chatlab-cli 0.36.2 → 0.37.1
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/dist/{chat-command-SEV6N3AR.mjs → chat-command-YAFRLHMQ.mjs} +15 -16
- package/dist/{chat-command-SEV6N3AR.mjs.map → chat-command-YAFRLHMQ.mjs.map} +1 -1
- package/dist/{chunk-6EZPD3XJ.mjs → chunk-2PY4XCH3.mjs} +6 -3
- package/dist/chunk-2PY4XCH3.mjs.map +1 -0
- package/dist/{chunk-HWIXK7SU.mjs → chunk-73TJ2S7W.mjs} +1643 -3
- package/dist/chunk-73TJ2S7W.mjs.map +1 -0
- package/dist/{chunk-YUH3H3QW.mjs → chunk-ARIBCH47.mjs} +96 -5
- package/dist/chunk-ARIBCH47.mjs.map +1 -0
- package/dist/{chunk-WRBFV2GX.mjs → chunk-FPVRSXQ4.mjs} +49 -55
- package/dist/chunk-FPVRSXQ4.mjs.map +1 -0
- package/dist/{chunk-VREVDZ4Q.mjs → chunk-GKCIRKOH.mjs} +1934 -35
- package/dist/chunk-GKCIRKOH.mjs.map +1 -0
- package/dist/{chunk-TJ3NOBVI.mjs → chunk-JWJREWVN.mjs} +119 -288
- package/dist/chunk-JWJREWVN.mjs.map +1 -0
- package/dist/{chunk-TWH422HC.mjs → chunk-MMTEGUQA.mjs} +3 -3
- package/dist/{chunk-VUYWUHWW.mjs → chunk-N4SB6QZV.mjs} +3 -3
- package/dist/chunk-N4SB6QZV.mjs.map +1 -0
- package/dist/{chunk-TRGR3KKJ.mjs → chunk-OTYNMDDL.mjs} +2643 -682
- package/dist/chunk-OTYNMDDL.mjs.map +1 -0
- package/dist/{chunk-CH5YAZ4Q.mjs → chunk-PDQV4RUA.mjs} +2 -2
- package/dist/{chunk-WJQOXOMR.mjs → chunk-UP6JIV3S.mjs} +285 -41
- package/dist/chunk-UP6JIV3S.mjs.map +1 -0
- package/dist/chunk-WDLO7OLX.mjs +101 -0
- package/dist/chunk-WDLO7OLX.mjs.map +1 -0
- package/dist/cli.mjs +9 -9
- package/dist/contacts-worker.mjs +2 -2
- package/dist/global-insight-worker.mjs +1 -1
- package/dist/{http-237XYNRT.mjs → http-LPFPVTBC.mjs} +12 -12
- package/dist/{import-R2E2TFAK.mjs → import-T4WX2ZJL.mjs} +7 -7
- package/dist/index.mjs +12 -12
- package/dist/{mcp-BED4AARV.mjs → mcp-SMF3NWIN.mjs} +8 -8
- package/dist/people-relationships-worker.mjs +2 -2
- package/dist/semantic-index-worker.mjs +1 -1
- package/dist/{src-AYMALWU5.mjs → src-EGLLMTAU.mjs} +44 -14
- package/dist/{stream-import-RXNSOOYH.mjs → stream-import-2BXJTTCE.mjs} +7 -7
- package/dist/{worker-runtime-JGAZU7MC.mjs → worker-runtime-RDLSPXFT.mjs} +5 -5
- package/dist-cli-web/assets/AISettingsTab-CEhrXlYR.js +1 -0
- package/dist-cli-web/assets/{AboutTab-DCM1-glA.js → AboutTab-Bbu0SsMM.js} +1 -1
- package/dist-cli-web/assets/ActionToolsPanel-DDNXXH8v.css +1 -0
- package/dist-cli-web/assets/ActionToolsPanel.vue_vue_type_script_setup_true_lang-IB1yZxCE.js +75 -0
- package/dist-cli-web/assets/{Alert-D-egBWcb.js → Alert-510jTN3l.js} +1 -1
- package/dist-cli-web/assets/ApiSettingsTab-Bi1GRMN4.js +2 -0
- package/dist-cli-web/assets/BatchManageTab-DhnqMCSM.js +1 -0
- package/dist-cli-web/assets/{BufferResource-BE2_2bZK.js → BufferResource-CKZxnACp.js} +1 -1
- package/dist-cli-web/assets/{CanvasRenderer-DDKdvEYQ.js → CanvasRenderer-BeK5POBy.js} +1 -1
- package/dist-cli-web/assets/CardDecoration-RuBA3N2j.js +1 -0
- package/dist-cli-web/assets/ChatRecordDrawer-BY_-lIEj.js +1 -0
- package/dist-cli-web/assets/{ChatRecordWorkspace-DqUI4QiU.js → ChatRecordWorkspace-7prKd-Tq.js} +1 -1
- package/dist-cli-web/assets/Checkbox-_eH64bb0.js +1 -0
- package/dist-cli-web/assets/DataDirCleanupNotice-BHaXwlfr.js +1 -0
- package/dist-cli-web/assets/{DatePicker.vue_vue_type_script_setup_true_lang-sPDoPzZ9.js → DatePicker.vue_vue_type_script_setup_true_lang-D9Ul_GYz.js} +1 -1
- package/dist-cli-web/assets/{DebugToolsPanel-BIHA6jw4.js → DebugToolsPanel-ByKItGrS.js} +1 -1
- package/dist-cli-web/assets/EChart.vue_vue_type_script_setup_true_lang-DubnuUXI.js +1 -0
- package/dist-cli-web/assets/EChartBar.vue_vue_type_script_setup_true_lang-DKNCZuFm.js +1 -0
- package/dist-cli-web/assets/EChartLine.vue_vue_type_script_setup_true_lang-Fl7xAOSR.js +1 -0
- package/dist-cli-web/assets/EChartWordcloud-C6XM4KOX.js +1 -0
- package/dist-cli-web/assets/FileDropZone.vue_vue_type_script_setup_true_lang-DYDdRSNE.js +1 -0
- package/dist-cli-web/assets/{Filter-kO4dIDJ2.js → Filter-CByj_rCR.js} +1 -1
- package/dist-cli-web/assets/GlobalTaskBar-BdELjzrs.js +1 -0
- package/dist-cli-web/assets/GlobalTaskBar-haLzezqY.css +1 -0
- package/dist-cli-web/assets/GroupRelationshipGalaxyView-CnzPEgUS.js +1 -0
- package/dist-cli-web/assets/Label-DCIcxkhU.js +1 -0
- package/dist-cli-web/assets/LoadingState.vue_vue_type_script_setup_true_lang-BBcCt_Qm.js +1 -0
- package/dist-cli-web/assets/MessageExportModal-DNU16Bs8.js +1 -0
- package/dist-cli-web/assets/PageHeader-CKeZjNNR.js +1 -0
- package/dist-cli-web/assets/PageHeader-CPLgiKT8.css +1 -0
- package/dist-cli-web/assets/{PageTabs.vue_vue_type_script_setup_true_lang-Cgungbjl.js → PageTabs.vue_vue_type_script_setup_true_lang-C8M3wNNH.js} +1 -1
- package/dist-cli-web/assets/{RelationshipGalaxyCanvas-Cod1JX9m.js → RelationshipGalaxyCanvas-CDhljGyJ.js} +3 -3
- package/dist-cli-web/assets/{RelationshipGalaxyThreeCanvas-CkefzeFJ.js → RelationshipGalaxyThreeCanvas-BP8fsvvf.js} +1 -1
- package/dist-cli-web/assets/{RenderTargetSystem-SuQ7cbze.js → RenderTargetSystem-D76QrDT_.js} +1 -1
- package/dist-cli-web/assets/{RovingFocusItem-psoFYxrC.js → RovingFocusItem-BJMUQ5DJ.js} +1 -1
- package/dist-cli-web/assets/{ScreenCaptureModal-D4r9ixKh.js → ScreenCaptureModal-DkX4z-M1.js} +1 -1
- package/dist-cli-web/assets/SectionTabs.vue_vue_type_script_setup_true_lang-qFhJO5B0.js +1 -0
- package/dist-cli-web/assets/Select-B5oJc5y1.js +1 -0
- package/dist-cli-web/assets/SettingsModal-BO-QKQ2h.js +2 -0
- package/dist-cli-web/assets/{StorageTab-DhSJ-0Ir.js → StorageTab-CPPXXaRm.js} +1 -1
- package/dist-cli-web/assets/Switch-CDk3LZ4_.js +1 -0
- package/dist-cli-web/assets/Tabs-BMq9wODW.js +1 -0
- package/dist-cli-web/assets/{Tabs-Bnm_Q7yW.js → Tabs-DqWTBV8x.js} +1 -1
- package/dist-cli-web/assets/ThemeCard.vue_vue_type_script_setup_true_lang-D2outEOV.js +1 -0
- package/dist-cli-web/assets/{TimeSelect.vue_vue_type_script_setup_true_lang-Cjz8Wpg-.js → TimeSelect.vue_vue_type_script_setup_true_lang-BcflxP_U.js} +1 -1
- package/dist-cli-web/assets/{VisuallyHiddenInput-Bo_XwaLu.js → VisuallyHiddenInput-BAFpkxMI.js} +1 -1
- package/dist-cli-web/assets/{WebGLRenderer-D1x9WZRj.js → WebGLRenderer-DjCPvR_O.js} +1 -1
- package/dist-cli-web/assets/{WebGPURenderer-37Nw-tLm.js → WebGPURenderer-C2B_u03z.js} +1 -1
- package/dist-cli-web/assets/aiChat--CR4g2M7.js +8 -0
- package/dist-cli-web/assets/base-F6s0vTrr.js +1 -0
- package/dist-cli-web/assets/{browserAll-CWrz_-4U.js → browserAll-DiUAZg4L.js} +1 -1
- package/dist-cli-web/assets/chatMessages-BGRbSlvD.css +1 -0
- package/dist-cli-web/assets/chatMessages-Bd33SSXI.js +147 -0
- package/dist-cli-web/assets/cli-web-DoibEdj2.js +1 -0
- package/dist-cli-web/assets/{fetch-CkXgOxcu.js → fetch-4nh1LaVF.js} +3 -3
- package/dist-cli-web/assets/fetch-7lUvXbhU.js +1 -0
- package/dist-cli-web/assets/{fetch-CFpLXWTe.js → fetch-BEaW1j5H.js} +1 -1
- package/dist-cli-web/assets/{fetch-CgA1peJD.js → fetch-B_YFABxI.js} +1 -1
- package/dist-cli-web/assets/{fetch-BGmCCyzz.js → fetch-BeX69kpS.js} +1 -1
- package/dist-cli-web/assets/{fetch-Du-wU0OO.js → fetch-CRocA-4C.js} +1 -1
- package/dist-cli-web/assets/{fetch-DPSWt6yX.js → fetch-CXM-cjDS.js} +1 -1
- package/dist-cli-web/assets/{fetch-qd2FgBWQ.js → fetch-CXqeAbnY.js} +1 -1
- package/dist-cli-web/assets/{fetch-6pcVxB9h.js → fetch-CxVcHNid.js} +1 -1
- package/dist-cli-web/assets/fetch-DBpDMy29.js +1 -0
- package/dist-cli-web/assets/{fetch-Gu4qQjUB.js → fetch-DKBBS9Op.js} +1 -1
- package/dist-cli-web/assets/{fetch-DZ6OF-xW.js → fetch-epFXmPIQ.js} +1 -1
- package/dist-cli-web/assets/{host-D8zlA62K.js → host-C4rU8pKA.js} +1 -1
- package/dist-cli-web/assets/{host-CWsAWKgy.js → host-CtSqR_Zm.js} +1 -1
- package/dist-cli-web/assets/{index-Dy0fRMDf.js → index-4DVZ2g0M.js} +10 -10
- package/dist-cli-web/assets/index-B1oj9KDv.js +135 -0
- package/dist-cli-web/assets/index-BFH1j_R9.js +1 -0
- package/dist-cli-web/assets/index-BZpR015e.css +1 -0
- package/dist-cli-web/assets/index-BgelKQTW.css +1 -0
- package/dist-cli-web/assets/{index-v6DlL4ue.js → index-BvMAw3Zd.js} +1 -1
- package/dist-cli-web/assets/index-C1A1FwpO.css +1 -0
- package/dist-cli-web/assets/index-CIIyg_o9.css +1 -0
- package/dist-cli-web/assets/index-CaYtkONV.js +64 -0
- package/dist-cli-web/assets/index-CuCQ1d9f.js +1 -0
- package/dist-cli-web/assets/index-D3Hyjv4e.js +137 -0
- package/dist-cli-web/assets/index-D8cHMqV-.js +2 -0
- package/dist-cli-web/assets/index-DlHuILT_.js +1 -0
- package/dist-cli-web/assets/index-R4LqAnx9.js +2 -0
- package/dist-cli-web/assets/index-_m1mf1jm.js +1 -0
- package/dist-cli-web/assets/{index-a7CT8DQm.js → index-ekvsNmfe.js} +1 -1
- package/dist-cli-web/assets/index-mXe1LssU.js +1 -0
- package/dist-cli-web/assets/index-mbLXPIyC.js +1 -0
- package/dist-cli-web/assets/{people-page-header-Czt9e1jv.js → people-page-header-BbYSSpsO.js} +1 -1
- package/dist-cli-web/assets/{prompt-DGazz143.js → prompt-C-ofJ7t_.js} +1 -1
- package/dist-cli-web/assets/{semantic-index-config-builder-BkFHzIUy.js → semantic-index-config-builder-D3TYVYC-.js} +1 -1
- package/dist-cli-web/assets/service-BYOUkk7V.js +1 -0
- package/dist-cli-web/assets/{service-CAp0YJoS.js → service-CppETV4a.js} +1 -1
- package/dist-cli-web/assets/service-tEx-5LUL.js +1 -0
- package/dist-cli-web/assets/useFormControl-CrWi_6Hn.js +1 -0
- package/dist-cli-web/assets/useTable-Clk7ecq-.js +1 -0
- package/dist-cli-web/assets/{useToast-YAHDkKDN.js → useToast-B5LaA6c-.js} +1 -1
- package/dist-cli-web/assets/{vendor-echarts-hTLhTs52.js → vendor-echarts-C9ugTmum.js} +1 -1
- package/dist-cli-web/assets/{vendor-echarts-wordcloud-B8CF_NgP.js → vendor-echarts-wordcloud-DNiU8Psq.js} +1 -1
- package/dist-cli-web/assets/{webworkerAll-CvSp2Y8j.js → webworkerAll-CyA4b4LT.js} +1 -1
- package/dist-cli-web/index.html +2 -2
- package/package.json +3 -3
- package/dist/chunk-6E46U4H2.mjs +0 -41
- package/dist/chunk-6E46U4H2.mjs.map +0 -1
- package/dist/chunk-6EZPD3XJ.mjs.map +0 -1
- package/dist/chunk-HWIXK7SU.mjs.map +0 -1
- package/dist/chunk-TJ3NOBVI.mjs.map +0 -1
- package/dist/chunk-TRGR3KKJ.mjs.map +0 -1
- package/dist/chunk-VREVDZ4Q.mjs.map +0 -1
- package/dist/chunk-VUYWUHWW.mjs.map +0 -1
- package/dist/chunk-WJQOXOMR.mjs.map +0 -1
- package/dist/chunk-WRBFV2GX.mjs.map +0 -1
- package/dist/chunk-YUH3H3QW.mjs.map +0 -1
- package/dist-cli-web/assets/AISettingsTab-VgI7PiJd.js +0 -1
- package/dist-cli-web/assets/ActionToolsPanel-BTGgwXVD.css +0 -1
- package/dist-cli-web/assets/ActionToolsPanel.vue_vue_type_script_setup_true_lang-a7RMjjve.js +0 -112
- package/dist-cli-web/assets/ApiSettingsTab-Co3LWf1f.js +0 -2
- package/dist-cli-web/assets/BatchManageTab-2LrckmQm.js +0 -1
- package/dist-cli-web/assets/ChatRecordDrawer-DRhztqLG.js +0 -1
- package/dist-cli-web/assets/Checkbox-EfpQmv4A.js +0 -1
- package/dist-cli-web/assets/DataDirCleanupNotice-BYIiR58J.js +0 -1
- package/dist-cli-web/assets/EChart.vue_vue_type_script_setup_true_lang-DryMSoCz.js +0 -1
- package/dist-cli-web/assets/EChartBar.vue_vue_type_script_setup_true_lang-BdFW-hvt.js +0 -1
- package/dist-cli-web/assets/EChartLine.vue_vue_type_script_setup_true_lang-C69Kdw9X.js +0 -1
- package/dist-cli-web/assets/EChartWordcloud-DM7UEHdK.js +0 -1
- package/dist-cli-web/assets/GlobalTaskBar-BZS_h0zC.js +0 -1
- package/dist-cli-web/assets/GlobalTaskBar-COW_uBX6.css +0 -1
- package/dist-cli-web/assets/GroupRelationshipGalaxyView--WIaHx_F.js +0 -1
- package/dist-cli-web/assets/Label-CIuDXyeM.js +0 -1
- package/dist-cli-web/assets/LoadingState.vue_vue_type_script_setup_true_lang-B_7VHxTx.js +0 -1
- package/dist-cli-web/assets/MessageExportModal-BQsIpyxv.js +0 -1
- package/dist-cli-web/assets/PageHeader-DxhQHF_0.js +0 -1
- package/dist-cli-web/assets/PageHeader-XIXMTomn.css +0 -1
- package/dist-cli-web/assets/SectionTabs.vue_vue_type_script_setup_true_lang-v_7aRBgM.js +0 -1
- package/dist-cli-web/assets/Select-CxurgslB.js +0 -1
- package/dist-cli-web/assets/SettingsModal-DBZucuf6.js +0 -2
- package/dist-cli-web/assets/Switch-3D81G6uV.js +0 -1
- package/dist-cli-web/assets/Tabs-DB603EEu.js +0 -1
- package/dist-cli-web/assets/ThemeCard.vue_vue_type_script_setup_true_lang-BDTdkH5i.js +0 -1
- package/dist-cli-web/assets/aiChat-BCzYQeZq.js +0 -8
- package/dist-cli-web/assets/cli-web-C-8N0CJh.js +0 -1
- package/dist-cli-web/assets/fetch-B69OkB6B.js +0 -1
- package/dist-cli-web/assets/fetch-z9M9FcIC.js +0 -1
- package/dist-cli-web/assets/index-BGd4ZfhO.js +0 -2
- package/dist-cli-web/assets/index-BYZF1ngN.js +0 -1
- package/dist-cli-web/assets/index-BcuwlCin.css +0 -1
- package/dist-cli-web/assets/index-BnaLj2dx.css +0 -1
- package/dist-cli-web/assets/index-Bq5q3kSU.js +0 -36
- package/dist-cli-web/assets/index-CPR3jdC2.js +0 -137
- package/dist-cli-web/assets/index-D3AjvaOX.js +0 -1
- package/dist-cli-web/assets/index-DAitScUA.js +0 -1
- package/dist-cli-web/assets/index-DBSMWAJ0.js +0 -1
- package/dist-cli-web/assets/index-DTn9htw-.js +0 -64
- package/dist-cli-web/assets/index-DV_rWxcH.js +0 -1
- package/dist-cli-web/assets/index-DxhAGqYM.css +0 -1
- package/dist-cli-web/assets/index-I0mIcDpE.css +0 -1
- package/dist-cli-web/assets/index-onwNShRw.js +0 -2
- package/dist-cli-web/assets/service-BMqwB74f.js +0 -1
- package/dist-cli-web/assets/service-CUQ8iHdS.js +0 -1
- package/dist-cli-web/assets/useFormControl-DcSMUc2d.js +0 -1
- package/dist-cli-web/assets/useTable-Clmq3sge.js +0 -1
- /package/dist/{chunk-TWH422HC.mjs.map → chunk-MMTEGUQA.mjs.map} +0 -0
- /package/dist/{chunk-CH5YAZ4Q.mjs.map → chunk-PDQV4RUA.mjs.map} +0 -0
- /package/dist/{http-237XYNRT.mjs.map → http-LPFPVTBC.mjs.map} +0 -0
- /package/dist/{import-R2E2TFAK.mjs.map → import-T4WX2ZJL.mjs.map} +0 -0
- /package/dist/{mcp-BED4AARV.mjs.map → mcp-SMF3NWIN.mjs.map} +0 -0
- /package/dist/{src-AYMALWU5.mjs.map → src-EGLLMTAU.mjs.map} +0 -0
- /package/dist/{stream-import-RXNSOOYH.mjs.map → stream-import-2BXJTTCE.mjs.map} +0 -0
- /package/dist/{worker-runtime-JGAZU7MC.mjs.map → worker-runtime-RDLSPXFT.mjs.map} +0 -0
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
DataDirCompatibilityError,
|
|
12
12
|
assertDataDirCompatible
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-OTYNMDDL.mjs";
|
|
14
14
|
|
|
15
15
|
// src/runtime-compat.ts
|
|
16
16
|
function assertCliDataDirCompatible(pathProvider, kind, options) {
|
|
@@ -37,4 +37,4 @@ function formatCliDataDirCompatibilityError(error, runtime) {
|
|
|
37
37
|
export {
|
|
38
38
|
assertCliDataDirCompatible
|
|
39
39
|
};
|
|
40
|
-
//# sourceMappingURL=chunk-
|
|
40
|
+
//# sourceMappingURL=chunk-PDQV4RUA.mjs.map
|
|
@@ -11,14 +11,15 @@ import {
|
|
|
11
11
|
getServerAiLogger,
|
|
12
12
|
getSkillManagerCore,
|
|
13
13
|
initServerAiLogger
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-ARIBCH47.mjs";
|
|
15
15
|
import {
|
|
16
16
|
AGENT_TOOL_REGISTRY,
|
|
17
17
|
CoreDataProvider
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-73TJ2S7W.mjs";
|
|
19
19
|
import {
|
|
20
|
+
prepareUnixSocket,
|
|
20
21
|
resolveCliLocalEmbeddingRuntimeConfig
|
|
21
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-WDLO7OLX.mjs";
|
|
22
23
|
import {
|
|
23
24
|
analyzeIncrementalImport,
|
|
24
25
|
analyzeNewImport,
|
|
@@ -26,10 +27,10 @@ import {
|
|
|
26
27
|
autoImportBatch,
|
|
27
28
|
incrementalImport,
|
|
28
29
|
streamImport
|
|
29
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-MMTEGUQA.mjs";
|
|
30
31
|
import {
|
|
31
32
|
assertCliDataDirCompatible
|
|
32
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-PDQV4RUA.mjs";
|
|
33
34
|
import {
|
|
34
35
|
getVersion
|
|
35
36
|
} from "./chunk-5ADKYYNA.mjs";
|
|
@@ -58,11 +59,10 @@ import {
|
|
|
58
59
|
getPendingNodeDataDirMigration,
|
|
59
60
|
hasPendingElectronDataWarning,
|
|
60
61
|
importDemoSessions,
|
|
61
|
-
initNlpDir,
|
|
62
62
|
isDictDownloaded,
|
|
63
63
|
segmentText,
|
|
64
64
|
serializeChatLabToJsonl
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-JWJREWVN.mjs";
|
|
66
66
|
import {
|
|
67
67
|
ArchiveImportError,
|
|
68
68
|
ArchiveImportSourceManager,
|
|
@@ -77,6 +77,7 @@ import {
|
|
|
77
77
|
TempDbWriter,
|
|
78
78
|
createChatLabTempDir,
|
|
79
79
|
createContactsService,
|
|
80
|
+
createCrossChatAnalysisService,
|
|
80
81
|
createGlobalInsightService,
|
|
81
82
|
createNavigationLayoutService,
|
|
82
83
|
createPeopleRelationshipsService,
|
|
@@ -102,9 +103,10 @@ import {
|
|
|
102
103
|
session_service_exports,
|
|
103
104
|
streamParseFileInfo,
|
|
104
105
|
summary_service_exports
|
|
105
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-GKCIRKOH.mjs";
|
|
106
107
|
import {
|
|
107
108
|
AIChatManager,
|
|
109
|
+
AIMemoryService,
|
|
108
110
|
ALL_MIGRATIONS,
|
|
109
111
|
ANNUAL_SUMMARY_PLUGIN_ID,
|
|
110
112
|
BUILTIN_MODELS,
|
|
@@ -169,16 +171,20 @@ import {
|
|
|
169
171
|
getWeekdayActivity,
|
|
170
172
|
getYearlyActivity,
|
|
171
173
|
initAppLogger,
|
|
174
|
+
initNlpDir,
|
|
172
175
|
isNewerStableVersion,
|
|
176
|
+
linkAIMemorySources,
|
|
177
|
+
listAIMemoriesWithSourceStatus,
|
|
173
178
|
loadConfig,
|
|
174
179
|
mergeRulesForLocale,
|
|
175
180
|
queryMessages,
|
|
181
|
+
resolveAIMemorySourceStatus,
|
|
176
182
|
runSimpleLlmStream,
|
|
177
183
|
stripAvatarFields,
|
|
178
184
|
validateApiKey,
|
|
179
185
|
verifyCliDataPath,
|
|
180
186
|
writeConfigField
|
|
181
|
-
} from "./chunk-
|
|
187
|
+
} from "./chunk-OTYNMDDL.mjs";
|
|
182
188
|
|
|
183
189
|
// src/http/index.ts
|
|
184
190
|
import * as fs11 from "fs";
|
|
@@ -810,14 +816,16 @@ function registerNodePlugins(server2, context, plugins) {
|
|
|
810
816
|
}
|
|
811
817
|
|
|
812
818
|
// ../../packages/http-routes/src/routes/web/ai-agent-stream.ts
|
|
819
|
+
import { randomUUID } from "crypto";
|
|
813
820
|
var activeAgentAborts = /* @__PURE__ */ new Map();
|
|
814
|
-
function registerAiAgentStreamRoutes(server2, ctx) {
|
|
821
|
+
function registerAiAgentStreamRoutes(server2, ctx, memoryProvenanceCoordinator) {
|
|
815
822
|
if (!ctx.runAgentStream) return;
|
|
816
823
|
const runAgentStream = ctx.runAgentStream;
|
|
817
824
|
server2.post("/_web/ai/agent/stream", async (request, reply) => {
|
|
818
|
-
const requestId = `req_${
|
|
825
|
+
const requestId = `req_${randomUUID()}`;
|
|
819
826
|
const abortController = new AbortController();
|
|
820
827
|
activeAgentAborts.set(requestId, abortController);
|
|
828
|
+
memoryProvenanceCoordinator?.begin(requestId, request.body.aiChatId);
|
|
821
829
|
reply.raw.writeHead(200, {
|
|
822
830
|
"Content-Type": "text/event-stream",
|
|
823
831
|
"Cache-Control": "no-cache",
|
|
@@ -849,6 +857,11 @@ data: ${JSON.stringify(data)}
|
|
|
849
857
|
request.body,
|
|
850
858
|
(chunk) => {
|
|
851
859
|
if (chunk.type === "done") emittedDone = true;
|
|
860
|
+
if (chunk.type === "memory_change" && chunk.memoryId) {
|
|
861
|
+
memoryProvenanceCoordinator?.record(requestId, chunk.memoryId);
|
|
862
|
+
safeSendSSE(chunk.type, { ...chunk, provenanceToken: requestId });
|
|
863
|
+
return;
|
|
864
|
+
}
|
|
852
865
|
safeSendSSE(chunk.type, chunk);
|
|
853
866
|
},
|
|
854
867
|
abortController.signal
|
|
@@ -857,6 +870,8 @@ data: ${JSON.stringify(data)}
|
|
|
857
870
|
const msg = error instanceof Error ? error.message : String(error);
|
|
858
871
|
safeSendSSE("error", { type: "error", error: { name: "ServerError", message: msg } });
|
|
859
872
|
} finally {
|
|
873
|
+
const expectedParentMessageId = ctx.aiChatManager?.getAIChat(request.body.aiChatId)?.activeMessageId ?? null;
|
|
874
|
+
memoryProvenanceCoordinator?.complete(requestId, expectedParentMessageId);
|
|
860
875
|
releaseInteractiveWork();
|
|
861
876
|
if (!emittedDone) safeSendSSE("done", { type: "done", isFinished: true });
|
|
862
877
|
activeAgentAborts.delete(requestId);
|
|
@@ -922,16 +937,6 @@ function registerAiAssistantRoutes(server2, ctx) {
|
|
|
922
937
|
server2.post("/_web/ai/assistants/import", async (request) => {
|
|
923
938
|
return mgr.importAssistantFromMd(request.body.rawMd);
|
|
924
939
|
});
|
|
925
|
-
server2.post("/_web/ai/assistants/import-builtin", async (request, reply) => {
|
|
926
|
-
const result = mgr.importAssistant(request.body.builtinId);
|
|
927
|
-
if (!result.success) return reply.code(400).send(result);
|
|
928
|
-
return result;
|
|
929
|
-
});
|
|
930
|
-
server2.post("/_web/ai/assistants/:id/reimport", async (request, reply) => {
|
|
931
|
-
const result = mgr.reimportAssistant(request.params.id);
|
|
932
|
-
if (!result.success) return reply.code(400).send(result);
|
|
933
|
-
return result;
|
|
934
|
-
});
|
|
935
940
|
}
|
|
936
941
|
|
|
937
942
|
// ../../packages/http-routes/src/routes/web/ai-chats.ts
|
|
@@ -947,6 +952,13 @@ function registerAiChatRoutes(server2, ctx) {
|
|
|
947
952
|
if (!sessionId) return [];
|
|
948
953
|
return cm.getAIChats(sessionId);
|
|
949
954
|
});
|
|
955
|
+
server2.post("/_web/ai/global-chats", async (request) => {
|
|
956
|
+
const { title, assistantId } = request.body;
|
|
957
|
+
return cm.createGlobalAIChat(title, assistantId);
|
|
958
|
+
});
|
|
959
|
+
server2.get("/_web/ai/global-chats", async () => {
|
|
960
|
+
return cm.getGlobalAIChats();
|
|
961
|
+
});
|
|
950
962
|
server2.get("/_web/ai/chats/:id", async (request, reply) => {
|
|
951
963
|
const conv = cm.getAIChat(request.params.id);
|
|
952
964
|
if (!conv) return reply.code(404).send({ error: "AI chat not found" });
|
|
@@ -958,8 +970,14 @@ function registerAiChatRoutes(server2, ctx) {
|
|
|
958
970
|
server2.delete("/_web/ai/chats/:id", async (request) => {
|
|
959
971
|
return cm.deleteAIChat(request.params.id);
|
|
960
972
|
});
|
|
973
|
+
server2.post("/_web/ai/chats/:id/message-pair", async (request) => {
|
|
974
|
+
return cm.addMessagePair(request.params.id, request.body.userMessage, request.body.assistantMessage);
|
|
975
|
+
});
|
|
976
|
+
server2.post("/_web/ai/chats/:id/replace-latest-message-round", async (request) => {
|
|
977
|
+
return cm.replaceLatestMessageRound(request.params.id, request.body);
|
|
978
|
+
});
|
|
961
979
|
server2.post("/_web/ai/chats/:id/messages", async (request) => {
|
|
962
|
-
const { role, content, dataKeywords, dataMessageCount, contentBlocks, tokenUsage } = request.body;
|
|
980
|
+
const { role, content, dataKeywords, dataMessageCount, contentBlocks, tokenUsage, entityRefs } = request.body;
|
|
963
981
|
return cm.addMessage(
|
|
964
982
|
request.params.id,
|
|
965
983
|
role,
|
|
@@ -967,7 +985,8 @@ function registerAiChatRoutes(server2, ctx) {
|
|
|
967
985
|
dataKeywords,
|
|
968
986
|
dataMessageCount,
|
|
969
987
|
contentBlocks,
|
|
970
|
-
tokenUsage
|
|
988
|
+
tokenUsage,
|
|
989
|
+
entityRefs
|
|
971
990
|
);
|
|
972
991
|
});
|
|
973
992
|
server2.get("/_web/ai/chats/:id/messages", async (request) => {
|
|
@@ -989,11 +1008,11 @@ function registerAiChatRoutes(server2, ctx) {
|
|
|
989
1008
|
return cm.forkAIChat(request.params.id, upToMessageId, title);
|
|
990
1009
|
});
|
|
991
1010
|
server2.put("/_web/ai/messages/:messageId/content", async (request, reply) => {
|
|
992
|
-
const { content } = request.body;
|
|
1011
|
+
const { content, entityRefs } = request.body;
|
|
993
1012
|
if (!content || typeof content !== "string") {
|
|
994
1013
|
return reply.code(400).send({ error: "content is required" });
|
|
995
1014
|
}
|
|
996
|
-
cm.updateMessageContent(request.params.messageId, content);
|
|
1015
|
+
cm.updateMessageContent(request.params.messageId, content, entityRefs);
|
|
997
1016
|
return { success: true };
|
|
998
1017
|
});
|
|
999
1018
|
server2.post("/_web/ai/chats/:id/messages/:messageId/delete-relink", async (request, reply) => {
|
|
@@ -1005,11 +1024,19 @@ function registerAiChatRoutes(server2, ctx) {
|
|
|
1005
1024
|
return { success: true };
|
|
1006
1025
|
});
|
|
1007
1026
|
server2.post("/_web/ai/chats/:id/messages/insert-after", async (request, reply) => {
|
|
1008
|
-
const { afterMessageId, role, content, contentBlocks, tokenUsage } = request.body;
|
|
1027
|
+
const { afterMessageId, role, content, contentBlocks, tokenUsage, entityRefs } = request.body;
|
|
1009
1028
|
if (!afterMessageId || typeof afterMessageId !== "string") {
|
|
1010
1029
|
return reply.code(400).send({ error: "afterMessageId is required" });
|
|
1011
1030
|
}
|
|
1012
|
-
return cm.insertMessageAfter(
|
|
1031
|
+
return cm.insertMessageAfter(
|
|
1032
|
+
request.params.id,
|
|
1033
|
+
afterMessageId,
|
|
1034
|
+
role,
|
|
1035
|
+
content,
|
|
1036
|
+
contentBlocks,
|
|
1037
|
+
tokenUsage,
|
|
1038
|
+
entityRefs
|
|
1039
|
+
);
|
|
1013
1040
|
});
|
|
1014
1041
|
server2.get("/_web/ai/chats/:id/token-usage", async (request) => {
|
|
1015
1042
|
return cm.getAIChatTokenUsage(request.params.id);
|
|
@@ -1336,6 +1363,127 @@ function registerAiLogRoutes(server2, ctx) {
|
|
|
1336
1363
|
});
|
|
1337
1364
|
}
|
|
1338
1365
|
|
|
1366
|
+
// ../../packages/http-routes/src/routes/web/ai-memories.ts
|
|
1367
|
+
function parseScope(input) {
|
|
1368
|
+
const scopeType = input.scopeType;
|
|
1369
|
+
if (scopeType !== "global" && scopeType !== "self" && scopeType !== "contact" && scopeType !== "group") {
|
|
1370
|
+
throw new Error("scopeType must be global, self, contact, or group");
|
|
1371
|
+
}
|
|
1372
|
+
return {
|
|
1373
|
+
scopeType,
|
|
1374
|
+
scopeId: typeof input.scopeId === "string" ? input.scopeId : null
|
|
1375
|
+
};
|
|
1376
|
+
}
|
|
1377
|
+
function sendBadRequest(reply, error) {
|
|
1378
|
+
return reply.code(400).send({ error: error instanceof Error ? error.message : String(error) });
|
|
1379
|
+
}
|
|
1380
|
+
function registerAiMemoryRoutes(server2, ctx, memoryProvenanceCoordinator) {
|
|
1381
|
+
const memoryService = ctx.aiMemoryService;
|
|
1382
|
+
if (!memoryService) return;
|
|
1383
|
+
const aiChatManager2 = ctx.aiChatManager;
|
|
1384
|
+
const withSourceStatus = (entry) => ({
|
|
1385
|
+
...entry,
|
|
1386
|
+
sourceStatus: aiChatManager2 ? resolveAIMemorySourceStatus(entry, aiChatManager2) : entry.sourceAIChatId ? "unavailable" : "none"
|
|
1387
|
+
});
|
|
1388
|
+
server2.get("/_web/ai/memories", async (request, reply) => {
|
|
1389
|
+
try {
|
|
1390
|
+
const { scopeType, scopeId } = request.query;
|
|
1391
|
+
if (!scopeType) {
|
|
1392
|
+
if (scopeId != null) throw new Error("scopeType is required when scopeId is provided");
|
|
1393
|
+
return aiChatManager2 ? listAIMemoriesWithSourceStatus(memoryService, aiChatManager2) : memoryService.list().map((entry) => ({
|
|
1394
|
+
...entry,
|
|
1395
|
+
sourceStatus: entry.sourceAIChatId ? "unavailable" : "none"
|
|
1396
|
+
}));
|
|
1397
|
+
}
|
|
1398
|
+
const scope = parseScope({ scopeType, scopeId });
|
|
1399
|
+
return aiChatManager2 ? listAIMemoriesWithSourceStatus(memoryService, aiChatManager2, scope) : memoryService.list(scope).map((entry) => ({
|
|
1400
|
+
...entry,
|
|
1401
|
+
sourceStatus: entry.sourceAIChatId ? "unavailable" : "none"
|
|
1402
|
+
}));
|
|
1403
|
+
} catch (error) {
|
|
1404
|
+
return sendBadRequest(reply, error);
|
|
1405
|
+
}
|
|
1406
|
+
});
|
|
1407
|
+
server2.post("/_web/ai/memories/link-sources", async (request, reply) => {
|
|
1408
|
+
if (!aiChatManager2) {
|
|
1409
|
+
return reply.code(503).send({ error: "AI conversation storage is unavailable" });
|
|
1410
|
+
}
|
|
1411
|
+
try {
|
|
1412
|
+
const body = request.body ?? {};
|
|
1413
|
+
const input = {
|
|
1414
|
+
provenanceToken: body.provenanceToken ?? "",
|
|
1415
|
+
aiChatId: body.aiChatId ?? "",
|
|
1416
|
+
userMessageId: body.userMessageId ?? "",
|
|
1417
|
+
assistantMessageId: body.assistantMessageId ?? "",
|
|
1418
|
+
memoryIds: body.memoryIds ?? []
|
|
1419
|
+
};
|
|
1420
|
+
if (!memoryProvenanceCoordinator) throw new Error("Memory provenance coordination is unavailable");
|
|
1421
|
+
const provenance = memoryProvenanceCoordinator.validate(input.provenanceToken, input.aiChatId, input.memoryIds);
|
|
1422
|
+
const result = linkAIMemorySources(memoryService, aiChatManager2, input, provenance);
|
|
1423
|
+
memoryProvenanceCoordinator.consume(input.provenanceToken);
|
|
1424
|
+
return result;
|
|
1425
|
+
} catch (error) {
|
|
1426
|
+
return sendBadRequest(reply, error);
|
|
1427
|
+
}
|
|
1428
|
+
});
|
|
1429
|
+
server2.post("/_web/ai/memories", async (request, reply) => {
|
|
1430
|
+
try {
|
|
1431
|
+
const scope = parseScope(request.body ?? {});
|
|
1432
|
+
return withSourceStatus(
|
|
1433
|
+
memoryService.create({
|
|
1434
|
+
...scope,
|
|
1435
|
+
content: request.body?.content ?? "",
|
|
1436
|
+
sourceType: "user",
|
|
1437
|
+
sourceAIChatId: null,
|
|
1438
|
+
sourceMessageId: null
|
|
1439
|
+
})
|
|
1440
|
+
);
|
|
1441
|
+
} catch (error) {
|
|
1442
|
+
return sendBadRequest(reply, error);
|
|
1443
|
+
}
|
|
1444
|
+
});
|
|
1445
|
+
server2.put("/_web/ai/memories/:id", async (request, reply) => {
|
|
1446
|
+
if (!memoryService.get(request.params.id)) {
|
|
1447
|
+
return reply.code(404).send({ error: "AI memory not found" });
|
|
1448
|
+
}
|
|
1449
|
+
try {
|
|
1450
|
+
return withSourceStatus(
|
|
1451
|
+
memoryService.update(request.params.id, {
|
|
1452
|
+
content: request.body?.content ?? "",
|
|
1453
|
+
sourceType: "user",
|
|
1454
|
+
sourceAIChatId: null,
|
|
1455
|
+
sourceMessageId: null
|
|
1456
|
+
})
|
|
1457
|
+
);
|
|
1458
|
+
} catch (error) {
|
|
1459
|
+
return sendBadRequest(reply, error);
|
|
1460
|
+
}
|
|
1461
|
+
});
|
|
1462
|
+
server2.delete("/_web/ai/memories/:id", async (request, reply) => {
|
|
1463
|
+
if (!memoryService.forget(request.params.id)) {
|
|
1464
|
+
return reply.code(404).send({ error: "AI memory not found" });
|
|
1465
|
+
}
|
|
1466
|
+
return { success: true };
|
|
1467
|
+
});
|
|
1468
|
+
server2.post("/_web/ai/memories/clear", async (request, reply) => {
|
|
1469
|
+
const { all, scopeType, scopeId } = request.body ?? {};
|
|
1470
|
+
if (all === true) {
|
|
1471
|
+
if (scopeType || scopeId != null) {
|
|
1472
|
+
return reply.code(400).send({ error: "all cannot be combined with a scope" });
|
|
1473
|
+
}
|
|
1474
|
+
return { success: true, cleared: memoryService.clear() };
|
|
1475
|
+
}
|
|
1476
|
+
if (!scopeType) {
|
|
1477
|
+
return reply.code(400).send({ error: "A scope or all: true is required" });
|
|
1478
|
+
}
|
|
1479
|
+
try {
|
|
1480
|
+
return { success: true, cleared: memoryService.clear(parseScope({ scopeType, scopeId })) };
|
|
1481
|
+
} catch (error) {
|
|
1482
|
+
return sendBadRequest(reply, error);
|
|
1483
|
+
}
|
|
1484
|
+
});
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1339
1487
|
// ../../packages/http-routes/src/routes/web/ai-semantic-index.ts
|
|
1340
1488
|
import path2 from "path";
|
|
1341
1489
|
function registerSemanticIndexRoutes(server2, ctx) {
|
|
@@ -1627,10 +1775,53 @@ function registerAiToolRoutes(server2, ctx) {
|
|
|
1627
1775
|
});
|
|
1628
1776
|
}
|
|
1629
1777
|
|
|
1778
|
+
// ../../packages/http-routes/src/routes/web/memory-provenance-coordinator.ts
|
|
1779
|
+
var MemoryProvenanceCoordinator = class {
|
|
1780
|
+
pending = /* @__PURE__ */ new Map();
|
|
1781
|
+
begin(token, aiChatId) {
|
|
1782
|
+
this.pending.set(token, {
|
|
1783
|
+
aiChatId,
|
|
1784
|
+
expectedParentMessageId: null,
|
|
1785
|
+
memoryIds: /* @__PURE__ */ new Set(),
|
|
1786
|
+
completed: false
|
|
1787
|
+
});
|
|
1788
|
+
}
|
|
1789
|
+
record(token, memoryId) {
|
|
1790
|
+
const changeSet = this.pending.get(token);
|
|
1791
|
+
if (!changeSet || changeSet.completed) return;
|
|
1792
|
+
changeSet.memoryIds.add(memoryId);
|
|
1793
|
+
}
|
|
1794
|
+
complete(token, expectedParentMessageId) {
|
|
1795
|
+
const changeSet = this.pending.get(token);
|
|
1796
|
+
if (!changeSet) return;
|
|
1797
|
+
if (changeSet.memoryIds.size === 0) {
|
|
1798
|
+
this.pending.delete(token);
|
|
1799
|
+
return;
|
|
1800
|
+
}
|
|
1801
|
+
changeSet.expectedParentMessageId = expectedParentMessageId;
|
|
1802
|
+
changeSet.completed = true;
|
|
1803
|
+
}
|
|
1804
|
+
validate(token, aiChatId, memoryIds) {
|
|
1805
|
+
const changeSet = this.pending.get(token);
|
|
1806
|
+
if (!changeSet || !changeSet.completed || changeSet.aiChatId !== aiChatId) {
|
|
1807
|
+
throw new Error("Memory provenance token is invalid");
|
|
1808
|
+
}
|
|
1809
|
+
const requestedIds = new Set(memoryIds);
|
|
1810
|
+
if (requestedIds.size !== changeSet.memoryIds.size || [...requestedIds].some((memoryId) => !changeSet.memoryIds.has(memoryId))) {
|
|
1811
|
+
throw new Error("Memory IDs do not match the agent turn change set");
|
|
1812
|
+
}
|
|
1813
|
+
return { expectedParentMessageId: changeSet.expectedParentMessageId };
|
|
1814
|
+
}
|
|
1815
|
+
consume(token) {
|
|
1816
|
+
this.pending.delete(token);
|
|
1817
|
+
}
|
|
1818
|
+
};
|
|
1819
|
+
|
|
1630
1820
|
// ../../packages/http-routes/src/routes/web/register-ai.ts
|
|
1631
1821
|
var REQUIRED_AI_DEPENDENCIES = [
|
|
1632
1822
|
"aiDataDir",
|
|
1633
1823
|
"aiChatManager",
|
|
1824
|
+
"aiMemoryService",
|
|
1634
1825
|
"assistantManager",
|
|
1635
1826
|
"skillManagerCore",
|
|
1636
1827
|
"llmConfigStore",
|
|
@@ -1646,13 +1837,15 @@ function assertRequiredAiContext(ctx) {
|
|
|
1646
1837
|
}
|
|
1647
1838
|
function registerAiRoutes(server2, ctx, options) {
|
|
1648
1839
|
if (options?.requireAi) assertRequiredAiContext(ctx);
|
|
1840
|
+
const memoryProvenanceCoordinator = new MemoryProvenanceCoordinator();
|
|
1649
1841
|
registerAiAssistantRoutes(server2, ctx);
|
|
1650
1842
|
registerAiSkillRoutes(server2, ctx);
|
|
1651
1843
|
registerAiLlmRoutes(server2, ctx);
|
|
1652
1844
|
registerAiLlmStreamRoutes(server2, ctx);
|
|
1653
|
-
registerAiAgentStreamRoutes(server2, ctx);
|
|
1845
|
+
registerAiAgentStreamRoutes(server2, ctx, memoryProvenanceCoordinator);
|
|
1654
1846
|
registerAiToolRoutes(server2, ctx);
|
|
1655
1847
|
registerAiChatRoutes(server2, ctx);
|
|
1848
|
+
registerAiMemoryRoutes(server2, ctx, memoryProvenanceCoordinator);
|
|
1656
1849
|
registerAiChatTopicRoutes(server2, ctx);
|
|
1657
1850
|
registerAiSummaryRoutes(server2, ctx);
|
|
1658
1851
|
registerAiLogRoutes(server2, ctx);
|
|
@@ -2660,7 +2853,9 @@ import * as path7 from "path";
|
|
|
2660
2853
|
function registerNlpRoutes(server2, ctx) {
|
|
2661
2854
|
const nlpDir = path7.join(ctx.pathProvider.getSystemDir(), "nlp");
|
|
2662
2855
|
initNlpDir(nlpDir);
|
|
2663
|
-
ensureDefaultDict(nlpDir).catch(
|
|
2856
|
+
ensureDefaultDict(nlpDir, ctx.bundledNlpDictDir).catch(
|
|
2857
|
+
(err) => console.warn("[NLP] Initialize zh-CN dict failed:", err)
|
|
2858
|
+
);
|
|
2664
2859
|
server2.get("/_web/nlp/pos-tags", async () => {
|
|
2665
2860
|
return POS_TAG_DEFINITIONS;
|
|
2666
2861
|
});
|
|
@@ -3142,7 +3337,8 @@ function registerAutomationRoutes(server2, ctx) {
|
|
|
3142
3337
|
enabled: true,
|
|
3143
3338
|
port: automation.serverInfo.port,
|
|
3144
3339
|
token: automation.serverInfo.token,
|
|
3145
|
-
host: automation.serverInfo.host
|
|
3340
|
+
host: automation.serverInfo.host,
|
|
3341
|
+
socket: automation.serverInfo.socket
|
|
3146
3342
|
};
|
|
3147
3343
|
});
|
|
3148
3344
|
server2.get("/_web/automation/data-sources", async (_request, reply) => {
|
|
@@ -3237,7 +3433,7 @@ function registerAutomationRoutes(server2, ctx) {
|
|
|
3237
3433
|
// src/http/routes/web/import.ts
|
|
3238
3434
|
import * as fs7 from "fs";
|
|
3239
3435
|
import * as path8 from "path";
|
|
3240
|
-
import { randomUUID } from "crypto";
|
|
3436
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
3241
3437
|
import { pipeline } from "stream/promises";
|
|
3242
3438
|
|
|
3243
3439
|
// src/http/routes/web/helpers.ts
|
|
@@ -3292,7 +3488,7 @@ function registerImportRoutes2(server2, dbManager2, options = {}) {
|
|
|
3292
3488
|
limits: { fileSize: ARCHIVE_UPLOAD_LIMIT }
|
|
3293
3489
|
});
|
|
3294
3490
|
if (!data) return reply.code(400).send({ success: false, error: "error.no_file_selected" });
|
|
3295
|
-
const uploadPath = path8.join(getChatLabTempScopeDir("imports"), `archive-${
|
|
3491
|
+
const uploadPath = path8.join(getChatLabTempScopeDir("imports"), `archive-${randomUUID2()}.zip`);
|
|
3296
3492
|
try {
|
|
3297
3493
|
await pipeline(data.file, fs7.createWriteStream(uploadPath, { flags: "wx" }));
|
|
3298
3494
|
if (data.file.truncated) {
|
|
@@ -3442,7 +3638,7 @@ data: ${JSON.stringify(eventData)}
|
|
|
3442
3638
|
const parts = request.parts();
|
|
3443
3639
|
if (!parts) return reply.code(400).send({ error: "No files uploaded" });
|
|
3444
3640
|
const requestedBatchId = request.headers["x-chatlab-import-batch-id"];
|
|
3445
|
-
const batchId = typeof requestedBatchId === "string" && requestedBatchId ? requestedBatchId :
|
|
3641
|
+
const batchId = typeof requestedBatchId === "string" && requestedBatchId ? requestedBatchId : randomUUID2();
|
|
3446
3642
|
if (activeBatchControllers.has(batchId)) {
|
|
3447
3643
|
return reply.code(409).send({ error: "Batch import id is already active" });
|
|
3448
3644
|
}
|
|
@@ -3763,10 +3959,10 @@ function registerWebRoutes2(server2, dbManager2, options) {
|
|
|
3763
3959
|
const resolvedPathProvider = options?.pathProvider ?? fallbackPathProvider;
|
|
3764
3960
|
const ai = options?.aiContext;
|
|
3765
3961
|
const cliStreamImport = async (dm, filePath) => {
|
|
3766
|
-
const { streamImport: streamImport2 } = await import("./stream-import-
|
|
3962
|
+
const { streamImport: streamImport2 } = await import("./stream-import-2BXJTTCE.mjs");
|
|
3767
3963
|
const result = await streamImport2(dm, filePath);
|
|
3768
3964
|
if (!result.success) {
|
|
3769
|
-
const { IMPORT_IN_PROGRESS_ERROR_KEY: IMPORT_IN_PROGRESS_ERROR_KEY2, ImportInProgressError: ImportInProgressError2 } = await import("./src-
|
|
3965
|
+
const { IMPORT_IN_PROGRESS_ERROR_KEY: IMPORT_IN_PROGRESS_ERROR_KEY2, ImportInProgressError: ImportInProgressError2 } = await import("./src-EGLLMTAU.mjs");
|
|
3770
3966
|
if (result.error === IMPORT_IN_PROGRESS_ERROR_KEY2) throw new ImportInProgressError2();
|
|
3771
3967
|
throw new Error(result.error || "Import failed");
|
|
3772
3968
|
}
|
|
@@ -3790,7 +3986,11 @@ function registerWebRoutes2(server2, dbManager2, options) {
|
|
|
3790
3986
|
runtimeIdentity: options?.runtimeIdentity,
|
|
3791
3987
|
getVersion,
|
|
3792
3988
|
nativeBinding: options?.nativeBinding,
|
|
3989
|
+
bundledNlpDictDir: process.env.CHATLAB_NLP_DICT_DIR?.trim() || void 0,
|
|
3793
3990
|
semanticIndexService,
|
|
3991
|
+
contactsService: options?.contactsService,
|
|
3992
|
+
globalInsightService: options?.globalInsightService,
|
|
3993
|
+
preferencesManager: options?.preferencesManager,
|
|
3794
3994
|
analyticsService,
|
|
3795
3995
|
getCurrentAiLogPath: () => getServerAiLogger()?.getExistingLogPath() ?? null,
|
|
3796
3996
|
openDirectory: openDirectoryPath,
|
|
@@ -3824,6 +4024,7 @@ function registerWebRoutes2(server2, dbManager2, options) {
|
|
|
3824
4024
|
...ai && {
|
|
3825
4025
|
aiDataDir: ai.aiDataDir,
|
|
3826
4026
|
aiChatManager: ai.aiChatManager,
|
|
4027
|
+
aiMemoryService: ai.aiMemoryService,
|
|
3827
4028
|
assistantManager: ai.assistantManager,
|
|
3828
4029
|
skillManagerCore: ai.skillManagerCore,
|
|
3829
4030
|
llmConfigStore: ai.llmConfigStore,
|
|
@@ -4797,6 +4998,7 @@ function cleanupSync() {
|
|
|
4797
4998
|
var server = null;
|
|
4798
4999
|
var dbManager = null;
|
|
4799
5000
|
var aiChatManager = null;
|
|
5001
|
+
var aiMemoryService = null;
|
|
4800
5002
|
function resolveNativeBinding2() {
|
|
4801
5003
|
if (process.versions.electron) return void 0;
|
|
4802
5004
|
const nativePath = resolveCliPath("native/better_sqlite3.node");
|
|
@@ -4819,7 +5021,9 @@ async function startHttpServer(options) {
|
|
|
4819
5021
|
let config = loadConfig();
|
|
4820
5022
|
const port = options?.port ?? config.api.port;
|
|
4821
5023
|
const host = options?.host ?? config.api.host;
|
|
5024
|
+
const socket = options?.socket;
|
|
4822
5025
|
const token = options?.token ?? ensureToken(config);
|
|
5026
|
+
if (socket) await prepareUnixSocket(socket);
|
|
4823
5027
|
const pendingMigration = applyPendingNodeDataDirMigrationIfNeeded();
|
|
4824
5028
|
if (!pendingMigration.skipped) {
|
|
4825
5029
|
if (pendingMigration.success) {
|
|
@@ -4850,8 +5054,30 @@ async function startHttpServer(options) {
|
|
|
4850
5054
|
await migrationRunner.run();
|
|
4851
5055
|
const nativeBinding = resolveNativeBinding2();
|
|
4852
5056
|
dbManager = new DatabaseManager(pathProvider, { nativeBinding, runtime });
|
|
5057
|
+
const sessionAdapter = createDatabaseManagerAdapter(dbManager);
|
|
5058
|
+
const contactsService = createContactsService({
|
|
5059
|
+
adapter: sessionAdapter,
|
|
5060
|
+
pathProvider,
|
|
5061
|
+
runtimeIdentity: runtime,
|
|
5062
|
+
nativeBinding
|
|
5063
|
+
});
|
|
5064
|
+
const preferencesManager = new PreferencesManager(pathProvider.getSystemDir());
|
|
5065
|
+
const globalInsightService = createGlobalInsightService({
|
|
5066
|
+
adapter: sessionAdapter,
|
|
5067
|
+
pathProvider,
|
|
5068
|
+
runtimeIdentity: runtime,
|
|
5069
|
+
nativeBinding,
|
|
5070
|
+
getExcludedSessionIds: () => preferencesManager.load().ownerExcludedSessionIds
|
|
5071
|
+
});
|
|
5072
|
+
const crossChatAnalysisService = createCrossChatAnalysisService({
|
|
5073
|
+
adapter: sessionAdapter,
|
|
5074
|
+
contactsService,
|
|
5075
|
+
globalInsightService,
|
|
5076
|
+
getExcludedSessionIds: () => preferencesManager.load().ownerExcludedSessionIds
|
|
5077
|
+
});
|
|
4853
5078
|
const aiDataDir = pathProvider.getAiDataDir();
|
|
4854
5079
|
aiChatManager = new AIChatManager(aiDataDir, { nativeBinding });
|
|
5080
|
+
aiMemoryService = new AIMemoryService(aiDataDir, { nativeBinding });
|
|
4855
5081
|
const assistantManager = getAssistantManager(aiDataDir);
|
|
4856
5082
|
const skillManagerCore = getSkillManagerCore(aiDataDir);
|
|
4857
5083
|
const llmRuntimeStores = createLlmRuntimeStores(aiDataDir);
|
|
@@ -4860,7 +5086,10 @@ async function startHttpServer(options) {
|
|
|
4860
5086
|
initServerAiLogger(pathProvider.getLogsDir());
|
|
4861
5087
|
appLogger.info("ai-config", "Shared LLM configuration store initialized", { aiDataDir });
|
|
4862
5088
|
appLogger.info("temp-workspace", "Temporary workspace initialized", { root: pathProvider.getTempDir() });
|
|
4863
|
-
appLogger.info(
|
|
5089
|
+
appLogger.info(
|
|
5090
|
+
"server",
|
|
5091
|
+
socket ? `HTTP server starting on Unix socket ${socket}` : `HTTP server starting on ${host}:${port}`
|
|
5092
|
+
);
|
|
4864
5093
|
logNativeParserStatus();
|
|
4865
5094
|
setAuthToken(token);
|
|
4866
5095
|
setRequireAuth(!!(options?.requireAuth ?? config.api.require_auth));
|
|
@@ -4888,10 +5117,14 @@ async function startHttpServer(options) {
|
|
|
4888
5117
|
pathProvider,
|
|
4889
5118
|
nativeBinding,
|
|
4890
5119
|
runtimeIdentity: runtime,
|
|
5120
|
+
contactsService,
|
|
5121
|
+
globalInsightService,
|
|
5122
|
+
preferencesManager,
|
|
4891
5123
|
semanticIndexService,
|
|
4892
5124
|
aiContext: {
|
|
4893
5125
|
aiDataDir,
|
|
4894
5126
|
aiChatManager,
|
|
5127
|
+
aiMemoryService,
|
|
4895
5128
|
assistantManager,
|
|
4896
5129
|
skillManagerCore,
|
|
4897
5130
|
llmConfigStore,
|
|
@@ -4899,11 +5132,14 @@ async function startHttpServer(options) {
|
|
|
4899
5132
|
customModelStore,
|
|
4900
5133
|
runAgentStream: createCliRunAgentStream(dbManager, aiChatManager, {
|
|
4901
5134
|
llmConfigStore,
|
|
4902
|
-
semanticIndexService
|
|
5135
|
+
semanticIndexService,
|
|
5136
|
+
crossChatAnalysisService,
|
|
5137
|
+
sessionAdapter,
|
|
5138
|
+
memoryService: aiMemoryService
|
|
4903
5139
|
})
|
|
4904
5140
|
}
|
|
4905
5141
|
});
|
|
4906
|
-
initSync(server, dbManager, pathProvider, { port, host, token });
|
|
5142
|
+
initSync(server, dbManager, pathProvider, { port, host, socket, token });
|
|
4907
5143
|
if (options?.webRoot && fs11.existsSync(options.webRoot)) {
|
|
4908
5144
|
registerProxyRoutes(server);
|
|
4909
5145
|
const fastifyStatic = await import("@fastify/static");
|
|
@@ -4916,8 +5152,12 @@ async function startHttpServer(options) {
|
|
|
4916
5152
|
return reply.sendFile("index.html");
|
|
4917
5153
|
});
|
|
4918
5154
|
}
|
|
4919
|
-
|
|
4920
|
-
|
|
5155
|
+
if (socket) {
|
|
5156
|
+
await server.listen({ path: socket });
|
|
5157
|
+
} else {
|
|
5158
|
+
await server.listen({ port, host });
|
|
5159
|
+
}
|
|
5160
|
+
return socket ? { socket, token } : { port, host, token };
|
|
4921
5161
|
}
|
|
4922
5162
|
async function stopHttpServer() {
|
|
4923
5163
|
if (!server) return;
|
|
@@ -4929,6 +5169,10 @@ async function stopHttpServer() {
|
|
|
4929
5169
|
aiChatManager.close();
|
|
4930
5170
|
aiChatManager = null;
|
|
4931
5171
|
}
|
|
5172
|
+
if (aiMemoryService) {
|
|
5173
|
+
aiMemoryService.close();
|
|
5174
|
+
aiMemoryService = null;
|
|
5175
|
+
}
|
|
4932
5176
|
if (dbManager) {
|
|
4933
5177
|
dbManager.closeAll();
|
|
4934
5178
|
dbManager = null;
|
|
@@ -4945,4 +5189,4 @@ export {
|
|
|
4945
5189
|
startHttpServer,
|
|
4946
5190
|
stopHttpServer
|
|
4947
5191
|
};
|
|
4948
|
-
//# sourceMappingURL=chunk-
|
|
5192
|
+
//# sourceMappingURL=chunk-UP6JIV3S.mjs.map
|