chatlab-cli 0.36.2 → 0.37.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/dist/{chat-command-SEV6N3AR.mjs → chat-command-WBAJBKIE.mjs} +15 -16
- package/dist/{chat-command-SEV6N3AR.mjs.map → chat-command-WBAJBKIE.mjs.map} +1 -1
- package/dist/chunk-2TV7M4CC.mjs +101 -0
- package/dist/chunk-2TV7M4CC.mjs.map +1 -0
- package/dist/{chunk-TRGR3KKJ.mjs → chunk-4J4MA3RC.mjs} +2605 -672
- package/dist/chunk-4J4MA3RC.mjs.map +1 -0
- package/dist/{chunk-TJ3NOBVI.mjs → chunk-5YOHLJFB.mjs} +98 -284
- package/dist/chunk-5YOHLJFB.mjs.map +1 -0
- package/dist/{chunk-WRBFV2GX.mjs → chunk-CR2MU7LN.mjs} +49 -55
- package/dist/chunk-CR2MU7LN.mjs.map +1 -0
- package/dist/{chunk-WJQOXOMR.mjs → chunk-DKIYHA3O.mjs} +281 -30
- package/dist/chunk-DKIYHA3O.mjs.map +1 -0
- package/dist/{chunk-VREVDZ4Q.mjs → chunk-DQR2YS3I.mjs} +1930 -33
- package/dist/chunk-DQR2YS3I.mjs.map +1 -0
- package/dist/{chunk-VUYWUHWW.mjs → chunk-EJBBVLUN.mjs} +3 -3
- package/dist/chunk-EJBBVLUN.mjs.map +1 -0
- package/dist/{chunk-HWIXK7SU.mjs → chunk-FM3GXNEO.mjs} +1643 -3
- package/dist/chunk-FM3GXNEO.mjs.map +1 -0
- package/dist/{chunk-YUH3H3QW.mjs → chunk-MSMDLDPB.mjs} +96 -5
- package/dist/chunk-MSMDLDPB.mjs.map +1 -0
- package/dist/{chunk-6EZPD3XJ.mjs → chunk-N2WGG3MS.mjs} +2 -2
- package/dist/{chunk-TWH422HC.mjs → chunk-RXMSZIYD.mjs} +3 -3
- package/dist/{chunk-CH5YAZ4Q.mjs → chunk-SQWN4GTQ.mjs} +2 -2
- 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-X6OEOOSH.mjs} +12 -12
- package/dist/{import-R2E2TFAK.mjs → import-WBJ6YIQ7.mjs} +7 -7
- package/dist/index.mjs +12 -12
- package/dist/{mcp-BED4AARV.mjs → mcp-FR6OKWKL.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-WE5HNN2O.mjs} +44 -14
- package/dist/{stream-import-RXNSOOYH.mjs → stream-import-YYQVZDGQ.mjs} +7 -7
- package/dist/{worker-runtime-JGAZU7MC.mjs → worker-runtime-YGB5ZDE4.mjs} +5 -5
- package/dist-cli-web/assets/AISettingsTab-Co2sM1iY.js +1 -0
- package/dist-cli-web/assets/{AboutTab-DCM1-glA.js → AboutTab-DQ8r6mYE.js} +1 -1
- package/dist-cli-web/assets/ActionToolsPanel-CmYpw8Mt.css +1 -0
- package/dist-cli-web/assets/ActionToolsPanel.vue_vue_type_script_setup_true_lang--RPlmfIu.js +75 -0
- package/dist-cli-web/assets/{Alert-D-egBWcb.js → Alert-DU1tLAAg.js} +1 -1
- package/dist-cli-web/assets/ApiSettingsTab-D5g5b79L.js +2 -0
- package/dist-cli-web/assets/BatchManageTab-BFUyVaGU.js +1 -0
- package/dist-cli-web/assets/{BufferResource-BE2_2bZK.js → BufferResource-C-RfYwQW.js} +1 -1
- package/dist-cli-web/assets/{CanvasRenderer-DDKdvEYQ.js → CanvasRenderer-Dz7JAMrR.js} +1 -1
- package/dist-cli-web/assets/CardDecoration-D28DI1G9.js +1 -0
- package/dist-cli-web/assets/ChatRecordDrawer-Cph819yY.js +1 -0
- package/dist-cli-web/assets/{ChatRecordWorkspace-DqUI4QiU.js → ChatRecordWorkspace-BAfERdPc.js} +1 -1
- package/dist-cli-web/assets/Checkbox-B8uqt13j.js +1 -0
- package/dist-cli-web/assets/DataDirCleanupNotice-3sGBE5vU.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-CQuub8-f.js} +1 -1
- package/dist-cli-web/assets/{DebugToolsPanel-BIHA6jw4.js → DebugToolsPanel-Cwkr0BOY.js} +1 -1
- package/dist-cli-web/assets/EChart.vue_vue_type_script_setup_true_lang-BuLujQCF.js +1 -0
- package/dist-cli-web/assets/EChartBar.vue_vue_type_script_setup_true_lang-DuA5xbcC.js +1 -0
- package/dist-cli-web/assets/EChartLine.vue_vue_type_script_setup_true_lang-CvmMEfYq.js +1 -0
- package/dist-cli-web/assets/EChartWordcloud-CHVtyPR7.js +1 -0
- package/dist-cli-web/assets/FileDropZone.vue_vue_type_script_setup_true_lang-BKPy9Qv-.js +1 -0
- package/dist-cli-web/assets/{Filter-kO4dIDJ2.js → Filter-CMfRHIoK.js} +1 -1
- package/dist-cli-web/assets/GlobalTaskBar-Jz6MASCu.js +1 -0
- package/dist-cli-web/assets/GlobalTaskBar-haLzezqY.css +1 -0
- package/dist-cli-web/assets/GroupRelationshipGalaxyView-Ch4obfEq.js +1 -0
- package/dist-cli-web/assets/Label-CuryuymO.js +1 -0
- package/dist-cli-web/assets/LoadingState.vue_vue_type_script_setup_true_lang-CoeQsaiL.js +1 -0
- package/dist-cli-web/assets/MessageExportModal-JqGZ-iLr.js +1 -0
- package/dist-cli-web/assets/PageHeader-CPLgiKT8.css +1 -0
- package/dist-cli-web/assets/PageHeader-D4up77TB.js +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-DYQRFk9s.js} +1 -1
- package/dist-cli-web/assets/{RelationshipGalaxyCanvas-Cod1JX9m.js → RelationshipGalaxyCanvas-Cn7Eta5U.js} +3 -3
- package/dist-cli-web/assets/{RelationshipGalaxyThreeCanvas-CkefzeFJ.js → RelationshipGalaxyThreeCanvas-LlaX57z6.js} +1 -1
- package/dist-cli-web/assets/{RenderTargetSystem-SuQ7cbze.js → RenderTargetSystem-JhA2PUFi.js} +1 -1
- package/dist-cli-web/assets/{RovingFocusItem-psoFYxrC.js → RovingFocusItem-DHaiTb4j.js} +1 -1
- package/dist-cli-web/assets/{ScreenCaptureModal-D4r9ixKh.js → ScreenCaptureModal-Bxhyt5g1.js} +1 -1
- package/dist-cli-web/assets/SectionTabs.vue_vue_type_script_setup_true_lang-BlAje3Tf.js +1 -0
- package/dist-cli-web/assets/Select-Beeqv0wU.js +1 -0
- package/dist-cli-web/assets/SettingsModal-DV8yDBJs.js +2 -0
- package/dist-cli-web/assets/{StorageTab-DhSJ-0Ir.js → StorageTab-B7GHadia.js} +1 -1
- package/dist-cli-web/assets/Switch-u4zlvUMa.js +1 -0
- package/dist-cli-web/assets/{Tabs-Bnm_Q7yW.js → Tabs-B7-Koq3x.js} +1 -1
- package/dist-cli-web/assets/Tabs-RWKHwtfM.js +1 -0
- package/dist-cli-web/assets/ThemeCard.vue_vue_type_script_setup_true_lang-ndsa3-aT.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-DKa1flT-.js} +1 -1
- package/dist-cli-web/assets/{VisuallyHiddenInput-Bo_XwaLu.js → VisuallyHiddenInput-DGDqcvUy.js} +1 -1
- package/dist-cli-web/assets/{WebGLRenderer-D1x9WZRj.js → WebGLRenderer-ifvgA1fe.js} +1 -1
- package/dist-cli-web/assets/{WebGPURenderer-37Nw-tLm.js → WebGPURenderer-DwzmuWF0.js} +1 -1
- package/dist-cli-web/assets/aiChat-BY4C3UQe.js +8 -0
- package/dist-cli-web/assets/base-BWDX-164.js +1 -0
- package/dist-cli-web/assets/{browserAll-CWrz_-4U.js → browserAll-CSIIETeE.js} +1 -1
- package/dist-cli-web/assets/chatMessages--r0obAVw.css +1 -0
- package/dist-cli-web/assets/chatMessages-Zywjea1n.js +147 -0
- package/dist-cli-web/assets/cli-web-BRY49NWe.js +1 -0
- package/dist-cli-web/assets/{fetch-Du-wU0OO.js → fetch-Bf4cqeM3.js} +1 -1
- package/dist-cli-web/assets/{fetch-DPSWt6yX.js → fetch-BiXab0IF.js} +1 -1
- package/dist-cli-web/assets/{fetch-B69OkB6B.js → fetch-C8CcoTWY.js} +1 -1
- package/dist-cli-web/assets/{fetch-qd2FgBWQ.js → fetch-Co2vLmiE.js} +1 -1
- package/dist-cli-web/assets/{fetch-BGmCCyzz.js → fetch-D3nLtFBi.js} +1 -1
- package/dist-cli-web/assets/{fetch-CFpLXWTe.js → fetch-DNSDHSqQ.js} +1 -1
- package/dist-cli-web/assets/{fetch-DZ6OF-xW.js → fetch-DeHqF6yL.js} +1 -1
- package/dist-cli-web/assets/{fetch-CkXgOxcu.js → fetch-jx1VdM9j.js} +3 -3
- package/dist-cli-web/assets/{fetch-Gu4qQjUB.js → fetch-mYSeL4Ki.js} +1 -1
- package/dist-cli-web/assets/fetch-qBaUXqFt.js +1 -0
- package/dist-cli-web/assets/{fetch-6pcVxB9h.js → fetch-r6mhEGrP.js} +1 -1
- package/dist-cli-web/assets/{fetch-CgA1peJD.js → fetch-wzv71PYy.js} +1 -1
- package/dist-cli-web/assets/{host-CWsAWKgy.js → host-1emQf9_4.js} +1 -1
- package/dist-cli-web/assets/{host-D8zlA62K.js → host-jXJHyyOX.js} +1 -1
- package/dist-cli-web/assets/index-2dJCozDq.js +64 -0
- package/dist-cli-web/assets/index-6ejRbH3h.js +2 -0
- package/dist-cli-web/assets/index-B4mJkX_d.js +1 -0
- package/dist-cli-web/assets/index-B7biznha.js +1 -0
- package/dist-cli-web/assets/index-BOcFyPCa.js +1 -0
- package/dist-cli-web/assets/index-BQ463TS7.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-C1A1FwpO.css +1 -0
- package/dist-cli-web/assets/index-CIIyg_o9.css +1 -0
- package/dist-cli-web/assets/{index-a7CT8DQm.js → index-CYc_VLgK.js} +1 -1
- package/dist-cli-web/assets/index-ClHMs0-a.js +2 -0
- package/dist-cli-web/assets/{index-Dy0fRMDf.js → index-Cw0IhKZ6.js} +10 -10
- package/dist-cli-web/assets/{index-v6DlL4ue.js → index-DOqbUvhA.js} +1 -1
- package/dist-cli-web/assets/index-DnpnIyle.js +135 -0
- package/dist-cli-web/assets/index-LV9LfFNu.js +1 -0
- package/dist-cli-web/assets/index-kePiJ3ca.js +137 -0
- package/dist-cli-web/assets/index-slDUxib2.js +1 -0
- package/dist-cli-web/assets/{people-page-header-Czt9e1jv.js → people-page-header-Cx5r9Bk2.js} +1 -1
- package/dist-cli-web/assets/{prompt-DGazz143.js → prompt-BggEDxxi.js} +1 -1
- package/dist-cli-web/assets/{semantic-index-config-builder-BkFHzIUy.js → semantic-index-config-builder-1sO0aEc1.js} +1 -1
- package/dist-cli-web/assets/{service-CAp0YJoS.js → service-Bvq1fRkC.js} +1 -1
- package/dist-cli-web/assets/service-DkPheDt8.js +1 -0
- package/dist-cli-web/assets/service-DvI8O_7K.js +1 -0
- package/dist-cli-web/assets/useFormControl-B0aShtLp.js +1 -0
- package/dist-cli-web/assets/useTable-DC7oxmBl.js +1 -0
- package/dist-cli-web/assets/{useToast-YAHDkKDN.js → useToast-CCPBE-Sy.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-FCJk6reG.js} +1 -1
- package/dist-cli-web/index.html +2 -2
- package/package.json +1 -1
- package/dist/chunk-6E46U4H2.mjs +0 -41
- package/dist/chunk-6E46U4H2.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-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-6EZPD3XJ.mjs.map → chunk-N2WGG3MS.mjs.map} +0 -0
- /package/dist/{chunk-TWH422HC.mjs.map → chunk-RXMSZIYD.mjs.map} +0 -0
- /package/dist/{chunk-CH5YAZ4Q.mjs.map → chunk-SQWN4GTQ.mjs.map} +0 -0
- /package/dist/{http-237XYNRT.mjs.map → http-X6OEOOSH.mjs.map} +0 -0
- /package/dist/{import-R2E2TFAK.mjs.map → import-WBJ6YIQ7.mjs.map} +0 -0
- /package/dist/{mcp-BED4AARV.mjs.map → mcp-FR6OKWKL.mjs.map} +0 -0
- /package/dist/{src-AYMALWU5.mjs.map → src-WE5HNN2O.mjs.map} +0 -0
- /package/dist/{stream-import-RXNSOOYH.mjs.map → stream-import-YYQVZDGQ.mjs.map} +0 -0
- /package/dist/{worker-runtime-JGAZU7MC.mjs.map → worker-runtime-YGB5ZDE4.mjs.map} +0 -0
|
@@ -11,14 +11,15 @@ import {
|
|
|
11
11
|
getServerAiLogger,
|
|
12
12
|
getSkillManagerCore,
|
|
13
13
|
initServerAiLogger
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-MSMDLDPB.mjs";
|
|
15
15
|
import {
|
|
16
16
|
AGENT_TOOL_REGISTRY,
|
|
17
17
|
CoreDataProvider
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-FM3GXNEO.mjs";
|
|
19
19
|
import {
|
|
20
|
+
prepareUnixSocket,
|
|
20
21
|
resolveCliLocalEmbeddingRuntimeConfig
|
|
21
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-2TV7M4CC.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-RXMSZIYD.mjs";
|
|
30
31
|
import {
|
|
31
32
|
assertCliDataDirCompatible
|
|
32
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-SQWN4GTQ.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-5YOHLJFB.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-DQR2YS3I.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-4J4MA3RC.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);
|
|
@@ -947,6 +962,13 @@ function registerAiChatRoutes(server2, ctx) {
|
|
|
947
962
|
if (!sessionId) return [];
|
|
948
963
|
return cm.getAIChats(sessionId);
|
|
949
964
|
});
|
|
965
|
+
server2.post("/_web/ai/global-chats", async (request) => {
|
|
966
|
+
const { title, assistantId } = request.body;
|
|
967
|
+
return cm.createGlobalAIChat(title, assistantId);
|
|
968
|
+
});
|
|
969
|
+
server2.get("/_web/ai/global-chats", async () => {
|
|
970
|
+
return cm.getGlobalAIChats();
|
|
971
|
+
});
|
|
950
972
|
server2.get("/_web/ai/chats/:id", async (request, reply) => {
|
|
951
973
|
const conv = cm.getAIChat(request.params.id);
|
|
952
974
|
if (!conv) return reply.code(404).send({ error: "AI chat not found" });
|
|
@@ -958,8 +980,14 @@ function registerAiChatRoutes(server2, ctx) {
|
|
|
958
980
|
server2.delete("/_web/ai/chats/:id", async (request) => {
|
|
959
981
|
return cm.deleteAIChat(request.params.id);
|
|
960
982
|
});
|
|
983
|
+
server2.post("/_web/ai/chats/:id/message-pair", async (request) => {
|
|
984
|
+
return cm.addMessagePair(request.params.id, request.body.userMessage, request.body.assistantMessage);
|
|
985
|
+
});
|
|
986
|
+
server2.post("/_web/ai/chats/:id/replace-latest-message-round", async (request) => {
|
|
987
|
+
return cm.replaceLatestMessageRound(request.params.id, request.body);
|
|
988
|
+
});
|
|
961
989
|
server2.post("/_web/ai/chats/:id/messages", async (request) => {
|
|
962
|
-
const { role, content, dataKeywords, dataMessageCount, contentBlocks, tokenUsage } = request.body;
|
|
990
|
+
const { role, content, dataKeywords, dataMessageCount, contentBlocks, tokenUsage, entityRefs } = request.body;
|
|
963
991
|
return cm.addMessage(
|
|
964
992
|
request.params.id,
|
|
965
993
|
role,
|
|
@@ -967,7 +995,8 @@ function registerAiChatRoutes(server2, ctx) {
|
|
|
967
995
|
dataKeywords,
|
|
968
996
|
dataMessageCount,
|
|
969
997
|
contentBlocks,
|
|
970
|
-
tokenUsage
|
|
998
|
+
tokenUsage,
|
|
999
|
+
entityRefs
|
|
971
1000
|
);
|
|
972
1001
|
});
|
|
973
1002
|
server2.get("/_web/ai/chats/:id/messages", async (request) => {
|
|
@@ -989,11 +1018,11 @@ function registerAiChatRoutes(server2, ctx) {
|
|
|
989
1018
|
return cm.forkAIChat(request.params.id, upToMessageId, title);
|
|
990
1019
|
});
|
|
991
1020
|
server2.put("/_web/ai/messages/:messageId/content", async (request, reply) => {
|
|
992
|
-
const { content } = request.body;
|
|
1021
|
+
const { content, entityRefs } = request.body;
|
|
993
1022
|
if (!content || typeof content !== "string") {
|
|
994
1023
|
return reply.code(400).send({ error: "content is required" });
|
|
995
1024
|
}
|
|
996
|
-
cm.updateMessageContent(request.params.messageId, content);
|
|
1025
|
+
cm.updateMessageContent(request.params.messageId, content, entityRefs);
|
|
997
1026
|
return { success: true };
|
|
998
1027
|
});
|
|
999
1028
|
server2.post("/_web/ai/chats/:id/messages/:messageId/delete-relink", async (request, reply) => {
|
|
@@ -1005,11 +1034,19 @@ function registerAiChatRoutes(server2, ctx) {
|
|
|
1005
1034
|
return { success: true };
|
|
1006
1035
|
});
|
|
1007
1036
|
server2.post("/_web/ai/chats/:id/messages/insert-after", async (request, reply) => {
|
|
1008
|
-
const { afterMessageId, role, content, contentBlocks, tokenUsage } = request.body;
|
|
1037
|
+
const { afterMessageId, role, content, contentBlocks, tokenUsage, entityRefs } = request.body;
|
|
1009
1038
|
if (!afterMessageId || typeof afterMessageId !== "string") {
|
|
1010
1039
|
return reply.code(400).send({ error: "afterMessageId is required" });
|
|
1011
1040
|
}
|
|
1012
|
-
return cm.insertMessageAfter(
|
|
1041
|
+
return cm.insertMessageAfter(
|
|
1042
|
+
request.params.id,
|
|
1043
|
+
afterMessageId,
|
|
1044
|
+
role,
|
|
1045
|
+
content,
|
|
1046
|
+
contentBlocks,
|
|
1047
|
+
tokenUsage,
|
|
1048
|
+
entityRefs
|
|
1049
|
+
);
|
|
1013
1050
|
});
|
|
1014
1051
|
server2.get("/_web/ai/chats/:id/token-usage", async (request) => {
|
|
1015
1052
|
return cm.getAIChatTokenUsage(request.params.id);
|
|
@@ -1336,6 +1373,127 @@ function registerAiLogRoutes(server2, ctx) {
|
|
|
1336
1373
|
});
|
|
1337
1374
|
}
|
|
1338
1375
|
|
|
1376
|
+
// ../../packages/http-routes/src/routes/web/ai-memories.ts
|
|
1377
|
+
function parseScope(input) {
|
|
1378
|
+
const scopeType = input.scopeType;
|
|
1379
|
+
if (scopeType !== "global" && scopeType !== "self" && scopeType !== "contact" && scopeType !== "group") {
|
|
1380
|
+
throw new Error("scopeType must be global, self, contact, or group");
|
|
1381
|
+
}
|
|
1382
|
+
return {
|
|
1383
|
+
scopeType,
|
|
1384
|
+
scopeId: typeof input.scopeId === "string" ? input.scopeId : null
|
|
1385
|
+
};
|
|
1386
|
+
}
|
|
1387
|
+
function sendBadRequest(reply, error) {
|
|
1388
|
+
return reply.code(400).send({ error: error instanceof Error ? error.message : String(error) });
|
|
1389
|
+
}
|
|
1390
|
+
function registerAiMemoryRoutes(server2, ctx, memoryProvenanceCoordinator) {
|
|
1391
|
+
const memoryService = ctx.aiMemoryService;
|
|
1392
|
+
if (!memoryService) return;
|
|
1393
|
+
const aiChatManager2 = ctx.aiChatManager;
|
|
1394
|
+
const withSourceStatus = (entry) => ({
|
|
1395
|
+
...entry,
|
|
1396
|
+
sourceStatus: aiChatManager2 ? resolveAIMemorySourceStatus(entry, aiChatManager2) : entry.sourceAIChatId ? "unavailable" : "none"
|
|
1397
|
+
});
|
|
1398
|
+
server2.get("/_web/ai/memories", async (request, reply) => {
|
|
1399
|
+
try {
|
|
1400
|
+
const { scopeType, scopeId } = request.query;
|
|
1401
|
+
if (!scopeType) {
|
|
1402
|
+
if (scopeId != null) throw new Error("scopeType is required when scopeId is provided");
|
|
1403
|
+
return aiChatManager2 ? listAIMemoriesWithSourceStatus(memoryService, aiChatManager2) : memoryService.list().map((entry) => ({
|
|
1404
|
+
...entry,
|
|
1405
|
+
sourceStatus: entry.sourceAIChatId ? "unavailable" : "none"
|
|
1406
|
+
}));
|
|
1407
|
+
}
|
|
1408
|
+
const scope = parseScope({ scopeType, scopeId });
|
|
1409
|
+
return aiChatManager2 ? listAIMemoriesWithSourceStatus(memoryService, aiChatManager2, scope) : memoryService.list(scope).map((entry) => ({
|
|
1410
|
+
...entry,
|
|
1411
|
+
sourceStatus: entry.sourceAIChatId ? "unavailable" : "none"
|
|
1412
|
+
}));
|
|
1413
|
+
} catch (error) {
|
|
1414
|
+
return sendBadRequest(reply, error);
|
|
1415
|
+
}
|
|
1416
|
+
});
|
|
1417
|
+
server2.post("/_web/ai/memories/link-sources", async (request, reply) => {
|
|
1418
|
+
if (!aiChatManager2) {
|
|
1419
|
+
return reply.code(503).send({ error: "AI conversation storage is unavailable" });
|
|
1420
|
+
}
|
|
1421
|
+
try {
|
|
1422
|
+
const body = request.body ?? {};
|
|
1423
|
+
const input = {
|
|
1424
|
+
provenanceToken: body.provenanceToken ?? "",
|
|
1425
|
+
aiChatId: body.aiChatId ?? "",
|
|
1426
|
+
userMessageId: body.userMessageId ?? "",
|
|
1427
|
+
assistantMessageId: body.assistantMessageId ?? "",
|
|
1428
|
+
memoryIds: body.memoryIds ?? []
|
|
1429
|
+
};
|
|
1430
|
+
if (!memoryProvenanceCoordinator) throw new Error("Memory provenance coordination is unavailable");
|
|
1431
|
+
const provenance = memoryProvenanceCoordinator.validate(input.provenanceToken, input.aiChatId, input.memoryIds);
|
|
1432
|
+
const result = linkAIMemorySources(memoryService, aiChatManager2, input, provenance);
|
|
1433
|
+
memoryProvenanceCoordinator.consume(input.provenanceToken);
|
|
1434
|
+
return result;
|
|
1435
|
+
} catch (error) {
|
|
1436
|
+
return sendBadRequest(reply, error);
|
|
1437
|
+
}
|
|
1438
|
+
});
|
|
1439
|
+
server2.post("/_web/ai/memories", async (request, reply) => {
|
|
1440
|
+
try {
|
|
1441
|
+
const scope = parseScope(request.body ?? {});
|
|
1442
|
+
return withSourceStatus(
|
|
1443
|
+
memoryService.create({
|
|
1444
|
+
...scope,
|
|
1445
|
+
content: request.body?.content ?? "",
|
|
1446
|
+
sourceType: "user",
|
|
1447
|
+
sourceAIChatId: null,
|
|
1448
|
+
sourceMessageId: null
|
|
1449
|
+
})
|
|
1450
|
+
);
|
|
1451
|
+
} catch (error) {
|
|
1452
|
+
return sendBadRequest(reply, error);
|
|
1453
|
+
}
|
|
1454
|
+
});
|
|
1455
|
+
server2.put("/_web/ai/memories/:id", async (request, reply) => {
|
|
1456
|
+
if (!memoryService.get(request.params.id)) {
|
|
1457
|
+
return reply.code(404).send({ error: "AI memory not found" });
|
|
1458
|
+
}
|
|
1459
|
+
try {
|
|
1460
|
+
return withSourceStatus(
|
|
1461
|
+
memoryService.update(request.params.id, {
|
|
1462
|
+
content: request.body?.content ?? "",
|
|
1463
|
+
sourceType: "user",
|
|
1464
|
+
sourceAIChatId: null,
|
|
1465
|
+
sourceMessageId: null
|
|
1466
|
+
})
|
|
1467
|
+
);
|
|
1468
|
+
} catch (error) {
|
|
1469
|
+
return sendBadRequest(reply, error);
|
|
1470
|
+
}
|
|
1471
|
+
});
|
|
1472
|
+
server2.delete("/_web/ai/memories/:id", async (request, reply) => {
|
|
1473
|
+
if (!memoryService.forget(request.params.id)) {
|
|
1474
|
+
return reply.code(404).send({ error: "AI memory not found" });
|
|
1475
|
+
}
|
|
1476
|
+
return { success: true };
|
|
1477
|
+
});
|
|
1478
|
+
server2.post("/_web/ai/memories/clear", async (request, reply) => {
|
|
1479
|
+
const { all, scopeType, scopeId } = request.body ?? {};
|
|
1480
|
+
if (all === true) {
|
|
1481
|
+
if (scopeType || scopeId != null) {
|
|
1482
|
+
return reply.code(400).send({ error: "all cannot be combined with a scope" });
|
|
1483
|
+
}
|
|
1484
|
+
return { success: true, cleared: memoryService.clear() };
|
|
1485
|
+
}
|
|
1486
|
+
if (!scopeType) {
|
|
1487
|
+
return reply.code(400).send({ error: "A scope or all: true is required" });
|
|
1488
|
+
}
|
|
1489
|
+
try {
|
|
1490
|
+
return { success: true, cleared: memoryService.clear(parseScope({ scopeType, scopeId })) };
|
|
1491
|
+
} catch (error) {
|
|
1492
|
+
return sendBadRequest(reply, error);
|
|
1493
|
+
}
|
|
1494
|
+
});
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1339
1497
|
// ../../packages/http-routes/src/routes/web/ai-semantic-index.ts
|
|
1340
1498
|
import path2 from "path";
|
|
1341
1499
|
function registerSemanticIndexRoutes(server2, ctx) {
|
|
@@ -1627,10 +1785,53 @@ function registerAiToolRoutes(server2, ctx) {
|
|
|
1627
1785
|
});
|
|
1628
1786
|
}
|
|
1629
1787
|
|
|
1788
|
+
// ../../packages/http-routes/src/routes/web/memory-provenance-coordinator.ts
|
|
1789
|
+
var MemoryProvenanceCoordinator = class {
|
|
1790
|
+
pending = /* @__PURE__ */ new Map();
|
|
1791
|
+
begin(token, aiChatId) {
|
|
1792
|
+
this.pending.set(token, {
|
|
1793
|
+
aiChatId,
|
|
1794
|
+
expectedParentMessageId: null,
|
|
1795
|
+
memoryIds: /* @__PURE__ */ new Set(),
|
|
1796
|
+
completed: false
|
|
1797
|
+
});
|
|
1798
|
+
}
|
|
1799
|
+
record(token, memoryId) {
|
|
1800
|
+
const changeSet = this.pending.get(token);
|
|
1801
|
+
if (!changeSet || changeSet.completed) return;
|
|
1802
|
+
changeSet.memoryIds.add(memoryId);
|
|
1803
|
+
}
|
|
1804
|
+
complete(token, expectedParentMessageId) {
|
|
1805
|
+
const changeSet = this.pending.get(token);
|
|
1806
|
+
if (!changeSet) return;
|
|
1807
|
+
if (changeSet.memoryIds.size === 0) {
|
|
1808
|
+
this.pending.delete(token);
|
|
1809
|
+
return;
|
|
1810
|
+
}
|
|
1811
|
+
changeSet.expectedParentMessageId = expectedParentMessageId;
|
|
1812
|
+
changeSet.completed = true;
|
|
1813
|
+
}
|
|
1814
|
+
validate(token, aiChatId, memoryIds) {
|
|
1815
|
+
const changeSet = this.pending.get(token);
|
|
1816
|
+
if (!changeSet || !changeSet.completed || changeSet.aiChatId !== aiChatId) {
|
|
1817
|
+
throw new Error("Memory provenance token is invalid");
|
|
1818
|
+
}
|
|
1819
|
+
const requestedIds = new Set(memoryIds);
|
|
1820
|
+
if (requestedIds.size !== changeSet.memoryIds.size || [...requestedIds].some((memoryId) => !changeSet.memoryIds.has(memoryId))) {
|
|
1821
|
+
throw new Error("Memory IDs do not match the agent turn change set");
|
|
1822
|
+
}
|
|
1823
|
+
return { expectedParentMessageId: changeSet.expectedParentMessageId };
|
|
1824
|
+
}
|
|
1825
|
+
consume(token) {
|
|
1826
|
+
this.pending.delete(token);
|
|
1827
|
+
}
|
|
1828
|
+
};
|
|
1829
|
+
|
|
1630
1830
|
// ../../packages/http-routes/src/routes/web/register-ai.ts
|
|
1631
1831
|
var REQUIRED_AI_DEPENDENCIES = [
|
|
1632
1832
|
"aiDataDir",
|
|
1633
1833
|
"aiChatManager",
|
|
1834
|
+
"aiMemoryService",
|
|
1634
1835
|
"assistantManager",
|
|
1635
1836
|
"skillManagerCore",
|
|
1636
1837
|
"llmConfigStore",
|
|
@@ -1646,13 +1847,15 @@ function assertRequiredAiContext(ctx) {
|
|
|
1646
1847
|
}
|
|
1647
1848
|
function registerAiRoutes(server2, ctx, options) {
|
|
1648
1849
|
if (options?.requireAi) assertRequiredAiContext(ctx);
|
|
1850
|
+
const memoryProvenanceCoordinator = new MemoryProvenanceCoordinator();
|
|
1649
1851
|
registerAiAssistantRoutes(server2, ctx);
|
|
1650
1852
|
registerAiSkillRoutes(server2, ctx);
|
|
1651
1853
|
registerAiLlmRoutes(server2, ctx);
|
|
1652
1854
|
registerAiLlmStreamRoutes(server2, ctx);
|
|
1653
|
-
registerAiAgentStreamRoutes(server2, ctx);
|
|
1855
|
+
registerAiAgentStreamRoutes(server2, ctx, memoryProvenanceCoordinator);
|
|
1654
1856
|
registerAiToolRoutes(server2, ctx);
|
|
1655
1857
|
registerAiChatRoutes(server2, ctx);
|
|
1858
|
+
registerAiMemoryRoutes(server2, ctx, memoryProvenanceCoordinator);
|
|
1656
1859
|
registerAiChatTopicRoutes(server2, ctx);
|
|
1657
1860
|
registerAiSummaryRoutes(server2, ctx);
|
|
1658
1861
|
registerAiLogRoutes(server2, ctx);
|
|
@@ -3142,7 +3345,8 @@ function registerAutomationRoutes(server2, ctx) {
|
|
|
3142
3345
|
enabled: true,
|
|
3143
3346
|
port: automation.serverInfo.port,
|
|
3144
3347
|
token: automation.serverInfo.token,
|
|
3145
|
-
host: automation.serverInfo.host
|
|
3348
|
+
host: automation.serverInfo.host,
|
|
3349
|
+
socket: automation.serverInfo.socket
|
|
3146
3350
|
};
|
|
3147
3351
|
});
|
|
3148
3352
|
server2.get("/_web/automation/data-sources", async (_request, reply) => {
|
|
@@ -3237,7 +3441,7 @@ function registerAutomationRoutes(server2, ctx) {
|
|
|
3237
3441
|
// src/http/routes/web/import.ts
|
|
3238
3442
|
import * as fs7 from "fs";
|
|
3239
3443
|
import * as path8 from "path";
|
|
3240
|
-
import { randomUUID } from "crypto";
|
|
3444
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
3241
3445
|
import { pipeline } from "stream/promises";
|
|
3242
3446
|
|
|
3243
3447
|
// src/http/routes/web/helpers.ts
|
|
@@ -3292,7 +3496,7 @@ function registerImportRoutes2(server2, dbManager2, options = {}) {
|
|
|
3292
3496
|
limits: { fileSize: ARCHIVE_UPLOAD_LIMIT }
|
|
3293
3497
|
});
|
|
3294
3498
|
if (!data) return reply.code(400).send({ success: false, error: "error.no_file_selected" });
|
|
3295
|
-
const uploadPath = path8.join(getChatLabTempScopeDir("imports"), `archive-${
|
|
3499
|
+
const uploadPath = path8.join(getChatLabTempScopeDir("imports"), `archive-${randomUUID2()}.zip`);
|
|
3296
3500
|
try {
|
|
3297
3501
|
await pipeline(data.file, fs7.createWriteStream(uploadPath, { flags: "wx" }));
|
|
3298
3502
|
if (data.file.truncated) {
|
|
@@ -3442,7 +3646,7 @@ data: ${JSON.stringify(eventData)}
|
|
|
3442
3646
|
const parts = request.parts();
|
|
3443
3647
|
if (!parts) return reply.code(400).send({ error: "No files uploaded" });
|
|
3444
3648
|
const requestedBatchId = request.headers["x-chatlab-import-batch-id"];
|
|
3445
|
-
const batchId = typeof requestedBatchId === "string" && requestedBatchId ? requestedBatchId :
|
|
3649
|
+
const batchId = typeof requestedBatchId === "string" && requestedBatchId ? requestedBatchId : randomUUID2();
|
|
3446
3650
|
if (activeBatchControllers.has(batchId)) {
|
|
3447
3651
|
return reply.code(409).send({ error: "Batch import id is already active" });
|
|
3448
3652
|
}
|
|
@@ -3763,10 +3967,10 @@ function registerWebRoutes2(server2, dbManager2, options) {
|
|
|
3763
3967
|
const resolvedPathProvider = options?.pathProvider ?? fallbackPathProvider;
|
|
3764
3968
|
const ai = options?.aiContext;
|
|
3765
3969
|
const cliStreamImport = async (dm, filePath) => {
|
|
3766
|
-
const { streamImport: streamImport2 } = await import("./stream-import-
|
|
3970
|
+
const { streamImport: streamImport2 } = await import("./stream-import-YYQVZDGQ.mjs");
|
|
3767
3971
|
const result = await streamImport2(dm, filePath);
|
|
3768
3972
|
if (!result.success) {
|
|
3769
|
-
const { IMPORT_IN_PROGRESS_ERROR_KEY: IMPORT_IN_PROGRESS_ERROR_KEY2, ImportInProgressError: ImportInProgressError2 } = await import("./src-
|
|
3973
|
+
const { IMPORT_IN_PROGRESS_ERROR_KEY: IMPORT_IN_PROGRESS_ERROR_KEY2, ImportInProgressError: ImportInProgressError2 } = await import("./src-WE5HNN2O.mjs");
|
|
3770
3974
|
if (result.error === IMPORT_IN_PROGRESS_ERROR_KEY2) throw new ImportInProgressError2();
|
|
3771
3975
|
throw new Error(result.error || "Import failed");
|
|
3772
3976
|
}
|
|
@@ -3791,6 +3995,9 @@ function registerWebRoutes2(server2, dbManager2, options) {
|
|
|
3791
3995
|
getVersion,
|
|
3792
3996
|
nativeBinding: options?.nativeBinding,
|
|
3793
3997
|
semanticIndexService,
|
|
3998
|
+
contactsService: options?.contactsService,
|
|
3999
|
+
globalInsightService: options?.globalInsightService,
|
|
4000
|
+
preferencesManager: options?.preferencesManager,
|
|
3794
4001
|
analyticsService,
|
|
3795
4002
|
getCurrentAiLogPath: () => getServerAiLogger()?.getExistingLogPath() ?? null,
|
|
3796
4003
|
openDirectory: openDirectoryPath,
|
|
@@ -3824,6 +4031,7 @@ function registerWebRoutes2(server2, dbManager2, options) {
|
|
|
3824
4031
|
...ai && {
|
|
3825
4032
|
aiDataDir: ai.aiDataDir,
|
|
3826
4033
|
aiChatManager: ai.aiChatManager,
|
|
4034
|
+
aiMemoryService: ai.aiMemoryService,
|
|
3827
4035
|
assistantManager: ai.assistantManager,
|
|
3828
4036
|
skillManagerCore: ai.skillManagerCore,
|
|
3829
4037
|
llmConfigStore: ai.llmConfigStore,
|
|
@@ -4797,6 +5005,7 @@ function cleanupSync() {
|
|
|
4797
5005
|
var server = null;
|
|
4798
5006
|
var dbManager = null;
|
|
4799
5007
|
var aiChatManager = null;
|
|
5008
|
+
var aiMemoryService = null;
|
|
4800
5009
|
function resolveNativeBinding2() {
|
|
4801
5010
|
if (process.versions.electron) return void 0;
|
|
4802
5011
|
const nativePath = resolveCliPath("native/better_sqlite3.node");
|
|
@@ -4819,7 +5028,9 @@ async function startHttpServer(options) {
|
|
|
4819
5028
|
let config = loadConfig();
|
|
4820
5029
|
const port = options?.port ?? config.api.port;
|
|
4821
5030
|
const host = options?.host ?? config.api.host;
|
|
5031
|
+
const socket = options?.socket;
|
|
4822
5032
|
const token = options?.token ?? ensureToken(config);
|
|
5033
|
+
if (socket) await prepareUnixSocket(socket);
|
|
4823
5034
|
const pendingMigration = applyPendingNodeDataDirMigrationIfNeeded();
|
|
4824
5035
|
if (!pendingMigration.skipped) {
|
|
4825
5036
|
if (pendingMigration.success) {
|
|
@@ -4850,8 +5061,30 @@ async function startHttpServer(options) {
|
|
|
4850
5061
|
await migrationRunner.run();
|
|
4851
5062
|
const nativeBinding = resolveNativeBinding2();
|
|
4852
5063
|
dbManager = new DatabaseManager(pathProvider, { nativeBinding, runtime });
|
|
5064
|
+
const sessionAdapter = createDatabaseManagerAdapter(dbManager);
|
|
5065
|
+
const contactsService = createContactsService({
|
|
5066
|
+
adapter: sessionAdapter,
|
|
5067
|
+
pathProvider,
|
|
5068
|
+
runtimeIdentity: runtime,
|
|
5069
|
+
nativeBinding
|
|
5070
|
+
});
|
|
5071
|
+
const preferencesManager = new PreferencesManager(pathProvider.getSystemDir());
|
|
5072
|
+
const globalInsightService = createGlobalInsightService({
|
|
5073
|
+
adapter: sessionAdapter,
|
|
5074
|
+
pathProvider,
|
|
5075
|
+
runtimeIdentity: runtime,
|
|
5076
|
+
nativeBinding,
|
|
5077
|
+
getExcludedSessionIds: () => preferencesManager.load().ownerExcludedSessionIds
|
|
5078
|
+
});
|
|
5079
|
+
const crossChatAnalysisService = createCrossChatAnalysisService({
|
|
5080
|
+
adapter: sessionAdapter,
|
|
5081
|
+
contactsService,
|
|
5082
|
+
globalInsightService,
|
|
5083
|
+
getExcludedSessionIds: () => preferencesManager.load().ownerExcludedSessionIds
|
|
5084
|
+
});
|
|
4853
5085
|
const aiDataDir = pathProvider.getAiDataDir();
|
|
4854
5086
|
aiChatManager = new AIChatManager(aiDataDir, { nativeBinding });
|
|
5087
|
+
aiMemoryService = new AIMemoryService(aiDataDir, { nativeBinding });
|
|
4855
5088
|
const assistantManager = getAssistantManager(aiDataDir);
|
|
4856
5089
|
const skillManagerCore = getSkillManagerCore(aiDataDir);
|
|
4857
5090
|
const llmRuntimeStores = createLlmRuntimeStores(aiDataDir);
|
|
@@ -4860,7 +5093,10 @@ async function startHttpServer(options) {
|
|
|
4860
5093
|
initServerAiLogger(pathProvider.getLogsDir());
|
|
4861
5094
|
appLogger.info("ai-config", "Shared LLM configuration store initialized", { aiDataDir });
|
|
4862
5095
|
appLogger.info("temp-workspace", "Temporary workspace initialized", { root: pathProvider.getTempDir() });
|
|
4863
|
-
appLogger.info(
|
|
5096
|
+
appLogger.info(
|
|
5097
|
+
"server",
|
|
5098
|
+
socket ? `HTTP server starting on Unix socket ${socket}` : `HTTP server starting on ${host}:${port}`
|
|
5099
|
+
);
|
|
4864
5100
|
logNativeParserStatus();
|
|
4865
5101
|
setAuthToken(token);
|
|
4866
5102
|
setRequireAuth(!!(options?.requireAuth ?? config.api.require_auth));
|
|
@@ -4888,10 +5124,14 @@ async function startHttpServer(options) {
|
|
|
4888
5124
|
pathProvider,
|
|
4889
5125
|
nativeBinding,
|
|
4890
5126
|
runtimeIdentity: runtime,
|
|
5127
|
+
contactsService,
|
|
5128
|
+
globalInsightService,
|
|
5129
|
+
preferencesManager,
|
|
4891
5130
|
semanticIndexService,
|
|
4892
5131
|
aiContext: {
|
|
4893
5132
|
aiDataDir,
|
|
4894
5133
|
aiChatManager,
|
|
5134
|
+
aiMemoryService,
|
|
4895
5135
|
assistantManager,
|
|
4896
5136
|
skillManagerCore,
|
|
4897
5137
|
llmConfigStore,
|
|
@@ -4899,11 +5139,14 @@ async function startHttpServer(options) {
|
|
|
4899
5139
|
customModelStore,
|
|
4900
5140
|
runAgentStream: createCliRunAgentStream(dbManager, aiChatManager, {
|
|
4901
5141
|
llmConfigStore,
|
|
4902
|
-
semanticIndexService
|
|
5142
|
+
semanticIndexService,
|
|
5143
|
+
crossChatAnalysisService,
|
|
5144
|
+
sessionAdapter,
|
|
5145
|
+
memoryService: aiMemoryService
|
|
4903
5146
|
})
|
|
4904
5147
|
}
|
|
4905
5148
|
});
|
|
4906
|
-
initSync(server, dbManager, pathProvider, { port, host, token });
|
|
5149
|
+
initSync(server, dbManager, pathProvider, { port, host, socket, token });
|
|
4907
5150
|
if (options?.webRoot && fs11.existsSync(options.webRoot)) {
|
|
4908
5151
|
registerProxyRoutes(server);
|
|
4909
5152
|
const fastifyStatic = await import("@fastify/static");
|
|
@@ -4916,8 +5159,12 @@ async function startHttpServer(options) {
|
|
|
4916
5159
|
return reply.sendFile("index.html");
|
|
4917
5160
|
});
|
|
4918
5161
|
}
|
|
4919
|
-
|
|
4920
|
-
|
|
5162
|
+
if (socket) {
|
|
5163
|
+
await server.listen({ path: socket });
|
|
5164
|
+
} else {
|
|
5165
|
+
await server.listen({ port, host });
|
|
5166
|
+
}
|
|
5167
|
+
return socket ? { socket, token } : { port, host, token };
|
|
4921
5168
|
}
|
|
4922
5169
|
async function stopHttpServer() {
|
|
4923
5170
|
if (!server) return;
|
|
@@ -4929,6 +5176,10 @@ async function stopHttpServer() {
|
|
|
4929
5176
|
aiChatManager.close();
|
|
4930
5177
|
aiChatManager = null;
|
|
4931
5178
|
}
|
|
5179
|
+
if (aiMemoryService) {
|
|
5180
|
+
aiMemoryService.close();
|
|
5181
|
+
aiMemoryService = null;
|
|
5182
|
+
}
|
|
4932
5183
|
if (dbManager) {
|
|
4933
5184
|
dbManager.closeAll();
|
|
4934
5185
|
dbManager = null;
|
|
@@ -4945,4 +5196,4 @@ export {
|
|
|
4945
5196
|
startHttpServer,
|
|
4946
5197
|
stopHttpServer
|
|
4947
5198
|
};
|
|
4948
|
-
//# sourceMappingURL=chunk-
|
|
5199
|
+
//# sourceMappingURL=chunk-DKIYHA3O.mjs.map
|