chatlab-cli 0.27.2 → 0.28.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/README.md +1 -1
- package/dist/{chat-command-QVCZVDSB.mjs → chat-command-7WL5NMZ6.mjs} +5 -5
- package/dist/{chunk-B2VLK3FB.mjs → chunk-55WR6WKW.mjs} +50 -18
- package/dist/{chunk-B2VLK3FB.mjs.map → chunk-55WR6WKW.mjs.map} +1 -1
- package/dist/{chunk-K7UUN3HT.mjs → chunk-GFRG7TZQ.mjs} +27 -12
- package/dist/chunk-GFRG7TZQ.mjs.map +1 -0
- package/dist/{chunk-DHRSLYUM.mjs → chunk-GPF34WXV.mjs} +2470 -330
- package/dist/chunk-GPF34WXV.mjs.map +1 -0
- package/dist/{chunk-OD3YH23N.mjs → chunk-VASK54KT.mjs} +2 -2
- package/dist/{chunk-H22VDCPB.mjs → chunk-WGS33EWH.mjs} +2 -2
- package/dist/{chunk-PXWAYFII.mjs → chunk-XNU5X7EV.mjs} +3 -3
- package/dist/{chunk-JOXF6ROV.mjs → chunk-YQ2FJGBT.mjs} +137 -18
- package/dist/chunk-YQ2FJGBT.mjs.map +1 -0
- package/dist/{chunk-ST5APJB2.mjs → chunk-YZDEZ6UI.mjs} +3 -3
- package/dist/{chunk-MDDWX2MG.mjs → chunk-ZSFVX6FM.mjs} +3 -3
- package/dist/cli.mjs +4 -4
- package/dist/{http-LSCVGWCI.mjs → http-C2FBHNZG.mjs} +9 -9
- package/dist/{import-E6HBJMMT.mjs → import-ED6JCPSJ.mjs} +5 -5
- package/dist/index.mjs +9 -9
- package/dist/{mcp-I7JUC5JV.mjs → mcp-5JIBER4M.mjs} +5 -5
- package/dist/semantic-index-worker.mjs +1 -1
- package/dist/{src-HZILDI7C.mjs → src-WBNM42SL.mjs} +19 -3
- package/dist/{stream-import-IMRULRS2.mjs → stream-import-37U3SROO.mjs} +4 -4
- package/dist/{worker-runtime-WWQ7W74Q.mjs → worker-runtime-6DGYL4TF.mjs} +2 -2
- package/dist-web/assets/{DebugToolsPanel.vue_vue_type_script_setup_true_lang-Du1FDD8L.js → DebugToolsPanel.vue_vue_type_script_setup_true_lang-CCz0Syxo.js} +5 -5
- package/dist-web/assets/{MessageExportModal-4ehLHG4x.js → MessageExportModal-Dd6R-cX_.js} +1 -1
- package/dist-web/assets/electron-D9vE5t3H.js +1 -0
- package/dist-web/assets/{electron-B3AteJC8.js → electron-DjminAKK.js} +1 -1
- package/dist-web/assets/{fetch-BUcl-Frr.js → fetch-B_kLRm6-.js} +1 -1
- package/dist-web/assets/{fetch-DZFx8FA4.js → fetch-CURbMNJV.js} +1 -1
- package/dist-web/assets/fetch-Cle6QKmL.js +3 -0
- package/dist-web/assets/{fetch-BQxv_UGQ.js → fetch-DFCYOQe5.js} +1 -1
- package/dist-web/assets/{fetch-ChZEF_n3.js → fetch-DOhCQ5J8.js} +1 -1
- package/dist-web/assets/{fetch-BwQh9WUD.js → fetch-DV8A1dGB.js} +1 -1
- package/dist-web/assets/{fetch-DlJFgbum.js → fetch-Wad5mWVH.js} +1 -1
- package/dist-web/assets/{fetch-DCQN6wfR.js → fetch-r83wdzHy.js} +1 -1
- package/dist-web/assets/{fetch-CZDFhvxY.js → fetch-srCJzcWc.js} +1 -1
- package/dist-web/assets/{fetch-C2mSdG3h.js → fetch-uM3erGZm.js} +1 -1
- package/dist-web/assets/index-7E5GSvR2.css +1 -0
- package/dist-web/assets/index-BCRHSc1k.js +173 -0
- package/dist-web/assets/{index-DlkH2E7N.js → index-BIvLzdwg.js} +1 -1
- package/dist-web/assets/{index-qVTX1tLg.js → index-BpszRZ8V.js} +3 -3
- package/dist-web/assets/index-D5UgZUpS.js +12 -0
- package/dist-web/assets/{index-DTlfOd_u.js → index-hOsKRsp6.js} +2 -2
- package/dist-web/assets/{index-KAFPL6dl.js → index-tkbEq8av.js} +1 -1
- package/dist-web/assets/{web-CoKgy4Oo.js → web-D27K6zSX.js} +1 -1
- package/dist-web/index.html +2 -2
- package/package.json +1 -1
- package/dist/chunk-DHRSLYUM.mjs.map +0 -1
- package/dist/chunk-JOXF6ROV.mjs.map +0 -1
- package/dist/chunk-K7UUN3HT.mjs.map +0 -1
- package/dist-web/assets/electron-2m4Vdk2z.js +0 -1
- package/dist-web/assets/fetch-O8M5ZWsc.js +0 -3
- package/dist-web/assets/index-B_uZZGqi.js +0 -173
- package/dist-web/assets/index-CoX0L-A8.css +0 -1
- package/dist-web/assets/index-DR78oafF.js +0 -11
- /package/dist/{chat-command-QVCZVDSB.mjs.map → chat-command-7WL5NMZ6.mjs.map} +0 -0
- /package/dist/{chunk-OD3YH23N.mjs.map → chunk-VASK54KT.mjs.map} +0 -0
- /package/dist/{chunk-H22VDCPB.mjs.map → chunk-WGS33EWH.mjs.map} +0 -0
- /package/dist/{chunk-PXWAYFII.mjs.map → chunk-XNU5X7EV.mjs.map} +0 -0
- /package/dist/{chunk-ST5APJB2.mjs.map → chunk-YZDEZ6UI.mjs.map} +0 -0
- /package/dist/{chunk-MDDWX2MG.mjs.map → chunk-ZSFVX6FM.mjs.map} +0 -0
- /package/dist/{http-LSCVGWCI.mjs.map → http-C2FBHNZG.mjs.map} +0 -0
- /package/dist/{import-E6HBJMMT.mjs.map → import-ED6JCPSJ.mjs.map} +0 -0
- /package/dist/{mcp-I7JUC5JV.mjs.map → mcp-5JIBER4M.mjs.map} +0 -0
- /package/dist/{src-HZILDI7C.mjs.map → src-WBNM42SL.mjs.map} +0 -0
- /package/dist/{stream-import-IMRULRS2.mjs.map → stream-import-37U3SROO.mjs.map} +0 -0
- /package/dist/{worker-runtime-WWQ7W74Q.mjs.map → worker-runtime-6DGYL4TF.mjs.map} +0 -0
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
getSessionOverview,
|
|
27
27
|
getWeekdayActivity,
|
|
28
28
|
searchMessagesByKeywords
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-55WR6WKW.mjs";
|
|
30
30
|
|
|
31
31
|
// ../../packages/tools/src/definitions/sql-query.ts
|
|
32
32
|
var inputSchema = {
|
|
@@ -1828,4 +1828,4 @@ export {
|
|
|
1828
1828
|
MCP_TOOL_REGISTRY,
|
|
1829
1829
|
CoreDataProvider
|
|
1830
1830
|
};
|
|
1831
|
-
//# sourceMappingURL=chunk-
|
|
1831
|
+
//# sourceMappingURL=chunk-VASK54KT.mjs.map
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
DataDirCompatibilityError,
|
|
12
12
|
assertDataDirCompatible
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-55WR6WKW.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-WGS33EWH.mjs.map
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
AGENT_TOOL_REGISTRY,
|
|
9
9
|
CoreDataProvider,
|
|
10
10
|
SEMANTIC_SEARCH_TOOL_NAME
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-VASK54KT.mjs";
|
|
12
12
|
import {
|
|
13
13
|
AgentEventHandler,
|
|
14
14
|
AiLogger,
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
runAgentCore,
|
|
48
48
|
shouldUseChartCapabilityForMessage,
|
|
49
49
|
wrapWithChartSchemaGate
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-55WR6WKW.mjs";
|
|
51
51
|
|
|
52
52
|
// src/ai/logger.ts
|
|
53
53
|
var logger = null;
|
|
@@ -582,4 +582,4 @@ export {
|
|
|
582
582
|
closeServerAiLogger,
|
|
583
583
|
createCliRunAgentStream
|
|
584
584
|
};
|
|
585
|
-
//# sourceMappingURL=chunk-
|
|
585
|
+
//# sourceMappingURL=chunk-XNU5X7EV.mjs.map
|
|
@@ -8,14 +8,14 @@ import {
|
|
|
8
8
|
closeServerAiLogger,
|
|
9
9
|
createCliRunAgentStream,
|
|
10
10
|
initServerAiLogger
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-XNU5X7EV.mjs";
|
|
12
12
|
import {
|
|
13
13
|
AGENT_TOOL_REGISTRY,
|
|
14
14
|
CoreDataProvider
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-VASK54KT.mjs";
|
|
16
16
|
import {
|
|
17
17
|
assertCliDataDirCompatible
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-WGS33EWH.mjs";
|
|
19
19
|
import {
|
|
20
20
|
getVersion
|
|
21
21
|
} from "./chunk-5ADKYYNA.mjs";
|
|
@@ -25,17 +25,20 @@ import {
|
|
|
25
25
|
import {
|
|
26
26
|
importData,
|
|
27
27
|
parseFile
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-YZDEZ6UI.mjs";
|
|
29
29
|
import {
|
|
30
30
|
analyzeIncrementalImport,
|
|
31
31
|
analyzeNewImport,
|
|
32
32
|
incrementalImport,
|
|
33
33
|
streamImport
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-ZSFVX6FM.mjs";
|
|
35
35
|
import {
|
|
36
36
|
AnalyticsService,
|
|
37
|
+
ArchiveImportError,
|
|
38
|
+
ArchiveImportSourceManager,
|
|
37
39
|
NodePathProvider,
|
|
38
40
|
PreferencesManager,
|
|
41
|
+
appLogger,
|
|
39
42
|
applyPendingNodeDataDirMigrationIfNeeded,
|
|
40
43
|
buildMergedOutput,
|
|
41
44
|
checkConflictsFromSources,
|
|
@@ -51,10 +54,11 @@ import {
|
|
|
51
54
|
getPendingNodeDataDirMigration,
|
|
52
55
|
getSupportedFormats,
|
|
53
56
|
hasPendingElectronDataWarning,
|
|
57
|
+
initAppLogger,
|
|
54
58
|
scanMultiChatFile,
|
|
55
59
|
serializeChatLabToJsonl,
|
|
56
60
|
streamParseFileInfo
|
|
57
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-GPF34WXV.mjs";
|
|
58
62
|
import {
|
|
59
63
|
AIChatManager,
|
|
60
64
|
ALL_MIGRATIONS,
|
|
@@ -145,7 +149,7 @@ import {
|
|
|
145
149
|
verifyCliDataPath,
|
|
146
150
|
writeAuthProfile,
|
|
147
151
|
writeConfigField
|
|
148
|
-
} from "./chunk-
|
|
152
|
+
} from "./chunk-55WR6WKW.mjs";
|
|
149
153
|
|
|
150
154
|
// src/http/index.ts
|
|
151
155
|
import * as fs11 from "fs";
|
|
@@ -1638,7 +1642,10 @@ function registerSemanticIndexRoutes(server2, ctx) {
|
|
|
1638
1642
|
apiKeySet: resolveSemanticIndexApiKeySet(config, ctx.resolveApiKey),
|
|
1639
1643
|
configured: isSemanticIndexConfigured(config)
|
|
1640
1644
|
});
|
|
1641
|
-
server2.get("/_web/ai/semantic-index/config", async () =>
|
|
1645
|
+
server2.get("/_web/ai/semantic-index/config", async () => ({
|
|
1646
|
+
...configResponse(configStore.get()),
|
|
1647
|
+
modelStatus: "idle"
|
|
1648
|
+
}));
|
|
1642
1649
|
server2.put(
|
|
1643
1650
|
"/_web/ai/semantic-index/config",
|
|
1644
1651
|
async (request) => {
|
|
@@ -1646,7 +1653,7 @@ function registerSemanticIndexRoutes(server2, ctx) {
|
|
|
1646
1653
|
apiKey: request.body.apiKey,
|
|
1647
1654
|
writeAuthProfile: ctx.writeAuthProfile
|
|
1648
1655
|
});
|
|
1649
|
-
return configResponse(config);
|
|
1656
|
+
return { ...configResponse(config), modelStatus: "idle" };
|
|
1650
1657
|
}
|
|
1651
1658
|
);
|
|
1652
1659
|
}
|
|
@@ -1659,14 +1666,20 @@ function registerSemanticIndexRoutes(server2, ctx) {
|
|
|
1659
1666
|
return {
|
|
1660
1667
|
config: await service.getConfig(),
|
|
1661
1668
|
apiKeySet: await service.hasApiKey(),
|
|
1662
|
-
configured: await service.isConfigured()
|
|
1669
|
+
configured: await service.isConfigured(),
|
|
1670
|
+
modelStatus: await service.getModelStatus()
|
|
1663
1671
|
};
|
|
1664
1672
|
});
|
|
1665
1673
|
server2.put(
|
|
1666
1674
|
"/_web/ai/semantic-index/config",
|
|
1667
1675
|
async (request) => {
|
|
1668
1676
|
const config = await service.setConfig(request.body.config, { apiKey: request.body.apiKey });
|
|
1669
|
-
return {
|
|
1677
|
+
return {
|
|
1678
|
+
config,
|
|
1679
|
+
apiKeySet: await service.hasApiKey(),
|
|
1680
|
+
configured: await service.isConfigured(),
|
|
1681
|
+
modelStatus: await service.getModelStatus()
|
|
1682
|
+
};
|
|
1670
1683
|
}
|
|
1671
1684
|
);
|
|
1672
1685
|
server2.get("/_web/ai/semantic-index/enabled", async () => {
|
|
@@ -1687,7 +1700,7 @@ function registerSemanticIndexRoutes(server2, ctx) {
|
|
|
1687
1700
|
});
|
|
1688
1701
|
};
|
|
1689
1702
|
sessionAction("/_web/ai/semantic-index/enable", (id) => service.enable(id));
|
|
1690
|
-
sessionAction("/_web/ai/semantic-index/
|
|
1703
|
+
sessionAction("/_web/ai/semantic-index/remove", (id) => service.remove(id));
|
|
1691
1704
|
sessionAction("/_web/ai/semantic-index/build", (id) => service.build(id));
|
|
1692
1705
|
sessionAction("/_web/ai/semantic-index/pause", (id) => service.pause(id));
|
|
1693
1706
|
sessionAction("/_web/ai/semantic-index/cancel", (id) => service.cancel(id));
|
|
@@ -2156,6 +2169,19 @@ function registerTelemetryRoutes(server2, ctx) {
|
|
|
2156
2169
|
);
|
|
2157
2170
|
}
|
|
2158
2171
|
|
|
2172
|
+
// ../../packages/http-routes/src/routes/web/logs.ts
|
|
2173
|
+
function registerLogRoutes(server2, _ctx) {
|
|
2174
|
+
server2.post("/_web/logs/report", async (req, reply) => {
|
|
2175
|
+
const { level, message, stack, url } = req.body ?? {};
|
|
2176
|
+
if (!message) return reply.code(400).send({ error: "message required" });
|
|
2177
|
+
const detail = [url ? `url=${url}` : null, stack ? `
|
|
2178
|
+
${stack}` : null].filter(Boolean).join(" ");
|
|
2179
|
+
if (level === "warn") appLogger.warn("web", message, detail || void 0);
|
|
2180
|
+
else appLogger.error("web", message, detail || void 0);
|
|
2181
|
+
return { ok: true };
|
|
2182
|
+
});
|
|
2183
|
+
}
|
|
2184
|
+
|
|
2159
2185
|
// ../../packages/http-routes/src/register.ts
|
|
2160
2186
|
function registerSharedRoutes(server2, ctx, options) {
|
|
2161
2187
|
const resolvedCtx = ctx.preferencesManager ? ctx : { ...ctx, preferencesManager: new PreferencesManager(ctx.pathProvider.getSystemDir()) };
|
|
@@ -2195,6 +2221,7 @@ function registerSharedRoutes(server2, ctx, options) {
|
|
|
2195
2221
|
registerMergeRoutes(server2, resolvedCtx);
|
|
2196
2222
|
registerCacheRoutes(server2, resolvedCtx);
|
|
2197
2223
|
registerTelemetryRoutes(server2, resolvedCtx);
|
|
2224
|
+
registerLogRoutes(server2, resolvedCtx);
|
|
2198
2225
|
}
|
|
2199
2226
|
|
|
2200
2227
|
// ../../packages/http-routes/src/auth.ts
|
|
@@ -2248,7 +2275,7 @@ function createServer() {
|
|
|
2248
2275
|
bodyLimit: JSON_BODY_LIMIT
|
|
2249
2276
|
});
|
|
2250
2277
|
server2.addHook("onRequest", authHook);
|
|
2251
|
-
server2.setErrorHandler((error,
|
|
2278
|
+
server2.setErrorHandler((error, request, reply) => {
|
|
2252
2279
|
const apiError = apiErrorFromUnknown(error);
|
|
2253
2280
|
if (apiError) {
|
|
2254
2281
|
reply.code(apiError.statusCode).send(errorResponse(apiError));
|
|
@@ -2264,6 +2291,7 @@ function createServer() {
|
|
|
2264
2291
|
reply.code(statusCode).send({ success: false, error: { code: "CLIENT_ERROR", message: error.message } });
|
|
2265
2292
|
return;
|
|
2266
2293
|
}
|
|
2294
|
+
appLogger.error("http", `${request.method} ${request.url} -> 500`, error);
|
|
2267
2295
|
const err = serverError(error.message);
|
|
2268
2296
|
reply.code(err.statusCode).send(errorResponse(err));
|
|
2269
2297
|
});
|
|
@@ -2278,6 +2306,8 @@ import * as path9 from "path";
|
|
|
2278
2306
|
import * as fs6 from "fs";
|
|
2279
2307
|
import * as os2 from "os";
|
|
2280
2308
|
import * as path7 from "path";
|
|
2309
|
+
import { randomUUID } from "crypto";
|
|
2310
|
+
import { pipeline } from "stream/promises";
|
|
2281
2311
|
|
|
2282
2312
|
// src/http/routes/web/helpers.ts
|
|
2283
2313
|
import * as fs5 from "fs";
|
|
@@ -2290,6 +2320,7 @@ function resolveNativeBinding() {
|
|
|
2290
2320
|
|
|
2291
2321
|
// src/http/routes/web/import.ts
|
|
2292
2322
|
var DEMO_BASE_URL = "https://chatlab.fun/assets/demo";
|
|
2323
|
+
var ARCHIVE_UPLOAD_LIMIT = 50 * 1024 * 1024 * 1024;
|
|
2293
2324
|
function cleanupTemp(...paths) {
|
|
2294
2325
|
for (const p of paths) {
|
|
2295
2326
|
try {
|
|
@@ -2303,7 +2334,93 @@ function cleanupTemp(...paths) {
|
|
|
2303
2334
|
}
|
|
2304
2335
|
}
|
|
2305
2336
|
}
|
|
2306
|
-
function registerImportRoutes(server2, dbManager2) {
|
|
2337
|
+
function registerImportRoutes(server2, dbManager2, options = {}) {
|
|
2338
|
+
const sourceManager = options.sourceManager ?? new ArchiveImportSourceManager({
|
|
2339
|
+
tempRoot: fs6.mkdtempSync(path7.join(os2.tmpdir(), "chatlab-import-sources-"))
|
|
2340
|
+
});
|
|
2341
|
+
const runPreparedImport = options.runPreparedImport ?? (async (manifestPath, onProgress) => {
|
|
2342
|
+
const result = await streamImport(dbManager2, manifestPath, {
|
|
2343
|
+
formatId: "google-chat-takeout",
|
|
2344
|
+
nativeBinding: resolveNativeBinding(),
|
|
2345
|
+
onProgress
|
|
2346
|
+
});
|
|
2347
|
+
return {
|
|
2348
|
+
success: result.success,
|
|
2349
|
+
sessionId: result.sessionId,
|
|
2350
|
+
error: result.error,
|
|
2351
|
+
messageCount: result.diagnostics?.messagesWritten ?? 0,
|
|
2352
|
+
memberCount: 0
|
|
2353
|
+
};
|
|
2354
|
+
});
|
|
2355
|
+
server2.addHook("onClose", async () => {
|
|
2356
|
+
await sourceManager.close();
|
|
2357
|
+
});
|
|
2358
|
+
server2.post("/_web/import-sources", async (request, reply) => {
|
|
2359
|
+
const data = await request.file({
|
|
2360
|
+
limits: { fileSize: ARCHIVE_UPLOAD_LIMIT }
|
|
2361
|
+
});
|
|
2362
|
+
if (!data) return reply.code(400).send({ success: false, error: "error.no_file_selected" });
|
|
2363
|
+
const uploadPath = path7.join(os2.tmpdir(), `chatlab-archive-${randomUUID()}.zip`);
|
|
2364
|
+
try {
|
|
2365
|
+
await pipeline(data.file, fs6.createWriteStream(uploadPath, { flags: "wx" }));
|
|
2366
|
+
if (data.file.truncated) {
|
|
2367
|
+
cleanupTemp(uploadPath);
|
|
2368
|
+
return reply.code(413).send({ success: false, error: "error.archive_limit_exceeded" });
|
|
2369
|
+
}
|
|
2370
|
+
const source = await sourceManager.prepareOwnedArchive(uploadPath);
|
|
2371
|
+
return { success: true, source };
|
|
2372
|
+
} catch (error) {
|
|
2373
|
+
cleanupTemp(uploadPath);
|
|
2374
|
+
if (error instanceof ArchiveImportError) {
|
|
2375
|
+
return reply.code(400).send({ success: false, error: error.code });
|
|
2376
|
+
}
|
|
2377
|
+
return reply.code(400).send({
|
|
2378
|
+
success: false,
|
|
2379
|
+
error: error instanceof Error ? error.message : String(error)
|
|
2380
|
+
});
|
|
2381
|
+
}
|
|
2382
|
+
});
|
|
2383
|
+
server2.post(
|
|
2384
|
+
"/_web/import-sources/:sourceId/import",
|
|
2385
|
+
async (request, reply) => {
|
|
2386
|
+
const chatId = request.body?.chatId;
|
|
2387
|
+
if (!chatId) return reply.code(400).send({ success: false, error: "error.no_chat_selected" });
|
|
2388
|
+
reply.raw.writeHead(200, {
|
|
2389
|
+
"Content-Type": "text/event-stream",
|
|
2390
|
+
"Cache-Control": "no-cache",
|
|
2391
|
+
Connection: "keep-alive"
|
|
2392
|
+
});
|
|
2393
|
+
function sendEvent(event, eventData) {
|
|
2394
|
+
reply.raw.write(`event: ${event}
|
|
2395
|
+
data: ${JSON.stringify(eventData)}
|
|
2396
|
+
|
|
2397
|
+
`);
|
|
2398
|
+
}
|
|
2399
|
+
try {
|
|
2400
|
+
const result = await sourceManager.withMaterializedChat(
|
|
2401
|
+
request.params.sourceId,
|
|
2402
|
+
chatId,
|
|
2403
|
+
(manifestPath) => runPreparedImport(manifestPath, (progress) => sendEvent("progress", progress))
|
|
2404
|
+
);
|
|
2405
|
+
if (result.success) {
|
|
2406
|
+
sendEvent("done", result);
|
|
2407
|
+
} else {
|
|
2408
|
+
sendEvent("error", { success: false, error: result.error || "error.import_failed" });
|
|
2409
|
+
}
|
|
2410
|
+
} catch (error) {
|
|
2411
|
+
sendEvent("error", {
|
|
2412
|
+
success: false,
|
|
2413
|
+
error: error instanceof ArchiveImportError ? error.code : error instanceof Error ? error.message : String(error)
|
|
2414
|
+
});
|
|
2415
|
+
} finally {
|
|
2416
|
+
reply.raw.end();
|
|
2417
|
+
}
|
|
2418
|
+
}
|
|
2419
|
+
);
|
|
2420
|
+
server2.delete("/_web/import-sources/:sourceId", async (request) => {
|
|
2421
|
+
await sourceManager.release(request.params.sourceId);
|
|
2422
|
+
return { success: true };
|
|
2423
|
+
});
|
|
2307
2424
|
server2.get("/_web/supported-formats", async () => {
|
|
2308
2425
|
return getSupportedFormats();
|
|
2309
2426
|
});
|
|
@@ -2668,7 +2785,7 @@ function registerWebRoutes(server2, dbManager2, options) {
|
|
|
2668
2785
|
const resolvedPathProvider = options?.pathProvider ?? fallbackPathProvider;
|
|
2669
2786
|
const ai = options?.aiContext;
|
|
2670
2787
|
const cliStreamImport = async (dm, filePath) => {
|
|
2671
|
-
const { streamImport: streamImport2 } = await import("./stream-import-
|
|
2788
|
+
const { streamImport: streamImport2 } = await import("./stream-import-37U3SROO.mjs");
|
|
2672
2789
|
const result = await streamImport2(dm, filePath);
|
|
2673
2790
|
if (!result.sessionId) throw new Error("Import succeeded but no sessionId returned");
|
|
2674
2791
|
return { sessionId: result.sessionId };
|
|
@@ -2771,7 +2888,7 @@ function registerProxyRoutes(server2) {
|
|
|
2771
2888
|
// src/ai/manager-factory.ts
|
|
2772
2889
|
import * as fs7 from "fs";
|
|
2773
2890
|
import * as path10 from "path";
|
|
2774
|
-
import { createHash, randomUUID } from "crypto";
|
|
2891
|
+
import { createHash, randomUUID as randomUUID2 } from "crypto";
|
|
2775
2892
|
var nodeFs = {
|
|
2776
2893
|
ensureDir(dir) {
|
|
2777
2894
|
if (!fs7.existsSync(dir)) fs7.mkdirSync(dir, { recursive: true });
|
|
@@ -2805,7 +2922,7 @@ function getAssistantManager(aiDataDir) {
|
|
|
2805
2922
|
fs: nodeFs,
|
|
2806
2923
|
assistantsDir: path10.join(aiDataDir, "assistants"),
|
|
2807
2924
|
builtinRawConfigs: [],
|
|
2808
|
-
generateId: () => `custom_${
|
|
2925
|
+
generateId: () => `custom_${randomUUID2().replace(/-/g, "").slice(0, 12)}`
|
|
2809
2926
|
}),
|
|
2810
2927
|
skill: new SkillManagerCore({
|
|
2811
2928
|
fs: nodeFs,
|
|
@@ -3854,7 +3971,9 @@ async function startHttpServer(options) {
|
|
|
3854
3971
|
if (profileName) deleteAuthProfile(profileName);
|
|
3855
3972
|
}
|
|
3856
3973
|
});
|
|
3974
|
+
initAppLogger(pathProvider.getLogsDir());
|
|
3857
3975
|
initServerAiLogger(pathProvider.getLogsDir());
|
|
3976
|
+
appLogger.info("server", `HTTP server starting on ${host}:${port}`);
|
|
3858
3977
|
setAuthToken(token);
|
|
3859
3978
|
setRequireAuth(!!(options?.requireAuth ?? config.api.require_auth));
|
|
3860
3979
|
server = createServer();
|
|
@@ -3933,4 +4052,4 @@ export {
|
|
|
3933
4052
|
startHttpServer,
|
|
3934
4053
|
stopHttpServer
|
|
3935
4054
|
};
|
|
3936
|
-
//# sourceMappingURL=chunk-
|
|
4055
|
+
//# sourceMappingURL=chunk-YQ2FJGBT.mjs.map
|