chainlesschain 0.162.149 → 0.162.150
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/assets/web-panel/assets/{AIOps-BJif14yR.js → AIOps-CBLvrjeG.js} +1 -1
- package/src/assets/web-panel/assets/{ActionButton-CXek6gJY.js → ActionButton-DYv2GtE0.js} +1 -1
- package/src/assets/web-panel/assets/{Analytics-BgQhdAJi.js → Analytics-CL6PZ-Ww.js} +3 -3
- package/src/assets/web-panel/assets/{AppLayout-DTYl5NtR.js → AppLayout-xuyHt4uA.js} +3 -3
- package/src/assets/web-panel/assets/{Audit-BzATQAeR.js → Audit-DOvSVycq.js} +1 -1
- package/src/assets/web-panel/assets/{Backup-BzdPEQhL.js → Backup-DMhfTswr.js} +1 -1
- package/src/assets/web-panel/assets/{BaseInput-BM0KVh8E.js → BaseInput-CQxDdm63.js} +1 -1
- package/src/assets/web-panel/assets/{Chat-D7fHXHkz.js → Chat-BEeNhK2a.js} +5 -5
- package/src/assets/web-panel/assets/{ChatBubbleRenderer-Wm34RR-b.js → ChatBubbleRenderer-8nul8eTq.js} +1 -1
- package/src/assets/web-panel/assets/{Checkbox-CAiSQ9vO.js → Checkbox-CL04O-ER.js} +1 -1
- package/src/assets/web-panel/assets/{Codegen-Df40CrEe.js → Codegen-C50o-n7x.js} +1 -1
- package/src/assets/web-panel/assets/{Col-DIT2fNFU.js → Col-CH-bDkzs.js} +1 -1
- package/src/assets/web-panel/assets/{Community-CSTIbW2k.js → Community-DqAIMvSe.js} +1 -1
- package/src/assets/web-panel/assets/{Compact-DtqXZZUi.js → Compact-C43fo_my.js} +1 -1
- package/src/assets/web-panel/assets/{Compliance-CUtzw6o7.js → Compliance-BERnMrdP.js} +1 -1
- package/src/assets/web-panel/assets/{Cowork-CezmlnmU.js → Cowork-Baw3w1gp.js} +4 -4
- package/src/assets/web-panel/assets/{Cron-P4BITarg.js → Cron-BEqAHF1-.js} +2 -2
- package/src/assets/web-panel/assets/{Crosschain-BRRiYwvq.js → Crosschain-CvnmKwK4.js} +1 -1
- package/src/assets/web-panel/assets/{DID-L5ijB9i4.js → DID-iMPxgVdt.js} +2 -2
- package/src/assets/web-panel/assets/{Dashboard-CFxro4ob.js → Dashboard--4SJX3YR.js} +2 -2
- package/src/assets/web-panel/assets/{Dropdown-BmAFCQ71.js → Dropdown-BgLV6xgz.js} +1 -1
- package/src/assets/web-panel/assets/{EmailListRenderer-DJBCEuon.js → EmailListRenderer-Bvb8oUD8.js} +1 -1
- package/src/assets/web-panel/assets/{FamilyGuardDashboard-z4oLq6eT.js → FamilyGuardDashboard-DpXPjJB5.js} +1 -1
- package/src/assets/web-panel/assets/{Federation-DsVCpHMF.js → Federation-BbFfJ1Xi.js} +1 -1
- package/src/assets/web-panel/assets/{FormItemContext-DP3bP5th.js → FormItemContext-DeGq1B-q.js} +1 -1
- package/src/assets/web-panel/assets/{GenericCardRenderer-BAXP2Gc6.js → GenericCardRenderer-CNW7s9zM.js} +1 -1
- package/src/assets/web-panel/assets/{Git-I3g_bAw9.js → Git-L1PjW-lT.js} +2 -2
- package/src/assets/web-panel/assets/{Governance-jHS5-ioS.js → Governance-PK-X58to.js} +1 -1
- package/src/assets/web-panel/assets/{Inference-CPL7sfx9.js → Inference-BePWEH-d.js} +1 -1
- package/src/assets/web-panel/assets/{KnowledgeGraph-Jf236h4C.js → KnowledgeGraph-LF_sBvdL.js} +1 -1
- package/src/assets/web-panel/assets/{Logs-Cm2tcSKg.js → Logs-BKkfk9hy.js} +2 -2
- package/src/assets/web-panel/assets/{Marketplace-CZK82rhi.js → Marketplace-BNMqUDla.js} +1 -1
- package/src/assets/web-panel/assets/{McpTools-CZCeji7a.js → McpTools-w4WPiyz2.js} +5 -5
- package/src/assets/web-panel/assets/{Memory-3l2KVS9k.js → Memory-DUKMVGNi.js} +2 -2
- package/src/assets/web-panel/assets/{MobileBridge-VYdpoLh6.js → MobileBridge-BWhiEyTJ.js} +1 -1
- package/src/assets/web-panel/assets/{MobileProjects-CiB9cmm1.js → MobileProjects-Ocf5JEkX.js} +1 -1
- package/src/assets/web-panel/assets/{Mtc-wCFZbBuL.js → Mtc-D2B6MMhU.js} +4 -4
- package/src/assets/web-panel/assets/{MtcAudit-1a3THIyG.js → MtcAudit-DdYjCq1O.js} +2 -2
- package/src/assets/web-panel/assets/{Multisig-DMzLB2hG.js → Multisig-Cb1hfuUZ.js} +3 -3
- package/src/assets/web-panel/assets/{NLProgramming-D9wZbf6l.js → NLProgramming-CTeImGp7.js} +1 -1
- package/src/assets/web-panel/assets/{Notes-hrFe2ZM-.js → Notes-BjYNc7eQ.js} +4 -4
- package/src/assets/web-panel/assets/{NotificationSettings-CHGX5Jwm.js → NotificationSettings-Dn_NtRXQ.js} +1 -1
- package/src/assets/web-panel/assets/OrderTableRenderer-DVYYIizh.js +1 -0
- package/src/assets/web-panel/assets/{Organization-By7FkhtY.js → Organization-Be2Kmr5j.js} +4 -4
- package/src/assets/web-panel/assets/{Overflow--khGSzJn.js → Overflow-Cu_-qRlR.js} +1 -1
- package/src/assets/web-panel/assets/{P2P-CAG9dH35.js → P2P-DD2HoGzE.js} +2 -2
- package/src/assets/web-panel/assets/{PdhVaultBrowser-B3SQZmK9.js → PdhVaultBrowser-BRI7DVth.js} +3 -3
- package/src/assets/web-panel/assets/{Permissions-D35ec6JA.js → Permissions-C9Srcs2M.js} +3 -3
- package/src/assets/web-panel/assets/{PersonalDataHub-CxBF7hW_.js → PersonalDataHub-CUqcMgo1.js} +3 -3
- package/src/assets/web-panel/assets/{Pipeline-s6EtOO1s.js → Pipeline-HBrQGLXt.js} +1 -1
- package/src/assets/web-panel/assets/{Privacy-BbJYmWmO.js → Privacy-D-B0vjwh.js} +1 -1
- package/src/assets/web-panel/assets/{ProjectInit-VGQq1jMT.js → ProjectInit-eTeLIu9e.js} +2 -2
- package/src/assets/web-panel/assets/{ProjectSettings-B1ew3Teh.js → ProjectSettings-DrRqCsC6.js} +2 -2
- package/src/assets/web-panel/assets/Projects-1G9DNOhI.js +1 -0
- package/src/assets/web-panel/assets/{Providers-mrO47FIK.js → Providers-RkTZzpxP.js} +1 -1
- package/src/assets/web-panel/assets/{QrScannerModal-IJF2mHyw.js → QrScannerModal-BSCUgsgC.js} +1 -1
- package/src/assets/web-panel/assets/{QuickAsk-CU0wN_Z0.js → QuickAsk-CHgyM3Bz.js} +1 -1
- package/src/assets/web-panel/assets/{Recommend-DhN37R6G.js → Recommend-0lry4OZq.js} +1 -1
- package/src/assets/web-panel/assets/{RemoteSession-D_xOX_hu.js → RemoteSession-Cn45UroZ.js} +2 -2
- package/src/assets/web-panel/assets/{Reputation-D_Ssv7uH.js → Reputation-Q-Zjb707.js} +1 -1
- package/src/assets/web-panel/assets/{Row-Kx5dKxX7.js → Row-BdM70oda.js} +1 -1
- package/src/assets/web-panel/assets/{RssFeed-BlGwqZkY.js → RssFeed-DmOAKKap.js} +2 -2
- package/src/assets/web-panel/assets/{Search-hLFQzxpb.js → Search-Dwavbm07.js} +1 -1
- package/src/assets/web-panel/assets/{Security-DMlvsVt4.js → Security-DukXFCnk.js} +3 -3
- package/src/assets/web-panel/assets/{Services-Bd0Qsj2m.js → Services-BIlRnITu.js} +2 -2
- package/src/assets/web-panel/assets/{Skeleton-DFclq9X3.js → Skeleton-YYVQdhhQ.js} +1 -1
- package/src/assets/web-panel/assets/{Skills-BNtln2qY.js → Skills-B8_iYHz2.js} +1 -1
- package/src/assets/web-panel/assets/{Sla-Dch5H19G.js → Sla-BdVrhT31.js} +1 -1
- package/src/assets/web-panel/assets/{SpeechSettings-2UfQcU1g.js → SpeechSettings-CD3ggRx7.js} +1 -1
- package/src/assets/web-panel/assets/{SyncSettings-CD9YQr4i.js → SyncSettings-Bp02VZFH.js} +2 -2
- package/src/assets/web-panel/assets/{Tasks-BNu-7MzI.js → Tasks-DEVmCEsr.js} +1 -1
- package/src/assets/web-panel/assets/{Templates-D1n9CaIR.js → Templates-B6czWc4N.js} +1 -1
- package/src/assets/web-panel/assets/{Tenant-DenL3iBW.js → Tenant-BCJLv17r.js} +1 -1
- package/src/assets/web-panel/assets/{Terminal-ZzU0Io1Y.js → Terminal-CD132d2Y.js} +2 -2
- package/src/assets/web-panel/assets/{TimelineRenderer-D87IfukO.js → TimelineRenderer-ZB-CvkZl.js} +1 -1
- package/src/assets/web-panel/assets/{Tokens-BkiZc8E3.js → Tokens-BnSY0S-s.js} +1 -1
- package/src/assets/web-panel/assets/{Trigger-BNRSytGN.js → Trigger-VZw9Oy2w.js} +1 -1
- package/src/assets/web-panel/assets/{Trust-Bwbd4X2m.js → Trust-pZq7Hjd2.js} +1 -1
- package/src/assets/web-panel/assets/{UkeySign-B8O2bs0o.js → UkeySign-DnQaqk4q.js} +1 -1
- package/src/assets/web-panel/assets/{VideoEditing-C2fL8zmH.js → VideoEditing-BEUfmvJV.js} +1 -1
- package/src/assets/web-panel/assets/{Wallet-BORYDdE1.js → Wallet-CoZKMXJ2.js} +4 -4
- package/src/assets/web-panel/assets/{WebAuthn-C0V5S2FM.js → WebAuthn-CBOGVx1I.js} +5 -5
- package/src/assets/web-panel/assets/{WorkflowEditor-2dR0fcHL.js → WorkflowEditor-huSKn7TT.js} +1 -1
- package/src/assets/web-panel/assets/{chat-BmuAFAn8.js → chat-A_3w6FBO.js} +1 -1
- package/src/assets/web-panel/assets/{colors-CN3smMcK.js → colors-D1Bem9Oy.js} +1 -1
- package/src/assets/web-panel/assets/{compact-item-DCnxb4kW.js → compact-item-CJYJj0oO.js} +1 -1
- package/src/assets/web-panel/assets/{createContext-vlR43pHn.js → createContext-BkbFiKT4.js} +1 -1
- package/src/assets/web-panel/assets/devWarning-WDr3_M_N.js +1 -0
- package/src/assets/web-panel/assets/{hasIn-D04tHYFd.js → hasIn-CKvUafVY.js} +1 -1
- package/src/assets/web-panel/assets/{index-0DnaZGkC.js → index-AjrSPnvv.js} +1 -1
- package/src/assets/web-panel/assets/{index-BudvKQfG.js → index-B8i0lViZ.js} +1 -1
- package/src/assets/web-panel/assets/{index-BeGDEXFs.js → index-B9Svn0zc.js} +1 -1
- package/src/assets/web-panel/assets/{index-D5LZVZ0L.js → index-BHdHSX06.js} +1 -1
- package/src/assets/web-panel/assets/{index-BTPEZTk1.js → index-BHdailyo.js} +1 -1
- package/src/assets/web-panel/assets/{index-DIpY0qM5.js → index-BJwlEnYo.js} +1 -1
- package/src/assets/web-panel/assets/{index-CsAsCPJ6.js → index-BOoAQjJz.js} +1 -1
- package/src/assets/web-panel/assets/{index-ljuBiQW9.js → index-BSgWxAOG.js} +1 -1
- package/src/assets/web-panel/assets/{index-hpvvtAZ3.js → index-BdutMsne.js} +1 -1
- package/src/assets/web-panel/assets/{index-_FIkN3jd.js → index-BiDWxzbn.js} +1 -1
- package/src/assets/web-panel/assets/{index-C-6NO5il.js → index-By5a0T_W.js} +1 -1
- package/src/assets/web-panel/assets/{index-B78xL3s2.js → index-C-WIY-FQ.js} +1 -1
- package/src/assets/web-panel/assets/{index-ClhAHDK3.js → index-C37f6iey.js} +1 -1
- package/src/assets/web-panel/assets/{index-ToUh2b1-.js → index-C9bWmTcO.js} +1 -1
- package/src/assets/web-panel/assets/{index-D28DeAAB.js → index-CBaosWRO.js} +1 -1
- package/src/assets/web-panel/assets/{index-D8vwp4qp.js → index-CBlBVJ_m.js} +1 -1
- package/src/assets/web-panel/assets/{index-BqhASEL4.js → index-CD62EEGo.js} +1 -1
- package/src/assets/web-panel/assets/{index-DDwLgQY9.js → index-CUj-l7GM.js} +1 -1
- package/src/assets/web-panel/assets/{index-DbVsQBOH.js → index-CVS8Ymuq.js} +1 -1
- package/src/assets/web-panel/assets/{index-Cr-A0FYJ.js → index-ChkXUj3f.js} +1 -1
- package/src/assets/web-panel/assets/{index-D65_XseV.js → index-Cj0OZ-37.js} +1 -1
- package/src/assets/web-panel/assets/{index-BXRg8GFQ.js → index-Co3OFL0t.js} +1 -1
- package/src/assets/web-panel/assets/{index-430S68MN.js → index-Crp8CbRg.js} +1 -1
- package/src/assets/web-panel/assets/{index-CngCC8hC.js → index-D22zNXiS.js} +1 -1
- package/src/assets/web-panel/assets/{index-HhNjnCfe.js → index-DTs_D1OL.js} +1 -1
- package/src/assets/web-panel/assets/{index-CP9m9Ggr.js → index-DfgCdFrN.js} +3 -3
- package/src/assets/web-panel/assets/{index-jzR7Ujuw.js → index-DjYrecNb.js} +1 -1
- package/src/assets/web-panel/assets/{index-CTOCnIQ7.js → index-DpW9cf3e.js} +1 -1
- package/src/assets/web-panel/assets/index-Dwix3p4g.js +1 -0
- package/src/assets/web-panel/assets/{index-D_n8_vfI.js → index-F--HuPG1.js} +1 -1
- package/src/assets/web-panel/assets/{index-BasvsWDM.js → index-Fuk6t_3K.js} +1 -1
- package/src/assets/web-panel/assets/{index-CnXebZLL.js → index-JEAGMii9.js} +1 -1
- package/src/assets/web-panel/assets/{index-DYAtmqiv.js → index-PF-mpv8K.js} +1 -1
- package/src/assets/web-panel/assets/index-SHaoZ0CA.js +1 -0
- package/src/assets/web-panel/assets/{index-DTWg-18U.js → index-b-sbVdjQ.js} +1 -1
- package/src/assets/web-panel/assets/{index-C5Sxb1sE.js → index-pyvMVX8r.js} +1 -1
- package/src/assets/web-panel/assets/{index-TslMTwNy.js → index-qNTtOVi_.js} +1 -1
- package/src/assets/web-panel/assets/{index-DTtRscUa.js → index-tgO8iza6.js} +1 -1
- package/src/assets/web-panel/assets/{index-DbADHwhr.js → index-ttDQVhZy.js} +1 -1
- package/src/assets/web-panel/assets/{initDefaultProps-C3wUb4je.js → initDefaultProps-DtrnfsZH.js} +1 -1
- package/src/assets/web-panel/assets/{motion-D-jYFUNA.js → motion-D4zqSaX3.js} +1 -1
- package/src/assets/web-panel/assets/{move-tqb8nwJ2.js → move-CGFGOUQj.js} +1 -1
- package/src/assets/web-panel/assets/{mtc-parser-DSOjMJMz.js → mtc-parser-DH2HvkJl.js} +1 -1
- package/src/assets/web-panel/assets/{omit-CJ7VimIW.js → omit-jJ2at5HX.js} +1 -1
- package/src/assets/web-panel/assets/{pickAttrs-qXiG1iT3.js → pickAttrs-CRyMT1Fv.js} +1 -1
- package/src/assets/web-panel/assets/{placementArrow-CkGBcy1Z.js → placementArrow-DZ_CX0Pt.js} +1 -1
- package/src/assets/web-panel/assets/{responsiveObserve-D3WvTlLO.js → responsiveObserve-wruHk-h5.js} +1 -1
- package/src/assets/web-panel/assets/{slide-BEE2ftge.js → slide-BGgx8q67.js} +1 -1
- package/src/assets/web-panel/assets/{statusUtils-CsfBpxiG.js → statusUtils-Do5M7gKm.js} +1 -1
- package/src/assets/web-panel/assets/{styleChecker-xPrIiJPI.js → styleChecker-CRa-GZpX.js} +1 -1
- package/src/assets/web-panel/assets/{useFlexGapSupport-C5Yd-SCR.js → useFlexGapSupport-BxPcq6pj.js} +1 -1
- package/src/assets/web-panel/assets/{useFs-D_MDS8HI.js → useFs-v5O2ZcJm.js} +1 -1
- package/src/assets/web-panel/assets/{usePersonalDataHub-BqJh-usA.js → usePersonalDataHub--z2FU0Px.js} +1 -1
- package/src/assets/web-panel/assets/{vnode-chm_p-gz.js → vnode-1emidVKd.js} +1 -1
- package/src/assets/web-panel/assets/{zoom-3-YDNz0Z.js → zoom-CcJaRyHs.js} +1 -1
- package/src/assets/web-panel/index.html +1 -1
- package/src/commands/a2a.js +19 -4
- package/src/commands/activitypub.js +20 -3
- package/src/commands/agent.js +27 -5
- package/src/commands/audit.js +40 -24
- package/src/commands/codeintel.js +68 -0
- package/src/commands/collab.js +15 -2
- package/src/commands/compliance.js +5 -0
- package/src/commands/config.js +4 -1
- package/src/commands/dao.js +86 -14
- package/src/commands/dev.js +2 -0
- package/src/commands/did.js +7 -1
- package/src/commands/dlp.js +23 -1
- package/src/commands/economy.js +29 -3
- package/src/commands/eval.js +7 -0
- package/src/commands/evomap.js +26 -0
- package/src/commands/governance.js +17 -3
- package/src/commands/hardening.js +18 -0
- package/src/commands/incentive.js +5 -0
- package/src/commands/init.js +46 -2
- package/src/commands/kg.js +4 -0
- package/src/commands/loop.js +6 -1
- package/src/commands/lowcode.js +15 -2
- package/src/commands/marketplace.js +40 -6
- package/src/commands/matrix.js +20 -1
- package/src/commands/memory.js +4 -1
- package/src/commands/mtc.js +7 -1
- package/src/commands/nostr.js +31 -4
- package/src/commands/note.js +7 -4
- package/src/commands/plugin.js +125 -5
- package/src/commands/pqc.js +5 -0
- package/src/commands/reputation.js +10 -1
- package/src/commands/scim.js +6 -0
- package/src/commands/session.js +32 -10
- package/src/commands/siem.js +11 -0
- package/src/commands/sla.js +18 -3
- package/src/commands/social.js +38 -5
- package/src/commands/sso.js +10 -2
- package/src/commands/stress.js +23 -4
- package/src/commands/team.js +9 -2
- package/src/commands/tech.js +2 -0
- package/src/commands/tenant.js +10 -1
- package/src/commands/terraform.js +6 -0
- package/src/commands/update.js +1 -1
- package/src/commands/zkp.js +20 -0
- package/src/gateways/ws/message-dispatcher.js +5 -2
- package/src/gateways/ws/remote-session-protocol.js +103 -42
- package/src/harness/jsonl-session-store.js +12 -5
- package/src/harness/plugin-manager.js +16 -4
- package/src/harness/remote-command-ledger.js +46 -15
- package/src/harness/worktree-isolator.js +16 -6
- package/src/lib/__tests__/logger.test.js +5 -2
- package/src/lib/a2a-protocol.js +25 -1
- package/src/lib/activitypub-bridge.js +61 -0
- package/src/lib/agent-core.js +2 -0
- package/src/lib/agent-economy.js +262 -29
- package/src/lib/agent-network.js +7 -1
- package/src/lib/agent-team/team-runner.js +25 -9
- package/src/lib/agent-team/team-worktree.js +36 -4
- package/src/lib/async-hook-supervisor.cjs +102 -16
- package/src/lib/audit-logger.js +7 -6
- package/src/lib/autonomous-developer.js +60 -0
- package/src/lib/chat-core.js +17 -4
- package/src/lib/collaboration-governance.js +56 -0
- package/src/lib/community-governance.js +68 -0
- package/src/lib/compliance-manager.js +63 -0
- package/src/lib/cross-chain.js +5 -0
- package/src/lib/dao-governance.js +151 -2
- package/src/lib/did-manager.js +23 -10
- package/src/lib/dlp-engine.js +70 -0
- package/src/lib/eval/runner.js +89 -1
- package/src/lib/eval/tasks.js +170 -0
- package/src/lib/eval/trend.js +16 -1
- package/src/lib/evolution-system.js +92 -0
- package/src/lib/evomap-federation.js +55 -0
- package/src/lib/evomap-governance.js +94 -0
- package/src/lib/fatal-handler.js +17 -1
- package/src/lib/hardening-manager.js +73 -0
- package/src/lib/hierarchical-memory.js +14 -8
- package/src/lib/knowledge-exporter.js +8 -2
- package/src/lib/knowledge-graph.js +79 -0
- package/src/lib/llm-providers.js +23 -14
- package/src/lib/logger.js +4 -1
- package/src/lib/lsp/__tests__/benchmark.test.js +88 -0
- package/src/lib/lsp/__tests__/lsp-client.test.js +11 -0
- package/src/lib/lsp/__tests__/lsp-manager.test.js +69 -0
- package/src/lib/lsp/benchmark.js +257 -0
- package/src/lib/lsp/lsp-client.js +30 -9
- package/src/lib/lsp/lsp-manager.js +54 -2
- package/src/lib/matrix-bridge.js +84 -0
- package/src/lib/memory-manager.js +5 -3
- package/src/lib/nostr-bridge.js +53 -0
- package/src/lib/permission-engine.js +22 -4
- package/src/lib/plugin-runtime/__tests__/remote-source.test.js +256 -0
- package/src/lib/plugin-runtime/install.js +9 -1
- package/src/lib/plugin-runtime/policy.js +9 -1
- package/src/lib/plugin-runtime/remote-source.js +240 -0
- package/src/lib/pqc-manager.js +64 -0
- package/src/lib/reputation-optimizer.js +101 -0
- package/src/lib/sandbox-egress-proxy.js +159 -59
- package/src/lib/sandbox-fs-policy.js +112 -0
- package/src/lib/sandbox-network-policy.js +18 -1
- package/src/lib/sandbox-v2.js +14 -14
- package/src/lib/scim-manager.js +36 -0
- package/src/lib/session-manager.js +5 -2
- package/src/lib/settings-hooks.cjs +1 -0
- package/src/lib/siem-exporter.js +45 -0
- package/src/lib/skill-loader.js +20 -2
- package/src/lib/skill-marketplace.js +83 -0
- package/src/lib/sla-manager.js +88 -0
- package/src/lib/social-manager.js +74 -0
- package/src/lib/stress-tester.js +65 -0
- package/src/lib/tech-learning-engine.js +75 -0
- package/src/lib/tenant-saas.js +107 -0
- package/src/lib/terraform-manager.js +67 -0
- package/src/lib/token-incentive.js +180 -29
- package/src/lib/wallet-manager.js +81 -35
- package/src/lib/zkp-engine.js +87 -0
- package/src/repl/agent-repl.js +17 -2
- package/src/runtime/__tests__/auto-pin.test.js +104 -0
- package/src/runtime/agent-core.js +241 -68
- package/src/runtime/auto-pin.js +117 -0
- package/src/runtime/headless-runner.js +35 -0
- package/src/assets/web-panel/assets/OrderTableRenderer-CRIFE2Tj.js +0 -1
- package/src/assets/web-panel/assets/Projects-CGcNIs_g.js +0 -1
- package/src/assets/web-panel/assets/devWarning-DxwmsL4j.js +0 -1
- package/src/assets/web-panel/assets/index-Cg2ldRfU.js +0 -1
- package/src/assets/web-panel/assets/index-Dwzo-dtJ.js +0 -1
|
@@ -221,6 +221,77 @@ export function killAllBackgroundShellTasks() {
|
|
|
221
221
|
return killed;
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
+
// SYNCHRONOUS whole-tree kill for use inside a process 'exit' / signal handler,
|
|
225
|
+
// where only synchronous work runs to completion (the async `spawn`/`taskkill`
|
|
226
|
+
// in _killTask would be cut off the instant the process terminates, leaving the
|
|
227
|
+
// grandchild orphaned). POSIX signals the process group with SIGKILL; Windows
|
|
228
|
+
// uses spawnSync taskkill /T so the shell's children die too.
|
|
229
|
+
function _killTaskSync(task) {
|
|
230
|
+
const child = task?.child;
|
|
231
|
+
if (!child || child.killed || task?.status !== "running") return false;
|
|
232
|
+
try {
|
|
233
|
+
if (process.platform === "win32") {
|
|
234
|
+
if (child.pid) {
|
|
235
|
+
spawnSync("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
|
|
236
|
+
windowsHide: true,
|
|
237
|
+
});
|
|
238
|
+
} else {
|
|
239
|
+
child.kill();
|
|
240
|
+
}
|
|
241
|
+
} else if (child.pid) {
|
|
242
|
+
// Negative pid → whole process group (requires the detached spawn above).
|
|
243
|
+
try {
|
|
244
|
+
process.kill(-child.pid, "SIGKILL");
|
|
245
|
+
} catch (_err) {
|
|
246
|
+
child.kill("SIGKILL");
|
|
247
|
+
}
|
|
248
|
+
} else {
|
|
249
|
+
child.kill("SIGKILL");
|
|
250
|
+
}
|
|
251
|
+
return true;
|
|
252
|
+
} catch (_err) {
|
|
253
|
+
return false;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Synchronously kill every still-running background shell task. Safe to call
|
|
259
|
+
* from a process 'exit' or signal handler (uses spawnSync/process.kill, not the
|
|
260
|
+
* async spawn path which a terminating process would cut off). This is the
|
|
261
|
+
* orphan-reclaim net for the paths the normal `finally` reaper can't cover: a
|
|
262
|
+
* Ctrl-C / SIGTERM unwinds no `finally`, so without it a backgrounded dev server
|
|
263
|
+
* outlives a killed `cc agent -p`.
|
|
264
|
+
* @returns {number} count of tasks signalled
|
|
265
|
+
*/
|
|
266
|
+
export function killAllBackgroundShellTasksSync() {
|
|
267
|
+
let killed = 0;
|
|
268
|
+
for (const task of _backgroundShellTasks.values()) {
|
|
269
|
+
if (_killTaskSync(task)) {
|
|
270
|
+
killed += 1;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return killed;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// Install a one-time process 'exit' net that synchronously reaps background
|
|
277
|
+
// shell tasks. `finally` blocks (headless/REPL) already reap on normal
|
|
278
|
+
// completion, but an explicit process.exit() elsewhere (serve shutdown, the
|
|
279
|
+
// headless signal handler that converts Ctrl-C → exit) would otherwise leave a
|
|
280
|
+
// backgrounded command orphaned. Installed lazily on the first background task,
|
|
281
|
+
// so a process that never backgrounds anything pays nothing.
|
|
282
|
+
let _bgExitReaperHooked = false;
|
|
283
|
+
function _ensureBgExitReaper() {
|
|
284
|
+
if (_bgExitReaperHooked) return;
|
|
285
|
+
_bgExitReaperHooked = true;
|
|
286
|
+
process.once("exit", () => {
|
|
287
|
+
try {
|
|
288
|
+
killAllBackgroundShellTasksSync();
|
|
289
|
+
} catch {
|
|
290
|
+
/* best-effort teardown on exit */
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
|
|
224
295
|
// Idle-reap tuning (Claude-Code 2.1.193 "automatic memory-pressure reaping for
|
|
225
296
|
// idle background shell commands"). A running task is a reap candidate when it
|
|
226
297
|
// has produced no output for BG_IDLE_REAP_MS AND the system is under memory
|
|
@@ -324,16 +395,12 @@ async function runSettingsPreToolUseHooks(name, args, context, cwd) {
|
|
|
324
395
|
ideResult: ide.result,
|
|
325
396
|
};
|
|
326
397
|
}
|
|
327
|
-
const
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
rule: `hook:${outcome.hook}`,
|
|
334
|
-
reason: outcome.reason || "a PreToolUse hook requests confirmation",
|
|
335
|
-
})
|
|
336
|
-
: false;
|
|
398
|
+
const ok = await requestInteractivePermission(name, args, context, cwd, {
|
|
399
|
+
tool: name,
|
|
400
|
+
args,
|
|
401
|
+
rule: `hook:${outcome.hook}`,
|
|
402
|
+
reason: outcome.reason || "a PreToolUse hook requests confirmation",
|
|
403
|
+
});
|
|
337
404
|
return ok
|
|
338
405
|
? { blocked: false }
|
|
339
406
|
: {
|
|
@@ -345,6 +412,87 @@ async function runSettingsPreToolUseHooks(name, args, context, cwd) {
|
|
|
345
412
|
return { blocked: false };
|
|
346
413
|
}
|
|
347
414
|
|
|
415
|
+
/**
|
|
416
|
+
* Run settings.json `PermissionRequest` hooks (Claude-Code parity). Fires at the
|
|
417
|
+
* exact moment a tool call would prompt the user for approval — BEFORE the
|
|
418
|
+
* prompt — so a policy hook can auto-approve (`allow`/`approve`), auto-reject
|
|
419
|
+
* (`deny`/`block`), or defer (`ask` / no decision) to the normal prompt.
|
|
420
|
+
* Returns `{ decision: "allow" | "deny" | null }`. No matching hook (or no
|
|
421
|
+
* `settingsHooks`) → `{ decision: null }` and the caller prompts exactly as
|
|
422
|
+
* before (default behaviour is byte-for-byte unchanged).
|
|
423
|
+
* @returns {{decision:("allow"|"deny"|null), reason?:string, hook?:string}}
|
|
424
|
+
*/
|
|
425
|
+
function runSettingsPermissionRequestHooks(name, args, context, cwd, reason) {
|
|
426
|
+
const matched = collectHooks(
|
|
427
|
+
context.settingsHooks,
|
|
428
|
+
"PermissionRequest",
|
|
429
|
+
name,
|
|
430
|
+
);
|
|
431
|
+
if (!matched || matched.length === 0) return { decision: null };
|
|
432
|
+
const payload = {
|
|
433
|
+
hook_event_name: "PermissionRequest",
|
|
434
|
+
tool_name: umbrellaFor(name),
|
|
435
|
+
raw_tool_name: name,
|
|
436
|
+
tool_input: args,
|
|
437
|
+
permission_reason: reason || null,
|
|
438
|
+
cwd,
|
|
439
|
+
session_id: context.sessionId || null,
|
|
440
|
+
};
|
|
441
|
+
const outcome = runCommandHooks(matched, payload, {
|
|
442
|
+
cwd,
|
|
443
|
+
event: "PermissionRequest",
|
|
444
|
+
});
|
|
445
|
+
// Precedence: deny > ask > allow > defer. The runner normalizes deny/block →
|
|
446
|
+
// "block" and short-circuits block/ask, but it COLLAPSES an "allow" into the
|
|
447
|
+
// aggregate "continue" (it only short-circuits block/ask) — so an explicit
|
|
448
|
+
// auto-approve must be recovered from the per-hook `results`. A deny or ask
|
|
449
|
+
// by any hook still wins over an allow (safety: never let an allow override a
|
|
450
|
+
// gate that another hook wanted to block or prompt for).
|
|
451
|
+
if (outcome.decision === "block") {
|
|
452
|
+
return { decision: "deny", reason: outcome.reason, hook: outcome.hook };
|
|
453
|
+
}
|
|
454
|
+
if (outcome.decision === "ask") {
|
|
455
|
+
return { decision: null }; // a hook asked → defer to the confirmer
|
|
456
|
+
}
|
|
457
|
+
const allowHook =
|
|
458
|
+
outcome.decision === "allow"
|
|
459
|
+
? { command: outcome.hook }
|
|
460
|
+
: (outcome.results || []).find((r) => r && r.decision === "allow");
|
|
461
|
+
if (allowHook) {
|
|
462
|
+
return { decision: "allow", hook: allowHook.command || null };
|
|
463
|
+
}
|
|
464
|
+
return { decision: null }; // no actionable decision → defer to the confirmer
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* Resolve an interactive permission gate. Gives `PermissionRequest` hooks first
|
|
469
|
+
* say (auto-allow → true without prompting, auto-deny → false without
|
|
470
|
+
* prompting), then falls back to the injected confirmer with the identical
|
|
471
|
+
* arguments the call site would have passed. When no `PermissionRequest` hook
|
|
472
|
+
* matches this is byte-for-byte the previous `confirm(confirmArgs)` call, so
|
|
473
|
+
* every existing permission gate keeps its exact behaviour absent a hook.
|
|
474
|
+
* @returns {Promise<boolean>}
|
|
475
|
+
*/
|
|
476
|
+
async function requestInteractivePermission(
|
|
477
|
+
name,
|
|
478
|
+
args,
|
|
479
|
+
context,
|
|
480
|
+
cwd,
|
|
481
|
+
confirmArgs,
|
|
482
|
+
) {
|
|
483
|
+
const verdict = runSettingsPermissionRequestHooks(
|
|
484
|
+
name,
|
|
485
|
+
args,
|
|
486
|
+
context,
|
|
487
|
+
cwd,
|
|
488
|
+
confirmArgs?.reason,
|
|
489
|
+
);
|
|
490
|
+
if (verdict.decision === "allow") return true;
|
|
491
|
+
if (verdict.decision === "deny") return false;
|
|
492
|
+
const confirm = context.permissionConfirm || context.shellConfirm || null;
|
|
493
|
+
return typeof confirm === "function" ? await confirm(confirmArgs) : false;
|
|
494
|
+
}
|
|
495
|
+
|
|
348
496
|
// ─── Tool definitions ────────────────────────────────────────────────────
|
|
349
497
|
|
|
350
498
|
export const AGENT_TOOLS = getCodingAgentFunctionToolDefinitions();
|
|
@@ -1082,16 +1230,12 @@ export async function executeTool(name, args, context = {}) {
|
|
|
1082
1230
|
source: "settings rule",
|
|
1083
1231
|
});
|
|
1084
1232
|
if (ide) return ide.result;
|
|
1085
|
-
const
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
rule: settingsVerdict.rule,
|
|
1092
|
-
reason: `settings rule ${settingsVerdict.rule} requires confirmation`,
|
|
1093
|
-
})
|
|
1094
|
-
: false;
|
|
1233
|
+
const ok = await requestInteractivePermission(name, args, context, cwd, {
|
|
1234
|
+
tool: name,
|
|
1235
|
+
args,
|
|
1236
|
+
rule: settingsVerdict.rule,
|
|
1237
|
+
reason: `settings rule ${settingsVerdict.rule} requires confirmation`,
|
|
1238
|
+
});
|
|
1095
1239
|
if (!ok) {
|
|
1096
1240
|
return {
|
|
1097
1241
|
error: `[Permission] Tool "${name}" requires confirmation (settings rule: ${settingsVerdict.rule}) but this run is non-interactive — denied. Do not retry; tell the user this action needs their approval.`,
|
|
@@ -1123,16 +1267,12 @@ export async function executeTool(name, args, context = {}) {
|
|
|
1123
1267
|
await import("../lib/sensitive-file-guard.js");
|
|
1124
1268
|
const sensReason = sensitiveFileReason(args.path);
|
|
1125
1269
|
if (sensReason) {
|
|
1126
|
-
const
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
rule: null,
|
|
1133
|
-
reason: `sensitive file: ${sensReason}`,
|
|
1134
|
-
})
|
|
1135
|
-
: false;
|
|
1270
|
+
const ok = await requestInteractivePermission(name, args, context, cwd, {
|
|
1271
|
+
tool: name,
|
|
1272
|
+
args,
|
|
1273
|
+
rule: null,
|
|
1274
|
+
reason: `sensitive file: ${sensReason}`,
|
|
1275
|
+
});
|
|
1136
1276
|
if (!ok) {
|
|
1137
1277
|
return {
|
|
1138
1278
|
error: `[Sensitive File] Writing "${args.path}" requires confirmation (${sensReason}) — denied. Add a settings allow rule to pre-authorize.`,
|
|
@@ -1155,16 +1295,12 @@ export async function executeTool(name, args, context = {}) {
|
|
|
1155
1295
|
!planManager.isActive() &&
|
|
1156
1296
|
isDangerousGitCommand(args?.command)
|
|
1157
1297
|
) {
|
|
1158
|
-
const
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
rule: null,
|
|
1165
|
-
reason: `destructive git command: git ${normalizeGitCommand(args.command)}`,
|
|
1166
|
-
})
|
|
1167
|
-
: false;
|
|
1298
|
+
const ok = await requestInteractivePermission(name, args, context, cwd, {
|
|
1299
|
+
tool: name,
|
|
1300
|
+
args,
|
|
1301
|
+
rule: null,
|
|
1302
|
+
reason: `destructive git command: git ${normalizeGitCommand(args.command)}`,
|
|
1303
|
+
});
|
|
1168
1304
|
if (!ok) {
|
|
1169
1305
|
return {
|
|
1170
1306
|
error: `[Destructive Git] "git ${normalizeGitCommand(args.command)}" discards work irrecoverably and requires confirmation — denied. Add a settings allow rule to pre-authorize.`,
|
|
@@ -1199,17 +1335,18 @@ export async function executeTool(name, args, context = {}) {
|
|
|
1199
1335
|
credReason = hit ? hit.reason : null;
|
|
1200
1336
|
}
|
|
1201
1337
|
if (credReason) {
|
|
1202
|
-
const
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1338
|
+
const ok = await requestInteractivePermission(
|
|
1339
|
+
name,
|
|
1340
|
+
args,
|
|
1341
|
+
context,
|
|
1342
|
+
cwd,
|
|
1343
|
+
{
|
|
1344
|
+
tool: name,
|
|
1345
|
+
args,
|
|
1346
|
+
rule: null,
|
|
1347
|
+
reason: `credential access: ${credReason}`,
|
|
1348
|
+
},
|
|
1349
|
+
);
|
|
1213
1350
|
if (!ok) {
|
|
1214
1351
|
const what =
|
|
1215
1352
|
name === "read_file" ? `Reading "${args.path}"` : "This command";
|
|
@@ -1774,28 +1911,41 @@ const _codeIntelPool = new Map(); // root -> { ci, idleTimer }
|
|
|
1774
1911
|
const CODE_INTEL_IDLE_MS = 60_000;
|
|
1775
1912
|
let _codeIntelExitHooked = false;
|
|
1776
1913
|
|
|
1777
|
-
async function _getSharedCodeIntel(cwd) {
|
|
1914
|
+
export async function _getSharedCodeIntel(cwd) {
|
|
1778
1915
|
const root = path.resolve(cwd || process.cwd());
|
|
1779
1916
|
let entry = _codeIntelPool.get(root);
|
|
1780
1917
|
if (!entry) {
|
|
1781
1918
|
const { CodeIntelligence } =
|
|
1782
1919
|
await import("../lib/lsp/code-intelligence.js");
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1920
|
+
// Re-check AFTER the await: two concurrent callers (the parallel read-only
|
|
1921
|
+
// batch runs several `code_intelligence` calls at once) both observed an
|
|
1922
|
+
// empty pool before this `await import`, so without this guard both would
|
|
1923
|
+
// construct a CodeIntelligence — each spawning its own language server — and
|
|
1924
|
+
// the second `set` would orphan the first (leaked server process) while its
|
|
1925
|
+
// stale idle-timer, still bound to `root`, later evicts the wrong (warm,
|
|
1926
|
+
// in-use) entry. This is exactly the orphaned-server/dangling-timer trap the
|
|
1927
|
+
// pool exists to prevent. Construction below has NO further await, so once
|
|
1928
|
+
// one continuation wins the re-check the other reuses its entry — the window
|
|
1929
|
+
// is fully closed.
|
|
1930
|
+
entry = _codeIntelPool.get(root);
|
|
1931
|
+
if (!entry) {
|
|
1932
|
+
entry = {
|
|
1933
|
+
ci: new CodeIntelligence({ projectRoot: root, coldStart: true }),
|
|
1934
|
+
idleTimer: null,
|
|
1935
|
+
};
|
|
1936
|
+
_codeIntelPool.set(root, entry);
|
|
1937
|
+
if (!_codeIntelExitHooked) {
|
|
1938
|
+
_codeIntelExitHooked = true;
|
|
1939
|
+
process.once("exit", () => {
|
|
1940
|
+
for (const e of _codeIntelPool.values()) {
|
|
1941
|
+
try {
|
|
1942
|
+
e.ci.dispose();
|
|
1943
|
+
} catch {
|
|
1944
|
+
/* best-effort teardown on exit */
|
|
1945
|
+
}
|
|
1796
1946
|
}
|
|
1797
|
-
}
|
|
1798
|
-
}
|
|
1947
|
+
});
|
|
1948
|
+
}
|
|
1799
1949
|
}
|
|
1800
1950
|
}
|
|
1801
1951
|
if (entry.idleTimer) clearTimeout(entry.idleTimer);
|
|
@@ -2327,6 +2477,9 @@ async function executeToolInner(
|
|
|
2327
2477
|
task.endedAt = new Date().toISOString();
|
|
2328
2478
|
}
|
|
2329
2479
|
_backgroundShellTasks.set(id, task);
|
|
2480
|
+
// Arm the process-exit net so a Ctrl-C / hard exit can't orphan this
|
|
2481
|
+
// task (the normal `finally` reaper is bypassed by signals).
|
|
2482
|
+
_ensureBgExitReaper();
|
|
2330
2483
|
return attachDescriptor(
|
|
2331
2484
|
{
|
|
2332
2485
|
background: true,
|
|
@@ -2463,6 +2616,14 @@ async function executeToolInner(
|
|
|
2463
2616
|
return attachDescriptor(
|
|
2464
2617
|
{
|
|
2465
2618
|
error: err.message.substring(0, 2000),
|
|
2619
|
+
// Surface stdout too: a failing command (test runner / linter /
|
|
2620
|
+
// build) usually prints WHAT failed to stdout and only the summary
|
|
2621
|
+
// to stderr, so dropping it on non-zero exit blinds the agent to the
|
|
2622
|
+
// actual failure. Only attach it when there IS output (a timeout with
|
|
2623
|
+
// no output keeps the field absent), mirroring the success path.
|
|
2624
|
+
...(err.stdout
|
|
2625
|
+
? { stdout: String(err.stdout).substring(0, 30000) }
|
|
2626
|
+
: {}),
|
|
2466
2627
|
stderr: (err.stderr || "").substring(0, 2000),
|
|
2467
2628
|
exitCode: err.status,
|
|
2468
2629
|
shellCommandPolicy: shellPolicy,
|
|
@@ -5440,10 +5601,22 @@ export async function* agentLoop(messages, options) {
|
|
|
5440
5601
|
reason: preCompactReason,
|
|
5441
5602
|
};
|
|
5442
5603
|
}
|
|
5604
|
+
// Auto-pin (OPT-IN): when enabled, the original task (first user turn)
|
|
5605
|
+
// is pinned so compaction can't drop it. Off by default → no predicate
|
|
5606
|
+
// is passed and compaction is byte-identical to before.
|
|
5607
|
+
let pinOpts = {};
|
|
5608
|
+
if (options.autoPin) {
|
|
5609
|
+
const { buildAutoPinPredicate } = await import("./auto-pin.js");
|
|
5610
|
+
const isPinned = buildAutoPinPredicate(messages, options.autoPin);
|
|
5611
|
+
if (isPinned) pinOpts = { isPinned };
|
|
5612
|
+
}
|
|
5443
5613
|
const { messages: compacted, stats } =
|
|
5444
5614
|
!needFull || preCompactBlocked
|
|
5445
5615
|
? { messages, stats: { saved: 0 } }
|
|
5446
|
-
: await compactor.compress(messages, {
|
|
5616
|
+
: await compactor.compress(messages, {
|
|
5617
|
+
preserveToolPairs: true,
|
|
5618
|
+
...pinOpts,
|
|
5619
|
+
});
|
|
5447
5620
|
if (stats.saved > 0 && compacted.length < messages.length) {
|
|
5448
5621
|
messages.splice(0, messages.length, ...compacted);
|
|
5449
5622
|
// Persist the compaction so a later --resume rebuilds from the
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-pin policy for compaction (OPT-IN).
|
|
3
|
+
*
|
|
4
|
+
* Phase 7.7 gave the compressor a deterministic pin mechanism: a message the
|
|
5
|
+
* predicate marks is pulled out before any strategy and re-inserted verbatim,
|
|
6
|
+
* so it survives compaction no matter what the (non-deterministic) LLM summary
|
|
7
|
+
* drops. What was deliberately left unbuilt is the *policy* — deciding WHICH
|
|
8
|
+
* messages to auto-pin — because auto-pinning reorders the hot agent loop's
|
|
9
|
+
* context and is a product-UX call.
|
|
10
|
+
*
|
|
11
|
+
* This module supplies that policy, but strictly opt-in: it only ever produces
|
|
12
|
+
* a predicate when the caller explicitly enables auto-pin. When disabled it
|
|
13
|
+
* returns null and the caller passes NO predicate, so the compressor falls back
|
|
14
|
+
* to its default (pin only messages already tagged `pinned:true`) and behaviour
|
|
15
|
+
* is byte-identical to before.
|
|
16
|
+
*
|
|
17
|
+
* Default policy when enabled: pin the ORIGINAL TASK — the first user turn —
|
|
18
|
+
* because that is the single fact most likely to scroll out of the recent
|
|
19
|
+
* window yet most important to keep (the coding agent's goal). Explicit
|
|
20
|
+
* `pinned:true` messages are always honored on top of it. A token cap keeps a
|
|
21
|
+
* pathologically large first turn from itself blowing the budget.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
const DEFAULT_MAX_PIN_TOKENS = 2000;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Normalize the opt-in value into a config object, or null when auto-pin is off.
|
|
28
|
+
* Accepts: falsy (off), `true` (defaults on), or a config object
|
|
29
|
+
* `{ firstUserGoal?, maxPinTokens? }`.
|
|
30
|
+
*/
|
|
31
|
+
export function resolveAutoPinConfig(opt) {
|
|
32
|
+
if (!opt) return null;
|
|
33
|
+
const cfg = typeof opt === "object" ? opt : {};
|
|
34
|
+
return {
|
|
35
|
+
firstUserGoal: cfg.firstUserGoal !== false, // default true when enabled
|
|
36
|
+
maxPinTokens: Number.isFinite(cfg.maxPinTokens)
|
|
37
|
+
? cfg.maxPinTokens
|
|
38
|
+
: DEFAULT_MAX_PIN_TOKENS,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Coarse char/4 token estimate — matches the compressor's own heuristic. */
|
|
43
|
+
function estimateTokens(text) {
|
|
44
|
+
return Math.ceil(String(text || "").length / 4);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function contentString(m) {
|
|
48
|
+
if (!m) return "";
|
|
49
|
+
return typeof m.content === "string"
|
|
50
|
+
? m.content
|
|
51
|
+
: JSON.stringify(m.content || "");
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Build an `isPinned(message)` predicate for `compress({ isPinned })`, or null
|
|
56
|
+
* when auto-pin is disabled (caller then passes no predicate → default).
|
|
57
|
+
*
|
|
58
|
+
* The predicate combines explicit pins (`pinned:true`/`_pin`) with the policy's
|
|
59
|
+
* auto-selected messages, matched by identity against `messages` (compress
|
|
60
|
+
* filters the same array, so identity is stable).
|
|
61
|
+
*/
|
|
62
|
+
export function buildAutoPinPredicate(messages, opt) {
|
|
63
|
+
const cfg = resolveAutoPinConfig(opt);
|
|
64
|
+
if (!cfg) return null;
|
|
65
|
+
if (!Array.isArray(messages)) {
|
|
66
|
+
return (m) => !!m && (m.pinned === true || m._pin === true);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const auto = new Set();
|
|
70
|
+
if (cfg.firstUserGoal) {
|
|
71
|
+
const firstUser = messages.find((m) => m && m.role === "user");
|
|
72
|
+
// Skip a first turn that is itself huge — pinning it would defeat the point
|
|
73
|
+
// (it would dominate the very budget compaction is trying to reclaim).
|
|
74
|
+
if (
|
|
75
|
+
firstUser &&
|
|
76
|
+
estimateTokens(contentString(firstUser)) <= cfg.maxPinTokens
|
|
77
|
+
) {
|
|
78
|
+
auto.add(firstUser);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return (m) => !!m && (m.pinned === true || m._pin === true || auto.has(m));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Explain what the policy would pin for `messages` (for `--dry-run` / logging).
|
|
87
|
+
* Returns `{ enabled, reasons: [{ role, preview, why }] }`.
|
|
88
|
+
*/
|
|
89
|
+
export function describeAutoPin(messages, opt) {
|
|
90
|
+
const cfg = resolveAutoPinConfig(opt);
|
|
91
|
+
if (!cfg) return { enabled: false, reasons: [] };
|
|
92
|
+
const reasons = [];
|
|
93
|
+
const list = Array.isArray(messages) ? messages : [];
|
|
94
|
+
for (const m of list) {
|
|
95
|
+
if (m && (m.pinned === true || m._pin === true)) {
|
|
96
|
+
reasons.push({ role: m.role, preview: preview(m), why: "explicit pin" });
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (cfg.firstUserGoal) {
|
|
100
|
+
const firstUser = list.find((m) => m && m.role === "user");
|
|
101
|
+
if (
|
|
102
|
+
firstUser &&
|
|
103
|
+
estimateTokens(contentString(firstUser)) <= cfg.maxPinTokens
|
|
104
|
+
) {
|
|
105
|
+
reasons.push({
|
|
106
|
+
role: "user",
|
|
107
|
+
preview: preview(firstUser),
|
|
108
|
+
why: "original task (first user turn)",
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return { enabled: true, reasons };
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function preview(m) {
|
|
116
|
+
return contentString(m).replace(/\s+/g, " ").slice(0, 80);
|
|
117
|
+
}
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
agentLoop as coreAgentLoop,
|
|
27
27
|
formatToolArgs,
|
|
28
28
|
killAllBackgroundShellTasks,
|
|
29
|
+
killAllBackgroundShellTasksSync,
|
|
29
30
|
} from "./agent-core.js";
|
|
30
31
|
import {
|
|
31
32
|
resolveAgentMcp,
|
|
@@ -905,6 +906,11 @@ export async function runAgentHeadless(options = {}, deps = {}) {
|
|
|
905
906
|
additionalDirectories,
|
|
906
907
|
sandbox: options.sandbox || null,
|
|
907
908
|
sessionId,
|
|
909
|
+
// Auto-pin (OPT-IN, off by default): pin the original task through
|
|
910
|
+
// compaction. Enable via --auto-pin or CC_AUTO_PIN=1. Falsy → agent-core
|
|
911
|
+
// passes no pin predicate and compaction is byte-identical.
|
|
912
|
+
autoPin:
|
|
913
|
+
options.autoPin === true || process.env.CC_AUTO_PIN === "1" || undefined,
|
|
908
914
|
autoCheckpoint: options.autoCheckpoint || false,
|
|
909
915
|
checkpointSession: options.checkpointSession || sessionId,
|
|
910
916
|
hookDb: db,
|
|
@@ -1071,6 +1077,30 @@ export async function runAgentHeadless(options = {}, deps = {}) {
|
|
|
1071
1077
|
};
|
|
1072
1078
|
};
|
|
1073
1079
|
|
|
1080
|
+
// A Ctrl-C (SIGINT) / SIGTERM terminates Node WITHOUT unwinding the `finally`
|
|
1081
|
+
// below, so its background-task reaper is bypassed — a backgrounded run_shell
|
|
1082
|
+
// task (e.g. a dev server) this run spawned would be orphaned. Install a
|
|
1083
|
+
// scoped handler that reaps it synchronously + stops the async-hook
|
|
1084
|
+
// supervisor, then exits with the conventional 128+signal code. Headless has
|
|
1085
|
+
// no other SIGINT owner (no raw-mode keypress like the REPL), so this can't
|
|
1086
|
+
// race a competing handler. Removed in `finally` so a normal return leaves no
|
|
1087
|
+
// listener behind (runAgentHeadless can be called repeatedly in one process).
|
|
1088
|
+
const _onHardSignal = (sig) => {
|
|
1089
|
+
try {
|
|
1090
|
+
killAllBackgroundShellTasksSync();
|
|
1091
|
+
} catch {
|
|
1092
|
+
/* best-effort — never let cleanup throw during shutdown */
|
|
1093
|
+
}
|
|
1094
|
+
try {
|
|
1095
|
+
if (_hookSupervisor) _hookSupervisor.stopAll();
|
|
1096
|
+
} catch {
|
|
1097
|
+
/* best-effort */
|
|
1098
|
+
}
|
|
1099
|
+
process.exit(sig === "SIGTERM" ? 143 : 130);
|
|
1100
|
+
};
|
|
1101
|
+
process.once("SIGINT", _onHardSignal);
|
|
1102
|
+
process.once("SIGTERM", _onHardSignal);
|
|
1103
|
+
|
|
1074
1104
|
try {
|
|
1075
1105
|
// eslint-disable-next-line no-constant-condition
|
|
1076
1106
|
while (true) {
|
|
@@ -1280,6 +1310,11 @@ export async function runAgentHeadless(options = {}, deps = {}) {
|
|
|
1280
1310
|
}
|
|
1281
1311
|
return { exitCode: 1, result: message, isError: true };
|
|
1282
1312
|
} finally {
|
|
1313
|
+
// Drop the signal handlers first — a normal return must not leave a
|
|
1314
|
+
// process-wide SIGINT/SIGTERM listener behind (a later Ctrl-C would wrongly
|
|
1315
|
+
// exit with 130, and repeated in-process runs would leak listeners).
|
|
1316
|
+
process.removeListener("SIGINT", _onHardSignal);
|
|
1317
|
+
process.removeListener("SIGTERM", _onHardSignal);
|
|
1283
1318
|
// Tear down ad-hoc MCP servers (--mcp-config) before returning, whether the
|
|
1284
1319
|
// loop completed or threw. Best-effort: a failed disconnect never masks the
|
|
1285
1320
|
// run's own outcome.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as w,P as l,J as u,U as s,R as n,c as i,K as v,Q as _,V as g,b as o}from"./vendor-BMxUs6UX.js";import{_ as S}from"./index-CP9m9Ggr.js";import"./icons-BsDmGpcT.js";const k={__name:"OrderTableRenderer",props:{event:{type:Object,required:!0}},setup(p,{expose:r}){r();const a=p,e=o(()=>a.event.content||{}),d=o(()=>a.event.extra||{}),m=o(()=>d.value.merchant||e.value.merchant||e.value.counterparty||"—"),c=o(()=>e.value.title||e.value.name||e.value.itemName||e.value.text||"—"),y=o(()=>{const t=e.value.amount??e.value.price??e.value.total;return t==null?"—":`${e.value.currency||"¥"} ${typeof t=="number"?t.toFixed(2):t}`}),T=o(()=>d.value.orderNo||e.value.orderNo||e.value.orderId),f=o(()=>e.value.status||e.value.state),h=o(()=>{const t=(f.value||"").toLowerCase();return t.includes("成功")||t.includes("succe")||t.includes("paid")?"green":t.includes("退")||t.includes("refund")?"orange":t.includes("失败")||t.includes("fail")?"red":"default"}),b=o(()=>{if(!a.event.occurredAt)return"";const t=new Date(a.event.occurredAt);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")} ${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}),x={props:a,c:e,e:d,merchantText:m,itemText:c,amountText:y,orderNo:T,statusText:f,statusColor:h,formattedTime:b,computed:o};return Object.defineProperty(x,"__isScriptSetup",{enumerable:!1,value:!0}),x}},N={class:"order-card"},C={class:"head"},O={class:"time"},V={class:"row"},R={class:"val"},B={class:"row"},D={class:"val"},I={class:"row amount-row"},j={class:"val amount"},A={key:0,class:"row"},F={class:"val mono"},M={key:1,class:"row"};function P(p,r,a,e,d,m){const c=w("a-tag");return l(),u("div",N,[s("div",C,[s("span",O,n(e.formattedTime),1),i(c,{color:"gold"},{default:v(()=>[_(n(a.event.source.adapter),1)]),_:1}),i(c,null,{default:v(()=>[_(n(a.event.subtype),1)]),_:1})]),s("div",V,[r[0]||(r[0]=s("span",{class:"key"},"商户",-1)),s("span",R,n(e.merchantText),1)]),s("div",B,[r[1]||(r[1]=s("span",{class:"key"},"商品/项目",-1)),s("span",D,n(e.itemText),1)]),s("div",I,[r[2]||(r[2]=s("span",{class:"key"},"金额",-1)),s("span",j,n(e.amountText),1)]),e.orderNo?(l(),u("div",A,[r[3]||(r[3]=s("span",{class:"key"},"单号",-1)),s("span",F,n(e.orderNo),1)])):g("v-if",!0),e.statusText?(l(),u("div",M,[r[4]||(r[4]=s("span",{class:"key"},"状态",-1)),i(c,{color:e.statusColor},{default:v(()=>[_(n(e.statusText),1)]),_:1},8,["color"])])):g("v-if",!0)])}const K=S(k,[["render",P],["__scopeId","data-v-5ed5524d"],["__file","/tmp/cc-web-panel-e7ho6d/repo/packages/web-panel/src/components/pdh/renderers/OrderTableRenderer.vue"]]);export{K as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as i,J as A,U as I,R as s,Q as r,c as t,K as a,V as _,S as x,o as oe,b as ee,r as u,P as p,F as ne,a2 as ge}from"./vendor-BMxUs6UX.js";import{_ as we,b as re,u as ie,d}from"./index-CP9m9Ggr.js";import{u as de}from"./useShellMode-CgR0wCYM.js";import{aM as ke,aN as Fe,aO as be,f as je,a4 as Ce,a7 as xe,as as Oe,R as Se}from"./icons-BsDmGpcT.js";const Pe={__name:"Projects",setup(se,{expose:l}){l();const{t:te}=re(),e=ie(),{isEmbedded:W}=de();async function w(o,f,ye,ae=8e3){if(W){const Z=await e.sendRaw({...f,type:o},ae);if(!Z?.ok){const $=Z?.error;throw new Error(typeof $=="string"?$:$?.message||`${o} failed`)}return Z.result}return e.executeJson(ye,ae)}const B=u(!1),y=u([]),O=u(""),S=u(""),P=u(!1),v=u(null),U=u([]),k=u(!1),E=u(!1),L=u(!1),F=u({name:"",description:"",type:"document",rootPath:""}),z=[{title:"ID",key:"id",width:110},{title:"名称",key:"name"},{title:"类型",key:"project_type",width:120},{title:"状态",key:"status",width:100},{title:"同步",key:"sync_status",width:100},{title:"更新",key:"updated_at",width:160},{title:"操作",key:"actions",width:180,fixed:"right"}],M=ee(()=>{const o={active:0,draft:0,completed:0,archived:0};for(const f of y.value)o[f.status]!==void 0&&(o[f.status]+=1);return o}),J=ee(()=>y.value.filter(o=>!(O.value&&o.status!==O.value||S.value&&!o.name.toLowerCase().includes(S.value.toLowerCase()))));function g(o){switch(o){case"active":return"green";case"draft":return"default";case"completed":return"cyan";case"archived":return"gold";default:return"default"}}function K(o){switch(o){case"synced":return"green";case"pending":return"orange";case"conflict":return"red";case"error":return"red";default:return"default"}}function Q(o){return!o&&o!==0?"-":new Date(typeof o=="number"?o:parseInt(o,10)).toLocaleString("zh-CN",{hour12:!1})}async function C(){B.value=!0;try{const o=await w("project.list",{limit:500},"project list --limit 500 --json",1e4);y.value=Array.isArray(o?.projects)?o.projects:Array.isArray(o)?o:[]}catch(o){d.error("加载失败: "+(o.message||o)),y.value=[]}finally{B.value=!1}}function G(o){return{onClick:()=>V(o)}}async function V(o){v.value=o,P.value=!0,k.value=!0,U.value=[];try{const f=await w("project.listFiles",{projectId:o.id,limit:200},`project list-files ${o.id} --json`,8e3);U.value=Array.isArray(f?.files)?f.files:[]}catch{U.value=[]}finally{k.value=!1}}async function H(o){try{(await w("project.delete",{id:o.id},`project delete ${o.id} --json`,8e3))?.ok?(d.success(`已删除项目 '${o.name}'`),P.value=!1,await C()):d.error("删除失败")}catch(f){d.error(f.message||String(f))}}function X(){F.value={name:"",description:"",type:"document",rootPath:""},E.value=!0}async function T(){if(!F.value.name.trim()){d.warning("请输入项目名称");return}L.value=!0;try{const o=await w("project.init",{name:F.value.name.trim(),description:F.value.description||null,projectType:F.value.type,rootPath:F.value.rootPath||null},`project init "${F.value.name.trim()}" --type ${F.value.type} --json`,8e3);o?.id?(d.success(`已创建项目 '${o.name}'`),E.value=!1,await C()):d.error("创建失败")}catch(o){d.error(o.message||String(o))}finally{L.value=!1}}const b=u(!1),D=u(!1),j=u({path:"",content:""}),h=u(!1),m=u(!1),R=u({path:""}),n=u(!1),c=u(null),q=u(""),Y=u(!1);function ue(){j.value={path:"",content:""},b.value=!0}function ce(){R.value={path:""},h.value=!0}async function N(){if(v.value){k.value=!0;try{const o=await w("project.listFiles",{projectId:v.value.id,limit:200},`project list-files ${v.value.id} --json`,8e3);U.value=Array.isArray(o?.files)?o.files:[]}catch(o){d.error("刷新文件失败: "+(o.message||o))}finally{k.value=!1}}}async function fe(){if(!j.value.path.trim()){d.warning("请输入文件路径");return}if(v.value){D.value=!0;try{const o=await w("project.createFile",{projectId:v.value.id,filePath:j.value.path.trim(),content:j.value.content||""},`project create-file ${v.value.id} "${j.value.path.trim()}" --json`,8e3);o?.id?(d.success(`已创建文件 '${o.file_name}'`),b.value=!1,await N(),await C()):d.error("创建文件失败")}catch(o){d.error(o.message||String(o))}finally{D.value=!1}}}async function pe(){if(!R.value.path.trim()){d.warning("请输入文件夹路径");return}if(v.value){m.value=!0;try{const o=await w("project.createFolder",{projectId:v.value.id,folderPath:R.value.path.trim()},`project create-folder ${v.value.id} "${R.value.path.trim()}" --json`,8e3);o?.id?(d.success(`已创建文件夹 '${o.file_name}'`),h.value=!1,await N(),await C()):d.error("创建文件夹失败")}catch(o){d.error(o.message||String(o))}finally{m.value=!1}}}async function ve(o){try{(await w("project.deleteFile",{fileId:o.id},`project delete-file ${o.id} --json`,8e3))?.deleted?(d.success(`已删除 '${o.file_name}'`),await N(),await C()):d.error("删除失败")}catch(f){d.error(f.message||String(f))}}async function me(o){if(o.is_folder){d.info("文件夹无内容可编辑");return}try{const f=await w("project.getFile",{fileId:o.id},`project get-file ${o.id} --json`,8e3);c.value=o,q.value=f?.content||"",n.value=!0}catch(f){d.error("读取文件失败: "+(f.message||f))}}async function _e(){if(c.value){Y.value=!0;try{(await w("project.writeFile",{fileId:c.value.id,content:q.value},`project write-file ${c.value.id} --json`,8e3))?.id?(d.success("已保存"),n.value=!1,await N()):d.error("保存失败")}catch(o){d.error(o.message||String(o))}finally{Y.value=!1}}}oe(()=>{C()});const le={t:te,ws:e,isEmbedded:W,callProjectTopic:w,loading:B,projects:y,statusFilter:O,nameFilter:S,detailOpen:P,detail:v,files:U,filesLoading:k,createOpen:E,creating:L,newProject:F,columns:z,countByStatus:M,filteredProjects:J,statusColor:g,syncColor:K,formatTime:Q,loadAll:C,onRowClick:G,openDetail:V,onDelete:H,onShowCreate:X,onCreate:T,createFileOpen:b,creatingFile:D,newFile:j,createFolderOpen:h,creatingFolder:m,newFolder:R,editFileOpen:n,editingFile:c,editFileContent:q,savingFile:Y,openCreateFile:ue,openCreateFolder:ce,refreshFiles:N,onCreateFile:fe,onCreateFolder:pe,onDeleteFile:ve,openEditFile:me,onSaveFile:_e,ref:u,computed:ee,onMounted:oe,get ReloadOutlined(){return Se},get PlusOutlined(){return Oe},get FolderOutlined(){return xe},get FileTextOutlined(){return Ce},get CheckCircleOutlined(){return je},get CheckSquareOutlined(){return be},get FileAddOutlined(){return Fe},get FolderAddOutlined(){return ke},get message(){return d},get useI18n(){return re},get useWsStore(){return ie},get useShellMode(){return de}};return Object.defineProperty(le,"__isScriptSetup",{enumerable:!1,value:!0}),le}},ze={style:{display:"flex","align-items":"center","justify-content":"space-between","margin-bottom":"24px"}},he={class:"page-title"},Ae={class:"page-sub"},Ie={class:"filter-bar",style:{"margin-bottom":"12px",display:"flex",gap:"12px","align-items":"center"}},Ue={key:0,style:{"font-size":"12px",color:"#888"}},De={key:0,style:{color:"#888","font-size":"12px"}},Re={key:0},Te={key:1,style:{color:"#888"}},Be=["onClick"],Ee={key:0,style:{color:"#888","font-size":"12px"}};function Le(se,l,te,e,W,w){const B=i("router-link"),y=i("a-button"),O=i("a-space"),S=i("a-statistic"),P=i("a-card"),v=i("a-col"),U=i("a-row"),k=i("a-radio-button"),E=i("a-radio-group"),L=i("a-input-search"),F=i("a-alert"),z=i("a-tag"),M=i("a-popconfirm"),J=i("a-table"),g=i("a-descriptions-item"),K=i("a-descriptions"),Q=i("a-divider"),C=i("a-empty"),G=i("a-list-item"),V=i("a-list"),H=i("a-spin"),X=i("a-drawer"),T=i("a-input"),b=i("a-form-item"),D=i("a-textarea"),j=i("a-form"),h=i("a-modal"),m=i("a-select-option"),R=i("a-select");return p(),A("div",null,[I("div",ze,[I("div",null,[I("h2",he,s(e.t("projects.title")),1),I("p",Ae,[l[17]||(l[17]=r("桌面 / CLI / 手机 三端共享同一份项目数据,Phase 3d sync 自动同步 (",-1)),t(B,{to:"/project-init"},{default:a(()=>[...l[16]||(l[16]=[r("项目初始化 / 环境设置",-1)])]),_:1}),l[18]||(l[18]=r(")",-1))])]),t(O,null,{default:a(()=>[t(y,{loading:e.loading,onClick:e.loadAll},{icon:a(()=>[t(e.ReloadOutlined)]),default:a(()=>[l[19]||(l[19]=r(" 刷新 ",-1))]),_:1},8,["loading"]),t(y,{type:"primary",onClick:e.onShowCreate},{icon:a(()=>[t(e.PlusOutlined)]),default:a(()=>[l[20]||(l[20]=r(" 新建项目 ",-1))]),_:1})]),_:1})]),_(" Stats "),t(U,{gutter:[16,16],style:{"margin-bottom":"20px"}},{default:a(()=>[t(v,{xs:12,sm:8,lg:6},{default:a(()=>[t(P,{style:{background:"var(--bg-card)","border-color":"var(--border-color)"}},{default:a(()=>[t(S,{title:"总项目",value:e.projects.length,"value-style":{color:"#1677ff",fontSize:"20px"}},{prefix:a(()=>[t(e.FolderOutlined)]),_:1},8,["value"])]),_:1})]),_:1}),t(v,{xs:12,sm:8,lg:6},{default:a(()=>[t(P,{style:{background:"var(--bg-card)","border-color":"var(--border-color)"}},{default:a(()=>[t(S,{title:"活跃",value:e.countByStatus.active,"value-style":{color:"#52c41a",fontSize:"20px"}},{prefix:a(()=>[t(e.CheckCircleOutlined)]),_:1},8,["value"])]),_:1})]),_:1}),t(v,{xs:12,sm:8,lg:6},{default:a(()=>[t(P,{style:{background:"var(--bg-card)","border-color":"var(--border-color)"}},{default:a(()=>[t(S,{title:"草稿",value:e.countByStatus.draft,"value-style":{color:"#8c8c8c",fontSize:"20px"}},{prefix:a(()=>[t(e.FileTextOutlined)]),_:1},8,["value"])]),_:1})]),_:1}),t(v,{xs:12,sm:8,lg:6},{default:a(()=>[t(P,{style:{background:"var(--bg-card)","border-color":"var(--border-color)"}},{default:a(()=>[t(S,{title:"已完成",value:e.countByStatus.completed,"value-style":{color:"#13c2c2",fontSize:"20px"}},{prefix:a(()=>[t(e.CheckSquareOutlined)]),_:1},8,["value"])]),_:1})]),_:1})]),_:1}),_(" Filter "),I("div",Ie,[t(E,{value:e.statusFilter,"onUpdate:value":l[0]||(l[0]=n=>e.statusFilter=n),size:"small","button-style":"solid"},{default:a(()=>[t(k,{value:""},{default:a(()=>[...l[21]||(l[21]=[r("全部",-1)])]),_:1}),t(k,{value:"active"},{default:a(()=>[...l[22]||(l[22]=[r("活跃",-1)])]),_:1}),t(k,{value:"draft"},{default:a(()=>[...l[23]||(l[23]=[r("草稿",-1)])]),_:1}),t(k,{value:"completed"},{default:a(()=>[...l[24]||(l[24]=[r("已完成",-1)])]),_:1}),t(k,{value:"archived"},{default:a(()=>[...l[25]||(l[25]=[r("已归档",-1)])]),_:1})]),_:1},8,["value"]),t(L,{value:e.nameFilter,"onUpdate:value":l[1]||(l[1]=n=>e.nameFilter=n),placeholder:"按名称过滤",style:{"max-width":"260px"},"allow-clear":""},null,8,["value"])]),!e.projects.length&&!e.loading?(p(),x(F,{key:0,type:"info",message:"还没有项目",description:'运行 `cc project init <name>` 或点击右上角"新建项目"按钮创建。桌面 / CLI / 手机三端共享同一份数据。',"show-icon":"",style:{"margin-bottom":"16px"}})):_("v-if",!0),e.projects.length||e.loading?(p(),x(J,{key:1,columns:e.columns,"data-source":e.filteredProjects,loading:e.loading,pagination:{pageSize:20,showSizeChanger:!0},"row-key":"id","custom-row":e.onRowClick},{bodyCell:a(({column:n,record:c})=>[n.key==="id"?(p(),A("code",Ue,s(c.id.slice(0,8))+"…",1)):n.key==="name"?(p(),A(ne,{key:1},[I("strong",null,s(c.name),1),c.description?(p(),A("div",De,s(c.description),1)):_("v-if",!0)],64)):n.key==="project_type"?(p(),x(z,{key:2},{default:a(()=>[r(s(c.project_type),1)]),_:2},1024)):n.key==="status"?(p(),x(z,{key:3,color:e.statusColor(c.status)},{default:a(()=>[r(s(c.status),1)]),_:2},1032,["color"])):n.key==="sync_status"?(p(),x(z,{key:4,color:e.syncColor(c.sync_status)},{default:a(()=>[r(s(c.sync_status||"unknown"),1)]),_:2},1032,["color"])):n.key==="updated_at"?(p(),A(ne,{key:5},[r(s(e.formatTime(c.updated_at)),1)],64)):n.key==="actions"?(p(),x(O,{key:6,onClick:l[2]||(l[2]=ge(()=>{},["stop"]))},{default:a(()=>[t(y,{size:"small",onClick:q=>e.openDetail(c)},{default:a(()=>[...l[26]||(l[26]=[r("详情",-1)])]),_:1},8,["onClick"]),t(M,{title:`删除项目 '${c.name}' ?`,"ok-text":"删除","ok-type":"danger","cancel-text":"取消",onConfirm:q=>e.onDelete(c)},{default:a(()=>[t(y,{size:"small",danger:""},{default:a(()=>[...l[27]||(l[27]=[r("删除",-1)])]),_:1})]),_:1},8,["title","onConfirm"])]),_:2},1024)):_("v-if",!0)]),_:1},8,["data-source","loading"])):_("v-if",!0),_(" Detail drawer "),t(X,{open:e.detailOpen,"onUpdate:open":l[3]||(l[3]=n=>e.detailOpen=n),title:e.detail?.name||"项目详情",width:"640",placement:"right"},{default:a(()=>[e.detail?(p(),x(K,{key:0,column:1,bordered:"",size:"small"},{default:a(()=>[t(g,{label:"ID"},{default:a(()=>[I("code",null,s(e.detail.id),1)]),_:1}),t(g,{label:"名称"},{default:a(()=>[r(s(e.detail.name),1)]),_:1}),t(g,{label:"描述"},{default:a(()=>[r(s(e.detail.description||"-"),1)]),_:1}),t(g,{label:"类型"},{default:a(()=>[t(z,null,{default:a(()=>[r(s(e.detail.project_type),1)]),_:1})]),_:1}),t(g,{label:"状态"},{default:a(()=>[t(z,{color:e.statusColor(e.detail.status)},{default:a(()=>[r(s(e.detail.status),1)]),_:1},8,["color"])]),_:1}),t(g,{label:"同步状态"},{default:a(()=>[t(z,{color:e.syncColor(e.detail.sync_status)},{default:a(()=>[r(s(e.detail.sync_status||"unknown"),1)]),_:1},8,["color"])]),_:1}),t(g,{label:"用户"},{default:a(()=>[r(s(e.detail.user_id),1)]),_:1}),t(g,{label:"根路径"},{default:a(()=>[e.detail.root_path?(p(),A("code",Re,s(e.detail.root_path),1)):(p(),A("span",Te,"(无)"))]),_:1}),t(g,{label:"文件数"},{default:a(()=>[r(s(e.detail.file_count||0),1)]),_:1}),t(g,{label:"创建"},{default:a(()=>[r(s(e.formatTime(e.detail.created_at)),1)]),_:1}),t(g,{label:"更新"},{default:a(()=>[r(s(e.formatTime(e.detail.updated_at)),1)]),_:1})]),_:1})):_("v-if",!0),t(Q,null,{default:a(()=>[...l[28]||(l[28]=[r("文件",-1)])]),_:1}),_(" Sub-phase 7.3 (2026-05-17): 文件 CRUD toolbar "),t(O,{style:{"margin-bottom":"12px"}},{default:a(()=>[t(y,{size:"small",type:"primary",disabled:!e.detail,onClick:e.openCreateFile},{default:a(()=>[t(e.FileAddOutlined),l[29]||(l[29]=r(" 新建文件 ",-1))]),_:1},8,["disabled"]),t(y,{size:"small",disabled:!e.detail,onClick:e.openCreateFolder},{default:a(()=>[t(e.FolderAddOutlined),l[30]||(l[30]=r(" 新建文件夹 ",-1))]),_:1},8,["disabled"])]),_:1}),t(H,{spinning:e.filesLoading},{default:a(()=>[!e.files.length&&!e.filesLoading?(p(),x(C,{key:0,description:"无文件 (点上方按钮新建)"})):(p(),x(V,{key:1,size:"small","data-source":e.files},{renderItem:a(({item:n})=>[t(G,null,{extra:a(()=>[t(O,null,{default:a(()=>[n.file_size?(p(),A("span",Ee,s(n.file_size)+" B",1)):_("v-if",!0),t(M,{title:`删除 ${n.is_folder?"文件夹":"文件"} '${n.file_name}' ?`,"ok-text":"删除","ok-type":"danger","cancel-text":"取消",onConfirm:c=>e.onDeleteFile(n)},{default:a(()=>[t(y,{size:"small",danger:""},{default:a(()=>[...l[31]||(l[31]=[r("×",-1)])]),_:1})]),_:1},8,["title","onConfirm"])]),_:2},1024)]),default:a(()=>[I("span",{style:{cursor:"pointer"},onClick:c=>e.openEditFile(n)},s(n.is_folder?"📁":"📄")+" "+s(n.file_path),9,Be)]),_:2},1024)]),_:1},8,["data-source"]))]),_:1},8,["spinning"])]),_:1},8,["open","title"]),_(" Sub-phase 7.3: Create file modal "),t(h,{open:e.createFileOpen,"onUpdate:open":l[6]||(l[6]=n=>e.createFileOpen=n),title:"新建文件","confirm-loading":e.creatingFile,"ok-text":"创建","cancel-text":"取消",onOk:e.onCreateFile},{default:a(()=>[t(j,{layout:"vertical"},{default:a(()=>[t(b,{label:"文件路径(项目内)",required:""},{default:a(()=>[t(T,{value:e.newFile.path,"onUpdate:value":l[4]||(l[4]=n=>e.newFile.path=n),placeholder:"例如 README.md 或 src/main.kt"},null,8,["value"])]),_:1}),t(b,{label:"初始内容(可选)"},{default:a(()=>[t(D,{value:e.newFile.content,"onUpdate:value":l[5]||(l[5]=n=>e.newFile.content=n),rows:6,placeholder:"留空创建空文件"},null,8,["value"])]),_:1})]),_:1})]),_:1},8,["open","confirm-loading"]),_(" Sub-phase 7.3: Create folder modal "),t(h,{open:e.createFolderOpen,"onUpdate:open":l[8]||(l[8]=n=>e.createFolderOpen=n),title:"新建文件夹","confirm-loading":e.creatingFolder,"ok-text":"创建","cancel-text":"取消",onOk:e.onCreateFolder},{default:a(()=>[t(j,{layout:"vertical"},{default:a(()=>[t(b,{label:"文件夹路径(项目内)",required:""},{default:a(()=>[t(T,{value:e.newFolder.path,"onUpdate:value":l[7]||(l[7]=n=>e.newFolder.path=n),placeholder:"例如 src/utils"},null,8,["value"])]),_:1})]),_:1})]),_:1},8,["open","confirm-loading"]),_(" Sub-phase 7.3: Edit file content modal "),t(h,{open:e.editFileOpen,"onUpdate:open":l[10]||(l[10]=n=>e.editFileOpen=n),title:`编辑 ${e.editingFile?.file_name||""}`,"confirm-loading":e.savingFile,"ok-text":"保存","cancel-text":"取消",onOk:e.onSaveFile,width:"720"},{default:a(()=>[t(D,{value:e.editFileContent,"onUpdate:value":l[9]||(l[9]=n=>e.editFileContent=n),rows:18,"auto-size":{minRows:12,maxRows:24},style:{"font-family":"monospace"}},null,8,["value"])]),_:1},8,["open","title","confirm-loading"]),_(" Create modal "),t(h,{open:e.createOpen,"onUpdate:open":l[15]||(l[15]=n=>e.createOpen=n),title:"新建项目","confirm-loading":e.creating,"ok-text":"创建","cancel-text":"取消",onOk:e.onCreate},{default:a(()=>[t(j,{layout:"vertical"},{default:a(()=>[t(b,{label:"项目名称",required:""},{default:a(()=>[t(T,{value:e.newProject.name,"onUpdate:value":l[11]||(l[11]=n=>e.newProject.name=n),placeholder:"例如:旅行计划-上海"},null,8,["value"])]),_:1}),t(b,{label:"描述"},{default:a(()=>[t(D,{value:e.newProject.description,"onUpdate:value":l[12]||(l[12]=n=>e.newProject.description=n),rows:2},null,8,["value"])]),_:1}),t(b,{label:"类型"},{default:a(()=>[t(R,{value:e.newProject.type,"onUpdate:value":l[13]||(l[13]=n=>e.newProject.type=n)},{default:a(()=>[t(m,{value:"document"},{default:a(()=>[...l[32]||(l[32]=[r("文档 (document)",-1)])]),_:1}),t(m,{value:"data"},{default:a(()=>[...l[33]||(l[33]=[r("数据 (data)",-1)])]),_:1}),t(m,{value:"web"},{default:a(()=>[...l[34]||(l[34]=[r("Web",-1)])]),_:1}),t(m,{value:"app"},{default:a(()=>[...l[35]||(l[35]=[r("应用 (app)",-1)])]),_:1}),t(m,{value:"presentation"},{default:a(()=>[...l[36]||(l[36]=[r("演示文稿",-1)])]),_:1}),t(m,{value:"spreadsheet"},{default:a(()=>[...l[37]||(l[37]=[r("表格",-1)])]),_:1}),t(m,{value:"design"},{default:a(()=>[...l[38]||(l[38]=[r("设计",-1)])]),_:1}),t(m,{value:"code"},{default:a(()=>[...l[39]||(l[39]=[r("代码",-1)])]),_:1}),t(m,{value:"workflow"},{default:a(()=>[...l[40]||(l[40]=[r("工作流",-1)])]),_:1}),t(m,{value:"knowledge"},{default:a(()=>[...l[41]||(l[41]=[r("知识库",-1)])]),_:1})]),_:1},8,["value"])]),_:1}),t(b,{label:"根路径 (可选)"},{default:a(()=>[t(T,{value:e.newProject.rootPath,"onUpdate:value":l[14]||(l[14]=n=>e.newProject.rootPath=n),placeholder:"留空则仅元数据"},null,8,["value"])]),_:1})]),_:1})]),_:1},8,["open","confirm-loading"])])}const We=we(Pe,[["render",Le],["__scopeId","data-v-019ac5aa"],["__file","/tmp/cc-web-panel-e7ho6d/repo/packages/web-panel/src/views/Projects.vue"]]);export{We as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Q as r}from"./index-CP9m9Ggr.js";const o=((n,a,e)=>{r(n,`[ant-design-vue: ${a}] ${e}`)});export{o as d};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as o}from"./Col-DIT2fNFU.js";import{a0 as t}from"./index-CP9m9Ggr.js";import"./vendor-BMxUs6UX.js";import"./index-D65_XseV.js";import"./icons-BsDmGpcT.js";const s=t(o);export{s as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as o}from"./Row-Kx5dKxX7.js";import{a0 as t}from"./index-CP9m9Ggr.js";import"./vendor-BMxUs6UX.js";import"./responsiveObserve-D3WvTlLO.js";import"./useFlexGapSupport-C5Yd-SCR.js";import"./styleChecker-xPrIiJPI.js";import"./index-D65_XseV.js";import"./icons-BsDmGpcT.js";const l=t(o);export{l as default};
|