wiki-graph-core 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/data/editor/clue_reviewer.jinja +410 -0
- package/data/editor/clue_reviewer_generator.jinja +428 -0
- package/data/editor/revision_feedback.jinja +5 -0
- package/data/editor/text_compressor.jinja +127 -0
- package/data/guaranteed/response_intent_classifier.jinja +8 -0
- package/data/help/commands/archive/next.jinja +29 -0
- package/data/help/commands/gc.jinja +38 -0
- package/data/help/commands/legacy/migrate.jinja +20 -0
- package/data/help/commands/legacy.jinja +19 -0
- package/data/help/commands/maintenance/chapter/add.jinja +41 -0
- package/data/help/commands/maintenance/chapter/list.jinja +33 -0
- package/data/help/commands/maintenance/chapter/move.jinja +36 -0
- package/data/help/commands/maintenance/chapter/remove.jinja +26 -0
- package/data/help/commands/maintenance/chapter/reset.jinja +29 -0
- package/data/help/commands/maintenance/chapter/set-source.jinja +34 -0
- package/data/help/commands/maintenance/chapter/set-summary.jinja +31 -0
- package/data/help/commands/maintenance/chapter/set-title.jinja +29 -0
- package/data/help/commands/maintenance/chapter/tree.jinja +58 -0
- package/data/help/commands/maintenance/chapter.jinja +59 -0
- package/data/help/commands/maintenance/cover.jinja +28 -0
- package/data/help/commands/maintenance/meta.jinja +55 -0
- package/data/help/commands/predicate.jinja +460 -0
- package/data/help/commands/root.jinja +83 -0
- package/data/help/commands/transform.jinja +34 -0
- package/data/help/commands/uri.jinja +274 -0
- package/data/help/topics/config.jinja +88 -0
- package/data/help/topics/format.jinja +72 -0
- package/data/help/topics/readiness.jinja +99 -0
- package/data/help/topics/recipe.jinja +151 -0
- package/data/help/topics/runtime.jinja +62 -0
- package/data/help/topics/uri.jinja +178 -0
- package/data/output/epub/cover.xhtml.jinja +13 -0
- package/data/output/epub/nav.xhtml.jinja +12 -0
- package/data/output/epub/package.opf.xml.jinja +39 -0
- package/data/output/epub/section.xhtml.jinja +12 -0
- package/data/topologization/book_coherence_extraction.jinja +223 -0
- package/data/topologization/chunk_extraction.jinja +233 -0
- package/data/topologization/evidence_choice.jinja +38 -0
- package/data/topologization/translate_chunks.jinja +138 -0
- package/data/topologization/user_focused_extraction.jinja +378 -0
- package/dist/archive/query/archive-view.d.ts +26 -0
- package/dist/archive/query/archive-view.js +4540 -0
- package/dist/archive/query/archive-view.js.map +1 -0
- package/dist/archive/query/continuation-cursor.d.ts +61 -0
- package/dist/archive/query/continuation-cursor.js +363 -0
- package/dist/archive/query/continuation-cursor.js.map +1 -0
- package/dist/archive/query/index.d.ts +29 -0
- package/dist/archive/query/index.js +63 -0
- package/dist/archive/query/index.js.map +1 -0
- package/dist/archive/query/lexical-search.d.ts +22 -0
- package/dist/archive/query/lexical-search.js +137 -0
- package/dist/archive/query/lexical-search.js.map +1 -0
- package/dist/archive/query/search-cache.d.ts +192 -0
- package/dist/archive/query/search-cache.js +1248 -0
- package/dist/archive/query/search-cache.js.map +1 -0
- package/dist/archive/search-index/index.d.ts +26 -0
- package/dist/archive/search-index/index.js +29 -0
- package/dist/archive/search-index/index.js.map +1 -0
- package/dist/archive/search-index/search-index.d.ts +26 -0
- package/dist/archive/search-index/search-index.js +555 -0
- package/dist/archive/search-index/search-index.js.map +1 -0
- package/dist/archive/search-index/search-tokenizer.d.ts +16 -0
- package/dist/archive/search-index/search-tokenizer.js +225 -0
- package/dist/archive/search-index/search-tokenizer.js.map +1 -0
- package/dist/common/cli-command.d.ts +4 -0
- package/dist/common/cli-command.js +7 -0
- package/dist/common/cli-command.js.map +1 -0
- package/dist/common/data-dir.d.ts +3 -0
- package/dist/common/data-dir.js +48 -0
- package/dist/common/data-dir.js.map +1 -0
- package/dist/common/language.d.ts +55 -0
- package/dist/common/language.js +208 -0
- package/dist/common/language.js.map +1 -0
- package/dist/common/llm-scope.d.ts +19 -0
- package/dist/common/llm-scope.js +31 -0
- package/dist/common/llm-scope.js.map +1 -0
- package/dist/common/logging.d.ts +22 -0
- package/dist/common/logging.js +141 -0
- package/dist/common/logging.js.map +1 -0
- package/dist/common/template.d.ts +8 -0
- package/dist/common/template.js +54 -0
- package/dist/common/template.js.map +1 -0
- package/dist/common/tinyld-language.d.ts +6 -0
- package/dist/common/tinyld-language.js +34 -0
- package/dist/common/tinyld-language.js.map +1 -0
- package/dist/common/wiki-graph-dir.d.ts +10 -0
- package/dist/common/wiki-graph-dir.js +41 -0
- package/dist/common/wiki-graph-dir.js.map +1 -0
- package/dist/common/wiki-graph-temp.d.ts +6 -0
- package/dist/common/wiki-graph-temp.js +21 -0
- package/dist/common/wiki-graph-temp.js.map +1 -0
- package/dist/common/wiki-graph-uri.d.ts +28 -0
- package/dist/common/wiki-graph-uri.js +171 -0
- package/dist/common/wiki-graph-uri.js.map +1 -0
- package/dist/context/index.d.ts +1 -0
- package/dist/context/index.js +13 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context/task-context.d.ts +41 -0
- package/dist/context/task-context.js +111 -0
- package/dist/context/task-context.js.map +1 -0
- package/dist/document/database.d.ts +30 -0
- package/dist/document/database.js +273 -0
- package/dist/document/database.js.map +1 -0
- package/dist/document/document.d.ts +153 -0
- package/dist/document/document.js +615 -0
- package/dist/document/document.js.map +1 -0
- package/dist/document/fragments.d.ts +63 -0
- package/dist/document/fragments.js +371 -0
- package/dist/document/fragments.js.map +1 -0
- package/dist/document/index.d.ts +13 -0
- package/dist/document/index.js +62 -0
- package/dist/document/index.js.map +1 -0
- package/dist/document/schema.d.ts +8 -0
- package/dist/document/schema.js +472 -0
- package/dist/document/schema.js.map +1 -0
- package/dist/document/shared-state-database.d.ts +9 -0
- package/dist/document/shared-state-database.js +193 -0
- package/dist/document/shared-state-database.js.map +1 -0
- package/dist/document/stores.d.ts +203 -0
- package/dist/document/stores.js +1678 -0
- package/dist/document/stores.js.map +1 -0
- package/dist/document/text-streams.d.ts +86 -0
- package/dist/document/text-streams.js +515 -0
- package/dist/document/text-streams.js.map +1 -0
- package/dist/document/types.d.ts +148 -0
- package/dist/document/types.js +69 -0
- package/dist/document/types.js.map +1 -0
- package/dist/editor/clue.d.ts +27 -0
- package/dist/editor/clue.js +158 -0
- package/dist/editor/clue.js.map +1 -0
- package/dist/editor/compressor.d.ts +18 -0
- package/dist/editor/compressor.js +68 -0
- package/dist/editor/compressor.js.map +1 -0
- package/dist/editor/editor.d.ts +39 -0
- package/dist/editor/editor.js +253 -0
- package/dist/editor/editor.js.map +1 -0
- package/dist/editor/feedback.d.ts +16 -0
- package/dist/editor/feedback.js +104 -0
- package/dist/editor/feedback.js.map +1 -0
- package/dist/editor/index.d.ts +17 -0
- package/dist/editor/index.js +5 -0
- package/dist/editor/index.js.map +1 -0
- package/dist/editor/language-review.d.ts +14 -0
- package/dist/editor/language-review.js +35 -0
- package/dist/editor/language-review.js.map +1 -0
- package/dist/editor/log.d.ts +37 -0
- package/dist/editor/log.js +202 -0
- package/dist/editor/log.js.map +1 -0
- package/dist/editor/markup.d.ts +20 -0
- package/dist/editor/markup.js +294 -0
- package/dist/editor/markup.js.map +1 -0
- package/dist/editor/prompt-templates.d.ts +6 -0
- package/dist/editor/prompt-templates.js +11 -0
- package/dist/editor/prompt-templates.js.map +1 -0
- package/dist/editor/response.d.ts +5 -0
- package/dist/editor/response.js +31 -0
- package/dist/editor/response.js.map +1 -0
- package/dist/editor/review.d.ts +34 -0
- package/dist/editor/review.js +189 -0
- package/dist/editor/review.js.map +1 -0
- package/dist/editor/types.d.ts +31 -0
- package/dist/editor/types.js +21 -0
- package/dist/editor/types.js.map +1 -0
- package/dist/evidence-selection/anchor-resolver.d.ts +43 -0
- package/dist/evidence-selection/anchor-resolver.js +783 -0
- package/dist/evidence-selection/anchor-resolver.js.map +1 -0
- package/dist/evidence-selection/anchor-types.d.ts +27 -0
- package/dist/evidence-selection/anchor-types.js +1 -0
- package/dist/evidence-selection/anchor-types.js.map +1 -0
- package/dist/evidence-selection/index.d.ts +8 -0
- package/dist/evidence-selection/index.js +32 -0
- package/dist/evidence-selection/index.js.map +1 -0
- package/dist/evidence-selection/prompt.d.ts +18 -0
- package/dist/evidence-selection/prompt.js +54 -0
- package/dist/evidence-selection/prompt.js.map +1 -0
- package/dist/evidence-selection/quote-score.d.ts +29 -0
- package/dist/evidence-selection/quote-score.js +331 -0
- package/dist/evidence-selection/quote-score.js.map +1 -0
- package/dist/evidence-selection/selection-resolver.d.ts +19 -0
- package/dist/evidence-selection/selection-resolver.js +303 -0
- package/dist/evidence-selection/selection-resolver.js.map +1 -0
- package/dist/evidence-selection/text.d.ts +4 -0
- package/dist/evidence-selection/text.js +66 -0
- package/dist/evidence-selection/text.js.map +1 -0
- package/dist/evidence-selection/types.d.ts +36 -0
- package/dist/evidence-selection/types.js +1 -0
- package/dist/evidence-selection/types.js.map +1 -0
- package/dist/facade/app.d.ts +75 -0
- package/dist/facade/app.js +141 -0
- package/dist/facade/app.js.map +1 -0
- package/dist/facade/build-queue.d.ts +181 -0
- package/dist/facade/build-queue.js +1442 -0
- package/dist/facade/build-queue.js.map +1 -0
- package/dist/facade/chapter-build.d.ts +60 -0
- package/dist/facade/chapter-build.js +1020 -0
- package/dist/facade/chapter-build.js.map +1 -0
- package/dist/facade/chapter.d.ts +168 -0
- package/dist/facade/chapter.js +944 -0
- package/dist/facade/chapter.js.map +1 -0
- package/dist/facade/digest.d.ts +55 -0
- package/dist/facade/digest.js +168 -0
- package/dist/facade/digest.js.map +1 -0
- package/dist/facade/graph.d.ts +60 -0
- package/dist/facade/graph.js +203 -0
- package/dist/facade/graph.js.map +1 -0
- package/dist/facade/import.d.ts +49 -0
- package/dist/facade/import.js +262 -0
- package/dist/facade/import.js.map +1 -0
- package/dist/facade/index.d.ts +39 -0
- package/dist/facade/index.js +171 -0
- package/dist/facade/index.js.map +1 -0
- package/dist/facade/knowledge-graph-build.d.ts +75 -0
- package/dist/facade/knowledge-graph-build.js +897 -0
- package/dist/facade/knowledge-graph-build.js.map +1 -0
- package/dist/facade/llm-sampling.d.ts +11 -0
- package/dist/facade/llm-sampling.js +58 -0
- package/dist/facade/llm-sampling.js.map +1 -0
- package/dist/facade/types.d.ts +8 -0
- package/dist/facade/types.js +1 -0
- package/dist/facade/types.js.map +1 -0
- package/dist/facade/wiki-graph-archive.d.ts +41 -0
- package/dist/facade/wiki-graph-archive.js +130 -0
- package/dist/facade/wiki-graph-archive.js.map +1 -0
- package/dist/gc/files.d.ts +15 -0
- package/dist/gc/files.js +141 -0
- package/dist/gc/files.js.map +1 -0
- package/dist/gc/index.d.ts +2 -0
- package/dist/gc/index.js +5 -0
- package/dist/gc/index.js.map +1 -0
- package/dist/gc/lock.d.ts +3 -0
- package/dist/gc/lock.js +137 -0
- package/dist/gc/lock.js.map +1 -0
- package/dist/gc/runner.d.ts +9 -0
- package/dist/gc/runner.js +129 -0
- package/dist/gc/runner.js.map +1 -0
- package/dist/gc/tmp-gc.d.ts +5 -0
- package/dist/gc/tmp-gc.js +57 -0
- package/dist/gc/tmp-gc.js.map +1 -0
- package/dist/gc/types.d.ts +24 -0
- package/dist/gc/types.js +1 -0
- package/dist/gc/types.js.map +1 -0
- package/dist/gc.cjs +10041 -0
- package/dist/gc.cjs.map +1 -0
- package/dist/gc.d.cts +10 -0
- package/dist/gc.d.ts +2 -0
- package/dist/gc.js +5 -0
- package/dist/gc.js.map +1 -0
- package/dist/guaranteed/classifier.d.ts +10 -0
- package/dist/guaranteed/classifier.js +88 -0
- package/dist/guaranteed/classifier.js.map +1 -0
- package/dist/guaranteed/errors.d.ts +38 -0
- package/dist/guaranteed/errors.js +73 -0
- package/dist/guaranteed/errors.js.map +1 -0
- package/dist/guaranteed/index.d.ts +7 -0
- package/dist/guaranteed/index.js +21 -0
- package/dist/guaranteed/index.js.map +1 -0
- package/dist/guaranteed/request.d.ts +8 -0
- package/dist/guaranteed/request.js +206 -0
- package/dist/guaranteed/request.js.map +1 -0
- package/dist/guaranteed/response.d.ts +12 -0
- package/dist/guaranteed/response.js +98 -0
- package/dist/guaranteed/response.js.map +1 -0
- package/dist/guaranteed/types.d.ts +20 -0
- package/dist/guaranteed/types.js +1 -0
- package/dist/guaranteed/types.js.map +1 -0
- package/dist/index-B8NNnQ8P.d.ts +424 -0
- package/dist/index.cjs +34774 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2462 -0
- package/dist/index.d.ts +79 -0
- package/dist/index.js +168 -0
- package/dist/index.js.map +1 -0
- package/dist/legacy-sdpub/upgrade.d.ts +7 -0
- package/dist/legacy-sdpub/upgrade.js +795 -0
- package/dist/legacy-sdpub/upgrade.js.map +1 -0
- package/dist/llm/cache.d.ts +13 -0
- package/dist/llm/cache.js +35 -0
- package/dist/llm/cache.js.map +1 -0
- package/dist/llm/client.d.ts +26 -0
- package/dist/llm/client.js +572 -0
- package/dist/llm/client.js.map +1 -0
- package/dist/llm/context.d.ts +22 -0
- package/dist/llm/context.js +78 -0
- package/dist/llm/context.js.map +1 -0
- package/dist/llm/errors.d.ts +7 -0
- package/dist/llm/errors.js +12 -0
- package/dist/llm/errors.js.map +1 -0
- package/dist/llm/index.d.ts +7 -0
- package/dist/llm/index.js +17 -0
- package/dist/llm/index.js.map +1 -0
- package/dist/llm/request-log.d.ts +9 -0
- package/dist/llm/request-log.js +35 -0
- package/dist/llm/request-log.js.map +1 -0
- package/dist/llm/sampling.d.ts +11 -0
- package/dist/llm/sampling.js +67 -0
- package/dist/llm/sampling.js.map +1 -0
- package/dist/llm/types.d.ts +50 -0
- package/dist/llm/types.js +1 -0
- package/dist/llm/types.js.map +1 -0
- package/dist/output/epub/archive.d.ts +9 -0
- package/dist/output/epub/archive.js +81 -0
- package/dist/output/epub/archive.js.map +1 -0
- package/dist/output/epub/book.d.ts +15 -0
- package/dist/output/epub/book.js +76 -0
- package/dist/output/epub/book.js.map +1 -0
- package/dist/output/epub/content.d.ts +9 -0
- package/dist/output/epub/content.js +35 -0
- package/dist/output/epub/content.js.map +1 -0
- package/dist/output/epub/index.d.ts +20 -0
- package/dist/output/epub/index.js +14 -0
- package/dist/output/epub/index.js.map +1 -0
- package/dist/output/epub/model.d.ts +24 -0
- package/dist/output/epub/model.js +1 -0
- package/dist/output/epub/model.js.map +1 -0
- package/dist/output/epub/navigation.d.ts +10 -0
- package/dist/output/epub/navigation.js +39 -0
- package/dist/output/epub/navigation.js.map +1 -0
- package/dist/output/epub/package.d.ts +17 -0
- package/dist/output/epub/package.js +29 -0
- package/dist/output/epub/package.js.map +1 -0
- package/dist/output/epub/shared.d.ts +4 -0
- package/dist/output/epub/shared.js +12 -0
- package/dist/output/epub/shared.js.map +1 -0
- package/dist/output/epub/templates.d.ts +35 -0
- package/dist/output/epub/templates.js +26 -0
- package/dist/output/epub/templates.js.map +1 -0
- package/dist/output/index.d.ts +14 -0
- package/dist/output/index.js +11 -0
- package/dist/output/index.js.map +1 -0
- package/dist/output/plain-text.d.ts +18 -0
- package/dist/output/plain-text.js +56 -0
- package/dist/output/plain-text.js.map +1 -0
- package/dist/progress/index.d.ts +3 -0
- package/dist/progress/index.js +14 -0
- package/dist/progress/index.js.map +1 -0
- package/dist/progress/reporter.d.ts +10 -0
- package/dist/progress/reporter.js +79 -0
- package/dist/progress/reporter.js.map +1 -0
- package/dist/progress/tracker.d.ts +37 -0
- package/dist/progress/tracker.js +119 -0
- package/dist/progress/tracker.js.map +1 -0
- package/dist/progress/types.d.ts +28 -0
- package/dist/progress/types.js +1 -0
- package/dist/progress/types.js.map +1 -0
- package/dist/reader/attention/attention.d.ts +39 -0
- package/dist/reader/attention/attention.js +123 -0
- package/dist/reader/attention/attention.js.map +1 -0
- package/dist/reader/attention/index.d.ts +9 -0
- package/dist/reader/attention/index.js +5 -0
- package/dist/reader/attention/index.js.map +1 -0
- package/dist/reader/attention/wave-reflection.d.ts +21 -0
- package/dist/reader/attention/wave-reflection.js +153 -0
- package/dist/reader/attention/wave-reflection.js.map +1 -0
- package/dist/reader/attention/working-memory.d.ts +28 -0
- package/dist/reader/attention/working-memory.js +62 -0
- package/dist/reader/attention/working-memory.js.map +1 -0
- package/dist/reader/chunk-batch/extract.d.ts +13 -0
- package/dist/reader/chunk-batch/extract.js +14 -0
- package/dist/reader/chunk-batch/extract.js.map +1 -0
- package/dist/reader/chunk-batch/extractor.d.ts +17 -0
- package/dist/reader/chunk-batch/extractor.js +337 -0
- package/dist/reader/chunk-batch/extractor.js.map +1 -0
- package/dist/reader/chunk-batch/fragment-projection.d.ts +34 -0
- package/dist/reader/chunk-batch/fragment-projection.js +94 -0
- package/dist/reader/chunk-batch/fragment-projection.js.map +1 -0
- package/dist/reader/chunk-batch/index.d.ts +12 -0
- package/dist/reader/chunk-batch/index.js +13 -0
- package/dist/reader/chunk-batch/index.js.map +1 -0
- package/dist/reader/chunk-batch/language.d.ts +9 -0
- package/dist/reader/chunk-batch/language.js +23 -0
- package/dist/reader/chunk-batch/language.js.map +1 -0
- package/dist/reader/chunk-batch/parser.d.ts +94 -0
- package/dist/reader/chunk-batch/parser.js +640 -0
- package/dist/reader/chunk-batch/parser.js.map +1 -0
- package/dist/reader/chunk-batch/prompt-templates.d.ts +6 -0
- package/dist/reader/chunk-batch/prompt-templates.js +11 -0
- package/dist/reader/chunk-batch/prompt-templates.js.map +1 -0
- package/dist/reader/chunk-batch/types.d.ts +85 -0
- package/dist/reader/chunk-batch/types.js +1 -0
- package/dist/reader/chunk-batch/types.js.map +1 -0
- package/dist/reader/index.d.ts +13 -0
- package/dist/reader/index.js +7 -0
- package/dist/reader/index.js.map +1 -0
- package/dist/reader/reader.d.ts +37 -0
- package/dist/reader/reader.js +82 -0
- package/dist/reader/reader.js.map +1 -0
- package/dist/reader/segment/index.d.ts +2 -0
- package/dist/reader/segment/index.js +5 -0
- package/dist/reader/segment/index.js.map +1 -0
- package/dist/reader/segment/intl-segmenter.d.ts +5 -0
- package/dist/reader/segment/intl-segmenter.js +102 -0
- package/dist/reader/segment/intl-segmenter.js.map +1 -0
- package/dist/reader/segment/segment.d.ts +5 -0
- package/dist/reader/segment/segment.js +9 -0
- package/dist/reader/segment/segment.js.map +1 -0
- package/dist/reader/segment/types.d.ts +14 -0
- package/dist/reader/segment/types.js +1 -0
- package/dist/reader/segment/types.js.map +1 -0
- package/dist/reader/types.d.ts +29 -0
- package/dist/reader/types.js +1 -0
- package/dist/reader/types.js.map +1 -0
- package/dist/serial.d.ts +89 -0
- package/dist/serial.js +476 -0
- package/dist/serial.js.map +1 -0
- package/dist/source/adapter.d.ts +15 -0
- package/dist/source/adapter.js +1 -0
- package/dist/source/adapter.js.map +1 -0
- package/dist/source/epub/archive.d.ts +27 -0
- package/dist/source/epub/archive.js +189 -0
- package/dist/source/epub/archive.js.map +1 -0
- package/dist/source/epub/content.d.ts +22 -0
- package/dist/source/epub/content.js +183 -0
- package/dist/source/epub/content.js.map +1 -0
- package/dist/source/epub/document.d.ts +55 -0
- package/dist/source/epub/document.js +179 -0
- package/dist/source/epub/document.js.map +1 -0
- package/dist/source/epub/index.d.ts +10 -0
- package/dist/source/epub/index.js +6 -0
- package/dist/source/epub/index.js.map +1 -0
- package/dist/source/epub/navigation.d.ts +16 -0
- package/dist/source/epub/navigation.js +215 -0
- package/dist/source/epub/navigation.js.map +1 -0
- package/dist/source/epub/package.d.ts +33 -0
- package/dist/source/epub/package.js +237 -0
- package/dist/source/epub/package.js.map +1 -0
- package/dist/source/epub/xml.d.ts +16 -0
- package/dist/source/epub/xml.js +111 -0
- package/dist/source/epub/xml.js.map +1 -0
- package/dist/source/index.d.ts +12 -0
- package/dist/source/index.js +32 -0
- package/dist/source/index.js.map +1 -0
- package/dist/source/meta.d.ts +30 -0
- package/dist/source/meta.js +22 -0
- package/dist/source/meta.js.map +1 -0
- package/dist/source/plain-text.d.ts +16 -0
- package/dist/source/plain-text.js +86 -0
- package/dist/source/plain-text.js.map +1 -0
- package/dist/source/toc.d.ts +16 -0
- package/dist/source/toc.js +17 -0
- package/dist/source/toc.js.map +1 -0
- package/dist/source/types.d.ts +16 -0
- package/dist/source/types.js +1 -0
- package/dist/source/types.js.map +1 -0
- package/dist/topology/grouping.d.ts +15 -0
- package/dist/topology/grouping.js +18 -0
- package/dist/topology/grouping.js.map +1 -0
- package/dist/topology/index.d.ts +21 -0
- package/dist/topology/index.js +5 -0
- package/dist/topology/index.js.map +1 -0
- package/dist/topology/resource-segmentation.d.ts +13 -0
- package/dist/topology/resource-segmentation.js +111 -0
- package/dist/topology/resource-segmentation.js.map +1 -0
- package/dist/topology/segment-incision.d.ts +18 -0
- package/dist/topology/segment-incision.js +197 -0
- package/dist/topology/segment-incision.js.map +1 -0
- package/dist/topology/snake-detector.d.ts +13 -0
- package/dist/topology/snake-detector.js +520 -0
- package/dist/topology/snake-detector.js.map +1 -0
- package/dist/topology/snake-graph-builder.d.ts +14 -0
- package/dist/topology/snake-graph-builder.js +76 -0
- package/dist/topology/snake-graph-builder.js.map +1 -0
- package/dist/topology/topology.d.ts +29 -0
- package/dist/topology/topology.js +348 -0
- package/dist/topology/topology.js.map +1 -0
- package/dist/topology/weights.d.ts +10 -0
- package/dist/topology/weights.js +84 -0
- package/dist/topology/weights.js.map +1 -0
- package/dist/types-FVIqiLC9.d.cts +24 -0
- package/dist/utils/async-semaphore.d.ts +7 -0
- package/dist/utils/async-semaphore.js +40 -0
- package/dist/utils/async-semaphore.js.map +1 -0
- package/dist/utils/enum.d.ts +5 -0
- package/dist/utils/enum.js +18 -0
- package/dist/utils/enum.js.map +1 -0
- package/dist/utils/hash.d.ts +3 -0
- package/dist/utils/hash.js +132 -0
- package/dist/utils/hash.js.map +1 -0
- package/dist/utils/node-error.d.ts +4 -0
- package/dist/utils/node-error.js +59 -0
- package/dist/utils/node-error.js.map +1 -0
- package/dist/wikg/archive-uri.d.ts +1 -0
- package/dist/wikg/archive-uri.js +37 -0
- package/dist/wikg/archive-uri.js.map +1 -0
- package/dist/wikg/archive.d.ts +28 -0
- package/dist/wikg/archive.js +496 -0
- package/dist/wikg/archive.js.map +1 -0
- package/dist/wikg/index.d.ts +31 -0
- package/dist/wikg/index.js +60 -0
- package/dist/wikg/index.js.map +1 -0
- package/dist/wikg/wikg-coordinator.d.ts +45 -0
- package/dist/wikg/wikg-coordinator.js +1687 -0
- package/dist/wikg/wikg-coordinator.js.map +1 -0
- package/dist/wikg/wiki-graph-archive-file.d.ts +42 -0
- package/dist/wikg/wiki-graph-archive-file.js +78 -0
- package/dist/wikg/wiki-graph-archive-file.js.map +1 -0
- package/dist/wikilink/index.d.ts +10 -0
- package/dist/wikilink/index.js +7 -0
- package/dist/wikilink/index.js.map +1 -0
- package/dist/wikilink/relation-discovery.d.ts +31 -0
- package/dist/wikilink/relation-discovery.js +477 -0
- package/dist/wikilink/relation-discovery.js.map +1 -0
- package/dist/wikilink/types.d.ts +23 -0
- package/dist/wikilink/types.js +1 -0
- package/dist/wikilink/types.js.map +1 -0
- package/dist/wikilink/window.d.ts +7 -0
- package/dist/wikilink/window.js +53 -0
- package/dist/wikilink/window.js.map +1 -0
- package/dist/wikimatch/enrichment.d.ts +10 -0
- package/dist/wikimatch/enrichment.js +55 -0
- package/dist/wikimatch/enrichment.js.map +1 -0
- package/dist/wikimatch/index.d.ts +16 -0
- package/dist/wikimatch/index.js +66 -0
- package/dist/wikimatch/index.js.map +1 -0
- package/dist/wikimatch/option-narrowing.d.ts +17 -0
- package/dist/wikimatch/option-narrowing.js +208 -0
- package/dist/wikimatch/option-narrowing.js.map +1 -0
- package/dist/wikimatch/options.d.ts +14 -0
- package/dist/wikimatch/options.js +155 -0
- package/dist/wikimatch/options.js.map +1 -0
- package/dist/wikimatch/policy-judge.d.ts +17 -0
- package/dist/wikimatch/policy-judge.js +430 -0
- package/dist/wikimatch/policy-judge.js.map +1 -0
- package/dist/wikimatch/range-suppression.d.ts +9 -0
- package/dist/wikimatch/range-suppression.js +27 -0
- package/dist/wikimatch/range-suppression.js.map +1 -0
- package/dist/wikimatch/surface-screening.d.ts +16 -0
- package/dist/wikimatch/surface-screening.js +168 -0
- package/dist/wikimatch/surface-screening.js.map +1 -0
- package/dist/wikimatch/surface-window.d.ts +6 -0
- package/dist/wikimatch/surface-window.js +44 -0
- package/dist/wikimatch/surface-window.js.map +1 -0
- package/dist/wikimatch/types.d.ts +151 -0
- package/dist/wikimatch/types.js +1 -0
- package/dist/wikimatch/types.js.map +1 -0
- package/dist/wikimatch/wikispine.d.ts +43 -0
- package/dist/wikimatch/wikispine.js +399 -0
- package/dist/wikimatch/wikispine.js.map +1 -0
- package/dist/wikimatch/window.d.ts +6 -0
- package/dist/wikimatch/window.js +83 -0
- package/dist/wikimatch/window.js.map +1 -0
- package/dist/wikimatch/words.d.ts +16 -0
- package/dist/wikimatch/words.js +66 -0
- package/dist/wikimatch/words.js.map +1 -0
- package/dist/wikipage/cache.d.ts +18 -0
- package/dist/wikipage/cache.js +404 -0
- package/dist/wikipage/cache.js.map +1 -0
- package/dist/wikipage/fetch-log.d.ts +17 -0
- package/dist/wikipage/fetch-log.js +143 -0
- package/dist/wikipage/fetch-log.js.map +1 -0
- package/dist/wikipage/index.d.ts +14 -0
- package/dist/wikipage/index.js +17 -0
- package/dist/wikipage/index.js.map +1 -0
- package/dist/wikipage/normalizer.d.ts +14 -0
- package/dist/wikipage/normalizer.js +147 -0
- package/dist/wikipage/normalizer.js.map +1 -0
- package/dist/wikipage/rate-limiter.d.ts +13 -0
- package/dist/wikipage/rate-limiter.js +84 -0
- package/dist/wikipage/rate-limiter.js.map +1 -0
- package/dist/wikipage/resolver.d.ts +26 -0
- package/dist/wikipage/resolver.js +325 -0
- package/dist/wikipage/resolver.js.map +1 -0
- package/dist/wikipage/types.d.ts +96 -0
- package/dist/wikipage/types.js +1 -0
- package/dist/wikipage/types.js.map +1 -0
- package/dist/wikipage/wikimedia-client.d.ts +48 -0
- package/dist/wikipage/wikimedia-client.js +397 -0
- package/dist/wikipage/wikimedia-client.js.map +1 -0
- package/dist/worker-BgQ0Xl8T.d.cts +181 -0
- package/dist/worker.cjs +5259 -0
- package/dist/worker.cjs.map +1 -0
- package/dist/worker.d.cts +2 -0
- package/dist/worker.d.ts +2 -0
- package/dist/worker.js +5 -0
- package/dist/worker.js.map +1 -0
- package/package.json +78 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import {
|
|
3
|
+
ParsedJsonError,
|
|
4
|
+
RESPONSE_INTENT_CLASSIFIER_PROMPT_TEMPLATE,
|
|
5
|
+
requestGuaranteedJson
|
|
6
|
+
} from "../guaranteed/index.js";
|
|
7
|
+
const protectedSurfaceSchema = z.object({
|
|
8
|
+
note: z.string().max(24).optional(),
|
|
9
|
+
surfaceId: z.string().min(1)
|
|
10
|
+
}).strict();
|
|
11
|
+
const protectionResponseSchema = z.object({
|
|
12
|
+
protectedSurfaces: z.array(protectedSurfaceSchema)
|
|
13
|
+
}).strict();
|
|
14
|
+
async function judgeWikimatchSurfaceProtection(options) {
|
|
15
|
+
if (options.suspiciousSurfaces.length === 0) {
|
|
16
|
+
return { protectedSurfaces: [] };
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
return await requestGuaranteedJson({
|
|
20
|
+
messages: buildProtectionMessages(options),
|
|
21
|
+
parse: (response) => parseSurfaceProtectionResponse(
|
|
22
|
+
options.suspiciousSurfaces,
|
|
23
|
+
normalizeProtectionResponse(response)
|
|
24
|
+
),
|
|
25
|
+
request: options.request,
|
|
26
|
+
responseIntentClassifierPrompt: RESPONSE_INTENT_CLASSIFIER_PROMPT_TEMPLATE,
|
|
27
|
+
schema: protectionResponseSchema,
|
|
28
|
+
...options.maxRetries === void 0 ? {} : { maxRetries: options.maxRetries }
|
|
29
|
+
});
|
|
30
|
+
} catch (error) {
|
|
31
|
+
return {
|
|
32
|
+
fallback: {
|
|
33
|
+
issues: [formatFallbackIssue(error)],
|
|
34
|
+
reason: "guaranteed_json_failed"
|
|
35
|
+
},
|
|
36
|
+
protectedSurfaces: []
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function normalizeProtectionResponse(response) {
|
|
41
|
+
return {
|
|
42
|
+
protectedSurfaces: response.protectedSurfaces.map((surface) => ({
|
|
43
|
+
...surface.note === void 0 ? {} : { note: surface.note },
|
|
44
|
+
surfaceId: surface.surfaceId
|
|
45
|
+
}))
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function parseSurfaceProtectionResponse(surfaces, response) {
|
|
49
|
+
const issues = validateSurfaceProtectionResponse(surfaces, response);
|
|
50
|
+
if (issues.length > 0) {
|
|
51
|
+
throw new ParsedJsonError(issues);
|
|
52
|
+
}
|
|
53
|
+
const surfacesById = createSurfaceMap(surfaces);
|
|
54
|
+
const protectedSurfaces = [];
|
|
55
|
+
for (const surface of response.protectedSurfaces) {
|
|
56
|
+
const source = surfacesById.get(surface.surfaceId);
|
|
57
|
+
protectedSurfaces.push({
|
|
58
|
+
...surface.note === void 0 ? {} : { note: surface.note },
|
|
59
|
+
surfaceId: surface.surfaceId,
|
|
60
|
+
text: source.text
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return { protectedSurfaces };
|
|
64
|
+
}
|
|
65
|
+
function validateSurfaceProtectionResponse(surfaces, response) {
|
|
66
|
+
const issues = [];
|
|
67
|
+
const surfacesById = createSurfaceMap(surfaces);
|
|
68
|
+
const seenIds = /* @__PURE__ */ new Set();
|
|
69
|
+
for (const surface of response.protectedSurfaces) {
|
|
70
|
+
if (!surfacesById.has(surface.surfaceId)) {
|
|
71
|
+
issues.push(
|
|
72
|
+
`Unknown surfaceId "${surface.surfaceId}". Use only these surface IDs: ${[
|
|
73
|
+
...surfacesById.keys()
|
|
74
|
+
].join(", ")}.`
|
|
75
|
+
);
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (seenIds.has(surface.surfaceId)) {
|
|
79
|
+
issues.push(`Duplicate protected surface ${surface.surfaceId}.`);
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
seenIds.add(surface.surfaceId);
|
|
83
|
+
}
|
|
84
|
+
return issues;
|
|
85
|
+
}
|
|
86
|
+
function buildProtectionMessages(input) {
|
|
87
|
+
return [
|
|
88
|
+
{
|
|
89
|
+
role: "system",
|
|
90
|
+
content: formatProtectionSystemPrompt(input)
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
role: "user",
|
|
94
|
+
content: formatProtectionPrompt(input)
|
|
95
|
+
}
|
|
96
|
+
];
|
|
97
|
+
}
|
|
98
|
+
function formatProtectionSystemPrompt(input) {
|
|
99
|
+
return [
|
|
100
|
+
"You protect useful high-frequency surface strings before Wikidata grounding.",
|
|
101
|
+
"",
|
|
102
|
+
"The input surfaces are suspicious only because they are frequent after range suppression.",
|
|
103
|
+
"Most high-frequency function words, fragments, punctuation, generic words, and discourse words should NOT be protected.",
|
|
104
|
+
"A surface that is not protected will be removed before grounding.",
|
|
105
|
+
"",
|
|
106
|
+
"User recall policy:",
|
|
107
|
+
input.policyPrompt,
|
|
108
|
+
"",
|
|
109
|
+
"Protect a surface only when it is likely to be a meaningful entity, named concept, named event, place, person, organization, work, or domain term under the policy.",
|
|
110
|
+
"",
|
|
111
|
+
"Rules:",
|
|
112
|
+
"- Return JSON only.",
|
|
113
|
+
"- Return only protected surface IDs.",
|
|
114
|
+
"- Do not return a result for every input surface.",
|
|
115
|
+
"- Do not protect generic grammar words merely because they appear often.",
|
|
116
|
+
"- Do not infer or choose Wikidata QIDs in this stage."
|
|
117
|
+
].join("\n");
|
|
118
|
+
}
|
|
119
|
+
function formatProtectionPrompt(input) {
|
|
120
|
+
return [
|
|
121
|
+
"Suspicious high-frequency surfaces:",
|
|
122
|
+
JSON.stringify(
|
|
123
|
+
input.suspiciousSurfaces.map((surface) => ({
|
|
124
|
+
count: surface.count,
|
|
125
|
+
surfaceId: surface.id,
|
|
126
|
+
text: surface.text
|
|
127
|
+
})),
|
|
128
|
+
null,
|
|
129
|
+
2
|
|
130
|
+
),
|
|
131
|
+
"",
|
|
132
|
+
"Return this JSON shape:",
|
|
133
|
+
JSON.stringify(
|
|
134
|
+
{
|
|
135
|
+
protectedSurfaces: [
|
|
136
|
+
{
|
|
137
|
+
note: "optional, <= 12 Chinese chars or 6 English words",
|
|
138
|
+
surfaceId: "surface id from the input"
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
null,
|
|
143
|
+
2
|
|
144
|
+
)
|
|
145
|
+
].join("\n");
|
|
146
|
+
}
|
|
147
|
+
function createSurfaceMap(surfaces) {
|
|
148
|
+
return new Map(surfaces.map((surface) => [surface.id, surface]));
|
|
149
|
+
}
|
|
150
|
+
function formatFallbackIssue(error) {
|
|
151
|
+
if (error instanceof ParsedJsonError) {
|
|
152
|
+
return error.issues.join("\n");
|
|
153
|
+
}
|
|
154
|
+
if (error instanceof Error) {
|
|
155
|
+
const issues = error.issues;
|
|
156
|
+
if (Array.isArray(issues) && issues.every((issue) => typeof issue === "string")) {
|
|
157
|
+
return issues.join("\n");
|
|
158
|
+
}
|
|
159
|
+
return error.message;
|
|
160
|
+
}
|
|
161
|
+
return String(error);
|
|
162
|
+
}
|
|
163
|
+
export {
|
|
164
|
+
judgeWikimatchSurfaceProtection,
|
|
165
|
+
parseSurfaceProtectionResponse,
|
|
166
|
+
validateSurfaceProtectionResponse
|
|
167
|
+
};
|
|
168
|
+
//# sourceMappingURL=surface-screening.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/wikimatch/surface-screening.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport {\n ParsedJsonError,\n RESPONSE_INTENT_CLASSIFIER_PROMPT_TEMPLATE,\n requestGuaranteedJson,\n type GuaranteedRequest,\n} from \"../guaranteed/index.js\";\nimport type { LLMessage } from \"../llm/index.js\";\n\nimport type {\n WikimatchProtectedSurface,\n WikimatchSurface,\n WikimatchSurfaceProtectionInput,\n WikimatchSurfaceProtectionResponse,\n WikimatchSurfaceProtectionResult,\n} from \"./types.js\";\n\nconst protectedSurfaceSchema = z\n .object({\n note: z.string().max(24).optional(),\n surfaceId: z.string().min(1),\n })\n .strict();\n\nconst protectionResponseSchema = z\n .object({\n protectedSurfaces: z.array(protectedSurfaceSchema),\n })\n .strict();\n\nexport interface JudgeWikimatchSurfaceProtectionOptions extends WikimatchSurfaceProtectionInput {\n readonly maxRetries?: number;\n readonly request: GuaranteedRequest;\n}\n\nexport async function judgeWikimatchSurfaceProtection(\n options: JudgeWikimatchSurfaceProtectionOptions,\n): Promise<WikimatchSurfaceProtectionResult> {\n if (options.suspiciousSurfaces.length === 0) {\n return { protectedSurfaces: [] };\n }\n\n try {\n return await requestGuaranteedJson({\n messages: buildProtectionMessages(options),\n parse: (response) =>\n parseSurfaceProtectionResponse(\n options.suspiciousSurfaces,\n normalizeProtectionResponse(response),\n ),\n request: options.request,\n responseIntentClassifierPrompt:\n RESPONSE_INTENT_CLASSIFIER_PROMPT_TEMPLATE,\n schema: protectionResponseSchema,\n ...(options.maxRetries === undefined\n ? {}\n : { maxRetries: options.maxRetries }),\n });\n } catch (error) {\n return {\n fallback: {\n issues: [formatFallbackIssue(error)],\n reason: \"guaranteed_json_failed\",\n },\n protectedSurfaces: [],\n };\n }\n}\n\nfunction normalizeProtectionResponse(\n response: z.infer<typeof protectionResponseSchema>,\n): WikimatchSurfaceProtectionResponse {\n return {\n protectedSurfaces: response.protectedSurfaces.map((surface) => ({\n ...(surface.note === undefined ? {} : { note: surface.note }),\n surfaceId: surface.surfaceId,\n })),\n };\n}\n\nexport function parseSurfaceProtectionResponse(\n surfaces: readonly WikimatchSurface[],\n response: WikimatchSurfaceProtectionResponse,\n): WikimatchSurfaceProtectionResult {\n const issues = validateSurfaceProtectionResponse(surfaces, response);\n\n if (issues.length > 0) {\n throw new ParsedJsonError(issues);\n }\n\n const surfacesById = createSurfaceMap(surfaces);\n const protectedSurfaces: WikimatchProtectedSurface[] = [];\n\n for (const surface of response.protectedSurfaces) {\n const source = surfacesById.get(surface.surfaceId)!;\n\n protectedSurfaces.push({\n ...(surface.note === undefined ? {} : { note: surface.note }),\n surfaceId: surface.surfaceId,\n text: source.text,\n });\n }\n\n return { protectedSurfaces };\n}\n\nexport function validateSurfaceProtectionResponse(\n surfaces: readonly WikimatchSurface[],\n response: WikimatchSurfaceProtectionResponse,\n): readonly string[] {\n const issues: string[] = [];\n const surfacesById = createSurfaceMap(surfaces);\n const seenIds = new Set<string>();\n\n for (const surface of response.protectedSurfaces) {\n if (!surfacesById.has(surface.surfaceId)) {\n issues.push(\n `Unknown surfaceId \"${surface.surfaceId}\". Use only these surface IDs: ${[\n ...surfacesById.keys(),\n ].join(\", \")}.`,\n );\n continue;\n }\n if (seenIds.has(surface.surfaceId)) {\n issues.push(`Duplicate protected surface ${surface.surfaceId}.`);\n continue;\n }\n\n seenIds.add(surface.surfaceId);\n }\n\n return issues;\n}\n\nfunction buildProtectionMessages(\n input: WikimatchSurfaceProtectionInput,\n): LLMessage[] {\n return [\n {\n role: \"system\",\n content: formatProtectionSystemPrompt(input),\n },\n {\n role: \"user\",\n content: formatProtectionPrompt(input),\n },\n ];\n}\n\nfunction formatProtectionSystemPrompt(\n input: WikimatchSurfaceProtectionInput,\n): string {\n return [\n \"You protect useful high-frequency surface strings before Wikidata grounding.\",\n \"\",\n \"The input surfaces are suspicious only because they are frequent after range suppression.\",\n \"Most high-frequency function words, fragments, punctuation, generic words, and discourse words should NOT be protected.\",\n \"A surface that is not protected will be removed before grounding.\",\n \"\",\n \"User recall policy:\",\n input.policyPrompt,\n \"\",\n \"Protect a surface only when it is likely to be a meaningful entity, named concept, named event, place, person, organization, work, or domain term under the policy.\",\n \"\",\n \"Rules:\",\n \"- Return JSON only.\",\n \"- Return only protected surface IDs.\",\n \"- Do not return a result for every input surface.\",\n \"- Do not protect generic grammar words merely because they appear often.\",\n \"- Do not infer or choose Wikidata QIDs in this stage.\",\n ].join(\"\\n\");\n}\n\nfunction formatProtectionPrompt(\n input: WikimatchSurfaceProtectionInput,\n): string {\n return [\n \"Suspicious high-frequency surfaces:\",\n JSON.stringify(\n input.suspiciousSurfaces.map((surface) => ({\n count: surface.count,\n surfaceId: surface.id,\n text: surface.text,\n })),\n null,\n 2,\n ),\n \"\",\n \"Return this JSON shape:\",\n JSON.stringify(\n {\n protectedSurfaces: [\n {\n note: \"optional, <= 12 Chinese chars or 6 English words\",\n surfaceId: \"surface id from the input\",\n },\n ],\n },\n null,\n 2,\n ),\n ].join(\"\\n\");\n}\n\nfunction createSurfaceMap(\n surfaces: readonly WikimatchSurface[],\n): ReadonlyMap<string, WikimatchSurface> {\n return new Map(surfaces.map((surface) => [surface.id, surface]));\n}\n\nfunction formatFallbackIssue(error: unknown): string {\n if (error instanceof ParsedJsonError) {\n return error.issues.join(\"\\n\");\n }\n if (error instanceof Error) {\n const issues = (error as { readonly issues?: unknown }).issues;\n\n if (\n Array.isArray(issues) &&\n issues.every((issue) => typeof issue === \"string\")\n ) {\n return issues.join(\"\\n\");\n }\n\n return error.message;\n }\n\n return String(error);\n}\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BuildWikimatchSurfaceProtectionInputOptions, WikimatchSurfaceProtectionBuildResult } from './types.js';
|
|
2
|
+
import '../wikipage/types.js';
|
|
3
|
+
|
|
4
|
+
declare function buildWikimatchSurfaceProtectionInput(options: BuildWikimatchSurfaceProtectionInputOptions): WikimatchSurfaceProtectionBuildResult;
|
|
5
|
+
|
|
6
|
+
export { buildWikimatchSurfaceProtectionInput };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { suppressContainedRanges } from "./range-suppression.js";
|
|
2
|
+
function buildWikimatchSurfaceProtectionInput(options) {
|
|
3
|
+
const suppressedCandidates = suppressContainedRanges(options.candidates);
|
|
4
|
+
const surfaces = listSurfaces(suppressedCandidates, options.text);
|
|
5
|
+
const suspiciousSurfaces = selectTopSurfaces(surfaces, options.percentile);
|
|
6
|
+
const suspiciousTexts = new Set(
|
|
7
|
+
suspiciousSurfaces.map((surface) => surface.text)
|
|
8
|
+
);
|
|
9
|
+
return {
|
|
10
|
+
candidates: suppressedCandidates.filter(
|
|
11
|
+
(candidate) => !suspiciousTexts.has(
|
|
12
|
+
options.text.slice(candidate.range.start, candidate.range.end)
|
|
13
|
+
)
|
|
14
|
+
),
|
|
15
|
+
suppressedCandidates,
|
|
16
|
+
suspiciousSurfaces
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function listSurfaces(candidates, text) {
|
|
20
|
+
const surfaces = /* @__PURE__ */ new Map();
|
|
21
|
+
for (const candidate of candidates) {
|
|
22
|
+
const surface = text.slice(candidate.range.start, candidate.range.end);
|
|
23
|
+
surfaces.set(surface, (surfaces.get(surface) ?? 0) + 1);
|
|
24
|
+
}
|
|
25
|
+
return [...surfaces.entries()].map(([surface, count], index) => ({
|
|
26
|
+
count,
|
|
27
|
+
id: `s${index + 1}`,
|
|
28
|
+
text: surface
|
|
29
|
+
})).sort(compareSurface);
|
|
30
|
+
}
|
|
31
|
+
function selectTopSurfaces(surfaces, percentile) {
|
|
32
|
+
if (surfaces.length === 0 || percentile <= 0) {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
const count = Math.ceil(surfaces.length * Math.min(1, percentile));
|
|
36
|
+
return surfaces.slice(0, count);
|
|
37
|
+
}
|
|
38
|
+
function compareSurface(left, right) {
|
|
39
|
+
return right.count - left.count || left.text.localeCompare(right.text) || left.id.localeCompare(right.id);
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
buildWikimatchSurfaceProtectionInput
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=surface-window.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/wikimatch/surface-window.ts"],"sourcesContent":["import type {\n BuildWikimatchSurfaceProtectionInputOptions,\n WikimatchCandidate,\n WikimatchSurface,\n WikimatchSurfaceProtectionBuildResult,\n} from \"./types.js\";\nimport { suppressContainedRanges } from \"./range-suppression.js\";\n\nexport function buildWikimatchSurfaceProtectionInput(\n options: BuildWikimatchSurfaceProtectionInputOptions,\n): WikimatchSurfaceProtectionBuildResult {\n const suppressedCandidates = suppressContainedRanges(options.candidates);\n const surfaces = listSurfaces(suppressedCandidates, options.text);\n const suspiciousSurfaces = selectTopSurfaces(surfaces, options.percentile);\n const suspiciousTexts = new Set(\n suspiciousSurfaces.map((surface) => surface.text),\n );\n\n return {\n candidates: suppressedCandidates.filter(\n (candidate) =>\n !suspiciousTexts.has(\n options.text.slice(candidate.range.start, candidate.range.end),\n ),\n ),\n suppressedCandidates,\n suspiciousSurfaces,\n };\n}\n\nfunction listSurfaces(\n candidates: readonly WikimatchCandidate[],\n text: string,\n): readonly WikimatchSurface[] {\n const surfaces = new Map<string, number>();\n\n for (const candidate of candidates) {\n const surface = text.slice(candidate.range.start, candidate.range.end);\n\n surfaces.set(surface, (surfaces.get(surface) ?? 0) + 1);\n }\n\n return [...surfaces.entries()]\n .map(([surface, count], index) => ({\n count,\n id: `s${index + 1}`,\n text: surface,\n }))\n .sort(compareSurface);\n}\n\nfunction selectTopSurfaces(\n surfaces: readonly WikimatchSurface[],\n percentile: number,\n): readonly WikimatchSurface[] {\n if (surfaces.length === 0 || percentile <= 0) {\n return [];\n }\n\n const count = Math.ceil(surfaces.length * Math.min(1, percentile));\n\n return surfaces.slice(0, count);\n}\n\nfunction compareSurface(\n left: WikimatchSurface,\n right: WikimatchSurface,\n): number {\n return (\n right.count - left.count ||\n left.text.localeCompare(right.text) ||\n left.id.localeCompare(right.id)\n );\n}\n"],"mappings":"AAMA,SAAS,+BAA+B;AAEjC,SAAS,qCACd,SACuC;AACvC,QAAM,uBAAuB,wBAAwB,QAAQ,UAAU;AACvE,QAAM,WAAW,aAAa,sBAAsB,QAAQ,IAAI;AAChE,QAAM,qBAAqB,kBAAkB,UAAU,QAAQ,UAAU;AACzE,QAAM,kBAAkB,IAAI;AAAA,IAC1B,mBAAmB,IAAI,CAAC,YAAY,QAAQ,IAAI;AAAA,EAClD;AAEA,SAAO;AAAA,IACL,YAAY,qBAAqB;AAAA,MAC/B,CAAC,cACC,CAAC,gBAAgB;AAAA,QACf,QAAQ,KAAK,MAAM,UAAU,MAAM,OAAO,UAAU,MAAM,GAAG;AAAA,MAC/D;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEA,SAAS,aACP,YACA,MAC6B;AAC7B,QAAM,WAAW,oBAAI,IAAoB;AAEzC,aAAW,aAAa,YAAY;AAClC,UAAM,UAAU,KAAK,MAAM,UAAU,MAAM,OAAO,UAAU,MAAM,GAAG;AAErE,aAAS,IAAI,UAAU,SAAS,IAAI,OAAO,KAAK,KAAK,CAAC;AAAA,EACxD;AAEA,SAAO,CAAC,GAAG,SAAS,QAAQ,CAAC,EAC1B,IAAI,CAAC,CAAC,SAAS,KAAK,GAAG,WAAW;AAAA,IACjC;AAAA,IACA,IAAI,IAAI,QAAQ,CAAC;AAAA,IACjB,MAAM;AAAA,EACR,EAAE,EACD,KAAK,cAAc;AACxB;AAEA,SAAS,kBACP,UACA,YAC6B;AAC7B,MAAI,SAAS,WAAW,KAAK,cAAc,GAAG;AAC5C,WAAO,CAAC;AAAA,EACV;AAEA,QAAM,QAAQ,KAAK,KAAK,SAAS,SAAS,KAAK,IAAI,GAAG,UAAU,CAAC;AAEjE,SAAO,SAAS,MAAM,GAAG,KAAK;AAChC;AAEA,SAAS,eACP,MACA,OACQ;AACR,SACE,MAAM,QAAQ,KAAK,SACnB,KAAK,KAAK,cAAc,MAAM,IAAI,KAClC,KAAK,GAAG,cAAc,MAAM,EAAE;AAElC;","names":[]}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { DisambiguationExpansion } from '../wikipage/types.js';
|
|
2
|
+
|
|
3
|
+
interface WikimatchCandidate {
|
|
4
|
+
readonly hasMoreOptions?: boolean;
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly qidOptions: readonly WikimatchQidOption[];
|
|
7
|
+
readonly range: WikimatchTextRange;
|
|
8
|
+
readonly surface: string;
|
|
9
|
+
}
|
|
10
|
+
interface WikimatchSentence {
|
|
11
|
+
readonly id?: string;
|
|
12
|
+
readonly range: WikimatchTextRange;
|
|
13
|
+
readonly text: string;
|
|
14
|
+
}
|
|
15
|
+
interface WikimatchQidOption {
|
|
16
|
+
readonly description?: string;
|
|
17
|
+
readonly disambiguation?: DisambiguationExpansion;
|
|
18
|
+
readonly isDisambiguation?: boolean;
|
|
19
|
+
readonly label?: string;
|
|
20
|
+
readonly qid: string;
|
|
21
|
+
}
|
|
22
|
+
interface WikimatchTextRange {
|
|
23
|
+
readonly end: number;
|
|
24
|
+
readonly start: number;
|
|
25
|
+
}
|
|
26
|
+
interface WikimatchWindow {
|
|
27
|
+
readonly baseOffset: number;
|
|
28
|
+
readonly candidates: readonly WikimatchCandidate[];
|
|
29
|
+
readonly groups: readonly WikimatchConflictGroup[];
|
|
30
|
+
readonly text: string;
|
|
31
|
+
}
|
|
32
|
+
interface WikimatchSurface {
|
|
33
|
+
readonly id: string;
|
|
34
|
+
readonly count: number;
|
|
35
|
+
readonly text: string;
|
|
36
|
+
}
|
|
37
|
+
interface WikimatchConflictGroup {
|
|
38
|
+
readonly candidateIds: readonly string[];
|
|
39
|
+
readonly id: string;
|
|
40
|
+
readonly range: WikimatchTextRange;
|
|
41
|
+
}
|
|
42
|
+
interface BuildWikimatchWindowsOptions {
|
|
43
|
+
readonly candidates: readonly WikimatchCandidate[];
|
|
44
|
+
readonly contextWords: number;
|
|
45
|
+
readonly optionBudget: number;
|
|
46
|
+
readonly text: string;
|
|
47
|
+
}
|
|
48
|
+
interface NarrowWikimatchCandidateOptionsInput {
|
|
49
|
+
readonly candidate: WikimatchCandidate;
|
|
50
|
+
readonly policyPrompt: string;
|
|
51
|
+
readonly text: string;
|
|
52
|
+
}
|
|
53
|
+
interface WikimatchCandidateOptionNarrowingResult {
|
|
54
|
+
readonly candidate: WikimatchCandidate;
|
|
55
|
+
readonly fallback?: WikimatchCandidateOptionNarrowingFallback;
|
|
56
|
+
}
|
|
57
|
+
interface WikimatchCandidateOptionNarrowingFallback {
|
|
58
|
+
readonly issues: readonly string[];
|
|
59
|
+
readonly reason: "guaranteed_json_failed";
|
|
60
|
+
}
|
|
61
|
+
interface WikimatchCandidateOptionNarrowingResponse {
|
|
62
|
+
readonly qids: readonly WikimatchCandidateOptionNarrowingItemOutput[];
|
|
63
|
+
}
|
|
64
|
+
interface WikimatchCandidateOptionNarrowingItemOutput {
|
|
65
|
+
readonly decision: "keep" | "reject";
|
|
66
|
+
readonly qid: string;
|
|
67
|
+
}
|
|
68
|
+
interface BuildWikimatchSurfaceProtectionInputOptions {
|
|
69
|
+
readonly candidates: readonly WikimatchCandidate[];
|
|
70
|
+
readonly percentile: number;
|
|
71
|
+
readonly text: string;
|
|
72
|
+
}
|
|
73
|
+
interface WikimatchSurfaceProtectionInput {
|
|
74
|
+
readonly policyPrompt: string;
|
|
75
|
+
readonly suspiciousSurfaces: readonly WikimatchSurface[];
|
|
76
|
+
}
|
|
77
|
+
interface WikimatchSurfaceProtectionBuildResult {
|
|
78
|
+
readonly candidates: readonly WikimatchCandidate[];
|
|
79
|
+
readonly suppressedCandidates: readonly WikimatchCandidate[];
|
|
80
|
+
readonly suspiciousSurfaces: readonly WikimatchSurface[];
|
|
81
|
+
}
|
|
82
|
+
interface WikimatchSurfaceProtectionResult {
|
|
83
|
+
readonly fallback?: WikimatchSurfaceProtectionFallback;
|
|
84
|
+
readonly protectedSurfaces: readonly WikimatchProtectedSurface[];
|
|
85
|
+
}
|
|
86
|
+
interface WikimatchProtectedSurface {
|
|
87
|
+
readonly note?: string;
|
|
88
|
+
readonly surfaceId: string;
|
|
89
|
+
readonly text: string;
|
|
90
|
+
}
|
|
91
|
+
interface WikimatchSurfaceProtectionFallback {
|
|
92
|
+
readonly issues: readonly string[];
|
|
93
|
+
readonly reason: "guaranteed_json_failed";
|
|
94
|
+
}
|
|
95
|
+
interface WikimatchProtectedSurfaceOutput {
|
|
96
|
+
readonly note?: string;
|
|
97
|
+
readonly surfaceId: string;
|
|
98
|
+
}
|
|
99
|
+
interface WikimatchSurfaceProtectionResponse {
|
|
100
|
+
readonly protectedSurfaces: readonly WikimatchProtectedSurfaceOutput[];
|
|
101
|
+
}
|
|
102
|
+
type WikimatchPolicyDecision = "continue" | "never_recall" | "recall" | "skip_this_time";
|
|
103
|
+
interface WikimatchPolicyJudgeInput {
|
|
104
|
+
readonly candidates: readonly WikimatchCandidate[];
|
|
105
|
+
readonly policyPrompt: string;
|
|
106
|
+
readonly window: WikimatchWindow;
|
|
107
|
+
}
|
|
108
|
+
interface WikimatchPolicyJudgeResult {
|
|
109
|
+
readonly continuations: readonly WikimatchPolicyContinuation[];
|
|
110
|
+
readonly fallback?: WikimatchPolicyFallback;
|
|
111
|
+
readonly mentions: readonly WikimatchAcceptedMention[];
|
|
112
|
+
readonly policyUpdates: readonly WikimatchPolicyUpdate[];
|
|
113
|
+
}
|
|
114
|
+
interface WikimatchAcceptedMention {
|
|
115
|
+
readonly candidateId: string;
|
|
116
|
+
readonly confidence?: number;
|
|
117
|
+
readonly qid: string;
|
|
118
|
+
readonly range: WikimatchTextRange;
|
|
119
|
+
readonly note?: string;
|
|
120
|
+
readonly surface: string;
|
|
121
|
+
}
|
|
122
|
+
interface WikimatchPolicyUpdate {
|
|
123
|
+
readonly candidateId: string;
|
|
124
|
+
readonly decision: Exclude<WikimatchPolicyDecision, "recall" | "continue">;
|
|
125
|
+
readonly note?: string;
|
|
126
|
+
readonly qid?: string;
|
|
127
|
+
readonly surface: string;
|
|
128
|
+
}
|
|
129
|
+
interface WikimatchPolicyContinuation {
|
|
130
|
+
readonly candidateIds: readonly string[];
|
|
131
|
+
readonly groupId: string;
|
|
132
|
+
}
|
|
133
|
+
interface WikimatchPolicyFallback {
|
|
134
|
+
readonly issues: readonly string[];
|
|
135
|
+
readonly reason: "guaranteed_json_failed";
|
|
136
|
+
}
|
|
137
|
+
interface WikimatchPolicyDecisionOutput {
|
|
138
|
+
readonly candidateId: string;
|
|
139
|
+
readonly confidence?: number;
|
|
140
|
+
readonly decision: WikimatchPolicyDecision;
|
|
141
|
+
readonly qid?: string;
|
|
142
|
+
}
|
|
143
|
+
interface WikimatchPolicyGroupOutput {
|
|
144
|
+
readonly decisions: readonly WikimatchPolicyDecisionOutput[];
|
|
145
|
+
readonly groupId: string;
|
|
146
|
+
}
|
|
147
|
+
interface WikimatchPolicyResponse {
|
|
148
|
+
readonly groups: readonly WikimatchPolicyGroupOutput[];
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export type { BuildWikimatchSurfaceProtectionInputOptions, BuildWikimatchWindowsOptions, NarrowWikimatchCandidateOptionsInput, WikimatchAcceptedMention, WikimatchCandidate, WikimatchCandidateOptionNarrowingFallback, WikimatchCandidateOptionNarrowingItemOutput, WikimatchCandidateOptionNarrowingResponse, WikimatchCandidateOptionNarrowingResult, WikimatchConflictGroup, WikimatchPolicyContinuation, WikimatchPolicyDecision, WikimatchPolicyDecisionOutput, WikimatchPolicyFallback, WikimatchPolicyGroupOutput, WikimatchPolicyJudgeInput, WikimatchPolicyJudgeResult, WikimatchPolicyResponse, WikimatchPolicyUpdate, WikimatchProtectedSurface, WikimatchProtectedSurfaceOutput, WikimatchQidOption, WikimatchSentence, WikimatchSurface, WikimatchSurfaceProtectionBuildResult, WikimatchSurfaceProtectionFallback, WikimatchSurfaceProtectionInput, WikimatchSurfaceProtectionResponse, WikimatchSurfaceProtectionResult, WikimatchTextRange, WikimatchWindow };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { WikimatchSentence, WikimatchCandidate } from './types.js';
|
|
2
|
+
import '../wikipage/types.js';
|
|
3
|
+
|
|
4
|
+
interface MatchWikispineSentenceCandidatesOptions {
|
|
5
|
+
readonly command?: string;
|
|
6
|
+
readonly dataDir?: string;
|
|
7
|
+
readonly endpoint?: string;
|
|
8
|
+
readonly fetch?: typeof fetch;
|
|
9
|
+
readonly includeDisambiguation?: boolean;
|
|
10
|
+
readonly maxCandidatesPerSurface?: number;
|
|
11
|
+
readonly onProgress?: (progress: WikispineMatchProgress) => Promise<void> | void;
|
|
12
|
+
readonly provider?: WikispineProvider;
|
|
13
|
+
readonly sentences: readonly WikimatchSentence[];
|
|
14
|
+
}
|
|
15
|
+
type WikispineProvider = "cli" | "fetch";
|
|
16
|
+
interface WikispineMatchProgress {
|
|
17
|
+
readonly coveredRangeEnd: number;
|
|
18
|
+
}
|
|
19
|
+
interface TestWikispineRuntimeOptions {
|
|
20
|
+
readonly command?: string;
|
|
21
|
+
readonly dataDir?: string;
|
|
22
|
+
readonly endpoint?: string;
|
|
23
|
+
readonly fetch?: typeof fetch;
|
|
24
|
+
readonly provider?: WikispineProvider;
|
|
25
|
+
}
|
|
26
|
+
interface WikispineRuntimeTestResult {
|
|
27
|
+
readonly durationMs: number;
|
|
28
|
+
readonly metadata?: WikispineMetadata;
|
|
29
|
+
readonly ok: true;
|
|
30
|
+
readonly provider: WikispineProvider;
|
|
31
|
+
}
|
|
32
|
+
interface WikispineMetadata {
|
|
33
|
+
readonly automaton_shard_count: number;
|
|
34
|
+
readonly format: string;
|
|
35
|
+
readonly qid_count: number;
|
|
36
|
+
readonly surface_count: number;
|
|
37
|
+
readonly surface_normalization: string;
|
|
38
|
+
}
|
|
39
|
+
declare const DEFAULT_WIKISPINE_FETCH_ENDPOINT = "https://wikispi-service-cxbfjlteab.cn-hangzhou.fcapp.run";
|
|
40
|
+
declare function matchWikispineSentenceCandidates(options: MatchWikispineSentenceCandidatesOptions): Promise<readonly WikimatchCandidate[]>;
|
|
41
|
+
declare function testWikispineRuntime(options: TestWikispineRuntimeOptions): Promise<WikispineRuntimeTestResult>;
|
|
42
|
+
|
|
43
|
+
export { DEFAULT_WIKISPINE_FETCH_ENDPOINT, type MatchWikispineSentenceCandidatesOptions, type TestWikispineRuntimeOptions, type WikispineMatchProgress, type WikispineProvider, type WikispineRuntimeTestResult, matchWikispineSentenceCandidates, testWikispineRuntime };
|