chatlab-cli 0.26.0 → 0.26.2
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-ZP4WJVWC.mjs → chat-command-BVIG2LCO.mjs} +4 -4
- package/dist/{chunk-WXC6RZCX.mjs → chunk-3XFHIQIW.mjs} +2 -2
- package/dist/{chunk-UB4XBM4R.mjs → chunk-6AOEMUCM.mjs} +2 -2
- package/dist/{chunk-SJIOPSMM.mjs → chunk-GBQQJJKK.mjs} +93 -75
- package/dist/chunk-GBQQJJKK.mjs.map +1 -0
- package/dist/{chunk-6G7AIF7I.mjs → chunk-GTXX72AQ.mjs} +28 -13
- package/dist/chunk-GTXX72AQ.mjs.map +1 -0
- package/dist/{chunk-ILGSSXOG.mjs → chunk-JFSTXSX2.mjs} +5 -4
- package/dist/chunk-JFSTXSX2.mjs.map +1 -0
- package/dist/{chunk-TC74HESZ.mjs → chunk-QKQRV7RV.mjs} +2 -2
- package/dist/{chunk-IRZRIHIT.mjs → chunk-SCE4YL3M.mjs} +8 -4
- package/dist/chunk-SCE4YL3M.mjs.map +1 -0
- package/dist/{chunk-QY67NN65.mjs → chunk-TMZC3SNX.mjs} +6248 -4318
- package/dist/chunk-TMZC3SNX.mjs.map +1 -0
- package/dist/cli.mjs +3 -3
- package/dist/{http-J3IOFFIA.mjs → http-NLFLQDI7.mjs} +8 -8
- package/dist/{import-POYG5LOX.mjs → import-ILK6MGYR.mjs} +4 -4
- package/dist/index.mjs +8 -8
- package/dist/{mcp-7HH7UMXT.mjs → mcp-FOLR5XJL.mjs} +7 -7
- package/dist/src-OQN3VE73.mjs +439 -0
- package/dist/{stream-import-O3H3FGV2.mjs → stream-import-F5QI2HTO.mjs} +3 -3
- package/dist/stream-import-F5QI2HTO.mjs.map +1 -0
- package/dist-web/assets/DebugToolsPanel.vue_vue_type_script_setup_true_lang-D9mCNaYM.js +182 -0
- package/dist-web/assets/MessageExportModal-ttP_JPqO.js +1 -0
- package/dist-web/assets/{electron-B3DFm1cC.js → electron-BeJHY587.js} +1 -1
- package/dist-web/assets/{electron-BMM4Nfty.js → electron-Dbml-SPN.js} +1 -1
- package/dist-web/assets/{fetch-BaJDB31c.js → fetch-4s20GRbb.js} +1 -1
- package/dist-web/assets/{fetch-C5CLcpQW.js → fetch-B7USXx9R.js} +1 -1
- package/dist-web/assets/fetch-BETFYYe1.js +1 -0
- package/dist-web/assets/{fetch-SYrb-sZe.js → fetch-DBJ7Xkjt.js} +1 -1
- package/dist-web/assets/{fetch-BjDJgdN0.js → fetch-DW8r_JmP.js} +1 -1
- package/dist-web/assets/fetch-DcEBAz_3.js +1 -0
- package/dist-web/assets/{fetch-BFtuJaa1.js → fetch-DsCNr_M0.js} +1 -1
- package/dist-web/assets/{fetch-DQZvdHnG.js → fetch-DtXUkazy.js} +1 -1
- package/dist-web/assets/{fetch-Dhfbt1BQ.js → fetch-H4B1CK_T.js} +1 -1
- package/dist-web/assets/{fetch-ArMjdMcy.js → fetch-rtQEc8Bu.js} +1 -1
- package/dist-web/assets/index-C2ts-hTr.js +173 -0
- package/dist-web/assets/index-CYMTvtEI.js +24 -0
- package/dist-web/assets/index-CjnMyejM.css +1 -0
- package/dist-web/assets/index-CsxrXMkt.js +2 -0
- package/dist-web/assets/index-DkownpUj.js +163 -0
- package/dist-web/assets/{index-DK9LEEzT.js → index-Dov-rTKE.js} +1 -1
- package/dist-web/assets/index-Dtm2oajn.css +1 -0
- package/dist-web/assets/{index-CGNgUIT-.css → index-LCedyGl2.css} +1 -1
- package/dist-web/assets/index-m7v4PP7r.js +11 -0
- package/dist-web/assets/{web-zEXsvoZW.js → web-1-WNRDnP.js} +1 -1
- package/dist-web/index.html +2 -2
- package/package.json +1 -1
- package/dist/chunk-6G7AIF7I.mjs.map +0 -1
- package/dist/chunk-ILGSSXOG.mjs.map +0 -1
- package/dist/chunk-IRZRIHIT.mjs.map +0 -1
- package/dist/chunk-QY67NN65.mjs.map +0 -1
- package/dist/chunk-SJIOPSMM.mjs.map +0 -1
- package/dist-web/assets/DebugToolsPanel.vue_vue_type_script_setup_true_lang-BTJxEma5.js +0 -182
- package/dist-web/assets/MessageExportModal-C7NgEL8T.js +0 -1
- package/dist-web/assets/fetch-BGfaAqO9.js +0 -1
- package/dist-web/assets/fetch-DnEP0uyF.js +0 -1
- package/dist-web/assets/index-C3A_Rjh-.css +0 -1
- package/dist-web/assets/index-CWfkrx37.js +0 -173
- package/dist-web/assets/index-D3N4NDFx.css +0 -1
- package/dist-web/assets/index-D7_ch4zf.js +0 -24
- package/dist-web/assets/index-DqDa_on9.js +0 -9
- package/dist-web/assets/index-DrN1G9bl.js +0 -2
- package/dist-web/assets/index-MdYeovYo.js +0 -163
- /package/dist/{chat-command-ZP4WJVWC.mjs.map → chat-command-BVIG2LCO.mjs.map} +0 -0
- /package/dist/{chunk-WXC6RZCX.mjs.map → chunk-3XFHIQIW.mjs.map} +0 -0
- /package/dist/{chunk-UB4XBM4R.mjs.map → chunk-6AOEMUCM.mjs.map} +0 -0
- /package/dist/{chunk-TC74HESZ.mjs.map → chunk-QKQRV7RV.mjs.map} +0 -0
- /package/dist/{http-J3IOFFIA.mjs.map → http-NLFLQDI7.mjs.map} +0 -0
- /package/dist/{import-POYG5LOX.mjs.map → import-ILK6MGYR.mjs.map} +0 -0
- /package/dist/{mcp-7HH7UMXT.mjs.map → mcp-FOLR5XJL.mjs.map} +0 -0
- /package/dist/{stream-import-O3H3FGV2.mjs.map → src-OQN3VE73.mjs.map} +0 -0
|
@@ -6,9 +6,9 @@ const __filename = __fileURLToPath(import.meta.url);
|
|
|
6
6
|
const __dirname = __pathDirname(__filename);
|
|
7
7
|
import {
|
|
8
8
|
createCliRunAgentStream
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-JFSTXSX2.mjs";
|
|
10
|
+
import "./chunk-SCE4YL3M.mjs";
|
|
11
|
+
import "./chunk-TMZC3SNX.mjs";
|
|
12
12
|
import "./chunk-VSOWNKPA.mjs";
|
|
13
13
|
|
|
14
14
|
// src/ai/chat-command.ts
|
|
@@ -301,4 +301,4 @@ export {
|
|
|
301
301
|
runChatCommand,
|
|
302
302
|
runChatTurn
|
|
303
303
|
};
|
|
304
|
-
//# sourceMappingURL=chat-command-
|
|
304
|
+
//# sourceMappingURL=chat-command-BVIG2LCO.mjs.map
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
buildMemberIdMap,
|
|
11
11
|
generateMessageKey,
|
|
12
12
|
writeParseResultToDb
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-TMZC3SNX.mjs";
|
|
14
14
|
|
|
15
15
|
// src/import/chatlab-reader.ts
|
|
16
16
|
import * as fs from "fs";
|
|
@@ -384,4 +384,4 @@ export {
|
|
|
384
384
|
parseFile,
|
|
385
385
|
importData
|
|
386
386
|
};
|
|
387
|
-
//# sourceMappingURL=chunk-
|
|
387
|
+
//# sourceMappingURL=chunk-3XFHIQIW.mjs.map
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
DataDirCompatibilityError,
|
|
12
12
|
assertDataDirCompatible
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-TMZC3SNX.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-6AOEMUCM.mjs.map
|
|
@@ -7,28 +7,31 @@ const __dirname = __pathDirname(__filename);
|
|
|
7
7
|
import {
|
|
8
8
|
importData,
|
|
9
9
|
parseFile
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-3XFHIQIW.mjs";
|
|
11
11
|
import {
|
|
12
12
|
analyzeIncrementalImport,
|
|
13
13
|
analyzeNewImport,
|
|
14
14
|
incrementalImport,
|
|
15
15
|
streamImport
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-QKQRV7RV.mjs";
|
|
17
17
|
import {
|
|
18
18
|
assertCliDataDirCompatible
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-6AOEMUCM.mjs";
|
|
20
20
|
import {
|
|
21
21
|
getVersion
|
|
22
22
|
} from "./chunk-5ADKYYNA.mjs";
|
|
23
|
+
import {
|
|
24
|
+
resolveCliPath
|
|
25
|
+
} from "./chunk-FJ35V3TE.mjs";
|
|
23
26
|
import {
|
|
24
27
|
closeServerAiLogger,
|
|
25
28
|
createCliRunAgentStream,
|
|
26
29
|
initServerAiLogger
|
|
27
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-JFSTXSX2.mjs";
|
|
28
31
|
import {
|
|
29
32
|
AGENT_TOOL_REGISTRY,
|
|
30
33
|
CoreDataProvider
|
|
31
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-SCE4YL3M.mjs";
|
|
32
35
|
import {
|
|
33
36
|
AIChatManager,
|
|
34
37
|
ALL_MIGRATIONS,
|
|
@@ -67,7 +70,6 @@ import {
|
|
|
67
70
|
exportSessionToJson,
|
|
68
71
|
export_service_exports,
|
|
69
72
|
fetchRemoteModels,
|
|
70
|
-
filterMessagesWithContext,
|
|
71
73
|
findEntryFileInDirectory,
|
|
72
74
|
getAvailableYears,
|
|
73
75
|
getBuiltinModelsByProvider,
|
|
@@ -88,7 +90,6 @@ import {
|
|
|
88
90
|
getMessageLengthDistribution,
|
|
89
91
|
getMessageTypeStats,
|
|
90
92
|
getMonthlyActivity,
|
|
91
|
-
getMultipleSessionsMessages,
|
|
92
93
|
getPendingNodeDataDirMigration,
|
|
93
94
|
getRelationshipStats,
|
|
94
95
|
getSchemaDetailed,
|
|
@@ -106,6 +107,7 @@ import {
|
|
|
106
107
|
loadConfig,
|
|
107
108
|
member_service_exports,
|
|
108
109
|
mergeRulesForLocale,
|
|
110
|
+
owner_profile_service_exports,
|
|
109
111
|
queryMessages,
|
|
110
112
|
resolveApiKey,
|
|
111
113
|
runSimpleLlmStream,
|
|
@@ -121,10 +123,7 @@ import {
|
|
|
121
123
|
verifyCliDataPath,
|
|
122
124
|
writeAuthProfile,
|
|
123
125
|
writeConfigField
|
|
124
|
-
} from "./chunk-
|
|
125
|
-
import {
|
|
126
|
-
resolveCliPath
|
|
127
|
-
} from "./chunk-FJ35V3TE.mjs";
|
|
126
|
+
} from "./chunk-TMZC3SNX.mjs";
|
|
128
127
|
|
|
129
128
|
// src/http/index.ts
|
|
130
129
|
import * as fs9 from "fs";
|
|
@@ -446,6 +445,11 @@ function registerRestSessionRoutes(server2, ctx) {
|
|
|
446
445
|
// ../../packages/http-routes/src/routes/web/sessions.ts
|
|
447
446
|
function registerSessionRoutes(server2, ctx) {
|
|
448
447
|
const { sessionAdapter: adapter } = ctx;
|
|
448
|
+
let preferencesInstance = null;
|
|
449
|
+
const preferences = () => {
|
|
450
|
+
preferencesInstance ??= ctx.preferencesManager ?? new PreferencesManager(ctx.pathProvider.getSystemDir());
|
|
451
|
+
return preferencesInstance;
|
|
452
|
+
};
|
|
449
453
|
server2.get("/_web/sessions", async () => {
|
|
450
454
|
return session_service_exports.listAnalysisSessions(adapter);
|
|
451
455
|
});
|
|
@@ -479,6 +483,24 @@ function registerSessionRoutes(server2, ctx) {
|
|
|
479
483
|
return { success: true };
|
|
480
484
|
}
|
|
481
485
|
);
|
|
486
|
+
server2.post("/_web/sessions/:id/owner/apply-profile", async (request) => {
|
|
487
|
+
return owner_profile_service_exports.tryApplyOwnerProfile(adapter, preferences(), request.params.id);
|
|
488
|
+
});
|
|
489
|
+
server2.post(
|
|
490
|
+
"/_web/sessions/:id/owner/select",
|
|
491
|
+
async (request) => {
|
|
492
|
+
return owner_profile_service_exports.setOwnerAndApplyProfile(
|
|
493
|
+
adapter,
|
|
494
|
+
preferences(),
|
|
495
|
+
request.params.id,
|
|
496
|
+
request.body.ownerPlatformId
|
|
497
|
+
);
|
|
498
|
+
}
|
|
499
|
+
);
|
|
500
|
+
server2.post("/_web/sessions/:id/owner/dismiss-prompt", async (request) => {
|
|
501
|
+
owner_profile_service_exports.dismissOwnerPrompt(preferences(), request.params.id);
|
|
502
|
+
return { success: true };
|
|
503
|
+
});
|
|
482
504
|
}
|
|
483
505
|
|
|
484
506
|
// ../../packages/http-routes/src/routes/web/members.ts
|
|
@@ -780,26 +802,23 @@ function registerSessionIndexRoutes(server2, ctx) {
|
|
|
780
802
|
// ../../packages/http-routes/src/routes/web/export.ts
|
|
781
803
|
function registerExportRoutes(server2, ctx) {
|
|
782
804
|
const { sessionAdapter: adapter } = ctx;
|
|
783
|
-
server2.post("/_web/sessions/:id/export
|
|
805
|
+
server2.post("/_web/sessions/:id/export", async (request, reply) => {
|
|
784
806
|
const { id } = request.params;
|
|
785
807
|
const body = request.body;
|
|
786
808
|
const sessionName = body?.sessionName || id;
|
|
787
|
-
const
|
|
809
|
+
const format = body?.format || "txt";
|
|
810
|
+
const result = export_service_exports.exportFormatted(adapter, {
|
|
788
811
|
sessionId: id,
|
|
789
812
|
sessionName,
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
timeFilter: body.timeFilter,
|
|
793
|
-
senderIds: body.senderIds,
|
|
794
|
-
contextSize: body.contextSize,
|
|
795
|
-
segmentIds: body.segmentIds
|
|
813
|
+
format,
|
|
814
|
+
timeFilter: body.timeFilter
|
|
796
815
|
});
|
|
797
816
|
if (!result.success) {
|
|
798
|
-
return reply.code(500).send({ error: result.error });
|
|
817
|
+
return reply.code(result.totalMessages === 0 ? 404 : 500).send({ error: result.error });
|
|
799
818
|
}
|
|
800
|
-
reply.header("Content-Type",
|
|
801
|
-
reply.header("Content-Disposition", `attachment; filename="${encodeURIComponent(
|
|
802
|
-
return reply.send(content);
|
|
819
|
+
reply.header("Content-Type", result.mimeType);
|
|
820
|
+
reply.header("Content-Disposition", `attachment; filename="${encodeURIComponent(result.filename)}"`);
|
|
821
|
+
return reply.send(result.content);
|
|
803
822
|
});
|
|
804
823
|
}
|
|
805
824
|
|
|
@@ -1165,22 +1184,6 @@ data: ${JSON.stringify(data)}
|
|
|
1165
1184
|
});
|
|
1166
1185
|
}
|
|
1167
1186
|
|
|
1168
|
-
// ../../packages/http-routes/src/routes/web/ai-filter.ts
|
|
1169
|
-
function registerAiFilterRoutes(server2, ctx) {
|
|
1170
|
-
server2.post("/_web/ai/filter-messages", async (request, reply) => {
|
|
1171
|
-
const { sessionId, keywords, timeFilter, senderIds, contextSize, page, pageSize } = request.body;
|
|
1172
|
-
const db = ctx.dbManager.open(sessionId);
|
|
1173
|
-
if (!db) return reply.code(404).send({ error: `Session not found: ${sessionId}` });
|
|
1174
|
-
return filterMessagesWithContext(db, { keywords, timeFilter, senderIds, contextSize, page, pageSize });
|
|
1175
|
-
});
|
|
1176
|
-
server2.post("/_web/ai/multiple-sessions-messages", async (request, reply) => {
|
|
1177
|
-
const { sessionId, segmentIds, page, pageSize } = request.body;
|
|
1178
|
-
const db = ctx.dbManager.open(sessionId);
|
|
1179
|
-
if (!db) return reply.code(404).send({ error: `Session not found: ${sessionId}` });
|
|
1180
|
-
return getMultipleSessionsMessages(db, segmentIds, page, pageSize);
|
|
1181
|
-
});
|
|
1182
|
-
}
|
|
1183
|
-
|
|
1184
1187
|
// ../../packages/http-routes/src/routes/web/ai-tools.ts
|
|
1185
1188
|
var MAX_RESULT_CHARS = 5e5;
|
|
1186
1189
|
var activeToolTests = /* @__PURE__ */ new Map();
|
|
@@ -1833,41 +1836,41 @@ function registerCacheRoutes(server2, ctx) {
|
|
|
1833
1836
|
|
|
1834
1837
|
// ../../packages/http-routes/src/register.ts
|
|
1835
1838
|
function registerSharedRoutes(server2, ctx, options) {
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1839
|
+
const resolvedCtx = ctx.preferencesManager ? ctx : { ...ctx, preferencesManager: new PreferencesManager(ctx.pathProvider.getSystemDir()) };
|
|
1840
|
+
registerSystemRoutes(server2, resolvedCtx);
|
|
1841
|
+
registerRestSessionRoutes(server2, resolvedCtx);
|
|
1842
|
+
registerSessionRoutes(server2, resolvedCtx);
|
|
1843
|
+
registerMemberRoutes(server2, resolvedCtx);
|
|
1844
|
+
registerPreferencesRoutes(server2, resolvedCtx);
|
|
1845
|
+
registerAnalyticsRoutes(server2, resolvedCtx);
|
|
1846
|
+
registerSqlRoutes(server2, resolvedCtx);
|
|
1847
|
+
registerSessionIndexRoutes(server2, resolvedCtx);
|
|
1848
|
+
registerExportRoutes(server2, resolvedCtx);
|
|
1849
|
+
registerNlpRoutes(server2, resolvedCtx);
|
|
1846
1850
|
if (options?.requireAi) {
|
|
1847
1851
|
const missing = [];
|
|
1848
|
-
if (!
|
|
1849
|
-
if (!
|
|
1850
|
-
if (!
|
|
1851
|
-
if (!
|
|
1852
|
-
if (!
|
|
1853
|
-
if (!
|
|
1854
|
-
if (!
|
|
1855
|
-
if (!
|
|
1852
|
+
if (!resolvedCtx.aiDataDir) missing.push("aiDataDir");
|
|
1853
|
+
if (!resolvedCtx.aiChatManager) missing.push("aiChatManager");
|
|
1854
|
+
if (!resolvedCtx.assistantManager) missing.push("assistantManager");
|
|
1855
|
+
if (!resolvedCtx.skillManagerCore) missing.push("skillManagerCore");
|
|
1856
|
+
if (!resolvedCtx.llmConfigStore) missing.push("llmConfigStore");
|
|
1857
|
+
if (!resolvedCtx.customProviderStore) missing.push("customProviderStore");
|
|
1858
|
+
if (!resolvedCtx.customModelStore) missing.push("customModelStore");
|
|
1859
|
+
if (!resolvedCtx.runAgentStream) missing.push("runAgentStream");
|
|
1856
1860
|
if (missing.length > 0) {
|
|
1857
1861
|
throw new Error(`[http-routes] requireAi is set but missing AI dependencies: ${missing.join(", ")}`);
|
|
1858
1862
|
}
|
|
1859
1863
|
}
|
|
1860
|
-
registerAiAssistantRoutes(server2,
|
|
1861
|
-
registerAiSkillRoutes(server2,
|
|
1862
|
-
registerAiLlmRoutes(server2,
|
|
1863
|
-
registerAiLlmStreamRoutes(server2,
|
|
1864
|
-
registerAiAgentStreamRoutes(server2,
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
registerCacheRoutes(server2, ctx);
|
|
1864
|
+
registerAiAssistantRoutes(server2, resolvedCtx);
|
|
1865
|
+
registerAiSkillRoutes(server2, resolvedCtx);
|
|
1866
|
+
registerAiLlmRoutes(server2, resolvedCtx);
|
|
1867
|
+
registerAiLlmStreamRoutes(server2, resolvedCtx);
|
|
1868
|
+
registerAiAgentStreamRoutes(server2, resolvedCtx);
|
|
1869
|
+
registerAiToolRoutes(server2, resolvedCtx);
|
|
1870
|
+
registerAiChatRoutes(server2, resolvedCtx);
|
|
1871
|
+
registerAiSummaryRoutes(server2, resolvedCtx);
|
|
1872
|
+
registerMergeRoutes(server2, resolvedCtx);
|
|
1873
|
+
registerCacheRoutes(server2, resolvedCtx);
|
|
1871
1874
|
}
|
|
1872
1875
|
|
|
1873
1876
|
// ../../packages/http-routes/src/auth.ts
|
|
@@ -2340,7 +2343,7 @@ function registerWebRoutes(server2, dbManager2, options) {
|
|
|
2340
2343
|
const resolvedPathProvider = options?.pathProvider ?? fallbackPathProvider;
|
|
2341
2344
|
const ai = options?.aiContext;
|
|
2342
2345
|
const cliStreamImport = async (dm, filePath) => {
|
|
2343
|
-
const { streamImport: streamImport2 } = await import("./stream-import-
|
|
2346
|
+
const { streamImport: streamImport2 } = await import("./stream-import-F5QI2HTO.mjs");
|
|
2344
2347
|
const result = await streamImport2(dm, filePath);
|
|
2345
2348
|
if (!result.sessionId) throw new Error("Import succeeded but no sessionId returned");
|
|
2346
2349
|
return { sessionId: result.sessionId };
|
|
@@ -2770,6 +2773,7 @@ var PullEngine = class {
|
|
|
2770
2773
|
dsManager;
|
|
2771
2774
|
logger;
|
|
2772
2775
|
isImporting;
|
|
2776
|
+
onSessionImported;
|
|
2773
2777
|
pullingSourceIds = /* @__PURE__ */ new Set();
|
|
2774
2778
|
progressMap = /* @__PURE__ */ new Map();
|
|
2775
2779
|
constructor(options) {
|
|
@@ -2779,6 +2783,7 @@ var PullEngine = class {
|
|
|
2779
2783
|
this.dsManager = options.dsManager;
|
|
2780
2784
|
this.logger = options.logger ?? NOOP_LOGGER;
|
|
2781
2785
|
this.isImporting = options.isImporting ?? (() => false);
|
|
2786
|
+
this.onSessionImported = options.onSessionImported;
|
|
2782
2787
|
}
|
|
2783
2788
|
getProgress() {
|
|
2784
2789
|
return Array.from(this.progressMap.values());
|
|
@@ -2976,6 +2981,13 @@ var PullEngine = class {
|
|
|
2976
2981
|
if (totalNewMessages > 0) this.notifier.onSessionListChanged();
|
|
2977
2982
|
this.notifier.onPullResult(sourceId, sess.id, "success", `+${totalNewMessages} messages`);
|
|
2978
2983
|
this.markProgressDone(sess.id);
|
|
2984
|
+
if (this.onSessionImported && sess.targetSessionId) {
|
|
2985
|
+
try {
|
|
2986
|
+
this.onSessionImported(sess.targetSessionId);
|
|
2987
|
+
} catch (hookErr) {
|
|
2988
|
+
this.logger.warn(`[Pull] onSessionImported hook failed for "${sess.name}": ${hookErr}`);
|
|
2989
|
+
}
|
|
2990
|
+
}
|
|
2979
2991
|
return { success: true, newMessageCount: totalNewMessages };
|
|
2980
2992
|
} catch (error) {
|
|
2981
2993
|
const errMsg = error.message || "Pull failed";
|
|
@@ -3281,10 +3293,7 @@ function registerAutomationRoutes(server2, ctx) {
|
|
|
3281
3293
|
if (!removed) return reply.code(404).send({ error: "Session not found" });
|
|
3282
3294
|
reloadTimer(request.params.id);
|
|
3283
3295
|
if (request.query.deleteData === "true" && removed.targetSessionId) {
|
|
3284
|
-
dbManager2.
|
|
3285
|
-
const dbPath = dbManager2.getDbPath(removed.targetSessionId);
|
|
3286
|
-
const fs10 = await import("fs");
|
|
3287
|
-
if (fs10.existsSync(dbPath)) fs10.unlinkSync(dbPath);
|
|
3296
|
+
dbManager2.deleteSessionDatabaseFiles(removed.targetSessionId);
|
|
3288
3297
|
}
|
|
3289
3298
|
return { success: true };
|
|
3290
3299
|
});
|
|
@@ -3336,12 +3345,21 @@ function initSync(server2, dbManager2, pathProvider, serverInfo) {
|
|
|
3336
3345
|
const fetcher = new NodeFetcher();
|
|
3337
3346
|
const importer = new DirectImporter(dbManager2, syncLogger);
|
|
3338
3347
|
const notifier = new NoopNotifier();
|
|
3348
|
+
const sessionAdapter = createDatabaseManagerAdapter(dbManager2);
|
|
3349
|
+
const preferences = new PreferencesManager(pathProvider.getSystemDir());
|
|
3339
3350
|
pullEngine = new PullEngine({
|
|
3340
3351
|
fetcher,
|
|
3341
3352
|
importer,
|
|
3342
3353
|
notifier,
|
|
3343
3354
|
dsManager,
|
|
3344
|
-
logger: syncLogger
|
|
3355
|
+
logger: syncLogger,
|
|
3356
|
+
onSessionImported: (localSessionId) => {
|
|
3357
|
+
preferences.invalidateCache();
|
|
3358
|
+
const result = owner_profile_service_exports.tryApplyOwnerProfile(sessionAdapter, preferences, localSessionId);
|
|
3359
|
+
if (result.applied) {
|
|
3360
|
+
syncLogger.info(`[Pull] Applied owner profile to session ${localSessionId} (owner: ${result.ownerId})`);
|
|
3361
|
+
}
|
|
3362
|
+
}
|
|
3345
3363
|
});
|
|
3346
3364
|
registerAutomationRoutes(server2, { dsManager, pullEngine, dbManager: dbManager2, serverInfo });
|
|
3347
3365
|
initScheduler({
|
|
@@ -3505,4 +3523,4 @@ export {
|
|
|
3505
3523
|
startHttpServer,
|
|
3506
3524
|
stopHttpServer
|
|
3507
3525
|
};
|
|
3508
|
-
//# sourceMappingURL=chunk-
|
|
3526
|
+
//# sourceMappingURL=chunk-GBQQJJKK.mjs.map
|