wiki-graph-core 0.3.1 → 0.4.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 +15 -0
- package/data/editor/text_compressor.jinja +17 -13
- package/data/help/commands/archive/next.jinja +7 -2
- package/data/help/commands/gc.jinja +2 -1
- package/data/help/commands/legacy/migrate.jinja +6 -1
- package/data/help/commands/legacy.jinja +3 -2
- package/data/help/commands/library-predicate.jinja +296 -0
- package/data/help/commands/library.jinja +235 -0
- package/data/help/commands/maintenance/chapter/add.jinja +3 -3
- package/data/help/commands/maintenance/chapter/list.jinja +4 -4
- package/data/help/commands/maintenance/chapter/move.jinja +4 -4
- package/data/help/commands/maintenance/chapter/remove.jinja +1 -1
- package/data/help/commands/maintenance/chapter/reset.jinja +1 -1
- package/data/help/commands/maintenance/chapter/set-source.jinja +2 -2
- package/data/help/commands/maintenance/chapter/set-summary.jinja +1 -1
- package/data/help/commands/maintenance/chapter/set-title.jinja +3 -3
- package/data/help/commands/maintenance/chapter/tree.jinja +6 -6
- package/data/help/commands/maintenance/chapter.jinja +10 -10
- package/data/help/commands/maintenance/meta.jinja +7 -7
- package/data/help/commands/maintenance/upgrade.jinja +35 -0
- package/data/help/commands/maintenance.jinja +23 -0
- package/data/help/commands/predicate.jinja +204 -28
- package/data/help/commands/root.jinja +10 -3
- package/data/help/commands/uri.jinja +165 -6
- package/data/help/topics/config.jinja +10 -3
- package/data/help/topics/library.jinja +87 -0
- package/data/help/topics/readiness.jinja +32 -2
- package/data/help/topics/recipe.jinja +42 -17
- package/data/help/topics/runtime.jinja +20 -3
- package/data/help/topics/uri.jinja +51 -25
- package/dist/api/app.d.ts +87 -0
- package/dist/api/app.js +137 -0
- package/dist/api/app.js.map +1 -0
- package/dist/api/chapter/advance.d.ts +36 -0
- package/dist/api/chapter/advance.js +171 -0
- package/dist/api/chapter/advance.js.map +1 -0
- package/dist/api/chapter/details.d.ts +25 -0
- package/dist/api/chapter/details.js +17 -0
- package/dist/api/chapter/details.js.map +1 -0
- package/dist/api/chapter/entries.d.ts +41 -0
- package/dist/api/chapter/entries.js +216 -0
- package/dist/api/chapter/entries.js.map +1 -0
- package/dist/api/chapter/generate.d.ts +42 -0
- package/dist/api/chapter/generate.js +61 -0
- package/dist/api/chapter/generate.js.map +1 -0
- package/dist/api/chapter/index.d.ts +43 -0
- package/dist/api/chapter/index.js +11 -0
- package/dist/api/chapter/index.js.map +1 -0
- package/dist/api/chapter/manage.d.ts +53 -0
- package/dist/api/chapter/manage.js +185 -0
- package/dist/api/chapter/manage.js.map +1 -0
- package/dist/api/chapter/options.d.ts +51 -0
- package/dist/api/chapter/options.js +11 -0
- package/dist/api/chapter/options.js.map +1 -0
- package/dist/api/chapter/parse.d.ts +13 -0
- package/dist/api/chapter/parse.js +16 -0
- package/dist/api/chapter/parse.js.map +1 -0
- package/dist/api/chapter/tree.d.ts +61 -0
- package/dist/api/chapter/tree.js +387 -0
- package/dist/api/chapter/tree.js.map +1 -0
- package/dist/api/chapter/types.d.ts +104 -0
- package/dist/api/chapter/types.js +5 -0
- package/dist/api/chapter/types.js.map +1 -0
- package/dist/api/chapter-build/index.d.ts +42 -0
- package/dist/api/chapter-build/index.js +3 -0
- package/dist/api/chapter-build/index.js.map +1 -0
- package/dist/api/chapter-build/types.d.ts +37 -0
- package/dist/api/digest.d.ts +67 -0
- package/dist/api/digest.js +171 -0
- package/dist/api/digest.js.map +1 -0
- package/dist/api/graph.d.ts +24 -0
- package/dist/api/graph.js +2 -0
- package/dist/api/graph.js.map +1 -0
- package/dist/api/import.d.ts +62 -0
- package/dist/api/import.js +269 -0
- package/dist/api/import.js.map +1 -0
- package/dist/api/index.d.ts +91 -0
- package/dist/api/index.js +189 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/knowledge-graph-build/index.d.ts +40 -0
- package/dist/api/knowledge-graph-build/index.js +2 -0
- package/dist/api/knowledge-graph-build/index.js.map +1 -0
- package/dist/api/knowledge-graph-build/types.d.ts +13 -0
- package/dist/api/llm-sampling.d.ts +11 -0
- package/dist/api/llm-sampling.js +58 -0
- package/dist/api/llm-sampling.js.map +1 -0
- package/dist/api/prompts.d.ts +1 -0
- package/dist/api/prompts.js +2 -0
- package/dist/api/prompts.js.map +1 -0
- package/dist/api/wiki-graph-archive.d.ts +42 -0
- package/dist/api/wiki-graph-archive.js +130 -0
- package/dist/api/wiki-graph-archive.js.map +1 -0
- package/dist/core-Cv8a8viI.d.ts +85 -0
- package/dist/document/chapter/index.d.ts +26 -0
- package/dist/document/chapter/index.js +23 -0
- package/dist/document/chapter/index.js.map +1 -0
- package/dist/document/chapter/path.d.ts +14 -0
- package/dist/document/chapter/path.js +133 -0
- package/dist/document/chapter/path.js.map +1 -0
- package/dist/document/chapter/query.d.ts +33 -0
- package/dist/document/chapter/query.js +83 -0
- package/dist/document/chapter/query.js.map +1 -0
- package/dist/document/chapter/stage.d.ts +28 -0
- package/dist/document/chapter/stage.js +13 -0
- package/dist/document/chapter/stage.js.map +1 -0
- package/dist/document/chapter/toc.d.ts +33 -0
- package/dist/document/chapter/toc.js +213 -0
- package/dist/document/chapter/toc.js.map +1 -0
- package/dist/document/chapter/tree.d.ts +20 -0
- package/dist/document/chapter/tree.js +48 -0
- package/dist/document/chapter/tree.js.map +1 -0
- package/dist/document/chapter/types.d.ts +31 -0
- package/dist/document/chapter/types.js +10 -0
- package/dist/document/chapter/types.js.map +1 -0
- package/dist/document/directory/context.d.ts +25 -0
- package/dist/document/directory/context.js +54 -0
- package/dist/document/directory/context.js.map +1 -0
- package/dist/document/directory/core.d.ts +25 -0
- package/dist/document/directory/core.js +382 -0
- package/dist/document/directory/core.js.map +1 -0
- package/dist/document/directory/file-store.d.ts +27 -0
- package/dist/document/directory/file-store.js +48 -0
- package/dist/document/directory/file-store.js.map +1 -0
- package/dist/document/directory/files.d.ts +53 -0
- package/dist/document/directory/files.js +71 -0
- package/dist/document/directory/files.js.map +1 -0
- package/dist/document/directory/index.d.ts +26 -0
- package/dist/document/directory/index.js +4 -0
- package/dist/document/directory/index.js.map +1 -0
- package/dist/document/directory/search-index.d.ts +32 -0
- package/dist/document/directory/search-index.js +154 -0
- package/dist/document/directory/search-index.js.map +1 -0
- package/dist/document/directory/serial-cleanup.d.ts +47 -0
- package/dist/document/directory/serial-cleanup.js +178 -0
- package/dist/document/directory/serial-cleanup.js.map +1 -0
- package/dist/document/directory/toc.d.ts +6 -0
- package/dist/document/directory/toc.js +14 -0
- package/dist/document/directory/toc.js.map +1 -0
- package/dist/document/directory/types.d.ts +105 -0
- package/dist/document/fragment-backed.d.ts +27 -0
- package/dist/document/fragment-backed.js +26 -0
- package/dist/document/fragment-backed.js.map +1 -0
- package/dist/document/fragments/core.d.ts +18 -0
- package/dist/document/fragments/core.js +68 -0
- package/dist/document/fragments/core.js.map +1 -0
- package/dist/document/fragments/draft.d.ts +16 -0
- package/dist/document/fragments/draft.js +57 -0
- package/dist/document/fragments/draft.js.map +1 -0
- package/dist/document/fragments/file-access.d.ts +7 -0
- package/dist/document/fragments/file-access.js +28 -0
- package/dist/document/fragments/file-access.js.map +1 -0
- package/dist/document/fragments/file.d.ts +7 -0
- package/dist/document/fragments/file.js +55 -0
- package/dist/document/fragments/file.js.map +1 -0
- package/dist/document/fragments/index.d.ts +5 -0
- package/dist/document/fragments/index.js +5 -0
- package/dist/document/fragments/index.js.map +1 -0
- package/dist/document/fragments/sentence.d.ts +5 -0
- package/dist/document/fragments/sentence.js +14 -0
- package/dist/document/fragments/sentence.js.map +1 -0
- package/dist/document/fragments/serial.d.ts +16 -0
- package/dist/document/fragments/serial.js +187 -0
- package/dist/document/fragments/serial.js.map +1 -0
- package/dist/document/fragments/types.d.ts +37 -0
- package/dist/document/fragments/types.js +9 -0
- package/dist/document/fragments/types.js.map +1 -0
- package/dist/document/home-schema-upgrade.d.ts +5 -0
- package/dist/document/home-schema-upgrade.js +529 -0
- package/dist/document/home-schema-upgrade.js.map +1 -0
- package/dist/document/index.d.ts +27 -8
- package/dist/document/index.js +10 -4
- package/dist/document/index.js.map +1 -1
- package/dist/document/schema.d.ts +3 -2
- package/dist/document/schema.js +24 -11
- package/dist/document/schema.js.map +1 -1
- package/dist/document/shared-state-database.js +27 -3
- package/dist/document/shared-state-database.js.map +1 -1
- package/dist/document/stores/chunk.d.ts +21 -0
- package/dist/document/stores/chunk.js +299 -0
- package/dist/document/stores/chunk.js.map +1 -0
- package/dist/document/stores/fragment-group.d.ts +16 -0
- package/dist/document/stores/fragment-group.js +77 -0
- package/dist/document/stores/fragment-group.js.map +1 -0
- package/dist/document/stores/graph-build-parameter.d.ts +17 -0
- package/dist/document/stores/graph-build-parameter.js +62 -0
- package/dist/document/stores/graph-build-parameter.js.map +1 -0
- package/dist/document/stores/helpers.d.ts +22 -0
- package/dist/document/stores/helpers.js +115 -0
- package/dist/document/stores/helpers.js.map +1 -0
- package/dist/document/stores/index.d.ts +15 -0
- package/dist/document/stores/index.js +23 -0
- package/dist/document/stores/index.js.map +1 -0
- package/dist/document/stores/mention-link.d.ts +32 -0
- package/dist/document/stores/mention-link.js +287 -0
- package/dist/document/stores/mention-link.js.map +1 -0
- package/dist/document/stores/mention.d.ts +31 -0
- package/dist/document/stores/mention.js +238 -0
- package/dist/document/stores/mention.js.map +1 -0
- package/dist/document/stores/object-metadata.d.ts +19 -0
- package/dist/document/stores/object-metadata.js +148 -0
- package/dist/document/stores/object-metadata.js.map +1 -0
- package/dist/document/stores/reading-edge.d.ts +17 -0
- package/dist/document/stores/reading-edge.js +80 -0
- package/dist/document/stores/reading-edge.js.map +1 -0
- package/dist/document/stores/serial.d.ts +29 -0
- package/dist/document/stores/serial.js +296 -0
- package/dist/document/stores/serial.js.map +1 -0
- package/dist/document/stores/snake/chunk.d.ts +14 -0
- package/dist/document/stores/snake/chunk.js +48 -0
- package/dist/document/stores/snake/chunk.js.map +1 -0
- package/dist/document/stores/snake/core.d.ts +15 -0
- package/dist/document/stores/snake/core.js +112 -0
- package/dist/document/stores/snake/core.js.map +1 -0
- package/dist/document/stores/snake/edge.d.ts +16 -0
- package/dist/document/stores/snake/edge.js +86 -0
- package/dist/document/stores/snake/edge.js.map +1 -0
- package/dist/document/stores/snake/index.d.ts +7 -0
- package/dist/document/stores/snake/index.js +4 -0
- package/dist/document/stores/snake/index.js.map +1 -0
- package/dist/document/stores/types.d.ts +95 -0
- package/dist/document/text-streams/core.d.ts +17 -0
- package/dist/document/text-streams/core.js +45 -0
- package/dist/document/text-streams/core.js.map +1 -0
- package/dist/document/text-streams/draft.d.ts +20 -0
- package/dist/document/text-streams/draft.js +70 -0
- package/dist/document/text-streams/draft.js.map +1 -0
- package/dist/document/text-streams/file-access.d.ts +6 -0
- package/dist/document/text-streams/file-access.js +31 -0
- package/dist/document/text-streams/file-access.js.map +1 -0
- package/dist/document/text-streams/index.d.ts +7 -0
- package/dist/document/text-streams/index.js +5 -0
- package/dist/document/text-streams/index.js.map +1 -0
- package/dist/document/text-streams/sentence.d.ts +13 -0
- package/dist/document/text-streams/sentence.js +77 -0
- package/dist/document/text-streams/sentence.js.map +1 -0
- package/dist/document/text-streams/serial.d.ts +24 -0
- package/dist/document/text-streams/serial.js +324 -0
- package/dist/document/text-streams/serial.js.map +1 -0
- package/dist/document/text-streams/types.d.ts +55 -0
- package/dist/document/text-streams/types.js +10 -0
- package/dist/document/text-streams/types.js.map +1 -0
- package/dist/external/guaranteed/classifier.js.map +1 -0
- package/dist/external/guaranteed/errors.js.map +1 -0
- package/dist/external/guaranteed/index.js.map +1 -0
- package/dist/external/guaranteed/request.js.map +1 -0
- package/dist/external/guaranteed/response.js.map +1 -0
- package/dist/external/llm/cache.js +35 -0
- package/dist/external/llm/cache.js.map +1 -0
- package/dist/external/llm/client/core.d.ts +26 -0
- package/dist/external/llm/client/core.js +321 -0
- package/dist/external/llm/client/core.js.map +1 -0
- package/dist/external/llm/client/files.d.ts +6 -0
- package/dist/external/llm/client/files.js +29 -0
- package/dist/external/llm/client/files.js.map +1 -0
- package/dist/external/llm/client/generation.d.ts +16 -0
- package/dist/external/llm/client/generation.js +35 -0
- package/dist/external/llm/client/generation.js.map +1 -0
- package/dist/external/llm/client/index.d.ts +5 -0
- package/dist/external/llm/client/index.js +5 -0
- package/dist/external/llm/client/index.js.map +1 -0
- package/dist/external/llm/client/log.d.ts +22 -0
- package/dist/external/llm/client/log.js +106 -0
- package/dist/external/llm/client/log.js.map +1 -0
- package/dist/external/llm/client/model.d.ts +10 -0
- package/dist/external/llm/client/model.js +26 -0
- package/dist/external/llm/client/model.js.map +1 -0
- package/dist/external/llm/client/retry.d.ts +4 -0
- package/dist/external/llm/client/retry.js +91 -0
- package/dist/external/llm/client/retry.js.map +1 -0
- package/dist/external/llm/context.js +78 -0
- package/dist/external/llm/context.js.map +1 -0
- package/dist/external/llm/errors.js.map +1 -0
- package/dist/external/llm/index.d.ts +7 -0
- package/dist/external/llm/index.js +17 -0
- package/dist/external/llm/index.js.map +1 -0
- package/dist/external/llm/request-log.js +35 -0
- package/dist/external/llm/request-log.js.map +1 -0
- package/dist/external/llm/sampling.js.map +1 -0
- package/dist/external/wikimatch/enrichment.d.ts +15 -0
- package/dist/external/wikimatch/enrichment.js +61 -0
- package/dist/external/wikimatch/enrichment.js.map +1 -0
- package/dist/external/wikimatch/index.d.ts +19 -0
- package/dist/external/wikimatch/index.js +66 -0
- package/dist/external/wikimatch/index.js.map +1 -0
- package/dist/external/wikimatch/option-narrowing.d.ts +19 -0
- package/dist/external/wikimatch/option-narrowing.js.map +1 -0
- package/dist/external/wikimatch/options.d.ts +16 -0
- package/dist/external/wikimatch/options.js +154 -0
- package/dist/external/wikimatch/options.js.map +1 -0
- package/dist/external/wikimatch/policy-judge.d.ts +19 -0
- package/dist/external/wikimatch/policy-judge.js +431 -0
- package/dist/external/wikimatch/policy-judge.js.map +1 -0
- package/dist/external/wikimatch/range-suppression.js.map +1 -0
- package/dist/external/wikimatch/surface/index.d.ts +10 -0
- package/dist/external/wikimatch/surface/index.js +3 -0
- package/dist/external/wikimatch/surface/index.js.map +1 -0
- package/dist/external/wikimatch/surface/screening.d.ts +18 -0
- package/dist/external/wikimatch/surface/screening.js +168 -0
- package/dist/external/wikimatch/surface/screening.js.map +1 -0
- package/dist/external/wikimatch/surface/window.d.ts +8 -0
- package/dist/external/wikimatch/surface/window.js +44 -0
- package/dist/external/wikimatch/surface/window.js.map +1 -0
- package/dist/external/wikimatch/types.d.ts +153 -0
- package/dist/external/wikimatch/wikispine.d.ts +45 -0
- package/dist/external/wikimatch/wikispine.js.map +1 -0
- package/dist/external/wikimatch/window.d.ts +8 -0
- package/dist/external/wikimatch/window.js.map +1 -0
- package/dist/external/wikimatch/words.js.map +1 -0
- package/dist/external/wikipage/cache.d.ts +20 -0
- package/dist/external/wikipage/cache.js +442 -0
- package/dist/external/wikipage/cache.js.map +1 -0
- package/dist/external/wikipage/fetch-log.js +146 -0
- package/dist/external/wikipage/fetch-log.js.map +1 -0
- package/dist/external/wikipage/index.d.ts +15 -0
- package/dist/external/wikipage/index.js +17 -0
- package/dist/external/wikipage/index.js.map +1 -0
- package/dist/external/wikipage/normalizer.d.ts +16 -0
- package/dist/external/wikipage/normalizer.js +188 -0
- package/dist/external/wikipage/normalizer.js.map +1 -0
- package/dist/external/wikipage/rate-limiter.js.map +1 -0
- package/dist/external/wikipage/resolver.d.ts +22 -0
- package/dist/external/wikipage/resolver.js +359 -0
- package/dist/external/wikipage/resolver.js.map +1 -0
- package/dist/external/wikipage/types.d.ts +118 -0
- package/dist/external/wikipage/wikimedia-client/core.d.ts +13 -0
- package/dist/external/wikipage/wikimedia-client/core.js +207 -0
- package/dist/external/wikipage/wikimedia-client/core.js.map +1 -0
- package/dist/external/wikipage/wikimedia-client/html.d.ts +7 -0
- package/dist/external/wikipage/wikimedia-client/html.js +136 -0
- package/dist/external/wikipage/wikimedia-client/html.js.map +1 -0
- package/dist/external/wikipage/wikimedia-client/index.d.ts +5 -0
- package/dist/external/wikipage/wikimedia-client/index.js +4 -0
- package/dist/external/wikipage/wikimedia-client/index.js.map +1 -0
- package/dist/external/wikipage/wikimedia-client/json.d.ts +7 -0
- package/dist/external/wikipage/wikimedia-client/json.js +27 -0
- package/dist/external/wikipage/wikimedia-client/json.js.map +1 -0
- package/dist/external/wikipage/wikimedia-client/request.d.ts +12 -0
- package/dist/external/wikipage/wikimedia-client/request.js +51 -0
- package/dist/external/wikipage/wikimedia-client/request.js.map +1 -0
- package/dist/external/wikipage/wikimedia-client/wiki.d.ts +54 -0
- package/dist/external/wikipage/wikimedia-client/wiki.js +28 -0
- package/dist/external/wikipage/wikimedia-client/wiki.js.map +1 -0
- package/dist/gc.cjs +8188 -8373
- package/dist/gc.cjs.map +1 -1
- package/dist/gc.d.cts +23 -3
- package/dist/gc.d.ts +2 -2
- package/dist/gc.js +1 -1
- package/dist/gc.js.map +1 -1
- package/dist/graph/evidence-selection/anchor/index.d.ts +4 -0
- package/dist/graph/evidence-selection/anchor/index.js +3 -0
- package/dist/graph/evidence-selection/anchor/index.js.map +1 -0
- package/dist/graph/evidence-selection/anchor/resolver/index.d.ts +38 -0
- package/dist/graph/evidence-selection/anchor/resolver/index.js +418 -0
- package/dist/graph/evidence-selection/anchor/resolver/index.js.map +1 -0
- package/dist/graph/evidence-selection/anchor/resolver/matcher.d.ts +8 -0
- package/dist/graph/evidence-selection/anchor/resolver/matcher.js +178 -0
- package/dist/graph/evidence-selection/anchor/resolver/matcher.js.map +1 -0
- package/dist/graph/evidence-selection/anchor/resolver/parser.d.ts +7 -0
- package/dist/graph/evidence-selection/anchor/resolver/parser.js +91 -0
- package/dist/graph/evidence-selection/anchor/resolver/parser.js.map +1 -0
- package/dist/graph/evidence-selection/anchor/resolver/scoring.d.ts +20 -0
- package/dist/graph/evidence-selection/anchor/resolver/scoring.js +119 -0
- package/dist/graph/evidence-selection/anchor/resolver/scoring.js.map +1 -0
- package/dist/graph/evidence-selection/anchor/resolver/types.d.ts +15 -0
- package/dist/graph/evidence-selection/anchor/resolver/types.js +17 -0
- package/dist/graph/evidence-selection/anchor/resolver/types.js.map +1 -0
- package/dist/graph/evidence-selection/anchor/types.d.ts +27 -0
- package/dist/graph/evidence-selection/index.d.ts +9 -0
- package/dist/graph/evidence-selection/index.js +32 -0
- package/dist/graph/evidence-selection/index.js.map +1 -0
- package/dist/graph/evidence-selection/prompt.js.map +1 -0
- package/dist/graph/evidence-selection/quote-score.js.map +1 -0
- package/dist/graph/evidence-selection/resolver.js +303 -0
- package/dist/graph/evidence-selection/resolver.js.map +1 -0
- package/dist/graph/evidence-selection/text.js.map +1 -0
- package/dist/graph/knowledge-build/artifact-io.d.ts +12 -0
- package/dist/graph/knowledge-build/artifact-io.js +151 -0
- package/dist/graph/knowledge-build/artifact-io.js.map +1 -0
- package/dist/graph/knowledge-build/artifact.d.ts +17 -0
- package/dist/graph/knowledge-build/artifact.js +66 -0
- package/dist/graph/knowledge-build/artifact.js.map +1 -0
- package/dist/graph/knowledge-build/candidates.d.ts +24 -0
- package/dist/graph/knowledge-build/candidates.js +60 -0
- package/dist/graph/knowledge-build/candidates.js.map +1 -0
- package/dist/graph/knowledge-build/commit.d.ts +39 -0
- package/dist/graph/knowledge-build/commit.js +52 -0
- package/dist/graph/knowledge-build/commit.js.map +1 -0
- package/dist/graph/knowledge-build/constants.d.ts +6 -0
- package/dist/graph/knowledge-build/constants.js +11 -0
- package/dist/graph/knowledge-build/constants.js.map +1 -0
- package/dist/graph/knowledge-build/fragments.d.ts +33 -0
- package/dist/graph/knowledge-build/fragments.js +36 -0
- package/dist/graph/knowledge-build/fragments.js.map +1 -0
- package/dist/graph/knowledge-build/generate.d.ts +39 -0
- package/dist/graph/knowledge-build/generate.js +128 -0
- package/dist/graph/knowledge-build/generate.js.map +1 -0
- package/dist/graph/knowledge-build/grounding-runner.d.ts +23 -0
- package/dist/graph/knowledge-build/grounding-runner.js +90 -0
- package/dist/graph/knowledge-build/grounding-runner.js.map +1 -0
- package/dist/graph/knowledge-build/grounding.d.ts +19 -0
- package/dist/graph/knowledge-build/grounding.js +158 -0
- package/dist/graph/knowledge-build/grounding.js.map +1 -0
- package/dist/graph/knowledge-build/index.d.ts +40 -0
- package/dist/graph/knowledge-build/index.js +8 -0
- package/dist/graph/knowledge-build/index.js.map +1 -0
- package/dist/graph/knowledge-build/mentions.d.ts +25 -0
- package/dist/graph/knowledge-build/mentions.js +66 -0
- package/dist/graph/knowledge-build/mentions.js.map +1 -0
- package/dist/graph/knowledge-build/parameter.d.ts +19 -0
- package/dist/graph/knowledge-build/parameter.js +14 -0
- package/dist/graph/knowledge-build/parameter.js.map +1 -0
- package/dist/graph/knowledge-build/progress.d.ts +8 -0
- package/dist/graph/knowledge-build/progress.js +45 -0
- package/dist/graph/knowledge-build/progress.js.map +1 -0
- package/dist/graph/knowledge-build/relations.d.ts +22 -0
- package/dist/graph/knowledge-build/relations.js +118 -0
- package/dist/graph/knowledge-build/relations.js.map +1 -0
- package/dist/graph/knowledge-build/request.d.ts +8 -0
- package/dist/graph/knowledge-build/request.js +19 -0
- package/dist/graph/knowledge-build/request.js.map +1 -0
- package/dist/graph/knowledge-build/snapshot.d.ts +38 -0
- package/dist/graph/knowledge-build/snapshot.js +18 -0
- package/dist/graph/knowledge-build/snapshot.js.map +1 -0
- package/dist/graph/knowledge-build/types.d.ts +46 -0
- package/dist/graph/reading-build/artifact.d.ts +42 -0
- package/dist/graph/reading-build/artifact.js +162 -0
- package/dist/graph/reading-build/artifact.js.map +1 -0
- package/dist/graph/reading-build/copy.d.ts +28 -0
- package/dist/graph/reading-build/copy.js +65 -0
- package/dist/graph/reading-build/copy.js.map +1 -0
- package/dist/graph/reading-build/index.d.ts +39 -0
- package/dist/graph/reading-build/index.js +4 -0
- package/dist/graph/reading-build/index.js.map +1 -0
- package/dist/graph/reading-build/input.d.ts +32 -0
- package/dist/graph/reading-build/input.js +19 -0
- package/dist/graph/reading-build/input.js.map +1 -0
- package/dist/graph/reading-build/options.d.ts +47 -0
- package/dist/graph/reading-build/options.js +20 -0
- package/dist/graph/reading-build/options.js.map +1 -0
- package/dist/graph/reading-build/source-fragments.d.ts +15 -0
- package/dist/graph/reading-build/source-fragments.js +36 -0
- package/dist/graph/reading-build/source-fragments.js.map +1 -0
- package/dist/graph/reading-build/types.d.ts +57 -0
- package/dist/graph/reading.d.ts +73 -0
- package/dist/graph/reading.js +203 -0
- package/dist/graph/reading.js.map +1 -0
- package/dist/graph/topology/core.d.ts +42 -0
- package/dist/graph/topology/core.js +348 -0
- package/dist/graph/topology/core.js.map +1 -0
- package/dist/graph/topology/grouping.d.ts +13 -0
- package/dist/graph/topology/grouping.js.map +1 -0
- package/dist/graph/topology/index.d.ts +34 -0
- package/dist/graph/topology/index.js +5 -0
- package/dist/graph/topology/index.js.map +1 -0
- package/dist/graph/topology/resource-segmentation.d.ts +11 -0
- package/dist/graph/topology/resource-segmentation.js.map +1 -0
- package/dist/graph/topology/segment-incision.d.ts +16 -0
- package/dist/graph/topology/segment-incision.js.map +1 -0
- package/dist/graph/topology/snake/compare.d.ts +8 -0
- package/dist/graph/topology/snake/compare.js +29 -0
- package/dist/graph/topology/snake/compare.js.map +1 -0
- package/dist/graph/topology/snake/components.d.ts +12 -0
- package/dist/graph/topology/snake/components.js +80 -0
- package/dist/graph/topology/snake/components.js.map +1 -0
- package/dist/graph/topology/snake/constants.d.ts +7 -0
- package/dist/graph/topology/snake/constants.js +13 -0
- package/dist/graph/topology/snake/constants.js.map +1 -0
- package/dist/graph/topology/snake/detect.d.ts +9 -0
- package/dist/graph/topology/snake/detect.js +63 -0
- package/dist/graph/topology/snake/detect.js.map +1 -0
- package/dist/graph/topology/snake/detector.d.ts +3 -0
- package/dist/graph/topology/snake/detector.js +7 -0
- package/dist/graph/topology/snake/detector.js.map +1 -0
- package/dist/graph/topology/snake/fingerprints.d.ts +7 -0
- package/dist/graph/topology/snake/fingerprints.js +86 -0
- package/dist/graph/topology/snake/fingerprints.js.map +1 -0
- package/dist/graph/topology/snake/graph-builder.d.ts +14 -0
- package/dist/graph/topology/snake/graph-builder.js +76 -0
- package/dist/graph/topology/snake/graph-builder.js.map +1 -0
- package/dist/graph/topology/snake/graph.d.ts +7 -0
- package/dist/graph/topology/snake/graph.js +105 -0
- package/dist/graph/topology/snake/graph.js.map +1 -0
- package/dist/graph/topology/snake/index.d.ts +4 -0
- package/dist/graph/topology/snake/index.js +3 -0
- package/dist/graph/topology/snake/index.js.map +1 -0
- package/dist/graph/topology/snake/merge.d.ts +6 -0
- package/dist/graph/topology/snake/merge.js +174 -0
- package/dist/graph/topology/snake/merge.js.map +1 -0
- package/dist/graph/topology/snake/records.d.ts +12 -0
- package/dist/graph/topology/snake/records.js +35 -0
- package/dist/graph/topology/snake/records.js.map +1 -0
- package/dist/graph/topology/snake/types.d.ts +23 -0
- package/dist/graph/topology/snake/types.js +1 -0
- package/dist/graph/topology/snake/weights.d.ts +3 -0
- package/dist/graph/topology/snake/weights.js +17 -0
- package/dist/graph/topology/snake/weights.js.map +1 -0
- package/dist/graph/topology/weights.d.ts +10 -0
- package/dist/graph/topology/weights.js +84 -0
- package/dist/graph/topology/weights.js.map +1 -0
- package/dist/graph/wikilink/index.d.ts +12 -0
- package/dist/graph/wikilink/index.js.map +1 -0
- package/dist/graph/wikilink/relation-discovery.d.ts +33 -0
- package/dist/graph/wikilink/relation-discovery.js +477 -0
- package/dist/graph/wikilink/relation-discovery.js.map +1 -0
- package/dist/graph/wikilink/types.d.ts +25 -0
- package/dist/graph/wikilink/types.js +1 -0
- package/dist/graph/wikilink/window.d.ts +9 -0
- package/dist/graph/wikilink/window.js.map +1 -0
- package/dist/index.cjs +37880 -29183
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1657 -1421
- package/dist/index.d.ts +127 -72
- package/dist/index.js +333 -27
- package/dist/index.js.map +1 -1
- package/dist/library/index.d.ts +38 -0
- package/dist/library/index.js +6 -0
- package/dist/library/index.js.map +1 -0
- package/dist/library/lock.d.ts +9 -0
- package/dist/library/lock.js +121 -0
- package/dist/library/lock.js.map +1 -0
- package/dist/library/membership.d.ts +51 -0
- package/dist/library/membership.js +799 -0
- package/dist/library/membership.js.map +1 -0
- package/dist/library/query-helpers.d.ts +45 -0
- package/dist/library/query-helpers.js +45 -0
- package/dist/library/query-helpers.js.map +1 -0
- package/dist/library/query.d.ts +45 -0
- package/dist/library/query.js +422 -0
- package/dist/library/query.js.map +1 -0
- package/dist/library/registry.d.ts +39 -0
- package/dist/library/registry.js +591 -0
- package/dist/library/registry.js.map +1 -0
- package/dist/library/search-index.d.ts +87 -0
- package/dist/library/search-index.js +473 -0
- package/dist/library/search-index.js.map +1 -0
- package/dist/library/search-query.d.ts +32 -0
- package/dist/library/search-query.js +418 -0
- package/dist/library/search-query.js.map +1 -0
- package/dist/library/segments.d.ts +3 -0
- package/dist/library/segments.js +16 -0
- package/dist/library/segments.js.map +1 -0
- package/dist/maintenance/upgrade.d.ts +54 -0
- package/dist/maintenance/upgrade.js +199 -0
- package/dist/maintenance/upgrade.js.map +1 -0
- package/dist/object-stream.d.ts +170 -0
- package/dist/object-stream.js +732 -0
- package/dist/object-stream.js.map +1 -0
- package/dist/retrieval/query/archive-view/backlinks.d.ts +38 -0
- package/dist/retrieval/query/archive-view/backlinks.js +200 -0
- package/dist/retrieval/query/archive-view/backlinks.js.map +1 -0
- package/dist/retrieval/query/archive-view/collection.d.ts +33 -0
- package/dist/retrieval/query/archive-view/collection.js +327 -0
- package/dist/retrieval/query/archive-view/collection.js.map +1 -0
- package/dist/retrieval/query/archive-view/core.d.ts +44 -0
- package/dist/retrieval/query/archive-view/core.js +165 -0
- package/dist/retrieval/query/archive-view/core.js.map +1 -0
- package/dist/retrieval/query/archive-view/evidence-hydration.d.ts +41 -0
- package/dist/retrieval/query/archive-view/evidence-hydration.js +311 -0
- package/dist/retrieval/query/archive-view/evidence-hydration.js.map +1 -0
- package/dist/retrieval/query/archive-view/evidence.d.ts +31 -0
- package/dist/retrieval/query/archive-view/evidence.js +166 -0
- package/dist/retrieval/query/archive-view/evidence.js.map +1 -0
- package/dist/retrieval/query/archive-view/find.d.ts +41 -0
- package/dist/retrieval/query/archive-view/find.js +289 -0
- package/dist/retrieval/query/archive-view/find.js.map +1 -0
- package/dist/retrieval/query/archive-view/helper/constants.d.ts +15 -0
- package/dist/retrieval/query/archive-view/helper/constants.js +20 -0
- package/dist/retrieval/query/archive-view/helper/constants.js.map +1 -0
- package/dist/retrieval/query/archive-view/helper/index.d.ts +34 -0
- package/dist/retrieval/query/archive-view/helper/index.js +9 -0
- package/dist/retrieval/query/archive-view/helper/index.js.map +1 -0
- package/dist/retrieval/query/archive-view/helper/meta.d.ts +17 -0
- package/dist/retrieval/query/archive-view/helper/meta.js +57 -0
- package/dist/retrieval/query/archive-view/helper/meta.js.map +1 -0
- package/dist/retrieval/query/archive-view/helper/parse.d.ts +38 -0
- package/dist/retrieval/query/archive-view/helper/parse.js +71 -0
- package/dist/retrieval/query/archive-view/helper/parse.js.map +1 -0
- package/dist/retrieval/query/archive-view/helper/position.d.ts +39 -0
- package/dist/retrieval/query/archive-view/helper/position.js +75 -0
- package/dist/retrieval/query/archive-view/helper/position.js.map +1 -0
- package/dist/retrieval/query/archive-view/helper/results.d.ts +45 -0
- package/dist/retrieval/query/archive-view/helper/results.js +153 -0
- package/dist/retrieval/query/archive-view/helper/results.js.map +1 -0
- package/dist/retrieval/query/archive-view/helper/sort.d.ts +35 -0
- package/dist/retrieval/query/archive-view/helper/sort.js +88 -0
- package/dist/retrieval/query/archive-view/helper/sort.js.map +1 -0
- package/dist/retrieval/query/archive-view/helper/text.d.ts +46 -0
- package/dist/retrieval/query/archive-view/helper/text.js +91 -0
- package/dist/retrieval/query/archive-view/helper/text.js.map +1 -0
- package/dist/retrieval/query/archive-view/helper/uri.d.ts +4 -0
- package/dist/retrieval/query/archive-view/helper/uri.js +12 -0
- package/dist/retrieval/query/archive-view/helper/uri.js.map +1 -0
- package/dist/retrieval/query/archive-view/helpers.d.ts +34 -0
- package/dist/retrieval/query/archive-view/helpers.js +2 -0
- package/dist/retrieval/query/archive-view/helpers.js.map +1 -0
- package/dist/retrieval/query/archive-view/index-state.d.ts +35 -0
- package/dist/retrieval/query/archive-view/index-state.js +191 -0
- package/dist/retrieval/query/archive-view/index-state.js.map +1 -0
- package/dist/retrieval/query/archive-view/index.d.ts +41 -0
- package/dist/retrieval/query/archive-view/index.js +51 -0
- package/dist/retrieval/query/archive-view/index.js.map +1 -0
- package/dist/retrieval/query/archive-view/knowledge.d.ts +45 -0
- package/dist/retrieval/query/archive-view/knowledge.js +99 -0
- package/dist/retrieval/query/archive-view/knowledge.js.map +1 -0
- package/dist/retrieval/query/archive-view/pack.d.ts +30 -0
- package/dist/retrieval/query/archive-view/pack.js +49 -0
- package/dist/retrieval/query/archive-view/pack.js.map +1 -0
- package/dist/retrieval/query/archive-view/pages.d.ts +41 -0
- package/dist/retrieval/query/archive-view/pages.js +341 -0
- package/dist/retrieval/query/archive-view/pages.js.map +1 -0
- package/dist/retrieval/query/archive-view/references.d.ts +88 -0
- package/dist/retrieval/query/archive-view/references.js +287 -0
- package/dist/retrieval/query/archive-view/references.js.map +1 -0
- package/dist/retrieval/query/archive-view/related/core.d.ts +37 -0
- package/dist/retrieval/query/archive-view/related/core.js +163 -0
- package/dist/retrieval/query/archive-view/related/core.js.map +1 -0
- package/dist/retrieval/query/archive-view/related/entity.d.ts +33 -0
- package/dist/retrieval/query/archive-view/related/entity.js +93 -0
- package/dist/retrieval/query/archive-view/related/entity.js.map +1 -0
- package/dist/retrieval/query/archive-view/related/index.d.ts +37 -0
- package/dist/retrieval/query/archive-view/related/index.js +7 -0
- package/dist/retrieval/query/archive-view/related/index.js.map +1 -0
- package/dist/retrieval/query/archive-view/related/pagination.d.ts +31 -0
- package/dist/retrieval/query/archive-view/related/pagination.js +90 -0
- package/dist/retrieval/query/archive-view/related/pagination.js.map +1 -0
- package/dist/retrieval/query/archive-view/related/query.d.ts +31 -0
- package/dist/retrieval/query/archive-view/related/query.js +145 -0
- package/dist/retrieval/query/archive-view/related/query.js.map +1 -0
- package/dist/retrieval/query/archive-view/related/sort.d.ts +32 -0
- package/dist/retrieval/query/archive-view/related/sort.js +85 -0
- package/dist/retrieval/query/archive-view/related/sort.js.map +1 -0
- package/dist/retrieval/query/archive-view/related/wikipage.d.ts +37 -0
- package/dist/retrieval/query/archive-view/related/wikipage.js +43 -0
- package/dist/retrieval/query/archive-view/related/wikipage.js.map +1 -0
- package/dist/retrieval/query/archive-view/search/bucket-hydration.d.ts +31 -0
- package/dist/retrieval/query/archive-view/search/bucket-hydration.js +58 -0
- package/dist/retrieval/query/archive-view/search/bucket-hydration.js.map +1 -0
- package/dist/retrieval/query/archive-view/search/bucket-order.d.ts +36 -0
- package/dist/retrieval/query/archive-view/search/bucket-order.js +64 -0
- package/dist/retrieval/query/archive-view/search/bucket-order.js.map +1 -0
- package/dist/retrieval/query/archive-view/search/bucket.d.ts +30 -0
- package/dist/retrieval/query/archive-view/search/bucket.js +3 -0
- package/dist/retrieval/query/archive-view/search/bucket.js.map +1 -0
- package/dist/retrieval/query/archive-view/search/buckets.d.ts +42 -0
- package/dist/retrieval/query/archive-view/search/buckets.js +302 -0
- package/dist/retrieval/query/archive-view/search/buckets.js.map +1 -0
- package/dist/retrieval/query/archive-view/search/cache-input.d.ts +45 -0
- package/dist/retrieval/query/archive-view/search/cache-input.js +255 -0
- package/dist/retrieval/query/archive-view/search/cache-input.js.map +1 -0
- package/dist/retrieval/query/archive-view/search/core.d.ts +31 -0
- package/dist/retrieval/query/archive-view/search/core.js +388 -0
- package/dist/retrieval/query/archive-view/search/core.js.map +1 -0
- package/dist/retrieval/query/archive-view/search/hydration.d.ts +51 -0
- package/dist/retrieval/query/archive-view/search/hydration.js +234 -0
- package/dist/retrieval/query/archive-view/search/hydration.js.map +1 -0
- package/dist/retrieval/query/archive-view/search/index.d.ts +35 -0
- package/dist/retrieval/query/archive-view/search/index.js +7 -0
- package/dist/retrieval/query/archive-view/search/index.js.map +1 -0
- package/dist/retrieval/query/archive-view/source-evidence/core.d.ts +60 -0
- package/dist/retrieval/query/archive-view/source-evidence/core.js +330 -0
- package/dist/retrieval/query/archive-view/source-evidence/core.js.map +1 -0
- package/dist/retrieval/query/archive-view/source-evidence/index.d.ts +30 -0
- package/dist/retrieval/query/archive-view/source-evidence/index.js +5 -0
- package/dist/retrieval/query/archive-view/source-evidence/index.js.map +1 -0
- package/dist/retrieval/query/archive-view/source-evidence/pagination.d.ts +46 -0
- package/dist/retrieval/query/archive-view/source-evidence/pagination.js +82 -0
- package/dist/retrieval/query/archive-view/source-evidence/pagination.js.map +1 -0
- package/dist/retrieval/query/archive-view/source-evidence/ranges.d.ts +47 -0
- package/dist/retrieval/query/archive-view/source-evidence/ranges.js +209 -0
- package/dist/retrieval/query/archive-view/source-evidence/ranges.js.map +1 -0
- package/dist/retrieval/query/archive-view/source-evidence/read.d.ts +31 -0
- package/dist/retrieval/query/archive-view/source-evidence/read.js +49 -0
- package/dist/retrieval/query/archive-view/source-evidence/read.js.map +1 -0
- package/dist/retrieval/query/archive-view/source.d.ts +30 -0
- package/dist/retrieval/query/archive-view/source.js +2 -0
- package/dist/retrieval/query/archive-view/source.js.map +1 -0
- package/dist/retrieval/query/archive-view/text-streams.d.ts +44 -0
- package/dist/retrieval/query/archive-view/text-streams.js +160 -0
- package/dist/retrieval/query/archive-view/text-streams.js.map +1 -0
- package/dist/retrieval/query/archive-view/types.d.ts +363 -0
- package/dist/retrieval/query/archive-view/types.js +1 -0
- package/dist/retrieval/query/continuation-cursor/core.d.ts +6 -0
- package/dist/retrieval/query/continuation-cursor/core.js +82 -0
- package/dist/retrieval/query/continuation-cursor/core.js.map +1 -0
- package/dist/retrieval/query/continuation-cursor/index.d.ts +2 -0
- package/dist/retrieval/query/continuation-cursor/index.js +3 -0
- package/dist/retrieval/query/continuation-cursor/index.js.map +1 -0
- package/dist/retrieval/query/continuation-cursor/payload.d.ts +12 -0
- package/dist/retrieval/query/continuation-cursor/payload.js +285 -0
- package/dist/retrieval/query/continuation-cursor/payload.js.map +1 -0
- package/dist/retrieval/query/continuation-cursor/store.d.ts +10 -0
- package/dist/retrieval/query/continuation-cursor/store.js +65 -0
- package/dist/retrieval/query/continuation-cursor/store.js.map +1 -0
- package/dist/retrieval/query/continuation-cursor/types.d.ts +72 -0
- package/dist/retrieval/query/continuation-cursor/types.js +1 -0
- package/dist/retrieval/query/continuation-cursor/types.js.map +1 -0
- package/dist/retrieval/query/index.d.ts +47 -0
- package/dist/retrieval/query/index.js +63 -0
- package/dist/retrieval/query/index.js.map +1 -0
- package/dist/retrieval/query/lexical-search.js.map +1 -0
- package/dist/retrieval/query/search-cache/buckets.d.ts +32 -0
- package/dist/retrieval/query/search-cache/buckets.js +87 -0
- package/dist/retrieval/query/search-cache/buckets.js.map +1 -0
- package/dist/retrieval/query/search-cache/cursor.d.ts +42 -0
- package/dist/retrieval/query/search-cache/cursor.js +84 -0
- package/dist/retrieval/query/search-cache/cursor.js.map +1 -0
- package/dist/retrieval/query/search-cache/database.d.ts +7 -0
- package/dist/retrieval/query/search-cache/database.js +47 -0
- package/dist/retrieval/query/search-cache/database.js.map +1 -0
- package/dist/retrieval/query/search-cache/gc.d.ts +6 -0
- package/dist/retrieval/query/search-cache/gc.js +110 -0
- package/dist/retrieval/query/search-cache/gc.js.map +1 -0
- package/dist/retrieval/query/search-cache/hits.d.ts +42 -0
- package/dist/retrieval/query/search-cache/hits.js +446 -0
- package/dist/retrieval/query/search-cache/hits.js.map +1 -0
- package/dist/retrieval/query/search-cache/ids.d.ts +32 -0
- package/dist/retrieval/query/search-cache/ids.js +48 -0
- package/dist/retrieval/query/search-cache/ids.js.map +1 -0
- package/dist/retrieval/query/search-cache/index.d.ts +33 -0
- package/dist/retrieval/query/search-cache/index.js +46 -0
- package/dist/retrieval/query/search-cache/index.js.map +1 -0
- package/dist/retrieval/query/search-cache/parsing.d.ts +36 -0
- package/dist/retrieval/query/search-cache/parsing.js +38 -0
- package/dist/retrieval/query/search-cache/parsing.js.map +1 -0
- package/dist/retrieval/query/search-cache/schema.d.ts +7 -0
- package/dist/retrieval/query/search-cache/schema.js +117 -0
- package/dist/retrieval/query/search-cache/schema.js.map +1 -0
- package/dist/retrieval/query/search-cache/scores.d.ts +4 -0
- package/dist/retrieval/query/search-cache/scores.js +12 -0
- package/dist/retrieval/query/search-cache/scores.js.map +1 -0
- package/dist/retrieval/query/search-cache/sessions.d.ts +45 -0
- package/dist/retrieval/query/search-cache/sessions.js +330 -0
- package/dist/retrieval/query/search-cache/sessions.js.map +1 -0
- package/dist/retrieval/query/search-cache/store.d.ts +23 -0
- package/dist/retrieval/query/search-cache/store.js +111 -0
- package/dist/retrieval/query/search-cache/store.js.map +1 -0
- package/dist/retrieval/query/search-cache/types.d.ts +164 -0
- package/dist/retrieval/query/search-cache/types.js +9 -0
- package/dist/retrieval/query/search-cache/types.js.map +1 -0
- package/dist/retrieval/query/view.d.ts +41 -0
- package/dist/retrieval/query/view.js +2 -0
- package/dist/retrieval/query/view.js.map +1 -0
- package/dist/retrieval/search-index/index.d.ts +33 -0
- package/dist/retrieval/search-index/index.js +41 -0
- package/dist/retrieval/search-index/index.js.map +1 -0
- package/dist/retrieval/search-index/search/build.d.ts +39 -0
- package/dist/retrieval/search-index/search/build.js +212 -0
- package/dist/retrieval/search-index/search/build.js.map +1 -0
- package/dist/retrieval/search-index/search/core.d.ts +33 -0
- package/dist/retrieval/search-index/search/core.js +8 -0
- package/dist/retrieval/search-index/search/core.js.map +1 -0
- package/dist/retrieval/search-index/search/dirty.d.ts +30 -0
- package/dist/retrieval/search-index/search/dirty.js +28 -0
- package/dist/retrieval/search-index/search/dirty.js.map +1 -0
- package/dist/retrieval/search-index/search/errors.d.ts +3 -0
- package/dist/retrieval/search-index/search/errors.js +8 -0
- package/dist/retrieval/search-index/search/errors.js.map +1 -0
- package/dist/retrieval/search-index/search/fingerprint.d.ts +8 -0
- package/dist/retrieval/search-index/search/fingerprint.js +51 -0
- package/dist/retrieval/search-index/search/fingerprint.js.map +1 -0
- package/dist/retrieval/search-index/search/helpers.d.ts +44 -0
- package/dist/retrieval/search-index/search/helpers.js +109 -0
- package/dist/retrieval/search-index/search/helpers.js.map +1 -0
- package/dist/retrieval/search-index/search/index.d.ts +34 -0
- package/dist/retrieval/search-index/search/index.js +3 -0
- package/dist/retrieval/search-index/search/index.js.map +1 -0
- package/dist/retrieval/search-index/search/match.d.ts +34 -0
- package/dist/retrieval/search-index/search/match.js +82 -0
- package/dist/retrieval/search-index/search/match.js.map +1 -0
- package/dist/retrieval/search-index/search/query.d.ts +44 -0
- package/dist/retrieval/search-index/search/query.js +219 -0
- package/dist/retrieval/search-index/search/query.js.map +1 -0
- package/dist/retrieval/search-index/search/settings.d.ts +29 -0
- package/dist/retrieval/search-index/search/settings.js +35 -0
- package/dist/retrieval/search-index/search/settings.js.map +1 -0
- package/dist/retrieval/search-index/search/status.d.ts +31 -0
- package/dist/retrieval/search-index/search/status.js +70 -0
- package/dist/retrieval/search-index/search/status.js.map +1 -0
- package/dist/retrieval/search-index/search/tokenizer.js +225 -0
- package/dist/retrieval/search-index/search/tokenizer.js.map +1 -0
- package/dist/retrieval/search-index/search/types.d.ts +79 -0
- package/dist/retrieval/search-index/search/types.js +31 -0
- package/dist/retrieval/search-index/search/types.js.map +1 -0
- package/dist/retrieval/search-index/search/write.d.ts +10 -0
- package/dist/retrieval/search-index/search/write.js +70 -0
- package/dist/retrieval/search-index/search/write.js.map +1 -0
- package/dist/runtime/common/cli-command.js.map +1 -0
- package/dist/runtime/common/data-dir.js +49 -0
- package/dist/runtime/common/data-dir.js.map +1 -0
- package/dist/runtime/common/language.js.map +1 -0
- package/dist/runtime/common/llm-scope.js.map +1 -0
- package/dist/runtime/common/logging.js.map +1 -0
- package/dist/runtime/common/prompts.d.ts +6 -0
- package/dist/runtime/common/prompts.js +25 -0
- package/dist/runtime/common/prompts.js.map +1 -0
- package/dist/runtime/common/template.js.map +1 -0
- package/dist/runtime/common/tinyld-language.js.map +1 -0
- package/dist/runtime/common/wiki-graph/dir.d.ts +19 -0
- package/dist/runtime/common/wiki-graph/dir.js +68 -0
- package/dist/runtime/common/wiki-graph/dir.js.map +1 -0
- package/dist/runtime/common/wiki-graph/index.d.ts +3 -0
- package/dist/runtime/common/wiki-graph/index.js +4 -0
- package/dist/runtime/common/wiki-graph/index.js.map +1 -0
- package/dist/runtime/common/wiki-graph/temp.js +21 -0
- package/dist/runtime/common/wiki-graph/temp.js.map +1 -0
- package/dist/runtime/common/wiki-graph/uri.d.ts +37 -0
- package/dist/runtime/common/wiki-graph/uri.js +288 -0
- package/dist/runtime/common/wiki-graph/uri.js.map +1 -0
- package/dist/runtime/context/index.d.ts +1 -0
- package/dist/runtime/context/index.js +13 -0
- package/dist/runtime/context/index.js.map +1 -0
- package/dist/runtime/context/task.js +111 -0
- package/dist/runtime/context/task.js.map +1 -0
- package/dist/runtime/gc/files.js +141 -0
- package/dist/runtime/gc/files.js.map +1 -0
- package/dist/runtime/gc/index.js.map +1 -0
- package/dist/runtime/gc/lock.js +137 -0
- package/dist/runtime/gc/lock.js.map +1 -0
- package/dist/runtime/gc/runner.js +134 -0
- package/dist/runtime/gc/runner.js.map +1 -0
- package/dist/runtime/gc/temp.js +57 -0
- package/dist/runtime/gc/temp.js.map +1 -0
- package/dist/runtime/gc/types.js +1 -0
- package/dist/runtime/gc/types.js.map +1 -0
- package/dist/runtime/jobs/conflicts.d.ts +16 -0
- package/dist/runtime/jobs/conflicts.js +61 -0
- package/dist/runtime/jobs/conflicts.js.map +1 -0
- package/dist/runtime/jobs/database.d.ts +12 -0
- package/dist/runtime/jobs/database.js +74 -0
- package/dist/runtime/jobs/database.js.map +1 -0
- package/dist/runtime/jobs/events.d.ts +6 -0
- package/dist/runtime/jobs/events.js +29 -0
- package/dist/runtime/jobs/events.js.map +1 -0
- package/dist/runtime/jobs/gc.d.ts +10 -0
- package/dist/runtime/jobs/gc.js +81 -0
- package/dist/runtime/jobs/gc.js.map +1 -0
- package/dist/runtime/jobs/helpers.d.ts +6 -0
- package/dist/runtime/jobs/helpers.js +35 -0
- package/dist/runtime/jobs/helpers.js.map +1 -0
- package/dist/runtime/jobs/index.d.ts +7 -0
- package/dist/runtime/jobs/index.js +42 -0
- package/dist/runtime/jobs/index.js.map +1 -0
- package/dist/runtime/jobs/jobs.d.ts +24 -0
- package/dist/runtime/jobs/jobs.js +416 -0
- package/dist/runtime/jobs/jobs.js.map +1 -0
- package/dist/runtime/jobs/paths.d.ts +9 -0
- package/dist/runtime/jobs/paths.js +48 -0
- package/dist/runtime/jobs/paths.js.map +1 -0
- package/dist/runtime/jobs/progress.d.ts +37 -0
- package/dist/runtime/jobs/progress.js +246 -0
- package/dist/runtime/jobs/progress.js.map +1 -0
- package/dist/runtime/jobs/recovery.d.ts +6 -0
- package/dist/runtime/jobs/recovery.js +40 -0
- package/dist/runtime/jobs/recovery.js.map +1 -0
- package/dist/runtime/jobs/row.d.ts +10 -0
- package/dist/runtime/jobs/row.js +92 -0
- package/dist/runtime/jobs/row.js.map +1 -0
- package/dist/runtime/jobs/schema.d.ts +3 -0
- package/dist/runtime/jobs/schema.js +55 -0
- package/dist/runtime/jobs/schema.js.map +1 -0
- package/dist/runtime/jobs/state.d.ts +13 -0
- package/dist/runtime/jobs/state.js +156 -0
- package/dist/runtime/jobs/state.js.map +1 -0
- package/dist/runtime/jobs/types.d.ts +141 -0
- package/dist/runtime/jobs/types.js +13 -0
- package/dist/runtime/jobs/types.js.map +1 -0
- package/dist/runtime/jobs/worker.d.ts +5 -0
- package/dist/runtime/jobs/worker.js +241 -0
- package/dist/runtime/jobs/worker.js.map +1 -0
- package/dist/runtime/progress/index.js.map +1 -0
- package/dist/runtime/progress/reporter.js.map +1 -0
- package/dist/runtime/progress/tracker.js.map +1 -0
- package/dist/runtime/progress/types.js +1 -0
- package/dist/runtime/progress/types.js.map +1 -0
- package/dist/serial.d.ts +36 -85
- package/dist/serial.js +1 -475
- package/dist/serial.js.map +1 -1
- package/dist/state-lock.d.ts +21 -0
- package/dist/state-lock.js +233 -0
- package/dist/state-lock.js.map +1 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/archive.d.ts +11 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/archive.js +94 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/archive.js.map +1 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/database.d.ts +7 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/database.js +28 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/database.js.map +1 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/extract.d.ts +3 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/extract.js +68 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/extract.js.map +1 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/index.js +47 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/index.js.map +1 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/schema.d.ts +3 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/schema.js +41 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/schema.js.map +1 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/text-storage/core.d.ts +3 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/text-storage/core.js +77 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/text-storage/core.js.map +1 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/text-storage/fragments.d.ts +10 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/text-storage/fragments.js +123 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/text-storage/fragments.js.map +1 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/text-storage/index.d.ts +1 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/text-storage/index.js +2 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/text-storage/index.js.map +1 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/text-storage/references.d.ts +5 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/text-storage/references.js +305 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/text-storage/references.js.map +1 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/text-storage/source-text.d.ts +11 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/text-storage/source-text.js +62 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/text-storage/source-text.js.map +1 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/text-storage/summaries.d.ts +3 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/text-storage/summaries.js +45 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/text-storage/summaries.js.map +1 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/text-storage/types.d.ts +19 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/text-storage/types.js +1 -0
- package/dist/storage/migration/legacy-sdpub/upgrade/text-storage/types.js.map +1 -0
- package/dist/storage/schema-upgrade/index.d.ts +8 -0
- package/dist/storage/schema-upgrade/index.js +308 -0
- package/dist/storage/schema-upgrade/index.js.map +1 -0
- package/dist/storage/wikg/archive/constants.d.ts +6 -0
- package/dist/storage/wikg/archive/constants.js +19 -0
- package/dist/storage/wikg/archive/constants.js.map +1 -0
- package/dist/storage/wikg/archive/document-files.d.ts +11 -0
- package/dist/storage/wikg/archive/document-files.js +70 -0
- package/dist/storage/wikg/archive/document-files.js.map +1 -0
- package/dist/storage/wikg/archive/extract.d.ts +3 -0
- package/dist/storage/wikg/archive/extract.js +37 -0
- package/dist/storage/wikg/archive/extract.js.map +1 -0
- package/dist/storage/wikg/archive/index.d.ts +6 -0
- package/dist/storage/wikg/archive/index.js +25 -0
- package/dist/storage/wikg/archive/index.js.map +1 -0
- package/dist/storage/wikg/archive/manifest.d.ts +11 -0
- package/dist/storage/wikg/archive/manifest.js +60 -0
- package/dist/storage/wikg/archive/manifest.js.map +1 -0
- package/dist/storage/wikg/archive/paths.d.ts +9 -0
- package/dist/storage/wikg/archive/paths.js +46 -0
- package/dist/storage/wikg/archive/paths.js.map +1 -0
- package/dist/storage/wikg/archive/reader.d.ts +17 -0
- package/dist/storage/wikg/archive/reader.js +101 -0
- package/dist/storage/wikg/archive/reader.js.map +1 -0
- package/dist/storage/wikg/archive/types.d.ts +10 -0
- package/dist/storage/wikg/archive/types.js +1 -0
- package/dist/storage/wikg/archive/types.js.map +1 -0
- package/dist/storage/wikg/archive/write.d.ts +8 -0
- package/dist/storage/wikg/archive/write.js +155 -0
- package/dist/storage/wikg/archive/write.js.map +1 -0
- package/dist/storage/wikg/archive/zip.d.ts +13 -0
- package/dist/storage/wikg/archive/zip.js +122 -0
- package/dist/storage/wikg/archive/zip.js.map +1 -0
- package/dist/storage/wikg/archive-uri.d.ts +1 -0
- package/dist/storage/wikg/archive-uri.js +39 -0
- package/dist/storage/wikg/archive-uri.js.map +1 -0
- package/dist/storage/wikg/coordinator.d.ts +29 -0
- package/dist/storage/wikg/coordinator.js +2 -0
- package/dist/storage/wikg/coordinator.js.map +1 -0
- package/dist/storage/wikg/index.d.ts +41 -0
- package/dist/storage/wikg/index.js +68 -0
- package/dist/storage/wikg/index.js.map +1 -0
- package/dist/storage/wikg/wikg-coordinator/activity.d.ts +4 -0
- package/dist/storage/wikg/wikg-coordinator/activity.js +48 -0
- package/dist/storage/wikg/wikg-coordinator/activity.js.map +1 -0
- package/dist/storage/wikg/wikg-coordinator/archive-key.d.ts +7 -0
- package/dist/storage/wikg/wikg-coordinator/archive-key.js +38 -0
- package/dist/storage/wikg/wikg-coordinator/archive-key.js.map +1 -0
- package/dist/storage/wikg/wikg-coordinator/constants.d.ts +9 -0
- package/dist/storage/wikg/wikg-coordinator/constants.js +19 -0
- package/dist/storage/wikg/wikg-coordinator/constants.js.map +1 -0
- package/dist/storage/wikg/wikg-coordinator/facade.d.ts +40 -0
- package/dist/storage/wikg/wikg-coordinator/facade.js +43 -0
- package/dist/storage/wikg/wikg-coordinator/facade.js.map +1 -0
- package/dist/storage/wikg/wikg-coordinator/file-store.d.ts +52 -0
- package/dist/storage/wikg/wikg-coordinator/file-store.js +369 -0
- package/dist/storage/wikg/wikg-coordinator/file-store.js.map +1 -0
- package/dist/storage/wikg/wikg-coordinator/flusher.d.ts +4 -0
- package/dist/storage/wikg/wikg-coordinator/flusher.js +115 -0
- package/dist/storage/wikg/wikg-coordinator/flusher.js.map +1 -0
- package/dist/storage/wikg/wikg-coordinator/gc.d.ts +5 -0
- package/dist/storage/wikg/wikg-coordinator/gc.js +197 -0
- package/dist/storage/wikg/wikg-coordinator/gc.js.map +1 -0
- package/dist/storage/wikg/wikg-coordinator/index.d.ts +29 -0
- package/dist/storage/wikg/wikg-coordinator/index.js +11 -0
- package/dist/storage/wikg/wikg-coordinator/index.js.map +1 -0
- package/dist/storage/wikg/wikg-coordinator/locks.d.ts +19 -0
- package/dist/storage/wikg/wikg-coordinator/locks.js +194 -0
- package/dist/storage/wikg/wikg-coordinator/locks.js.map +1 -0
- package/dist/storage/wikg/wikg-coordinator/overlays.d.ts +32 -0
- package/dist/storage/wikg/wikg-coordinator/overlays.js +141 -0
- package/dist/storage/wikg/wikg-coordinator/overlays.js.map +1 -0
- package/dist/storage/wikg/wikg-coordinator/owners.d.ts +15 -0
- package/dist/storage/wikg/wikg-coordinator/owners.js +95 -0
- package/dist/storage/wikg/wikg-coordinator/owners.js.map +1 -0
- package/dist/storage/wikg/wikg-coordinator/search-index-cache.d.ts +9 -0
- package/dist/storage/wikg/wikg-coordinator/search-index-cache.js +164 -0
- package/dist/storage/wikg/wikg-coordinator/search-index-cache.js.map +1 -0
- package/dist/storage/wikg/wikg-coordinator/session.d.ts +43 -0
- package/dist/storage/wikg/wikg-coordinator/session.js +147 -0
- package/dist/storage/wikg/wikg-coordinator/session.js.map +1 -0
- package/dist/storage/wikg/wikg-coordinator/state.d.ts +16 -0
- package/dist/storage/wikg/wikg-coordinator/state.js +258 -0
- package/dist/storage/wikg/wikg-coordinator/state.js.map +1 -0
- package/dist/storage/wikg/wikg-coordinator/types.d.ts +28 -0
- package/dist/storage/wikg/wikg-coordinator/types.js +1 -0
- package/dist/storage/wikg/wikg-coordinator/types.js.map +1 -0
- package/dist/storage/wikg/wikg-coordinator/workspace.d.ts +8 -0
- package/dist/storage/wikg/wikg-coordinator/workspace.js +60 -0
- package/dist/storage/wikg/wikg-coordinator/workspace.js.map +1 -0
- package/dist/storage/wikg/wiki-graph-archive-file.d.ts +45 -0
- package/dist/storage/wikg/wiki-graph-archive-file.js +78 -0
- package/dist/storage/wikg/wiki-graph-archive-file.js.map +1 -0
- package/dist/text/editor/clue.d.ts +40 -0
- package/dist/text/editor/clue.js.map +1 -0
- package/dist/text/editor/compression.d.ts +52 -0
- package/dist/text/editor/compression.js +253 -0
- package/dist/text/editor/compression.js.map +1 -0
- package/dist/text/editor/compressor.d.ts +19 -0
- package/dist/text/editor/compressor.js +123 -0
- package/dist/text/editor/compressor.js.map +1 -0
- package/dist/text/editor/feedback.d.ts +16 -0
- package/dist/text/editor/feedback.js.map +1 -0
- package/dist/text/editor/index.d.ts +30 -0
- package/dist/text/editor/index.js +5 -0
- package/dist/text/editor/index.js.map +1 -0
- package/dist/text/editor/language-review.d.ts +14 -0
- package/dist/text/editor/language-review.js +35 -0
- package/dist/text/editor/language-review.js.map +1 -0
- package/dist/text/editor/log.d.ts +50 -0
- package/dist/text/editor/log.js +202 -0
- package/dist/text/editor/log.js.map +1 -0
- package/dist/text/editor/markup.d.ts +18 -0
- package/dist/text/editor/markup.js +294 -0
- package/dist/text/editor/markup.js.map +1 -0
- package/dist/text/editor/prompt-templates.js.map +1 -0
- package/dist/text/editor/response.js.map +1 -0
- package/dist/text/editor/review.d.ts +47 -0
- package/dist/text/editor/review.js +189 -0
- package/dist/text/editor/review.js.map +1 -0
- package/dist/text/editor/types.js +21 -0
- package/dist/text/editor/types.js.map +1 -0
- package/dist/text/output/epub/archive.js.map +1 -0
- package/dist/text/output/epub/book.d.ts +28 -0
- package/dist/text/output/epub/book.js.map +1 -0
- package/dist/text/output/epub/content.js.map +1 -0
- package/dist/text/output/epub/index.d.ts +33 -0
- package/dist/text/output/epub/index.js.map +1 -0
- package/dist/text/output/epub/model.js.map +1 -0
- package/dist/text/output/epub/navigation.js.map +1 -0
- package/dist/text/output/epub/package.js.map +1 -0
- package/dist/text/output/epub/shared.js.map +1 -0
- package/dist/text/output/epub/templates.js +26 -0
- package/dist/text/output/epub/templates.js.map +1 -0
- package/dist/text/output/index.d.ts +27 -0
- package/dist/text/output/index.js.map +1 -0
- package/dist/text/output/plain-text.d.ts +31 -0
- package/dist/text/output/plain-text.js.map +1 -0
- package/dist/text/reader/attention/core.d.ts +39 -0
- package/dist/text/reader/attention/core.js +123 -0
- package/dist/text/reader/attention/core.js.map +1 -0
- package/dist/text/reader/attention/index.d.ts +9 -0
- package/dist/text/reader/attention/index.js +5 -0
- package/dist/text/reader/attention/index.js.map +1 -0
- package/dist/text/reader/attention/wave-reflection.d.ts +21 -0
- package/dist/text/reader/attention/wave-reflection.js.map +1 -0
- package/dist/text/reader/attention/working-memory.d.ts +28 -0
- package/dist/text/reader/attention/working-memory.js.map +1 -0
- package/dist/text/reader/chunk-batch/extract.d.ts +13 -0
- package/dist/text/reader/chunk-batch/extract.js.map +1 -0
- package/dist/text/reader/chunk-batch/extractor.d.ts +17 -0
- package/dist/text/reader/chunk-batch/extractor.js +337 -0
- package/dist/text/reader/chunk-batch/extractor.js.map +1 -0
- package/dist/text/reader/chunk-batch/fragment-projection.d.ts +34 -0
- package/dist/text/reader/chunk-batch/fragment-projection.js.map +1 -0
- package/dist/text/reader/chunk-batch/index.d.ts +13 -0
- package/dist/text/reader/chunk-batch/index.js +13 -0
- package/dist/text/reader/chunk-batch/index.js.map +1 -0
- package/dist/text/reader/chunk-batch/language.d.ts +9 -0
- package/dist/text/reader/chunk-batch/language.js +23 -0
- package/dist/text/reader/chunk-batch/language.js.map +1 -0
- package/dist/text/reader/chunk-batch/parser/annotations.d.ts +19 -0
- package/dist/text/reader/chunk-batch/parser/annotations.js +34 -0
- package/dist/text/reader/chunk-batch/parser/annotations.js.map +1 -0
- package/dist/text/reader/chunk-batch/parser/core.d.ts +33 -0
- package/dist/text/reader/chunk-batch/parser/core.js +171 -0
- package/dist/text/reader/chunk-batch/parser/core.js.map +1 -0
- package/dist/text/reader/chunk-batch/parser/evidence.d.ts +21 -0
- package/dist/text/reader/chunk-batch/parser/evidence.js +40 -0
- package/dist/text/reader/chunk-batch/parser/evidence.js.map +1 -0
- package/dist/text/reader/chunk-batch/parser/helpers.d.ts +27 -0
- package/dist/text/reader/chunk-batch/parser/helpers.js +98 -0
- package/dist/text/reader/chunk-batch/parser/helpers.js.map +1 -0
- package/dist/text/reader/chunk-batch/parser/index.d.ts +13 -0
- package/dist/text/reader/chunk-batch/parser/index.js +3 -0
- package/dist/text/reader/chunk-batch/parser/index.js.map +1 -0
- package/dist/text/reader/chunk-batch/parser/links.d.ts +17 -0
- package/dist/text/reader/chunk-batch/parser/links.js +44 -0
- package/dist/text/reader/chunk-batch/parser/links.js.map +1 -0
- package/dist/text/reader/chunk-batch/parser/resolver.d.ts +28 -0
- package/dist/text/reader/chunk-batch/parser/resolver.js +267 -0
- package/dist/text/reader/chunk-batch/parser/resolver.js.map +1 -0
- package/dist/text/reader/chunk-batch/parser/schema.d.ts +136 -0
- package/dist/text/reader/chunk-batch/parser/schema.js +71 -0
- package/dist/text/reader/chunk-batch/parser/schema.js.map +1 -0
- package/dist/text/reader/chunk-batch/prompt-templates.js.map +1 -0
- package/dist/text/reader/chunk-batch/types.d.ts +85 -0
- package/dist/text/reader/chunk-batch/types.js +1 -0
- package/dist/text/reader/chunk-batch/types.js.map +1 -0
- package/dist/text/reader/core.d.ts +37 -0
- package/dist/text/reader/core.js +82 -0
- package/dist/text/reader/core.js.map +1 -0
- package/dist/text/reader/index.d.ts +13 -0
- package/dist/text/reader/index.js +7 -0
- package/dist/text/reader/index.js.map +1 -0
- package/dist/text/reader/segment/core.js +9 -0
- package/dist/text/reader/segment/core.js.map +1 -0
- package/dist/text/reader/segment/index.d.ts +2 -0
- package/dist/text/reader/segment/index.js +5 -0
- package/dist/text/reader/segment/index.js.map +1 -0
- package/dist/text/reader/segment/intl-segmenter.js.map +1 -0
- package/dist/text/reader/segment/types.js +1 -0
- package/dist/text/reader/segment/types.js.map +1 -0
- package/dist/text/reader/types.d.ts +29 -0
- package/dist/text/reader/types.js +1 -0
- package/dist/text/reader/types.js.map +1 -0
- package/dist/text/serial/discovery.d.ts +36 -0
- package/dist/text/serial/discovery.js +5 -0
- package/dist/text/serial/discovery.js.map +1 -0
- package/dist/text/serial/fragments.d.ts +67 -0
- package/dist/text/serial/fragments.js +121 -0
- package/dist/text/serial/fragments.js.map +1 -0
- package/dist/text/serial/generation.d.ts +48 -0
- package/dist/text/serial/generation.js +257 -0
- package/dist/text/serial/generation.js.map +1 -0
- package/dist/text/serial/index.d.ts +40 -0
- package/dist/text/serial/index.js +7 -0
- package/dist/text/serial/index.js.map +1 -0
- package/dist/text/serial/options.d.ts +77 -0
- package/dist/text/serial/options.js +17 -0
- package/dist/text/serial/options.js.map +1 -0
- package/dist/text/serial/read.d.ts +28 -0
- package/dist/text/serial/read.js +19 -0
- package/dist/text/serial/read.js.map +1 -0
- package/dist/text/serial/reader-graph.d.ts +39 -0
- package/dist/text/serial/reader-graph.js +27 -0
- package/dist/text/serial/reader-graph.js.map +1 -0
- package/dist/text/serial/record.d.ts +40 -0
- package/dist/text/serial/record.js +21 -0
- package/dist/text/serial/record.js.map +1 -0
- package/dist/text/serial/source.d.ts +39 -0
- package/dist/text/serial/source.js +12 -0
- package/dist/text/serial/source.js.map +1 -0
- package/dist/text/serial/topology.d.ts +43 -0
- package/dist/text/serial/topology.js +64 -0
- package/dist/text/serial/topology.js.map +1 -0
- package/dist/text/source/adapter.js.map +1 -0
- package/dist/text/source/epub/archive.js.map +1 -0
- package/dist/text/source/epub/content.js.map +1 -0
- package/dist/text/source/epub/document.js.map +1 -0
- package/dist/text/source/epub/index.js.map +1 -0
- package/dist/text/source/epub/navigation.js.map +1 -0
- package/dist/text/source/epub/package.js.map +1 -0
- package/dist/text/source/epub/xml.js.map +1 -0
- package/dist/text/source/index.js.map +1 -0
- package/dist/text/source/meta.js.map +1 -0
- package/dist/text/source/plain-text.js.map +1 -0
- package/dist/text/source/toc.d.ts +17 -0
- package/dist/text/source/toc.js +19 -0
- package/dist/text/source/toc.js.map +1 -0
- package/dist/text/source/types.js +1 -0
- package/dist/text/source/types.js.map +1 -0
- package/dist/text/summary-build/artifact.d.ts +44 -0
- package/dist/text/summary-build/artifact.js +157 -0
- package/dist/text/summary-build/artifact.js.map +1 -0
- package/dist/text/summary-build/build.d.ts +37 -0
- package/dist/text/summary-build/build.js +60 -0
- package/dist/text/summary-build/build.js.map +1 -0
- package/dist/text/summary-build/index.d.ts +38 -0
- package/dist/text/summary-build/index.js +4 -0
- package/dist/text/summary-build/index.js.map +1 -0
- package/dist/text/summary-build/schema.d.ts +106 -0
- package/dist/text/summary-build/schema.js +118 -0
- package/dist/text/summary-build/schema.js.map +1 -0
- package/dist/text/summary-build/snapshot/chunk-store.d.ts +17 -0
- package/dist/text/summary-build/snapshot/chunk-store.js +68 -0
- package/dist/text/summary-build/snapshot/chunk-store.js.map +1 -0
- package/dist/text/summary-build/snapshot/empty-stores.d.ts +50 -0
- package/dist/text/summary-build/snapshot/empty-stores.js +60 -0
- package/dist/text/summary-build/snapshot/empty-stores.js.map +1 -0
- package/dist/text/summary-build/snapshot/graph-stores.d.ts +42 -0
- package/dist/text/summary-build/snapshot/graph-stores.js +148 -0
- package/dist/text/summary-build/snapshot/graph-stores.js.map +1 -0
- package/dist/text/summary-build/snapshot/helpers.d.ts +17 -0
- package/dist/text/summary-build/snapshot/helpers.js +65 -0
- package/dist/text/summary-build/snapshot/helpers.js.map +1 -0
- package/dist/text/summary-build/snapshot/index.d.ts +63 -0
- package/dist/text/summary-build/snapshot/index.js +106 -0
- package/dist/text/summary-build/snapshot/index.js.map +1 -0
- package/dist/text/summary-build/snapshot/serial-store.d.ts +29 -0
- package/dist/text/summary-build/snapshot/serial-store.js +92 -0
- package/dist/text/summary-build/snapshot/serial-store.js.map +1 -0
- package/dist/text/summary-build/snapshot-io.d.ts +14 -0
- package/dist/text/summary-build/snapshot-io.js +25 -0
- package/dist/text/summary-build/snapshot-io.js.map +1 -0
- package/dist/text/summary-build/source.d.ts +39 -0
- package/dist/text/summary-build/source.js +30 -0
- package/dist/text/summary-build/source.js.map +1 -0
- package/dist/text/summary-build/types.d.ts +34 -0
- package/dist/text/summary-build/types.js +1 -0
- package/dist/text/summary-build/types.js.map +1 -0
- package/dist/worker-DWasYKWW.d.cts +143 -0
- package/dist/worker.cjs +5560 -2312
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.cts +1 -2
- package/dist/worker.d.ts +2 -2
- package/dist/worker.js +1 -1
- package/dist/worker.js.map +1 -1
- package/package.json +3 -2
- package/dist/archive/query/archive-view.d.ts +0 -26
- package/dist/archive/query/archive-view.js +0 -4540
- package/dist/archive/query/archive-view.js.map +0 -1
- package/dist/archive/query/continuation-cursor.d.ts +0 -61
- package/dist/archive/query/continuation-cursor.js +0 -363
- package/dist/archive/query/continuation-cursor.js.map +0 -1
- package/dist/archive/query/index.d.ts +0 -29
- package/dist/archive/query/index.js +0 -63
- package/dist/archive/query/index.js.map +0 -1
- package/dist/archive/query/lexical-search.js.map +0 -1
- package/dist/archive/query/search-cache.d.ts +0 -192
- package/dist/archive/query/search-cache.js +0 -1248
- package/dist/archive/query/search-cache.js.map +0 -1
- package/dist/archive/search-index/index.d.ts +0 -26
- package/dist/archive/search-index/index.js +0 -29
- package/dist/archive/search-index/index.js.map +0 -1
- package/dist/archive/search-index/search-index.d.ts +0 -26
- package/dist/archive/search-index/search-index.js +0 -555
- package/dist/archive/search-index/search-index.js.map +0 -1
- package/dist/archive/search-index/search-tokenizer.js +0 -225
- package/dist/archive/search-index/search-tokenizer.js.map +0 -1
- package/dist/common/cli-command.js.map +0 -1
- package/dist/common/data-dir.js +0 -48
- package/dist/common/data-dir.js.map +0 -1
- package/dist/common/language.js.map +0 -1
- package/dist/common/llm-scope.js.map +0 -1
- package/dist/common/logging.js.map +0 -1
- package/dist/common/template.js.map +0 -1
- package/dist/common/tinyld-language.js.map +0 -1
- package/dist/common/wiki-graph-dir.d.ts +0 -10
- package/dist/common/wiki-graph-dir.js +0 -41
- package/dist/common/wiki-graph-dir.js.map +0 -1
- package/dist/common/wiki-graph-temp.js +0 -21
- package/dist/common/wiki-graph-temp.js.map +0 -1
- package/dist/common/wiki-graph-uri.d.ts +0 -28
- package/dist/common/wiki-graph-uri.js +0 -171
- package/dist/common/wiki-graph-uri.js.map +0 -1
- package/dist/context/index.d.ts +0 -1
- package/dist/context/index.js +0 -13
- package/dist/context/index.js.map +0 -1
- package/dist/context/task-context.js +0 -111
- package/dist/context/task-context.js.map +0 -1
- package/dist/document/document.d.ts +0 -153
- package/dist/document/document.js +0 -615
- package/dist/document/document.js.map +0 -1
- package/dist/document/fragments.d.ts +0 -63
- package/dist/document/fragments.js +0 -371
- package/dist/document/fragments.js.map +0 -1
- package/dist/document/stores.d.ts +0 -203
- package/dist/document/stores.js +0 -1678
- package/dist/document/stores.js.map +0 -1
- package/dist/document/text-streams.d.ts +0 -86
- package/dist/document/text-streams.js +0 -515
- package/dist/document/text-streams.js.map +0 -1
- package/dist/editor/clue.d.ts +0 -27
- package/dist/editor/clue.js.map +0 -1
- package/dist/editor/compressor.d.ts +0 -18
- package/dist/editor/compressor.js +0 -68
- package/dist/editor/compressor.js.map +0 -1
- package/dist/editor/editor.d.ts +0 -39
- package/dist/editor/editor.js +0 -253
- package/dist/editor/editor.js.map +0 -1
- package/dist/editor/feedback.d.ts +0 -16
- package/dist/editor/feedback.js.map +0 -1
- package/dist/editor/index.d.ts +0 -17
- package/dist/editor/index.js +0 -5
- package/dist/editor/index.js.map +0 -1
- package/dist/editor/language-review.d.ts +0 -14
- package/dist/editor/language-review.js +0 -35
- package/dist/editor/language-review.js.map +0 -1
- package/dist/editor/log.d.ts +0 -37
- package/dist/editor/log.js +0 -202
- package/dist/editor/log.js.map +0 -1
- package/dist/editor/markup.d.ts +0 -20
- package/dist/editor/markup.js +0 -294
- package/dist/editor/markup.js.map +0 -1
- package/dist/editor/prompt-templates.js.map +0 -1
- package/dist/editor/response.js.map +0 -1
- package/dist/editor/review.d.ts +0 -34
- package/dist/editor/review.js +0 -189
- package/dist/editor/review.js.map +0 -1
- package/dist/editor/types.js +0 -21
- package/dist/editor/types.js.map +0 -1
- package/dist/evidence-selection/anchor-resolver.d.ts +0 -43
- package/dist/evidence-selection/anchor-resolver.js +0 -783
- package/dist/evidence-selection/anchor-resolver.js.map +0 -1
- package/dist/evidence-selection/anchor-types.d.ts +0 -27
- package/dist/evidence-selection/anchor-types.js +0 -1
- package/dist/evidence-selection/index.d.ts +0 -8
- package/dist/evidence-selection/index.js +0 -32
- package/dist/evidence-selection/index.js.map +0 -1
- package/dist/evidence-selection/prompt.js.map +0 -1
- package/dist/evidence-selection/quote-score.js.map +0 -1
- package/dist/evidence-selection/selection-resolver.js +0 -303
- package/dist/evidence-selection/selection-resolver.js.map +0 -1
- package/dist/evidence-selection/text.js.map +0 -1
- package/dist/facade/app.d.ts +0 -75
- package/dist/facade/app.js +0 -141
- package/dist/facade/app.js.map +0 -1
- package/dist/facade/build-queue.d.ts +0 -181
- package/dist/facade/build-queue.js +0 -1442
- package/dist/facade/build-queue.js.map +0 -1
- package/dist/facade/chapter-build.d.ts +0 -60
- package/dist/facade/chapter-build.js +0 -1020
- package/dist/facade/chapter-build.js.map +0 -1
- package/dist/facade/chapter.d.ts +0 -168
- package/dist/facade/chapter.js +0 -944
- package/dist/facade/chapter.js.map +0 -1
- package/dist/facade/digest.d.ts +0 -55
- package/dist/facade/digest.js +0 -168
- package/dist/facade/digest.js.map +0 -1
- package/dist/facade/graph.d.ts +0 -60
- package/dist/facade/graph.js +0 -203
- package/dist/facade/graph.js.map +0 -1
- package/dist/facade/import.d.ts +0 -49
- package/dist/facade/import.js +0 -262
- package/dist/facade/import.js.map +0 -1
- package/dist/facade/index.d.ts +0 -39
- package/dist/facade/index.js +0 -171
- package/dist/facade/index.js.map +0 -1
- package/dist/facade/knowledge-graph-build.d.ts +0 -75
- package/dist/facade/knowledge-graph-build.js +0 -897
- package/dist/facade/knowledge-graph-build.js.map +0 -1
- package/dist/facade/llm-sampling.d.ts +0 -11
- package/dist/facade/llm-sampling.js +0 -58
- package/dist/facade/llm-sampling.js.map +0 -1
- package/dist/facade/wiki-graph-archive.d.ts +0 -41
- package/dist/facade/wiki-graph-archive.js +0 -130
- package/dist/facade/wiki-graph-archive.js.map +0 -1
- package/dist/gc/files.js +0 -141
- package/dist/gc/files.js.map +0 -1
- package/dist/gc/index.js.map +0 -1
- package/dist/gc/lock.js +0 -137
- package/dist/gc/lock.js.map +0 -1
- package/dist/gc/runner.js +0 -129
- package/dist/gc/runner.js.map +0 -1
- package/dist/gc/tmp-gc.js +0 -57
- package/dist/gc/tmp-gc.js.map +0 -1
- package/dist/guaranteed/classifier.js.map +0 -1
- package/dist/guaranteed/errors.js.map +0 -1
- package/dist/guaranteed/index.js.map +0 -1
- package/dist/guaranteed/request.js.map +0 -1
- package/dist/guaranteed/response.js.map +0 -1
- package/dist/index-B8NNnQ8P.d.ts +0 -424
- package/dist/legacy-sdpub/upgrade.js +0 -795
- package/dist/legacy-sdpub/upgrade.js.map +0 -1
- package/dist/llm/cache.js +0 -35
- package/dist/llm/cache.js.map +0 -1
- package/dist/llm/client.d.ts +0 -26
- package/dist/llm/client.js +0 -572
- package/dist/llm/client.js.map +0 -1
- package/dist/llm/context.js +0 -78
- package/dist/llm/context.js.map +0 -1
- package/dist/llm/errors.js.map +0 -1
- package/dist/llm/index.d.ts +0 -7
- package/dist/llm/index.js +0 -17
- package/dist/llm/index.js.map +0 -1
- package/dist/llm/request-log.js +0 -35
- package/dist/llm/request-log.js.map +0 -1
- package/dist/llm/sampling.js.map +0 -1
- package/dist/output/epub/archive.js.map +0 -1
- package/dist/output/epub/book.d.ts +0 -15
- package/dist/output/epub/book.js.map +0 -1
- package/dist/output/epub/content.js.map +0 -1
- package/dist/output/epub/index.d.ts +0 -20
- package/dist/output/epub/index.js.map +0 -1
- package/dist/output/epub/navigation.js.map +0 -1
- package/dist/output/epub/package.js.map +0 -1
- package/dist/output/epub/shared.js.map +0 -1
- package/dist/output/epub/templates.js +0 -26
- package/dist/output/epub/templates.js.map +0 -1
- package/dist/output/index.d.ts +0 -14
- package/dist/output/index.js.map +0 -1
- package/dist/output/plain-text.d.ts +0 -18
- package/dist/output/plain-text.js.map +0 -1
- package/dist/progress/index.js.map +0 -1
- package/dist/progress/reporter.js.map +0 -1
- package/dist/progress/tracker.js.map +0 -1
- package/dist/reader/attention/attention.d.ts +0 -39
- package/dist/reader/attention/attention.js +0 -123
- package/dist/reader/attention/attention.js.map +0 -1
- package/dist/reader/attention/index.d.ts +0 -9
- package/dist/reader/attention/index.js +0 -5
- package/dist/reader/attention/index.js.map +0 -1
- package/dist/reader/attention/wave-reflection.d.ts +0 -21
- package/dist/reader/attention/wave-reflection.js.map +0 -1
- package/dist/reader/attention/working-memory.d.ts +0 -28
- package/dist/reader/attention/working-memory.js.map +0 -1
- package/dist/reader/chunk-batch/extract.d.ts +0 -13
- package/dist/reader/chunk-batch/extract.js.map +0 -1
- package/dist/reader/chunk-batch/extractor.d.ts +0 -17
- package/dist/reader/chunk-batch/extractor.js +0 -337
- package/dist/reader/chunk-batch/extractor.js.map +0 -1
- package/dist/reader/chunk-batch/fragment-projection.d.ts +0 -34
- package/dist/reader/chunk-batch/fragment-projection.js.map +0 -1
- package/dist/reader/chunk-batch/index.d.ts +0 -12
- package/dist/reader/chunk-batch/index.js +0 -13
- package/dist/reader/chunk-batch/index.js.map +0 -1
- package/dist/reader/chunk-batch/language.d.ts +0 -9
- package/dist/reader/chunk-batch/language.js +0 -23
- package/dist/reader/chunk-batch/language.js.map +0 -1
- package/dist/reader/chunk-batch/parser.d.ts +0 -94
- package/dist/reader/chunk-batch/parser.js +0 -640
- package/dist/reader/chunk-batch/parser.js.map +0 -1
- package/dist/reader/chunk-batch/prompt-templates.js.map +0 -1
- package/dist/reader/chunk-batch/types.d.ts +0 -85
- package/dist/reader/index.d.ts +0 -13
- package/dist/reader/index.js +0 -7
- package/dist/reader/index.js.map +0 -1
- package/dist/reader/reader.d.ts +0 -37
- package/dist/reader/reader.js +0 -82
- package/dist/reader/reader.js.map +0 -1
- package/dist/reader/segment/index.d.ts +0 -2
- package/dist/reader/segment/index.js +0 -5
- package/dist/reader/segment/index.js.map +0 -1
- package/dist/reader/segment/intl-segmenter.js.map +0 -1
- package/dist/reader/segment/segment.js +0 -9
- package/dist/reader/segment/segment.js.map +0 -1
- package/dist/reader/types.d.ts +0 -29
- package/dist/source/epub/archive.js.map +0 -1
- package/dist/source/epub/content.js.map +0 -1
- package/dist/source/epub/document.js.map +0 -1
- package/dist/source/epub/index.js.map +0 -1
- package/dist/source/epub/navigation.js.map +0 -1
- package/dist/source/epub/package.js.map +0 -1
- package/dist/source/epub/xml.js.map +0 -1
- package/dist/source/index.js.map +0 -1
- package/dist/source/meta.js.map +0 -1
- package/dist/source/plain-text.js.map +0 -1
- package/dist/source/toc.d.ts +0 -16
- package/dist/source/toc.js +0 -17
- package/dist/source/toc.js.map +0 -1
- package/dist/topology/grouping.d.ts +0 -15
- package/dist/topology/grouping.js.map +0 -1
- package/dist/topology/index.d.ts +0 -21
- package/dist/topology/index.js +0 -5
- package/dist/topology/index.js.map +0 -1
- package/dist/topology/resource-segmentation.d.ts +0 -13
- package/dist/topology/resource-segmentation.js.map +0 -1
- package/dist/topology/segment-incision.d.ts +0 -18
- package/dist/topology/segment-incision.js.map +0 -1
- package/dist/topology/snake-detector.d.ts +0 -13
- package/dist/topology/snake-detector.js +0 -520
- package/dist/topology/snake-detector.js.map +0 -1
- package/dist/topology/snake-graph-builder.d.ts +0 -14
- package/dist/topology/snake-graph-builder.js +0 -76
- package/dist/topology/snake-graph-builder.js.map +0 -1
- package/dist/topology/topology.d.ts +0 -29
- package/dist/topology/topology.js +0 -348
- package/dist/topology/topology.js.map +0 -1
- package/dist/topology/weights.d.ts +0 -10
- package/dist/topology/weights.js +0 -84
- package/dist/topology/weights.js.map +0 -1
- package/dist/types-FVIqiLC9.d.cts +0 -24
- package/dist/wikg/archive-uri.d.ts +0 -1
- package/dist/wikg/archive-uri.js +0 -37
- package/dist/wikg/archive-uri.js.map +0 -1
- package/dist/wikg/archive.d.ts +0 -28
- package/dist/wikg/archive.js +0 -496
- package/dist/wikg/archive.js.map +0 -1
- package/dist/wikg/index.d.ts +0 -31
- package/dist/wikg/index.js +0 -60
- package/dist/wikg/index.js.map +0 -1
- package/dist/wikg/wikg-coordinator.d.ts +0 -45
- package/dist/wikg/wikg-coordinator.js +0 -1687
- package/dist/wikg/wikg-coordinator.js.map +0 -1
- package/dist/wikg/wiki-graph-archive-file.d.ts +0 -42
- package/dist/wikg/wiki-graph-archive-file.js +0 -78
- package/dist/wikg/wiki-graph-archive-file.js.map +0 -1
- package/dist/wikilink/index.d.ts +0 -10
- package/dist/wikilink/index.js.map +0 -1
- package/dist/wikilink/relation-discovery.d.ts +0 -31
- package/dist/wikilink/relation-discovery.js +0 -477
- package/dist/wikilink/relation-discovery.js.map +0 -1
- package/dist/wikilink/types.d.ts +0 -23
- package/dist/wikilink/window.d.ts +0 -7
- package/dist/wikilink/window.js.map +0 -1
- package/dist/wikimatch/enrichment.d.ts +0 -10
- package/dist/wikimatch/enrichment.js +0 -55
- package/dist/wikimatch/enrichment.js.map +0 -1
- package/dist/wikimatch/index.d.ts +0 -16
- package/dist/wikimatch/index.js +0 -66
- package/dist/wikimatch/index.js.map +0 -1
- package/dist/wikimatch/option-narrowing.d.ts +0 -17
- package/dist/wikimatch/option-narrowing.js.map +0 -1
- package/dist/wikimatch/options.d.ts +0 -14
- package/dist/wikimatch/options.js +0 -155
- package/dist/wikimatch/options.js.map +0 -1
- package/dist/wikimatch/policy-judge.d.ts +0 -17
- package/dist/wikimatch/policy-judge.js +0 -430
- package/dist/wikimatch/policy-judge.js.map +0 -1
- package/dist/wikimatch/range-suppression.js.map +0 -1
- package/dist/wikimatch/surface-screening.d.ts +0 -16
- package/dist/wikimatch/surface-screening.js +0 -168
- package/dist/wikimatch/surface-screening.js.map +0 -1
- package/dist/wikimatch/surface-window.d.ts +0 -6
- package/dist/wikimatch/surface-window.js +0 -44
- package/dist/wikimatch/surface-window.js.map +0 -1
- package/dist/wikimatch/types.d.ts +0 -151
- package/dist/wikimatch/wikispine.d.ts +0 -43
- package/dist/wikimatch/wikispine.js.map +0 -1
- package/dist/wikimatch/window.d.ts +0 -6
- package/dist/wikimatch/window.js.map +0 -1
- package/dist/wikimatch/words.js.map +0 -1
- package/dist/wikipage/cache.d.ts +0 -18
- package/dist/wikipage/cache.js +0 -404
- package/dist/wikipage/cache.js.map +0 -1
- package/dist/wikipage/fetch-log.js +0 -143
- package/dist/wikipage/fetch-log.js.map +0 -1
- package/dist/wikipage/index.d.ts +0 -14
- package/dist/wikipage/index.js +0 -17
- package/dist/wikipage/index.js.map +0 -1
- package/dist/wikipage/normalizer.d.ts +0 -14
- package/dist/wikipage/normalizer.js +0 -147
- package/dist/wikipage/normalizer.js.map +0 -1
- package/dist/wikipage/rate-limiter.js.map +0 -1
- package/dist/wikipage/resolver.d.ts +0 -26
- package/dist/wikipage/resolver.js +0 -325
- package/dist/wikipage/resolver.js.map +0 -1
- package/dist/wikipage/types.d.ts +0 -96
- package/dist/wikipage/wikimedia-client.d.ts +0 -48
- package/dist/wikipage/wikimedia-client.js +0 -397
- package/dist/wikipage/wikimedia-client.js.map +0 -1
- package/dist/worker-BgQ0Xl8T.d.cts +0 -181
- /package/dist/{evidence-selection → api/chapter-build}/types.js +0 -0
- /package/dist/{evidence-selection → api/chapter-build}/types.js.map +0 -0
- /package/dist/{facade → api/knowledge-graph-build}/types.js +0 -0
- /package/dist/{facade → api/knowledge-graph-build}/types.js.map +0 -0
- /package/dist/{facade → api}/types.d.ts +0 -0
- /package/dist/{gc → api}/types.js +0 -0
- /package/dist/{gc → api}/types.js.map +0 -0
- /package/dist/{guaranteed → document/directory}/types.js +0 -0
- /package/dist/{guaranteed → document/directory}/types.js.map +0 -0
- /package/dist/{llm → document/stores}/types.js +0 -0
- /package/dist/{llm → document/stores}/types.js.map +0 -0
- /package/dist/{guaranteed → external/guaranteed}/classifier.d.ts +0 -0
- /package/dist/{guaranteed → external/guaranteed}/classifier.js +0 -0
- /package/dist/{guaranteed → external/guaranteed}/errors.d.ts +0 -0
- /package/dist/{guaranteed → external/guaranteed}/errors.js +0 -0
- /package/dist/{guaranteed → external/guaranteed}/index.d.ts +0 -0
- /package/dist/{guaranteed → external/guaranteed}/index.js +0 -0
- /package/dist/{guaranteed → external/guaranteed}/request.d.ts +0 -0
- /package/dist/{guaranteed → external/guaranteed}/request.js +0 -0
- /package/dist/{guaranteed → external/guaranteed}/response.d.ts +0 -0
- /package/dist/{guaranteed → external/guaranteed}/response.js +0 -0
- /package/dist/{guaranteed → external/guaranteed}/types.d.ts +0 -0
- /package/dist/{progress → external/guaranteed}/types.js +0 -0
- /package/dist/{progress → external/guaranteed}/types.js.map +0 -0
- /package/dist/{llm → external/llm}/cache.d.ts +0 -0
- /package/dist/{llm → external/llm}/context.d.ts +0 -0
- /package/dist/{llm → external/llm}/errors.d.ts +0 -0
- /package/dist/{llm → external/llm}/errors.js +0 -0
- /package/dist/{llm → external/llm}/request-log.d.ts +0 -0
- /package/dist/{llm → external/llm}/sampling.d.ts +0 -0
- /package/dist/{llm → external/llm}/sampling.js +0 -0
- /package/dist/{llm → external/llm}/types.d.ts +0 -0
- /package/dist/{reader/chunk-batch → external/llm}/types.js +0 -0
- /package/dist/{reader/chunk-batch → external/llm}/types.js.map +0 -0
- /package/dist/{wikimatch → external/wikimatch}/option-narrowing.js +0 -0
- /package/dist/{wikimatch → external/wikimatch}/range-suppression.d.ts +0 -0
- /package/dist/{wikimatch → external/wikimatch}/range-suppression.js +0 -0
- /package/dist/{reader/segment → external/wikimatch}/types.js +0 -0
- /package/dist/{reader/segment → external/wikimatch}/types.js.map +0 -0
- /package/dist/{wikimatch → external/wikimatch}/wikispine.js +0 -0
- /package/dist/{wikimatch → external/wikimatch}/window.js +0 -0
- /package/dist/{wikimatch → external/wikimatch}/words.d.ts +0 -0
- /package/dist/{wikimatch → external/wikimatch}/words.js +0 -0
- /package/dist/{wikipage → external/wikipage}/fetch-log.d.ts +0 -0
- /package/dist/{wikipage → external/wikipage}/rate-limiter.d.ts +0 -0
- /package/dist/{wikipage → external/wikipage}/rate-limiter.js +0 -0
- /package/dist/{reader → external/wikipage}/types.js +0 -0
- /package/dist/{reader → external/wikipage}/types.js.map +0 -0
- /package/dist/{source → graph/evidence-selection/anchor}/types.js +0 -0
- /package/dist/{source → graph/evidence-selection/anchor}/types.js.map +0 -0
- /package/dist/{evidence-selection → graph/evidence-selection}/prompt.d.ts +0 -0
- /package/dist/{evidence-selection → graph/evidence-selection}/prompt.js +0 -0
- /package/dist/{evidence-selection → graph/evidence-selection}/quote-score.d.ts +0 -0
- /package/dist/{evidence-selection → graph/evidence-selection}/quote-score.js +0 -0
- /package/dist/{evidence-selection/selection-resolver.d.ts → graph/evidence-selection/resolver.d.ts} +0 -0
- /package/dist/{evidence-selection → graph/evidence-selection}/text.d.ts +0 -0
- /package/dist/{evidence-selection → graph/evidence-selection}/text.js +0 -0
- /package/dist/{evidence-selection → graph/evidence-selection}/types.d.ts +0 -0
- /package/dist/{wikilink → graph/evidence-selection}/types.js +0 -0
- /package/dist/{wikilink → graph/evidence-selection}/types.js.map +0 -0
- /package/dist/{wikimatch → graph/knowledge-build}/types.js +0 -0
- /package/dist/{wikimatch → graph/knowledge-build}/types.js.map +0 -0
- /package/dist/{wikipage → graph/reading-build}/types.js +0 -0
- /package/dist/{wikipage → graph/reading-build}/types.js.map +0 -0
- /package/dist/{topology → graph/topology}/grouping.js +0 -0
- /package/dist/{topology → graph/topology}/resource-segmentation.js +0 -0
- /package/dist/{topology → graph/topology}/segment-incision.js +0 -0
- /package/dist/{evidence-selection/anchor-types.js.map → graph/topology/snake/types.js.map} +0 -0
- /package/dist/{wikilink → graph/wikilink}/index.js +0 -0
- /package/dist/{output/epub/model.js.map → graph/wikilink/types.js.map} +0 -0
- /package/dist/{wikilink → graph/wikilink}/window.js +0 -0
- /package/dist/{source/adapter.js.map → retrieval/query/archive-view/types.js.map} +0 -0
- /package/dist/{archive → retrieval}/query/lexical-search.d.ts +0 -0
- /package/dist/{archive → retrieval}/query/lexical-search.js +0 -0
- /package/dist/{archive/search-index/search-tokenizer.d.ts → retrieval/search-index/search/tokenizer.d.ts} +0 -0
- /package/dist/{common → runtime/common}/cli-command.d.ts +0 -0
- /package/dist/{common → runtime/common}/cli-command.js +0 -0
- /package/dist/{common → runtime/common}/data-dir.d.ts +0 -0
- /package/dist/{common → runtime/common}/language.d.ts +0 -0
- /package/dist/{common → runtime/common}/language.js +0 -0
- /package/dist/{common → runtime/common}/llm-scope.d.ts +0 -0
- /package/dist/{common → runtime/common}/llm-scope.js +0 -0
- /package/dist/{common → runtime/common}/logging.d.ts +0 -0
- /package/dist/{common → runtime/common}/logging.js +0 -0
- /package/dist/{common → runtime/common}/template.d.ts +0 -0
- /package/dist/{common → runtime/common}/template.js +0 -0
- /package/dist/{common → runtime/common}/tinyld-language.d.ts +0 -0
- /package/dist/{common → runtime/common}/tinyld-language.js +0 -0
- /package/dist/{common/wiki-graph-temp.d.ts → runtime/common/wiki-graph/temp.d.ts} +0 -0
- /package/dist/{context/task-context.d.ts → runtime/context/task.d.ts} +0 -0
- /package/dist/{gc → runtime/gc}/files.d.ts +0 -0
- /package/dist/{gc → runtime/gc}/index.d.ts +0 -0
- /package/dist/{gc → runtime/gc}/index.js +0 -0
- /package/dist/{gc → runtime/gc}/lock.d.ts +0 -0
- /package/dist/{gc → runtime/gc}/runner.d.ts +0 -0
- /package/dist/{gc/tmp-gc.d.ts → runtime/gc/temp.d.ts} +0 -0
- /package/dist/{gc → runtime/gc}/types.d.ts +0 -0
- /package/dist/{progress → runtime/progress}/index.d.ts +0 -0
- /package/dist/{progress → runtime/progress}/index.js +0 -0
- /package/dist/{progress → runtime/progress}/reporter.d.ts +0 -0
- /package/dist/{progress → runtime/progress}/reporter.js +0 -0
- /package/dist/{progress → runtime/progress}/tracker.d.ts +0 -0
- /package/dist/{progress → runtime/progress}/tracker.js +0 -0
- /package/dist/{progress → runtime/progress}/types.d.ts +0 -0
- /package/dist/{legacy-sdpub/upgrade.d.ts → storage/migration/legacy-sdpub/upgrade/index.d.ts} +0 -0
- /package/dist/{editor → text/editor}/clue.js +0 -0
- /package/dist/{editor → text/editor}/feedback.js +0 -0
- /package/dist/{editor → text/editor}/prompt-templates.d.ts +0 -0
- /package/dist/{editor → text/editor}/prompt-templates.js +0 -0
- /package/dist/{editor → text/editor}/response.d.ts +0 -0
- /package/dist/{editor → text/editor}/response.js +0 -0
- /package/dist/{editor → text/editor}/types.d.ts +0 -0
- /package/dist/{output → text/output}/epub/archive.d.ts +0 -0
- /package/dist/{output → text/output}/epub/archive.js +0 -0
- /package/dist/{output → text/output}/epub/book.js +0 -0
- /package/dist/{output → text/output}/epub/content.d.ts +0 -0
- /package/dist/{output → text/output}/epub/content.js +0 -0
- /package/dist/{output → text/output}/epub/index.js +0 -0
- /package/dist/{output → text/output}/epub/model.d.ts +0 -0
- /package/dist/{output → text/output}/epub/model.js +0 -0
- /package/dist/{output → text/output}/epub/navigation.d.ts +0 -0
- /package/dist/{output → text/output}/epub/navigation.js +0 -0
- /package/dist/{output → text/output}/epub/package.d.ts +0 -0
- /package/dist/{output → text/output}/epub/package.js +0 -0
- /package/dist/{output → text/output}/epub/shared.d.ts +0 -0
- /package/dist/{output → text/output}/epub/shared.js +0 -0
- /package/dist/{output → text/output}/epub/templates.d.ts +0 -0
- /package/dist/{output → text/output}/index.js +0 -0
- /package/dist/{output → text/output}/plain-text.js +0 -0
- /package/dist/{reader → text/reader}/attention/wave-reflection.js +0 -0
- /package/dist/{reader → text/reader}/attention/working-memory.js +0 -0
- /package/dist/{reader → text/reader}/chunk-batch/extract.js +0 -0
- /package/dist/{reader → text/reader}/chunk-batch/fragment-projection.js +0 -0
- /package/dist/{reader → text/reader}/chunk-batch/prompt-templates.d.ts +0 -0
- /package/dist/{reader → text/reader}/chunk-batch/prompt-templates.js +0 -0
- /package/dist/{reader/segment/segment.d.ts → text/reader/segment/core.d.ts} +0 -0
- /package/dist/{reader → text/reader}/segment/intl-segmenter.d.ts +0 -0
- /package/dist/{reader → text/reader}/segment/intl-segmenter.js +0 -0
- /package/dist/{reader → text/reader}/segment/types.d.ts +0 -0
- /package/dist/{source → text/source}/adapter.d.ts +0 -0
- /package/dist/{source → text/source}/adapter.js +0 -0
- /package/dist/{source → text/source}/epub/archive.d.ts +0 -0
- /package/dist/{source → text/source}/epub/archive.js +0 -0
- /package/dist/{source → text/source}/epub/content.d.ts +0 -0
- /package/dist/{source → text/source}/epub/content.js +0 -0
- /package/dist/{source → text/source}/epub/document.d.ts +0 -0
- /package/dist/{source → text/source}/epub/document.js +0 -0
- /package/dist/{source → text/source}/epub/index.d.ts +0 -0
- /package/dist/{source → text/source}/epub/index.js +0 -0
- /package/dist/{source → text/source}/epub/navigation.d.ts +0 -0
- /package/dist/{source → text/source}/epub/navigation.js +0 -0
- /package/dist/{source → text/source}/epub/package.d.ts +0 -0
- /package/dist/{source → text/source}/epub/package.js +0 -0
- /package/dist/{source → text/source}/epub/xml.d.ts +0 -0
- /package/dist/{source → text/source}/epub/xml.js +0 -0
- /package/dist/{source → text/source}/index.d.ts +0 -0
- /package/dist/{source → text/source}/index.js +0 -0
- /package/dist/{source → text/source}/meta.d.ts +0 -0
- /package/dist/{source → text/source}/meta.js +0 -0
- /package/dist/{source → text/source}/plain-text.d.ts +0 -0
- /package/dist/{source → text/source}/plain-text.js +0 -0
- /package/dist/{source → text/source}/types.d.ts +0 -0
package/dist/document/stores.js
DELETED
|
@@ -1,1678 +0,0 @@
|
|
|
1
|
-
import { getNumber, getOptionalString, getString } from "./database.js";
|
|
2
|
-
import {
|
|
3
|
-
isChunkImportance,
|
|
4
|
-
isChunkRetention
|
|
5
|
-
} from "./types.js";
|
|
6
|
-
import { createHash } from "../utils/hash.js";
|
|
7
|
-
const MAX_SQL_BIND_PARAMS = 900;
|
|
8
|
-
class ObjectMetadataStore {
|
|
9
|
-
#database;
|
|
10
|
-
constructor(database) {
|
|
11
|
-
this.#database = database;
|
|
12
|
-
}
|
|
13
|
-
async getMap(objectPath) {
|
|
14
|
-
const rows = await this.#database.queryAll(
|
|
15
|
-
`
|
|
16
|
-
SELECT key, value_json
|
|
17
|
-
FROM object_metadata
|
|
18
|
-
WHERE object_path = ?
|
|
19
|
-
ORDER BY key
|
|
20
|
-
`,
|
|
21
|
-
[objectPath],
|
|
22
|
-
(row) => ({
|
|
23
|
-
key: getString(row, "key"),
|
|
24
|
-
value: parseMetadataValue(getString(row, "value_json"))
|
|
25
|
-
})
|
|
26
|
-
);
|
|
27
|
-
const result = {};
|
|
28
|
-
for (const row of rows) {
|
|
29
|
-
result[row.key] = row.value;
|
|
30
|
-
}
|
|
31
|
-
return result;
|
|
32
|
-
}
|
|
33
|
-
async replaceMap(target, map) {
|
|
34
|
-
await this.#database.transaction(async () => {
|
|
35
|
-
await this.clear(target.objectPath);
|
|
36
|
-
for (const [key, value] of Object.entries(map)) {
|
|
37
|
-
await this.put(target, key, value);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
async put(target, key, value) {
|
|
42
|
-
await this.#database.run(
|
|
43
|
-
`
|
|
44
|
-
INSERT INTO object_metadata (
|
|
45
|
-
object_kind,
|
|
46
|
-
object_path,
|
|
47
|
-
key,
|
|
48
|
-
value_json,
|
|
49
|
-
updated_at,
|
|
50
|
-
chapter_id,
|
|
51
|
-
chunk_id,
|
|
52
|
-
entity_qid,
|
|
53
|
-
triple_subject_qid,
|
|
54
|
-
triple_predicate,
|
|
55
|
-
triple_object_qid
|
|
56
|
-
)
|
|
57
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
58
|
-
ON CONFLICT(object_path, key) DO UPDATE SET
|
|
59
|
-
object_kind = excluded.object_kind,
|
|
60
|
-
value_json = excluded.value_json,
|
|
61
|
-
updated_at = excluded.updated_at,
|
|
62
|
-
chapter_id = excluded.chapter_id,
|
|
63
|
-
chunk_id = excluded.chunk_id,
|
|
64
|
-
entity_qid = excluded.entity_qid,
|
|
65
|
-
triple_subject_qid = excluded.triple_subject_qid,
|
|
66
|
-
triple_predicate = excluded.triple_predicate,
|
|
67
|
-
triple_object_qid = excluded.triple_object_qid
|
|
68
|
-
`,
|
|
69
|
-
[
|
|
70
|
-
target.kind,
|
|
71
|
-
target.objectPath,
|
|
72
|
-
key,
|
|
73
|
-
JSON.stringify(value),
|
|
74
|
-
(/* @__PURE__ */ new Date()).toISOString(),
|
|
75
|
-
target.chapterId ?? null,
|
|
76
|
-
target.chunkId ?? null,
|
|
77
|
-
target.entityQid ?? null,
|
|
78
|
-
target.tripleSubjectQid ?? null,
|
|
79
|
-
target.triplePredicate ?? null,
|
|
80
|
-
target.tripleObjectQid ?? null
|
|
81
|
-
]
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
async deleteKey(objectPath, key) {
|
|
85
|
-
await this.#database.run(
|
|
86
|
-
`
|
|
87
|
-
DELETE FROM object_metadata
|
|
88
|
-
WHERE object_path = ?
|
|
89
|
-
AND key = ?
|
|
90
|
-
`,
|
|
91
|
-
[objectPath, key]
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
async clear(objectPath) {
|
|
95
|
-
await this.#database.run(
|
|
96
|
-
`
|
|
97
|
-
DELETE FROM object_metadata
|
|
98
|
-
WHERE object_path = ?
|
|
99
|
-
`,
|
|
100
|
-
[objectPath]
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
|
-
async deleteChapterSubtree(chapterId) {
|
|
104
|
-
await this.#database.run(
|
|
105
|
-
`
|
|
106
|
-
DELETE FROM object_metadata
|
|
107
|
-
WHERE chapter_id = ?
|
|
108
|
-
`,
|
|
109
|
-
[chapterId]
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
async deleteDeletedChunks() {
|
|
113
|
-
await this.#database.run(`
|
|
114
|
-
DELETE FROM object_metadata
|
|
115
|
-
WHERE chunk_id IS NOT NULL
|
|
116
|
-
AND NOT EXISTS (
|
|
117
|
-
SELECT 1
|
|
118
|
-
FROM chunks
|
|
119
|
-
WHERE chunks.id = object_metadata.chunk_id
|
|
120
|
-
)
|
|
121
|
-
`);
|
|
122
|
-
}
|
|
123
|
-
async deleteDeletedEntitiesAndTriples() {
|
|
124
|
-
await this.#database.run(`
|
|
125
|
-
DELETE FROM object_metadata
|
|
126
|
-
WHERE entity_qid IS NOT NULL
|
|
127
|
-
AND NOT EXISTS (
|
|
128
|
-
SELECT 1
|
|
129
|
-
FROM mentions
|
|
130
|
-
WHERE mentions.qid = object_metadata.entity_qid
|
|
131
|
-
)
|
|
132
|
-
`);
|
|
133
|
-
await this.#database.run(`
|
|
134
|
-
DELETE FROM object_metadata
|
|
135
|
-
WHERE triple_subject_qid IS NOT NULL
|
|
136
|
-
AND NOT EXISTS (
|
|
137
|
-
SELECT 1
|
|
138
|
-
FROM mention_links
|
|
139
|
-
JOIN mentions AS source_mentions
|
|
140
|
-
ON source_mentions.id = mention_links.source_mention_id
|
|
141
|
-
JOIN mentions AS target_mentions
|
|
142
|
-
ON target_mentions.id = mention_links.target_mention_id
|
|
143
|
-
WHERE source_mentions.qid = object_metadata.triple_subject_qid
|
|
144
|
-
AND mention_links.predicate = object_metadata.triple_predicate
|
|
145
|
-
AND target_mentions.qid = object_metadata.triple_object_qid
|
|
146
|
-
)
|
|
147
|
-
`);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
class SerialStore {
|
|
151
|
-
#database;
|
|
152
|
-
constructor(database) {
|
|
153
|
-
this.#database = database;
|
|
154
|
-
}
|
|
155
|
-
async create() {
|
|
156
|
-
return await this.#database.transaction(async () => {
|
|
157
|
-
await this.#database.run(
|
|
158
|
-
`
|
|
159
|
-
INSERT INTO serials DEFAULT VALUES
|
|
160
|
-
`
|
|
161
|
-
);
|
|
162
|
-
const serialId = await this.#database.getLastInsertRowId();
|
|
163
|
-
await this.#database.run(
|
|
164
|
-
`
|
|
165
|
-
INSERT INTO serial_states (
|
|
166
|
-
serial_id, revision, topology_ready, knowledge_graph_ready
|
|
167
|
-
)
|
|
168
|
-
VALUES (?, ?, ?, ?)
|
|
169
|
-
`,
|
|
170
|
-
[serialId, 0, 0, 0]
|
|
171
|
-
);
|
|
172
|
-
return serialId;
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
async createWithId(serialId) {
|
|
176
|
-
try {
|
|
177
|
-
await this.#database.transaction(async () => {
|
|
178
|
-
await this.#database.run(
|
|
179
|
-
`
|
|
180
|
-
INSERT INTO serials (id)
|
|
181
|
-
VALUES (?)
|
|
182
|
-
`,
|
|
183
|
-
[serialId]
|
|
184
|
-
);
|
|
185
|
-
await this.#database.run(
|
|
186
|
-
`
|
|
187
|
-
INSERT INTO serial_states (
|
|
188
|
-
serial_id, revision, topology_ready, knowledge_graph_ready
|
|
189
|
-
)
|
|
190
|
-
VALUES (?, ?, ?, ?)
|
|
191
|
-
`,
|
|
192
|
-
[serialId, 0, 0, 0]
|
|
193
|
-
);
|
|
194
|
-
});
|
|
195
|
-
} catch (error) {
|
|
196
|
-
if (isSqliteConstraintError(error)) {
|
|
197
|
-
throw new Error(`Serial ${serialId} already exists`);
|
|
198
|
-
}
|
|
199
|
-
throw error;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
async ensure(serialId) {
|
|
203
|
-
await this.#database.transaction(async () => {
|
|
204
|
-
await this.#database.run(
|
|
205
|
-
`
|
|
206
|
-
INSERT OR IGNORE INTO serials (id)
|
|
207
|
-
VALUES (?)
|
|
208
|
-
`,
|
|
209
|
-
[serialId]
|
|
210
|
-
);
|
|
211
|
-
await this.#database.run(
|
|
212
|
-
`
|
|
213
|
-
INSERT OR IGNORE INTO serial_states (
|
|
214
|
-
serial_id, revision, topology_ready, knowledge_graph_ready
|
|
215
|
-
)
|
|
216
|
-
VALUES (?, ?, ?, ?)
|
|
217
|
-
`,
|
|
218
|
-
[serialId, 0, 0, 0]
|
|
219
|
-
);
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
async getById(serialId) {
|
|
223
|
-
return await this.#database.queryOne(
|
|
224
|
-
`
|
|
225
|
-
SELECT
|
|
226
|
-
serials.id AS id,
|
|
227
|
-
serials.document_order AS document_order,
|
|
228
|
-
COALESCE(serial_states.revision, 0) AS revision,
|
|
229
|
-
COALESCE(serial_states.topology_ready, 0) AS topology_ready,
|
|
230
|
-
serial_states.topology_parameter_hash AS topology_parameter_hash,
|
|
231
|
-
COALESCE(serial_states.knowledge_graph_ready, 0) AS knowledge_graph_ready,
|
|
232
|
-
serial_states.knowledge_graph_parameter_hash AS knowledge_graph_parameter_hash
|
|
233
|
-
FROM serials
|
|
234
|
-
LEFT JOIN serial_states
|
|
235
|
-
ON serial_states.serial_id = serials.id
|
|
236
|
-
WHERE serials.id = ?
|
|
237
|
-
`,
|
|
238
|
-
[serialId],
|
|
239
|
-
mapSerialRow
|
|
240
|
-
);
|
|
241
|
-
}
|
|
242
|
-
async getRevision(serialId) {
|
|
243
|
-
return await this.#database.queryOne(
|
|
244
|
-
`
|
|
245
|
-
SELECT COALESCE(revision, 0) AS revision
|
|
246
|
-
FROM serial_states
|
|
247
|
-
WHERE serial_id = ?
|
|
248
|
-
`,
|
|
249
|
-
[serialId],
|
|
250
|
-
(row) => getNumber(row, "revision")
|
|
251
|
-
) ?? 0;
|
|
252
|
-
}
|
|
253
|
-
async getRevisions(serialIds) {
|
|
254
|
-
const uniqueIds = [...new Set(serialIds)].sort(compareNumber);
|
|
255
|
-
if (uniqueIds.length === 0) {
|
|
256
|
-
return /* @__PURE__ */ new Map();
|
|
257
|
-
}
|
|
258
|
-
const rows = await this.#database.queryAll(
|
|
259
|
-
`
|
|
260
|
-
SELECT serial_id, COALESCE(revision, 0) AS revision
|
|
261
|
-
FROM serial_states
|
|
262
|
-
WHERE serial_id IN (${uniqueIds.map(() => "?").join(", ")})
|
|
263
|
-
ORDER BY serial_id
|
|
264
|
-
`,
|
|
265
|
-
uniqueIds,
|
|
266
|
-
(row) => [getNumber(row, "serial_id"), getNumber(row, "revision")]
|
|
267
|
-
);
|
|
268
|
-
return new Map(rows);
|
|
269
|
-
}
|
|
270
|
-
async bumpRevision(serialId) {
|
|
271
|
-
await this.ensure(serialId);
|
|
272
|
-
await this.#database.transaction(async () => {
|
|
273
|
-
await this.#database.run(
|
|
274
|
-
`
|
|
275
|
-
UPDATE serial_states
|
|
276
|
-
SET revision = revision + 1
|
|
277
|
-
WHERE serial_id = ?
|
|
278
|
-
`,
|
|
279
|
-
[serialId]
|
|
280
|
-
);
|
|
281
|
-
await this.bumpChaptersRevision();
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
async bumpChaptersRevision() {
|
|
285
|
-
await this.#database.run(
|
|
286
|
-
`
|
|
287
|
-
INSERT INTO archive_revisions (key, value)
|
|
288
|
-
VALUES ('chapters', 1)
|
|
289
|
-
ON CONFLICT(key) DO UPDATE SET value = value + 1
|
|
290
|
-
`
|
|
291
|
-
);
|
|
292
|
-
}
|
|
293
|
-
async getChaptersRevision() {
|
|
294
|
-
return await this.#database.queryOne(
|
|
295
|
-
`
|
|
296
|
-
SELECT value
|
|
297
|
-
FROM archive_revisions
|
|
298
|
-
WHERE key = 'chapters'
|
|
299
|
-
`,
|
|
300
|
-
void 0,
|
|
301
|
-
(row) => getNumber(row, "value")
|
|
302
|
-
) ?? 0;
|
|
303
|
-
}
|
|
304
|
-
async getMaxId() {
|
|
305
|
-
const maxId = await this.#database.queryOne(
|
|
306
|
-
`
|
|
307
|
-
SELECT COALESCE(MAX(id), 0) AS max_id
|
|
308
|
-
FROM serials
|
|
309
|
-
`,
|
|
310
|
-
void 0,
|
|
311
|
-
(row) => getNumber(row, "max_id")
|
|
312
|
-
);
|
|
313
|
-
return maxId ?? 0;
|
|
314
|
-
}
|
|
315
|
-
async setTopologyReady(serialId, ready = true, parameterHash) {
|
|
316
|
-
await this.ensure(serialId);
|
|
317
|
-
if (ready) {
|
|
318
|
-
await this.#database.run(
|
|
319
|
-
`
|
|
320
|
-
UPDATE serial_states
|
|
321
|
-
SET
|
|
322
|
-
topology_ready = ?,
|
|
323
|
-
topology_parameter_hash = COALESCE(?, topology_parameter_hash)
|
|
324
|
-
WHERE serial_id = ?
|
|
325
|
-
`,
|
|
326
|
-
[1, parameterHash ?? null, serialId]
|
|
327
|
-
);
|
|
328
|
-
return;
|
|
329
|
-
}
|
|
330
|
-
await this.#database.run(
|
|
331
|
-
`
|
|
332
|
-
UPDATE serial_states
|
|
333
|
-
SET
|
|
334
|
-
topology_ready = ?,
|
|
335
|
-
topology_parameter_hash = NULL
|
|
336
|
-
WHERE serial_id = ?
|
|
337
|
-
`,
|
|
338
|
-
[0, serialId]
|
|
339
|
-
);
|
|
340
|
-
}
|
|
341
|
-
async setKnowledgeGraphReady(serialId, ready = true, parameterHash) {
|
|
342
|
-
await this.ensure(serialId);
|
|
343
|
-
if (ready) {
|
|
344
|
-
await this.#database.run(
|
|
345
|
-
`
|
|
346
|
-
UPDATE serial_states
|
|
347
|
-
SET
|
|
348
|
-
knowledge_graph_ready = ?,
|
|
349
|
-
knowledge_graph_parameter_hash = COALESCE(?, knowledge_graph_parameter_hash)
|
|
350
|
-
WHERE serial_id = ?
|
|
351
|
-
`,
|
|
352
|
-
[1, parameterHash ?? null, serialId]
|
|
353
|
-
);
|
|
354
|
-
return;
|
|
355
|
-
}
|
|
356
|
-
await this.#database.run(
|
|
357
|
-
`
|
|
358
|
-
UPDATE serial_states
|
|
359
|
-
SET
|
|
360
|
-
knowledge_graph_ready = ?,
|
|
361
|
-
knowledge_graph_parameter_hash = NULL
|
|
362
|
-
WHERE serial_id = ?
|
|
363
|
-
`,
|
|
364
|
-
[0, serialId]
|
|
365
|
-
);
|
|
366
|
-
}
|
|
367
|
-
async listIds() {
|
|
368
|
-
return await this.#database.queryAll(
|
|
369
|
-
`
|
|
370
|
-
SELECT id
|
|
371
|
-
FROM serials
|
|
372
|
-
ORDER BY id
|
|
373
|
-
`,
|
|
374
|
-
void 0,
|
|
375
|
-
(row) => getNumber(row, "id")
|
|
376
|
-
);
|
|
377
|
-
}
|
|
378
|
-
async listDocumentOrders() {
|
|
379
|
-
const rows = await this.#database.queryAll(
|
|
380
|
-
`
|
|
381
|
-
SELECT id, document_order
|
|
382
|
-
FROM serials
|
|
383
|
-
ORDER BY id
|
|
384
|
-
`,
|
|
385
|
-
void 0,
|
|
386
|
-
(row) => [getNumber(row, "id"), getNumber(row, "document_order")]
|
|
387
|
-
);
|
|
388
|
-
return new Map(rows);
|
|
389
|
-
}
|
|
390
|
-
async setDocumentOrders(entries) {
|
|
391
|
-
await this.#database.transaction(async () => {
|
|
392
|
-
for (const entry of entries) {
|
|
393
|
-
await this.#database.run(
|
|
394
|
-
`
|
|
395
|
-
INSERT OR IGNORE INTO serials (id)
|
|
396
|
-
VALUES (?)
|
|
397
|
-
`,
|
|
398
|
-
[entry.serialId]
|
|
399
|
-
);
|
|
400
|
-
await this.#database.run(
|
|
401
|
-
`
|
|
402
|
-
INSERT OR IGNORE INTO serial_states (
|
|
403
|
-
serial_id, revision, topology_ready, knowledge_graph_ready
|
|
404
|
-
)
|
|
405
|
-
VALUES (?, ?, ?, ?)
|
|
406
|
-
`,
|
|
407
|
-
[entry.serialId, 0, 0, 0]
|
|
408
|
-
);
|
|
409
|
-
await this.#database.run(
|
|
410
|
-
`
|
|
411
|
-
UPDATE serials
|
|
412
|
-
SET document_order = ?
|
|
413
|
-
WHERE id = ?
|
|
414
|
-
`,
|
|
415
|
-
[entry.documentOrder, entry.serialId]
|
|
416
|
-
);
|
|
417
|
-
}
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
function mapSerialRow(row) {
|
|
422
|
-
const topologyParameterHash = getOptionalString(
|
|
423
|
-
row,
|
|
424
|
-
"topology_parameter_hash"
|
|
425
|
-
);
|
|
426
|
-
const knowledgeGraphParameterHash = getOptionalString(
|
|
427
|
-
row,
|
|
428
|
-
"knowledge_graph_parameter_hash"
|
|
429
|
-
);
|
|
430
|
-
return {
|
|
431
|
-
documentOrder: getNumber(row, "document_order"),
|
|
432
|
-
id: getNumber(row, "id"),
|
|
433
|
-
knowledgeGraphReady: getNumber(row, "knowledge_graph_ready") !== 0,
|
|
434
|
-
...knowledgeGraphParameterHash === void 0 ? {} : { knowledgeGraphParameterHash },
|
|
435
|
-
revision: getNumber(row, "revision"),
|
|
436
|
-
topologyReady: getNumber(row, "topology_ready") !== 0,
|
|
437
|
-
...topologyParameterHash === void 0 ? {} : { topologyParameterHash }
|
|
438
|
-
};
|
|
439
|
-
}
|
|
440
|
-
function compareNumber(left, right) {
|
|
441
|
-
return left - right;
|
|
442
|
-
}
|
|
443
|
-
class GraphBuildParameterStore {
|
|
444
|
-
#database;
|
|
445
|
-
constructor(database) {
|
|
446
|
-
this.#database = database;
|
|
447
|
-
}
|
|
448
|
-
async save(input) {
|
|
449
|
-
const hash = createHash({
|
|
450
|
-
language: input.language ?? null,
|
|
451
|
-
prompt: input.prompt
|
|
452
|
-
});
|
|
453
|
-
const createdAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
454
|
-
await this.#database.run(
|
|
455
|
-
`
|
|
456
|
-
INSERT OR IGNORE INTO graph_build_parameters (
|
|
457
|
-
hash, prompt, language, created_at
|
|
458
|
-
)
|
|
459
|
-
VALUES (?, ?, ?, ?)
|
|
460
|
-
`,
|
|
461
|
-
[hash, input.prompt, input.language ?? null, createdAt]
|
|
462
|
-
);
|
|
463
|
-
return await this.getByHash(hash);
|
|
464
|
-
}
|
|
465
|
-
async getByHash(hash) {
|
|
466
|
-
return await this.#database.queryOne(
|
|
467
|
-
`
|
|
468
|
-
SELECT hash, prompt, language, created_at
|
|
469
|
-
FROM graph_build_parameters
|
|
470
|
-
WHERE hash = ?
|
|
471
|
-
`,
|
|
472
|
-
[hash],
|
|
473
|
-
(row) => {
|
|
474
|
-
const language = getOptionalString(row, "language");
|
|
475
|
-
return {
|
|
476
|
-
createdAt: getString(row, "created_at"),
|
|
477
|
-
hash: getString(row, "hash"),
|
|
478
|
-
...language === void 0 ? {} : { language },
|
|
479
|
-
prompt: getString(row, "prompt")
|
|
480
|
-
};
|
|
481
|
-
}
|
|
482
|
-
);
|
|
483
|
-
}
|
|
484
|
-
async deleteUnreferenced() {
|
|
485
|
-
await this.#database.run(`
|
|
486
|
-
DELETE FROM graph_build_parameters
|
|
487
|
-
WHERE hash NOT IN (
|
|
488
|
-
SELECT topology_parameter_hash
|
|
489
|
-
FROM serial_states
|
|
490
|
-
WHERE topology_parameter_hash IS NOT NULL
|
|
491
|
-
UNION
|
|
492
|
-
SELECT knowledge_graph_parameter_hash
|
|
493
|
-
FROM serial_states
|
|
494
|
-
WHERE knowledge_graph_parameter_hash IS NOT NULL
|
|
495
|
-
)
|
|
496
|
-
`);
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
function isSqliteConstraintError(error) {
|
|
500
|
-
return typeof error === "object" && error !== null && "code" in error && typeof error.code === "string" && error.code.startsWith("SQLITE_CONSTRAINT");
|
|
501
|
-
}
|
|
502
|
-
class ChunkStore {
|
|
503
|
-
#database;
|
|
504
|
-
constructor(database) {
|
|
505
|
-
this.#database = database;
|
|
506
|
-
}
|
|
507
|
-
async countAll() {
|
|
508
|
-
return await this.#database.queryOne(
|
|
509
|
-
`
|
|
510
|
-
SELECT COUNT(*) AS count
|
|
511
|
-
FROM chunks
|
|
512
|
-
`,
|
|
513
|
-
void 0,
|
|
514
|
-
(row) => getNumber(row, "count")
|
|
515
|
-
) ?? 0;
|
|
516
|
-
}
|
|
517
|
-
async create(record) {
|
|
518
|
-
return await this.#database.transaction(async () => {
|
|
519
|
-
await this.#database.run(
|
|
520
|
-
`
|
|
521
|
-
INSERT INTO chunks (
|
|
522
|
-
generation,
|
|
523
|
-
serial_id,
|
|
524
|
-
sentence_index,
|
|
525
|
-
label,
|
|
526
|
-
content,
|
|
527
|
-
retention,
|
|
528
|
-
importance,
|
|
529
|
-
wordsCount,
|
|
530
|
-
weight
|
|
531
|
-
)
|
|
532
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
533
|
-
`,
|
|
534
|
-
[
|
|
535
|
-
record.generation,
|
|
536
|
-
record.sentenceId[0],
|
|
537
|
-
record.sentenceId[1],
|
|
538
|
-
record.label,
|
|
539
|
-
record.content,
|
|
540
|
-
record.retention ?? null,
|
|
541
|
-
record.importance ?? null,
|
|
542
|
-
record.wordsCount,
|
|
543
|
-
record.weight
|
|
544
|
-
]
|
|
545
|
-
);
|
|
546
|
-
const id = await this.#database.getLastInsertRowId();
|
|
547
|
-
const createdRecord = {
|
|
548
|
-
...record,
|
|
549
|
-
id
|
|
550
|
-
};
|
|
551
|
-
await this.#replaceChunkSentences(createdRecord);
|
|
552
|
-
return createdRecord;
|
|
553
|
-
});
|
|
554
|
-
}
|
|
555
|
-
async save(record) {
|
|
556
|
-
await this.#database.transaction(async () => {
|
|
557
|
-
await this.#database.run(
|
|
558
|
-
`
|
|
559
|
-
INSERT OR REPLACE INTO chunks (
|
|
560
|
-
id,
|
|
561
|
-
generation,
|
|
562
|
-
serial_id,
|
|
563
|
-
sentence_index,
|
|
564
|
-
label,
|
|
565
|
-
content,
|
|
566
|
-
retention,
|
|
567
|
-
importance,
|
|
568
|
-
wordsCount,
|
|
569
|
-
weight
|
|
570
|
-
)
|
|
571
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
572
|
-
`,
|
|
573
|
-
[
|
|
574
|
-
record.id,
|
|
575
|
-
record.generation,
|
|
576
|
-
record.sentenceId[0],
|
|
577
|
-
record.sentenceId[1],
|
|
578
|
-
record.label,
|
|
579
|
-
record.content,
|
|
580
|
-
record.retention ?? null,
|
|
581
|
-
record.importance ?? null,
|
|
582
|
-
record.wordsCount,
|
|
583
|
-
record.weight
|
|
584
|
-
]
|
|
585
|
-
);
|
|
586
|
-
await this.#replaceChunkSentences(record);
|
|
587
|
-
});
|
|
588
|
-
}
|
|
589
|
-
async getById(chunkId) {
|
|
590
|
-
const row = await this.#database.queryOne(
|
|
591
|
-
`
|
|
592
|
-
SELECT
|
|
593
|
-
id,
|
|
594
|
-
generation,
|
|
595
|
-
serial_id,
|
|
596
|
-
sentence_index,
|
|
597
|
-
label,
|
|
598
|
-
content,
|
|
599
|
-
retention,
|
|
600
|
-
importance,
|
|
601
|
-
wordsCount,
|
|
602
|
-
weight
|
|
603
|
-
FROM chunks
|
|
604
|
-
WHERE id = ?
|
|
605
|
-
`,
|
|
606
|
-
[chunkId],
|
|
607
|
-
(value) => value
|
|
608
|
-
);
|
|
609
|
-
if (row === void 0) {
|
|
610
|
-
return void 0;
|
|
611
|
-
}
|
|
612
|
-
return await this.#mapChunkRow(row);
|
|
613
|
-
}
|
|
614
|
-
async listAll() {
|
|
615
|
-
const rows = await this.#database.queryAll(
|
|
616
|
-
`
|
|
617
|
-
SELECT
|
|
618
|
-
id,
|
|
619
|
-
generation,
|
|
620
|
-
serial_id,
|
|
621
|
-
sentence_index,
|
|
622
|
-
label,
|
|
623
|
-
content,
|
|
624
|
-
retention,
|
|
625
|
-
importance,
|
|
626
|
-
wordsCount,
|
|
627
|
-
weight
|
|
628
|
-
FROM chunks
|
|
629
|
-
ORDER BY id
|
|
630
|
-
`,
|
|
631
|
-
void 0,
|
|
632
|
-
(row) => row
|
|
633
|
-
);
|
|
634
|
-
return await Promise.all(
|
|
635
|
-
rows.map(async (row) => await this.#mapChunkRow(row))
|
|
636
|
-
);
|
|
637
|
-
}
|
|
638
|
-
async listBySentenceStartIndexes(serialId, sentenceStartIndexes) {
|
|
639
|
-
if (sentenceStartIndexes.length === 0) {
|
|
640
|
-
return [];
|
|
641
|
-
}
|
|
642
|
-
const results = await Promise.all(
|
|
643
|
-
sentenceStartIndexes.map(
|
|
644
|
-
async (sentenceStartIndex) => await this.listBySentenceRange(
|
|
645
|
-
serialId,
|
|
646
|
-
sentenceStartIndex,
|
|
647
|
-
sentenceStartIndex
|
|
648
|
-
)
|
|
649
|
-
)
|
|
650
|
-
);
|
|
651
|
-
return deduplicateById(results.flat());
|
|
652
|
-
}
|
|
653
|
-
async listBySentenceRange(serialId, startSentenceIndex, endSentenceIndex) {
|
|
654
|
-
const rows = await this.#database.queryAll(
|
|
655
|
-
`
|
|
656
|
-
SELECT
|
|
657
|
-
id,
|
|
658
|
-
generation,
|
|
659
|
-
serial_id,
|
|
660
|
-
sentence_index,
|
|
661
|
-
label,
|
|
662
|
-
content,
|
|
663
|
-
retention,
|
|
664
|
-
importance,
|
|
665
|
-
wordsCount,
|
|
666
|
-
weight
|
|
667
|
-
FROM chunks
|
|
668
|
-
WHERE serial_id = ?
|
|
669
|
-
AND sentence_index BETWEEN ? AND ?
|
|
670
|
-
ORDER BY id
|
|
671
|
-
`,
|
|
672
|
-
[serialId, startSentenceIndex, endSentenceIndex],
|
|
673
|
-
(row) => row
|
|
674
|
-
);
|
|
675
|
-
return await Promise.all(
|
|
676
|
-
rows.map(async (row) => await this.#mapChunkRow(row))
|
|
677
|
-
);
|
|
678
|
-
}
|
|
679
|
-
async listBySerial(serialId) {
|
|
680
|
-
const rows = await this.#database.queryAll(
|
|
681
|
-
`
|
|
682
|
-
SELECT
|
|
683
|
-
id,
|
|
684
|
-
generation,
|
|
685
|
-
serial_id,
|
|
686
|
-
sentence_index,
|
|
687
|
-
label,
|
|
688
|
-
content,
|
|
689
|
-
retention,
|
|
690
|
-
importance,
|
|
691
|
-
wordsCount,
|
|
692
|
-
weight
|
|
693
|
-
FROM chunks
|
|
694
|
-
WHERE serial_id = ?
|
|
695
|
-
ORDER BY id
|
|
696
|
-
`,
|
|
697
|
-
[serialId],
|
|
698
|
-
(row) => row
|
|
699
|
-
);
|
|
700
|
-
return await Promise.all(
|
|
701
|
-
rows.map(async (row) => await this.#mapChunkRow(row))
|
|
702
|
-
);
|
|
703
|
-
}
|
|
704
|
-
async getMaxId() {
|
|
705
|
-
return await this.#database.queryOne(
|
|
706
|
-
`
|
|
707
|
-
SELECT MAX(id) AS id
|
|
708
|
-
FROM chunks
|
|
709
|
-
`,
|
|
710
|
-
void 0,
|
|
711
|
-
(row) => {
|
|
712
|
-
const value = row.id;
|
|
713
|
-
return typeof value === "number" ? value : 0;
|
|
714
|
-
}
|
|
715
|
-
) ?? 0;
|
|
716
|
-
}
|
|
717
|
-
async listFragmentPairs() {
|
|
718
|
-
return await this.#database.queryAll(
|
|
719
|
-
`
|
|
720
|
-
SELECT DISTINCT serial_id, sentence_index
|
|
721
|
-
FROM chunks
|
|
722
|
-
ORDER BY serial_id, sentence_index
|
|
723
|
-
`,
|
|
724
|
-
void 0,
|
|
725
|
-
(row) => [
|
|
726
|
-
getNumber(row, "serial_id"),
|
|
727
|
-
getNumber(row, "sentence_index")
|
|
728
|
-
]
|
|
729
|
-
);
|
|
730
|
-
}
|
|
731
|
-
async #getSentenceIds(chunkId) {
|
|
732
|
-
return await this.#database.queryAll(
|
|
733
|
-
`
|
|
734
|
-
SELECT serial_id, sentence_index
|
|
735
|
-
FROM chunk_sentences
|
|
736
|
-
WHERE chunk_id = ?
|
|
737
|
-
ORDER BY serial_id, sentence_index
|
|
738
|
-
`,
|
|
739
|
-
[chunkId],
|
|
740
|
-
(row) => [
|
|
741
|
-
getNumber(row, "serial_id"),
|
|
742
|
-
getNumber(row, "sentence_index")
|
|
743
|
-
]
|
|
744
|
-
);
|
|
745
|
-
}
|
|
746
|
-
async #replaceChunkSentences(record) {
|
|
747
|
-
await this.#database.run(
|
|
748
|
-
`
|
|
749
|
-
DELETE FROM chunk_sentences
|
|
750
|
-
WHERE chunk_id = ?
|
|
751
|
-
`,
|
|
752
|
-
[record.id]
|
|
753
|
-
);
|
|
754
|
-
for (const sentenceId of record.sentenceIds) {
|
|
755
|
-
await this.#database.run(
|
|
756
|
-
`
|
|
757
|
-
INSERT INTO chunk_sentences (
|
|
758
|
-
chunk_id,
|
|
759
|
-
serial_id,
|
|
760
|
-
sentence_index
|
|
761
|
-
)
|
|
762
|
-
VALUES (?, ?, ?)
|
|
763
|
-
`,
|
|
764
|
-
[record.id, sentenceId[0], sentenceId[1]]
|
|
765
|
-
);
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
async #mapChunkRow(row) {
|
|
769
|
-
const chunkId = getNumber(row, "id");
|
|
770
|
-
const importance = parseChunkImportance(
|
|
771
|
-
getOptionalString(row, "importance")
|
|
772
|
-
);
|
|
773
|
-
const retention = parseChunkRetention(getOptionalString(row, "retention"));
|
|
774
|
-
return {
|
|
775
|
-
content: getString(row, "content"),
|
|
776
|
-
generation: getNumber(row, "generation"),
|
|
777
|
-
id: chunkId,
|
|
778
|
-
label: getString(row, "label"),
|
|
779
|
-
sentenceId: [
|
|
780
|
-
getNumber(row, "serial_id"),
|
|
781
|
-
getNumber(row, "sentence_index")
|
|
782
|
-
],
|
|
783
|
-
sentenceIds: await this.#getSentenceIds(chunkId),
|
|
784
|
-
wordsCount: getNumber(row, "wordsCount"),
|
|
785
|
-
weight: getNumber(row, "weight"),
|
|
786
|
-
...importance === void 0 ? {} : { importance },
|
|
787
|
-
...retention === void 0 ? {} : { retention }
|
|
788
|
-
};
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
class ReadingEdgeStore {
|
|
792
|
-
#database;
|
|
793
|
-
constructor(database) {
|
|
794
|
-
this.#database = database;
|
|
795
|
-
}
|
|
796
|
-
async countAll() {
|
|
797
|
-
return await this.#database.queryOne(
|
|
798
|
-
`
|
|
799
|
-
SELECT COUNT(*) AS count
|
|
800
|
-
FROM reading_edges
|
|
801
|
-
`,
|
|
802
|
-
void 0,
|
|
803
|
-
(row) => getNumber(row, "count")
|
|
804
|
-
) ?? 0;
|
|
805
|
-
}
|
|
806
|
-
async save(record) {
|
|
807
|
-
await this.#database.run(
|
|
808
|
-
`
|
|
809
|
-
INSERT OR REPLACE INTO reading_edges (from_id, to_id, strength, weight)
|
|
810
|
-
VALUES (?, ?, ?, ?)
|
|
811
|
-
`,
|
|
812
|
-
[record.fromId, record.toId, record.strength ?? null, record.weight]
|
|
813
|
-
);
|
|
814
|
-
}
|
|
815
|
-
async listAll() {
|
|
816
|
-
return await this.#database.queryAll(
|
|
817
|
-
`
|
|
818
|
-
SELECT from_id, to_id, strength, weight
|
|
819
|
-
FROM reading_edges
|
|
820
|
-
ORDER BY from_id, to_id
|
|
821
|
-
`,
|
|
822
|
-
void 0,
|
|
823
|
-
(row) => mapReadingEdgeRow(row)
|
|
824
|
-
);
|
|
825
|
-
}
|
|
826
|
-
async listBySerial(serialId) {
|
|
827
|
-
return await this.#database.queryAll(
|
|
828
|
-
`
|
|
829
|
-
SELECT
|
|
830
|
-
reading_edges.from_id AS from_id,
|
|
831
|
-
reading_edges.to_id AS to_id,
|
|
832
|
-
reading_edges.strength AS strength,
|
|
833
|
-
reading_edges.weight AS weight
|
|
834
|
-
FROM reading_edges
|
|
835
|
-
INNER JOIN chunks AS from_chunks
|
|
836
|
-
ON from_chunks.id = reading_edges.from_id
|
|
837
|
-
INNER JOIN chunks AS to_chunks
|
|
838
|
-
ON to_chunks.id = reading_edges.to_id
|
|
839
|
-
WHERE from_chunks.serial_id = ? AND to_chunks.serial_id = ?
|
|
840
|
-
ORDER BY reading_edges.from_id, reading_edges.to_id
|
|
841
|
-
`,
|
|
842
|
-
[serialId, serialId],
|
|
843
|
-
(row) => mapReadingEdgeRow(row)
|
|
844
|
-
);
|
|
845
|
-
}
|
|
846
|
-
async listIncoming(chunkId) {
|
|
847
|
-
return await this.#listByDirection("to_id", chunkId);
|
|
848
|
-
}
|
|
849
|
-
async listOutgoing(chunkId) {
|
|
850
|
-
return await this.#listByDirection("from_id", chunkId);
|
|
851
|
-
}
|
|
852
|
-
async #listByDirection(column, chunkId) {
|
|
853
|
-
return await this.#database.queryAll(
|
|
854
|
-
`
|
|
855
|
-
SELECT from_id, to_id, strength, weight
|
|
856
|
-
FROM reading_edges
|
|
857
|
-
WHERE ${column} = ?
|
|
858
|
-
ORDER BY from_id, to_id
|
|
859
|
-
`,
|
|
860
|
-
[chunkId],
|
|
861
|
-
(row) => mapReadingEdgeRow(row)
|
|
862
|
-
);
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
class SnakeStore {
|
|
866
|
-
#database;
|
|
867
|
-
constructor(database) {
|
|
868
|
-
this.#database = database;
|
|
869
|
-
}
|
|
870
|
-
async create(record) {
|
|
871
|
-
await this.#database.run(
|
|
872
|
-
`
|
|
873
|
-
INSERT INTO snakes (
|
|
874
|
-
serial_id,
|
|
875
|
-
group_id,
|
|
876
|
-
local_snake_id,
|
|
877
|
-
size,
|
|
878
|
-
first_label,
|
|
879
|
-
last_label,
|
|
880
|
-
wordsCount,
|
|
881
|
-
weight
|
|
882
|
-
)
|
|
883
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
884
|
-
`,
|
|
885
|
-
[
|
|
886
|
-
record.serialId,
|
|
887
|
-
record.groupId,
|
|
888
|
-
record.localSnakeId,
|
|
889
|
-
record.size,
|
|
890
|
-
record.firstLabel,
|
|
891
|
-
record.lastLabel,
|
|
892
|
-
record.wordsCount ?? 0,
|
|
893
|
-
record.weight ?? 0
|
|
894
|
-
]
|
|
895
|
-
);
|
|
896
|
-
return await this.#database.getLastInsertRowId();
|
|
897
|
-
}
|
|
898
|
-
async getById(snakeId) {
|
|
899
|
-
return await this.#database.queryOne(
|
|
900
|
-
`
|
|
901
|
-
SELECT
|
|
902
|
-
id,
|
|
903
|
-
serial_id,
|
|
904
|
-
group_id,
|
|
905
|
-
local_snake_id,
|
|
906
|
-
size,
|
|
907
|
-
first_label,
|
|
908
|
-
last_label,
|
|
909
|
-
wordsCount,
|
|
910
|
-
weight
|
|
911
|
-
FROM snakes
|
|
912
|
-
WHERE id = ?
|
|
913
|
-
`,
|
|
914
|
-
[snakeId],
|
|
915
|
-
(row) => ({
|
|
916
|
-
serialId: getNumber(row, "serial_id"),
|
|
917
|
-
firstLabel: getString(row, "first_label"),
|
|
918
|
-
groupId: getNumber(row, "group_id"),
|
|
919
|
-
id: getNumber(row, "id"),
|
|
920
|
-
lastLabel: getString(row, "last_label"),
|
|
921
|
-
localSnakeId: getNumber(row, "local_snake_id"),
|
|
922
|
-
size: getNumber(row, "size"),
|
|
923
|
-
wordsCount: getNumber(row, "wordsCount"),
|
|
924
|
-
weight: getNumber(row, "weight")
|
|
925
|
-
})
|
|
926
|
-
);
|
|
927
|
-
}
|
|
928
|
-
async listIdsByGroup(serialId, groupId) {
|
|
929
|
-
return await this.#database.queryAll(
|
|
930
|
-
`
|
|
931
|
-
SELECT id
|
|
932
|
-
FROM snakes
|
|
933
|
-
WHERE serial_id = ? AND group_id = ?
|
|
934
|
-
ORDER BY id
|
|
935
|
-
`,
|
|
936
|
-
[serialId, groupId],
|
|
937
|
-
(row) => getNumber(row, "id")
|
|
938
|
-
);
|
|
939
|
-
}
|
|
940
|
-
async listBySerial(serialId) {
|
|
941
|
-
return await this.#database.queryAll(
|
|
942
|
-
`
|
|
943
|
-
SELECT
|
|
944
|
-
id,
|
|
945
|
-
serial_id,
|
|
946
|
-
group_id,
|
|
947
|
-
local_snake_id,
|
|
948
|
-
size,
|
|
949
|
-
first_label,
|
|
950
|
-
last_label,
|
|
951
|
-
wordsCount,
|
|
952
|
-
weight
|
|
953
|
-
FROM snakes
|
|
954
|
-
WHERE serial_id = ?
|
|
955
|
-
ORDER BY group_id, id
|
|
956
|
-
`,
|
|
957
|
-
[serialId],
|
|
958
|
-
(row) => ({
|
|
959
|
-
serialId: getNumber(row, "serial_id"),
|
|
960
|
-
firstLabel: getString(row, "first_label"),
|
|
961
|
-
groupId: getNumber(row, "group_id"),
|
|
962
|
-
id: getNumber(row, "id"),
|
|
963
|
-
lastLabel: getString(row, "last_label"),
|
|
964
|
-
localSnakeId: getNumber(row, "local_snake_id"),
|
|
965
|
-
size: getNumber(row, "size"),
|
|
966
|
-
wordsCount: getNumber(row, "wordsCount"),
|
|
967
|
-
weight: getNumber(row, "weight")
|
|
968
|
-
})
|
|
969
|
-
);
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
class MentionStore {
|
|
973
|
-
#database;
|
|
974
|
-
constructor(database) {
|
|
975
|
-
this.#database = database;
|
|
976
|
-
}
|
|
977
|
-
async save(record) {
|
|
978
|
-
await this.#database.run(
|
|
979
|
-
`
|
|
980
|
-
INSERT OR REPLACE INTO mentions (
|
|
981
|
-
id,
|
|
982
|
-
chapter_id,
|
|
983
|
-
sentence_index,
|
|
984
|
-
range_start,
|
|
985
|
-
range_end,
|
|
986
|
-
surface,
|
|
987
|
-
qid,
|
|
988
|
-
confidence,
|
|
989
|
-
note
|
|
990
|
-
)
|
|
991
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
992
|
-
`,
|
|
993
|
-
[
|
|
994
|
-
record.id,
|
|
995
|
-
record.chapterId,
|
|
996
|
-
record.sentenceIndex ?? null,
|
|
997
|
-
record.rangeStart,
|
|
998
|
-
record.rangeEnd,
|
|
999
|
-
record.surface,
|
|
1000
|
-
record.qid,
|
|
1001
|
-
record.confidence ?? null,
|
|
1002
|
-
record.note ?? null
|
|
1003
|
-
]
|
|
1004
|
-
);
|
|
1005
|
-
}
|
|
1006
|
-
async saveMany(records) {
|
|
1007
|
-
await this.#database.transaction(async () => {
|
|
1008
|
-
for (const record of records) {
|
|
1009
|
-
await this.save(record);
|
|
1010
|
-
}
|
|
1011
|
-
});
|
|
1012
|
-
}
|
|
1013
|
-
async getById(mentionId) {
|
|
1014
|
-
return await this.#database.queryOne(
|
|
1015
|
-
`
|
|
1016
|
-
SELECT
|
|
1017
|
-
id,
|
|
1018
|
-
chapter_id,
|
|
1019
|
-
sentence_index,
|
|
1020
|
-
range_start,
|
|
1021
|
-
range_end,
|
|
1022
|
-
surface,
|
|
1023
|
-
qid,
|
|
1024
|
-
confidence,
|
|
1025
|
-
note
|
|
1026
|
-
FROM mentions
|
|
1027
|
-
WHERE id = ?
|
|
1028
|
-
`,
|
|
1029
|
-
[mentionId],
|
|
1030
|
-
mapMentionRow
|
|
1031
|
-
);
|
|
1032
|
-
}
|
|
1033
|
-
async listAll() {
|
|
1034
|
-
return await this.#database.queryAll(
|
|
1035
|
-
`
|
|
1036
|
-
SELECT
|
|
1037
|
-
id,
|
|
1038
|
-
chapter_id,
|
|
1039
|
-
sentence_index,
|
|
1040
|
-
range_start,
|
|
1041
|
-
range_end,
|
|
1042
|
-
surface,
|
|
1043
|
-
qid,
|
|
1044
|
-
confidence,
|
|
1045
|
-
note
|
|
1046
|
-
FROM mentions
|
|
1047
|
-
ORDER BY chapter_id, sentence_index, range_start, range_end, id
|
|
1048
|
-
`,
|
|
1049
|
-
void 0,
|
|
1050
|
-
mapMentionRow
|
|
1051
|
-
);
|
|
1052
|
-
}
|
|
1053
|
-
async listByQid(qid) {
|
|
1054
|
-
return await this.#database.queryAll(
|
|
1055
|
-
`
|
|
1056
|
-
SELECT
|
|
1057
|
-
id,
|
|
1058
|
-
chapter_id,
|
|
1059
|
-
sentence_index,
|
|
1060
|
-
range_start,
|
|
1061
|
-
range_end,
|
|
1062
|
-
surface,
|
|
1063
|
-
qid,
|
|
1064
|
-
confidence,
|
|
1065
|
-
note
|
|
1066
|
-
FROM mentions
|
|
1067
|
-
WHERE qid = ?
|
|
1068
|
-
ORDER BY chapter_id, sentence_index, range_start, range_end, id
|
|
1069
|
-
`,
|
|
1070
|
-
[qid],
|
|
1071
|
-
mapMentionRow
|
|
1072
|
-
);
|
|
1073
|
-
}
|
|
1074
|
-
async listBySurfaces(surfaces) {
|
|
1075
|
-
const normalizedSurfaces = [
|
|
1076
|
-
...new Set(surfaces.map((surface) => surface.trim()))
|
|
1077
|
-
].filter((surface) => surface !== "");
|
|
1078
|
-
if (normalizedSurfaces.length === 0) {
|
|
1079
|
-
return [];
|
|
1080
|
-
}
|
|
1081
|
-
return await this.#database.queryAll(
|
|
1082
|
-
`
|
|
1083
|
-
SELECT
|
|
1084
|
-
id,
|
|
1085
|
-
chapter_id,
|
|
1086
|
-
sentence_index,
|
|
1087
|
-
range_start,
|
|
1088
|
-
range_end,
|
|
1089
|
-
surface,
|
|
1090
|
-
qid,
|
|
1091
|
-
confidence,
|
|
1092
|
-
note
|
|
1093
|
-
FROM mentions
|
|
1094
|
-
WHERE surface IN (${normalizedSurfaces.map(() => "?").join(", ")})
|
|
1095
|
-
ORDER BY chapter_id, sentence_index, range_start, range_end, id
|
|
1096
|
-
`,
|
|
1097
|
-
normalizedSurfaces,
|
|
1098
|
-
mapMentionRow
|
|
1099
|
-
);
|
|
1100
|
-
}
|
|
1101
|
-
async listBySurfaceTerms(terms) {
|
|
1102
|
-
const normalizedTerms = [
|
|
1103
|
-
...new Set(terms.map((term) => term.trim().toLowerCase()))
|
|
1104
|
-
].filter((term) => term !== "");
|
|
1105
|
-
if (normalizedTerms.length === 0) {
|
|
1106
|
-
return [];
|
|
1107
|
-
}
|
|
1108
|
-
const filters = normalizedTerms.map(() => "lower(surface) LIKE ? ESCAPE '\\'").join(" OR ");
|
|
1109
|
-
return await this.#database.queryAll(
|
|
1110
|
-
`
|
|
1111
|
-
SELECT
|
|
1112
|
-
id,
|
|
1113
|
-
chapter_id,
|
|
1114
|
-
sentence_index,
|
|
1115
|
-
range_start,
|
|
1116
|
-
range_end,
|
|
1117
|
-
surface,
|
|
1118
|
-
qid,
|
|
1119
|
-
confidence,
|
|
1120
|
-
note
|
|
1121
|
-
FROM mentions
|
|
1122
|
-
WHERE ${filters}
|
|
1123
|
-
ORDER BY chapter_id, sentence_index, range_start, range_end, id
|
|
1124
|
-
`,
|
|
1125
|
-
normalizedTerms.map((term) => `%${escapeLikePattern(term)}%`),
|
|
1126
|
-
mapMentionRow
|
|
1127
|
-
);
|
|
1128
|
-
}
|
|
1129
|
-
async listByChapter(chapterId) {
|
|
1130
|
-
return await this.#database.queryAll(
|
|
1131
|
-
`
|
|
1132
|
-
SELECT
|
|
1133
|
-
id,
|
|
1134
|
-
chapter_id,
|
|
1135
|
-
sentence_index,
|
|
1136
|
-
range_start,
|
|
1137
|
-
range_end,
|
|
1138
|
-
surface,
|
|
1139
|
-
qid,
|
|
1140
|
-
confidence,
|
|
1141
|
-
note
|
|
1142
|
-
FROM mentions
|
|
1143
|
-
WHERE chapter_id = ?
|
|
1144
|
-
ORDER BY sentence_index, range_start, range_end, id
|
|
1145
|
-
`,
|
|
1146
|
-
[chapterId],
|
|
1147
|
-
mapMentionRow
|
|
1148
|
-
);
|
|
1149
|
-
}
|
|
1150
|
-
async deleteByChapter(chapterId) {
|
|
1151
|
-
await this.#database.run(
|
|
1152
|
-
`
|
|
1153
|
-
DELETE FROM mentions
|
|
1154
|
-
WHERE chapter_id = ?
|
|
1155
|
-
`,
|
|
1156
|
-
[chapterId]
|
|
1157
|
-
);
|
|
1158
|
-
}
|
|
1159
|
-
}
|
|
1160
|
-
class MentionLinkStore {
|
|
1161
|
-
#database;
|
|
1162
|
-
constructor(database) {
|
|
1163
|
-
this.#database = database;
|
|
1164
|
-
}
|
|
1165
|
-
async save(record) {
|
|
1166
|
-
await this.#database.transaction(async () => {
|
|
1167
|
-
await this.#saveRecord(record);
|
|
1168
|
-
});
|
|
1169
|
-
}
|
|
1170
|
-
async #saveRecord(record) {
|
|
1171
|
-
await this.#database.run(
|
|
1172
|
-
`
|
|
1173
|
-
INSERT OR REPLACE INTO mention_links (
|
|
1174
|
-
id,
|
|
1175
|
-
source_mention_id,
|
|
1176
|
-
target_mention_id,
|
|
1177
|
-
predicate,
|
|
1178
|
-
confidence,
|
|
1179
|
-
note
|
|
1180
|
-
)
|
|
1181
|
-
VALUES (?, ?, ?, ?, ?, ?)
|
|
1182
|
-
`,
|
|
1183
|
-
[
|
|
1184
|
-
record.id,
|
|
1185
|
-
record.sourceMentionId,
|
|
1186
|
-
record.targetMentionId,
|
|
1187
|
-
record.predicate,
|
|
1188
|
-
record.confidence ?? null,
|
|
1189
|
-
record.note ?? null
|
|
1190
|
-
]
|
|
1191
|
-
);
|
|
1192
|
-
await this.#database.run(
|
|
1193
|
-
`
|
|
1194
|
-
DELETE FROM mention_link_evidence_sentences
|
|
1195
|
-
WHERE link_id = ?
|
|
1196
|
-
`,
|
|
1197
|
-
[record.id]
|
|
1198
|
-
);
|
|
1199
|
-
for (const [chapterId, sentenceIndex] of record.evidenceSentenceIds) {
|
|
1200
|
-
await this.#database.run(
|
|
1201
|
-
`
|
|
1202
|
-
INSERT INTO mention_link_evidence_sentences (
|
|
1203
|
-
link_id,
|
|
1204
|
-
chapter_id,
|
|
1205
|
-
sentence_index
|
|
1206
|
-
)
|
|
1207
|
-
VALUES (?, ?, ?)
|
|
1208
|
-
`,
|
|
1209
|
-
[record.id, chapterId, sentenceIndex]
|
|
1210
|
-
);
|
|
1211
|
-
}
|
|
1212
|
-
}
|
|
1213
|
-
async saveMany(records) {
|
|
1214
|
-
await this.#database.transaction(async () => {
|
|
1215
|
-
for (const record of records) {
|
|
1216
|
-
await this.#saveRecord(record);
|
|
1217
|
-
}
|
|
1218
|
-
});
|
|
1219
|
-
}
|
|
1220
|
-
async getById(linkId) {
|
|
1221
|
-
const row = await this.#database.queryOne(
|
|
1222
|
-
`
|
|
1223
|
-
SELECT
|
|
1224
|
-
id,
|
|
1225
|
-
source_mention_id,
|
|
1226
|
-
target_mention_id,
|
|
1227
|
-
predicate,
|
|
1228
|
-
confidence,
|
|
1229
|
-
note
|
|
1230
|
-
FROM mention_links
|
|
1231
|
-
WHERE id = ?
|
|
1232
|
-
`,
|
|
1233
|
-
[linkId],
|
|
1234
|
-
mapMentionLinkRow
|
|
1235
|
-
);
|
|
1236
|
-
return row === void 0 ? void 0 : await this.#hydrateEvidence(row);
|
|
1237
|
-
}
|
|
1238
|
-
async listByTriple(input) {
|
|
1239
|
-
const rows = await this.#database.queryAll(
|
|
1240
|
-
`
|
|
1241
|
-
SELECT
|
|
1242
|
-
mention_links.id AS id,
|
|
1243
|
-
mention_links.source_mention_id AS source_mention_id,
|
|
1244
|
-
mention_links.target_mention_id AS target_mention_id,
|
|
1245
|
-
mention_links.predicate AS predicate,
|
|
1246
|
-
mention_links.confidence AS confidence,
|
|
1247
|
-
mention_links.note AS note
|
|
1248
|
-
FROM mention_links
|
|
1249
|
-
INNER JOIN mentions AS source_mentions
|
|
1250
|
-
ON source_mentions.id = mention_links.source_mention_id
|
|
1251
|
-
INNER JOIN mentions AS target_mentions
|
|
1252
|
-
ON target_mentions.id = mention_links.target_mention_id
|
|
1253
|
-
WHERE source_mentions.qid = ?
|
|
1254
|
-
AND mention_links.predicate = ?
|
|
1255
|
-
AND target_mentions.qid = ?
|
|
1256
|
-
ORDER BY
|
|
1257
|
-
source_mentions.chapter_id,
|
|
1258
|
-
source_mentions.sentence_index,
|
|
1259
|
-
mention_links.id
|
|
1260
|
-
`,
|
|
1261
|
-
[input.subjectQid, input.predicate, input.objectQid],
|
|
1262
|
-
mapMentionLinkRow
|
|
1263
|
-
);
|
|
1264
|
-
return await this.#hydrateEvidenceMany(rows);
|
|
1265
|
-
}
|
|
1266
|
-
async listByChapter(chapterId) {
|
|
1267
|
-
const rows = await this.#database.queryAll(
|
|
1268
|
-
`
|
|
1269
|
-
SELECT
|
|
1270
|
-
mention_links.id AS id,
|
|
1271
|
-
mention_links.source_mention_id AS source_mention_id,
|
|
1272
|
-
mention_links.target_mention_id AS target_mention_id,
|
|
1273
|
-
mention_links.predicate AS predicate,
|
|
1274
|
-
mention_links.confidence AS confidence,
|
|
1275
|
-
mention_links.note AS note
|
|
1276
|
-
FROM mention_links
|
|
1277
|
-
INNER JOIN mentions AS source_mentions
|
|
1278
|
-
ON source_mentions.id = mention_links.source_mention_id
|
|
1279
|
-
INNER JOIN mentions AS target_mentions
|
|
1280
|
-
ON target_mentions.id = mention_links.target_mention_id
|
|
1281
|
-
WHERE source_mentions.chapter_id = ?
|
|
1282
|
-
OR target_mentions.chapter_id = ?
|
|
1283
|
-
ORDER BY mention_links.id
|
|
1284
|
-
`,
|
|
1285
|
-
[chapterId, chapterId],
|
|
1286
|
-
mapMentionLinkRow
|
|
1287
|
-
);
|
|
1288
|
-
return await this.#hydrateEvidenceMany(rows);
|
|
1289
|
-
}
|
|
1290
|
-
async deleteByChapter(chapterId) {
|
|
1291
|
-
await this.#database.transaction(async () => {
|
|
1292
|
-
await this.#database.run(
|
|
1293
|
-
`
|
|
1294
|
-
DELETE FROM mention_link_evidence_sentences
|
|
1295
|
-
WHERE link_id IN (
|
|
1296
|
-
SELECT mention_links.id
|
|
1297
|
-
FROM mention_links
|
|
1298
|
-
INNER JOIN mentions AS source_mentions
|
|
1299
|
-
ON source_mentions.id = mention_links.source_mention_id
|
|
1300
|
-
INNER JOIN mentions AS target_mentions
|
|
1301
|
-
ON target_mentions.id = mention_links.target_mention_id
|
|
1302
|
-
WHERE source_mentions.chapter_id = ?
|
|
1303
|
-
OR target_mentions.chapter_id = ?
|
|
1304
|
-
)
|
|
1305
|
-
`,
|
|
1306
|
-
[chapterId, chapterId]
|
|
1307
|
-
);
|
|
1308
|
-
await this.#database.run(
|
|
1309
|
-
`
|
|
1310
|
-
DELETE FROM mention_links
|
|
1311
|
-
WHERE source_mention_id IN (
|
|
1312
|
-
SELECT id
|
|
1313
|
-
FROM mentions
|
|
1314
|
-
WHERE chapter_id = ?
|
|
1315
|
-
)
|
|
1316
|
-
OR target_mention_id IN (
|
|
1317
|
-
SELECT id
|
|
1318
|
-
FROM mentions
|
|
1319
|
-
WHERE chapter_id = ?
|
|
1320
|
-
)
|
|
1321
|
-
`,
|
|
1322
|
-
[chapterId, chapterId]
|
|
1323
|
-
);
|
|
1324
|
-
});
|
|
1325
|
-
}
|
|
1326
|
-
async #hydrateEvidenceMany(records) {
|
|
1327
|
-
if (records.length === 0) {
|
|
1328
|
-
return [];
|
|
1329
|
-
}
|
|
1330
|
-
const sentenceIdsByLinkId = /* @__PURE__ */ new Map();
|
|
1331
|
-
const linkIds = [...new Set(records.map((record) => record.id))];
|
|
1332
|
-
for (const linkIdBatch of chunkArray(linkIds, MAX_SQL_BIND_PARAMS)) {
|
|
1333
|
-
const placeholders = linkIdBatch.map(() => "?").join(", ");
|
|
1334
|
-
const rows = await this.#database.queryAll(
|
|
1335
|
-
`
|
|
1336
|
-
SELECT link_id, chapter_id, sentence_index
|
|
1337
|
-
FROM mention_link_evidence_sentences
|
|
1338
|
-
WHERE link_id IN (${placeholders})
|
|
1339
|
-
ORDER BY link_id, chapter_id, sentence_index
|
|
1340
|
-
`,
|
|
1341
|
-
linkIdBatch,
|
|
1342
|
-
(row) => ({
|
|
1343
|
-
linkId: getString(row, "link_id"),
|
|
1344
|
-
sentenceId: [
|
|
1345
|
-
getNumber(row, "chapter_id"),
|
|
1346
|
-
getNumber(row, "sentence_index")
|
|
1347
|
-
]
|
|
1348
|
-
})
|
|
1349
|
-
);
|
|
1350
|
-
for (const row of rows) {
|
|
1351
|
-
const sentenceIds = sentenceIdsByLinkId.get(row.linkId) ?? [];
|
|
1352
|
-
sentenceIds.push(row.sentenceId);
|
|
1353
|
-
sentenceIdsByLinkId.set(row.linkId, sentenceIds);
|
|
1354
|
-
}
|
|
1355
|
-
}
|
|
1356
|
-
return records.map((record) => ({
|
|
1357
|
-
...record,
|
|
1358
|
-
evidenceSentenceIds: sentenceIdsByLinkId.get(record.id) ?? []
|
|
1359
|
-
}));
|
|
1360
|
-
}
|
|
1361
|
-
async #hydrateEvidence(record) {
|
|
1362
|
-
const evidenceSentenceIds = await this.#database.queryAll(
|
|
1363
|
-
`
|
|
1364
|
-
SELECT chapter_id, sentence_index
|
|
1365
|
-
FROM mention_link_evidence_sentences
|
|
1366
|
-
WHERE link_id = ?
|
|
1367
|
-
ORDER BY chapter_id, sentence_index
|
|
1368
|
-
`,
|
|
1369
|
-
[record.id],
|
|
1370
|
-
(row) => [
|
|
1371
|
-
getNumber(row, "chapter_id"),
|
|
1372
|
-
getNumber(row, "sentence_index")
|
|
1373
|
-
]
|
|
1374
|
-
);
|
|
1375
|
-
return {
|
|
1376
|
-
...record,
|
|
1377
|
-
evidenceSentenceIds
|
|
1378
|
-
};
|
|
1379
|
-
}
|
|
1380
|
-
}
|
|
1381
|
-
function chunkArray(items, size) {
|
|
1382
|
-
const chunks = [];
|
|
1383
|
-
for (let index = 0; index < items.length; index += size) {
|
|
1384
|
-
chunks.push(items.slice(index, index + size));
|
|
1385
|
-
}
|
|
1386
|
-
return chunks;
|
|
1387
|
-
}
|
|
1388
|
-
class SnakeChunkStore {
|
|
1389
|
-
#database;
|
|
1390
|
-
constructor(database) {
|
|
1391
|
-
this.#database = database;
|
|
1392
|
-
}
|
|
1393
|
-
async save(record) {
|
|
1394
|
-
await this.#database.run(
|
|
1395
|
-
`
|
|
1396
|
-
INSERT OR REPLACE INTO snake_chunks (snake_id, chunk_id, position)
|
|
1397
|
-
VALUES (?, ?, ?)
|
|
1398
|
-
`,
|
|
1399
|
-
[record.snakeId, record.chunkId, record.position]
|
|
1400
|
-
);
|
|
1401
|
-
}
|
|
1402
|
-
async listChunkIds(snakeId) {
|
|
1403
|
-
return await this.#database.queryAll(
|
|
1404
|
-
`
|
|
1405
|
-
SELECT chunk_id
|
|
1406
|
-
FROM snake_chunks
|
|
1407
|
-
WHERE snake_id = ?
|
|
1408
|
-
ORDER BY position
|
|
1409
|
-
`,
|
|
1410
|
-
[snakeId],
|
|
1411
|
-
(row) => getNumber(row, "chunk_id")
|
|
1412
|
-
);
|
|
1413
|
-
}
|
|
1414
|
-
async listBySnake(snakeId) {
|
|
1415
|
-
return await this.#database.queryAll(
|
|
1416
|
-
`
|
|
1417
|
-
SELECT snake_id, chunk_id, position
|
|
1418
|
-
FROM snake_chunks
|
|
1419
|
-
WHERE snake_id = ?
|
|
1420
|
-
ORDER BY position
|
|
1421
|
-
`,
|
|
1422
|
-
[snakeId],
|
|
1423
|
-
(row) => ({
|
|
1424
|
-
chunkId: getNumber(row, "chunk_id"),
|
|
1425
|
-
position: getNumber(row, "position"),
|
|
1426
|
-
snakeId: getNumber(row, "snake_id")
|
|
1427
|
-
})
|
|
1428
|
-
);
|
|
1429
|
-
}
|
|
1430
|
-
}
|
|
1431
|
-
class SnakeEdgeStore {
|
|
1432
|
-
#database;
|
|
1433
|
-
constructor(database) {
|
|
1434
|
-
this.#database = database;
|
|
1435
|
-
}
|
|
1436
|
-
async save(record) {
|
|
1437
|
-
await this.#database.run(
|
|
1438
|
-
`
|
|
1439
|
-
INSERT OR REPLACE INTO snake_edges (from_snake_id, to_snake_id, weight)
|
|
1440
|
-
VALUES (?, ?, ?)
|
|
1441
|
-
`,
|
|
1442
|
-
[record.fromSnakeId, record.toSnakeId, record.weight]
|
|
1443
|
-
);
|
|
1444
|
-
}
|
|
1445
|
-
async listIncoming(snakeId) {
|
|
1446
|
-
return await this.#listByDirection("to_snake_id", snakeId);
|
|
1447
|
-
}
|
|
1448
|
-
async listOutgoing(snakeId) {
|
|
1449
|
-
return await this.#listByDirection("from_snake_id", snakeId);
|
|
1450
|
-
}
|
|
1451
|
-
async listWithin(snakeIds) {
|
|
1452
|
-
if (snakeIds.length === 0) {
|
|
1453
|
-
return [];
|
|
1454
|
-
}
|
|
1455
|
-
const placeholders = snakeIds.map(() => "?").join(", ");
|
|
1456
|
-
return await this.#database.queryAll(
|
|
1457
|
-
`
|
|
1458
|
-
SELECT from_snake_id, to_snake_id, weight
|
|
1459
|
-
FROM snake_edges
|
|
1460
|
-
WHERE from_snake_id IN (${placeholders})
|
|
1461
|
-
AND to_snake_id IN (${placeholders})
|
|
1462
|
-
ORDER BY from_snake_id, to_snake_id
|
|
1463
|
-
`,
|
|
1464
|
-
[...snakeIds, ...snakeIds],
|
|
1465
|
-
(row) => ({
|
|
1466
|
-
fromSnakeId: getNumber(row, "from_snake_id"),
|
|
1467
|
-
toSnakeId: getNumber(row, "to_snake_id"),
|
|
1468
|
-
weight: getNumber(row, "weight")
|
|
1469
|
-
})
|
|
1470
|
-
);
|
|
1471
|
-
}
|
|
1472
|
-
async listBySerial(serialId) {
|
|
1473
|
-
return await this.#database.queryAll(
|
|
1474
|
-
`
|
|
1475
|
-
SELECT
|
|
1476
|
-
snake_edges.from_snake_id AS from_snake_id,
|
|
1477
|
-
snake_edges.to_snake_id AS to_snake_id,
|
|
1478
|
-
snake_edges.weight AS weight
|
|
1479
|
-
FROM snake_edges
|
|
1480
|
-
INNER JOIN snakes AS from_snakes
|
|
1481
|
-
ON from_snakes.id = snake_edges.from_snake_id
|
|
1482
|
-
INNER JOIN snakes AS to_snakes
|
|
1483
|
-
ON to_snakes.id = snake_edges.to_snake_id
|
|
1484
|
-
WHERE from_snakes.serial_id = ? AND to_snakes.serial_id = ?
|
|
1485
|
-
ORDER BY snake_edges.from_snake_id, snake_edges.to_snake_id
|
|
1486
|
-
`,
|
|
1487
|
-
[serialId, serialId],
|
|
1488
|
-
(row) => ({
|
|
1489
|
-
fromSnakeId: getNumber(row, "from_snake_id"),
|
|
1490
|
-
toSnakeId: getNumber(row, "to_snake_id"),
|
|
1491
|
-
weight: getNumber(row, "weight")
|
|
1492
|
-
})
|
|
1493
|
-
);
|
|
1494
|
-
}
|
|
1495
|
-
async #listByDirection(column, snakeId) {
|
|
1496
|
-
return await this.#database.queryAll(
|
|
1497
|
-
`
|
|
1498
|
-
SELECT from_snake_id, to_snake_id, weight
|
|
1499
|
-
FROM snake_edges
|
|
1500
|
-
WHERE ${column} = ?
|
|
1501
|
-
ORDER BY from_snake_id, to_snake_id
|
|
1502
|
-
`,
|
|
1503
|
-
[snakeId],
|
|
1504
|
-
(row) => ({
|
|
1505
|
-
fromSnakeId: getNumber(row, "from_snake_id"),
|
|
1506
|
-
toSnakeId: getNumber(row, "to_snake_id"),
|
|
1507
|
-
weight: getNumber(row, "weight")
|
|
1508
|
-
})
|
|
1509
|
-
);
|
|
1510
|
-
}
|
|
1511
|
-
}
|
|
1512
|
-
class FragmentGroupStore {
|
|
1513
|
-
#database;
|
|
1514
|
-
constructor(database) {
|
|
1515
|
-
this.#database = database;
|
|
1516
|
-
}
|
|
1517
|
-
async save(record) {
|
|
1518
|
-
await this.#database.run(
|
|
1519
|
-
`
|
|
1520
|
-
INSERT OR REPLACE INTO sentence_groups (
|
|
1521
|
-
serial_id,
|
|
1522
|
-
group_id,
|
|
1523
|
-
start_sentence_index,
|
|
1524
|
-
end_sentence_index
|
|
1525
|
-
)
|
|
1526
|
-
VALUES (?, ?, ?, ?)
|
|
1527
|
-
`,
|
|
1528
|
-
[
|
|
1529
|
-
record.serialId,
|
|
1530
|
-
record.groupId,
|
|
1531
|
-
record.startSentenceIndex,
|
|
1532
|
-
record.endSentenceIndex
|
|
1533
|
-
]
|
|
1534
|
-
);
|
|
1535
|
-
}
|
|
1536
|
-
async saveMany(records) {
|
|
1537
|
-
await this.#database.transaction(async () => {
|
|
1538
|
-
for (const record of records) {
|
|
1539
|
-
await this.save(record);
|
|
1540
|
-
}
|
|
1541
|
-
});
|
|
1542
|
-
}
|
|
1543
|
-
async listBySerial(serialId) {
|
|
1544
|
-
return await this.#database.queryAll(
|
|
1545
|
-
`
|
|
1546
|
-
SELECT serial_id, group_id, start_sentence_index, end_sentence_index
|
|
1547
|
-
FROM sentence_groups
|
|
1548
|
-
WHERE serial_id = ?
|
|
1549
|
-
ORDER BY group_id, start_sentence_index
|
|
1550
|
-
`,
|
|
1551
|
-
[serialId],
|
|
1552
|
-
(row) => ({
|
|
1553
|
-
serialId: getNumber(row, "serial_id"),
|
|
1554
|
-
groupId: getNumber(row, "group_id"),
|
|
1555
|
-
startSentenceIndex: getNumber(row, "start_sentence_index"),
|
|
1556
|
-
endSentenceIndex: getNumber(row, "end_sentence_index")
|
|
1557
|
-
})
|
|
1558
|
-
);
|
|
1559
|
-
}
|
|
1560
|
-
async listSerialIds() {
|
|
1561
|
-
return await this.#database.queryAll(
|
|
1562
|
-
`
|
|
1563
|
-
SELECT DISTINCT serial_id
|
|
1564
|
-
FROM sentence_groups
|
|
1565
|
-
ORDER BY serial_id
|
|
1566
|
-
`,
|
|
1567
|
-
void 0,
|
|
1568
|
-
(row) => getNumber(row, "serial_id")
|
|
1569
|
-
);
|
|
1570
|
-
}
|
|
1571
|
-
async listGroupIdsForSerial(serialId) {
|
|
1572
|
-
return await this.#database.queryAll(
|
|
1573
|
-
`
|
|
1574
|
-
SELECT DISTINCT group_id
|
|
1575
|
-
FROM sentence_groups
|
|
1576
|
-
WHERE serial_id = ?
|
|
1577
|
-
ORDER BY group_id
|
|
1578
|
-
`,
|
|
1579
|
-
[serialId],
|
|
1580
|
-
(row) => getNumber(row, "group_id")
|
|
1581
|
-
);
|
|
1582
|
-
}
|
|
1583
|
-
}
|
|
1584
|
-
function mapReadingEdgeRow(row) {
|
|
1585
|
-
const strength = getOptionalString(row, "strength");
|
|
1586
|
-
return {
|
|
1587
|
-
fromId: getNumber(row, "from_id"),
|
|
1588
|
-
toId: getNumber(row, "to_id"),
|
|
1589
|
-
weight: getNumber(row, "weight"),
|
|
1590
|
-
...strength === void 0 ? {} : { strength }
|
|
1591
|
-
};
|
|
1592
|
-
}
|
|
1593
|
-
function mapMentionRow(row) {
|
|
1594
|
-
const sentenceIndex = getOptionalNumber(row, "sentence_index");
|
|
1595
|
-
const confidence = getOptionalNumber(row, "confidence");
|
|
1596
|
-
const note = getOptionalString(row, "note");
|
|
1597
|
-
return {
|
|
1598
|
-
chapterId: getNumber(row, "chapter_id"),
|
|
1599
|
-
...confidence === void 0 ? {} : { confidence },
|
|
1600
|
-
id: getString(row, "id"),
|
|
1601
|
-
...note === void 0 ? {} : { note },
|
|
1602
|
-
qid: getString(row, "qid"),
|
|
1603
|
-
rangeEnd: getNumber(row, "range_end"),
|
|
1604
|
-
rangeStart: getNumber(row, "range_start"),
|
|
1605
|
-
...sentenceIndex === void 0 ? {} : { sentenceIndex },
|
|
1606
|
-
surface: getString(row, "surface")
|
|
1607
|
-
};
|
|
1608
|
-
}
|
|
1609
|
-
function deduplicateById(records) {
|
|
1610
|
-
const seen = /* @__PURE__ */ new Set();
|
|
1611
|
-
const result = [];
|
|
1612
|
-
for (const record of records) {
|
|
1613
|
-
if (seen.has(record.id)) {
|
|
1614
|
-
continue;
|
|
1615
|
-
}
|
|
1616
|
-
seen.add(record.id);
|
|
1617
|
-
result.push(record);
|
|
1618
|
-
}
|
|
1619
|
-
return result;
|
|
1620
|
-
}
|
|
1621
|
-
function mapMentionLinkRow(row) {
|
|
1622
|
-
const confidence = getOptionalNumber(row, "confidence");
|
|
1623
|
-
const note = getOptionalString(row, "note");
|
|
1624
|
-
return {
|
|
1625
|
-
...confidence === void 0 ? {} : { confidence },
|
|
1626
|
-
evidenceSentenceIds: [],
|
|
1627
|
-
id: getString(row, "id"),
|
|
1628
|
-
...note === void 0 ? {} : { note },
|
|
1629
|
-
predicate: getString(row, "predicate"),
|
|
1630
|
-
sourceMentionId: getString(row, "source_mention_id"),
|
|
1631
|
-
targetMentionId: getString(row, "target_mention_id")
|
|
1632
|
-
};
|
|
1633
|
-
}
|
|
1634
|
-
function parseMetadataValue(valueJson) {
|
|
1635
|
-
try {
|
|
1636
|
-
return JSON.parse(valueJson);
|
|
1637
|
-
} catch (error) {
|
|
1638
|
-
throw new Error(
|
|
1639
|
-
`Invalid object metadata JSON: ${formatUnknownError(error)}`
|
|
1640
|
-
);
|
|
1641
|
-
}
|
|
1642
|
-
}
|
|
1643
|
-
function getOptionalNumber(row, key) {
|
|
1644
|
-
const value = row[key];
|
|
1645
|
-
if (value === null || value === void 0) {
|
|
1646
|
-
return void 0;
|
|
1647
|
-
}
|
|
1648
|
-
if (typeof value !== "number") {
|
|
1649
|
-
throw new TypeError(`Expected ${key} to be a number`);
|
|
1650
|
-
}
|
|
1651
|
-
return value;
|
|
1652
|
-
}
|
|
1653
|
-
function formatUnknownError(error) {
|
|
1654
|
-
return error instanceof Error ? error.message : String(error);
|
|
1655
|
-
}
|
|
1656
|
-
function escapeLikePattern(value) {
|
|
1657
|
-
return value.replace(/[\\%_]/gu, (character) => `\\${character}`);
|
|
1658
|
-
}
|
|
1659
|
-
function parseChunkImportance(value) {
|
|
1660
|
-
return value !== void 0 && isChunkImportance(value) ? value : void 0;
|
|
1661
|
-
}
|
|
1662
|
-
function parseChunkRetention(value) {
|
|
1663
|
-
return value !== void 0 && isChunkRetention(value) ? value : void 0;
|
|
1664
|
-
}
|
|
1665
|
-
export {
|
|
1666
|
-
ChunkStore,
|
|
1667
|
-
FragmentGroupStore,
|
|
1668
|
-
GraphBuildParameterStore,
|
|
1669
|
-
MentionLinkStore,
|
|
1670
|
-
MentionStore,
|
|
1671
|
-
ObjectMetadataStore,
|
|
1672
|
-
ReadingEdgeStore,
|
|
1673
|
-
SerialStore,
|
|
1674
|
-
SnakeChunkStore,
|
|
1675
|
-
SnakeEdgeStore,
|
|
1676
|
-
SnakeStore
|
|
1677
|
-
};
|
|
1678
|
-
//# sourceMappingURL=stores.js.map
|