chainlesschain 0.166.141 → 0.166.143

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/README.md +249 -14
  2. package/package.json +2 -2
  3. package/src/assets/linux-subreaper/linux-arm64/manifest.json +1 -1
  4. package/src/assets/linux-subreaper/linux-x64/manifest.json +1 -1
  5. package/src/assets/web-panel/assets/{AIOps-BefmcZw2.js → AIOps-DNySV2Kf.js} +1 -1
  6. package/src/assets/web-panel/assets/{ActionButton-BBlS9rmj.js → ActionButton-ByFuxJsa.js} +1 -1
  7. package/src/assets/web-panel/assets/{Analytics-DfNjXT9e.js → Analytics-ETbdywk5.js} +1 -1
  8. package/src/assets/web-panel/assets/{AppLayout-CIBZPPMS.js → AppLayout-CuHekZaP.js} +2 -2
  9. package/src/assets/web-panel/assets/{Artifacts-CE66rTTZ.js → Artifacts-BJJq2BDq.js} +1 -1
  10. package/src/assets/web-panel/assets/{Audit-DOC8Lt8U.js → Audit-DXrietv8.js} +1 -1
  11. package/src/assets/web-panel/assets/{BackgroundAgents-9TMG041Q.js → BackgroundAgents-CFB1fxsr.js} +1 -1
  12. package/src/assets/web-panel/assets/{Backup-us3KWb9F.js → Backup-VLtflRmp.js} +1 -1
  13. package/src/assets/web-panel/assets/{BaseInput-D6Q95Wr5.js → BaseInput-BbqBaS2r.js} +1 -1
  14. package/src/assets/web-panel/assets/{Chat-BPrM5ARp.js → Chat-t0g7BXL8.js} +1 -1
  15. package/src/assets/web-panel/assets/{ChatBubbleRenderer-Drs9vSc4.js → ChatBubbleRenderer-JNFsjV0j.js} +1 -1
  16. package/src/assets/web-panel/assets/{Checkbox-DqZGMV0o.js → Checkbox-BCSclHQb.js} +1 -1
  17. package/src/assets/web-panel/assets/{Codegen-CmolL6wr.js → Codegen-BcyINEHT.js} +1 -1
  18. package/src/assets/web-panel/assets/{Col-BwHSmoYQ.js → Col-C-0WNlwS.js} +1 -1
  19. package/src/assets/web-panel/assets/{Community-DGWqobpd.js → Community-DxZeoORX.js} +1 -1
  20. package/src/assets/web-panel/assets/{Compact-t_yy09-r.js → Compact-BNnX4jpz.js} +1 -1
  21. package/src/assets/web-panel/assets/{Compliance-D0S8-EsN.js → Compliance-KnjHtn9C.js} +1 -1
  22. package/src/assets/web-panel/assets/{Cowork-Y1LiuRwP.js → Cowork-CDyCrhbX.js} +1 -1
  23. package/src/assets/web-panel/assets/{Cron-FTqEw7QV.js → Cron-DxpS3D1G.js} +1 -1
  24. package/src/assets/web-panel/assets/{Crosschain-C3rPZ4Qu.js → Crosschain-BSzTZYyc.js} +1 -1
  25. package/src/assets/web-panel/assets/{DID-Ba2zySM-.js → DID-Bfj9Vdne.js} +1 -1
  26. package/src/assets/web-panel/assets/{Dashboard-D6xyN2ND.js → Dashboard-CcERVdgo.js} +2 -2
  27. package/src/assets/web-panel/assets/{Dropdown-BF4QuXJw.js → Dropdown-BtYXAz6E.js} +1 -1
  28. package/src/assets/web-panel/assets/{EmailListRenderer-s9dUxq14.js → EmailListRenderer-fdCMeGXU.js} +1 -1
  29. package/src/assets/web-panel/assets/{EvolutionSettings-CoAKOfqZ.js → EvolutionSettings-LHxhcuF2.js} +1 -1
  30. package/src/assets/web-panel/assets/{FamilyGuardDashboard-CEznwH1c.js → FamilyGuardDashboard-MIgtLsos.js} +1 -1
  31. package/src/assets/web-panel/assets/{Federation-rIzOt8-a.js → Federation-9-TOztwa.js} +1 -1
  32. package/src/assets/web-panel/assets/{FormItemContext-BARFiExr.js → FormItemContext-BKcwEE6w.js} +1 -1
  33. package/src/assets/web-panel/assets/{GenericCardRenderer-DI0A4swS.js → GenericCardRenderer-DJBPVUK2.js} +1 -1
  34. package/src/assets/web-panel/assets/{Git-DdmysND4.js → Git-C_XYISjG.js} +1 -1
  35. package/src/assets/web-panel/assets/{Governance-DrdhwUz2.js → Governance-DWsbPrwq.js} +1 -1
  36. package/src/assets/web-panel/assets/{Inference-Scm8tumd.js → Inference-D0_bYket.js} +1 -1
  37. package/src/assets/web-panel/assets/{KnowledgeGraph-_6bgPs4W.js → KnowledgeGraph-BoA3VQlw.js} +1 -1
  38. package/src/assets/web-panel/assets/{Logs-DW_v7bSo.js → Logs-LEGItChf.js} +1 -1
  39. package/src/assets/web-panel/assets/{MarkdownRenderer-7JABuv1j.js → MarkdownRenderer-DOHVc-Uw.js} +1 -1
  40. package/src/assets/web-panel/assets/{Marketplace-0h3YSvME.js → Marketplace-BKovl9NH.js} +1 -1
  41. package/src/assets/web-panel/assets/{McpTools-Byrg0Y3e.js → McpTools-D61ktoGb.js} +1 -1
  42. package/src/assets/web-panel/assets/{Memory-Cyoq-o29.js → Memory-CllorS0l.js} +1 -1
  43. package/src/assets/web-panel/assets/{MobileBridge-ISIlploU.js → MobileBridge-D-dJ78bk.js} +1 -1
  44. package/src/assets/web-panel/assets/{MobileProjects-04EncaRx.js → MobileProjects-CaxMKkd3.js} +1 -1
  45. package/src/assets/web-panel/assets/{Mtc-BMzkpyOF.js → Mtc-qEc62Qsx.js} +1 -1
  46. package/src/assets/web-panel/assets/{MtcAudit-Cx7BR5sz.js → MtcAudit-BY68jOZJ.js} +1 -1
  47. package/src/assets/web-panel/assets/{Multisig-D4pmkSX4.js → Multisig-eCCR8ELt.js} +1 -1
  48. package/src/assets/web-panel/assets/{NLProgramming-CCfaaWNu.js → NLProgramming-VtGv8pky.js} +1 -1
  49. package/src/assets/web-panel/assets/{Notes-Mq-1ZyaH.js → Notes-CPkYQySe.js} +1 -1
  50. package/src/assets/web-panel/assets/{NotificationSettings-rzf5V1TR.js → NotificationSettings-BuAvlHUu.js} +1 -1
  51. package/src/assets/web-panel/assets/{OrderTableRenderer-OREUs5ue.js → OrderTableRenderer-CLf_HAGv.js} +1 -1
  52. package/src/assets/web-panel/assets/{Organization-BQfOATgw.js → Organization-DjujhMbD.js} +1 -1
  53. package/src/assets/web-panel/assets/{Overflow-D7Pa6aaA.js → Overflow-RznznTS4.js} +1 -1
  54. package/src/assets/web-panel/assets/{P2P-CaJ79ZsC.js → P2P-DSa5ot0t.js} +1 -1
  55. package/src/assets/web-panel/assets/{PdhVaultBrowser-CtimQQN3.js → PdhVaultBrowser-oSEh6vkf.js} +2 -2
  56. package/src/assets/web-panel/assets/{Permissions-AzmmkLZ0.js → Permissions-CdOZguX9.js} +1 -1
  57. package/src/assets/web-panel/assets/{PersonalDataHub-BRU8ME7z.js → PersonalDataHub-B4--6iEF.js} +1 -1
  58. package/src/assets/web-panel/assets/{Pipeline-BnNqutXh.js → Pipeline-BnI57jE8.js} +1 -1
  59. package/src/assets/web-panel/assets/{Privacy-gMyZcxsz.js → Privacy-C8MId3ad.js} +1 -1
  60. package/src/assets/web-panel/assets/{ProjectInit-CkK-Fvr0.js → ProjectInit-DPGyYO8a.js} +1 -1
  61. package/src/assets/web-panel/assets/{ProjectSettings-CGY_uiIX.js → ProjectSettings-qBMqaJaO.js} +1 -1
  62. package/src/assets/web-panel/assets/{Projects-DBNC7xXG.js → Projects-Bq87Syce.js} +1 -1
  63. package/src/assets/web-panel/assets/{Providers-BVgWawtE.js → Providers-CVuG9Ugf.js} +1 -1
  64. package/src/assets/web-panel/assets/{QrScannerModal-DZILESCa.js → QrScannerModal-C94c8m3q.js} +1 -1
  65. package/src/assets/web-panel/assets/{QuickAsk-DwRBzFWW.js → QuickAsk-BvfsXZ8s.js} +1 -1
  66. package/src/assets/web-panel/assets/{Recommend-B3VxvUih.js → Recommend-CoezBYH9.js} +1 -1
  67. package/src/assets/web-panel/assets/{RemoteSession-DM74lufU.js → RemoteSession-CcYC4v3u.js} +1 -1
  68. package/src/assets/web-panel/assets/{Reputation-DOOEuGHh.js → Reputation-diDbL4cO.js} +1 -1
  69. package/src/assets/web-panel/assets/{Row-BZJYAo0S.js → Row-5qp3_fNS.js} +1 -1
  70. package/src/assets/web-panel/assets/{RssFeed-CYw44jcD.js → RssFeed-BCsMvpV4.js} +1 -1
  71. package/src/assets/web-panel/assets/{Search-CbypjDNG.js → Search-Br9nVxOp.js} +1 -1
  72. package/src/assets/web-panel/assets/{Security-0rSBDrXh.js → Security-BdOUzRfA.js} +1 -1
  73. package/src/assets/web-panel/assets/{Services-kqP79CBD.js → Services-Cp9TqzyN.js} +1 -1
  74. package/src/assets/web-panel/assets/{Skeleton-BjxvGVfI.js → Skeleton-DSdWsUMR.js} +1 -1
  75. package/src/assets/web-panel/assets/{Skills-SOoWyPCO.js → Skills-DRczAMTe.js} +1 -1
  76. package/src/assets/web-panel/assets/{Sla-kdRVAT19.js → Sla-B6G_Vd8N.js} +1 -1
  77. package/src/assets/web-panel/assets/{SpeechSettings-DILtcMaJ.js → SpeechSettings-BCcLx5x4.js} +1 -1
  78. package/src/assets/web-panel/assets/{SyncSettings-C98Jauc4.js → SyncSettings-BFhwtxCp.js} +1 -1
  79. package/src/assets/web-panel/assets/{Tasks-Bw-KaQAs.js → Tasks-DGRE6VHO.js} +1 -1
  80. package/src/assets/web-panel/assets/{Templates-CDJ027Hd.js → Templates-CJkJRFzd.js} +1 -1
  81. package/src/assets/web-panel/assets/{Tenant-BqNV62UA.js → Tenant-CAOv6p00.js} +1 -1
  82. package/src/assets/web-panel/assets/{Terminal-B8aQ3GLO.js → Terminal-CDrwwrKj.js} +1 -1
  83. package/src/assets/web-panel/assets/{TimelineRenderer-BSpccq11.js → TimelineRenderer-DI0YE2SN.js} +1 -1
  84. package/src/assets/web-panel/assets/{Tokens-BbGMoFO6.js → Tokens-DmqWTZSG.js} +1 -1
  85. package/src/assets/web-panel/assets/{Trigger-D75Mawa_.js → Trigger-CkXkhmjk.js} +1 -1
  86. package/src/assets/web-panel/assets/{Trust-BiK_Pk05.js → Trust-U8YJLcoJ.js} +1 -1
  87. package/src/assets/web-panel/assets/{UkeySign-Dv2xX_b9.js → UkeySign-BLTozMmr.js} +1 -1
  88. package/src/assets/web-panel/assets/{VideoEditing-CdBWfeEE.js → VideoEditing-DHKyFlZa.js} +1 -1
  89. package/src/assets/web-panel/assets/{Wallet-Cvrp4agg.js → Wallet-DapBxIQt.js} +1 -1
  90. package/src/assets/web-panel/assets/{WebAuthn-D0Htlf3v.js → WebAuthn-CkvG3yOr.js} +1 -1
  91. package/src/assets/web-panel/assets/{WorkflowEditor-nuUBOHIF.js → WorkflowEditor-cNLsinXP.js} +1 -1
  92. package/src/assets/web-panel/assets/{chat-C6MLShIo.js → chat-BzgkgfMC.js} +1 -1
  93. package/src/assets/web-panel/assets/{colors-9G5FqFOC.js → colors-BPpVKQsb.js} +1 -1
  94. package/src/assets/web-panel/assets/{compact-item-0M49EurU.js → compact-item-zepznuTv.js} +1 -1
  95. package/src/assets/web-panel/assets/{createContext-CiDDLED_.js → createContext-BRto-SQH.js} +1 -1
  96. package/src/assets/web-panel/assets/{hasIn-wZvUczmn.js → hasIn-CqsmU_n6.js} +1 -1
  97. package/src/assets/web-panel/assets/{index-B0JZ_ccM.js → index-B-bNzvdU.js} +1 -1
  98. package/src/assets/web-panel/assets/{index-B_XOMujL.js → index-B0Z6rfV-.js} +1 -1
  99. package/src/assets/web-panel/assets/{index-DwX9cOL6.js → index-B9_jRD2e.js} +1 -1
  100. package/src/assets/web-panel/assets/{index-DwUOiN8M.js → index-BEXKES7V.js} +1 -1
  101. package/src/assets/web-panel/assets/{index-8jz-X3xg.js → index-BGHd4D8F.js} +1 -1
  102. package/src/assets/web-panel/assets/{index-BVV2mBbo.js → index-BLwY9y0X.js} +1 -1
  103. package/src/assets/web-panel/assets/{index-qJcOtd8J.js → index-B_l6gfDh.js} +1 -1
  104. package/src/assets/web-panel/assets/{index-B6TAOS4G.js → index-BeBxP1M6.js} +1 -1
  105. package/src/assets/web-panel/assets/{index-C63qiwQz.js → index-BeSzdB7x.js} +1 -1
  106. package/src/assets/web-panel/assets/{index-k0BVfcwQ.js → index-BuBnM6Kz.js} +1 -1
  107. package/src/assets/web-panel/assets/{index-BXIY2BIN.js → index-Bz7pG8z3.js} +1 -1
  108. package/src/assets/web-panel/assets/{index-D51V5vmz.js → index-CBI-7Q3W.js} +1 -1
  109. package/src/assets/web-panel/assets/{index-BWTcG128.js → index-CTk9gY88.js} +1 -1
  110. package/src/assets/web-panel/assets/{index-sBsJaBmM.js → index-CdHXVSZ4.js} +1 -1
  111. package/src/assets/web-panel/assets/{index-Dclwd_lj.js → index-CmPnDXx4.js} +1 -1
  112. package/src/assets/web-panel/assets/{index-BlcOkfzz.js → index-CnezE05k.js} +1 -1
  113. package/src/assets/web-panel/assets/{index-DOxTmc3k.js → index-CwkhrUmw.js} +1 -1
  114. package/src/assets/web-panel/assets/{index-Cs66y4oC.js → index-CzoKAiyT.js} +3 -3
  115. package/src/assets/web-panel/assets/{index-BzeA3eRQ.js → index-DDPmr5Yr.js} +1 -1
  116. package/src/assets/web-panel/assets/{index-CdaLWIz-.js → index-DEbAW3Ec.js} +1 -1
  117. package/src/assets/web-panel/assets/{index-DvWRS-s7.js → index-DJSn3owP.js} +1 -1
  118. package/src/assets/web-panel/assets/{index-DN9t1qjW.js → index-DKa_jSfj.js} +1 -1
  119. package/src/assets/web-panel/assets/{index-BTCIIdoS.js → index-DUclk35X.js} +1 -1
  120. package/src/assets/web-panel/assets/{index-BmS2P_eX.js → index-DXkw-nt5.js} +1 -1
  121. package/src/assets/web-panel/assets/{index-CoxzvhoN.js → index-D_-w4KkD.js} +1 -1
  122. package/src/assets/web-panel/assets/{index-Cz1SAgnb.js → index-D_asIcU7.js} +1 -1
  123. package/src/assets/web-panel/assets/{index-BfwJm0DU.js → index-Df_CY0We.js} +1 -1
  124. package/src/assets/web-panel/assets/{index-JhfNEldK.js → index-Dnvj_XU-.js} +1 -1
  125. package/src/assets/web-panel/assets/index-DruOFzuF.js +1 -0
  126. package/src/assets/web-panel/assets/{index-D9J_tLGk.js → index-DvGttIXQ.js} +1 -1
  127. package/src/assets/web-panel/assets/{index-DcZxOXd8.js → index-JrVhUwyh.js} +1 -1
  128. package/src/assets/web-panel/assets/{index-CdUmgLxP.js → index-LVvzNdPa.js} +1 -1
  129. package/src/assets/web-panel/assets/{index-CTy9gD3m.js → index-Q5sAV7wp.js} +1 -1
  130. package/src/assets/web-panel/assets/{index-CtbFv3Et.js → index-S8fkzbQ_.js} +1 -1
  131. package/src/assets/web-panel/assets/{index-BCfxxScC.js → index-Z6DBe2RU.js} +1 -1
  132. package/src/assets/web-panel/assets/{index-dJ_V_Fqy.js → index-faHHtBKj.js} +1 -1
  133. package/src/assets/web-panel/assets/index-hhOrZ6HO.js +1 -0
  134. package/src/assets/web-panel/assets/{index-DeHSwWVG.js → index-w36TkwyO.js} +1 -1
  135. package/src/assets/web-panel/assets/{index-D2wN6VIq.js → index-wbvZayBb.js} +1 -1
  136. package/src/assets/web-panel/assets/{initDefaultProps-DyIyjurJ.js → initDefaultProps-BlhbrsQk.js} +1 -1
  137. package/src/assets/web-panel/assets/{motion-B2D0PuTM.js → motion-UZx12NPM.js} +1 -1
  138. package/src/assets/web-panel/assets/{move-B22T5MnN.js → move-BTby5W4q.js} +1 -1
  139. package/src/assets/web-panel/assets/{mtc-parser-i4b7HNzF.js → mtc-parser-BOOaGiCg.js} +1 -1
  140. package/src/assets/web-panel/assets/{omit-ByNIr_gz.js → omit-BVylGzEr.js} +1 -1
  141. package/src/assets/web-panel/assets/{pickAttrs-_xP2RvxA.js → pickAttrs-Cp3Nflbr.js} +1 -1
  142. package/src/assets/web-panel/assets/{placementArrow-CVDvzK0z.js → placementArrow-BVXYvwH2.js} +1 -1
  143. package/src/assets/web-panel/assets/{responsiveObserve-CI1toXJ_.js → responsiveObserve-C67SbpBN.js} +1 -1
  144. package/src/assets/web-panel/assets/{slide-2_VosSRQ.js → slide-CnBvM22R.js} +1 -1
  145. package/src/assets/web-panel/assets/{statusUtils-CMiWWrZC.js → statusUtils-T8fy53tf.js} +1 -1
  146. package/src/assets/web-panel/assets/{styleChecker-DY8wTVCe.js → styleChecker-Bf7i4nlm.js} +1 -1
  147. package/src/assets/web-panel/assets/{useFlexGapSupport-DkdcgIyl.js → useFlexGapSupport-BUKk7jqw.js} +1 -1
  148. package/src/assets/web-panel/assets/{useFs-gpl11PEF.js → useFs-T5lg6SpD.js} +1 -1
  149. package/src/assets/web-panel/assets/{usePersonalDataHub-DqnQ0H9y.js → usePersonalDataHub-Brvye8Tg.js} +1 -1
  150. package/src/assets/web-panel/assets/{vnode-CgY9xUvr.js → vnode-CK992ojP.js} +1 -1
  151. package/src/assets/web-panel/assets/{zoom-Ch0jan5_.js → zoom-CcABB_97.js} +1 -1
  152. package/src/assets/web-panel/index.html +1 -1
  153. package/src/command-help-index.json +1 -1
  154. package/src/commands/goal.js +340 -145
  155. package/src/commands/setup.js +17 -0
  156. package/src/data/changelog.json +26 -0
  157. package/src/lib/llm-onboarding-catalog.json +4 -3
  158. package/src/lib/plugin-runtime/cli-goal-capabilities.js +29 -0
  159. package/src/lib/plugin-runtime/cli-goal-draft-request.js +25 -15
  160. package/src/lib/plugin-runtime/cli-goal-drafts.js +78 -35
  161. package/src/lib/plugin-runtime/cli-goal-event-history.js +284 -0
  162. package/src/lib/plugin-runtime/cli-goal-events.js +175 -0
  163. package/src/lib/plugin-runtime/cli-goal-extension-host.js +21 -13
  164. package/src/lib/plugin-runtime/cli-project-goal-events.js +212 -0
  165. package/src/lib/plugin-runtime/examples/goal-project-observer/plugin.json +20 -0
  166. package/src/lib/plugin-runtime/examples/goal-status-observer/plugin.json +17 -0
  167. package/src/lib/plugin-runtime/examples/goal-task-creator/README.md +60 -0
  168. package/src/lib/plugin-runtime/examples/goal-task-creator/plugin.json +13 -0
  169. package/src/lib/plugin-runtime/examples/project-delivery-assistant/README.md +125 -0
  170. package/src/lib/plugin-runtime/examples/project-delivery-assistant/plugin.json +8 -8
  171. package/src/lib/plugin-runtime/goal-extensions.js +17 -0
  172. package/src/lib/project-goal-connection.js +126 -30
  173. package/src/lib/project-goal-draft-connection.js +18 -11
  174. package/src/assets/web-panel/assets/index-C101Sec6.js +0 -1
  175. package/src/assets/web-panel/assets/index-D23TaGOp.js +0 -1
