@linghun/tui 0.1.0
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/LICENSE +190 -0
- package/dist/agent-completion-finalizer.d.ts +31 -0
- package/dist/agent-completion-finalizer.d.ts.map +1 -0
- package/dist/agent-completion-finalizer.js +20 -0
- package/dist/agent-handoff-safety.d.ts +13 -0
- package/dist/agent-handoff-safety.d.ts.map +1 -0
- package/dist/agent-handoff-safety.js +43 -0
- package/dist/agent-workflow-registry.d.ts +45 -0
- package/dist/agent-workflow-registry.d.ts.map +1 -0
- package/dist/agent-workflow-registry.js +12 -0
- package/dist/architecture-boundary.d.ts +151 -0
- package/dist/architecture-boundary.d.ts.map +1 -0
- package/dist/architecture-boundary.js +24 -0
- package/dist/architecture-runtime.d.ts +56 -0
- package/dist/architecture-runtime.d.ts.map +1 -0
- package/dist/architecture-runtime.js +18 -0
- package/dist/background-control-runtime.d.ts +29 -0
- package/dist/background-control-runtime.d.ts.map +1 -0
- package/dist/background-control-runtime.js +148 -0
- package/dist/bash-subcommand-parser.d.ts +34 -0
- package/dist/bash-subcommand-parser.d.ts.map +1 -0
- package/dist/bash-subcommand-parser.js +8 -0
- package/dist/batch-tool-confirmation.d.ts +18 -0
- package/dist/batch-tool-confirmation.d.ts.map +1 -0
- package/dist/batch-tool-confirmation.js +100 -0
- package/dist/break-cache-runtime.d.ts +40 -0
- package/dist/break-cache-runtime.d.ts.map +1 -0
- package/dist/break-cache-runtime.js +17 -0
- package/dist/btw-runtime.d.ts +45 -0
- package/dist/btw-runtime.d.ts.map +1 -0
- package/dist/btw-runtime.js +14 -0
- package/dist/cache-command-runtime.d.ts +22 -0
- package/dist/cache-command-runtime.d.ts.map +1 -0
- package/dist/cache-command-runtime.js +33 -0
- package/dist/cache-freshness.d.ts +26 -0
- package/dist/cache-freshness.d.ts.map +1 -0
- package/dist/cache-freshness.js +14 -0
- package/dist/capability-runtime.d.ts +75 -0
- package/dist/capability-runtime.d.ts.map +1 -0
- package/dist/capability-runtime.js +97 -0
- package/dist/chunk-2FVEKTKN.js +86 -0
- package/dist/chunk-2YL5VKJ5.js +531 -0
- package/dist/chunk-3AKXDMVS.js +85 -0
- package/dist/chunk-3GCIXKCI.js +221 -0
- package/dist/chunk-3LT6OWQ2.js +258 -0
- package/dist/chunk-3XNUDLOM.js +91 -0
- package/dist/chunk-4EIC5BCT.js +475 -0
- package/dist/chunk-4EP3TUFF.js +238 -0
- package/dist/chunk-4I2NWBOM.js +117 -0
- package/dist/chunk-4K6UB524.js +443 -0
- package/dist/chunk-4T5DJW54.js +88 -0
- package/dist/chunk-4WHZ6JKD.js +8105 -0
- package/dist/chunk-5H7RRF7C.js +6 -0
- package/dist/chunk-64MJP6FK.js +558 -0
- package/dist/chunk-66BNE332.js +1617 -0
- package/dist/chunk-6CI6TKLN.js +50 -0
- package/dist/chunk-6RJVTUWI.js +16 -0
- package/dist/chunk-6SMM5CMP.js +100 -0
- package/dist/chunk-6USL33ZO.js +289 -0
- package/dist/chunk-7ZE5JFAZ.js +760 -0
- package/dist/chunk-AKPXMCVF.js +1373 -0
- package/dist/chunk-AO4CXI37.js +284 -0
- package/dist/chunk-APJIC2O5.js +150 -0
- package/dist/chunk-B4GQTZMT.js +607 -0
- package/dist/chunk-BFVPLGAC.js +93 -0
- package/dist/chunk-BOV4K7FP.js +588 -0
- package/dist/chunk-CFMSB6ST.js +59 -0
- package/dist/chunk-CFXB5SE5.js +502 -0
- package/dist/chunk-CRQORMFF.js +32 -0
- package/dist/chunk-CRSLDQOA.js +146 -0
- package/dist/chunk-CRW3636S.js +214 -0
- package/dist/chunk-D3UTL2QX.js +86 -0
- package/dist/chunk-D7TCSOAZ.js +331 -0
- package/dist/chunk-DDXS2RDZ.js +228 -0
- package/dist/chunk-DICVLZHH.js +144 -0
- package/dist/chunk-DNQN74CC.js +1186 -0
- package/dist/chunk-DTK5NBTV.js +912 -0
- package/dist/chunk-E72U7WW7.js +50 -0
- package/dist/chunk-EBACIBJP.js +356 -0
- package/dist/chunk-ECFLCY5V.js +530 -0
- package/dist/chunk-EORRZP3F.js +109 -0
- package/dist/chunk-F43AMWLZ.js +115 -0
- package/dist/chunk-F46N43MG.js +56 -0
- package/dist/chunk-F6TVBCZV.js +51 -0
- package/dist/chunk-FRIMDSRU.js +242 -0
- package/dist/chunk-FTAEPAVY.js +314 -0
- package/dist/chunk-GC55DMZV.js +156 -0
- package/dist/chunk-GCMH5P4W.js +422 -0
- package/dist/chunk-GDQQNPBP.js +251 -0
- package/dist/chunk-GKZYTPN2.js +279 -0
- package/dist/chunk-GLWTWEGX.js +272 -0
- package/dist/chunk-GMUCSNUD.js +586 -0
- package/dist/chunk-GTP2KPLY.js +167 -0
- package/dist/chunk-GW5YDCRZ.js +42 -0
- package/dist/chunk-H3T4EF5F.js +87 -0
- package/dist/chunk-HAEU6OTS.js +381 -0
- package/dist/chunk-HQIJGQYU.js +172 -0
- package/dist/chunk-HW2TBXVK.js +34 -0
- package/dist/chunk-HWD22O6F.js +94 -0
- package/dist/chunk-I3NTAIMF.js +280 -0
- package/dist/chunk-IN42UISW.js +372 -0
- package/dist/chunk-IWUIOLMF.js +82 -0
- package/dist/chunk-J7ZE2JKP.js +283 -0
- package/dist/chunk-JBLVBO3U.js +109 -0
- package/dist/chunk-JDWXC2OQ.js +800 -0
- package/dist/chunk-JGDIO2NF.js +74 -0
- package/dist/chunk-JHGWGH2C.js +182 -0
- package/dist/chunk-JLCPHVBN.js +42 -0
- package/dist/chunk-JO5ANTMR.js +6027 -0
- package/dist/chunk-JPXSFZFC.js +100 -0
- package/dist/chunk-JQCRCDOC.js +1195 -0
- package/dist/chunk-K4FSYBSY.js +41 -0
- package/dist/chunk-K56D3X7S.js +1225 -0
- package/dist/chunk-KI7C6ZOD.js +92 -0
- package/dist/chunk-KO64OFSG.js +58 -0
- package/dist/chunk-KQJHVJZB.js +227 -0
- package/dist/chunk-KTWV5JC5.js +59 -0
- package/dist/chunk-L4XXW6Y5.js +374 -0
- package/dist/chunk-L5GOCMZP.js +18 -0
- package/dist/chunk-LDABZV5V.js +278 -0
- package/dist/chunk-LHHKPGLX.js +903 -0
- package/dist/chunk-LL7LBRDL.js +60 -0
- package/dist/chunk-LQTVYUT3.js +421 -0
- package/dist/chunk-LVIM2PA7.js +663 -0
- package/dist/chunk-M4AIK2SP.js +215 -0
- package/dist/chunk-MLUIOBKL.js +420 -0
- package/dist/chunk-MOJL4X4L.js +47 -0
- package/dist/chunk-MVONSJEN.js +300 -0
- package/dist/chunk-N7G2X2LK.js +709 -0
- package/dist/chunk-NKFKOEYX.js +146 -0
- package/dist/chunk-NMNOAFFT.js +167 -0
- package/dist/chunk-NSIKYD3X.js +74 -0
- package/dist/chunk-O7EFPSMC.js +60 -0
- package/dist/chunk-O7S3HYE6.js +210 -0
- package/dist/chunk-OEYW3JE3.js +262 -0
- package/dist/chunk-OF3K3CU5.js +159 -0
- package/dist/chunk-OMZYPQVA.js +298 -0
- package/dist/chunk-OZMX3E35.js +248 -0
- package/dist/chunk-P277M7Z5.js +303 -0
- package/dist/chunk-P4CPRJLI.js +65 -0
- package/dist/chunk-PBIPV4LD.js +494 -0
- package/dist/chunk-PGNALDEH.js +2003 -0
- package/dist/chunk-PGWW3DVE.js +157 -0
- package/dist/chunk-QB4VWH7W.js +515 -0
- package/dist/chunk-QBCGAIU7.js +120 -0
- package/dist/chunk-QIU3FJPC.js +99 -0
- package/dist/chunk-QLRTQHTR.js +744 -0
- package/dist/chunk-QTDGRZMZ.js +171 -0
- package/dist/chunk-RBOQJFIZ.js +183 -0
- package/dist/chunk-RDGM4RUE.js +178 -0
- package/dist/chunk-RM5JDRCW.js +71 -0
- package/dist/chunk-RM5QMOFY.js +189 -0
- package/dist/chunk-RMLTVKOY.js +588 -0
- package/dist/chunk-RVY34HK4.js +79 -0
- package/dist/chunk-S3YWTBXL.js +43 -0
- package/dist/chunk-SJOS5PM6.js +64 -0
- package/dist/chunk-SOPYWTFV.js +90 -0
- package/dist/chunk-SQIBPLLV.js +15 -0
- package/dist/chunk-SRZIA6B4.js +136 -0
- package/dist/chunk-SYBNJZEL.js +250 -0
- package/dist/chunk-TFZEFIQT.js +17 -0
- package/dist/chunk-THZBFYAH.js +136 -0
- package/dist/chunk-TJLC3QAS.js +83 -0
- package/dist/chunk-TYF4GJR3.js +598 -0
- package/dist/chunk-UDQT5CWK.js +252 -0
- package/dist/chunk-UOHZQIVL.js +168 -0
- package/dist/chunk-URNQUECO.js +187 -0
- package/dist/chunk-UT2TYK2A.js +148 -0
- package/dist/chunk-UT5BOJKU.js +190 -0
- package/dist/chunk-V7GDHHBL.js +526 -0
- package/dist/chunk-VCSRBS47.js +133 -0
- package/dist/chunk-VIBENDE3.js +152 -0
- package/dist/chunk-VTQL23UM.js +302 -0
- package/dist/chunk-W3KHJNSH.js +281 -0
- package/dist/chunk-W6NU7ZAV.js +52 -0
- package/dist/chunk-WHFDDZHY.js +407 -0
- package/dist/chunk-WJWYRBWH.js +48 -0
- package/dist/chunk-WKMBK5UP.js +145 -0
- package/dist/chunk-WQMSRO4D.js +489 -0
- package/dist/chunk-WV6YJGZR.js +81 -0
- package/dist/chunk-WVAQYKGL.js +269 -0
- package/dist/chunk-X7A22JHP.js +106 -0
- package/dist/chunk-XFPNU42I.js +59 -0
- package/dist/chunk-YH6UIHNF.js +161 -0
- package/dist/chunk-YPQFSFYK.js +19 -0
- package/dist/chunk-YTQFOZRZ.js +110 -0
- package/dist/chunk-ZJK25VFP.js +506 -0
- package/dist/chunk-ZOSK2UEU.js +1555 -0
- package/dist/chunk-ZYSN7AWW.js +336 -0
- package/dist/chunk-ZZ2CNCXJ.js +282 -0
- package/dist/command-panel-runtime.d.ts +33 -0
- package/dist/command-panel-runtime.d.ts.map +1 -0
- package/dist/command-panel-runtime.js +80 -0
- package/dist/compact-cache-command-runtime.d.ts +38 -0
- package/dist/compact-cache-command-runtime.d.ts.map +1 -0
- package/dist/compact-cache-command-runtime.js +146 -0
- package/dist/compact-context.d.ts +35 -0
- package/dist/compact-context.d.ts.map +1 -0
- package/dist/compact-context.js +16 -0
- package/dist/compact-preflight-runtime.d.ts +46 -0
- package/dist/compact-preflight-runtime.d.ts.map +1 -0
- package/dist/compact-preflight-runtime.js +62 -0
- package/dist/connector-runtime.d.ts +72 -0
- package/dist/connector-runtime.d.ts.map +1 -0
- package/dist/connector-runtime.js +88 -0
- package/dist/context-estimator.d.ts +20 -0
- package/dist/context-estimator.d.ts.map +1 -0
- package/dist/context-estimator.js +18 -0
- package/dist/context-window-runtime.d.ts +12 -0
- package/dist/context-window-runtime.d.ts.map +1 -0
- package/dist/context-window-runtime.js +10 -0
- package/dist/deep-compact-runtime.d.ts +53 -0
- package/dist/deep-compact-runtime.d.ts.map +1 -0
- package/dist/deep-compact-runtime.js +35 -0
- package/dist/deferred-tools-catalog.d.ts +52 -0
- package/dist/deferred-tools-catalog.d.ts.map +1 -0
- package/dist/deferred-tools-catalog.js +42 -0
- package/dist/details-status-runtime.d.ts +48 -0
- package/dist/details-status-runtime.d.ts.map +1 -0
- package/dist/details-status-runtime.js +102 -0
- package/dist/evidence-runtime.d.ts +48 -0
- package/dist/evidence-runtime.d.ts.map +1 -0
- package/dist/evidence-runtime.js +92 -0
- package/dist/extension-command-runtime.d.ts +63 -0
- package/dist/extension-command-runtime.d.ts.map +1 -0
- package/dist/extension-command-runtime.js +67 -0
- package/dist/extension-slash-runtime.d.ts +11 -0
- package/dist/extension-slash-runtime.d.ts.map +1 -0
- package/dist/extension-slash-runtime.js +79 -0
- package/dist/external-editor-runtime.d.ts +32 -0
- package/dist/external-editor-runtime.d.ts.map +1 -0
- package/dist/external-editor-runtime.js +71 -0
- package/dist/failure-learning-command-runtime.d.ts +10 -0
- package/dist/failure-learning-command-runtime.d.ts.map +1 -0
- package/dist/failure-learning-command-runtime.js +78 -0
- package/dist/failure-learning-presenter.d.ts +6 -0
- package/dist/failure-learning-presenter.d.ts.map +1 -0
- package/dist/failure-learning-presenter.js +12 -0
- package/dist/failure-learning-runtime.d.ts +39 -0
- package/dist/failure-learning-runtime.d.ts.map +1 -0
- package/dist/failure-learning-runtime.js +39 -0
- package/dist/feature-flag-runtime.d.ts +8 -0
- package/dist/feature-flag-runtime.d.ts.map +1 -0
- package/dist/feature-flag-runtime.js +12 -0
- package/dist/feishu-long-connection-runtime.d.ts +12 -0
- package/dist/feishu-long-connection-runtime.d.ts.map +1 -0
- package/dist/feishu-long-connection-runtime.js +7 -0
- package/dist/final-answer-gate.d.ts +24 -0
- package/dist/final-answer-gate.d.ts.map +1 -0
- package/dist/final-answer-gate.js +26 -0
- package/dist/ghost-text.d.ts +16 -0
- package/dist/ghost-text.d.ts.map +1 -0
- package/dist/ghost-text.js +8 -0
- package/dist/git-branch-runtime.d.ts +14 -0
- package/dist/git-branch-runtime.d.ts.map +1 -0
- package/dist/git-branch-runtime.js +68 -0
- package/dist/git-command-runtime.d.ts +22 -0
- package/dist/git-command-runtime.d.ts.map +1 -0
- package/dist/git-command-runtime.js +89 -0
- package/dist/git-operation-runtime.d.ts +188 -0
- package/dist/git-operation-runtime.d.ts.map +1 -0
- package/dist/git-operation-runtime.js +45 -0
- package/dist/git-runtime.d.ts +113 -0
- package/dist/git-runtime.d.ts.map +1 -0
- package/dist/git-runtime.js +16 -0
- package/dist/git-slash-runtime.d.ts +38 -0
- package/dist/git-slash-runtime.d.ts.map +1 -0
- package/dist/git-slash-runtime.js +18 -0
- package/dist/git-tool-dispatch-runtime.d.ts +108 -0
- package/dist/git-tool-dispatch-runtime.d.ts.map +1 -0
- package/dist/git-tool-dispatch-runtime.js +25 -0
- package/dist/git-tool-runtime.d.ts +64 -0
- package/dist/git-tool-runtime.d.ts.map +1 -0
- package/dist/git-tool-runtime.js +36 -0
- package/dist/guard-wiring.d.ts +67 -0
- package/dist/guard-wiring.d.ts.map +1 -0
- package/dist/guard-wiring.js +21 -0
- package/dist/handoff-session-runtime.d.ts +11 -0
- package/dist/handoff-session-runtime.d.ts.map +1 -0
- package/dist/handoff-session-runtime.js +36 -0
- package/dist/index-result-presenter.d.ts +14 -0
- package/dist/index-result-presenter.d.ts.map +1 -0
- package/dist/index-result-presenter.js +28 -0
- package/dist/index-runtime.d.ts +64 -0
- package/dist/index-runtime.d.ts.map +1 -0
- package/dist/index-runtime.js +28 -0
- package/dist/index-tool-runtime.d.ts +44 -0
- package/dist/index-tool-runtime.d.ts.map +1 -0
- package/dist/index-tool-runtime.js +24 -0
- package/dist/index.d.ts +57 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2346 -0
- package/dist/job-agent-command-runtime.d.ts +127 -0
- package/dist/job-agent-command-runtime.d.ts.map +1 -0
- package/dist/job-agent-command-runtime.js +138 -0
- package/dist/job-runner-presenter.d.ts +32 -0
- package/dist/job-runner-presenter.d.ts.map +1 -0
- package/dist/job-runner-presenter.js +30 -0
- package/dist/job-runtime.d.ts +65 -0
- package/dist/job-runtime.d.ts.map +1 -0
- package/dist/job-runtime.js +88 -0
- package/dist/keybinding-runtime.d.ts +29 -0
- package/dist/keybinding-runtime.d.ts.map +1 -0
- package/dist/keybinding-runtime.js +14 -0
- package/dist/log-artifact.d.ts +55 -0
- package/dist/log-artifact.d.ts.map +1 -0
- package/dist/log-artifact.js +10 -0
- package/dist/mcp-index-command-runtime.d.ts +21 -0
- package/dist/mcp-index-command-runtime.d.ts.map +1 -0
- package/dist/mcp-index-command-runtime.js +18 -0
- package/dist/mcp-index-runtime.d.ts +106 -0
- package/dist/mcp-index-runtime.d.ts.map +1 -0
- package/dist/mcp-index-runtime.js +142 -0
- package/dist/mcp-sse-runtime.d.ts +13 -0
- package/dist/mcp-sse-runtime.d.ts.map +1 -0
- package/dist/mcp-sse-runtime.js +8 -0
- package/dist/mcp-stdio-runtime.d.ts +37 -0
- package/dist/mcp-stdio-runtime.d.ts.map +1 -0
- package/dist/mcp-stdio-runtime.js +15 -0
- package/dist/memory-command-runtime.d.ts +37 -0
- package/dist/memory-command-runtime.d.ts.map +1 -0
- package/dist/memory-command-runtime.js +88 -0
- package/dist/memory-eviction-runtime.d.ts +7 -0
- package/dist/memory-eviction-runtime.d.ts.map +1 -0
- package/dist/memory-eviction-runtime.js +12 -0
- package/dist/memory-extraction-runtime.d.ts +40 -0
- package/dist/memory-extraction-runtime.d.ts.map +1 -0
- package/dist/memory-extraction-runtime.js +20 -0
- package/dist/memory-rules-runtime.d.ts +15 -0
- package/dist/memory-rules-runtime.d.ts.map +1 -0
- package/dist/memory-rules-runtime.js +14 -0
- package/dist/meta-scheduler-complexity.d.ts +16 -0
- package/dist/meta-scheduler-complexity.d.ts.map +1 -0
- package/dist/meta-scheduler-complexity.js +37 -0
- package/dist/meta-scheduler-runtime.d.ts +288 -0
- package/dist/meta-scheduler-runtime.d.ts.map +1 -0
- package/dist/meta-scheduler-runtime.js +17 -0
- package/dist/model-command-runtime.d.ts +12 -0
- package/dist/model-command-runtime.d.ts.map +1 -0
- package/dist/model-command-runtime.js +84 -0
- package/dist/model-doctor-runtime.d.ts +81 -0
- package/dist/model-doctor-runtime.d.ts.map +1 -0
- package/dist/model-doctor-runtime.js +46 -0
- package/dist/model-loop-runtime.d.ts +189 -0
- package/dist/model-loop-runtime.d.ts.map +1 -0
- package/dist/model-loop-runtime.js +141 -0
- package/dist/model-prompt-runtime.d.ts +25 -0
- package/dist/model-prompt-runtime.d.ts.map +1 -0
- package/dist/model-prompt-runtime.js +33 -0
- package/dist/model-setup-runtime.d.ts +28 -0
- package/dist/model-setup-runtime.d.ts.map +1 -0
- package/dist/model-setup-runtime.js +26 -0
- package/dist/model-stream-runtime.d.ts +47 -0
- package/dist/model-stream-runtime.d.ts.map +1 -0
- package/dist/model-stream-runtime.js +136 -0
- package/dist/model-tool-runtime.d.ts +114 -0
- package/dist/model-tool-runtime.d.ts.map +1 -0
- package/dist/model-tool-runtime.js +144 -0
- package/dist/natural-command-bridge.d.ts +158 -0
- package/dist/natural-command-bridge.d.ts.map +1 -0
- package/dist/natural-command-bridge.js +36 -0
- package/dist/pending-details-presenter.d.ts +8 -0
- package/dist/pending-details-presenter.d.ts.map +1 -0
- package/dist/pending-details-presenter.js +12 -0
- package/dist/permission-approval-runtime.d.ts +28 -0
- package/dist/permission-approval-runtime.d.ts.map +1 -0
- package/dist/permission-approval-runtime.js +136 -0
- package/dist/permission-continuation-runtime.d.ts +90 -0
- package/dist/permission-continuation-runtime.d.ts.map +1 -0
- package/dist/permission-continuation-runtime.js +68 -0
- package/dist/permission-policy-engine.d.ts +51 -0
- package/dist/permission-policy-engine.d.ts.map +1 -0
- package/dist/permission-policy-engine.js +12 -0
- package/dist/permission-presenter.d.ts +13 -0
- package/dist/permission-presenter.d.ts.map +1 -0
- package/dist/permission-presenter.js +8 -0
- package/dist/persistent-history.d.ts +18 -0
- package/dist/persistent-history.d.ts.map +1 -0
- package/dist/persistent-history.js +126 -0
- package/dist/platform-security.d.ts +4 -0
- package/dist/platform-security.d.ts.map +1 -0
- package/dist/platform-security.js +10 -0
- package/dist/process-command-runtime.d.ts +9 -0
- package/dist/process-command-runtime.d.ts.map +1 -0
- package/dist/process-command-runtime.js +11 -0
- package/dist/process-guard.d.ts +56 -0
- package/dist/process-guard.d.ts.map +1 -0
- package/dist/process-guard.js +22 -0
- package/dist/prompt-command-runtime.d.ts +12 -0
- package/dist/prompt-command-runtime.d.ts.map +1 -0
- package/dist/prompt-command-runtime.js +10 -0
- package/dist/prompt-stash.d.ts +15 -0
- package/dist/prompt-stash.d.ts.map +1 -0
- package/dist/prompt-stash.js +8 -0
- package/dist/provider-circuit-breaker.d.ts +132 -0
- package/dist/provider-circuit-breaker.d.ts.map +1 -0
- package/dist/provider-circuit-breaker.js +31 -0
- package/dist/provider-loop-runtime.d.ts +18 -0
- package/dist/provider-loop-runtime.d.ts.map +1 -0
- package/dist/provider-loop-runtime.js +16 -0
- package/dist/remote-command-runtime.d.ts +47 -0
- package/dist/remote-command-runtime.d.ts.map +1 -0
- package/dist/remote-command-runtime.js +125 -0
- package/dist/remote-inbound-bridge-runtime.d.ts +152 -0
- package/dist/remote-inbound-bridge-runtime.d.ts.map +1 -0
- package/dist/remote-inbound-bridge-runtime.js +44 -0
- package/dist/remote-mcp-presenter.d.ts +5 -0
- package/dist/remote-mcp-presenter.d.ts.map +1 -0
- package/dist/remote-mcp-presenter.js +10 -0
- package/dist/remote-repl-bridge-runtime.d.ts +134 -0
- package/dist/remote-repl-bridge-runtime.d.ts.map +1 -0
- package/dist/remote-repl-bridge-runtime.js +20 -0
- package/dist/remote-transport.d.ts +50 -0
- package/dist/remote-transport.d.ts.map +1 -0
- package/dist/remote-transport.js +14 -0
- package/dist/request-lifecycle-presenter.d.ts +25 -0
- package/dist/request-lifecycle-presenter.d.ts.map +1 -0
- package/dist/request-lifecycle-presenter.js +22 -0
- package/dist/runner-runtime.d.ts +41 -0
- package/dist/runner-runtime.d.ts.map +1 -0
- package/dist/runner-runtime.js +35 -0
- package/dist/runtime-budget.d.ts +38 -0
- package/dist/runtime-budget.d.ts.map +1 -0
- package/dist/runtime-budget.js +78 -0
- package/dist/runtime-path-marker.d.ts +112 -0
- package/dist/runtime-path-marker.d.ts.map +1 -0
- package/dist/runtime-path-marker.js +18 -0
- package/dist/runtime-status-presenter.d.ts +22 -0
- package/dist/runtime-status-presenter.d.ts.map +1 -0
- package/dist/runtime-status-presenter.js +15 -0
- package/dist/runtime-status-snapshot.d.ts +52 -0
- package/dist/runtime-status-snapshot.d.ts.map +1 -0
- package/dist/runtime-status-snapshot.js +11 -0
- package/dist/runtime-utils.d.ts +2 -0
- package/dist/runtime-utils.d.ts.map +1 -0
- package/dist/runtime-utils.js +6 -0
- package/dist/shell/clipboard.d.ts +23 -0
- package/dist/shell/clipboard.d.ts.map +1 -0
- package/dist/shell/clipboard.js +8 -0
- package/dist/shell/components/AgentProgressTree.d.ts +9 -0
- package/dist/shell/components/AgentProgressTree.d.ts.map +1 -0
- package/dist/shell/components/AgentProgressTree.js +9 -0
- package/dist/shell/components/BackgroundTaskOverlay.d.ts +8 -0
- package/dist/shell/components/BackgroundTaskOverlay.d.ts.map +1 -0
- package/dist/shell/components/BackgroundTaskOverlay.js +8 -0
- package/dist/shell/components/BtwPanel.d.ts +16 -0
- package/dist/shell/components/BtwPanel.d.ts.map +1 -0
- package/dist/shell/components/BtwPanel.js +8 -0
- package/dist/shell/components/CommandPanel.d.ts +11 -0
- package/dist/shell/components/CommandPanel.d.ts.map +1 -0
- package/dist/shell/components/CommandPanel.js +8 -0
- package/dist/shell/components/Composer.d.ts +187 -0
- package/dist/shell/components/Composer.d.ts.map +1 -0
- package/dist/shell/components/Composer.js +99 -0
- package/dist/shell/components/ConfigPanel.d.ts +11 -0
- package/dist/shell/components/ConfigPanel.d.ts.map +1 -0
- package/dist/shell/components/ConfigPanel.js +8 -0
- package/dist/shell/components/CtrlOToExpand.d.ts +30 -0
- package/dist/shell/components/CtrlOToExpand.d.ts.map +1 -0
- package/dist/shell/components/CtrlOToExpand.js +16 -0
- package/dist/shell/components/HelpPanel.d.ts +19 -0
- package/dist/shell/components/HelpPanel.d.ts.map +1 -0
- package/dist/shell/components/HelpPanel.js +8 -0
- package/dist/shell/components/HistorySearchPanel.d.ts +14 -0
- package/dist/shell/components/HistorySearchPanel.d.ts.map +1 -0
- package/dist/shell/components/HistorySearchPanel.js +104 -0
- package/dist/shell/components/MessageMarkdown.d.ts +34 -0
- package/dist/shell/components/MessageMarkdown.d.ts.map +1 -0
- package/dist/shell/components/MessageMarkdown.js +18 -0
- package/dist/shell/components/MessageResponse.d.ts +14 -0
- package/dist/shell/components/MessageResponse.d.ts.map +1 -0
- package/dist/shell/components/MessageResponse.js +6 -0
- package/dist/shell/components/MouseInputRouter.d.ts +28 -0
- package/dist/shell/components/MouseInputRouter.d.ts.map +1 -0
- package/dist/shell/components/MouseInputRouter.js +84 -0
- package/dist/shell/components/NotificationStack.d.ts +19 -0
- package/dist/shell/components/NotificationStack.d.ts.map +1 -0
- package/dist/shell/components/NotificationStack.js +6 -0
- package/dist/shell/components/OutputLine.d.ts +19 -0
- package/dist/shell/components/OutputLine.d.ts.map +1 -0
- package/dist/shell/components/OutputLine.js +38 -0
- package/dist/shell/components/ProductBlock.d.ts +10 -0
- package/dist/shell/components/ProductBlock.d.ts.map +1 -0
- package/dist/shell/components/ProductBlock.js +12 -0
- package/dist/shell/components/ScrollViewport.d.ts +43 -0
- package/dist/shell/components/ScrollViewport.d.ts.map +1 -0
- package/dist/shell/components/ScrollViewport.js +86 -0
- package/dist/shell/components/SessionsPanel.d.ts +24 -0
- package/dist/shell/components/SessionsPanel.d.ts.map +1 -0
- package/dist/shell/components/SessionsPanel.js +8 -0
- package/dist/shell/components/ShellApp.d.ts +8 -0
- package/dist/shell/components/ShellApp.d.ts.map +1 -0
- package/dist/shell/components/ShellApp.js +45 -0
- package/dist/shell/components/ShortcutPanel.d.ts +14 -0
- package/dist/shell/components/ShortcutPanel.d.ts.map +1 -0
- package/dist/shell/components/ShortcutPanel.js +59 -0
- package/dist/shell/components/SlashSuggestions.d.ts +24 -0
- package/dist/shell/components/SlashSuggestions.d.ts.map +1 -0
- package/dist/shell/components/SlashSuggestions.js +7 -0
- package/dist/shell/components/StatusFooter.d.ts +30 -0
- package/dist/shell/components/StatusFooter.d.ts.map +1 -0
- package/dist/shell/components/StatusFooter.js +7 -0
- package/dist/shell/components/StatusTray.d.ts +9 -0
- package/dist/shell/components/StatusTray.d.ts.map +1 -0
- package/dist/shell/components/StatusTray.js +6 -0
- package/dist/shell/components/StructuredDiff.d.ts +9 -0
- package/dist/shell/components/StructuredDiff.d.ts.map +1 -0
- package/dist/shell/components/StructuredDiff.js +7 -0
- package/dist/shell/components/TaskListView.d.ts +9 -0
- package/dist/shell/components/TaskListView.d.ts.map +1 -0
- package/dist/shell/components/TaskListView.js +9 -0
- package/dist/shell/components/TaskSuggestionBar.d.ts +15 -0
- package/dist/shell/components/TaskSuggestionBar.d.ts.map +1 -0
- package/dist/shell/components/TaskSuggestionBar.js +8 -0
- package/dist/shell/components/UnseenMessagePill.d.ts +12 -0
- package/dist/shell/components/UnseenMessagePill.d.ts.map +1 -0
- package/dist/shell/components/UnseenMessagePill.js +6 -0
- package/dist/shell/components/WorkflowProgressView.d.ts +9 -0
- package/dist/shell/components/WorkflowProgressView.d.ts.map +1 -0
- package/dist/shell/components/WorkflowProgressView.js +9 -0
- package/dist/shell/components/useAnchoredCursor.d.ts +32 -0
- package/dist/shell/components/useAnchoredCursor.d.ts.map +1 -0
- package/dist/shell/components/useAnchoredCursor.js +6 -0
- package/dist/shell/hooks/useRenderThrottle.d.ts +2 -0
- package/dist/shell/hooks/useRenderThrottle.d.ts.map +1 -0
- package/dist/shell/hooks/useRenderThrottle.js +35 -0
- package/dist/shell/hooks/useScrollBatcher.d.ts +10 -0
- package/dist/shell/hooks/useScrollBatcher.d.ts.map +1 -0
- package/dist/shell/hooks/useScrollBatcher.js +23 -0
- package/dist/shell/hooks/useScrollRuntime.d.ts +2 -0
- package/dist/shell/hooks/useScrollRuntime.d.ts.map +1 -0
- package/dist/shell/hooks/useScrollRuntime.js +6 -0
- package/dist/shell/hyperlink-utils.d.ts +18 -0
- package/dist/shell/hyperlink-utils.d.ts.map +1 -0
- package/dist/shell/hyperlink-utils.js +8 -0
- package/dist/shell/ink-renderer.d.ts +18 -0
- package/dist/shell/ink-renderer.d.ts.map +1 -0
- package/dist/shell/ink-renderer.js +54 -0
- package/dist/shell/models/command-transcript-presenter.d.ts +73 -0
- package/dist/shell/models/command-transcript-presenter.d.ts.map +1 -0
- package/dist/shell/models/command-transcript-presenter.js +26 -0
- package/dist/shell/models/help-panel.d.ts +37 -0
- package/dist/shell/models/help-panel.d.ts.map +1 -0
- package/dist/shell/models/help-panel.js +10 -0
- package/dist/shell/models/permission-elevation.d.ts +65 -0
- package/dist/shell/models/permission-elevation.d.ts.map +1 -0
- package/dist/shell/models/permission-elevation.js +10 -0
- package/dist/shell/models/permission-explanation.d.ts +45 -0
- package/dist/shell/models/permission-explanation.d.ts.map +1 -0
- package/dist/shell/models/permission-explanation.js +14 -0
- package/dist/shell/models/session-panel.d.ts +22 -0
- package/dist/shell/models/session-panel.d.ts.map +1 -0
- package/dist/shell/models/session-panel.js +18 -0
- package/dist/shell/models/task-scroll-state.d.ts +24 -0
- package/dist/shell/models/task-scroll-state.d.ts.map +1 -0
- package/dist/shell/models/task-scroll-state.js +26 -0
- package/dist/shell/models/terminal-input-runtime.d.ts +37 -0
- package/dist/shell/models/terminal-input-runtime.d.ts.map +1 -0
- package/dist/shell/models/terminal-input-runtime.js +18 -0
- package/dist/shell/models/transcript-scroll-state.d.ts +57 -0
- package/dist/shell/models/transcript-scroll-state.d.ts.map +1 -0
- package/dist/shell/models/transcript-scroll-state.js +12 -0
- package/dist/shell/models/transcript-selection-state.d.ts +39 -0
- package/dist/shell/models/transcript-selection-state.d.ts.map +1 -0
- package/dist/shell/models/transcript-selection-state.js +25 -0
- package/dist/shell/models/wheel-acceleration.d.ts +52 -0
- package/dist/shell/models/wheel-acceleration.d.ts.map +1 -0
- package/dist/shell/models/wheel-acceleration.js +6 -0
- package/dist/shell/output-utils.d.ts +22 -0
- package/dist/shell/output-utils.d.ts.map +1 -0
- package/dist/shell/output-utils.js +12 -0
- package/dist/shell/plain-renderer.d.ts +12 -0
- package/dist/shell/plain-renderer.d.ts.map +1 -0
- package/dist/shell/plain-renderer.js +13 -0
- package/dist/shell/progress-views.d.ts +10 -0
- package/dist/shell/progress-views.d.ts.map +1 -0
- package/dist/shell/progress-views.js +17 -0
- package/dist/shell/stdout-flush-barrier.d.ts +39 -0
- package/dist/shell/stdout-flush-barrier.d.ts.map +1 -0
- package/dist/shell/stdout-flush-barrier.js +10 -0
- package/dist/shell/terminal-capability.d.ts +54 -0
- package/dist/shell/terminal-capability.d.ts.map +1 -0
- package/dist/shell/terminal-capability.js +10 -0
- package/dist/shell/terminal-interaction-runtime.d.ts +11 -0
- package/dist/shell/terminal-interaction-runtime.d.ts.map +1 -0
- package/dist/shell/terminal-interaction-runtime.js +38 -0
- package/dist/shell/terminal-state-recovery.d.ts +52 -0
- package/dist/shell/terminal-state-recovery.d.ts.map +1 -0
- package/dist/shell/terminal-state-recovery.js +11 -0
- package/dist/shell/text-utils.d.ts +40 -0
- package/dist/shell/text-utils.d.ts.map +1 -0
- package/dist/shell/text-utils.js +26 -0
- package/dist/shell/theme.d.ts +41 -0
- package/dist/shell/theme.d.ts.map +1 -0
- package/dist/shell/theme.js +8 -0
- package/dist/shell/types.d.ts +784 -0
- package/dist/shell/types.d.ts.map +1 -0
- package/dist/shell/types.js +0 -0
- package/dist/shell/view-model.d.ts +82 -0
- package/dist/shell/view-model.d.ts.map +1 -0
- package/dist/shell/view-model.js +48 -0
- package/dist/slash-command-runtime.d.ts +64 -0
- package/dist/slash-command-runtime.d.ts.map +1 -0
- package/dist/slash-command-runtime.js +186 -0
- package/dist/slash-dispatch.d.ts +48 -0
- package/dist/slash-dispatch.d.ts.map +1 -0
- package/dist/slash-dispatch.js +53 -0
- package/dist/startup-runtime.d.ts +48 -0
- package/dist/startup-runtime.d.ts.map +1 -0
- package/dist/startup-runtime.js +43 -0
- package/dist/terminal-readiness-presenter.d.ts +131 -0
- package/dist/terminal-readiness-presenter.d.ts.map +1 -0
- package/dist/terminal-readiness-presenter.js +16 -0
- package/dist/terminal-readiness-runtime.d.ts +5 -0
- package/dist/terminal-readiness-runtime.d.ts.map +1 -0
- package/dist/terminal-readiness-runtime.js +15 -0
- package/dist/terminal-setup-runtime.d.ts +34 -0
- package/dist/terminal-setup-runtime.d.ts.map +1 -0
- package/dist/terminal-setup-runtime.js +257 -0
- package/dist/tool-output-presenter.d.ts +38 -0
- package/dist/tool-output-presenter.d.ts.map +1 -0
- package/dist/tool-output-presenter.js +16 -0
- package/dist/tool-result-budget.d.ts +42 -0
- package/dist/tool-result-budget.d.ts.map +1 -0
- package/dist/tool-result-budget.js +11 -0
- package/dist/tui-agent-job-runtime.d.ts +38 -0
- package/dist/tui-agent-job-runtime.d.ts.map +1 -0
- package/dist/tui-agent-job-runtime.js +86 -0
- package/dist/tui-context-runtime.d.ts +426 -0
- package/dist/tui-context-runtime.d.ts.map +1 -0
- package/dist/tui-context-runtime.js +65 -0
- package/dist/tui-data-types.d.ts +923 -0
- package/dist/tui-data-types.d.ts.map +1 -0
- package/dist/tui-data-types.js +0 -0
- package/dist/tui-details-runtime.d.ts +25 -0
- package/dist/tui-details-runtime.d.ts.map +1 -0
- package/dist/tui-details-runtime.js +29 -0
- package/dist/tui-memory-runtime.d.ts +33 -0
- package/dist/tui-memory-runtime.d.ts.map +1 -0
- package/dist/tui-memory-runtime.js +58 -0
- package/dist/tui-messages.d.ts +4 -0
- package/dist/tui-messages.d.ts.map +1 -0
- package/dist/tui-messages.js +6 -0
- package/dist/tui-model-runtime.d.ts +30 -0
- package/dist/tui-model-runtime.d.ts.map +1 -0
- package/dist/tui-model-runtime.js +39 -0
- package/dist/tui-output-surface.d.ts +141 -0
- package/dist/tui-output-surface.d.ts.map +1 -0
- package/dist/tui-output-surface.js +55 -0
- package/dist/tui-permission-runtime.d.ts +62 -0
- package/dist/tui-permission-runtime.d.ts.map +1 -0
- package/dist/tui-permission-runtime.js +24 -0
- package/dist/tui-state-runtime.d.ts +21 -0
- package/dist/tui-state-runtime.d.ts.map +1 -0
- package/dist/tui-state-runtime.js +47 -0
- package/dist/turn-continuity-runtime.d.ts +30 -0
- package/dist/turn-continuity-runtime.d.ts.map +1 -0
- package/dist/turn-continuity-runtime.js +8 -0
- package/dist/undo-ring.d.ts +16 -0
- package/dist/undo-ring.d.ts.map +1 -0
- package/dist/undo-ring.js +12 -0
- package/dist/usage-stats-presenter.d.ts +17 -0
- package/dist/usage-stats-presenter.d.ts.map +1 -0
- package/dist/usage-stats-presenter.js +22 -0
- package/dist/user-state-signal-runtime.d.ts +33 -0
- package/dist/user-state-signal-runtime.d.ts.map +1 -0
- package/dist/user-state-signal-runtime.js +8 -0
- package/dist/verification-command-runtime.d.ts +25 -0
- package/dist/verification-command-runtime.d.ts.map +1 -0
- package/dist/verification-command-runtime.js +51 -0
- package/dist/verification-level.d.ts +93 -0
- package/dist/verification-level.d.ts.map +1 -0
- package/dist/verification-level.js +18 -0
- package/dist/workflow-agent-runtime-bridge.d.ts +169 -0
- package/dist/workflow-agent-runtime-bridge.d.ts.map +1 -0
- package/dist/workflow-agent-runtime-bridge.js +9 -0
- package/dist/workflow-command-runtime.d.ts +94 -0
- package/dist/workflow-command-runtime.d.ts.map +1 -0
- package/dist/workflow-command-runtime.js +114 -0
- package/dist/workflow-plan-schema.d.ts +161 -0
- package/dist/workflow-plan-schema.d.ts.map +1 -0
- package/dist/workflow-plan-schema.js +12 -0
- package/dist/workflow-planner-entry.d.ts +52 -0
- package/dist/workflow-planner-entry.d.ts.map +1 -0
- package/dist/workflow-planner-entry.js +328 -0
- package/dist/workflow-task-surface.d.ts +39 -0
- package/dist/workflow-task-surface.d.ts.map +1 -0
- package/dist/workflow-task-surface.js +7 -0
- package/dist/workspace-reference-cache.d.ts +110 -0
- package/dist/workspace-reference-cache.d.ts.map +1 -0
- package/dist/workspace-reference-cache.js +12 -0
- package/package.json +41 -0
|
@@ -0,0 +1,586 @@
|
|
|
1
|
+
import {
|
|
2
|
+
applyMemoryExtractionDecision,
|
|
3
|
+
decideMemoryExtraction,
|
|
4
|
+
refreshAutoMemoryFiles,
|
|
5
|
+
writeAutoMemoryFiles
|
|
6
|
+
} from "./chunk-VTQL23UM.js";
|
|
7
|
+
import {
|
|
8
|
+
showCommandPanel
|
|
9
|
+
} from "./chunk-JO5ANTMR.js";
|
|
10
|
+
import {
|
|
11
|
+
writeErrorLine
|
|
12
|
+
} from "./chunk-ECFLCY5V.js";
|
|
13
|
+
import {
|
|
14
|
+
createHandoffPacket,
|
|
15
|
+
formatResumePacket,
|
|
16
|
+
hydrateResumeContext,
|
|
17
|
+
validateHandoffPacket
|
|
18
|
+
} from "./chunk-MLUIOBKL.js";
|
|
19
|
+
import {
|
|
20
|
+
createEvidenceBackedMemoryCandidates,
|
|
21
|
+
createLinghunMdTemplate,
|
|
22
|
+
createMemoryCandidate,
|
|
23
|
+
findMemoryRecord,
|
|
24
|
+
formatMemoryLearningRun,
|
|
25
|
+
formatMemoryReview,
|
|
26
|
+
formatMemoryScope,
|
|
27
|
+
formatMemoryStats,
|
|
28
|
+
formatMemoryStatus,
|
|
29
|
+
formatMemoryStorage,
|
|
30
|
+
getMemoryDirectory,
|
|
31
|
+
parseMemoryCandidateArgs,
|
|
32
|
+
removeMemoryFromState,
|
|
33
|
+
removeMemoryRecord,
|
|
34
|
+
writeMemoryLearningMode,
|
|
35
|
+
writeMemoryRecord
|
|
36
|
+
} from "./chunk-LQTVYUT3.js";
|
|
37
|
+
import {
|
|
38
|
+
pathExists,
|
|
39
|
+
summarizeProjectRules
|
|
40
|
+
} from "./chunk-QLRTQHTR.js";
|
|
41
|
+
import {
|
|
42
|
+
formatError,
|
|
43
|
+
writeLine
|
|
44
|
+
} from "./chunk-OMZYPQVA.js";
|
|
45
|
+
|
|
46
|
+
// src/memory-command-runtime.ts
|
|
47
|
+
import { writeFile } from "fs/promises";
|
|
48
|
+
import { basename } from "path";
|
|
49
|
+
import { TOGGLE_DETAILS_KEYBIND } from "@linghun/shared";
|
|
50
|
+
var runtimeDeps;
|
|
51
|
+
function configureMemoryCommandRuntime(deps2) {
|
|
52
|
+
runtimeDeps = deps2;
|
|
53
|
+
}
|
|
54
|
+
function deps() {
|
|
55
|
+
if (!runtimeDeps) {
|
|
56
|
+
throw new Error("memory-command-runtime deps not configured");
|
|
57
|
+
}
|
|
58
|
+
return runtimeDeps;
|
|
59
|
+
}
|
|
60
|
+
function isSessionEnded(transcript) {
|
|
61
|
+
return transcript.at(-1)?.type === "session_end";
|
|
62
|
+
}
|
|
63
|
+
function buildMemoryStatusPanel(context) {
|
|
64
|
+
const isEn = context.language === "en-US";
|
|
65
|
+
const candidates = context.memory.candidates.length;
|
|
66
|
+
const accepted = context.memory.accepted.length;
|
|
67
|
+
const disabled = context.memory.disabled.length;
|
|
68
|
+
const rejected = context.memory.rejected.length;
|
|
69
|
+
const learning = context.memory.learningMode === "active";
|
|
70
|
+
const summary = [
|
|
71
|
+
isEn ? `Memory \xB7 accepted ${accepted} \xB7 candidates ${candidates} \xB7 disabled ${disabled}${rejected > 0 ? ` \xB7 rejected ${rejected}` : ""}` : `\u8BB0\u5FC6 \xB7 \u5DF2\u63A5\u53D7 ${accepted} \xB7 \u5019\u9009 ${candidates} \xB7 \u5DF2\u7981\u7528 ${disabled}${rejected > 0 ? ` \xB7 \u5DF2\u62D2\u7EDD ${rejected}` : ""}`,
|
|
72
|
+
isEn ? `Auto-learning: ${learning ? "on" : "off"}` : `\u81EA\u52A8\u5B66\u4E60\uFF1A${learning ? "\u5DF2\u5F00\u542F" : "\u5DF2\u5173\u95ED"}`
|
|
73
|
+
];
|
|
74
|
+
const actions = [];
|
|
75
|
+
if (candidates > 0) actions.push("/memory review");
|
|
76
|
+
if (!learning) actions.push("/memory learn on");
|
|
77
|
+
actions.push("/memory storage");
|
|
78
|
+
return {
|
|
79
|
+
title: "/memory",
|
|
80
|
+
tone: candidates > 0 ? "warning" : "neutral",
|
|
81
|
+
summary,
|
|
82
|
+
actions,
|
|
83
|
+
detailsText: formatMemoryStatus(context)
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
async function handleMemoryCommand(args, context, output) {
|
|
87
|
+
const action = args[0] ?? "status";
|
|
88
|
+
if (action === "status" || action === "list") {
|
|
89
|
+
showCommandPanel(context, output, buildMemoryStatusPanel(context));
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (action === "storage") {
|
|
93
|
+
showCommandPanel(context, output, {
|
|
94
|
+
title: "/memory storage",
|
|
95
|
+
tone: "neutral",
|
|
96
|
+
summary: [
|
|
97
|
+
context.language === "en-US" ? `Memory storage paths \u2014 ${TOGGLE_DETAILS_KEYBIND} for details.` : `\u8BB0\u5FC6\u5B58\u50A8\u8DEF\u5F84 \u2014 ${TOGGLE_DETAILS_KEYBIND} \u67E5\u770B\u8BE6\u60C5\u3002`
|
|
98
|
+
],
|
|
99
|
+
detailsText: formatMemoryStorage(context)
|
|
100
|
+
});
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (action === "review") {
|
|
104
|
+
showCommandPanel(context, output, {
|
|
105
|
+
title: "/memory review",
|
|
106
|
+
tone: "neutral",
|
|
107
|
+
summary: [
|
|
108
|
+
context.language === "en-US" ? `Memory review \u2014 ${TOGGLE_DETAILS_KEYBIND} for details.` : `\u8BB0\u5FC6\u590D\u6838 \u2014 ${TOGGLE_DETAILS_KEYBIND} \u67E5\u770B\u8BE6\u60C5\u3002`
|
|
109
|
+
],
|
|
110
|
+
detailsText: formatMemoryReview(context)
|
|
111
|
+
});
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (action === "stats") {
|
|
115
|
+
showCommandPanel(context, output, {
|
|
116
|
+
title: "/memory stats",
|
|
117
|
+
tone: "neutral",
|
|
118
|
+
summary: [
|
|
119
|
+
context.language === "en-US" ? `Memory stats \u2014 ${TOGGLE_DETAILS_KEYBIND} for details.` : `\u8BB0\u5FC6\u7EDF\u8BA1 \u2014 ${TOGGLE_DETAILS_KEYBIND} \u67E5\u770B\u8BE6\u60C5\u3002`
|
|
120
|
+
],
|
|
121
|
+
detailsText: formatMemoryStats(context)
|
|
122
|
+
});
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (action === "learn") {
|
|
126
|
+
const subAction = args[1];
|
|
127
|
+
if (subAction === "on") {
|
|
128
|
+
context.memory.learningMode = "active";
|
|
129
|
+
await writeMemoryLearningMode(context);
|
|
130
|
+
const sessionId = await deps().ensureSession(context);
|
|
131
|
+
await deps().appendSystemEvent(context, sessionId, "memory learning mode active", "info");
|
|
132
|
+
writeLine(
|
|
133
|
+
output,
|
|
134
|
+
context.language === "en-US" ? "Auto-learning enabled. Stable taxonomy memory can be accepted automatically; uncertain content stays candidate-only. Disable with /memory learn off." : "\u81EA\u52A8\u5B66\u4E60\u5DF2\u5F00\u542F\u3002\u7A33\u5B9A taxonomy \u8BB0\u5FC6\u53EF\u81EA\u52A8\u63A5\u53D7\uFF1B\u4E0D\u786E\u5B9A\u5185\u5BB9\u4FDD\u7559\u5019\u9009\u3002\u5173\u95ED\uFF1A/memory learn off"
|
|
135
|
+
);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
if (subAction === "off") {
|
|
139
|
+
context.memory.learningMode = "off";
|
|
140
|
+
await writeMemoryLearningMode(context);
|
|
141
|
+
const sessionId = await deps().ensureSession(context);
|
|
142
|
+
await deps().appendSystemEvent(context, sessionId, "memory learning mode off", "info");
|
|
143
|
+
writeLine(
|
|
144
|
+
output,
|
|
145
|
+
context.language === "en-US" ? "Auto-learning disabled. No new candidates will be generated automatically." : "\u81EA\u52A8\u5B66\u4E60\u5DF2\u5173\u95ED\u3002\u4E0D\u518D\u81EA\u52A8\u751F\u6210\u65B0\u5019\u9009\u8BB0\u5FC6\u3002"
|
|
146
|
+
);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
if (subAction === "status") {
|
|
150
|
+
writeLine(
|
|
151
|
+
output,
|
|
152
|
+
context.language === "en-US" ? `Learning mode: ${context.memory.learningMode}; source ${context.memory.learningModeSource ?? "default"}; candidates ${context.memory.candidates.length}; accepted ${context.memory.accepted.length}` : `\u5B66\u4E60\u6A21\u5F0F\uFF1A${context.memory.learningMode === "active" ? "\u5F00\u542F" : "\u5173\u95ED"}\uFF1B\u6765\u6E90 ${context.memory.learningModeSource ?? "default"}\uFF1B\u5019\u9009 ${context.memory.candidates.length}\uFF1B\u5DF2\u63A5\u53D7 ${context.memory.accepted.length}`
|
|
153
|
+
);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const result = await runControlledMemoryLearning(context);
|
|
157
|
+
showCommandPanel(context, output, {
|
|
158
|
+
title: "/memory learn",
|
|
159
|
+
tone: "neutral",
|
|
160
|
+
summary: [
|
|
161
|
+
context.language === "en-US" ? `Memory learn \u2014 ${result.candidatesCreated} candidate(s), ${result.acceptedCreated ?? 0} accepted; ${TOGGLE_DETAILS_KEYBIND} for details.` : `\u8BB0\u5FC6\u5B66\u4E60 \u2014 \u65B0\u5019\u9009 ${result.candidatesCreated} \u6761\uFF0C\u81EA\u52A8\u63A5\u53D7 ${result.acceptedCreated ?? 0} \u6761\uFF1B${TOGGLE_DETAILS_KEYBIND} \u67E5\u770B\u8BE6\u60C5\u3002`
|
|
162
|
+
],
|
|
163
|
+
detailsText: formatMemoryLearningRun(result, context.language)
|
|
164
|
+
});
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (action === "candidate") {
|
|
168
|
+
const parsed = parseMemoryCandidateArgs(args.slice(1));
|
|
169
|
+
if (!parsed.summary) {
|
|
170
|
+
writeLine(
|
|
171
|
+
output,
|
|
172
|
+
"\u7528\u6CD5\uFF1A/memory candidate <\u77ED\u5C0F\u7A33\u5B9A\u8BB0\u5FC6\u6458\u8981> [--scope project|user|session]"
|
|
173
|
+
);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
const candidate = createMemoryCandidate(
|
|
177
|
+
parsed.scope,
|
|
178
|
+
parsed.summary,
|
|
179
|
+
"manual /memory candidate",
|
|
180
|
+
["user:/memory candidate"]
|
|
181
|
+
);
|
|
182
|
+
context.memory.candidates.unshift(candidate);
|
|
183
|
+
await writeMemoryRecord(candidate, context);
|
|
184
|
+
const sessionId = await deps().ensureSession(context);
|
|
185
|
+
await context.store.appendEvent(sessionId, {
|
|
186
|
+
type: "memory_candidate",
|
|
187
|
+
candidate,
|
|
188
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
189
|
+
});
|
|
190
|
+
deps().refreshCacheFreshness(context);
|
|
191
|
+
writeLine(
|
|
192
|
+
output,
|
|
193
|
+
`\u5DF2\u521B\u5EFA\u5019\u9009\u8BB0\u5FC6\uFF1A${candidate.id}\u3002\u5199\u5165\u957F\u671F\u8BB0\u5FC6\u524D\u8BF7\u8FD0\u884C /memory review \u548C /memory accept ${candidate.id}`
|
|
194
|
+
);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
if (action === "accept") {
|
|
198
|
+
const id = args[1];
|
|
199
|
+
const candidate = context.memory.candidates.find((item) => item.id === id);
|
|
200
|
+
if (!candidate) {
|
|
201
|
+
writeLine(output, "\u672A\u627E\u5230\u5019\u9009\u8BB0\u5FC6\u3002\u7528\u6CD5\uFF1A/memory accept <candidate-id>");
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
await executeMemoryMutation(context, output, { action: "accept", candidate });
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
if (action === "reject") {
|
|
208
|
+
const id = args[1];
|
|
209
|
+
const candidate = context.memory.candidates.find((item) => item.id === id);
|
|
210
|
+
if (!candidate) {
|
|
211
|
+
writeLine(output, "\u672A\u627E\u5230\u5019\u9009\u8BB0\u5FC6\u3002\u7528\u6CD5\uFF1A/memory reject <candidate-id>");
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
if (await deps().requestMemoryMutationApproval(context, output, {
|
|
215
|
+
action: "reject",
|
|
216
|
+
candidate
|
|
217
|
+
}) !== "approved") {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
await executeMemoryMutation(context, output, { action: "reject", candidate });
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
if (action === "disable") {
|
|
224
|
+
const id = args[1];
|
|
225
|
+
const memory = context.memory.accepted.find((item) => item.id === id);
|
|
226
|
+
if (!memory) {
|
|
227
|
+
writeLine(output, "\u672A\u627E\u5230\u5DF2\u63A5\u53D7\u8BB0\u5FC6\u3002\u7528\u6CD5\uFF1A/memory disable <accepted-id>");
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
if (await deps().requestMemoryMutationApproval(context, output, {
|
|
231
|
+
action: "disable",
|
|
232
|
+
memory
|
|
233
|
+
}) !== "approved") {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
await executeMemoryMutation(context, output, { action: "disable", memory });
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
if (action === "rollback") {
|
|
240
|
+
const id = args[1];
|
|
241
|
+
const memory = context.memory.disabled.find((item) => item.id === id);
|
|
242
|
+
if (!memory) {
|
|
243
|
+
writeLine(output, "\u672A\u627E\u5230\u5DF2\u7981\u7528\u8BB0\u5FC6\u3002\u7528\u6CD5\uFF1A/memory rollback <disabled-id>");
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
if (await deps().requestMemoryMutationApproval(context, output, {
|
|
247
|
+
action: "rollback",
|
|
248
|
+
memory
|
|
249
|
+
}) !== "approved") {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
await executeMemoryMutation(context, output, { action: "rollback", memory });
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
if (action === "delete" || action === "forget") {
|
|
256
|
+
const id = args[1];
|
|
257
|
+
const memory = findMemoryRecord(context.memory, id);
|
|
258
|
+
if (!memory) {
|
|
259
|
+
writeLine(output, "\u672A\u627E\u5230\u8BE5\u8BB0\u5FC6\u3002\u7528\u6CD5\uFF1A/memory delete <id> \u6216 /memory forget <id>");
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
if (await deps().requestMemoryMutationApproval(context, output, {
|
|
263
|
+
action: "delete",
|
|
264
|
+
memory
|
|
265
|
+
}) !== "approved") {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
await executeMemoryMutation(context, output, { action: "delete", memory });
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
if (action === "init") {
|
|
272
|
+
if (await pathExists(context.memory.projectRulesPath)) {
|
|
273
|
+
await initLinghunMd(context, output);
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
if (await deps().requestMemoryMutationApproval(context, output, { action: "init" }) !== "approved") {
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
await executeMemoryMutation(context, output, { action: "init" });
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
if (action === "import" && args[1] === "sessions") {
|
|
283
|
+
await importAiSessions(args.slice(2), context, output);
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
writeLine(
|
|
287
|
+
output,
|
|
288
|
+
"\u7528\u6CD5\uFF1A/memory | /memory storage | /memory review | /memory stats | /memory learn [on|off|status] | /memory candidate <\u6458\u8981> [--scope project|user|session] | /memory accept|reject|disable|rollback|delete|forget <id> | /memory init | /memory import sessions [source] [query]"
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
async function resumeSessionWithHandoff(sessionId, context, output, source) {
|
|
292
|
+
try {
|
|
293
|
+
const resumed = await context.store.resume(sessionId);
|
|
294
|
+
context.sessionId = resumed.session.id;
|
|
295
|
+
context.sessionEnded = isSessionEnded(resumed.transcript);
|
|
296
|
+
context.model = resumed.session.model;
|
|
297
|
+
hydrateResumeContext(context, resumed.transcript);
|
|
298
|
+
deps().refreshCacheFreshness(context);
|
|
299
|
+
const packet = context.memory.lastHandoff ?? createHandoffPacket(context, resumed.transcript);
|
|
300
|
+
const missing = validateHandoffPacket(packet);
|
|
301
|
+
context.memory.lastResumeReadonly = missing.length > 0;
|
|
302
|
+
writeLine(output, `\u5DF2\u6062\u590D\u4F1A\u8BDD\uFF1A${resumed.session.id}`);
|
|
303
|
+
writeLine(output, `\u6062\u590D\u65B9\u5F0F\uFF1A${source}\uFF1B\u4E0D\u4F1A\u628A\u5B8C\u6574 transcript \u585E\u56DE\u4E0A\u4E0B\u6587\u3002`);
|
|
304
|
+
writeLine(output, formatResumePacket(packet, missing, context));
|
|
305
|
+
if (context.index.status === "stale" || context.index.status === "missing") {
|
|
306
|
+
writeLine(
|
|
307
|
+
output,
|
|
308
|
+
"\u7D22\u5F15\u4E0D\u662F ready\uFF1A\u5EFA\u8BAE\u5148\u8FD0\u884C /index status \u6216 /index refresh\uFF1B\u4E0D\u4F1A\u81EA\u52A8\u5237\u65B0\u3002 "
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
deps().writeStatus(output, context);
|
|
312
|
+
} catch (error) {
|
|
313
|
+
writeErrorLine(output, formatError(error));
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
async function appendMemoryLifecycleEvent(context, sessionId, action, memory) {
|
|
317
|
+
await deps().appendSystemEvent(
|
|
318
|
+
context,
|
|
319
|
+
sessionId,
|
|
320
|
+
`memory_lifecycle action=${action} id=${memory.id} scope=${memory.scope} status=${memory.status} source=${memory.source}`,
|
|
321
|
+
action === "deleted" ? "warning" : "info"
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
async function executeMemoryMutation(context, output, mutation) {
|
|
325
|
+
if (mutation.action === "accept") {
|
|
326
|
+
const accepted = { ...mutation.candidate, status: "accepted" };
|
|
327
|
+
await writeMemoryRecord(accepted, context);
|
|
328
|
+
if (accepted.taxonomy && accepted.scope !== "session") {
|
|
329
|
+
await writeAutoMemoryFiles(getMemoryDirectory(accepted.scope, context), accepted);
|
|
330
|
+
}
|
|
331
|
+
context.memory.candidates = context.memory.candidates.filter((item) => item.id !== accepted.id);
|
|
332
|
+
context.memory.accepted.unshift(accepted);
|
|
333
|
+
const sessionId = await deps().ensureSession(context);
|
|
334
|
+
await context.store.appendEvent(sessionId, {
|
|
335
|
+
type: "memory_accepted",
|
|
336
|
+
memory: accepted,
|
|
337
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
338
|
+
});
|
|
339
|
+
await appendMemoryLifecycleEvent(context, sessionId, "accepted", accepted);
|
|
340
|
+
await deps().recordMemoryMutationEvidence(context, sessionId, "accepted", accepted);
|
|
341
|
+
deps().refreshCacheFreshness(context);
|
|
342
|
+
writeLine(
|
|
343
|
+
output,
|
|
344
|
+
`\u5DF2\u5199\u5165${formatMemoryScope(accepted.scope)}\u7EA7\u957F\u671F\u8BB0\u5FC6\uFF1A${accepted.id}\uFF1B\u540E\u7EED\u6CE8\u5165\u4ECD\u53D7 accepted-only top-k/\u5B57\u7B26\u9884\u7B97\u9650\u5236\u3002`
|
|
345
|
+
);
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
if (mutation.action === "reject") {
|
|
349
|
+
const rejected = { ...mutation.candidate, status: "rejected" };
|
|
350
|
+
await writeMemoryRecord(rejected, context);
|
|
351
|
+
context.memory.candidates = context.memory.candidates.filter((item) => item.id !== rejected.id);
|
|
352
|
+
context.memory.rejected.unshift(rejected);
|
|
353
|
+
const sessionId = await deps().ensureSession(context);
|
|
354
|
+
await appendMemoryLifecycleEvent(context, sessionId, "rejected", rejected);
|
|
355
|
+
await deps().recordMemoryMutationEvidence(context, sessionId, "rejected", rejected);
|
|
356
|
+
deps().refreshCacheFreshness(context);
|
|
357
|
+
writeLine(output, `\u5DF2\u62D2\u7EDD\u5019\u9009\u8BB0\u5FC6\uFF1A${rejected.id}\uFF1B\u4E0D\u4F1A\u5199\u5165\u957F\u671F\u8BB0\u5FC6\u6216\u6CE8\u5165 prompt\u3002`);
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
if (mutation.action === "disable") {
|
|
361
|
+
const disabled = { ...mutation.memory, status: "disabled" };
|
|
362
|
+
await writeMemoryRecord(disabled, context);
|
|
363
|
+
context.memory.accepted = context.memory.accepted.filter((item) => item.id !== disabled.id);
|
|
364
|
+
context.memory.disabled.unshift(disabled);
|
|
365
|
+
if (disabled.taxonomy && disabled.scope !== "session") {
|
|
366
|
+
await refreshAutoMemoryFiles(
|
|
367
|
+
getMemoryDirectory(disabled.scope, context),
|
|
368
|
+
context.memory.accepted.filter((item) => item.scope === disabled.scope),
|
|
369
|
+
context.memory.disabled.filter((item) => item.scope === disabled.scope)
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
const sessionId = await deps().ensureSession(context);
|
|
373
|
+
await appendMemoryLifecycleEvent(context, sessionId, "disabled", disabled);
|
|
374
|
+
await deps().recordMemoryMutationEvidence(context, sessionId, "disabled", disabled);
|
|
375
|
+
deps().refreshCacheFreshness(context);
|
|
376
|
+
writeLine(output, `\u5DF2\u7981\u7528\u957F\u671F\u8BB0\u5FC6\uFF1A${disabled.id}\uFF1B\u4FDD\u7559\u8BB0\u5F55\u4F46\u4E0D\u518D\u6CE8\u5165 prompt\u3002`);
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
if (mutation.action === "rollback") {
|
|
380
|
+
const accepted = { ...mutation.memory, status: "accepted" };
|
|
381
|
+
await writeMemoryRecord(accepted, context);
|
|
382
|
+
context.memory.disabled = context.memory.disabled.filter((item) => item.id !== accepted.id);
|
|
383
|
+
context.memory.accepted.unshift(accepted);
|
|
384
|
+
if (accepted.taxonomy && accepted.scope !== "session") {
|
|
385
|
+
await refreshAutoMemoryFiles(
|
|
386
|
+
getMemoryDirectory(accepted.scope, context),
|
|
387
|
+
context.memory.accepted.filter((item) => item.scope === accepted.scope),
|
|
388
|
+
context.memory.disabled.filter((item) => item.scope === accepted.scope)
|
|
389
|
+
);
|
|
390
|
+
}
|
|
391
|
+
const sessionId = await deps().ensureSession(context);
|
|
392
|
+
await appendMemoryLifecycleEvent(context, sessionId, "rollback", accepted);
|
|
393
|
+
await deps().recordMemoryMutationEvidence(context, sessionId, "rollback", accepted);
|
|
394
|
+
deps().refreshCacheFreshness(context);
|
|
395
|
+
writeLine(output, `\u5DF2\u56DE\u6EDA\u542F\u7528\u957F\u671F\u8BB0\u5FC6\uFF1A${accepted.id}\uFF1B\u4ECD\u53D7\u53D7\u63A7 prompt \u6CE8\u5165\u9884\u7B97\u9650\u5236\u3002`);
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
if (mutation.action === "delete") {
|
|
399
|
+
await removeMemoryRecord(mutation.memory, context);
|
|
400
|
+
removeMemoryFromState(context.memory, mutation.memory.id);
|
|
401
|
+
if (mutation.memory.taxonomy && mutation.memory.scope !== "session") {
|
|
402
|
+
await refreshAutoMemoryFiles(
|
|
403
|
+
getMemoryDirectory(mutation.memory.scope, context),
|
|
404
|
+
context.memory.accepted.filter((item) => item.scope === mutation.memory.scope),
|
|
405
|
+
context.memory.disabled.filter((item) => item.scope === mutation.memory.scope)
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
const sessionId = await deps().ensureSession(context);
|
|
409
|
+
await appendMemoryLifecycleEvent(context, sessionId, "deleted", mutation.memory);
|
|
410
|
+
await deps().recordMemoryMutationEvidence(context, sessionId, "deleted", mutation.memory);
|
|
411
|
+
deps().refreshCacheFreshness(context);
|
|
412
|
+
writeLine(output, `\u5DF2\u5220\u9664\u8BB0\u5FC6\u8BB0\u5F55\uFF1A${mutation.memory.id}\uFF1B\u4E0D\u4F1A\u4FDD\u7559\u5728\u5019\u9009/\u957F\u671F/\u7981\u7528\u5217\u8868\u3002`);
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
if (mutation.action === "init") {
|
|
416
|
+
const created = await initLinghunMd(context, output);
|
|
417
|
+
if (!created) {
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
const sessionId = await deps().ensureSession(context);
|
|
421
|
+
await deps().appendSystemEvent(
|
|
422
|
+
context,
|
|
423
|
+
sessionId,
|
|
424
|
+
"memory_lifecycle action=init path=LINGHUN.md",
|
|
425
|
+
"info"
|
|
426
|
+
);
|
|
427
|
+
await deps().recordMemoryMutationEvidence(
|
|
428
|
+
context,
|
|
429
|
+
sessionId,
|
|
430
|
+
"init",
|
|
431
|
+
createMemoryCandidate("project", "generated LINGHUN.md", "memory init", ["LINGHUN.md"])
|
|
432
|
+
);
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
const unknown = mutation;
|
|
436
|
+
throw new Error(
|
|
437
|
+
`\u672A\u77E5 memory mutation action\uFF1A${String(unknown.action)}`
|
|
438
|
+
);
|
|
439
|
+
}
|
|
440
|
+
async function runControlledMemoryLearning(context) {
|
|
441
|
+
const candidates = createEvidenceBackedMemoryCandidates(context).slice(0, 3);
|
|
442
|
+
context.memory.candidates.unshift(...candidates);
|
|
443
|
+
const sessionId = await deps().ensureSession(context);
|
|
444
|
+
for (const candidate of candidates) {
|
|
445
|
+
await writeMemoryRecord(candidate, context);
|
|
446
|
+
await context.store.appendEvent(sessionId, {
|
|
447
|
+
type: "memory_candidate",
|
|
448
|
+
candidate,
|
|
449
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
const run = {
|
|
453
|
+
trigger: "manual",
|
|
454
|
+
candidatesCreated: candidates.length,
|
|
455
|
+
modelCalled: false,
|
|
456
|
+
...candidates.length === 0 ? { skippedReason: "no bounded evidence/todo/verification/handoff source" } : {},
|
|
457
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
458
|
+
};
|
|
459
|
+
context.memory.lastLearningRun = run;
|
|
460
|
+
await deps().appendSystemEvent(
|
|
461
|
+
context,
|
|
462
|
+
sessionId,
|
|
463
|
+
`memory_learning trigger=${run.trigger} candidates=${run.candidatesCreated} modelCalled=no skipped=${run.skippedReason ?? "none"}`,
|
|
464
|
+
candidates.length === 0 ? "warning" : "info"
|
|
465
|
+
);
|
|
466
|
+
deps().refreshCacheFreshness(context);
|
|
467
|
+
return run;
|
|
468
|
+
}
|
|
469
|
+
async function runAutoLearningOnTurnEnd(context, userInput) {
|
|
470
|
+
if (context.memory.learningMode !== "active") {
|
|
471
|
+
return {
|
|
472
|
+
trigger: "manual",
|
|
473
|
+
candidatesCreated: 0,
|
|
474
|
+
modelCalled: false,
|
|
475
|
+
skippedReason: "learning_mode=off",
|
|
476
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
const decision = decideMemoryExtraction({
|
|
480
|
+
recentMessages: [userInput],
|
|
481
|
+
accepted: context.memory.accepted,
|
|
482
|
+
disabled: context.memory.disabled,
|
|
483
|
+
candidates: context.memory.candidates
|
|
484
|
+
});
|
|
485
|
+
if (decision.action === "create" || decision.action === "update") {
|
|
486
|
+
const existing = context.memory.accepted.find((item) => item.id === decision.id);
|
|
487
|
+
const applied = await applyMemoryExtractionDecision({
|
|
488
|
+
decision,
|
|
489
|
+
memoryDir: getMemoryDirectory(decision.scope, context),
|
|
490
|
+
existing
|
|
491
|
+
});
|
|
492
|
+
if (!applied.memory) {
|
|
493
|
+
throw new Error("memory extraction returned no accepted memory");
|
|
494
|
+
}
|
|
495
|
+
await writeMemoryRecord(applied.memory, context);
|
|
496
|
+
context.memory.accepted = [
|
|
497
|
+
applied.memory,
|
|
498
|
+
...context.memory.accepted.filter((item) => item.id !== applied.memory?.id)
|
|
499
|
+
];
|
|
500
|
+
const sessionId = await deps().ensureSession(context);
|
|
501
|
+
await context.store.appendEvent(sessionId, {
|
|
502
|
+
type: "memory_accepted",
|
|
503
|
+
memory: applied.memory,
|
|
504
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
505
|
+
});
|
|
506
|
+
await appendMemoryLifecycleEvent(context, sessionId, `auto_${decision.action}`, applied.memory);
|
|
507
|
+
await deps().recordMemoryMutationEvidence(
|
|
508
|
+
context,
|
|
509
|
+
sessionId,
|
|
510
|
+
`auto_${decision.action}`,
|
|
511
|
+
applied.memory
|
|
512
|
+
);
|
|
513
|
+
const run = {
|
|
514
|
+
trigger: "evidence",
|
|
515
|
+
candidatesCreated: 0,
|
|
516
|
+
acceptedCreated: decision.action === "create" ? 1 : 0,
|
|
517
|
+
acceptedUpdated: decision.action === "update" ? 1 : 0,
|
|
518
|
+
modelCalled: false,
|
|
519
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
520
|
+
};
|
|
521
|
+
context.memory.lastLearningRun = run;
|
|
522
|
+
await deps().appendSystemEvent(
|
|
523
|
+
context,
|
|
524
|
+
sessionId,
|
|
525
|
+
`auto_memory_extraction action=${decision.action} taxonomy=${decision.taxonomy} topic=${decision.topic}`,
|
|
526
|
+
"info"
|
|
527
|
+
);
|
|
528
|
+
deps().refreshCacheFreshness(context);
|
|
529
|
+
return run;
|
|
530
|
+
}
|
|
531
|
+
return {
|
|
532
|
+
trigger: "manual",
|
|
533
|
+
candidatesCreated: 0,
|
|
534
|
+
modelCalled: false,
|
|
535
|
+
skippedReason: decision.action === "no-op" ? `memory_extraction:${decision.reason}${decision.blockedBy ? `:${decision.blockedBy}` : ""}` : "no_learnable_content",
|
|
536
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
async function initLinghunMd(context, output) {
|
|
540
|
+
if (await pathExists(context.memory.projectRulesPath)) {
|
|
541
|
+
context.memory.projectRulesExists = true;
|
|
542
|
+
writeLine(output, `LINGHUN.md \u5DF2\u5B58\u5728\uFF1A${context.memory.projectRulesPath}`);
|
|
543
|
+
return false;
|
|
544
|
+
}
|
|
545
|
+
const content = createLinghunMdTemplate(context.language);
|
|
546
|
+
await writeFile(context.memory.projectRulesPath, content, "utf8");
|
|
547
|
+
context.memory.projectRulesExists = true;
|
|
548
|
+
context.memory.projectRulesSummary = summarizeProjectRules(content);
|
|
549
|
+
context.memory.projectRulesError = void 0;
|
|
550
|
+
deps().refreshCacheFreshness(context);
|
|
551
|
+
writeLine(output, `\u5DF2\u751F\u6210\u57FA\u7840 LINGHUN.md\uFF1A${context.memory.projectRulesPath}`);
|
|
552
|
+
return true;
|
|
553
|
+
}
|
|
554
|
+
async function importAiSessions(args, context, output) {
|
|
555
|
+
const source = args[0] ?? "auto";
|
|
556
|
+
const query = args.slice(1).join(" ").trim() || basename(context.projectPath);
|
|
557
|
+
const summary = `AI sessions import requested: source=${source}, query=${query}. \u5F53\u524D Linghun \u6700\u5C0F\u5165\u53E3\u53EA\u8BB0\u5F55\u6458\u8981\u548C\u8BC1\u636E\u5F15\u7528\uFF0C\u4E0D\u8BFB\u53D6\u6216\u4FDD\u5B58\u654F\u611F\u804A\u5929\u539F\u6587\uFF1B\u5982 MCP bridge \u4E0D\u53EF\u7528\uFF0C\u8BF7\u5148\u914D\u7F6E ai-sessions\u3002`;
|
|
558
|
+
const sessionId = await deps().ensureSession(context);
|
|
559
|
+
await context.store.appendEvent(sessionId, {
|
|
560
|
+
type: "session_import",
|
|
561
|
+
source,
|
|
562
|
+
summary,
|
|
563
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
564
|
+
});
|
|
565
|
+
const candidate = createMemoryCandidate(
|
|
566
|
+
"project",
|
|
567
|
+
`\u5916\u90E8\u4F1A\u8BDD\u5BFC\u5165\u7EBF\u7D22\uFF1A${source} / ${query}`,
|
|
568
|
+
"AI sessions import summary",
|
|
569
|
+
[`ai-sessions:${source}:${query}`]
|
|
570
|
+
);
|
|
571
|
+
context.memory.candidates.unshift(candidate);
|
|
572
|
+
await writeMemoryRecord(candidate, context);
|
|
573
|
+
deps().refreshCacheFreshness(context);
|
|
574
|
+
writeLine(output, summary);
|
|
575
|
+
writeLine(output, `\u5DF2\u521B\u5EFA\u5019\u9009\u8BB0\u5FC6\u7B49\u5F85\u786E\u8BA4\uFF1A${candidate.id}`);
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
export {
|
|
579
|
+
configureMemoryCommandRuntime,
|
|
580
|
+
handleMemoryCommand,
|
|
581
|
+
resumeSessionWithHandoff,
|
|
582
|
+
executeMemoryMutation,
|
|
583
|
+
runAutoLearningOnTurnEnd,
|
|
584
|
+
initLinghunMd,
|
|
585
|
+
importAiSessions
|
|
586
|
+
};
|