nexum-code 0.7.20 → 0.12.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +414 -118
- package/dist/{app-STmkYeC7.mjs → app-COTk2IwE.mjs} +20347 -50542
- package/dist/assets/fsevents-9Sj9I9VP.node +0 -0
- package/dist/base64-js-DzVmk6Nb.mjs +95 -0
- package/dist/{rolldown-runtime-CDCXy-ZS.mjs → chunk-D90kvbyJ.mjs} +4 -10
- package/dist/{dist-Dh_F9syl.mjs → dist-AcjRoBBn.mjs} +1 -1
- package/dist/{from-D_EZ04z8.mjs → from-BMeHuTTE.mjs} +1 -1
- package/dist/main.mjs +1 -1
- package/dist/markit-DG5XsAGz.mjs +56336 -0
- package/dist/{multipart-parser-uEw3PR6T.mjs → multipart-parser-_uHCprmc.mjs} +2 -2
- package/dist/public/assets/github-dark-DHJKELXO.js +2 -0
- package/dist/public/assets/github-dark-DHJKELXO.js.map +1 -0
- package/dist/public/assets/github-light-DAi9KRSo.js +2 -0
- package/dist/public/assets/github-light-DAi9KRSo.js.map +1 -0
- package/dist/public/assets/index-Dk4bewva.js +90 -0
- package/dist/public/assets/index-Dk4bewva.js.map +1 -0
- package/dist/public/assets/index-nfSMt8uX.css +1 -0
- package/dist/public/assets/wasm-CG6Dc4jp.js +2 -0
- package/dist/public/assets/wasm-CG6Dc4jp.js.map +1 -0
- package/dist/public/icon.ico +0 -0
- package/dist/public/index.html +15 -0
- package/dist/{dist-BaQOFk-J.mjs → src-BH9W5k24.mjs} +114 -16
- package/dist/{dist-BRIvo0y7.mjs → src-DCp4eCi5.mjs} +1 -1
- package/dist/{src-BAMmHkmC.mjs → src-DlpH2wBe.mjs} +19 -19
- package/dist/{aiflowy-bot-sync-DhoRtQfn.mjs → text-input-dialog-B5imDNC1.mjs} +2 -2
- package/dist/text-input-dialog-B_4fy5St.mjs +2345 -0
- package/icon.ico +0 -0
- package/package.json +22 -26
- package/dist/aiflowy-bot-sync-C0WrAYbG.mjs +0 -219
- package/scripts/postinstall/migrate.mjs +0 -351
- package/scripts/postinstall/reach.mjs +0 -457
- package/scripts/postinstall/shortcut.mjs +0 -74
- package/scripts/postinstall/ui.mjs +0 -458
- package/scripts/postinstall.mjs +0 -278
|
Binary file
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<meta name="theme-color" content="#0d1117" />
|
|
7
|
+
<link rel="icon" href="./icon.ico" type="image/x-icon" />
|
|
8
|
+
<title>Nexum Web UI</title>
|
|
9
|
+
<script type="module" crossorigin src="./assets/index-Dk4bewva.js"></script>
|
|
10
|
+
<link rel="stylesheet" crossorigin href="./assets/index-nfSMt8uX.css">
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<div id="app"></div>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
@@ -167,8 +167,8 @@ const parse = function(p) {
|
|
|
167
167
|
};
|
|
168
168
|
};
|
|
169
169
|
//#endregion
|
|
170
|
-
//#region ../../packages/knowledge/
|
|
171
|
-
const ENTITY_TYPES$1 =
|
|
170
|
+
//#region ../../packages/knowledge/src/store.ts
|
|
171
|
+
const ENTITY_TYPES$1 = new Set([
|
|
172
172
|
"person",
|
|
173
173
|
"organization",
|
|
174
174
|
"location",
|
|
@@ -214,7 +214,10 @@ var KnowledgeStore = class {
|
|
|
214
214
|
}
|
|
215
215
|
async init() {
|
|
216
216
|
if (this.initPromise) return this.initPromise;
|
|
217
|
-
this.initPromise = this._doInit()
|
|
217
|
+
this.initPromise = this._doInit().catch((error) => {
|
|
218
|
+
this.initPromise = null;
|
|
219
|
+
throw error;
|
|
220
|
+
});
|
|
218
221
|
return this.initPromise;
|
|
219
222
|
}
|
|
220
223
|
async _doInit() {
|
|
@@ -225,8 +228,32 @@ var KnowledgeStore = class {
|
|
|
225
228
|
this.db.exec("PRAGMA foreign_keys = ON;");
|
|
226
229
|
this.db.exec("PRAGMA busy_timeout = 5000;");
|
|
227
230
|
this.createSchema();
|
|
231
|
+
this.migrateFtsTokenization();
|
|
228
232
|
this.initialized = true;
|
|
229
233
|
}
|
|
234
|
+
/**
|
|
235
|
+
* One-time migration: FTS rows written before toFtsText pre-tokenization
|
|
236
|
+
* indexed raw text (CJK runs became single tokens and are unsearchable).
|
|
237
|
+
* Rebuild all three FTS tables from the content tables with toFtsText.
|
|
238
|
+
* Tracked via PRAGMA user_version so it runs exactly once.
|
|
239
|
+
*/
|
|
240
|
+
migrateFtsTokenization() {
|
|
241
|
+
if (this.db === void 0) return;
|
|
242
|
+
if (this.db.prepare("PRAGMA user_version").get().user_version >= 1) return;
|
|
243
|
+
this.db.exec("DELETE FROM knowledge_chunks_fts");
|
|
244
|
+
this.db.exec("DELETE FROM knowledge_events_fts");
|
|
245
|
+
this.db.exec("DELETE FROM knowledge_entities_fts");
|
|
246
|
+
const chunks = this.db.prepare("SELECT rowid, heading, content FROM knowledge_chunks").all();
|
|
247
|
+
const insChunk = this.db.prepare("INSERT INTO knowledge_chunks_fts (rowid, heading, content) VALUES (?, ?, ?)");
|
|
248
|
+
for (const c of chunks) insChunk.run(c.rowid, toFtsText(c.heading ?? ""), toFtsText(c.content));
|
|
249
|
+
const events = this.db.prepare("SELECT rowid, title, summary, content FROM knowledge_events").all();
|
|
250
|
+
const insEvent = this.db.prepare("INSERT INTO knowledge_events_fts (rowid, title, summary, content) VALUES (?, ?, ?, ?)");
|
|
251
|
+
for (const e of events) insEvent.run(e.rowid, toFtsText(e.title), toFtsText(e.summary ?? ""), toFtsText(e.content));
|
|
252
|
+
const entities = this.db.prepare("SELECT rowid, name, description FROM knowledge_entities").all();
|
|
253
|
+
const insEntity = this.db.prepare("INSERT INTO knowledge_entities_fts (rowid, name, description) VALUES (?, ?, ?)");
|
|
254
|
+
for (const e of entities) insEntity.run(e.rowid, toFtsText(e.name), toFtsText(e.description ?? ""));
|
|
255
|
+
this.db.exec("PRAGMA user_version = 1");
|
|
256
|
+
}
|
|
230
257
|
close() {
|
|
231
258
|
if (this.db !== void 0) {
|
|
232
259
|
this.db.exec("PRAGMA wal_checkpoint(TRUNCATE)");
|
|
@@ -392,7 +419,19 @@ var KnowledgeStore = class {
|
|
|
392
419
|
async deleteSource(id) {
|
|
393
420
|
await this.init();
|
|
394
421
|
if (this.db === void 0) return false;
|
|
395
|
-
|
|
422
|
+
const chunkRows = this.db.prepare("SELECT rowid, heading, content FROM knowledge_chunks WHERE source_id = ?").all(id);
|
|
423
|
+
const eventRows = this.db.prepare("SELECT rowid, title, summary, content FROM knowledge_events WHERE source_id = ?").all(id);
|
|
424
|
+
const entityRows = this.db.prepare("SELECT rowid, name, description FROM knowledge_entities WHERE source_id = ?").all(id);
|
|
425
|
+
const result = this.db.prepare("DELETE FROM knowledge_sources WHERE id = ?").run(id);
|
|
426
|
+
if (result.changes > 0) {
|
|
427
|
+
const delChunk = this.db.prepare("INSERT INTO knowledge_chunks_fts (knowledge_chunks_fts, rowid, heading, content) VALUES ('delete', ?, ?, ?)");
|
|
428
|
+
for (const row of chunkRows) delChunk.run(row.rowid, toFtsText(row.heading ?? ""), toFtsText(row.content));
|
|
429
|
+
const delEvent = this.db.prepare("INSERT INTO knowledge_events_fts (knowledge_events_fts, rowid, title, summary, content) VALUES ('delete', ?, ?, ?, ?)");
|
|
430
|
+
for (const row of eventRows) delEvent.run(row.rowid, toFtsText(row.title), toFtsText(row.summary ?? ""), toFtsText(row.content));
|
|
431
|
+
const delEntity = this.db.prepare("INSERT INTO knowledge_entities_fts (knowledge_entities_fts, rowid, name, description) VALUES ('delete', ?, ?, ?)");
|
|
432
|
+
for (const row of entityRows) delEntity.run(row.rowid, toFtsText(row.name), toFtsText(row.description ?? ""));
|
|
433
|
+
}
|
|
434
|
+
return result.changes > 0;
|
|
396
435
|
}
|
|
397
436
|
async createDocument(params) {
|
|
398
437
|
if (this.db === void 0) throw new Error("knowledge store not initialized");
|
|
@@ -440,7 +479,7 @@ var KnowledgeStore = class {
|
|
|
440
479
|
(id, source_id, document_id, rank, heading, content, raw_content, embedding_json, created_at)
|
|
441
480
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(id, params.sourceId, params.documentId, params.rank, params.heading, params.content, params.rawContent, embeddingJson, createdAt);
|
|
442
481
|
this.db.prepare(`INSERT INTO knowledge_chunks_fts (rowid, heading, content)
|
|
443
|
-
VALUES ((SELECT rowid FROM knowledge_chunks WHERE id = ?), ?, ?)`).run(id, params.heading ?? "", params.content);
|
|
482
|
+
VALUES ((SELECT rowid FROM knowledge_chunks WHERE id = ?), ?, ?)`).run(id, toFtsText(params.heading ?? ""), toFtsText(params.content));
|
|
444
483
|
return {
|
|
445
484
|
id,
|
|
446
485
|
sourceId: params.sourceId,
|
|
@@ -488,7 +527,7 @@ var KnowledgeStore = class {
|
|
|
488
527
|
title_embedding_json, content_embedding_json, created_at)
|
|
489
528
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(id, params.sourceId, params.documentId, params.chunkId, params.rank, params.title, params.summary, params.content, params.category, JSON.stringify(params.keywords), vectorToJson(params.titleEmbedding), vectorToJson(params.contentEmbedding), createdAt);
|
|
490
529
|
this.db.prepare(`INSERT INTO knowledge_events_fts (rowid, title, summary, content)
|
|
491
|
-
VALUES ((SELECT rowid FROM knowledge_events WHERE id = ?), ?, ?, ?)`).run(id, params.title, params.summary ?? "", params.content);
|
|
530
|
+
VALUES ((SELECT rowid FROM knowledge_events WHERE id = ?), ?, ?, ?)`).run(id, toFtsText(params.title), toFtsText(params.summary ?? ""), toFtsText(params.content));
|
|
492
531
|
return {
|
|
493
532
|
id,
|
|
494
533
|
sourceId: params.sourceId,
|
|
@@ -551,8 +590,24 @@ var KnowledgeStore = class {
|
|
|
551
590
|
const normalizedName = normalizeName(params.name);
|
|
552
591
|
const existing = this.db.prepare("SELECT * FROM knowledge_entities WHERE source_id = ? AND type = ? AND normalized_name = ?").get(params.sourceId, params.type, normalizedName);
|
|
553
592
|
if (existing !== void 0) {
|
|
554
|
-
|
|
555
|
-
|
|
593
|
+
const existingId = String(existing["id"]);
|
|
594
|
+
let descriptionChanged = false;
|
|
595
|
+
if (params.description !== null && existing["description"] === null) {
|
|
596
|
+
this.db.prepare("UPDATE knowledge_entities SET description = ? WHERE id = ?").run(params.description, existingId);
|
|
597
|
+
existing["description"] = params.description;
|
|
598
|
+
descriptionChanged = true;
|
|
599
|
+
}
|
|
600
|
+
if (params.embedding !== null && existing["embedding_json"] === null) {
|
|
601
|
+
this.db.prepare("UPDATE knowledge_entities SET embedding_json = ? WHERE id = ?").run(vectorToJson(params.embedding), existingId);
|
|
602
|
+
existing["embedding_json"] = vectorToJson(params.embedding);
|
|
603
|
+
}
|
|
604
|
+
if (descriptionChanged) {
|
|
605
|
+
const ftsRow = this.db.prepare("SELECT rowid, name, description FROM knowledge_entities WHERE id = ?").get(existingId);
|
|
606
|
+
if (ftsRow !== void 0) {
|
|
607
|
+
this.db.prepare("INSERT INTO knowledge_entities_fts (knowledge_entities_fts, rowid, name, description) VALUES ('delete', ?, ?, ?)").run(ftsRow.rowid, toFtsText(ftsRow.name), "");
|
|
608
|
+
this.db.prepare(`INSERT INTO knowledge_entities_fts (rowid, name, description) VALUES (?, ?, ?)`).run(ftsRow.rowid, toFtsText(ftsRow.name), toFtsText(ftsRow.description ?? ""));
|
|
609
|
+
}
|
|
610
|
+
}
|
|
556
611
|
return rowToEntity(existing);
|
|
557
612
|
}
|
|
558
613
|
const id = generateId("ent");
|
|
@@ -561,7 +616,7 @@ var KnowledgeStore = class {
|
|
|
561
616
|
(id, source_id, type, name, normalized_name, description, embedding_json, created_at)
|
|
562
617
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`).run(id, params.sourceId, params.type, params.name, normalizedName, params.description, vectorToJson(params.embedding), createdAt);
|
|
563
618
|
this.db.prepare(`INSERT INTO knowledge_entities_fts (rowid, name, description)
|
|
564
|
-
VALUES ((SELECT rowid FROM knowledge_entities WHERE id = ?), ?, ?)`).run(id, params.name, params.description ?? "");
|
|
619
|
+
VALUES ((SELECT rowid FROM knowledge_entities WHERE id = ?), ?, ?)`).run(id, toFtsText(params.name), toFtsText(params.description ?? ""));
|
|
565
620
|
return {
|
|
566
621
|
id,
|
|
567
622
|
sourceId: params.sourceId,
|
|
@@ -850,6 +905,8 @@ function buildFtsQuery(search) {
|
|
|
850
905
|
if (tokens.length === 0) return void 0;
|
|
851
906
|
return tokens.map((t) => `"${t.replaceAll("\"", "\"\"")}"`).join(" AND ");
|
|
852
907
|
}
|
|
908
|
+
//#endregion
|
|
909
|
+
//#region ../../packages/knowledge/src/chunking.ts
|
|
853
910
|
const HEADING_RE = /^(#{1,6})\s+(.+?)\s*$/;
|
|
854
911
|
const CODE_FENCE_RE = /^(\s*)(`{3,}|~{3,})/;
|
|
855
912
|
/**
|
|
@@ -1096,6 +1153,8 @@ function splitByCharLimit(text) {
|
|
|
1096
1153
|
if (remaining.length > 0) chunks.push(remaining);
|
|
1097
1154
|
return chunks;
|
|
1098
1155
|
}
|
|
1156
|
+
//#endregion
|
|
1157
|
+
//#region ../../packages/knowledge/src/extractor.ts
|
|
1099
1158
|
/** Max LLM call attempts for extraction — fails fall back to a heading-derived event. */
|
|
1100
1159
|
const EXTRACTION_MAX_ATTEMPTS = 3;
|
|
1101
1160
|
/** Base delay (ms) for exponential backoff: 100, 200, 400. */
|
|
@@ -1370,6 +1429,8 @@ Only include entities that explicitly appear in the query. If no clear entities,
|
|
|
1370
1429
|
return [];
|
|
1371
1430
|
}
|
|
1372
1431
|
}
|
|
1432
|
+
//#endregion
|
|
1433
|
+
//#region ../../packages/knowledge/src/ingest.ts
|
|
1373
1434
|
/**
|
|
1374
1435
|
* Embed texts, returning null-array if embeddings are skipped or on failure.
|
|
1375
1436
|
* Caller should set skipEmbedding=true when the model didn't load in time,
|
|
@@ -1384,8 +1445,8 @@ async function embedOrNulls(engine, texts, skipEmbedding) {
|
|
|
1384
1445
|
return vectors;
|
|
1385
1446
|
}
|
|
1386
1447
|
/** LLM concurrency for extraction — kept low to avoid rate-limit bursts. */
|
|
1387
|
-
const LLM_CONCURRENCY =
|
|
1388
|
-
const SUPPORTED_EXTENSIONS =
|
|
1448
|
+
const LLM_CONCURRENCY = 20;
|
|
1449
|
+
const SUPPORTED_EXTENSIONS = new Set([
|
|
1389
1450
|
".md",
|
|
1390
1451
|
".markdown",
|
|
1391
1452
|
".txt"
|
|
@@ -1691,6 +1752,8 @@ async function ingestDirectory(store, llm, dirPath, onProgress) {
|
|
|
1691
1752
|
errors
|
|
1692
1753
|
};
|
|
1693
1754
|
}
|
|
1755
|
+
//#endregion
|
|
1756
|
+
//#region ../../packages/knowledge/src/search.ts
|
|
1694
1757
|
const DEFAULT_TOP_K = 5;
|
|
1695
1758
|
const MAX_TOP_K = 20;
|
|
1696
1759
|
const SEED_EVENT_LIMIT = 30;
|
|
@@ -1782,9 +1845,21 @@ async function multiSearchWithTrace(store, llm, query, options = {}) {
|
|
|
1782
1845
|
}), (matches) => ({ count: matches.length }));
|
|
1783
1846
|
for (const { event } of titleMatches) seedEventIds.add(event.id);
|
|
1784
1847
|
if (seedEventIds.size === 0) {
|
|
1785
|
-
|
|
1848
|
+
const results = await chunkVectorFallback(store, queryVec, topK);
|
|
1849
|
+
if (results.length > 0) {
|
|
1850
|
+
fallbackReason = "no seed events; used direct chunk vector search";
|
|
1851
|
+
return {
|
|
1852
|
+
results,
|
|
1853
|
+
trace: {
|
|
1854
|
+
steps,
|
|
1855
|
+
rerankedEventTitles,
|
|
1856
|
+
fallbackReason
|
|
1857
|
+
}
|
|
1858
|
+
};
|
|
1859
|
+
}
|
|
1860
|
+
fallbackReason = "no seed events and direct chunk vector search returned no results; used FTS5 keyword fallback";
|
|
1786
1861
|
return {
|
|
1787
|
-
results: await
|
|
1862
|
+
results: await ftsFallback(store, query, topK),
|
|
1788
1863
|
trace: {
|
|
1789
1864
|
steps,
|
|
1790
1865
|
rerankedEventTitles,
|
|
@@ -1844,9 +1919,21 @@ async function multiSearchWithTrace(store, llm, query, options = {}) {
|
|
|
1844
1919
|
topScore: result.topCandidates[0]?.score ?? 0
|
|
1845
1920
|
}));
|
|
1846
1921
|
if (candidates.length === 0) {
|
|
1847
|
-
|
|
1922
|
+
const results = await chunkVectorFallback(store, queryVec, topK);
|
|
1923
|
+
if (results.length > 0) {
|
|
1924
|
+
fallbackReason = "no graph-reachable events with content; used chunk vector fallback";
|
|
1925
|
+
return {
|
|
1926
|
+
results,
|
|
1927
|
+
trace: {
|
|
1928
|
+
steps,
|
|
1929
|
+
rerankedEventTitles,
|
|
1930
|
+
fallbackReason
|
|
1931
|
+
}
|
|
1932
|
+
};
|
|
1933
|
+
}
|
|
1934
|
+
fallbackReason = "no graph-reachable events with content and chunk vector search returned no results; used FTS5 keyword fallback";
|
|
1848
1935
|
return {
|
|
1849
|
-
results: await
|
|
1936
|
+
results: await ftsFallback(store, query, topK),
|
|
1850
1937
|
trace: {
|
|
1851
1938
|
steps,
|
|
1852
1939
|
rerankedEventTitles,
|
|
@@ -1922,6 +2009,17 @@ async function multiSearchWithTrace(store, llm, query, options = {}) {
|
|
|
1922
2009
|
if (result !== void 0) results.push(result);
|
|
1923
2010
|
}
|
|
1924
2011
|
}
|
|
2012
|
+
if (results.length === 0) {
|
|
2013
|
+
fallbackReason = "vector retrieval returned no results; used FTS5 keyword fallback";
|
|
2014
|
+
return {
|
|
2015
|
+
results: await ftsFallback(store, query, topK),
|
|
2016
|
+
trace: {
|
|
2017
|
+
steps,
|
|
2018
|
+
rerankedEventTitles,
|
|
2019
|
+
fallbackReason
|
|
2020
|
+
}
|
|
2021
|
+
};
|
|
2022
|
+
}
|
|
1925
2023
|
return {
|
|
1926
2024
|
results,
|
|
1927
2025
|
trace: {
|
|
@@ -1969,4 +2067,4 @@ async function chunkVectorFallback(store, queryVec, topK) {
|
|
|
1969
2067
|
return results;
|
|
1970
2068
|
}
|
|
1971
2069
|
//#endregion
|
|
1972
|
-
export { join as C, resolve as D, relative as E, isAbsolute as S, parse as T,
|
|
2070
|
+
export { join as C, resolve as D, relative as E, isAbsolute as S, parse as T, splitLargeSection as _, isSupportedFile as a, basename as b, buildExtractionUserPrompt as c, extractQueryEntities as d, parseExtractionResponse as f, estimateTokens as g, chunkText as h, ingestFile as i, extractEventFromChunk as l, chunkMarkdown as m, multiSearchWithTrace as n, ENTITY_TYPES as o, rerankEventsWithLlm as p, ingestDirectory as r, EXTRACTION_SYSTEM_PROMPT as s, multiSearch as t, extractJsonFromText as u, stripMarkdown as v, normalize as w, dirname as x, KnowledgeStore as y };
|
|
@@ -3,5 +3,5 @@ import { fileURLToPath as __cjsShimFileURLToPath } from 'node:url';
|
|
|
3
3
|
import { dirname as __cjsShimDirname } from 'node:path';
|
|
4
4
|
const __filename = __cjsShimFileURLToPath(import.meta.url);
|
|
5
5
|
const __dirname = __cjsShimDirname(__filename);
|
|
6
|
-
import {
|
|
6
|
+
import { n as multiSearchWithTrace } from "./src-BH9W5k24.mjs";
|
|
7
7
|
export { multiSearchWithTrace };
|
|
@@ -3,13 +3,13 @@ import { fileURLToPath as __cjsShimFileURLToPath } from 'node:url';
|
|
|
3
3
|
import { dirname as __cjsShimDirname } from 'node:path';
|
|
4
4
|
const __filename = __cjsShimFileURLToPath(import.meta.url);
|
|
5
5
|
const __dirname = __cjsShimDirname(__filename);
|
|
6
|
-
import { n as __esmMin } from "./
|
|
7
|
-
import { c as init_fetch_blob, i as init_esm_min, n as FormData, r as formDataToBlob, s as Blob, t as init_from } from "./from-
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
6
|
+
import { n as __esmMin } from "./chunk-D90kvbyJ.mjs";
|
|
7
|
+
import { c as init_fetch_blob, i as init_esm_min, n as FormData, r as formDataToBlob, s as Blob, t as init_from } from "./from-BMeHuTTE.mjs";
|
|
8
|
+
import Cs, { PassThrough, pipeline } from "node:stream";
|
|
9
|
+
import { deprecate, promisify, types } from "node:util";
|
|
10
10
|
import http from "node:http";
|
|
11
|
+
import { format } from "node:url";
|
|
11
12
|
import { isIP } from "node:net";
|
|
12
|
-
import { deprecate, promisify, types } from "node:util";
|
|
13
13
|
import https from "node:https";
|
|
14
14
|
import zlib from "node:zlib";
|
|
15
15
|
import { Buffer as Buffer$1 } from "node:buffer";
|
|
@@ -131,7 +131,7 @@ async function consumeBody(data) {
|
|
|
131
131
|
const { body } = data;
|
|
132
132
|
if (body === null) return Buffer$1.alloc(0);
|
|
133
133
|
/* c8 ignore next 3 */
|
|
134
|
-
if (!(body instanceof
|
|
134
|
+
if (!(body instanceof Cs)) return Buffer$1.alloc(0);
|
|
135
135
|
const accum = [];
|
|
136
136
|
let accumBytes = 0;
|
|
137
137
|
try {
|
|
@@ -162,7 +162,7 @@ var init_body = __esmMin((() => {
|
|
|
162
162
|
init_fetch_error();
|
|
163
163
|
init_base();
|
|
164
164
|
init_is();
|
|
165
|
-
pipeline$1 = promisify(
|
|
165
|
+
pipeline$1 = promisify(Cs.pipeline);
|
|
166
166
|
INTERNALS$2 = Symbol("Body internals");
|
|
167
167
|
Body = class {
|
|
168
168
|
constructor(body, { size = 0 } = {}) {
|
|
@@ -171,13 +171,13 @@ var init_body = __esmMin((() => {
|
|
|
171
171
|
else if (isURLSearchParameters(body)) body = Buffer$1.from(body.toString());
|
|
172
172
|
else if (isBlob(body)) {} else if (Buffer$1.isBuffer(body)) {} else if (types.isAnyArrayBuffer(body)) body = Buffer$1.from(body);
|
|
173
173
|
else if (ArrayBuffer.isView(body)) body = Buffer$1.from(body.buffer, body.byteOffset, body.byteLength);
|
|
174
|
-
else if (body instanceof
|
|
174
|
+
else if (body instanceof Cs) {} else if (body instanceof FormData) {
|
|
175
175
|
body = formDataToBlob(body);
|
|
176
176
|
boundary = body.type.split("=")[1];
|
|
177
177
|
} else body = Buffer$1.from(String(body));
|
|
178
178
|
let stream = body;
|
|
179
|
-
if (Buffer$1.isBuffer(body)) stream =
|
|
180
|
-
else if (isBlob(body)) stream =
|
|
179
|
+
if (Buffer$1.isBuffer(body)) stream = Cs.Readable.from(body);
|
|
180
|
+
else if (isBlob(body)) stream = Cs.Readable.from(body.stream());
|
|
181
181
|
this[INTERNALS$2] = {
|
|
182
182
|
body,
|
|
183
183
|
stream,
|
|
@@ -186,7 +186,7 @@ var init_body = __esmMin((() => {
|
|
|
186
186
|
error: null
|
|
187
187
|
};
|
|
188
188
|
this.size = size;
|
|
189
|
-
if (body instanceof
|
|
189
|
+
if (body instanceof Cs) body.on("error", (error_) => {
|
|
190
190
|
const error = error_ instanceof FetchBaseError ? error_ : new FetchError(`Invalid response body while trying to fetch ${this.url}: ${error_.message}`, "system", error_);
|
|
191
191
|
this[INTERNALS$2].error = error;
|
|
192
192
|
});
|
|
@@ -214,7 +214,7 @@ var init_body = __esmMin((() => {
|
|
|
214
214
|
for (const [name, value] of parameters) formData.append(name, value);
|
|
215
215
|
return formData;
|
|
216
216
|
}
|
|
217
|
-
const { toFormData } = await import("./multipart-parser-
|
|
217
|
+
const { toFormData } = await import("./multipart-parser-_uHCprmc.mjs");
|
|
218
218
|
return toFormData(this.body, ct);
|
|
219
219
|
}
|
|
220
220
|
/**
|
|
@@ -268,7 +268,7 @@ var init_body = __esmMin((() => {
|
|
|
268
268
|
let p2;
|
|
269
269
|
let { body } = instance[INTERNALS$2];
|
|
270
270
|
if (instance.bodyUsed) throw new Error("cannot clone body after it is used");
|
|
271
|
-
if (body instanceof
|
|
271
|
+
if (body instanceof Cs && typeof body.getBoundary !== "function") {
|
|
272
272
|
p1 = new PassThrough({ highWaterMark });
|
|
273
273
|
p2 = new PassThrough({ highWaterMark });
|
|
274
274
|
body.pipe(p1);
|
|
@@ -287,7 +287,7 @@ var init_body = __esmMin((() => {
|
|
|
287
287
|
if (Buffer$1.isBuffer(body) || types.isAnyArrayBuffer(body) || ArrayBuffer.isView(body)) return null;
|
|
288
288
|
if (body instanceof FormData) return `multipart/form-data; boundary=${request[INTERNALS$2].boundary}`;
|
|
289
289
|
if (body && typeof body.getBoundary === "function") return `multipart/form-data;boundary=${getNonSpecFormDataBoundary(body)}`;
|
|
290
|
-
if (body instanceof
|
|
290
|
+
if (body instanceof Cs) return null;
|
|
291
291
|
return "text/plain;charset=UTF-8";
|
|
292
292
|
};
|
|
293
293
|
getTotalBytes = (request) => {
|
|
@@ -474,7 +474,7 @@ var init_headers = __esmMin((() => {
|
|
|
474
474
|
//#region ../../node_modules/.pnpm/node-fetch@3.3.2/node_modules/node-fetch/src/utils/is-redirect.js
|
|
475
475
|
var redirectStatus, isRedirect;
|
|
476
476
|
var init_is_redirect = __esmMin((() => {
|
|
477
|
-
redirectStatus =
|
|
477
|
+
redirectStatus = new Set([
|
|
478
478
|
301,
|
|
479
479
|
302,
|
|
480
480
|
303,
|
|
@@ -745,7 +745,7 @@ function parseReferrerPolicyFromHeader(headers) {
|
|
|
745
745
|
}
|
|
746
746
|
var ReferrerPolicy, DEFAULT_REFERRER_POLICY;
|
|
747
747
|
var init_referrer = __esmMin((() => {
|
|
748
|
-
ReferrerPolicy =
|
|
748
|
+
ReferrerPolicy = new Set([
|
|
749
749
|
"",
|
|
750
750
|
"no-referrer",
|
|
751
751
|
"no-referrer-when-downgrade",
|
|
@@ -952,7 +952,7 @@ async function fetch(url, options_) {
|
|
|
952
952
|
const abort = () => {
|
|
953
953
|
const error = new AbortError("The operation was aborted.");
|
|
954
954
|
reject(error);
|
|
955
|
-
if (request.body && request.body instanceof
|
|
955
|
+
if (request.body && request.body instanceof Cs.Readable) request.body.destroy(error);
|
|
956
956
|
if (!response || !response.body) return;
|
|
957
957
|
response.body.emit("error", error);
|
|
958
958
|
};
|
|
@@ -1038,7 +1038,7 @@ async function fetch(url, options_) {
|
|
|
1038
1038
|
"cookie",
|
|
1039
1039
|
"cookie2"
|
|
1040
1040
|
]) requestOptions.headers.delete(name);
|
|
1041
|
-
if (response_.statusCode !== 303 && request.body && options_.body instanceof
|
|
1041
|
+
if (response_.statusCode !== 303 && request.body && options_.body instanceof Cs.Readable) {
|
|
1042
1042
|
reject(new FetchError("Cannot follow redirect with body being a readable stream", "unsupported-redirect"));
|
|
1043
1043
|
finalize();
|
|
1044
1044
|
return;
|
|
@@ -1173,7 +1173,7 @@ __esmMin((() => {
|
|
|
1173
1173
|
init_is();
|
|
1174
1174
|
init_referrer();
|
|
1175
1175
|
init_from();
|
|
1176
|
-
supportedSchemas =
|
|
1176
|
+
supportedSchemas = new Set([
|
|
1177
1177
|
"data:",
|
|
1178
1178
|
"http:",
|
|
1179
1179
|
"https:"
|
|
@@ -3,5 +3,5 @@ import { fileURLToPath as __cjsShimFileURLToPath } from 'node:url';
|
|
|
3
3
|
import { dirname as __cjsShimDirname } from 'node:path';
|
|
4
4
|
const __filename = __cjsShimFileURLToPath(import.meta.url);
|
|
5
5
|
const __dirname = __cjsShimDirname(__filename);
|
|
6
|
-
import {
|
|
7
|
-
export {
|
|
6
|
+
import { t as TextInputDialogComponent } from "./text-input-dialog-B_4fy5St.mjs";
|
|
7
|
+
export { TextInputDialogComponent };
|