@dikolab/kbdb 0.6.4 → 0.6.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/dist/cli.cjs +452 -144
- package/dist/cli.cjs.map +4 -4
- package/dist/cli.mjs +452 -144
- package/dist/cli.mjs.map +4 -4
- package/dist/kbdb-worker.cjs +49 -7
- package/dist/kbdb-worker.cjs.map +4 -4
- package/dist/mod.cjs +1 -1
- package/dist/mod.cjs.map +1 -1
- package/dist/mod.mjs +1 -1
- package/dist/mod.mjs.map +1 -1
- package/dist/src/shared/cli/constants/defaults.constant.d.ts +1 -1
- package/dist/src/shared/cli/functions/learn-structured-document.function.d.ts +10 -0
- package/dist/src/shared/cli/functions/learn-target-content.function.d.ts +5 -17
- package/dist/src/shared/cli/functions/split-markdown-sections.function.d.ts +4 -0
- package/dist/src/shared/cli/typings/learn-client.interface.d.ts +2 -0
- package/dist/src/shared/cli/typings/learn-result.model.d.ts +2 -0
- package/dist/src/shared/content-splitter/classes/heading-parent-tracker.class.d.ts +20 -0
- package/dist/src/shared/content-splitter/constants/content-type-maps.constant.d.ts +5 -0
- package/dist/src/shared/content-splitter/constants/split-strategy-map.constant.d.ts +4 -0
- package/dist/src/shared/content-splitter/functions/detect-content-type.function.d.ts +13 -0
- package/dist/src/shared/content-splitter/functions/flush-markdown-draft.function.d.ts +14 -0
- package/dist/src/shared/content-splitter/functions/flush-toml-draft.function.d.ts +15 -0
- package/dist/src/shared/content-splitter/functions/push-content-section.function.d.ts +16 -0
- package/dist/src/shared/content-splitter/functions/resolve-parent-ids.function.d.ts +14 -0
- package/dist/src/shared/content-splitter/functions/split-content.function.d.ts +11 -0
- package/dist/src/shared/content-splitter/functions/split-html.function.d.ts +12 -0
- package/dist/src/shared/content-splitter/functions/split-markdown.function.d.ts +13 -0
- package/dist/src/shared/content-splitter/functions/split-plain-text.function.d.ts +8 -0
- package/dist/src/shared/content-splitter/functions/split-toml.function.d.ts +12 -0
- package/dist/src/shared/content-splitter/index.d.ts +11 -0
- package/dist/src/shared/content-splitter/typings/content-format.type.d.ts +2 -0
- package/dist/src/shared/content-splitter/typings/content-section.interface.d.ts +17 -0
- package/dist/src/shared/content-splitter/typings/markdown-draft.interface.d.ts +12 -0
- package/dist/src/shared/content-splitter/typings/split-result.interface.d.ts +8 -0
- package/dist/src/shared/content-splitter/typings/split-strategy.interface.d.ts +3 -0
- package/dist/src/shared/content-splitter/typings/toml-draft.interface.d.ts +15 -0
- package/dist/src/shared/mcp/functions/build-learn-payload.function.d.ts +24 -0
- package/dist/src/shared/mcp/functions/determine-learn-split.function.d.ts +18 -0
- package/dist/src/shared/mcp/functions/handle-tool-learn.function.d.ts +3 -1
- package/dist/src/shared/mcp/functions/learn-with-splitting.function.d.ts +22 -0
- package/dist/src/shared/mcp/functions/parse-learn-args.function.d.ts +24 -0
- package/dist/src/shared/mcp/functions/store-split-learn-sections.function.d.ts +16 -0
- package/dist/src/shared/mcp/functions/unwrap-json-content.function.d.ts +9 -0
- package/dist/src/shared/mcp/typings/learn-section-params.interface.d.ts +20 -0
- package/dist/src/shared/mcp/typings/mcp-client.interface.d.ts +4 -0
- package/dist/src/shared/mcp/typings/mcp-worker-client.interface.d.ts +4 -0
- package/dist/src/shared/version/constants/version.constant.d.ts +1 -1
- package/dist/src/shared/wasm-codec/functions/decode-one-recall-result.function.d.ts +2 -1
- package/dist/src/shared/wasm-codec/functions/decode-recall-document.function.d.ts +2 -1
- package/dist/src/shared/wasm-codec/functions/decode-recall-result.function.d.ts +2 -0
- package/dist/src/shared/wasm-codec/functions/decode-recall-sibling.function.d.ts +2 -1
- package/dist/src/shared/wasm-codec/functions/decode-scored-results.function.d.ts +6 -0
- package/dist/src/shared/wasm-codec/functions/decode-section-match.function.d.ts +2 -1
- package/dist/src/shared/wasm-codec/functions/decode-section-records.function.d.ts +4 -0
- package/dist/src/shared/wasm-codec/functions/encode-add-section-params.function.d.ts +1 -0
- package/dist/src/shared/wasm-codec/typings/add-section-input.model.d.ts +2 -0
- package/dist/src/shared/wasm-codec/typings/section-match.model.d.ts +4 -0
- package/dist/src/shared/wasm-codec/typings/section-record-trailing.model.d.ts +2 -0
- package/dist/src/shared/wasm-codec/typings/section-record.model.d.ts +2 -0
- package/dist/src/shared/worker-client/typings/recall-result.model.d.ts +12 -0
- package/dist/src/shared/worker-client/typings/search-result.model.d.ts +4 -0
- package/dist/src/shared/worker-client/typings/section.model.d.ts +2 -0
- package/dist/wasm/fs-database/kbdb_fs_database_bg.wasm +0 -0
- package/dist/wasm/kb-worker/kbdb_worker_bg.wasm +0 -0
- package/dist/worker.mjs +49 -7
- package/dist/worker.mjs.map +4 -4
- package/package.json +1 -1
package/dist/kbdb-worker.cjs
CHANGED
|
@@ -1237,6 +1237,7 @@ function encodeAddSectionParams(params) {
|
|
|
1237
1237
|
params.replace === true ? 1 : 0
|
|
1238
1238
|
]);
|
|
1239
1239
|
const levelBytes = params.level != null ? new Uint8Array([1, params.level]) : new Uint8Array([0]);
|
|
1240
|
+
const parentBytes = encodeOptionString(params.parent);
|
|
1240
1241
|
const parts = [
|
|
1241
1242
|
encodeSectionType(params.sectionType, params.mimeType),
|
|
1242
1243
|
encodeString(params.content),
|
|
@@ -1249,7 +1250,8 @@ function encodeAddSectionParams(params) {
|
|
|
1249
1250
|
tagsCountBytes,
|
|
1250
1251
|
...tagParts,
|
|
1251
1252
|
replaceByte,
|
|
1252
|
-
levelBytes
|
|
1253
|
+
levelBytes,
|
|
1254
|
+
parentBytes
|
|
1253
1255
|
];
|
|
1254
1256
|
const totalLen = parts.reduce((sum, p) => sum + p.length, 0);
|
|
1255
1257
|
const result = new Uint8Array(totalLen);
|
|
@@ -1387,6 +1389,15 @@ function decodeU64(bytes, offset) {
|
|
|
1387
1389
|
};
|
|
1388
1390
|
}
|
|
1389
1391
|
|
|
1392
|
+
// src/shared/wasm-codec/functions/decode-option-u8.function.ts
|
|
1393
|
+
function decodeOptionU8(bytes, offset) {
|
|
1394
|
+
const tag = bytes[offset];
|
|
1395
|
+
if (tag === 1) {
|
|
1396
|
+
return { value: bytes[offset + 1], bytesRead: 2 };
|
|
1397
|
+
}
|
|
1398
|
+
return { value: null, bytesRead: 1 };
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1390
1401
|
// src/shared/wasm-codec/functions/decode-scored-results.function.ts
|
|
1391
1402
|
function decodeOptionString(bytes, offset) {
|
|
1392
1403
|
const tag = bytes[offset];
|
|
@@ -1452,6 +1463,10 @@ function decodePagedSearchResult(bytes) {
|
|
|
1452
1463
|
}
|
|
1453
1464
|
const createdAt = decodeString(bytes, offset);
|
|
1454
1465
|
offset += createdAt.bytesRead;
|
|
1466
|
+
const optLevel = decodeOptionU8(bytes, offset);
|
|
1467
|
+
offset += optLevel.bytesRead;
|
|
1468
|
+
const optParent = decodeOptionString(bytes, offset);
|
|
1469
|
+
offset += optParent.bytesRead;
|
|
1455
1470
|
items.push({
|
|
1456
1471
|
kbid: kbid.value,
|
|
1457
1472
|
heading: heading.value,
|
|
@@ -1462,7 +1477,9 @@ function decodePagedSearchResult(bytes) {
|
|
|
1462
1477
|
snippet: snippet.value,
|
|
1463
1478
|
matched_terms,
|
|
1464
1479
|
matched_fields,
|
|
1465
|
-
created_at: createdAt.value
|
|
1480
|
+
created_at: createdAt.value,
|
|
1481
|
+
level: optLevel.value,
|
|
1482
|
+
parent: optParent.value
|
|
1466
1483
|
});
|
|
1467
1484
|
}
|
|
1468
1485
|
return {
|
|
@@ -1476,7 +1493,7 @@ function decodePagedSearchResult(bytes) {
|
|
|
1476
1493
|
}
|
|
1477
1494
|
|
|
1478
1495
|
// src/shared/wasm-codec/functions/decode-section-records.function.ts
|
|
1479
|
-
function
|
|
1496
|
+
function decodeOptionU82(bytes, offset) {
|
|
1480
1497
|
const tag = bytes[offset];
|
|
1481
1498
|
if (tag === 1) {
|
|
1482
1499
|
return { value: bytes[offset + 1], bytesRead: 2 };
|
|
@@ -1581,10 +1598,16 @@ function decodeSectionRecords(bytes) {
|
|
|
1581
1598
|
}
|
|
1582
1599
|
let level = null;
|
|
1583
1600
|
if (offset < bytes.length) {
|
|
1584
|
-
const v =
|
|
1601
|
+
const v = decodeOptionU82(bytes, offset);
|
|
1585
1602
|
offset += v.bytesRead;
|
|
1586
1603
|
level = v.value;
|
|
1587
1604
|
}
|
|
1605
|
+
let parent = null;
|
|
1606
|
+
if (offset < bytes.length) {
|
|
1607
|
+
const v = decodeOptionString2(bytes, offset);
|
|
1608
|
+
offset += v.bytesRead;
|
|
1609
|
+
parent = v.value;
|
|
1610
|
+
}
|
|
1588
1611
|
const record = {
|
|
1589
1612
|
kbid: kbid.value,
|
|
1590
1613
|
docid: docid.value,
|
|
@@ -1606,7 +1629,8 @@ function decodeSectionRecords(bytes) {
|
|
|
1606
1629
|
updatedAt,
|
|
1607
1630
|
tags,
|
|
1608
1631
|
supersedes,
|
|
1609
|
-
level
|
|
1632
|
+
level,
|
|
1633
|
+
parent
|
|
1610
1634
|
};
|
|
1611
1635
|
if (st.mimeType !== void 0) {
|
|
1612
1636
|
record.mimeType = st.mimeType;
|
|
@@ -1819,12 +1843,18 @@ function decodeSibling(bytes, offset) {
|
|
|
1819
1843
|
pos += sectionType.bytesRead;
|
|
1820
1844
|
const content = decodeString(bytes, pos);
|
|
1821
1845
|
pos += content.bytesRead;
|
|
1846
|
+
const optLevel = decodeOptionU8(bytes, pos);
|
|
1847
|
+
pos += optLevel.bytesRead;
|
|
1848
|
+
const optParent = decodeOptionString3(bytes, pos);
|
|
1849
|
+
pos += optParent.bytesRead;
|
|
1822
1850
|
return {
|
|
1823
1851
|
value: {
|
|
1824
1852
|
kbid: kbid.value,
|
|
1825
1853
|
heading: heading.value,
|
|
1826
1854
|
type: sectionType.value,
|
|
1827
|
-
content: content.value
|
|
1855
|
+
content: content.value,
|
|
1856
|
+
level: optLevel.value,
|
|
1857
|
+
parent: optParent.value
|
|
1828
1858
|
},
|
|
1829
1859
|
bytesRead: pos - offset
|
|
1830
1860
|
};
|
|
@@ -1845,10 +1875,16 @@ function decodeDocument(bytes, offset) {
|
|
|
1845
1875
|
pos += secHeading.bytesRead;
|
|
1846
1876
|
const secType = decodeString(bytes, pos);
|
|
1847
1877
|
pos += secType.bytesRead;
|
|
1878
|
+
const secLevel = decodeOptionU8(bytes, pos);
|
|
1879
|
+
pos += secLevel.bytesRead;
|
|
1880
|
+
const secParent = decodeOptionString3(bytes, pos);
|
|
1881
|
+
pos += secParent.bytesRead;
|
|
1848
1882
|
sections.push({
|
|
1849
1883
|
kbid: secKbid.value,
|
|
1850
1884
|
heading: secHeading.value,
|
|
1851
|
-
type: secType.value
|
|
1885
|
+
type: secType.value,
|
|
1886
|
+
level: secLevel.value,
|
|
1887
|
+
parent: secParent.value
|
|
1852
1888
|
});
|
|
1853
1889
|
}
|
|
1854
1890
|
return {
|
|
@@ -1870,6 +1906,10 @@ function decodeOneResult(bytes, startOffset) {
|
|
|
1870
1906
|
pos += sectionType.bytesRead;
|
|
1871
1907
|
const content = decodeString(bytes, pos);
|
|
1872
1908
|
pos += content.bytesRead;
|
|
1909
|
+
const optLevel = decodeOptionU8(bytes, pos);
|
|
1910
|
+
pos += optLevel.bytesRead;
|
|
1911
|
+
const optParent = decodeOptionString3(bytes, pos);
|
|
1912
|
+
pos += optParent.bytesRead;
|
|
1873
1913
|
const docidCount = decodeU32(bytes, pos);
|
|
1874
1914
|
pos += docidCount.bytesRead;
|
|
1875
1915
|
const docids = [];
|
|
@@ -1916,6 +1956,8 @@ function decodeOneResult(bytes, startOffset) {
|
|
|
1916
1956
|
heading: heading.value,
|
|
1917
1957
|
type: sectionType.value,
|
|
1918
1958
|
content: content.value,
|
|
1959
|
+
level: optLevel.value,
|
|
1960
|
+
parent: optParent.value,
|
|
1919
1961
|
docids,
|
|
1920
1962
|
documents,
|
|
1921
1963
|
back_references,
|