package/README.md CHANGED
@@ -1,20 +1,70 @@
1
1
  # chainlesschain CLI
2
2
 
3
+ 工作树待发布补充:两端 IDE 新增力数/vLLM/SGLang 等本地算力平台入口,使用 `custom` OpenAI 兼容路径,可选平台密钥并显式确认局域网 HTTP。CLI 原子保存与首次设置在更换无密钥平台地址时不复用旧端点密钥;详见 [DMM 当前证据](../../docs/research/agents/evidence/dmm-volcengine-live-2026-11-06/README.md)。此说明不改变下文公开版本及发行限制。
4
+
3
5
  Command-line interface for installing, configuring, and managing [ChainlessChain](https://www.chainlesschain.com), including the coding agent, governed tools, sessions, memory, and IDE integrations.
4
6
 
5
- <!-- release141-pairing:start -->
7
+ ## CLI 0.166.143 / local compute and controlled task-creation drafts
8
+
9
+ Release candidate pairing: Session Core **0.3.26**, CLI **0.166.143**, Open VSX
10
+ **0.37.179** and JetBrains **0.4.196**. Both IDEs add a Local compute / OpenAI
11
+ compatible option for LEXDATA, vLLM and SGLang, with explicit endpoint/model,
12
+ optional platform key and HTTP consent. Atomic configuration and first-run setup
13
+ do not carry a previous endpoint credential to a new keyless platform.
14
+
15
+ The CLI/IDE goal tools add explicit file/v6 pending task-creation requests and
16
+ the admitted data-only project-delivery-assistant 0.3.0. They require matching
17
+ desktop source support and separate native source/creation consent. Published
18
+ clients have not been upgraded by this CLI/IDE release. Model drafting remains
19
+ in the desktop source; the new IDE option configures chat/CLI connectivity.
20
+
21
+ The candidate passed 374 focused tests and 22 local checks. Two synthetic real
22
+ Volcengine drafts consumed 1,176 tokens, with cost unknown; these are engineering
23
+ samples, not independent business-effect acceptance. LEXDATA's supplied API
24
+ currently resets discovery connections, so actual LEXDATA inference is unverified.
25
+ Real IDE/Electron GUI acceptance remains separate.
26
+
27
+ Publication requires the exact source's complete Linux/Windows/macOS CLI CI and
28
+ Strict Sandbox results, then Actions OIDC upstream publication/readback before
29
+ CLI and IDE publication. Once verified, install
30
+ `npm i -g chainlesschain@0.166.143 --registry https://registry.npmjs.org`.
31
+ Current release-stage results are tracked in
32
+ [release143 evidence](../../docs/research/cli/evidence/release143-public/README.md).
33
+
34
+ ## CLI 0.166.142 / authorized goal events and history
35
+
36
+ Release pairing: Session Core **0.3.25**, CLI **0.166.142**, Open VSX **0.37.178**
37
+ and JetBrains **0.4.195**. This adds authorized goal observation, transactional
38
+ retained history, durable replay checkpoints, explicit recovery in both IDEs and
39
+ the data-only `project-delivery-assistant` 0.2.0 scenario. Separate desktop consent
40
+ and native confirmation remain required; replay is at least once and does not
41
+ prove business completion. Real GUI/business-effect evaluation remains separate.
42
+
43
+ Publication requires exact-source three-OS CLI CI / Strict Sandbox and OIDC.
44
+ Publish and verify Session Core first, then CLI, then IDE extensions. After public
45
+ verification install `npm i -g chainlesschain@0.166.142 --registry https://registry.npmjs.org`.
46
+ PC/mobile releases follow the verified IDE stage. The block below retains the
47
+ previous verified public pairing.
48
+
49
+ <!-- release141-current:start -->
50
+
51
+ ## CLI 0.166.141 / verified public pairing
6
52
 
7
- ## CLI 0.166.141 / complete source preview recovery
53
+ CLI **0.166.141** is public through GitHub Actions OIDC. Open VSX **0.37.177** and JetBrains **0.4.194** are public and both recommend CLI **0.166.141**. CLI public bytes, signed provenance, registry-only `--ignore-scripts` installation and the Agent capability startup probe passed. Both public IDE payloads match their official builds.
8
54
 
9
- Release candidate **0.166.141** preserves legitimate source spread expressions in complete file-read previews and keeps read-recovery guidance actionable. Launcher-owned hermetic evaluations use the same exact mutation scope through the CLI and IDE gateway; ordinary interactive permissions and the IDE protocol retain their existing behavior.
55
+ Exact release source:`df9295e33ad04aec0aa74cab4dd242766d5556a4`。CLI CI **76/76** / Strict Sandbox **6/6** passed across Linux, Windows and macOS.
10
56
 
11
- The intended pairing is VS Code **0.37.177** and JetBrains **0.4.194**. Child npm versions are unchanged. Publication remains pending until this exact source passes every configured Linux, Windows and macOS CLI CI / CLI Strict Sandbox job, then GitHub Actions OIDC publishes and verifies the public npm archive. IDE publication follows verified CLI installation.
57
+ This release preserves valid spread expressions in complete source previews, keeps read recovery actionable, and shares launcher-owned exact file scope across CLI and IDE evaluations. The diagnostic broker rejects a formal budget scope before reading options. Existing interactive permissions, IDE protocol and finite diagnostic limits remain.
12
58
 
13
- After public availability is verified, install `npm i -g chainlesschain@0.166.141 --registry https://registry.npmjs.org`, restart the CLI and IDE hosts, and run `cc --version` and `cc doctor`.
59
+ Install `npm i -g chainlesschain@0.166.141 --registry https://registry.npmjs.org`; restart CLI / IDE chat hosts, then run `cc --version` and `cc doctor`.
14
60
 
15
- This release does not run additional model-task retests or rescore historical results. Volcengine historical coverage remains 36/45 with its original qualification limits; the latest complete round is 24/45. Sol original-project history is 41/45, the latest repaired-source four-case cohort is 2/4, and cross-version coverage is 45/45. Diagnostic future budgets remain finite; these are not automatic increases to ordinary user requests.
61
+ No additional model-task retests were run. Volcengine corrected .140 round: generation **39/45**, strict acceptance **24/45**; historical automatic-deliverable union **36/45**, with **9** remaining and the verify-06 candidate-only qualification preserved. Sol original frozen-project history **41/45**, cross-version coverage including repaired sources **45/45**, and the separate .140 repaired-project four-case result **2/4** retain distinct scopes.
16
62
 
17
- <!-- release141-pairing:end -->
63
+ [Publication evidence](../../docs/research/cli/evidence/release141-public/README.md) · [45-task ledger](../../docs/research/cli/verify01-36-plus-9-task-list.md)
64
+
65
+ SDK **0.2.17**, Protocol **0.1.12**, Kernel **0.1.11** and child npm versions are unchanged; public child bytes and dependency installation were verified before CLI publication. PC/mobile **v5.0.3.144** remain independent. Microsoft Marketplace is deferred. NOT_PAID_READY / NOT_ADMITTED / HOLD remain.
66
+
67
+ <!-- release141-current:end -->
18
68
 
19
69
  <!-- release140-pairing:start -->
20
70
 
@@ -2714,6 +2764,105 @@ cc plugin consent goal-progress-viewer --scope project --grant --json
2714
2764
  cc goal panels <id> --plugin goal-progress-viewer --scope project
2715
2765
  ```
2716
2766
 
2767
+ The working tree also supports a bounded, explicitly started **standalone goal
2768
+ status observer**. This addition is unreleased; use the local CLI source:
2769
+
2770
+ ```bash
2771
+ node packages/cli/bin/chainlesschain.js plugin add packages/cli/src/lib/plugin-runtime/examples/goal-status-observer --scope project --json
2772
+ node packages/cli/bin/chainlesschain.js plugin trust goal-status-observer --scope project
2773
+ node packages/cli/bin/chainlesschain.js plugin consent goal-status-observer --scope project --grant --json
2774
+ node packages/cli/bin/chainlesschain.js goal watch <id> --plugin goal-status-observer --scope project --expected-store <catalog-store-id> --interval 1000 --duration 60 --json
2775
+ ```
2776
+
2777
+ Run these commands from the repository root. `watch` prints a `ready` record,
2778
+ then newline-delimited JSON for observed `goal.status.changed` transitions.
2779
+ It polls every 1000 ms for 60 seconds by default (interval 250–60000 ms,
2780
+ duration 1–900 seconds). Ctrl+C stops it. Every poll rechecks plugin trust,
2781
+ consent and policy; revocation, uninstall or an invalid source stops the stream.
2782
+ Events contain status transitions and versioned goal references, without the
2783
+ objective or task body. This is polling with no history replay: intermediate
2784
+ transitions may be missed and timestamps describe observation time. A new run
2785
+ starts from the current state. Existing summary/evidence/draft connections grant
2786
+ no event access. IDE event UI still requires separate work.
2787
+
2788
+ The working tree additionally supports a separately authorized **desktop event
2789
+ connection**. In the desktop goal connection panel choose the dedicated risk/action
2790
+ event authorization, approve the native dialog, and save a new private connection
2791
+ file. This exports v4 `goal.events`; it contains no goal objective and cannot be
2792
+ used for goal catalogs, panels or drafts. From the repository root:
2793
+
2794
+ ```bash
2795
+ node packages/cli/bin/chainlesschain.js plugin add packages/cli/src/lib/plugin-runtime/examples/goal-project-observer --scope project --json
2796
+ node packages/cli/bin/chainlesschain.js plugin trust goal-project-observer --scope project
2797
+ node packages/cli/bin/chainlesschain.js plugin consent goal-project-observer --scope project --grant --json
2798
+ node packages/cli/bin/chainlesschain.js goal watch <goal-id> --connection "<event-connection.json>" --plugin goal-project-observer --scope project --duration 60 --json
2799
+ ```
2800
+
2801
+ After `ready`, this observer emits `risk.review.completed` and
2802
+ `action.receipt.updated` summaries when new native evidence is observed. Baseline
2803
+ history is not replayed. Reads remain bounded to the latest persisted risk check
2804
+ and latest 20 receipts, so intermediate changes can be missed. Timestamps describe
2805
+ observation time, and neither a check nor an action receipt proves goal completion.
2806
+ Disconnect, logout, navigation, target revision, expiry or authorization changes
2807
+ stop the observer. Snapshot changes during projection also stop it; explicitly
2808
+ restart to observe the current state. The 15-minute connection and 512-read quota
2809
+ can end a watch before its requested duration. Cancellation interrupts pending HTTP.
2810
+ This source capability is unreleased and does not add durable event replay.
2811
+
2812
+ Matching working-tree VS Code and JetBrains builds expose **Observe desktop
2813
+ events…** in the plugin manager. Select the admitted observer plugin, choose the
2814
+ v4 file with the native picker and enter the goal ID shown in the desktop. The
2815
+ IDE starts a fixed 60-second watch, validates the NDJSON target/plugin binding,
2816
+ and shows only the latest 50 plain text observations. **Stop and clear**, plugin
2817
+ operations, refresh or closing the manager stop the owned CLI process and reject
2818
+ late output. These entries need local matching builds; real IDE GUI acceptance
2819
+ and cross-platform release gates remain separate.
2820
+
2821
+ The working tree separately supports **retained event replay**. The desktop's
2822
+ **另行授权保留的事件历史** button exports a v5 `goal.event-history` connection.
2823
+ v1–v4 grants are not expanded, and v5 does not grant catalogs, panels, live watch
2824
+ or draft submission. Use the admitted `goal-project-observer` sample above:
2825
+
2826
+ ```bash
2827
+ node packages/cli/bin/chainlesschain.js goal replay <goal-id> --connection "<history-connection.json>" --checkpoint "<new-or-existing-checkpoint.json>" --plugin goal-project-observer --scope project --json
2828
+ ```
2829
+
2830
+ Run the same command again with the same checkpoint to read the next page. Each
2831
+ page scans at most 20 retained events and stays within 16 KiB. The checkpoint
2832
+ contains only the target/plugin/declaration binding and opaque cursor, with no
2833
+ credentials or event bodies. The command holds a strict file lock, acknowledges
2834
+ stdout, rechecks current native and plugin access, then atomically advances it.
2835
+ Exit zero means the checkpoint committed. A crash after output but before commit
2836
+ can repeat the same event IDs: delivery is **at least once**, and stdout acceptance
2837
+ does not prove downstream consumption. A failed write or revoked access does not
2838
+ advance the old cursor; no automatic retry or reconnect runs.
2839
+
2840
+ `--checkpoint-mode new` refuses an existing checkpoint; `--checkpoint-mode resume`
2841
+ requires the original file and never creates a replacement. The default `auto`
2842
+ keeps the existing create-or-resume CLI behavior. All modes check the binding
2843
+ and hold the same checkpoint lock through output and commit.
2844
+
2845
+ The journal retains the newest 1000 events per actor/goal and starts with the new
2846
+ instrumentation; earlier checks, old-version writes and other execution paths are
2847
+ not backfilled. The first page reports `truncated` when older journal entries were
2848
+ evicted. An expired cursor reports `GOAL_EVENT_HISTORY_GAP`; a cursor ahead of a
2849
+ restored database reports `GOAL_EVENT_HISTORY_REGRESSED`. Neither is silently reset.
2850
+ After an explicit new desktop authorization, reconnect with the new connection
2851
+ file and the same checkpoint for the same active goal revision and plugin. Changed
2852
+ identity, goal revision/control generation or plugin declaration requires a new
2853
+ explicit checkpoint; an opaque cursor never grants access.
2854
+
2855
+ Matching working-tree VS Code and JetBrains plugin managers expose **Recover
2856
+ retained history…**, with native v5 connection and new/resume checkpoint selection.
2857
+ **Read next page / check again** runs one explicit page. Results appear only after
2858
+ successful CLI exit and validation; cancellation clears continuation and warns
2859
+ that the checkpoint may already have advanced. Keep it and explicitly resume.
2860
+ The IDE never reads credentials or checkpoint bodies. Real GUI acceptance is pending.
2861
+ This unreleased change requires matching Session Core, CLI and desktop sources.
2862
+ Release the required child package first, verify
2863
+ the exact three-OS CLI gates and OIDC publication, then align downstream IDE/client
2864
+ releases; local replay tests are not a release gate.
2865
+
2717
2866
  VS Code and JetBrains expose **CLI goal panels…** in the plugin manager. Select
2718
2867
  a goal from the native paged picker, or choose **Enter goal ID…**. The picker uses
2719
2868
  `goal catalog --json`; its opaque `nextCursor` continues with `--after <cursor>`.
@@ -2726,14 +2875,24 @@ the manual-ID path when catalog discovery is unavailable.
2726
2875
 
2727
2876
  Refresh or a new read checks current source and plugin authorization. Standalone
2728
2877
  goals provide objective/status snapshots. Historical project risk and receipt
2729
- summaries require the separate desktop evidence connection below. The broader
2730
- `project-delivery-assistant` example still requires a project host adapter.
2878
+ summaries require the separate desktop evidence connection below.
2879
+
2880
+ The working-tree [`project-delivery-assistant` 0.2.0 scenario package](src/lib/plugin-runtime/examples/project-delivery-assistant/README.md)
2881
+ now combines those evidence panels, standalone status / native risk-receipt
2882
+ observations, retained replay and pending description drafts under one installed
2883
+ plugin. Install its directory, then explicitly trust it and consent to its full
2884
+ declared capability set. Each operation still needs the separate source/connection
2885
+ for that surface; an evidence connection cannot watch events or submit drafts.
2886
+ The same installed plugin works with both IDE plugin managers. Installation and
2887
+ reinstallation do not start an observer, retry or business action. Use matching
2888
+ local CLI/Desktop/Session Core sources; these additions are unreleased. The
2889
+ package does not yet offer task-creation proposals or automatic drafting.
2731
2890
 
2732
2891
  The working-tree SDK now shares its proposal contract with Session Core's native
2733
2892
  pending-draft queue. A trusted-host SQLite integration verifies source and
2734
2893
  admission checks, idempotency and revocation; the CLI still has no authenticated
2735
2894
  live project write entry. The desktop's separately consented built-in delivery
2736
- draft rule is not an installed CLI plugin or the full `project-delivery-assistant`.
2895
+ draft rule is separate from the installed `project-delivery-assistant` scenario.
2737
2896
  The trusted desktop host can now explicitly convert a persisted draft into one
2738
2897
  native preview/intent, then use the existing native confirmation and receipt
2739
2898
  flow. Conversion IDs survive restart and lost responses; revocation blocks
@@ -2786,8 +2945,8 @@ not establish current risk or goal completion. Running actions remain unresolved
2786
2945
  The read path performs no initialization, recovery or usage settlement and
2787
2946
  exposes no task bodies, previews or approval evidence. Summary-only plugins
2788
2947
  cannot read evidence fields. Project writes and event subscriptions remain
2789
- unavailable through either connection. The complete `project-delivery-assistant`
2790
- example still requires those additional host capabilities.
2948
+ unavailable through either connection. The combined `project-delivery-assistant`
2949
+ uses separate v3 draft, v4 event and v5 replay authorization for those surfaces.
2791
2950
 
2792
2951
  The working tree also supports **request-file handoff** for task descriptions.
2793
2952
  Install the proposal-only example and explicitly trust/consent it:
@@ -2823,6 +2982,32 @@ Native preview and a second explicit native confirmation remain required before
2823
2982
  task modification. Revoking adoption invalidates pending previews; it does not
2824
2983
  undo completed task changes. No versions have been published for this flow.
2825
2984
 
2985
+ The source build additionally supports **task-creation request files** using
2986
+ `goal-task-creator` and the separate `goal draft-create-request` command:
2987
+
2988
+ ```powershell
2989
+ cc plugin add packages/cli/src/lib/plugin-runtime/examples/goal-task-creator --scope project --json
2990
+ cc plugin trust goal-task-creator --scope project
2991
+ cc plugin consent goal-task-creator --scope project --grant --json
2992
+ cc goal draft-create-request <goal-id> --connection "<summary-connection.json>" --plugin goal-task-creator --scope project --source <current-native-creation-proposal-id> --request-id <stable-id> --title "Delivery follow-up" --task-type analyze_data --description-file "<utf8-description.txt>" --out "<new-create-request.json>" --json
2993
+ ```
2994
+
2995
+ This requires matching local CLI, Session Core and desktop sources; the published
2996
+ CLI 0.166.142 does not acquire this command through the manifest version floor.
2997
+ Use a current native `task.create` risk proposal ID. The exported schema
2998
+ `chainlesschain.goal-task-create-request/v1` is separate from the description-only
2999
+ file format. Desktop adoption reviews the full body and task type, saves this
3000
+ one pending request under `native-imported-task-create`, and requires a new
3001
+ native preview and a second explicit confirmation before creation. It does not
3002
+ execute the created task or prove that the source risk is resolved. The same
3003
+ request identity with a different task type conflicts; a revoked adoption cannot
3004
+ be revived by reimport. The existing online v3 bridge remains description-only.
3005
+ Matching source IDE builds now provide **Export
3006
+ task creation request…** using native type and file selections; combined assistant
3007
+ 0.3.0 declares this file-export capability after new version trust and expansion
3008
+ consent. A separate v6 CLI creation flow is described below. See the
3009
+ [source example](src/lib/plugin-runtime/examples/goal-task-creator/README.md).
3010
+
2826
3011
  The working tree additionally supports a separately authorized **online pending
2827
3012
  draft connection**. Export an access request for the same installed/trusted/
2828
3013
  consented proposal-only plugin:
@@ -2861,8 +3046,58 @@ review, native preview and explicit source revocation. Disconnecting preserves
2861
3046
  saved drafts and the grant across application restarts. Revoking the source
2862
3047
  invalidates its old drafts and pending previews; completed task receipts remain.
2863
3048
  Actual changes require a current preview and separate native confirmation.
2864
- Event subscriptions, the complete delivery assistant and real GUI acceptance
2865
- remain open. See local implementation evidence (`../../docs/research/agents/evidence/dmm-cli-online-drafts-2026-10-18/README.md`).
3049
+ The complete delivery assistant and real GUI acceptance remain open. See local
3050
+ implementation evidence (`../../docs/research/agents/evidence/dmm-cli-online-drafts-2026-10-18/README.md`).
3051
+
3052
+ The matching source CLI and desktop also support **online pending task-creation
3053
+ drafts** under a separate v6 `goal.create-drafts` connection. First allow
3054
+ `task.create` on the goal and run a fresh native risk check. Install, trust and
3055
+ consent `goal-task-creator` (or source assistant 0.3.0), then:
3056
+
3057
+ ```powershell
3058
+ cc goal draft-create-access --plugin goal-task-creator --scope project --out "<new-creation-access.json>" --json
3059
+ # Desktop: select “另行授权在线创建任务待审连接”, choose that access file,
3060
+ # inspect the native consent, and save a new private connection file.
3061
+ cc goal draft-create-sources <goal-id> --connection "<creation-v6.json>" --plugin goal-task-creator --scope project --expected-store <store-id> --json
3062
+ cc goal draft-create-send <goal-id> --connection "<creation-v6.json>" --plugin goal-task-creator --scope project --expected-store <store-id> --source <selected-creation-source-id> --request-id <stable-id> --title "Delivery follow-up" --task-type analyze_data --description-file "<utf8-text-file>" --record "<new-creation-submission.json>" --json
3063
+ cc goal draft-create-receipt <goal-id> --connection "<creation-v6.json>" --plugin goal-task-creator --scope project --expected-store <store-id> --record "<creation-submission.json>" --json
3064
+ ```
3065
+
3066
+ Creation access files use `chainlesschain.goal-create-draft-access/v1`; old
3067
+ description access files and connections are rejected. The native creation
3068
+ grant has its own identity and revocation epoch. Each command activates only
3069
+ its actual proposal capability, including when the plugin declares both types.
3070
+ Task type is fixed in the proposal digest and durable submission identity;
3071
+ changing it under the same request ID conflicts. `saved` means only a pending
3072
+ creation suggestion was stored. Desktop review, a current native preview and
3073
+ individual confirmation are still required to create one pending task.
3074
+
3075
+ Keep the body-free submission reference after `unknown`. Existing references
3076
+ are only queried, including after `not-found`, and never automatically resent.
3077
+ Reconnect the same unchanged creation grant to query again. Disconnect/restart
3078
+ preserves drafts; revocation invalidates unconfirmed drafts and previews while
3079
+ retaining completed receipts. Description grants do not authorize creation.
3080
+ Matching source VS Code and JetBrains builds provide **Export online creation
3081
+ access…**, **Submit pending creation…** and **Look up creation receipt…** with
3082
+ native connection/source/type/body/reference controls. Creation results require
3083
+ their own schemas and successful CLI exit before presentation. Closing the IDE
3084
+ or clearing results may leave a dispatched submission saved; keep the original
3085
+ reference and use the receipt action, without automatically resending it.
3086
+ Both IDEs also retain creation request-file export for per-file desktop adoption.
3087
+ This source capability is unpublished. See the
3088
+ [verification and status tables](../../docs/research/agents/evidence/dmm-online-create-2026-11-06/README.md).
3089
+
3090
+ Matching desktop sources also expose **本机模型起草(逐次原生授权)** in the goal
3091
+ actions panel. This is a separate on-demand native pipeline; CLI/IDE proposal
3092
+ commands continue to use the user-selected body. Select governed local Ollama
3093
+ with a literal `127.0.0.1` or `[::1]` endpoint in model settings, allow the goal's
3094
+ action type and run a fresh risk check. Select a current source/type; memory is
3095
+ off by default. Native consent shows the selected input and notes that governance
3096
+ evidence stores the prompt/response. Saved output still requires current preview
3097
+ and individual native task confirmation. Keep the model request ID after an
3098
+ interruption, and query it without generating a replacement automatically.
3099
+ Unknown cost stays unknown; finite token/cost budgets currently refuse dispatch.
3100
+ See [local adapter scope and evidence](../../docs/research/agents/evidence/dmm-local-model-drafts-2026-11-06/README.md).
2866
3101
 
2867
3102
  ### `chainlesschain permissions <action>` (alias: `perms`)
2868
3103
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chainlesschain",
3
- "version": "0.166.141",
3
+ "version": "0.166.143",
4
4
  "description": "CLI for ChainlessChain - install, configure, and manage your personal AI management system",
5
5
  "type": "module",
6
6
  "bin": {
@@ -108,7 +108,7 @@
108
108
  "@chainlesschain/core-mtc": "0.2.3",
109
109
  "@chainlesschain/core-multisig": "0.1.4",
110
110
  "@chainlesschain/personal-data-hub": "0.4.66",
111
- "@chainlesschain/session-core": "0.3.24",
111
+ "@chainlesschain/session-core": "0.3.26",
112
112
  "@chainlesschain/shared-logger": "0.1.1",
113
113
  "@inquirer/prompts": "^7.2.0",
114
114
  "@noble/curves": "^1.9.7",
@@ -6,5 +6,5 @@
6
6
  "imageDigest": "sha256:6395a47a5bd9b038303e94a5e93754258c8480dab64635460f973eb93dc6f4d8",
7
7
  "bytes": 778808,
8
8
  "linkage": "static",
9
- "commit": "df9295e33ad04aec0aa74cab4dd242766d5556a4"
9
+ "commit": "3fa3a4b258bbcb60b23b4298cec375661ad6f410"
10
10
  }
@@ -6,5 +6,5 @@
6
6
  "imageDigest": "sha256:f162e55ad3f3f72f8a52e9d7f12b5b8db44506c2ca66a14d7d62d5cd4f12498e",
7
7
  "bytes": 934160,
8
8
  "linkage": "static",
9
- "commit": "df9295e33ad04aec0aa74cab4dd242766d5556a4"
9
+ "commit": "3fa3a4b258bbcb60b23b4298cec375661ad6f410"
10
10
  }
@@ -1 +1 @@
1
- import{t as B,_ as Ye,u as We,b as Ze,d as m}from"./index-Cs66y4oC.js";import{R as Ge,at as He,A as re,j as ue,aY as de,b3 as Xe,c as et,f as tt}from"./icons-DlxlFL4g.js";import at from"./index-CdaLWIz-.js";import{o as ot,M as v,R as z,P as r,c as a,N as l,Q as C,S as y,K as b,r as x,L as d,O as c,u as k,F as R,Y as J,f as M,h as lt,a as H}from"./vendor-BXcBOG8b.js";import"./KeyCode-D63Tfrq7.js";import"./omit-ByNIr_gz.js";import"./pickAttrs-_xP2RvxA.js";import"./initDefaultProps-DyIyjurJ.js";import"./motion-B2D0PuTM.js";import"./raf-Deuc0E8-.js";import"./index-BVV2mBbo.js";import"./index-BCfxxScC.js";import"./isVisible-C7tPsqfj.js";import"./useState-Dlgl7fUg.js";import"./devWarning-CNIS3FrJ.js";import"./warning-Pq00owYb.js";import"./compact-item-0M49EurU.js";import"./createContext-CiDDLED_.js";import"./Compact-t_yy09-r.js";import"./_getTag-BVc6NQ_K.js";import"./styleChecker-DY8wTVCe.js";import"./zoom-Ch0jan5_.js";import"./ActionButton-BBlS9rmj.js";import"./vnode-CgY9xUvr.js";const pe=Object.freeze(["P0","P1","P2","P3"]),st=Object.freeze(["open","acknowledged","resolved","closed"]);function g(i,n=0){return typeof i=="number"&&Number.isFinite(i)?i:n}function it(i,n=0){if(!i||typeof i!="object")return null;const t=i.id||"";return t?{key:t,id:t,anomalyMetric:i.anomalyMetric??i.anomaly_metric??"",severity:String(i.severity||"P3"),status:String(i.status||"open").toLowerCase(),description:String(i.description||""),anomalyData:i.anomalyData??i.anomaly_data??null,remediationId:i.remediationId??i.remediation_id??null,postmortem:i.postmortem||"",acknowledgedAt:i.acknowledgedAt??i.acknowledged_at??null,resolvedAt:i.resolvedAt??i.resolved_at??null,createdAt:i.createdAt??i.created_at??null,_idx:n}:null}function nt(i){const n=B(i);return Array.isArray(n)?n.map(it).filter(Boolean):[]}function rt(i,n=0){if(!i||typeof i!="object")return null;const t=i.id||"";if(!t)return null;const _=i.enabled;let S=!1;return _===!0||_===1||_==="1"?S=!0:_===!1||_===0||_==="0"?S=!1:S=!!_,{key:t,id:t,name:String(i.name||""),triggerCondition:i.triggerCondition??i.trigger_condition??"",steps:i.steps||"",enabled:S,successCount:g(i.successCount??i.success_count,0),failureCount:g(i.failureCount??i.failure_count,0),createdAt:i.createdAt??i.created_at??null,_idx:n}}function ut(i){const n=B(i);return Array.isArray(n)?n.map(rt).filter(Boolean):[]}function dt(i,n=0){if(!i||typeof i!="object")return null;const t=i.metricName??i.metric_name??"";return t?{key:t,metricName:t,mean:g(i.mean,0),stdDev:g(i.stdDev??i.std_dev,0),q1:g(i.q1,0),q3:g(i.q3,0),sampleCount:g(i.sampleCount??i.sample_count,0),updatedAt:i.updatedAt??i.updated_at??null,_idx:n}:null}function pt(i){const n=B(i);return Array.isArray(n)?n.map(dt).filter(Boolean):[]}function ct(i){const n=B(i);return!n||typeof n!="object"||Array.isArray(n)?null:{anomaly:!!n.anomaly,reason:n.reason||null,metricName:n.metricName??n.metric_name??"",value:g(n.value,0),algorithm:String(n.algorithm||""),score:g(n.score,0),threshold:g(n.threshold,0),baseline:n.baseline?{mean:g(n.baseline.mean,0),stdDev:g(n.baseline.stdDev??n.baseline.std_dev,0),q1:g(n.baseline.q1,0),q3:g(n.baseline.q3,0)}:null,incidentId:n.incidentId??n.incident_id??null,severity:n.severity||null}}const mt={incidents:{total:0,bySeverity:{P0:0,P1:0,P2:0,P3:0},byStatus:{open:0,acknowledged:0,resolved:0,closed:0},avgResolveMs:0},playbooks:{total:0,enabled:0,totalSuccess:0,totalFailure:0},baselines:{total:0,metrics:[]}};function yt(i){const n=JSON.parse(JSON.stringify(mt)),t=B(i);if(!t||typeof t!="object"||Array.isArray(t))return n;if(t.incidents&&typeof t.incidents=="object"){if(n.incidents.total=g(t.incidents.total,0),n.incidents.avgResolveMs=g(t.incidents.avgResolveMs??t.incidents.avg_resolve_ms,0),t.incidents.bySeverity&&typeof t.incidents.bySeverity=="object")for(const _ of Object.keys(n.incidents.bySeverity))n.incidents.bySeverity[_]=g(t.incidents.bySeverity[_],0);if(t.incidents.byStatus&&typeof t.incidents.byStatus=="object")for(const _ of Object.keys(n.incidents.byStatus))n.incidents.byStatus[_]=g(t.incidents.byStatus[_],0)}return t.playbooks&&typeof t.playbooks=="object"&&(n.playbooks.total=g(t.playbooks.total,0),n.playbooks.enabled=g(t.playbooks.enabled,0),n.playbooks.totalSuccess=g(t.playbooks.totalSuccess??t.playbooks.total_success,0),n.playbooks.totalFailure=g(t.playbooks.totalFailure??t.playbooks.total_failure,0)),t.baselines&&typeof t.baselines=="object"&&(n.baselines.total=g(t.baselines.total,0),Array.isArray(t.baselines.metrics)&&(n.baselines.metrics=[...t.baselines.metrics])),n}function ce(i){if(i==null||i==="")return"—";const n=typeof i=="number"?new Date(i):new Date(String(i));return isNaN(n.getTime())?String(i):n.toLocaleString("zh-CN",{hour12:!1})}const ft={style:{display:"flex","align-items":"center","justify-content":"space-between","margin-bottom":"24px"}},vt={class:"page-title"},bt={class:"page-sub"},gt={style:{color:"var(--text-secondary)","font-size":"12px","margin-left":"8px"}},kt={class:"filter-bar"},_t={key:0,style:{color:"var(--text-primary)","font-family":"monospace","font-size":"12px"}},$t={key:1,style:{color:"var(--text-muted)"}},ht={key:2,style:{color:"var(--text-secondary)","font-size":"12px"}},Ct={key:4,style:{color:"var(--text-secondary)","font-size":"11px"}},xt={style:{padding:"40px",color:"var(--text-muted)","text-align":"center"}},St={style:{color:"var(--text-primary)","font-weight":"500"}},wt={key:0,style:{color:"var(--text-secondary)","font-size":"11px","margin-top":"2px","font-family":"monospace"}},zt={key:3,style:{color:"var(--text-secondary)","font-size":"11px"}},At={style:{padding:"40px",color:"var(--text-muted)","text-align":"center"}},Ft={key:0,style:{color:"var(--text-primary)","font-family":"monospace","font-weight":"500"}},Pt={style:{color:"#1677ff"}},Rt={style:{color:"var(--text-secondary)","margin-left":"4px","font-size":"11px"}},jt={key:2,style:{color:"var(--text-secondary)","font-size":"12px"}},It={key:4,style:{color:"var(--text-secondary)","font-size":"11px"}},Lt={style:{padding:"40px",color:"var(--text-muted)","text-align":"center"}},Nt={key:0,style:{color:"var(--text-secondary)","font-size":"12px","margin-top":"8px"}},Ot={key:1,style:{"margin-top":"12px","font-size":"12px",color:"var(--text-secondary)"}},Tt={key:2,style:{"margin-top":"8px"}},Ut={__name:"AIOps",setup(i){const n=We(),{t}=Ze(),_=x(!1),S=x(!1),X=x(!1),me=x([]),ye=x([]),ee=x([]),A=x({incidents:{total:0,bySeverity:{P0:0,P1:0,P2:0,P3:0},byStatus:{open:0,acknowledged:0,resolved:0,closed:0},avgResolveMs:0},playbooks:{total:0,enabled:0,totalSuccess:0,totalFailure:0},baselines:{total:0,metrics:[]}}),K=x("incidents"),q=x(""),D=x(""),V=x(!1),Q=x(!1),Y=x(!1),te=x(!1),w=H({severity:"P3",metric:"",description:""}),$=H({name:"",triggerJson:"",stepsJson:""}),I=H({metric:"",values:""}),F=H({metric:"",value:null,algorithm:"z_score"}),h=x(null),xe=M(()=>[{title:t("aiops.incidentCols.severity"),key:"severity",width:"90px"},{title:t("aiops.incidentCols.metric"),key:"metric",width:"160px"},{title:t("aiops.incidentCols.description"),key:"description"},{title:t("aiops.incidentCols.status"),key:"status",width:"100px"},{title:t("aiops.incidentCols.createdAt"),key:"createdAt",width:"160px"},{title:t("aiops.incidentCols.action"),key:"action",width:"220px"}]),Se=M(()=>[{title:t("aiops.playbookCols.name"),key:"name"},{title:t("aiops.playbookCols.enabled"),key:"enabled",width:"80px"},{title:t("aiops.playbookCols.stats"),key:"stats",width:"180px"},{title:t("aiops.playbookCols.createdAt"),key:"createdAt",width:"160px"},{title:t("aiops.playbookCols.action"),key:"action",width:"160px"}]),we=M(()=>[{title:t("aiops.baselineCols.metric"),key:"metric"},{title:t("aiops.baselineCols.mean"),key:"mean",width:"180px"},{title:t("aiops.baselineCols.iqr"),key:"iqr",width:"180px"},{title:t("aiops.baselineCols.sampleCount"),key:"sampleCount",width:"90px"},{title:t("aiops.baselineCols.updatedAt"),key:"updatedAt",width:"160px"}]),ze=M(()=>A.value.incidents.byStatus.open+A.value.incidents.byStatus.acknowledged),Ae=M(()=>{let e=me.value;return q.value&&(e=e.filter(o=>o.severity===q.value)),D.value&&(e=e.filter(o=>o.status===D.value)),e});function fe(e){const o=`aiops.statusLabels.${e}`,u=t(o);return u===o?e:u}function Fe(e){return{open:"red",acknowledged:"orange",resolved:"cyan",closed:"default"}[e]||"default"}function ae(e){return{P0:"red",P1:"volcano",P2:"orange",P3:"gold"}[e]||"default"}function Pe(e){const o=`aiops.reasonLabels.${e}`,u=t(o);return u===o?e:u}function ve(e,o){return e?e.length>o?e.slice(0,o)+"...":e:""}function Re(e){return!e||e<=0?t("aiops.duration.none"):e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:e<36e5?`${(e/6e4).toFixed(1)}min`:`${(e/36e5).toFixed(1)}h`}function je({key:e}){e==="incident"?V.value=!0:e==="playbook"?Q.value=!0:e==="baseline"?Y.value=!0:e==="detect"&&(h.value=null,te.value=!0)}async function j(){_.value=!0;try{const[e,o,u,f]=await Promise.all([n.execute("ops incidents --limit 200 --json",1e4).catch(()=>({output:""})),n.execute("ops playbooks --limit 200 --json",1e4).catch(()=>({output:""})),n.execute("ops baselines --json",1e4).catch(()=>({output:""})),n.execute("ops stats --json",8e3).catch(()=>({output:""}))]);me.value=nt(e.output),ye.value=ut(o.output),ee.value=pt(u.output),A.value=yt(f.output)}catch(e){m.error(t("aiops.msg.loadFailed")+": "+(e?.message||e))}finally{_.value=!1}}async function Ie(){if(!w.description.trim()){m.warning(t("aiops.msg.descEmpty"));return}S.value=!0;try{const e=[`ops incident-create --severity ${w.severity}`];w.metric.trim()&&e.push(`--metric "${w.metric.trim().replace(/"/g,'\\"')}"`),e.push(`--description "${w.description.trim().replace(/"/g,'\\"')}"`),e.push("--json");const{output:o}=await n.execute(e.join(" "),1e4);if(/error|失败/i.test(o)&&!/"incidentId"/.test(o)){m.error(t("aiops.msg.createFailed")+": "+o.slice(0,120));return}m.success(t("aiops.msg.incidentCreated")),V.value=!1,ge(),await j()}catch(e){m.error(t("aiops.msg.createFailed")+": "+(e?.message||e))}finally{S.value=!1}}async function Le(){if(!$.name.trim()){m.warning(t("aiops.msg.playbookNameEmpty"));return}for(const[e,o]of[[$.triggerJson,"triggerLabel"],[$.stepsJson,"stepsLabel"]])if(e.trim())try{JSON.parse(e)}catch{m.warning(t("aiops.msg.jsonInvalid",{label:t(`aiops.msg.${o}`)}));return}S.value=!0;try{const e=[`ops playbook-create --name "${$.name.trim().replace(/"/g,'\\"')}"`];$.triggerJson.trim()&&e.push(`--trigger '${$.triggerJson.trim().replace(/'/g,"'\\''")}'`),$.stepsJson.trim()&&e.push(`--steps '${$.stepsJson.trim().replace(/'/g,"'\\''")}'`),e.push("--json");const{output:o}=await n.execute(e.join(" "),1e4);if(/error|失败/i.test(o)&&!/"playbookId"/.test(o)){m.error(t("aiops.msg.createFailed")+": "+o.slice(0,120));return}m.success(t("aiops.msg.playbookCreated")),Q.value=!1,ke(),K.value="playbooks",await j()}catch(e){m.error(t("aiops.msg.createFailed")+": "+(e?.message||e))}finally{S.value=!1}}async function Ne(){const e=I.metric.trim();if(!e){m.warning(t("aiops.msg.metricEmpty"));return}const o=I.values.split(/[\s,]+/).map(u=>u.trim()).filter(Boolean).map(u=>Number(u));if(o.length===0||o.some(u=>!Number.isFinite(u))){m.warning(t("aiops.msg.valuesInvalid"));return}S.value=!0;try{const u=`ops baseline-update "${e.replace(/"/g,'\\"')}" --values ${o.join(",")} --json`,{output:f}=await n.execute(u,1e4);if(/error|失败/i.test(f)&&!/"updated"/.test(f)){m.error(t("aiops.msg.baselineUpdateFailed")+": "+f.slice(0,120));return}m.success(t("aiops.msg.baselineUpdated",{n:o.length})),Y.value=!1,_e(),K.value="baselines",await j()}catch(u){m.error(t("aiops.msg.baselineUpdateFailed")+": "+(u?.message||u))}finally{S.value=!1}}async function Oe(){if(!F.metric||F.value==null){m.warning(t("aiops.msg.detectFieldsEmpty"));return}X.value=!0,h.value=null;try{const e=`ops detect "${F.metric.replace(/"/g,'\\"')}" ${F.value} --algorithm ${F.algorithm} --json`,{output:o}=await n.execute(e,8e3),u=ct(o);if(!u){m.error(t("aiops.msg.detectFailed")+": "+o.slice(0,120));return}h.value=u,u.anomaly&&(m.warning(t("aiops.msg.detectAnomaly",{severity:u.severity||"P3"})),j())}catch(e){m.error(t("aiops.msg.detectFailed")+": "+(e?.message||e))}finally{X.value=!1}}async function Te(e){await oe(e,"incident-ack",t("aiops.msg.incidentAcked"))}async function Ue(e){await oe(e,"incident-resolve",t("aiops.msg.incidentResolved"))}async function qe(e){await oe(e,"incident-close",t("aiops.msg.incidentClosed"))}async function oe(e,o,u){try{const{output:f}=await n.execute(`ops ${o} ${e.id} --json`,8e3);if(/error|失败|invalid/i.test(f)&&!/"acknowledged"|"resolved"|"closed"/.test(f)){m.error(t("aiops.msg.incidentTransitionFailed")+": "+f.slice(0,120));return}m.success(u),await j()}catch(f){m.error(t("aiops.msg.incidentTransitionFailed")+": "+(f?.message||f))}}async function De(e){try{const{output:o}=await n.execute(`ops postmortem ${e.id}`,12e3);at.info({title:t("aiops.msg.postmortemTitle",{id:e.id.slice(0,8)}),width:720,content:()=>lt("pre",{style:"white-space: pre-wrap; max-height: 60vh; overflow: auto; font-size: 12px; padding: 8px; background: rgba(0,0,0,.04); border-radius: 4px;"},o||t("aiops.msg.postmortemEmpty"))})}catch(o){m.error(t("aiops.msg.postmortemFailed")+": "+(o?.message||o))}}async function Ee(e,o){const u=o?"on":"off";try{const{output:f}=await n.execute(`ops playbook-toggle ${e.id} ${u} --json`,8e3);if(/error|失败/i.test(f)&&!/"enabled"/.test(f)){m.error(t("aiops.msg.playbookToggleFailed")+": "+f.slice(0,120));return}m.success(t(o?"aiops.msg.playbookEnabled":"aiops.msg.playbookDisabled")),await j()}catch(f){m.error(t("aiops.msg.playbookToggleFailed")+": "+(f?.message||f))}}async function be(e,o){try{const{output:u}=await n.execute(`ops playbook-record ${e.id} ${o} --json`,8e3);if(/error|失败/i.test(u)&&!/"recorded"/.test(u)){m.error(t("aiops.msg.playbookRecordFailed")+": "+u.slice(0,120));return}m.success(t(o==="success"?"aiops.msg.playbookRecordSuccess":"aiops.msg.playbookRecordFailure")),await j()}catch(u){m.error(t("aiops.msg.playbookRecordFailed")+": "+(u?.message||u))}}function ge(){w.severity="P3",w.metric="",w.description=""}function ke(){$.name="",$.triggerJson="",$.stepsJson=""}function _e(){I.metric="",I.values=""}return ot(j),(e,o)=>{const u=b("a-button"),f=b("a-menu-item"),Je=b("a-menu"),Me=b("a-dropdown"),$e=b("a-space"),T=b("a-statistic"),L=b("a-card"),E=b("a-col"),Be=b("a-row"),N=b("a-tag"),U=b("a-radio-button"),le=b("a-radio-group"),se=b("a-table"),ie=b("a-tab-pane"),Ke=b("a-switch"),Ve=b("a-tabs"),he=b("a-select-option"),Ce=b("a-select"),P=b("a-form-item"),ne=b("a-input"),W=b("a-textarea"),Z=b("a-form"),G=b("a-modal"),Qe=b("a-input-number");return d(),v("div",null,[z("div",ft,[z("div",null,[z("h2",vt,r(e.$t("aiops.title")),1),z("p",bt,r(e.$t("aiops.subtitle")),1)]),a($e,null,{default:l(()=>[a(u,{loading:_.value,onClick:j},{icon:l(()=>[a(k(Ge))]),default:l(()=>[c(" "+r(e.$t("aiops.refresh")),1)]),_:1},8,["loading"]),a(Me,{trigger:["click"]},{overlay:l(()=>[a(Je,{onClick:je},{default:l(()=>[a(f,{key:"incident"},{default:l(()=>[a(k(re)),c(" "+r(e.$t("aiops.actions.incident")),1)]),_:1}),a(f,{key:"playbook"},{default:l(()=>[a(k(ue)),c(" "+r(e.$t("aiops.actions.playbook")),1)]),_:1}),a(f,{key:"baseline"},{default:l(()=>[a(k(de)),c(" "+r(e.$t("aiops.actions.baseline")),1)]),_:1}),a(f,{key:"detect"},{default:l(()=>[a(k(Xe)),c(" "+r(e.$t("aiops.actions.detect")),1)]),_:1})]),_:1})]),default:l(()=>[a(u,{type:"primary"},{icon:l(()=>[a(k(He))]),default:l(()=>[c(" "+r(e.$t("aiops.newDropdown")),1)]),_:1})]),_:1})]),_:1})]),a(Be,{gutter:[16,16],style:{"margin-bottom":"20px"}},{default:l(()=>[a(E,{xs:12,sm:8,lg:5},{default:l(()=>[a(L,{style:{background:"var(--bg-card)","border-color":"var(--border-color)"}},{default:l(()=>[a(T,{title:e.$t("aiops.stats.incidents"),value:A.value.incidents.total,"value-style":{color:"#1677ff",fontSize:"20px"}},{prefix:l(()=>[a(k(re))]),_:1},8,["title","value"])]),_:1})]),_:1}),a(E,{xs:12,sm:8,lg:5},{default:l(()=>[a(L,{style:{background:"var(--bg-card)","border-color":"var(--border-color)"}},{default:l(()=>[a(T,{title:e.$t("aiops.stats.pending"),value:A.value.incidents.byStatus.open+A.value.incidents.byStatus.acknowledged,"value-style":{color:ze.value>0?"#ff4d4f":"#52c41a",fontSize:"20px"}},{prefix:l(()=>[a(k(et))]),_:1},8,["title","value","value-style"])]),_:1})]),_:1}),a(E,{xs:12,sm:8,lg:5},{default:l(()=>[a(L,{style:{background:"var(--bg-card)","border-color":"var(--border-color)"}},{default:l(()=>[a(T,{title:e.$t("aiops.stats.playbooks"),value:A.value.playbooks.total,"value-style":{color:"#722ed1",fontSize:"20px"}},{prefix:l(()=>[a(k(ue))]),_:1},8,["title","value"])]),_:1})]),_:1}),a(E,{xs:12,sm:8,lg:5},{default:l(()=>[a(L,{style:{background:"var(--bg-card)","border-color":"var(--border-color)"}},{default:l(()=>[a(T,{title:e.$t("aiops.stats.enabled"),value:A.value.playbooks.enabled,"value-style":{color:"#52c41a",fontSize:"20px"}},{prefix:l(()=>[a(k(tt))]),_:1},8,["title","value"])]),_:1})]),_:1}),a(E,{xs:24,sm:8,lg:4},{default:l(()=>[a(L,{style:{background:"var(--bg-card)","border-color":"var(--border-color)"}},{default:l(()=>[a(T,{title:e.$t("aiops.stats.baselines"),value:A.value.baselines.total,"value-style":{color:"#13c2c2",fontSize:"20px"}},{prefix:l(()=>[a(k(de))]),_:1},8,["title","value"])]),_:1})]),_:1})]),_:1}),A.value.incidents.total>0?(d(),C(L,{key:0,title:e.$t("aiops.severityCard"),size:"small",style:{background:"var(--bg-card)","border-color":"var(--border-color)","margin-bottom":"20px"},"body-style":{padding:"12px 16px"}},{default:l(()=>[a($e,{size:[12,8],wrap:""},{default:l(()=>[(d(!0),v(R,null,J(k(pe),s=>(d(),C(N,{key:s,color:ae(s),style:{"font-size":"13px",padding:"2px 10px"}},{default:l(()=>[c(r(s)+": "+r(A.value.incidents.bySeverity[s]||0),1)]),_:2},1032,["color"]))),128)),z("span",gt,r(e.$t("aiops.avgResolveLabel",{time:Re(A.value.incidents.avgResolveMs)})),1)]),_:1})]),_:1},8,["title"])):y("",!0),a(Ve,{activeKey:K.value,"onUpdate:activeKey":o[2]||(o[2]=s=>K.value=s),class:"aiops-tabs"},{default:l(()=>[a(ie,{key:"incidents",tab:e.$t("aiops.tabs.incidents")},{default:l(()=>[z("div",kt,[a(le,{value:q.value,"onUpdate:value":o[0]||(o[0]=s=>q.value=s),size:"small","button-style":"solid"},{default:l(()=>[a(U,{value:""},{default:l(()=>[c(r(e.$t("aiops.filter.all")),1)]),_:1}),(d(!0),v(R,null,J(k(pe),s=>(d(),C(U,{key:s,value:s},{default:l(()=>[c(r(s),1)]),_:2},1032,["value"]))),128))]),_:1},8,["value"]),a(le,{value:D.value,"onUpdate:value":o[1]||(o[1]=s=>D.value=s),size:"small"},{default:l(()=>[a(U,{value:""},{default:l(()=>[c(r(e.$t("aiops.filter.allStatuses")),1)]),_:1}),(d(!0),v(R,null,J(k(st),s=>(d(),C(U,{key:s,value:s},{default:l(()=>[c(r(fe(s)),1)]),_:2},1032,["value"]))),128))]),_:1},8,["value"])]),a(se,{columns:xe.value,"data-source":Ae.value,pagination:{pageSize:20,showTotal:s=>e.$t("aiops.table.totalSuffix",{n:s})},size:"small",loading:_.value,style:{background:"var(--bg-card)"}},{bodyCell:l(({column:s,record:p})=>[s.key==="severity"?(d(),C(N,{key:0,color:ae(p.severity),style:{"font-weight":"600"}},{default:l(()=>[c(r(p.severity),1)]),_:2},1032,["color"])):y("",!0),s.key==="metric"?(d(),v(R,{key:1},[p.anomalyMetric?(d(),v("span",_t,r(p.anomalyMetric),1)):(d(),v("span",$t,"—"))],64)):y("",!0),s.key==="description"?(d(),v("span",ht,r(ve(p.description,80)||"—"),1)):y("",!0),s.key==="status"?(d(),C(N,{key:3,color:Fe(p.status)},{default:l(()=>[c(r(fe(p.status)),1)]),_:2},1032,["color"])):y("",!0),s.key==="createdAt"?(d(),v("span",Ct,r(k(ce)(p.createdAt)),1)):y("",!0),s.key==="action"?(d(),v(R,{key:5},[p.status==="open"?(d(),C(u,{key:0,size:"small",type:"link",onClick:O=>Te(p)},{default:l(()=>[c(r(e.$t("aiops.incidentActions.ack")),1)]),_:1},8,["onClick"])):y("",!0),p.status==="open"||p.status==="acknowledged"?(d(),C(u,{key:1,size:"small",type:"link",onClick:O=>Ue(p)},{default:l(()=>[c(r(e.$t("aiops.incidentActions.resolve")),1)]),_:1},8,["onClick"])):y("",!0),p.status==="resolved"?(d(),C(u,{key:2,size:"small",type:"link",onClick:O=>qe(p)},{default:l(()=>[c(r(e.$t("aiops.incidentActions.close")),1)]),_:1},8,["onClick"])):y("",!0),p.status==="resolved"||p.status==="closed"?(d(),C(u,{key:3,size:"small",type:"link",onClick:O=>De(p)},{default:l(()=>[c(r(e.$t("aiops.incidentActions.postmortem")),1)]),_:1},8,["onClick"])):y("",!0)],64)):y("",!0)]),emptyText:l(()=>[z("div",xt,[a(k(re),{style:{"font-size":"36px","margin-bottom":"10px",display:"block"}}),c(" "+r(q.value||D.value?e.$t("aiops.table.incidentEmptyFiltered"):e.$t("aiops.table.incidentEmpty")),1)])]),_:1},8,["columns","data-source","pagination","loading"])]),_:1},8,["tab"]),a(ie,{key:"playbooks",tab:e.$t("aiops.tabs.playbooks")},{default:l(()=>[a(se,{columns:Se.value,"data-source":ye.value,pagination:{pageSize:20,showTotal:s=>e.$t("aiops.table.totalSuffix",{n:s})},size:"small",loading:_.value,style:{background:"var(--bg-card)"}},{bodyCell:l(({column:s,record:p})=>[s.key==="name"?(d(),v(R,{key:0},[z("span",St,r(p.name),1),p.triggerCondition?(d(),v("div",wt,r(ve(p.triggerCondition,80)),1)):y("",!0)],64)):y("",!0),s.key==="enabled"?(d(),C(Ke,{key:1,checked:p.enabled,size:"small",onChange:O=>Ee(p,O)},null,8,["checked","onChange"])):y("",!0),s.key==="stats"?(d(),v(R,{key:2},[a(N,{color:"green",style:{"font-size":"11px"}},{default:l(()=>[c(r(e.$t("aiops.table.successCount",{n:p.successCount})),1)]),_:2},1024),p.failureCount>0?(d(),C(N,{key:0,color:"red",style:{"font-size":"11px","margin-left":"4px"}},{default:l(()=>[c(r(e.$t("aiops.table.failureCount",{n:p.failureCount})),1)]),_:2},1024)):y("",!0)],64)):y("",!0),s.key==="createdAt"?(d(),v("span",zt,r(k(ce)(p.createdAt)),1)):y("",!0),s.key==="action"?(d(),v(R,{key:4},[a(u,{size:"small",type:"link",onClick:O=>be(p,"success")},{default:l(()=>[c(r(e.$t("aiops.playbookActions.success")),1)]),_:1},8,["onClick"]),a(u,{size:"small",type:"link",danger:"",onClick:O=>be(p,"failure")},{default:l(()=>[c(r(e.$t("aiops.playbookActions.failure")),1)]),_:1},8,["onClick"])],64)):y("",!0)]),emptyText:l(()=>[z("div",At,[a(k(ue),{style:{"font-size":"36px","margin-bottom":"10px",display:"block"}}),c(" "+r(e.$t("aiops.table.playbookEmpty")),1)])]),_:1},8,["columns","data-source","pagination","loading"])]),_:1},8,["tab"]),a(ie,{key:"baselines",tab:e.$t("aiops.tabs.baselines")},{default:l(()=>[a(se,{columns:we.value,"data-source":ee.value,pagination:{pageSize:20,showTotal:s=>e.$t("aiops.table.totalSuffix",{n:s})},size:"small",loading:_.value,style:{background:"var(--bg-card)"}},{bodyCell:l(({column:s,record:p})=>[s.key==="metric"?(d(),v("span",Ft,r(p.metricName),1)):y("",!0),s.key==="mean"?(d(),v(R,{key:1},[z("span",Pt,r(p.mean),1),z("span",Rt,"σ "+r(p.stdDev),1)],64)):y("",!0),s.key==="iqr"?(d(),v("span",jt," Q1 "+r(p.q1)+" / Q3 "+r(p.q3),1)):y("",!0),s.key==="sampleCount"?(d(),C(N,{key:3,color:"blue",style:{"font-size":"11px"}},{default:l(()=>[c(r(p.sampleCount),1)]),_:2},1024)):y("",!0),s.key==="updatedAt"?(d(),v("span",It,r(k(ce)(p.updatedAt)),1)):y("",!0)]),emptyText:l(()=>[z("div",Lt,[a(k(de),{style:{"font-size":"36px","margin-bottom":"10px",display:"block"}}),c(" "+r(e.$t("aiops.table.baselineEmpty")),1)])]),_:1},8,["columns","data-source","pagination","loading"])]),_:1},8,["tab"])]),_:1},8,["activeKey"]),a(G,{open:V.value,"onUpdate:open":o[6]||(o[6]=s=>V.value=s),title:e.$t("aiops.incident_modal.title"),"confirm-loading":S.value,width:520,"ok-text":e.$t("aiops.incident_modal.ok"),"cancel-text":e.$t("aiops.incident_modal.cancel"),onOk:Ie,onCancel:ge},{default:l(()=>[a(Z,{"label-col":{span:5},"wrapper-col":{span:19},style:{"margin-top":"16px"}},{default:l(()=>[a(P,{label:e.$t("aiops.incident_modal.severityLabel")},{default:l(()=>[a(Ce,{value:w.severity,"onUpdate:value":o[3]||(o[3]=s=>w.severity=s)},{default:l(()=>[(d(!0),v(R,null,J(k(pe),s=>(d(),C(he,{key:s,value:s},{default:l(()=>[c(r(s),1)]),_:2},1032,["value"]))),128))]),_:1},8,["value"])]),_:1},8,["label"]),a(P,{label:e.$t("aiops.incident_modal.metricLabel")},{default:l(()=>[a(ne,{value:w.metric,"onUpdate:value":o[4]||(o[4]=s=>w.metric=s),placeholder:e.$t("aiops.incident_modal.metricPlaceholder")},null,8,["value","placeholder"])]),_:1},8,["label"]),a(P,{label:e.$t("aiops.incident_modal.descLabel"),required:""},{default:l(()=>[a(W,{value:w.description,"onUpdate:value":o[5]||(o[5]=s=>w.description=s),"auto-size":{minRows:3,maxRows:6}},null,8,["value"])]),_:1},8,["label"])]),_:1})]),_:1},8,["open","title","confirm-loading","ok-text","cancel-text"]),a(G,{open:Q.value,"onUpdate:open":o[10]||(o[10]=s=>Q.value=s),title:e.$t("aiops.playbook_modal.title"),"confirm-loading":S.value,width:540,"ok-text":e.$t("aiops.playbook_modal.ok"),"cancel-text":e.$t("aiops.playbook_modal.cancel"),onOk:Le,onCancel:ke},{default:l(()=>[a(Z,{"label-col":{span:5},"wrapper-col":{span:19},style:{"margin-top":"16px"}},{default:l(()=>[a(P,{label:e.$t("aiops.playbook_modal.nameLabel"),required:""},{default:l(()=>[a(ne,{value:$.name,"onUpdate:value":o[7]||(o[7]=s=>$.name=s),placeholder:e.$t("aiops.playbook_modal.namePlaceholder")},null,8,["value","placeholder"])]),_:1},8,["label"]),a(P,{label:e.$t("aiops.playbook_modal.triggerLabel")},{default:l(()=>[a(W,{value:$.triggerJson,"onUpdate:value":o[8]||(o[8]=s=>$.triggerJson=s),placeholder:e.$t("aiops.playbook_modal.triggerPlaceholder"),"auto-size":{minRows:2,maxRows:4}},null,8,["value","placeholder"])]),_:1},8,["label"]),a(P,{label:e.$t("aiops.playbook_modal.stepsLabel")},{default:l(()=>[a(W,{value:$.stepsJson,"onUpdate:value":o[9]||(o[9]=s=>$.stepsJson=s),placeholder:e.$t("aiops.playbook_modal.stepsPlaceholder"),"auto-size":{minRows:3,maxRows:6}},null,8,["value","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["open","title","confirm-loading","ok-text","cancel-text"]),a(G,{open:Y.value,"onUpdate:open":o[13]||(o[13]=s=>Y.value=s),title:e.$t("aiops.baseline_modal.title"),"confirm-loading":S.value,width:500,"ok-text":e.$t("aiops.baseline_modal.ok"),"cancel-text":e.$t("aiops.baseline_modal.cancel"),onOk:Ne,onCancel:_e},{default:l(()=>[a(Z,{"label-col":{span:5},"wrapper-col":{span:19},style:{"margin-top":"16px"}},{default:l(()=>[a(P,{label:e.$t("aiops.baseline_modal.metricLabel"),required:""},{default:l(()=>[a(ne,{value:I.metric,"onUpdate:value":o[11]||(o[11]=s=>I.metric=s),placeholder:e.$t("aiops.baseline_modal.metricPlaceholder")},null,8,["value","placeholder"])]),_:1},8,["label"]),a(P,{label:e.$t("aiops.baseline_modal.valuesLabel"),required:""},{default:l(()=>[a(W,{value:I.values,"onUpdate:value":o[12]||(o[12]=s=>I.values=s),placeholder:e.$t("aiops.baseline_modal.valuesPlaceholder"),"auto-size":{minRows:3,maxRows:8}},null,8,["value","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["open","title","confirm-loading","ok-text","cancel-text"]),a(G,{open:te.value,"onUpdate:open":o[17]||(o[17]=s=>te.value=s),title:e.$t("aiops.detect_modal.title"),"confirm-loading":X.value,width:500,"ok-text":e.$t("aiops.detect_modal.ok"),"cancel-text":e.$t("aiops.detect_modal.cancel"),onOk:Oe},{default:l(()=>[a(Z,{"label-col":{span:5},"wrapper-col":{span:19},style:{"margin-top":"16px"}},{default:l(()=>[a(P,{label:e.$t("aiops.detect_modal.metricLabel"),required:""},{default:l(()=>[a(Ce,{value:F.metric,"onUpdate:value":o[14]||(o[14]=s=>F.metric=s),"show-search":"",placeholder:e.$t("aiops.detect_modal.metricPlaceholder")},{default:l(()=>[(d(!0),v(R,null,J(ee.value,s=>(d(),C(he,{key:s.metricName,value:s.metricName},{default:l(()=>[c(r(e.$t("aiops.detect_modal.metricOptionLabel",{name:s.metricName,count:s.sampleCount})),1)]),_:2},1032,["value"]))),128))]),_:1},8,["value","placeholder"])]),_:1},8,["label"]),a(P,{label:e.$t("aiops.detect_modal.valueLabel"),required:""},{default:l(()=>[a(Qe,{value:F.value,"onUpdate:value":o[15]||(o[15]=s=>F.value=s),style:{width:"100%"}},null,8,["value"])]),_:1},8,["label"]),a(P,{label:e.$t("aiops.detect_modal.algorithmLabel")},{default:l(()=>[a(le,{value:F.algorithm,"onUpdate:value":o[16]||(o[16]=s=>F.algorithm=s)},{default:l(()=>[a(U,{value:"z_score"},{default:l(()=>[...o[18]||(o[18]=[c("Z-Score (3σ)",-1)])]),_:1}),a(U,{value:"iqr"},{default:l(()=>[...o[19]||(o[19]=[c("IQR (1.5×)",-1)])]),_:1})]),_:1},8,["value"])]),_:1},8,["label"])]),_:1}),h.value?(d(),C(L,{key:0,size:"small",style:{background:"var(--bg-base)","margin-top":"8px"}},{default:l(()=>[a(T,{title:e.$t("aiops.detect_modal.resultTitle"),value:h.value.anomaly?e.$t("aiops.detect_modal.anomaly"):e.$t("aiops.detect_modal.normal"),"value-style":{color:h.value.anomaly?"#ff4d4f":"#52c41a"}},null,8,["title","value","value-style"]),h.value.reason&&!h.value.anomaly?(d(),v("div",Nt,r(e.$t("aiops.detect_modal.reasonLine",{reason:Pe(h.value.reason)})),1)):y("",!0),h.value.baseline?(d(),v("div",Ot,[z("div",null,r(e.$t("aiops.detect_modal.scoreLine",{score:h.value.score,threshold:h.value.threshold})),1),z("div",null,r(e.$t("aiops.detect_modal.baselineLine",{mean:h.value.baseline.mean,stdDev:h.value.baseline.stdDev})),1)])):y("",!0),h.value.incidentId?(d(),v("div",Tt,[a(N,{color:ae(h.value.severity)},{default:l(()=>[c(r(e.$t("aiops.detect_modal.incidentCreated",{severity:h.value.severity})),1)]),_:1},8,["color"])])):y("",!0)]),_:1})):y("",!0)]),_:1},8,["open","title","confirm-loading","ok-text","cancel-text"])])}}},ua=Ye(Ut,[["__scopeId","data-v-ecfcab22"]]);export{ua as default};
1
+ import{t as B,_ as Ye,u as We,b as Ze,d as m}from"./index-CzoKAiyT.js";import{R as Ge,at as He,A as re,j as ue,aY as de,b3 as Xe,c as et,f as tt}from"./icons-DlxlFL4g.js";import at from"./index-DEbAW3Ec.js";import{o as ot,M as v,R as z,P as r,c as a,N as l,Q as C,S as y,K as b,r as x,L as d,O as c,u as k,F as R,Y as J,f as M,h as lt,a as H}from"./vendor-BXcBOG8b.js";import"./KeyCode-D63Tfrq7.js";import"./omit-BVylGzEr.js";import"./pickAttrs-Cp3Nflbr.js";import"./initDefaultProps-BlhbrsQk.js";import"./motion-UZx12NPM.js";import"./raf-Deuc0E8-.js";import"./index-BLwY9y0X.js";import"./index-Z6DBe2RU.js";import"./isVisible-C7tPsqfj.js";import"./useState-Dlgl7fUg.js";import"./devWarning-CNIS3FrJ.js";import"./warning-Pq00owYb.js";import"./compact-item-zepznuTv.js";import"./createContext-BRto-SQH.js";import"./Compact-BNnX4jpz.js";import"./_getTag-BVc6NQ_K.js";import"./styleChecker-Bf7i4nlm.js";import"./zoom-CcABB_97.js";import"./ActionButton-ByFuxJsa.js";import"./vnode-CK992ojP.js";const pe=Object.freeze(["P0","P1","P2","P3"]),st=Object.freeze(["open","acknowledged","resolved","closed"]);function g(i,n=0){return typeof i=="number"&&Number.isFinite(i)?i:n}function it(i,n=0){if(!i||typeof i!="object")return null;const t=i.id||"";return t?{key:t,id:t,anomalyMetric:i.anomalyMetric??i.anomaly_metric??"",severity:String(i.severity||"P3"),status:String(i.status||"open").toLowerCase(),description:String(i.description||""),anomalyData:i.anomalyData??i.anomaly_data??null,remediationId:i.remediationId??i.remediation_id??null,postmortem:i.postmortem||"",acknowledgedAt:i.acknowledgedAt??i.acknowledged_at??null,resolvedAt:i.resolvedAt??i.resolved_at??null,createdAt:i.createdAt??i.created_at??null,_idx:n}:null}function nt(i){const n=B(i);return Array.isArray(n)?n.map(it).filter(Boolean):[]}function rt(i,n=0){if(!i||typeof i!="object")return null;const t=i.id||"";if(!t)return null;const _=i.enabled;let S=!1;return _===!0||_===1||_==="1"?S=!0:_===!1||_===0||_==="0"?S=!1:S=!!_,{key:t,id:t,name:String(i.name||""),triggerCondition:i.triggerCondition??i.trigger_condition??"",steps:i.steps||"",enabled:S,successCount:g(i.successCount??i.success_count,0),failureCount:g(i.failureCount??i.failure_count,0),createdAt:i.createdAt??i.created_at??null,_idx:n}}function ut(i){const n=B(i);return Array.isArray(n)?n.map(rt).filter(Boolean):[]}function dt(i,n=0){if(!i||typeof i!="object")return null;const t=i.metricName??i.metric_name??"";return t?{key:t,metricName:t,mean:g(i.mean,0),stdDev:g(i.stdDev??i.std_dev,0),q1:g(i.q1,0),q3:g(i.q3,0),sampleCount:g(i.sampleCount??i.sample_count,0),updatedAt:i.updatedAt??i.updated_at??null,_idx:n}:null}function pt(i){const n=B(i);return Array.isArray(n)?n.map(dt).filter(Boolean):[]}function ct(i){const n=B(i);return!n||typeof n!="object"||Array.isArray(n)?null:{anomaly:!!n.anomaly,reason:n.reason||null,metricName:n.metricName??n.metric_name??"",value:g(n.value,0),algorithm:String(n.algorithm||""),score:g(n.score,0),threshold:g(n.threshold,0),baseline:n.baseline?{mean:g(n.baseline.mean,0),stdDev:g(n.baseline.stdDev??n.baseline.std_dev,0),q1:g(n.baseline.q1,0),q3:g(n.baseline.q3,0)}:null,incidentId:n.incidentId??n.incident_id??null,severity:n.severity||null}}const mt={incidents:{total:0,bySeverity:{P0:0,P1:0,P2:0,P3:0},byStatus:{open:0,acknowledged:0,resolved:0,closed:0},avgResolveMs:0},playbooks:{total:0,enabled:0,totalSuccess:0,totalFailure:0},baselines:{total:0,metrics:[]}};function yt(i){const n=JSON.parse(JSON.stringify(mt)),t=B(i);if(!t||typeof t!="object"||Array.isArray(t))return n;if(t.incidents&&typeof t.incidents=="object"){if(n.incidents.total=g(t.incidents.total,0),n.incidents.avgResolveMs=g(t.incidents.avgResolveMs??t.incidents.avg_resolve_ms,0),t.incidents.bySeverity&&typeof t.incidents.bySeverity=="object")for(const _ of Object.keys(n.incidents.bySeverity))n.incidents.bySeverity[_]=g(t.incidents.bySeverity[_],0);if(t.incidents.byStatus&&typeof t.incidents.byStatus=="object")for(const _ of Object.keys(n.incidents.byStatus))n.incidents.byStatus[_]=g(t.incidents.byStatus[_],0)}return t.playbooks&&typeof t.playbooks=="object"&&(n.playbooks.total=g(t.playbooks.total,0),n.playbooks.enabled=g(t.playbooks.enabled,0),n.playbooks.totalSuccess=g(t.playbooks.totalSuccess??t.playbooks.total_success,0),n.playbooks.totalFailure=g(t.playbooks.totalFailure??t.playbooks.total_failure,0)),t.baselines&&typeof t.baselines=="object"&&(n.baselines.total=g(t.baselines.total,0),Array.isArray(t.baselines.metrics)&&(n.baselines.metrics=[...t.baselines.metrics])),n}function ce(i){if(i==null||i==="")return"—";const n=typeof i=="number"?new Date(i):new Date(String(i));return isNaN(n.getTime())?String(i):n.toLocaleString("zh-CN",{hour12:!1})}const ft={style:{display:"flex","align-items":"center","justify-content":"space-between","margin-bottom":"24px"}},vt={class:"page-title"},bt={class:"page-sub"},gt={style:{color:"var(--text-secondary)","font-size":"12px","margin-left":"8px"}},kt={class:"filter-bar"},_t={key:0,style:{color:"var(--text-primary)","font-family":"monospace","font-size":"12px"}},$t={key:1,style:{color:"var(--text-muted)"}},ht={key:2,style:{color:"var(--text-secondary)","font-size":"12px"}},Ct={key:4,style:{color:"var(--text-secondary)","font-size":"11px"}},xt={style:{padding:"40px",color:"var(--text-muted)","text-align":"center"}},St={style:{color:"var(--text-primary)","font-weight":"500"}},wt={key:0,style:{color:"var(--text-secondary)","font-size":"11px","margin-top":"2px","font-family":"monospace"}},zt={key:3,style:{color:"var(--text-secondary)","font-size":"11px"}},At={style:{padding:"40px",color:"var(--text-muted)","text-align":"center"}},Ft={key:0,style:{color:"var(--text-primary)","font-family":"monospace","font-weight":"500"}},Pt={style:{color:"#1677ff"}},Rt={style:{color:"var(--text-secondary)","margin-left":"4px","font-size":"11px"}},jt={key:2,style:{color:"var(--text-secondary)","font-size":"12px"}},It={key:4,style:{color:"var(--text-secondary)","font-size":"11px"}},Lt={style:{padding:"40px",color:"var(--text-muted)","text-align":"center"}},Nt={key:0,style:{color:"var(--text-secondary)","font-size":"12px","margin-top":"8px"}},Ot={key:1,style:{"margin-top":"12px","font-size":"12px",color:"var(--text-secondary)"}},Tt={key:2,style:{"margin-top":"8px"}},Ut={__name:"AIOps",setup(i){const n=We(),{t}=Ze(),_=x(!1),S=x(!1),X=x(!1),me=x([]),ye=x([]),ee=x([]),A=x({incidents:{total:0,bySeverity:{P0:0,P1:0,P2:0,P3:0},byStatus:{open:0,acknowledged:0,resolved:0,closed:0},avgResolveMs:0},playbooks:{total:0,enabled:0,totalSuccess:0,totalFailure:0},baselines:{total:0,metrics:[]}}),K=x("incidents"),q=x(""),D=x(""),V=x(!1),Q=x(!1),Y=x(!1),te=x(!1),w=H({severity:"P3",metric:"",description:""}),$=H({name:"",triggerJson:"",stepsJson:""}),I=H({metric:"",values:""}),F=H({metric:"",value:null,algorithm:"z_score"}),h=x(null),xe=M(()=>[{title:t("aiops.incidentCols.severity"),key:"severity",width:"90px"},{title:t("aiops.incidentCols.metric"),key:"metric",width:"160px"},{title:t("aiops.incidentCols.description"),key:"description"},{title:t("aiops.incidentCols.status"),key:"status",width:"100px"},{title:t("aiops.incidentCols.createdAt"),key:"createdAt",width:"160px"},{title:t("aiops.incidentCols.action"),key:"action",width:"220px"}]),Se=M(()=>[{title:t("aiops.playbookCols.name"),key:"name"},{title:t("aiops.playbookCols.enabled"),key:"enabled",width:"80px"},{title:t("aiops.playbookCols.stats"),key:"stats",width:"180px"},{title:t("aiops.playbookCols.createdAt"),key:"createdAt",width:"160px"},{title:t("aiops.playbookCols.action"),key:"action",width:"160px"}]),we=M(()=>[{title:t("aiops.baselineCols.metric"),key:"metric"},{title:t("aiops.baselineCols.mean"),key:"mean",width:"180px"},{title:t("aiops.baselineCols.iqr"),key:"iqr",width:"180px"},{title:t("aiops.baselineCols.sampleCount"),key:"sampleCount",width:"90px"},{title:t("aiops.baselineCols.updatedAt"),key:"updatedAt",width:"160px"}]),ze=M(()=>A.value.incidents.byStatus.open+A.value.incidents.byStatus.acknowledged),Ae=M(()=>{let e=me.value;return q.value&&(e=e.filter(o=>o.severity===q.value)),D.value&&(e=e.filter(o=>o.status===D.value)),e});function fe(e){const o=`aiops.statusLabels.${e}`,u=t(o);return u===o?e:u}function Fe(e){return{open:"red",acknowledged:"orange",resolved:"cyan",closed:"default"}[e]||"default"}function ae(e){return{P0:"red",P1:"volcano",P2:"orange",P3:"gold"}[e]||"default"}function Pe(e){const o=`aiops.reasonLabels.${e}`,u=t(o);return u===o?e:u}function ve(e,o){return e?e.length>o?e.slice(0,o)+"...":e:""}function Re(e){return!e||e<=0?t("aiops.duration.none"):e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:e<36e5?`${(e/6e4).toFixed(1)}min`:`${(e/36e5).toFixed(1)}h`}function je({key:e}){e==="incident"?V.value=!0:e==="playbook"?Q.value=!0:e==="baseline"?Y.value=!0:e==="detect"&&(h.value=null,te.value=!0)}async function j(){_.value=!0;try{const[e,o,u,f]=await Promise.all([n.execute("ops incidents --limit 200 --json",1e4).catch(()=>({output:""})),n.execute("ops playbooks --limit 200 --json",1e4).catch(()=>({output:""})),n.execute("ops baselines --json",1e4).catch(()=>({output:""})),n.execute("ops stats --json",8e3).catch(()=>({output:""}))]);me.value=nt(e.output),ye.value=ut(o.output),ee.value=pt(u.output),A.value=yt(f.output)}catch(e){m.error(t("aiops.msg.loadFailed")+": "+(e?.message||e))}finally{_.value=!1}}async function Ie(){if(!w.description.trim()){m.warning(t("aiops.msg.descEmpty"));return}S.value=!0;try{const e=[`ops incident-create --severity ${w.severity}`];w.metric.trim()&&e.push(`--metric "${w.metric.trim().replace(/"/g,'\\"')}"`),e.push(`--description "${w.description.trim().replace(/"/g,'\\"')}"`),e.push("--json");const{output:o}=await n.execute(e.join(" "),1e4);if(/error|失败/i.test(o)&&!/"incidentId"/.test(o)){m.error(t("aiops.msg.createFailed")+": "+o.slice(0,120));return}m.success(t("aiops.msg.incidentCreated")),V.value=!1,ge(),await j()}catch(e){m.error(t("aiops.msg.createFailed")+": "+(e?.message||e))}finally{S.value=!1}}async function Le(){if(!$.name.trim()){m.warning(t("aiops.msg.playbookNameEmpty"));return}for(const[e,o]of[[$.triggerJson,"triggerLabel"],[$.stepsJson,"stepsLabel"]])if(e.trim())try{JSON.parse(e)}catch{m.warning(t("aiops.msg.jsonInvalid",{label:t(`aiops.msg.${o}`)}));return}S.value=!0;try{const e=[`ops playbook-create --name "${$.name.trim().replace(/"/g,'\\"')}"`];$.triggerJson.trim()&&e.push(`--trigger '${$.triggerJson.trim().replace(/'/g,"'\\''")}'`),$.stepsJson.trim()&&e.push(`--steps '${$.stepsJson.trim().replace(/'/g,"'\\''")}'`),e.push("--json");const{output:o}=await n.execute(e.join(" "),1e4);if(/error|失败/i.test(o)&&!/"playbookId"/.test(o)){m.error(t("aiops.msg.createFailed")+": "+o.slice(0,120));return}m.success(t("aiops.msg.playbookCreated")),Q.value=!1,ke(),K.value="playbooks",await j()}catch(e){m.error(t("aiops.msg.createFailed")+": "+(e?.message||e))}finally{S.value=!1}}async function Ne(){const e=I.metric.trim();if(!e){m.warning(t("aiops.msg.metricEmpty"));return}const o=I.values.split(/[\s,]+/).map(u=>u.trim()).filter(Boolean).map(u=>Number(u));if(o.length===0||o.some(u=>!Number.isFinite(u))){m.warning(t("aiops.msg.valuesInvalid"));return}S.value=!0;try{const u=`ops baseline-update "${e.replace(/"/g,'\\"')}" --values ${o.join(",")} --json`,{output:f}=await n.execute(u,1e4);if(/error|失败/i.test(f)&&!/"updated"/.test(f)){m.error(t("aiops.msg.baselineUpdateFailed")+": "+f.slice(0,120));return}m.success(t("aiops.msg.baselineUpdated",{n:o.length})),Y.value=!1,_e(),K.value="baselines",await j()}catch(u){m.error(t("aiops.msg.baselineUpdateFailed")+": "+(u?.message||u))}finally{S.value=!1}}async function Oe(){if(!F.metric||F.value==null){m.warning(t("aiops.msg.detectFieldsEmpty"));return}X.value=!0,h.value=null;try{const e=`ops detect "${F.metric.replace(/"/g,'\\"')}" ${F.value} --algorithm ${F.algorithm} --json`,{output:o}=await n.execute(e,8e3),u=ct(o);if(!u){m.error(t("aiops.msg.detectFailed")+": "+o.slice(0,120));return}h.value=u,u.anomaly&&(m.warning(t("aiops.msg.detectAnomaly",{severity:u.severity||"P3"})),j())}catch(e){m.error(t("aiops.msg.detectFailed")+": "+(e?.message||e))}finally{X.value=!1}}async function Te(e){await oe(e,"incident-ack",t("aiops.msg.incidentAcked"))}async function Ue(e){await oe(e,"incident-resolve",t("aiops.msg.incidentResolved"))}async function qe(e){await oe(e,"incident-close",t("aiops.msg.incidentClosed"))}async function oe(e,o,u){try{const{output:f}=await n.execute(`ops ${o} ${e.id} --json`,8e3);if(/error|失败|invalid/i.test(f)&&!/"acknowledged"|"resolved"|"closed"/.test(f)){m.error(t("aiops.msg.incidentTransitionFailed")+": "+f.slice(0,120));return}m.success(u),await j()}catch(f){m.error(t("aiops.msg.incidentTransitionFailed")+": "+(f?.message||f))}}async function De(e){try{const{output:o}=await n.execute(`ops postmortem ${e.id}`,12e3);at.info({title:t("aiops.msg.postmortemTitle",{id:e.id.slice(0,8)}),width:720,content:()=>lt("pre",{style:"white-space: pre-wrap; max-height: 60vh; overflow: auto; font-size: 12px; padding: 8px; background: rgba(0,0,0,.04); border-radius: 4px;"},o||t("aiops.msg.postmortemEmpty"))})}catch(o){m.error(t("aiops.msg.postmortemFailed")+": "+(o?.message||o))}}async function Ee(e,o){const u=o?"on":"off";try{const{output:f}=await n.execute(`ops playbook-toggle ${e.id} ${u} --json`,8e3);if(/error|失败/i.test(f)&&!/"enabled"/.test(f)){m.error(t("aiops.msg.playbookToggleFailed")+": "+f.slice(0,120));return}m.success(t(o?"aiops.msg.playbookEnabled":"aiops.msg.playbookDisabled")),await j()}catch(f){m.error(t("aiops.msg.playbookToggleFailed")+": "+(f?.message||f))}}async function be(e,o){try{const{output:u}=await n.execute(`ops playbook-record ${e.id} ${o} --json`,8e3);if(/error|失败/i.test(u)&&!/"recorded"/.test(u)){m.error(t("aiops.msg.playbookRecordFailed")+": "+u.slice(0,120));return}m.success(t(o==="success"?"aiops.msg.playbookRecordSuccess":"aiops.msg.playbookRecordFailure")),await j()}catch(u){m.error(t("aiops.msg.playbookRecordFailed")+": "+(u?.message||u))}}function ge(){w.severity="P3",w.metric="",w.description=""}function ke(){$.name="",$.triggerJson="",$.stepsJson=""}function _e(){I.metric="",I.values=""}return ot(j),(e,o)=>{const u=b("a-button"),f=b("a-menu-item"),Je=b("a-menu"),Me=b("a-dropdown"),$e=b("a-space"),T=b("a-statistic"),L=b("a-card"),E=b("a-col"),Be=b("a-row"),N=b("a-tag"),U=b("a-radio-button"),le=b("a-radio-group"),se=b("a-table"),ie=b("a-tab-pane"),Ke=b("a-switch"),Ve=b("a-tabs"),he=b("a-select-option"),Ce=b("a-select"),P=b("a-form-item"),ne=b("a-input"),W=b("a-textarea"),Z=b("a-form"),G=b("a-modal"),Qe=b("a-input-number");return d(),v("div",null,[z("div",ft,[z("div",null,[z("h2",vt,r(e.$t("aiops.title")),1),z("p",bt,r(e.$t("aiops.subtitle")),1)]),a($e,null,{default:l(()=>[a(u,{loading:_.value,onClick:j},{icon:l(()=>[a(k(Ge))]),default:l(()=>[c(" "+r(e.$t("aiops.refresh")),1)]),_:1},8,["loading"]),a(Me,{trigger:["click"]},{overlay:l(()=>[a(Je,{onClick:je},{default:l(()=>[a(f,{key:"incident"},{default:l(()=>[a(k(re)),c(" "+r(e.$t("aiops.actions.incident")),1)]),_:1}),a(f,{key:"playbook"},{default:l(()=>[a(k(ue)),c(" "+r(e.$t("aiops.actions.playbook")),1)]),_:1}),a(f,{key:"baseline"},{default:l(()=>[a(k(de)),c(" "+r(e.$t("aiops.actions.baseline")),1)]),_:1}),a(f,{key:"detect"},{default:l(()=>[a(k(Xe)),c(" "+r(e.$t("aiops.actions.detect")),1)]),_:1})]),_:1})]),default:l(()=>[a(u,{type:"primary"},{icon:l(()=>[a(k(He))]),default:l(()=>[c(" "+r(e.$t("aiops.newDropdown")),1)]),_:1})]),_:1})]),_:1})]),a(Be,{gutter:[16,16],style:{"margin-bottom":"20px"}},{default:l(()=>[a(E,{xs:12,sm:8,lg:5},{default:l(()=>[a(L,{style:{background:"var(--bg-card)","border-color":"var(--border-color)"}},{default:l(()=>[a(T,{title:e.$t("aiops.stats.incidents"),value:A.value.incidents.total,"value-style":{color:"#1677ff",fontSize:"20px"}},{prefix:l(()=>[a(k(re))]),_:1},8,["title","value"])]),_:1})]),_:1}),a(E,{xs:12,sm:8,lg:5},{default:l(()=>[a(L,{style:{background:"var(--bg-card)","border-color":"var(--border-color)"}},{default:l(()=>[a(T,{title:e.$t("aiops.stats.pending"),value:A.value.incidents.byStatus.open+A.value.incidents.byStatus.acknowledged,"value-style":{color:ze.value>0?"#ff4d4f":"#52c41a",fontSize:"20px"}},{prefix:l(()=>[a(k(et))]),_:1},8,["title","value","value-style"])]),_:1})]),_:1}),a(E,{xs:12,sm:8,lg:5},{default:l(()=>[a(L,{style:{background:"var(--bg-card)","border-color":"var(--border-color)"}},{default:l(()=>[a(T,{title:e.$t("aiops.stats.playbooks"),value:A.value.playbooks.total,"value-style":{color:"#722ed1",fontSize:"20px"}},{prefix:l(()=>[a(k(ue))]),_:1},8,["title","value"])]),_:1})]),_:1}),a(E,{xs:12,sm:8,lg:5},{default:l(()=>[a(L,{style:{background:"var(--bg-card)","border-color":"var(--border-color)"}},{default:l(()=>[a(T,{title:e.$t("aiops.stats.enabled"),value:A.value.playbooks.enabled,"value-style":{color:"#52c41a",fontSize:"20px"}},{prefix:l(()=>[a(k(tt))]),_:1},8,["title","value"])]),_:1})]),_:1}),a(E,{xs:24,sm:8,lg:4},{default:l(()=>[a(L,{style:{background:"var(--bg-card)","border-color":"var(--border-color)"}},{default:l(()=>[a(T,{title:e.$t("aiops.stats.baselines"),value:A.value.baselines.total,"value-style":{color:"#13c2c2",fontSize:"20px"}},{prefix:l(()=>[a(k(de))]),_:1},8,["title","value"])]),_:1})]),_:1})]),_:1}),A.value.incidents.total>0?(d(),C(L,{key:0,title:e.$t("aiops.severityCard"),size:"small",style:{background:"var(--bg-card)","border-color":"var(--border-color)","margin-bottom":"20px"},"body-style":{padding:"12px 16px"}},{default:l(()=>[a($e,{size:[12,8],wrap:""},{default:l(()=>[(d(!0),v(R,null,J(k(pe),s=>(d(),C(N,{key:s,color:ae(s),style:{"font-size":"13px",padding:"2px 10px"}},{default:l(()=>[c(r(s)+": "+r(A.value.incidents.bySeverity[s]||0),1)]),_:2},1032,["color"]))),128)),z("span",gt,r(e.$t("aiops.avgResolveLabel",{time:Re(A.value.incidents.avgResolveMs)})),1)]),_:1})]),_:1},8,["title"])):y("",!0),a(Ve,{activeKey:K.value,"onUpdate:activeKey":o[2]||(o[2]=s=>K.value=s),class:"aiops-tabs"},{default:l(()=>[a(ie,{key:"incidents",tab:e.$t("aiops.tabs.incidents")},{default:l(()=>[z("div",kt,[a(le,{value:q.value,"onUpdate:value":o[0]||(o[0]=s=>q.value=s),size:"small","button-style":"solid"},{default:l(()=>[a(U,{value:""},{default:l(()=>[c(r(e.$t("aiops.filter.all")),1)]),_:1}),(d(!0),v(R,null,J(k(pe),s=>(d(),C(U,{key:s,value:s},{default:l(()=>[c(r(s),1)]),_:2},1032,["value"]))),128))]),_:1},8,["value"]),a(le,{value:D.value,"onUpdate:value":o[1]||(o[1]=s=>D.value=s),size:"small"},{default:l(()=>[a(U,{value:""},{default:l(()=>[c(r(e.$t("aiops.filter.allStatuses")),1)]),_:1}),(d(!0),v(R,null,J(k(st),s=>(d(),C(U,{key:s,value:s},{default:l(()=>[c(r(fe(s)),1)]),_:2},1032,["value"]))),128))]),_:1},8,["value"])]),a(se,{columns:xe.value,"data-source":Ae.value,pagination:{pageSize:20,showTotal:s=>e.$t("aiops.table.totalSuffix",{n:s})},size:"small",loading:_.value,style:{background:"var(--bg-card)"}},{bodyCell:l(({column:s,record:p})=>[s.key==="severity"?(d(),C(N,{key:0,color:ae(p.severity),style:{"font-weight":"600"}},{default:l(()=>[c(r(p.severity),1)]),_:2},1032,["color"])):y("",!0),s.key==="metric"?(d(),v(R,{key:1},[p.anomalyMetric?(d(),v("span",_t,r(p.anomalyMetric),1)):(d(),v("span",$t,"—"))],64)):y("",!0),s.key==="description"?(d(),v("span",ht,r(ve(p.description,80)||"—"),1)):y("",!0),s.key==="status"?(d(),C(N,{key:3,color:Fe(p.status)},{default:l(()=>[c(r(fe(p.status)),1)]),_:2},1032,["color"])):y("",!0),s.key==="createdAt"?(d(),v("span",Ct,r(k(ce)(p.createdAt)),1)):y("",!0),s.key==="action"?(d(),v(R,{key:5},[p.status==="open"?(d(),C(u,{key:0,size:"small",type:"link",onClick:O=>Te(p)},{default:l(()=>[c(r(e.$t("aiops.incidentActions.ack")),1)]),_:1},8,["onClick"])):y("",!0),p.status==="open"||p.status==="acknowledged"?(d(),C(u,{key:1,size:"small",type:"link",onClick:O=>Ue(p)},{default:l(()=>[c(r(e.$t("aiops.incidentActions.resolve")),1)]),_:1},8,["onClick"])):y("",!0),p.status==="resolved"?(d(),C(u,{key:2,size:"small",type:"link",onClick:O=>qe(p)},{default:l(()=>[c(r(e.$t("aiops.incidentActions.close")),1)]),_:1},8,["onClick"])):y("",!0),p.status==="resolved"||p.status==="closed"?(d(),C(u,{key:3,size:"small",type:"link",onClick:O=>De(p)},{default:l(()=>[c(r(e.$t("aiops.incidentActions.postmortem")),1)]),_:1},8,["onClick"])):y("",!0)],64)):y("",!0)]),emptyText:l(()=>[z("div",xt,[a(k(re),{style:{"font-size":"36px","margin-bottom":"10px",display:"block"}}),c(" "+r(q.value||D.value?e.$t("aiops.table.incidentEmptyFiltered"):e.$t("aiops.table.incidentEmpty")),1)])]),_:1},8,["columns","data-source","pagination","loading"])]),_:1},8,["tab"]),a(ie,{key:"playbooks",tab:e.$t("aiops.tabs.playbooks")},{default:l(()=>[a(se,{columns:Se.value,"data-source":ye.value,pagination:{pageSize:20,showTotal:s=>e.$t("aiops.table.totalSuffix",{n:s})},size:"small",loading:_.value,style:{background:"var(--bg-card)"}},{bodyCell:l(({column:s,record:p})=>[s.key==="name"?(d(),v(R,{key:0},[z("span",St,r(p.name),1),p.triggerCondition?(d(),v("div",wt,r(ve(p.triggerCondition,80)),1)):y("",!0)],64)):y("",!0),s.key==="enabled"?(d(),C(Ke,{key:1,checked:p.enabled,size:"small",onChange:O=>Ee(p,O)},null,8,["checked","onChange"])):y("",!0),s.key==="stats"?(d(),v(R,{key:2},[a(N,{color:"green",style:{"font-size":"11px"}},{default:l(()=>[c(r(e.$t("aiops.table.successCount",{n:p.successCount})),1)]),_:2},1024),p.failureCount>0?(d(),C(N,{key:0,color:"red",style:{"font-size":"11px","margin-left":"4px"}},{default:l(()=>[c(r(e.$t("aiops.table.failureCount",{n:p.failureCount})),1)]),_:2},1024)):y("",!0)],64)):y("",!0),s.key==="createdAt"?(d(),v("span",zt,r(k(ce)(p.createdAt)),1)):y("",!0),s.key==="action"?(d(),v(R,{key:4},[a(u,{size:"small",type:"link",onClick:O=>be(p,"success")},{default:l(()=>[c(r(e.$t("aiops.playbookActions.success")),1)]),_:1},8,["onClick"]),a(u,{size:"small",type:"link",danger:"",onClick:O=>be(p,"failure")},{default:l(()=>[c(r(e.$t("aiops.playbookActions.failure")),1)]),_:1},8,["onClick"])],64)):y("",!0)]),emptyText:l(()=>[z("div",At,[a(k(ue),{style:{"font-size":"36px","margin-bottom":"10px",display:"block"}}),c(" "+r(e.$t("aiops.table.playbookEmpty")),1)])]),_:1},8,["columns","data-source","pagination","loading"])]),_:1},8,["tab"]),a(ie,{key:"baselines",tab:e.$t("aiops.tabs.baselines")},{default:l(()=>[a(se,{columns:we.value,"data-source":ee.value,pagination:{pageSize:20,showTotal:s=>e.$t("aiops.table.totalSuffix",{n:s})},size:"small",loading:_.value,style:{background:"var(--bg-card)"}},{bodyCell:l(({column:s,record:p})=>[s.key==="metric"?(d(),v("span",Ft,r(p.metricName),1)):y("",!0),s.key==="mean"?(d(),v(R,{key:1},[z("span",Pt,r(p.mean),1),z("span",Rt,"σ "+r(p.stdDev),1)],64)):y("",!0),s.key==="iqr"?(d(),v("span",jt," Q1 "+r(p.q1)+" / Q3 "+r(p.q3),1)):y("",!0),s.key==="sampleCount"?(d(),C(N,{key:3,color:"blue",style:{"font-size":"11px"}},{default:l(()=>[c(r(p.sampleCount),1)]),_:2},1024)):y("",!0),s.key==="updatedAt"?(d(),v("span",It,r(k(ce)(p.updatedAt)),1)):y("",!0)]),emptyText:l(()=>[z("div",Lt,[a(k(de),{style:{"font-size":"36px","margin-bottom":"10px",display:"block"}}),c(" "+r(e.$t("aiops.table.baselineEmpty")),1)])]),_:1},8,["columns","data-source","pagination","loading"])]),_:1},8,["tab"])]),_:1},8,["activeKey"]),a(G,{open:V.value,"onUpdate:open":o[6]||(o[6]=s=>V.value=s),title:e.$t("aiops.incident_modal.title"),"confirm-loading":S.value,width:520,"ok-text":e.$t("aiops.incident_modal.ok"),"cancel-text":e.$t("aiops.incident_modal.cancel"),onOk:Ie,onCancel:ge},{default:l(()=>[a(Z,{"label-col":{span:5},"wrapper-col":{span:19},style:{"margin-top":"16px"}},{default:l(()=>[a(P,{label:e.$t("aiops.incident_modal.severityLabel")},{default:l(()=>[a(Ce,{value:w.severity,"onUpdate:value":o[3]||(o[3]=s=>w.severity=s)},{default:l(()=>[(d(!0),v(R,null,J(k(pe),s=>(d(),C(he,{key:s,value:s},{default:l(()=>[c(r(s),1)]),_:2},1032,["value"]))),128))]),_:1},8,["value"])]),_:1},8,["label"]),a(P,{label:e.$t("aiops.incident_modal.metricLabel")},{default:l(()=>[a(ne,{value:w.metric,"onUpdate:value":o[4]||(o[4]=s=>w.metric=s),placeholder:e.$t("aiops.incident_modal.metricPlaceholder")},null,8,["value","placeholder"])]),_:1},8,["label"]),a(P,{label:e.$t("aiops.incident_modal.descLabel"),required:""},{default:l(()=>[a(W,{value:w.description,"onUpdate:value":o[5]||(o[5]=s=>w.description=s),"auto-size":{minRows:3,maxRows:6}},null,8,["value"])]),_:1},8,["label"])]),_:1})]),_:1},8,["open","title","confirm-loading","ok-text","cancel-text"]),a(G,{open:Q.value,"onUpdate:open":o[10]||(o[10]=s=>Q.value=s),title:e.$t("aiops.playbook_modal.title"),"confirm-loading":S.value,width:540,"ok-text":e.$t("aiops.playbook_modal.ok"),"cancel-text":e.$t("aiops.playbook_modal.cancel"),onOk:Le,onCancel:ke},{default:l(()=>[a(Z,{"label-col":{span:5},"wrapper-col":{span:19},style:{"margin-top":"16px"}},{default:l(()=>[a(P,{label:e.$t("aiops.playbook_modal.nameLabel"),required:""},{default:l(()=>[a(ne,{value:$.name,"onUpdate:value":o[7]||(o[7]=s=>$.name=s),placeholder:e.$t("aiops.playbook_modal.namePlaceholder")},null,8,["value","placeholder"])]),_:1},8,["label"]),a(P,{label:e.$t("aiops.playbook_modal.triggerLabel")},{default:l(()=>[a(W,{value:$.triggerJson,"onUpdate:value":o[8]||(o[8]=s=>$.triggerJson=s),placeholder:e.$t("aiops.playbook_modal.triggerPlaceholder"),"auto-size":{minRows:2,maxRows:4}},null,8,["value","placeholder"])]),_:1},8,["label"]),a(P,{label:e.$t("aiops.playbook_modal.stepsLabel")},{default:l(()=>[a(W,{value:$.stepsJson,"onUpdate:value":o[9]||(o[9]=s=>$.stepsJson=s),placeholder:e.$t("aiops.playbook_modal.stepsPlaceholder"),"auto-size":{minRows:3,maxRows:6}},null,8,["value","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["open","title","confirm-loading","ok-text","cancel-text"]),a(G,{open:Y.value,"onUpdate:open":o[13]||(o[13]=s=>Y.value=s),title:e.$t("aiops.baseline_modal.title"),"confirm-loading":S.value,width:500,"ok-text":e.$t("aiops.baseline_modal.ok"),"cancel-text":e.$t("aiops.baseline_modal.cancel"),onOk:Ne,onCancel:_e},{default:l(()=>[a(Z,{"label-col":{span:5},"wrapper-col":{span:19},style:{"margin-top":"16px"}},{default:l(()=>[a(P,{label:e.$t("aiops.baseline_modal.metricLabel"),required:""},{default:l(()=>[a(ne,{value:I.metric,"onUpdate:value":o[11]||(o[11]=s=>I.metric=s),placeholder:e.$t("aiops.baseline_modal.metricPlaceholder")},null,8,["value","placeholder"])]),_:1},8,["label"]),a(P,{label:e.$t("aiops.baseline_modal.valuesLabel"),required:""},{default:l(()=>[a(W,{value:I.values,"onUpdate:value":o[12]||(o[12]=s=>I.values=s),placeholder:e.$t("aiops.baseline_modal.valuesPlaceholder"),"auto-size":{minRows:3,maxRows:8}},null,8,["value","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["open","title","confirm-loading","ok-text","cancel-text"]),a(G,{open:te.value,"onUpdate:open":o[17]||(o[17]=s=>te.value=s),title:e.$t("aiops.detect_modal.title"),"confirm-loading":X.value,width:500,"ok-text":e.$t("aiops.detect_modal.ok"),"cancel-text":e.$t("aiops.detect_modal.cancel"),onOk:Oe},{default:l(()=>[a(Z,{"label-col":{span:5},"wrapper-col":{span:19},style:{"margin-top":"16px"}},{default:l(()=>[a(P,{label:e.$t("aiops.detect_modal.metricLabel"),required:""},{default:l(()=>[a(Ce,{value:F.metric,"onUpdate:value":o[14]||(o[14]=s=>F.metric=s),"show-search":"",placeholder:e.$t("aiops.detect_modal.metricPlaceholder")},{default:l(()=>[(d(!0),v(R,null,J(ee.value,s=>(d(),C(he,{key:s.metricName,value:s.metricName},{default:l(()=>[c(r(e.$t("aiops.detect_modal.metricOptionLabel",{name:s.metricName,count:s.sampleCount})),1)]),_:2},1032,["value"]))),128))]),_:1},8,["value","placeholder"])]),_:1},8,["label"]),a(P,{label:e.$t("aiops.detect_modal.valueLabel"),required:""},{default:l(()=>[a(Qe,{value:F.value,"onUpdate:value":o[15]||(o[15]=s=>F.value=s),style:{width:"100%"}},null,8,["value"])]),_:1},8,["label"]),a(P,{label:e.$t("aiops.detect_modal.algorithmLabel")},{default:l(()=>[a(le,{value:F.algorithm,"onUpdate:value":o[16]||(o[16]=s=>F.algorithm=s)},{default:l(()=>[a(U,{value:"z_score"},{default:l(()=>[...o[18]||(o[18]=[c("Z-Score (3σ)",-1)])]),_:1}),a(U,{value:"iqr"},{default:l(()=>[...o[19]||(o[19]=[c("IQR (1.5×)",-1)])]),_:1})]),_:1},8,["value"])]),_:1},8,["label"])]),_:1}),h.value?(d(),C(L,{key:0,size:"small",style:{background:"var(--bg-base)","margin-top":"8px"}},{default:l(()=>[a(T,{title:e.$t("aiops.detect_modal.resultTitle"),value:h.value.anomaly?e.$t("aiops.detect_modal.anomaly"):e.$t("aiops.detect_modal.normal"),"value-style":{color:h.value.anomaly?"#ff4d4f":"#52c41a"}},null,8,["title","value","value-style"]),h.value.reason&&!h.value.anomaly?(d(),v("div",Nt,r(e.$t("aiops.detect_modal.reasonLine",{reason:Pe(h.value.reason)})),1)):y("",!0),h.value.baseline?(d(),v("div",Ot,[z("div",null,r(e.$t("aiops.detect_modal.scoreLine",{score:h.value.score,threshold:h.value.threshold})),1),z("div",null,r(e.$t("aiops.detect_modal.baselineLine",{mean:h.value.baseline.mean,stdDev:h.value.baseline.stdDev})),1)])):y("",!0),h.value.incidentId?(d(),v("div",Tt,[a(N,{color:ae(h.value.severity)},{default:l(()=>[c(r(e.$t("aiops.detect_modal.incidentCreated",{severity:h.value.severity})),1)]),_:1},8,["color"])])):y("",!0)]),_:1})):y("",!0)]),_:1},8,["open","title","confirm-loading","ok-text","cancel-text"])])}}},ua=Ye(Ut,[["__scopeId","data-v-ecfcab22"]]);export{ua as default};
@@ -1 +1 @@
1
- import{O as b,f as i,v as p}from"./index-Cs66y4oC.js";import{B as O,c as y}from"./index-BVV2mBbo.js";import{e as m,s as r,d as P,o as R,c as x}from"./vendor-BXcBOG8b.js";const A=()=>{const n=r(!1);return m(()=>{n.value=!0}),n},D={type:{type:String},actionFn:Function,close:Function,autofocus:Boolean,prefixCls:String,buttonProps:p(),emitEvent:Boolean,quitOnNullishReturnValue:Boolean};function d(n){return!!(n&&n.then)}const j=P({compatConfig:{MODE:3},name:"ActionButton",props:D,setup(n,g){let{slots:B}=g;const l=r(!1),c=r(),a=r(!1);let f;const v=A();R(()=>{n.autofocus&&(f=setTimeout(()=>{var e,t;return(t=(e=b(c.value))===null||e===void 0?void 0:e.focus)===null||t===void 0?void 0:t.call(e)}))}),m(()=>{clearTimeout(f)});const u=function(){for(var e,t=arguments.length,o=new Array(t),s=0;s<t;s++)o[s]=arguments[s];(e=n.close)===null||e===void 0||e.call(n,...o)},h=e=>{d(e)&&(a.value=!0,e.then(function(){v.value||(a.value=!1),u(...arguments),l.value=!1},t=>(v.value||(a.value=!1),l.value=!1,Promise.reject(t))))},C=e=>{const{actionFn:t}=n;if(l.value)return;if(l.value=!0,!t){u();return}let o;if(n.emitEvent){if(o=t(e),n.quitOnNullishReturnValue&&!d(o)){l.value=!1,u(e);return}}else if(t.length)o=t(n.close),l.value=!1;else if(o=t(),!o){u();return}h(o)};return()=>{const{type:e,prefixCls:t,buttonProps:o}=n;return x(O,i(i(i({},y(e)),{},{onClick:C,loading:a.value,prefixCls:t},o),{},{ref:c}),B)}}});export{j as A};
1
+ import{O as b,f as i,v as p}from"./index-CzoKAiyT.js";import{B as O,c as y}from"./index-BLwY9y0X.js";import{e as m,s as r,d as P,o as R,c as x}from"./vendor-BXcBOG8b.js";const A=()=>{const n=r(!1);return m(()=>{n.value=!0}),n},D={type:{type:String},actionFn:Function,close:Function,autofocus:Boolean,prefixCls:String,buttonProps:p(),emitEvent:Boolean,quitOnNullishReturnValue:Boolean};function d(n){return!!(n&&n.then)}const j=P({compatConfig:{MODE:3},name:"ActionButton",props:D,setup(n,g){let{slots:B}=g;const l=r(!1),c=r(),a=r(!1);let f;const v=A();R(()=>{n.autofocus&&(f=setTimeout(()=>{var e,t;return(t=(e=b(c.value))===null||e===void 0?void 0:e.focus)===null||t===void 0?void 0:t.call(e)}))}),m(()=>{clearTimeout(f)});const u=function(){for(var e,t=arguments.length,o=new Array(t),s=0;s<t;s++)o[s]=arguments[s];(e=n.close)===null||e===void 0||e.call(n,...o)},h=e=>{d(e)&&(a.value=!0,e.then(function(){v.value||(a.value=!1),u(...arguments),l.value=!1},t=>(v.value||(a.value=!1),l.value=!1,Promise.reject(t))))},C=e=>{const{actionFn:t}=n;if(l.value)return;if(l.value=!0,!t){u();return}let o;if(n.emitEvent){if(o=t(e),n.quitOnNullishReturnValue&&!d(o)){l.value=!1,u(e);return}}else if(t.length)o=t(n.close),l.value=!1;else if(o=t(),!o){u();return}h(o)};return()=>{const{type:e,prefixCls:t,buttonProps:o}=n;return x(O,i(i(i({},y(e)),{},{onClick:C,loading:a.value,prefixCls:t},o),{},{ref:c}),B)}}});export{j as A};
@@ -1,3 +1,3 @@
1
- import{_ as fe,b as _e,u as ge,t as xe,d as I}from"./index-Cs66y4oC.js";import{R as ee,a6 as te,i as ae,aD as Te,w as he,aR as oe}from"./icons-DlxlFL4g.js";import{w as be,o as we,M as v,R,P as r,u as n,c as a,N as o,r as g,K as x,a as Q,L as c,O as y,Q as z,S as T,F as Ce,f as W}from"./vendor-BXcBOG8b.js";const Se={style:{display:"flex","align-items":"center","justify-content":"space-between","margin-bottom":"24px"}},Ie={class:"page-title"},ze={class:"page-sub"},Re={style:{display:"flex","align-items":"center",gap:"12px"}},Me={key:0,style:{"text-align":"center",padding:"60px"}},Oe={key:1,style:{color:"#e0e0e0","font-family":"monospace","font-size":"12px"}},je={key:2,style:{color:"#faad14"}},Fe={key:3,style:{color:"var(--text-secondary)"}},Ne={key:0,style:{"text-align":"center",padding:"60px"}},Ue={key:0,style:{color:"var(--text-secondary)","font-size":"12px","font-family":"monospace"}},Ae={key:2,style:{color:"#e0e0e0","font-family":"monospace","font-size":"12px"}},Be={key:3,style:{color:"#faad14"}},Le={key:4,style:{color:"var(--text-secondary)"}},De={key:0,style:{"text-align":"center",padding:"40px"}},Pe={key:1,style:{color:"#e0e0e0","font-family":"monospace","font-size":"12px"}},Je={key:0,style:{"text-align":"center",padding:"40px"}},$e={__name:"Analytics",setup(Ee){const{t:l}=_e(),C=ge(),M=g("all"),U=g(!1),A=g(!1),B=g(!1),L=g(!1),D=g(!1),P=g(!1),J=g(20),f=Q({totalCalls:0,totalTokens:0,totalCost:0,avgResponseTime:0}),O=g([]),j=g([]),_=Q({entries:0,hits:0,tokensSaved:0,expired:0}),F=g(!1),b=Q({totalCalls:0,inputTokens:0,outputTokens:0,totalTokens:0}),q=g([]),se=W(()=>[{title:"Provider",key:"provider",dataIndex:"provider",width:"120px"},{title:"Model",key:"model",dataIndex:"model",ellipsis:!0},{title:l("analytics.sessionUsageColumns.calls"),key:"calls",dataIndex:"calls",width:"100px",sorter:(e,t)=>(e.calls||0)-(t.calls||0)},{title:"Input",key:"inputTokens",dataIndex:"inputTokens",width:"110px",sorter:(e,t)=>(e.inputTokens||0)-(t.inputTokens||0)},{title:"Output",key:"outputTokens",dataIndex:"outputTokens",width:"110px",sorter:(e,t)=>(e.outputTokens||0)-(t.outputTokens||0)},{title:"Total",key:"totalTokens",dataIndex:"totalTokens",width:"110px",sorter:(e,t)=>(e.totalTokens||0)-(t.totalTokens||0)}]),le=W(()=>[{title:"Provider",key:"provider",dataIndex:"provider",width:"120px",sorter:(e,t)=>(e.provider||"").localeCompare(t.provider||"")},{title:"Model",key:"model",dataIndex:"model",ellipsis:!0,sorter:(e,t)=>(e.model||"").localeCompare(t.model||"")},{title:l("analytics.breakdownColumns.calls"),key:"calls",dataIndex:"calls",width:"100px",sorter:(e,t)=>(e.calls||0)-(t.calls||0)},{title:l("analytics.breakdownColumns.inputTokens"),key:"inputTokens",dataIndex:"inputTokens",width:"120px",sorter:(e,t)=>(e.inputTokens||0)-(t.inputTokens||0)},{title:l("analytics.breakdownColumns.outputTokens"),key:"outputTokens",dataIndex:"outputTokens",width:"130px",sorter:(e,t)=>(e.outputTokens||0)-(t.outputTokens||0)},{title:l("analytics.breakdownColumns.totalTokens"),key:"totalTokens",dataIndex:"totalTokens",width:"120px",sorter:(e,t)=>(e.totalTokens||0)-(t.totalTokens||0)},{title:l("analytics.breakdownColumns.cost"),key:"cost",dataIndex:"cost",width:"110px",sorter:(e,t)=>(e.cost||0)-(t.cost||0)},{title:l("analytics.breakdownColumns.avgResponseTime"),key:"avgResponseTime",dataIndex:"avgResponseTime",width:"110px",sorter:(e,t)=>(e.avgResponseTime||0)-(t.avgResponseTime||0)}]),ne=W(()=>[{title:l("analytics.recentColumns.timestamp"),key:"timestamp",dataIndex:"timestamp",width:"180px"},{title:"Provider",key:"provider",dataIndex:"provider",width:"110px"},{title:"Model",key:"model",dataIndex:"model",ellipsis:!0},{title:l("analytics.recentColumns.input"),key:"inputTokens",dataIndex:"inputTokens",width:"90px"},{title:l("analytics.recentColumns.output"),key:"outputTokens",dataIndex:"outputTokens",width:"90px"},{title:l("analytics.recentColumns.cost"),key:"cost",dataIndex:"cost",width:"100px"},{title:l("analytics.recentColumns.responseTime"),key:"responseTime",dataIndex:"responseTime",width:"100px"}]);function w(e){return(e||"").replace(/,/g,"")}function S(e){return xe(e)}function re(e){const t=(e||"").split(`
1
+ import{_ as fe,b as _e,u as ge,t as xe,d as I}from"./index-CzoKAiyT.js";import{R as ee,a6 as te,i as ae,aD as Te,w as he,aR as oe}from"./icons-DlxlFL4g.js";import{w as be,o as we,M as v,R,P as r,u as n,c as a,N as o,r as g,K as x,a as Q,L as c,O as y,Q as z,S as T,F as Ce,f as W}from"./vendor-BXcBOG8b.js";const Se={style:{display:"flex","align-items":"center","justify-content":"space-between","margin-bottom":"24px"}},Ie={class:"page-title"},ze={class:"page-sub"},Re={style:{display:"flex","align-items":"center",gap:"12px"}},Me={key:0,style:{"text-align":"center",padding:"60px"}},Oe={key:1,style:{color:"#e0e0e0","font-family":"monospace","font-size":"12px"}},je={key:2,style:{color:"#faad14"}},Fe={key:3,style:{color:"var(--text-secondary)"}},Ne={key:0,style:{"text-align":"center",padding:"60px"}},Ue={key:0,style:{color:"var(--text-secondary)","font-size":"12px","font-family":"monospace"}},Ae={key:2,style:{color:"#e0e0e0","font-family":"monospace","font-size":"12px"}},Be={key:3,style:{color:"#faad14"}},Le={key:4,style:{color:"var(--text-secondary)"}},De={key:0,style:{"text-align":"center",padding:"40px"}},Pe={key:1,style:{color:"#e0e0e0","font-family":"monospace","font-size":"12px"}},Je={key:0,style:{"text-align":"center",padding:"40px"}},$e={__name:"Analytics",setup(Ee){const{t:l}=_e(),C=ge(),M=g("all"),U=g(!1),A=g(!1),B=g(!1),L=g(!1),D=g(!1),P=g(!1),J=g(20),f=Q({totalCalls:0,totalTokens:0,totalCost:0,avgResponseTime:0}),O=g([]),j=g([]),_=Q({entries:0,hits:0,tokensSaved:0,expired:0}),F=g(!1),b=Q({totalCalls:0,inputTokens:0,outputTokens:0,totalTokens:0}),q=g([]),se=W(()=>[{title:"Provider",key:"provider",dataIndex:"provider",width:"120px"},{title:"Model",key:"model",dataIndex:"model",ellipsis:!0},{title:l("analytics.sessionUsageColumns.calls"),key:"calls",dataIndex:"calls",width:"100px",sorter:(e,t)=>(e.calls||0)-(t.calls||0)},{title:"Input",key:"inputTokens",dataIndex:"inputTokens",width:"110px",sorter:(e,t)=>(e.inputTokens||0)-(t.inputTokens||0)},{title:"Output",key:"outputTokens",dataIndex:"outputTokens",width:"110px",sorter:(e,t)=>(e.outputTokens||0)-(t.outputTokens||0)},{title:"Total",key:"totalTokens",dataIndex:"totalTokens",width:"110px",sorter:(e,t)=>(e.totalTokens||0)-(t.totalTokens||0)}]),le=W(()=>[{title:"Provider",key:"provider",dataIndex:"provider",width:"120px",sorter:(e,t)=>(e.provider||"").localeCompare(t.provider||"")},{title:"Model",key:"model",dataIndex:"model",ellipsis:!0,sorter:(e,t)=>(e.model||"").localeCompare(t.model||"")},{title:l("analytics.breakdownColumns.calls"),key:"calls",dataIndex:"calls",width:"100px",sorter:(e,t)=>(e.calls||0)-(t.calls||0)},{title:l("analytics.breakdownColumns.inputTokens"),key:"inputTokens",dataIndex:"inputTokens",width:"120px",sorter:(e,t)=>(e.inputTokens||0)-(t.inputTokens||0)},{title:l("analytics.breakdownColumns.outputTokens"),key:"outputTokens",dataIndex:"outputTokens",width:"130px",sorter:(e,t)=>(e.outputTokens||0)-(t.outputTokens||0)},{title:l("analytics.breakdownColumns.totalTokens"),key:"totalTokens",dataIndex:"totalTokens",width:"120px",sorter:(e,t)=>(e.totalTokens||0)-(t.totalTokens||0)},{title:l("analytics.breakdownColumns.cost"),key:"cost",dataIndex:"cost",width:"110px",sorter:(e,t)=>(e.cost||0)-(t.cost||0)},{title:l("analytics.breakdownColumns.avgResponseTime"),key:"avgResponseTime",dataIndex:"avgResponseTime",width:"110px",sorter:(e,t)=>(e.avgResponseTime||0)-(t.avgResponseTime||0)}]),ne=W(()=>[{title:l("analytics.recentColumns.timestamp"),key:"timestamp",dataIndex:"timestamp",width:"180px"},{title:"Provider",key:"provider",dataIndex:"provider",width:"110px"},{title:"Model",key:"model",dataIndex:"model",ellipsis:!0},{title:l("analytics.recentColumns.input"),key:"inputTokens",dataIndex:"inputTokens",width:"90px"},{title:l("analytics.recentColumns.output"),key:"outputTokens",dataIndex:"outputTokens",width:"90px"},{title:l("analytics.recentColumns.cost"),key:"cost",dataIndex:"cost",width:"100px"},{title:l("analytics.recentColumns.responseTime"),key:"responseTime",dataIndex:"responseTime",width:"100px"}]);function w(e){return(e||"").replace(/,/g,"")}function S(e){return xe(e)}function re(e){const t=(e||"").split(`
2
2
  `);for(const s of t){const u=s.trim(),h=u.match(/total\s*calls?\s*[::]\s*([\d,]+)/i);h&&(f.totalCalls=parseInt(w(h[1]),10)||0);const d=u.match(/total\s*tokens?\s*[::]\s*([\d,]+)/i);d&&(f.totalTokens=parseInt(w(d[1]),10)||0);const k=u.match(/cost\s*[::]\s*\$?([\d,.]+)/i);k&&(f.totalCost=parseFloat(w(k[1]))||0);const p=u.match(/(?:avg|average)\s*(?:response\s*)?time\s*[::]\s*([\d,.]+)/i);p&&(f.avgResponseTime=parseFloat(w(p[1]))||0)}}function ie(e){f.totalCalls=e.totalCalls??e.total_calls??e.calls??0,f.totalTokens=e.totalTokens??e.total_tokens??e.tokens??0,f.totalCost=e.totalCost??e.total_cost??e.cost??0,f.avgResponseTime=e.avgResponseTime??e.avg_response_time??e.avgTime??0}function ce(e){return(Array.isArray(e)?e:e.breakdown||e.providers||e.rows||[]).map((s,u)=>({key:u,provider:s.provider||"-",model:s.model||"-",calls:s.calls||s.count||0,inputTokens:s.inputTokens??s.input_tokens??0,outputTokens:s.outputTokens??s.output_tokens??0,totalTokens:s.totalTokens??s.total_tokens??(s.inputTokens??0)+(s.outputTokens??0),cost:s.cost??s.total_cost??0,avgResponseTime:s.avgResponseTime??s.avg_response_time??0}))}function ue(e){return(Array.isArray(e)?e:e.recent||e.records||e.rows||[]).map((s,u)=>({key:u,timestamp:s.timestamp||s.time||s.created_at||"-",provider:s.provider||"-",model:s.model||"-",inputTokens:s.inputTokens??s.input_tokens??0,outputTokens:s.outputTokens??s.output_tokens??0,cost:s.cost??0,responseTime:s.responseTime??s.response_time??0}))}function de(e){_.entries=e.entries??e.count??e.size??0,_.hits=e.hits??e.cacheHits??e.cache_hits??0,_.tokensSaved=e.tokensSaved??e.tokens_saved??0,_.expired=e.expired??e.expiredCount??e.expired_count??0}function pe(e){const t=(e||"").split(`
3
3
  `);for(const s of t){const u=s.trim(),h=u.match(/entries?\s*[::]\s*([\d,]+)/i);h&&(_.entries=parseInt(w(h[1]),10)||0);const d=u.match(/hits?\s*[::]\s*([\d,]+)/i);d&&(_.hits=parseInt(w(d[1]),10)||0);const k=u.match(/(?:tokens?\s*)?saved\s*[::]\s*([\d,]+)/i);k&&(_.tokensSaved=parseInt(w(k[1]),10)||0);const p=u.match(/expired?\s*[::]\s*([\d,]+)/i);p&&(_.expired=parseInt(w(p[1]),10)||0)}}async function G(){U.value=!0;try{const{output:e}=await C.execute(`tokens show --period ${M.value} --json`,15e3),t=S(e);t?ie(t):re(e)}catch(e){console.error("loadSummary failed:",e)}finally{U.value=!1}}async function ye(){A.value=!0;try{const{output:e}=await C.execute("tokens breakdown --json",15e3),t=S(e);t?O.value=ce(t):O.value=[]}catch(e){console.error("loadBreakdown failed:",e),O.value=[]}finally{A.value=!1}}async function X(){B.value=!0;try{const{output:e}=await C.execute(`tokens recent --limit ${J.value} --json`,15e3),t=S(e);t?j.value=ue(t):j.value=[]}catch(e){console.error("loadRecent failed:",e),j.value=[]}finally{B.value=!1}}async function $(){L.value=!0;try{const{output:e}=await C.execute("tokens cache --json",15e3),t=S(e);t?de(t):pe(e)}catch(e){console.error("loadCache failed:",e)}finally{L.value=!1}}async function ke(){D.value=!0;try{const{output:e}=await C.execute("tokens cache --clear --json",15e3),t=S(e);t&&t.error?I.error(l("analytics.messages.cacheClearFailed",{err:t.error})):(I.success(l("analytics.messages.cacheClearOk")),await $())}catch(e){I.error(l("analytics.messages.cacheClearFailed",{err:e.message}))}finally{D.value=!1}}async function ve(){P.value=!0;try{const{output:e}=await C.execute("tokens cache --cleanup --json",15e3),t=S(e);t&&t.error?I.error(l("analytics.messages.cacheCleanupFailed",{err:t.error})):(I.success(l("analytics.messages.cacheCleanupOk")),await $())}catch(e){I.error(l("analytics.messages.cacheCleanupFailed",{err:e.message}))}finally{P.value=!1}}async function Y(){F.value=!0;try{const e=await C.sendRaw({type:"usage.global",limit:1e3},15e3);if(e.ok&&e.usage){const t=e.usage.total||{};b.totalCalls=t.calls??0,b.inputTokens=t.inputTokens??t.input_tokens??0,b.outputTokens=t.outputTokens??t.output_tokens??0,b.totalTokens=t.totalTokens??t.total_tokens??0,q.value=(e.usage.byModel||[]).map((s,u)=>({key:u,provider:s.provider||"-",model:s.model||"-",calls:s.calls??0,inputTokens:s.inputTokens??s.input_tokens??0,outputTokens:s.outputTokens??s.output_tokens??0,totalTokens:s.totalTokens??s.total_tokens??0}))}}catch(e){console.warn("loadSessionUsage failed (route may not be available):",e.message)}finally{F.value=!1}}async function Z(){await Promise.all([G(),ye(),X(),$(),Y()])}return be(M,()=>{G()}),we(Z),(e,t)=>{const s=x("a-radio-button"),u=x("a-radio-group"),h=x("a-button"),d=x("a-statistic"),k=x("a-card"),p=x("a-col"),E=x("a-row"),N=x("a-spin"),V=x("a-tag"),H=x("a-empty"),K=x("a-table"),me=x("a-space");return c(),v("div",null,[R("div",Se,[R("div",null,[R("h2",Ie,r(n(l)("analytics.title")),1),R("p",ze,r(n(l)("analytics.subtitle")),1)]),R("div",Re,[a(u,{value:M.value,"onUpdate:value":t[0]||(t[0]=i=>M.value=i),"button-style":"solid",size:"small"},{default:o(()=>[a(s,{value:"today"},{default:o(()=>[y(r(n(l)("analytics.period.today")),1)]),_:1}),a(s,{value:"week"},{default:o(()=>[y(r(n(l)("analytics.period.week")),1)]),_:1}),a(s,{value:"month"},{default:o(()=>[y(r(n(l)("analytics.period.month")),1)]),_:1}),a(s,{value:"all"},{default:o(()=>[y(r(n(l)("analytics.period.all")),1)]),_:1})]),_:1},8,["value"]),a(h,{type:"primary",ghost:"",loading:U.value,onClick:Z},{icon:o(()=>[a(n(ee))]),default:o(()=>[y(" "+r(n(l)("analytics.refresh")),1)]),_:1},8,["loading"])])]),a(E,{gutter:[16,16],style:{"margin-bottom":"20px"}},{default:o(()=>[a(p,{xs:24,sm:12,lg:6},{default:o(()=>[a(k,{style:{background:"var(--bg-card)","border-color":"var(--border-color)"}},{default:o(()=>[a(d,{title:n(l)("analytics.summary.totalCalls"),value:f.totalCalls,"value-style":{color:"#1677ff",fontSize:"20px"}},{prefix:o(()=>[a(n(te))]),suffix:o(()=>[y(r(n(l)("analytics.summary.callsSuffix")),1)]),_:1},8,["title","value"])]),_:1})]),_:1}),a(p,{xs:24,sm:12,lg:6},{default:o(()=>[a(k,{style:{background:"var(--bg-card)","border-color":"var(--border-color)"}},{default:o(()=>[a(d,{title:n(l)("analytics.summary.totalTokens"),value:f.totalTokens,"value-style":{color:"#52c41a",fontSize:"20px"}},{prefix:o(()=>[a(n(ae))]),_:1},8,["title","value"])]),_:1})]),_:1}),a(p,{xs:24,sm:12,lg:6},{default:o(()=>[a(k,{style:{background:"var(--bg-card)","border-color":"var(--border-color)"}},{default:o(()=>[a(d,{title:n(l)("analytics.summary.totalCost"),value:f.totalCost,precision:4,"value-style":{color:"#faad14",fontSize:"20px"}},{prefix:o(()=>[a(n(Te))]),suffix:o(()=>[...t[2]||(t[2]=[y("USD",-1)])]),_:1},8,["title","value"])]),_:1})]),_:1}),a(p,{xs:24,sm:12,lg:6},{default:o(()=>[a(k,{style:{background:"var(--bg-card)","border-color":"var(--border-color)"}},{default:o(()=>[a(d,{title:n(l)("analytics.summary.avgResponseTime"),value:f.avgResponseTime,"value-style":{color:"#722ed1",fontSize:"20px"}},{prefix:o(()=>[a(n(ae))]),suffix:o(()=>[...t[3]||(t[3]=[y("ms",-1)])]),_:1},8,["title","value"])]),_:1})]),_:1})]),_:1}),a(k,{title:n(l)("analytics.providerCardTitle"),style:{background:"var(--bg-card)","border-color":"var(--border-color)","margin-bottom":"20px"}},{default:o(()=>[A.value?(c(),v("div",Me,[a(N,{size:"large"})])):(c(),z(K,{key:1,columns:le.value,"data-source":O.value,pagination:{pageSize:20,showTotal:i=>n(l)("analytics.totals.rows",{count:i})},size:"small",style:{background:"var(--bg-card)"},"row-class-name":()=>"analytics-row"},{bodyCell:o(({column:i,record:m})=>[i.key==="provider"?(c(),z(V,{key:0,color:"blue"},{default:o(()=>[y(r(m.provider),1)]),_:2},1024)):T("",!0),i.key==="model"?(c(),v("span",Oe,r(m.model),1)):T("",!0),i.key==="cost"?(c(),v("span",je,"$"+r((m.cost||0).toFixed(4)),1)):T("",!0),i.key==="avgResponseTime"?(c(),v("span",Fe,r(m.avgResponseTime||0)+" ms",1)):T("",!0)]),emptyText:o(()=>[a(H,{description:n(l)("analytics.providerEmpty")},null,8,["description"])]),_:1},8,["columns","data-source","pagination"]))]),_:1},8,["title"]),a(k,{title:n(l)("analytics.recentCardTitle"),style:{background:"var(--bg-card)","border-color":"var(--border-color)","margin-bottom":"20px"}},{extra:o(()=>[a(u,{value:J.value,"onUpdate:value":t[1]||(t[1]=i=>J.value=i),size:"small",onChange:X},{default:o(()=>[a(s,{value:10},{default:o(()=>[...t[4]||(t[4]=[y("10",-1)])]),_:1}),a(s,{value:20},{default:o(()=>[...t[5]||(t[5]=[y("20",-1)])]),_:1}),a(s,{value:50},{default:o(()=>[...t[6]||(t[6]=[y("50",-1)])]),_:1})]),_:1},8,["value"])]),default:o(()=>[B.value?(c(),v("div",Ne,[a(N,{size:"large"})])):(c(),z(K,{key:1,columns:ne.value,"data-source":j.value,pagination:{pageSize:20,showTotal:i=>n(l)("analytics.totals.rows",{count:i})},size:"small",style:{background:"var(--bg-card)"},"row-class-name":()=>"analytics-row"},{bodyCell:o(({column:i,record:m})=>[i.key==="timestamp"?(c(),v("span",Ue,r(m.timestamp),1)):T("",!0),i.key==="provider"?(c(),z(V,{key:1,color:"blue"},{default:o(()=>[y(r(m.provider),1)]),_:2},1024)):T("",!0),i.key==="model"?(c(),v("span",Ae,r(m.model),1)):T("",!0),i.key==="cost"?(c(),v("span",Be,"$"+r((m.cost||0).toFixed(4)),1)):T("",!0),i.key==="responseTime"?(c(),v("span",Le,r(m.responseTime||0)+" ms",1)):T("",!0)]),emptyText:o(()=>[a(H,{description:n(l)("analytics.recentEmpty")},null,8,["description"])]),_:1},8,["columns","data-source","pagination"]))]),_:1},8,["title"]),a(k,{title:n(l)("analytics.sessionCardTitle"),style:{background:"var(--bg-card)","border-color":"var(--border-color)","margin-bottom":"20px"}},{extra:o(()=>[a(h,{size:"small",loading:F.value,onClick:Y,style:{background:"var(--bg-card-hover)","border-color":"var(--border-color)"}},{icon:o(()=>[a(n(ee))]),default:o(()=>[y(" "+r(n(l)("analytics.refresh")),1)]),_:1},8,["loading"])]),default:o(()=>[F.value?(c(),v("div",De,[a(N)])):(c(),v(Ce,{key:1},[a(E,{gutter:[16,16],style:{"margin-bottom":"16px"}},{default:o(()=>[a(p,{xs:12,sm:6},{default:o(()=>[a(d,{title:n(l)("analytics.sessionStats.totalCalls"),value:b.totalCalls,"value-style":{color:"#1677ff",fontSize:"18px"}},{prefix:o(()=>[a(n(te))]),_:1},8,["title","value"])]),_:1}),a(p,{xs:12,sm:6},{default:o(()=>[a(d,{title:n(l)("analytics.sessionStats.inputTokens"),value:b.inputTokens,"value-style":{color:"#52c41a",fontSize:"18px"}},null,8,["title","value"])]),_:1}),a(p,{xs:12,sm:6},{default:o(()=>[a(d,{title:n(l)("analytics.sessionStats.outputTokens"),value:b.outputTokens,"value-style":{color:"#faad14",fontSize:"18px"}},null,8,["title","value"])]),_:1}),a(p,{xs:12,sm:6},{default:o(()=>[a(d,{title:n(l)("analytics.sessionStats.totalTokens"),value:b.totalTokens,"value-style":{color:"#722ed1",fontSize:"18px"}},null,8,["title","value"])]),_:1})]),_:1}),a(K,{columns:se.value,"data-source":q.value,pagination:!1,size:"small",style:{background:"var(--bg-card)"},"row-class-name":()=>"analytics-row"},{bodyCell:o(({column:i,record:m})=>[i.key==="provider"?(c(),z(V,{key:0,color:"blue"},{default:o(()=>[y(r(m.provider),1)]),_:2},1024)):T("",!0),i.key==="model"?(c(),v("span",Pe,r(m.model),1)):T("",!0)]),emptyText:o(()=>[a(H,{description:n(l)("analytics.sessionEmpty")},null,8,["description"])]),_:1},8,["columns","data-source"])],64))]),_:1},8,["title"]),a(k,{title:n(l)("analytics.cacheCardTitle"),style:{background:"var(--bg-card)","border-color":"var(--border-color)"}},{extra:o(()=>[a(me,null,{default:o(()=>[a(h,{size:"small",loading:P.value,onClick:ve,style:{background:"var(--bg-card-hover)","border-color":"var(--border-color)"}},{icon:o(()=>[a(n(oe))]),default:o(()=>[y(" "+r(n(l)("analytics.cacheActions.cleanup")),1)]),_:1},8,["loading"]),a(h,{size:"small",danger:"",loading:D.value,onClick:ke,style:{"border-color":"var(--border-color)"}},{icon:o(()=>[a(n(oe))]),default:o(()=>[y(" "+r(n(l)("analytics.cacheActions.clear")),1)]),_:1},8,["loading"])]),_:1})]),default:o(()=>[L.value?(c(),v("div",Je,[a(N)])):(c(),z(E,{key:1,gutter:[16,16]},{default:o(()=>[a(p,{xs:12,sm:6},{default:o(()=>[a(d,{title:n(l)("analytics.cacheStats.entries"),value:_.entries,"value-style":{color:"#1677ff",fontSize:"18px"}},{prefix:o(()=>[a(n(he))]),_:1},8,["title","value"])]),_:1}),a(p,{xs:12,sm:6},{default:o(()=>[a(d,{title:n(l)("analytics.cacheStats.hits"),value:_.hits,"value-style":{color:"#52c41a",fontSize:"18px"}},null,8,["title","value"])]),_:1}),a(p,{xs:12,sm:6},{default:o(()=>[a(d,{title:n(l)("analytics.cacheStats.tokensSaved"),value:_.tokensSaved,"value-style":{color:"#faad14",fontSize:"18px"}},null,8,["title","value"])]),_:1}),a(p,{xs:12,sm:6},{default:o(()=>[a(d,{title:n(l)("analytics.cacheStats.expired"),value:_.expired,"value-style":{color:"#ff4d4f",fontSize:"18px"}},null,8,["title","value"])]),_:1})]),_:1}))]),_:1},8,["title"])])}}},Qe=fe($e,[["__scopeId","data-v-c636a5e0"]]);export{Qe as default};