dsh-data-domain-knowledge 0.1.0-alpha.9 → 0.1.1-alpha.2
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 +118 -567
- package/cordis.patch.yml +5 -418
- package/eval/README.md +19 -8
- package/eval/benchmark-extraction-format.mjs +20 -0
- package/eval/evaluate-retrieval.mjs +17 -8
- package/eval/queries.example.jsonl +1 -0
- package/lib/client.js +4181 -3239
- package/lib/contract-envelope.d.ts +91 -0
- package/lib/contract-envelope.js +106 -0
- package/lib/contract-layout.d.ts +130 -0
- package/lib/contract-layout.js +138 -0
- package/lib/contract-refs.d.ts +39 -0
- package/lib/contract-refs.js +9 -0
- package/lib/contract-version.d.ts +311 -0
- package/lib/contract-version.js +270 -0
- package/lib/contract-wire.d.ts +147 -0
- package/lib/contract-wire.js +99 -0
- package/lib/contracts.d.ts +12 -0
- package/lib/contracts.js +12 -0
- package/lib/doc-page.js +2 -2
- package/lib/pages.js +3329 -1296
- package/lib/types/agent-behavior-rules.d.ts +10 -0
- package/lib/types/agent-behavior-rules.d.ts.map +1 -0
- package/lib/types/agent-behavior-rules.js +28 -0
- package/lib/types/agent-behavior-rules.js.map +1 -0
- package/lib/types/axis-registry.d.ts +37 -5
- package/lib/types/axis-registry.d.ts.map +1 -1
- package/lib/types/axis-registry.js +234 -26
- package/lib/types/axis-registry.js.map +1 -1
- package/lib/types/card-organize.d.ts +27 -12
- package/lib/types/card-organize.d.ts.map +1 -1
- package/lib/types/card-organize.js +58 -73
- package/lib/types/card-organize.js.map +1 -1
- package/lib/types/compiler/embedding-identity.d.ts +3 -0
- package/lib/types/compiler/embedding-identity.d.ts.map +1 -0
- package/lib/types/compiler/embedding-identity.js +24 -0
- package/lib/types/compiler/embedding-identity.js.map +1 -0
- package/lib/types/compiler/snapshot.d.ts +16 -0
- package/lib/types/compiler/snapshot.d.ts.map +1 -0
- package/lib/types/compiler/snapshot.js +2 -0
- package/lib/types/compiler/snapshot.js.map +1 -0
- package/lib/types/config-schema.d.ts +6 -3
- package/lib/types/config-schema.d.ts.map +1 -1
- package/lib/types/config-schema.js +6 -2
- package/lib/types/config-schema.js.map +1 -1
- package/lib/types/convert/host.d.ts +6 -5
- package/lib/types/convert/host.d.ts.map +1 -1
- package/lib/types/convert/host.js +58 -18
- package/lib/types/convert/host.js.map +1 -1
- package/lib/types/convert/ingest.d.ts +10 -1
- package/lib/types/convert/ingest.d.ts.map +1 -1
- package/lib/types/convert/ingest.js +68 -9
- package/lib/types/convert/ingest.js.map +1 -1
- package/lib/types/derive-contract.d.ts +3 -0
- package/lib/types/derive-contract.d.ts.map +1 -0
- package/lib/types/derive-contract.js +15 -0
- package/lib/types/derive-contract.js.map +1 -0
- package/lib/types/diagnosis/cards.d.ts +7 -3
- package/lib/types/diagnosis/cards.d.ts.map +1 -1
- package/lib/types/diagnosis/cards.js +13 -8
- package/lib/types/diagnosis/cards.js.map +1 -1
- package/lib/types/diagnosis/run.d.ts +4 -13
- package/lib/types/diagnosis/run.d.ts.map +1 -1
- package/lib/types/diagnosis/run.js +26 -16
- package/lib/types/diagnosis/run.js.map +1 -1
- package/lib/types/diagnosis/schema.js +2 -2
- package/lib/types/diagnosis/schema.js.map +1 -1
- package/lib/types/diagnosis/seed-source.d.ts +1 -1
- package/lib/types/diagnosis/seed-source.d.ts.map +1 -1
- package/lib/types/diagnosis/seed-source.js +5 -4
- package/lib/types/diagnosis/seed-source.js.map +1 -1
- package/lib/types/diagnosis/seed.d.ts +4 -4
- package/lib/types/diagnosis/seed.d.ts.map +1 -1
- package/lib/types/diagnosis/seed.js +6 -8
- package/lib/types/diagnosis/seed.js.map +1 -1
- package/lib/types/diagnosis/store.d.ts +24 -18
- package/lib/types/diagnosis/store.d.ts.map +1 -1
- package/lib/types/diagnosis/store.js +130 -65
- package/lib/types/diagnosis/store.js.map +1 -1
- package/lib/types/diagnosis/types.d.ts +47 -15
- package/lib/types/diagnosis/types.d.ts.map +1 -1
- package/lib/types/diagnosis/types.js.map +1 -1
- package/lib/types/environment/dsh-python.d.ts +77 -0
- package/lib/types/environment/dsh-python.d.ts.map +1 -0
- package/lib/types/environment/dsh-python.js +139 -0
- package/lib/types/environment/dsh-python.js.map +1 -0
- package/lib/types/environment/install.d.ts +15 -0
- package/lib/types/environment/install.d.ts.map +1 -0
- package/lib/types/environment/install.js +297 -0
- package/lib/types/environment/install.js.map +1 -0
- package/lib/types/environment/manifest.d.ts +208 -0
- package/lib/types/environment/manifest.d.ts.map +1 -0
- package/lib/types/environment/manifest.js +26 -0
- package/lib/types/environment/manifest.js.map +1 -0
- package/lib/types/environment/model-catalog.d.ts +223 -0
- package/lib/types/environment/model-catalog.d.ts.map +1 -0
- package/lib/types/environment/model-catalog.js +129 -0
- package/lib/types/environment/model-catalog.js.map +1 -0
- package/lib/types/environment/process.d.ts +10 -0
- package/lib/types/environment/process.d.ts.map +1 -0
- package/lib/types/environment/process.js +54 -0
- package/lib/types/environment/process.js.map +1 -0
- package/lib/types/environment/selection.d.ts +9 -0
- package/lib/types/environment/selection.d.ts.map +1 -0
- package/lib/types/environment/selection.js +29 -0
- package/lib/types/environment/selection.js.map +1 -0
- package/lib/types/environment/service.d.ts +64 -0
- package/lib/types/environment/service.d.ts.map +1 -0
- package/lib/types/environment/service.js +424 -0
- package/lib/types/environment/service.js.map +1 -0
- package/lib/types/environment/types.d.ts +56 -0
- package/lib/types/environment/types.d.ts.map +1 -0
- package/lib/types/environment/types.js +2 -0
- package/lib/types/environment/types.js.map +1 -0
- package/lib/types/events.d.ts +76 -0
- package/lib/types/events.d.ts.map +1 -0
- package/lib/types/events.js +52 -0
- package/lib/types/events.js.map +1 -0
- package/lib/types/extract-contract.d.ts +3 -0
- package/lib/types/extract-contract.d.ts.map +1 -0
- package/lib/types/extract-contract.js +41 -0
- package/lib/types/extract-contract.js.map +1 -0
- package/lib/types/extract-model.d.ts +5 -0
- package/lib/types/extract-model.d.ts.map +1 -1
- package/lib/types/extract-model.js.map +1 -1
- package/lib/types/extract-table-contract.d.ts +3 -0
- package/lib/types/extract-table-contract.d.ts.map +1 -0
- package/lib/types/extract-table-contract.js +27 -0
- package/lib/types/extract-table-contract.js.map +1 -0
- package/lib/types/extract-table.d.ts +8 -0
- package/lib/types/extract-table.d.ts.map +1 -0
- package/lib/types/extract-table.js +158 -0
- package/lib/types/extract-table.js.map +1 -0
- package/lib/types/extraction-runs.d.ts +30 -6
- package/lib/types/extraction-runs.d.ts.map +1 -1
- package/lib/types/extraction-runs.js +69 -8
- package/lib/types/extraction-runs.js.map +1 -1
- package/lib/types/fs-atomic.d.ts +0 -7
- package/lib/types/fs-atomic.d.ts.map +1 -1
- package/lib/types/fs-atomic.js +17 -2
- package/lib/types/fs-atomic.js.map +1 -1
- package/lib/types/images.d.ts +26 -0
- package/lib/types/images.d.ts.map +1 -0
- package/lib/types/images.js +196 -0
- package/lib/types/images.js.map +1 -0
- package/lib/types/index.d.ts +2 -2
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js +598 -209
- package/lib/types/index.js.map +1 -1
- package/lib/types/intent/engine.d.ts +12 -4
- package/lib/types/intent/engine.d.ts.map +1 -1
- package/lib/types/intent/engine.js +43 -5
- package/lib/types/intent/engine.js.map +1 -1
- package/lib/types/intent/host.d.ts +5 -8
- package/lib/types/intent/host.d.ts.map +1 -1
- package/lib/types/intent/host.js +56 -11
- package/lib/types/intent/host.js.map +1 -1
- package/lib/types/intent/scope.d.ts +25 -0
- package/lib/types/intent/scope.d.ts.map +1 -0
- package/lib/types/intent/scope.js +116 -0
- package/lib/types/intent/scope.js.map +1 -0
- package/lib/types/intent/tools.d.ts +24 -20
- package/lib/types/intent/tools.d.ts.map +1 -1
- package/lib/types/intent/tools.js +65 -23
- package/lib/types/intent/tools.js.map +1 -1
- package/lib/types/intent/types.d.ts +11 -4
- package/lib/types/intent/types.d.ts.map +1 -1
- package/lib/types/knowledge-bases.d.ts +11 -5
- package/lib/types/knowledge-bases.d.ts.map +1 -1
- package/lib/types/knowledge-bases.js +52 -20
- package/lib/types/knowledge-bases.js.map +1 -1
- package/lib/types/knowledge-contract.d.ts +32 -0
- package/lib/types/knowledge-contract.d.ts.map +1 -0
- package/lib/types/knowledge-contract.js +116 -0
- package/lib/types/knowledge-contract.js.map +1 -0
- package/lib/types/knowledge.d.ts +31 -9
- package/lib/types/knowledge.d.ts.map +1 -1
- package/lib/types/knowledge.js +137 -60
- package/lib/types/knowledge.js.map +1 -1
- package/lib/types/layout.d.ts +10 -29
- package/lib/types/layout.d.ts.map +1 -1
- package/lib/types/layout.js +17 -36
- package/lib/types/layout.js.map +1 -1
- package/lib/types/materialize-snapshot.d.ts +49 -0
- package/lib/types/materialize-snapshot.d.ts.map +1 -0
- package/lib/types/materialize-snapshot.js +2 -0
- package/lib/types/materialize-snapshot.js.map +1 -0
- package/lib/types/migrate.d.ts +11 -0
- package/lib/types/migrate.d.ts.map +1 -1
- package/lib/types/migrate.js +83 -2
- package/lib/types/migrate.js.map +1 -1
- package/lib/types/model-text.d.ts +58 -1
- package/lib/types/model-text.d.ts.map +1 -1
- package/lib/types/model-text.js +85 -30
- package/lib/types/model-text.js.map +1 -1
- package/lib/types/oplog.d.ts.map +1 -1
- package/lib/types/oplog.js +7 -0
- package/lib/types/oplog.js.map +1 -1
- package/lib/types/organize-contract.d.ts +18 -0
- package/lib/types/organize-contract.d.ts.map +1 -0
- package/lib/types/organize-contract.js +82 -0
- package/lib/types/organize-contract.js.map +1 -0
- package/lib/types/pipeline/engine.d.ts +66 -0
- package/lib/types/pipeline/engine.d.ts.map +1 -0
- package/lib/types/pipeline/engine.js +352 -0
- package/lib/types/pipeline/engine.js.map +1 -0
- package/lib/types/pipeline/store.d.ts +73 -0
- package/lib/types/pipeline/store.d.ts.map +1 -0
- package/lib/types/pipeline/store.js +143 -0
- package/lib/types/pipeline/store.js.map +1 -0
- package/lib/types/pipeline/types.d.ts +102 -0
- package/lib/types/pipeline/types.d.ts.map +1 -0
- package/lib/types/pipeline/types.js +5 -0
- package/lib/types/pipeline/types.js.map +1 -0
- package/lib/types/present.d.ts +2 -0
- package/lib/types/present.d.ts.map +1 -1
- package/lib/types/present.js +9 -4
- package/lib/types/present.js.map +1 -1
- package/lib/types/preset-ids.d.ts +4 -0
- package/lib/types/preset-ids.d.ts.map +1 -0
- package/lib/types/preset-ids.js +6 -0
- package/lib/types/preset-ids.js.map +1 -0
- package/lib/types/query-analysis.d.ts +13 -1
- package/lib/types/query-analysis.d.ts.map +1 -1
- package/lib/types/query-analysis.js +62 -6
- package/lib/types/query-analysis.js.map +1 -1
- package/lib/types/recall-rank.d.ts +3 -3
- package/lib/types/recall-rank.d.ts.map +1 -1
- package/lib/types/recall-rank.js +4 -4
- package/lib/types/recall-rank.js.map +1 -1
- package/lib/types/retention.d.ts +39 -0
- package/lib/types/retention.d.ts.map +1 -0
- package/lib/types/retention.js +42 -0
- package/lib/types/retention.js.map +1 -0
- package/lib/types/retrieval/vector-index.d.ts +32 -0
- package/lib/types/retrieval/vector-index.d.ts.map +1 -0
- package/lib/types/retrieval/vector-index.js +15 -0
- package/lib/types/retrieval/vector-index.js.map +1 -0
- package/lib/types/retrieval/visibility.d.ts +6 -0
- package/lib/types/retrieval/visibility.d.ts.map +1 -0
- package/lib/types/retrieval/visibility.js +11 -0
- package/lib/types/retrieval/visibility.js.map +1 -0
- package/lib/types/runtime.d.ts +272 -27
- package/lib/types/runtime.d.ts.map +1 -1
- package/lib/types/runtime.js +2751 -537
- package/lib/types/runtime.js.map +1 -1
- package/lib/types/settings-schema.d.ts +17 -15
- package/lib/types/settings-schema.d.ts.map +1 -1
- package/lib/types/settings-schema.js +50 -47
- package/lib/types/settings-schema.js.map +1 -1
- package/lib/types/settings-volatile.d.ts +4 -4
- package/lib/types/settings-volatile.js +4 -4
- package/lib/types/source-evidence.d.ts +14 -0
- package/lib/types/source-evidence.d.ts.map +1 -0
- package/lib/types/source-evidence.js +36 -0
- package/lib/types/source-evidence.js.map +1 -0
- package/lib/types/store/axis-references.d.ts +5 -0
- package/lib/types/store/axis-references.d.ts.map +1 -0
- package/lib/types/store/axis-references.js +106 -0
- package/lib/types/store/axis-references.js.map +1 -0
- package/lib/types/store/derived.d.ts +12 -1
- package/lib/types/store/derived.d.ts.map +1 -1
- package/lib/types/store/derived.js +71 -12
- package/lib/types/store/derived.js.map +1 -1
- package/lib/types/store/knowledge-db.d.ts +31 -1
- package/lib/types/store/knowledge-db.d.ts.map +1 -1
- package/lib/types/store/knowledge-db.js +252 -18
- package/lib/types/store/knowledge-db.js.map +1 -1
- package/lib/types/store/migrate.d.ts.map +1 -1
- package/lib/types/store/migrate.js +17 -6
- package/lib/types/store/migrate.js.map +1 -1
- package/lib/types/trajectory-types.d.ts +172 -0
- package/lib/types/trajectory-types.d.ts.map +1 -0
- package/lib/types/trajectory-types.js +36 -0
- package/lib/types/trajectory-types.js.map +1 -0
- package/lib/types/types.d.ts +59 -27
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/types.js +6 -15
- package/lib/types/types.js.map +1 -1
- package/lib/types/wiki-finalize.d.ts +16 -0
- package/lib/types/wiki-finalize.d.ts.map +1 -1
- package/lib/types/wiki-finalize.js +26 -0
- package/lib/types/wiki-finalize.js.map +1 -1
- package/lib/types/wiki-materialize.d.ts +4 -0
- package/lib/types/wiki-materialize.d.ts.map +1 -1
- package/lib/types/wiki-materialize.js +21 -7
- package/lib/types/wiki-materialize.js.map +1 -1
- package/lib/types/wiki-trial-types.d.ts +87 -0
- package/lib/types/wiki-trial-types.d.ts.map +1 -1
- package/lib/types/wiki-trial-types.js +0 -16
- package/lib/types/wiki-trial-types.js.map +1 -1
- package/lib/types/wiki-trial.d.ts +40 -16
- package/lib/types/wiki-trial.d.ts.map +1 -1
- package/lib/types/wiki-trial.js +337 -224
- package/lib/types/wiki-trial.js.map +1 -1
- package/package.json +29 -20
- package/python/prepare-models.py +19 -0
- package/python/requirements.txt +8 -6
- package/scripts/doctor.mjs +13 -19
- package/scripts/environment.mjs +29 -0
- package/scripts/setup-embedding.sh +15 -5
- package/src/agent-behavior-rules.ts +37 -0
- package/src/axis-registry.ts +234 -27
- package/src/card-organize.ts +69 -75
- package/src/client/AgentBehaviorRulesCard.tsx +65 -0
- package/src/client/AttributionEventGuide.tsx +41 -39
- package/src/client/AxisRegistrySection.tsx +204 -164
- package/src/client/CompileDialogs.tsx +44 -29
- package/src/client/DeleteDocumentDialog.tsx +36 -5
- package/src/client/DirectoryPicker.tsx +0 -10
- package/src/client/EnvironmentSetup.tsx +243 -0
- package/src/client/ExpansionGraph.tsx +13 -7
- package/src/client/ExtractionTasksPage.tsx +578 -0
- package/src/client/GuideArchitectureCanvas.tsx +470 -0
- package/src/client/ImportFilesDialog.tsx +2 -13
- package/src/client/IntentLogic.tsx +2 -2
- package/src/client/IntentTab.tsx +118 -47
- package/src/client/KnowledgeBaseTab.tsx +277 -197
- package/src/client/KnowledgeLayerSection.tsx +24 -6
- package/src/client/KnowledgePanel.tsx +58 -93
- package/src/client/KnowledgeSettingsDrawer.tsx +90 -0
- package/src/client/ListPager.tsx +15 -5
- package/src/client/MaterializeTrajectoryView.tsx +124 -0
- package/src/client/NodeSettings.tsx +210 -89
- package/src/client/NormalizeTrajectoryView.tsx +136 -0
- package/src/client/PipelineNotice.tsx +26 -0
- package/src/client/PreviewSections.tsx +118 -51
- package/src/client/RecallPanel.tsx +89 -85
- package/src/client/TabGuide.tsx +159 -184
- package/src/client/TrialReportView.tsx +391 -214
- package/src/client/TypeDefinitionDrawer.tsx +150 -23
- package/src/client/WikiCardPreview.tsx +62 -16
- package/src/client/WikiFlowPanel.tsx +4 -4
- package/src/client/arch/NodeLogicPanel.tsx +3 -4
- package/src/client/arch/model.ts +6 -9
- package/src/client/architecture.tsx +23 -33
- package/src/client/attribution/AttributionGraph.tsx +10 -6
- package/src/client/attribution/AttributionTab.tsx +136 -84
- package/src/client/attribution/CaseView.tsx +3 -1
- package/src/client/attribution/EventView.tsx +108 -0
- package/src/client/attribution/RunView.tsx +2 -2
- package/src/client/attribution/StageChrome.tsx +34 -3
- package/src/client/attribution/ViewSwitch.tsx +20 -5
- package/src/client/attribution/graph-options.ts +47 -39
- package/src/client/attribution/model.ts +17 -10
- package/src/client/config-scope.ts +3 -3
- package/src/client/graph/palette.ts +165 -0
- package/src/client/index.ts +49 -42
- package/src/client/pages.css +459 -135
- package/src/client/pages.tsx +37 -9
- package/src/client/problem-domains.ts +1 -1
- package/src/client/session-remote.ts +9 -0
- package/src/client/styles.css +205 -62
- package/src/client/wiki-trial.ts +44 -3
- package/src/compiler/embedding-identity.ts +21 -0
- package/src/compiler/snapshot.ts +17 -0
- package/src/config-schema.ts +8 -3
- package/src/convert/host.ts +56 -21
- package/src/convert/ingest.ts +74 -10
- package/src/derive-contract.ts +14 -0
- package/src/diagnosis/cards.ts +13 -8
- package/src/diagnosis/run.ts +27 -17
- package/src/diagnosis/schema.ts +2 -2
- package/src/diagnosis/seed-source.ts +5 -4
- package/src/diagnosis/seed.ts +6 -8
- package/src/diagnosis/store.ts +138 -69
- package/src/diagnosis/types.ts +34 -15
- package/src/environment/dsh-python.ts +156 -0
- package/src/environment/install.ts +244 -0
- package/src/environment/manifest.ts +28 -0
- package/src/environment/model-catalog.ts +147 -0
- package/src/environment/process.ts +54 -0
- package/src/environment/selection.ts +29 -0
- package/src/environment/service.ts +348 -0
- package/src/environment/types.ts +45 -0
- package/src/events.ts +108 -0
- package/src/extract-contract.ts +42 -0
- package/src/extract-model.ts +10 -1
- package/src/extract-table-contract.ts +26 -0
- package/src/extract-table.ts +132 -0
- package/src/extraction-runs.ts +70 -11
- package/src/fs-atomic.ts +19 -2
- package/src/images.ts +203 -0
- package/src/index.ts +553 -205
- package/src/intent/README.md +8 -6
- package/src/intent/engine.ts +44 -6
- package/src/intent/host.ts +59 -18
- package/src/intent/scope.ts +125 -0
- package/src/intent/tools.ts +70 -28
- package/src/intent/types.ts +11 -4
- package/src/knowledge-bases.ts +56 -20
- package/src/knowledge-contract.ts +114 -0
- package/src/knowledge.ts +138 -69
- package/src/layout.ts +17 -37
- package/src/materialize-snapshot.ts +46 -0
- package/src/migrate.ts +75 -2
- package/src/model-text.ts +109 -4
- package/src/oplog.ts +7 -0
- package/src/organize-contract.ts +83 -0
- package/src/pipeline/engine.ts +323 -0
- package/src/pipeline/store.ts +147 -0
- package/src/pipeline/types.ts +93 -0
- package/src/present.ts +10 -4
- package/src/preset-ids.ts +6 -0
- package/src/python/embedding_worker.py +66 -2
- package/src/query-analysis.ts +68 -8
- package/src/recall-rank.ts +5 -5
- package/src/retention.ts +76 -0
- package/src/retrieval/vector-index.ts +45 -0
- package/src/retrieval/visibility.ts +14 -0
- package/src/runtime.ts +2708 -567
- package/src/settings-schema.ts +11 -8
- package/src/settings-volatile.ts +4 -4
- package/src/source-evidence.ts +37 -0
- package/src/store/axis-references.ts +96 -0
- package/src/store/derived.ts +70 -12
- package/src/store/knowledge-db.ts +248 -17
- package/src/store/migrate.ts +16 -6
- package/src/trajectory-types.ts +142 -0
- package/src/types.ts +61 -35
- package/src/wiki-finalize.ts +28 -0
- package/src/wiki-materialize.ts +25 -6
- package/src/wiki-trial-types.ts +83 -1
- package/src/wiki-trial.ts +357 -185
- package/lib/types/intent/preset-tools.d.ts +0 -37
- package/lib/types/intent/preset-tools.d.ts.map +0 -1
- package/lib/types/intent/preset-tools.js +0 -45
- package/lib/types/intent/preset-tools.js.map +0 -1
- package/preset/tita-data-agent/agent.cordis.yml +0 -394
- package/preset/tita-data-agent/preset.yml +0 -3
- package/scripts/install-agent-preset.mjs +0 -92
- package/scripts/sync-agent-preset.mjs +0 -188
- package/src/client/AgentPresetCard.tsx +0 -247
- package/src/client/agent-preset.ts +0 -121
- package/src/client/convert/ConvertPanel.tsx +0 -583
- package/src/client/convert/styles.css +0 -138
- package/src/client/convert/styles.ts +0 -49
- package/src/intent/preset-tools.ts +0 -48
package/lib/types/runtime.d.ts
CHANGED
|
@@ -2,15 +2,19 @@ import { type CardAnnotation, type CardCoordinate, type CardReview, type CardSta
|
|
|
2
2
|
import { DiagnosisStore } from './diagnosis/store.js';
|
|
3
3
|
import { OperationLog } from './oplog.js';
|
|
4
4
|
import { ExtractionRunStore, type ExtractionRunPage, type ExtractionRunRecord } from './extraction-runs.js';
|
|
5
|
-
import
|
|
5
|
+
import type { TrajectoryStage } from './trajectory-types.js';
|
|
6
|
+
import { AxisRegistry, type AxisEntity, type AxisGuidance, type AxisGuidanceKind, type AxisKind, type AxisRelation, type AxisResolution, type AxisStatus } from './axis-registry.js';
|
|
6
7
|
import { KnowledgeStore, type Knowledge, type KnowledgeDocumentRemoval, type KnowledgeFacets, type KnowledgeIngest, type KnowledgeIngestResult, type KnowledgeQuery, type KnowledgeState, type KnowledgeVersion } from './knowledge.js';
|
|
7
|
-
import
|
|
8
|
+
import { type EventEntity } from './events.js';
|
|
9
|
+
import type { TrialAxis, TrialEvent, TrialKnowledge } from './wiki-trial-types.js';
|
|
8
10
|
import { type ModelCall } from './extract-model.js';
|
|
9
|
-
import { type AxisPromptBlock } from './wiki-trial.js';
|
|
11
|
+
import { type AxisPromptBlock, type TrialAxisSet, type TrialAxisSetResolution } from './wiki-trial.js';
|
|
12
|
+
import { KnowledgePipeline } from './pipeline/engine.js';
|
|
13
|
+
import type { PipelineStatus } from './pipeline/types.js';
|
|
10
14
|
import { type CardCitationRecord } from './card-organize.js';
|
|
11
15
|
import { type RelatedEntry } from './wiki-finalize.js';
|
|
12
16
|
import { type CardKnowledgeRow } from './store/knowledge-db.js';
|
|
13
|
-
import type { LineageContext, LineageRef } from '
|
|
17
|
+
import type { LineageContext, LineageRef } from '#contracts';
|
|
14
18
|
declare const LAYOUT: readonly string[];
|
|
15
19
|
/**
|
|
16
20
|
* 一次 `import_sources` 能带多少份来源(0045)。
|
|
@@ -21,7 +25,7 @@ declare const LAYOUT: readonly string[];
|
|
|
21
25
|
export declare const MAX_IMPORT_SOURCES = 50;
|
|
22
26
|
/**
|
|
23
27
|
* Both helpers delegate to the shared envelope constructors: the five-key shape
|
|
24
|
-
* and the "warnings ⇒ partial" rule live in
|
|
28
|
+
* and the "warnings ⇒ partial" rule live in the shared contract source,
|
|
25
29
|
* so a knowledge response and a workbook response cannot disagree about status,
|
|
26
30
|
* and neither can forget `error: null` on the happy path.
|
|
27
31
|
*/
|
|
@@ -60,6 +64,11 @@ export interface DocumentDeletion {
|
|
|
60
64
|
deleted: number;
|
|
61
65
|
detached: number;
|
|
62
66
|
};
|
|
67
|
+
/** 独立 Event 的来源记录清理结果。 */
|
|
68
|
+
events: {
|
|
69
|
+
deleted: number;
|
|
70
|
+
detached: number;
|
|
71
|
+
};
|
|
63
72
|
/** 兜底对账的结果(按「来源还在不在」重扫一遍)。没有孤儿时是 0。 */
|
|
64
73
|
orphans: {
|
|
65
74
|
knowledge: KnowledgeDocumentRemoval;
|
|
@@ -67,6 +76,10 @@ export interface DocumentDeletion {
|
|
|
67
76
|
deleted: number;
|
|
68
77
|
detached: number;
|
|
69
78
|
};
|
|
79
|
+
events: {
|
|
80
|
+
deleted: number;
|
|
81
|
+
detached: number;
|
|
82
|
+
};
|
|
70
83
|
} | null;
|
|
71
84
|
/**
|
|
72
85
|
* 顺带回收掉的图片(2026-10-05)。
|
|
@@ -102,6 +115,8 @@ export interface ImportFailure {
|
|
|
102
115
|
* 而这里要回答的是「刚才那一下让库里多了什么」。
|
|
103
116
|
*/
|
|
104
117
|
export interface ImportCompileReport {
|
|
118
|
+
taskId?: string;
|
|
119
|
+
state?: import('./pipeline/types.js').PipelineState;
|
|
105
120
|
cardsCreated: number;
|
|
106
121
|
cardsUpdated: number;
|
|
107
122
|
cardsReused?: number;
|
|
@@ -214,6 +229,8 @@ export interface WikiSchemaSnapshot {
|
|
|
214
229
|
types: WikiTypeDef[];
|
|
215
230
|
}
|
|
216
231
|
export interface KnowledgeRuntimeOptions {
|
|
232
|
+
/** Production deployment requires a working Python + embedding + rerank stack. */
|
|
233
|
+
environmentGuard?: (kind?: 'embedding' | 'rerank') => Promise<void>;
|
|
217
234
|
/**
|
|
218
235
|
* 这一库的「坐标提取备注」(0068),人写的。
|
|
219
236
|
*
|
|
@@ -226,7 +243,7 @@ export interface KnowledgeRuntimeOptions {
|
|
|
226
243
|
* 0029:家当目录(`<agentRoot>/resource`)。
|
|
227
244
|
*
|
|
228
245
|
* 配置里那三个路径字段(`python` / `embeddingModel` / `rerankModel`)为空时,
|
|
229
|
-
*
|
|
246
|
+
* 它们从这里解析。省略时使用 DSH Python、系统命令或模型名作为兜底 —— 独立运行时与单元
|
|
230
247
|
* 测试不必先造一个根路径。
|
|
231
248
|
*/
|
|
232
249
|
resourceRoot?: string;
|
|
@@ -265,13 +282,17 @@ export interface KnowledgeRuntimeOptions {
|
|
|
265
282
|
* **并且必须能说出拿不到的原因** —— `why` 会原样进 `rebuild` 的 warnings。
|
|
266
283
|
* 一个说不出理由的降级,等于没有降级信息。
|
|
267
284
|
*/
|
|
268
|
-
modelSeam?: () => ModelSeam;
|
|
285
|
+
modelSeam?: (baseId?: string) => ModelSeam;
|
|
269
286
|
}
|
|
270
287
|
/** 一次模型接缝解析的结果。两件东西都要有交代:能不能用,以及不能用时为什么。 */
|
|
271
288
|
export interface ModelSeam {
|
|
272
289
|
call?: ModelCall;
|
|
273
290
|
/** 拿不到 `call` 的原因,人话。会被原样写进 `rebuild` 的 warnings。 */
|
|
274
291
|
why?: string;
|
|
292
|
+
/** 用于审计的实际模型路由,不含凭据。 */
|
|
293
|
+
provider?: string;
|
|
294
|
+
model?: string;
|
|
295
|
+
reasoningEffort?: string;
|
|
275
296
|
}
|
|
276
297
|
/**
|
|
277
298
|
* 一次编译的**实时进度快照**。
|
|
@@ -301,6 +322,8 @@ export interface CompileStepView {
|
|
|
301
322
|
/** 这一段的计数事实,一行一条。第一条通常是进度(`读取文档 3/40`)。 */
|
|
302
323
|
facts: string[];
|
|
303
324
|
}
|
|
325
|
+
export type CompileTaskState = 'queued' | 'running' | 'pausing' | 'paused' | 'cancelling' | 'succeeded' | 'failed' | 'cancelled';
|
|
326
|
+
export type CompileTaskAction = 'pause' | 'resume' | 'cancel';
|
|
304
327
|
export interface CompileProgressView {
|
|
305
328
|
/**
|
|
306
329
|
* 这一趟编译的编号(0066)。**调用方靠它认出「这是我发起的那一趟」。**
|
|
@@ -310,6 +333,8 @@ export interface CompileProgressView {
|
|
|
310
333
|
* 会读到上一次编译的结论,而那看起来完全正常。
|
|
311
334
|
*/
|
|
312
335
|
runId: string;
|
|
336
|
+
state: CompileTaskState;
|
|
337
|
+
queuedAt: string;
|
|
313
338
|
/** 与 `rebuild()` 的入参同一个联合类型 —— 少写一个成员,这里就会变成一处会过期的假设。 */
|
|
314
339
|
only: 'all' | 'schema' | 'wiki' | 'embeddings';
|
|
315
340
|
startedAt: string;
|
|
@@ -335,7 +360,15 @@ export interface CompileProgressView {
|
|
|
335
360
|
*/
|
|
336
361
|
report?: RebuildReport;
|
|
337
362
|
}
|
|
363
|
+
/** 任务页只读进度,不接收编译报告或来源 id 清单。 */
|
|
364
|
+
export type CompileTaskSummary = Omit<CompileProgressView, 'report' | 'sourceIds'>;
|
|
365
|
+
export interface CompileTaskControlResult {
|
|
366
|
+
ok: boolean;
|
|
367
|
+
task?: CompileTaskSummary;
|
|
368
|
+
why?: string;
|
|
369
|
+
}
|
|
338
370
|
export declare class KnowledgeRuntime {
|
|
371
|
+
private readonly environmentGuard?;
|
|
339
372
|
/** 当前生效的配置。volatile 改动会就地合并进来(见 `updateConfig`),所以它不是只读的。 */
|
|
340
373
|
config: RuntimeKnowledgeConfig;
|
|
341
374
|
readonly rootDir: string;
|
|
@@ -354,6 +387,8 @@ export declare class KnowledgeRuntime {
|
|
|
354
387
|
* `settleProgressReport()`。它是**单一槽位**:装着正在跑的那一趟。
|
|
355
388
|
*/
|
|
356
389
|
private compileProgress;
|
|
390
|
+
/** 当前进程里的抽取/编译任务,包含队列项和最近结束的记录。 */
|
|
391
|
+
private compileTasks;
|
|
357
392
|
/**
|
|
358
393
|
* **已经结束**那几趟的进度记录,按编号存。
|
|
359
394
|
*
|
|
@@ -381,12 +416,16 @@ export declare class KnowledgeRuntime {
|
|
|
381
416
|
private compileTail;
|
|
382
417
|
/** 已结束的进度记录最多留几条。 */
|
|
383
418
|
private static readonly FINISHED_COMPILES_KEPT;
|
|
419
|
+
private static readonly COMPILE_TASKS_KEPT;
|
|
384
420
|
/** 处理日志(`04_memory/oplog.sqlite`);`oplogReady` 记探测结论,避免每次重开。 */
|
|
385
421
|
private oplog;
|
|
386
422
|
private oplogReady;
|
|
387
423
|
/** 抽取轨迹(`<memoryDir>/extraction-runs.sqlite`)。同一个懒打开的理由。 */
|
|
388
424
|
private extractionRunsStore;
|
|
389
425
|
private extractionRunsReady;
|
|
426
|
+
private closed;
|
|
427
|
+
private pipelineEngine?;
|
|
428
|
+
private pipelineOpening?;
|
|
390
429
|
/** 轴注册表(`<memoryDir>/knowledge.sqlite`)。与抽取轨迹同一个懒打开的理由。 */
|
|
391
430
|
private axesStore;
|
|
392
431
|
private axesReady;
|
|
@@ -428,6 +467,8 @@ export declare class KnowledgeRuntime {
|
|
|
428
467
|
*/
|
|
429
468
|
private derived;
|
|
430
469
|
private derivedProblem;
|
|
470
|
+
private publication?;
|
|
471
|
+
private recallSnapshotCache?;
|
|
431
472
|
/** 段内布局整理是否已经跑过(每个 runtime 一次)。 */
|
|
432
473
|
private segmentsOrganized;
|
|
433
474
|
/**
|
|
@@ -461,9 +502,10 @@ export declare class KnowledgeRuntime {
|
|
|
461
502
|
private vectorIndex;
|
|
462
503
|
private vectorError;
|
|
463
504
|
private embeddingWorker;
|
|
505
|
+
private embeddingWorkerFingerprint?;
|
|
464
506
|
/** Separate process so a rerank model failure cannot take embeddings down. */
|
|
465
507
|
private rerankWorker;
|
|
466
|
-
/** Cache the
|
|
508
|
+
/** Cache the last rerank failure with its time; see `RERANK_RETRY_COOLDOWN_MS`. */
|
|
467
509
|
private rerankUnavailable;
|
|
468
510
|
/** 解析后的 Python 解释器路径(配置为空时从家当目录解析)。 */
|
|
469
511
|
private pythonPath;
|
|
@@ -478,7 +520,8 @@ export declare class KnowledgeRuntime {
|
|
|
478
520
|
* 清单里的模型名就对不上,整个向量索引被判成「配置不匹配」而作废,用户会莫名
|
|
479
521
|
* 收到一次全量重编码。清单该记「是哪一个模型」,不是「它在哪」。
|
|
480
522
|
*/
|
|
481
|
-
private
|
|
523
|
+
private embeddingModelId;
|
|
524
|
+
private readonly resourceRoot?;
|
|
482
525
|
/**
|
|
483
526
|
* 这个知识库的记忆段(0032)。
|
|
484
527
|
*
|
|
@@ -498,6 +541,7 @@ export declare class KnowledgeRuntime {
|
|
|
498
541
|
* **每次现问**,不是在构造时定死:插件 apply 的时刻早于 `agent-default-model` 挂载,
|
|
499
542
|
* 那时问一次只会得到 undefined,而定死之后就再也不会变(见 `modelCallProvider`)。
|
|
500
543
|
*/
|
|
544
|
+
private embeddingFingerprint;
|
|
501
545
|
private modelSeamNow;
|
|
502
546
|
/**
|
|
503
547
|
* 就地应用一份新的运行时配置(0.1.7 的 volatile 改动走这条路)。
|
|
@@ -680,6 +724,7 @@ export declare class KnowledgeRuntime {
|
|
|
680
724
|
private encodeWithOllama;
|
|
681
725
|
private encodeEmbeddings;
|
|
682
726
|
close(): void;
|
|
727
|
+
private closeStores;
|
|
683
728
|
/** Both the encoder and the reranker speak the same JSONL worker protocol. */
|
|
684
729
|
private spawnWorker;
|
|
685
730
|
private vectorInputs;
|
|
@@ -819,7 +864,16 @@ export declare class KnowledgeRuntime {
|
|
|
819
864
|
*
|
|
820
865
|
* 失败一律返回 `null`,**不抛** —— 「知识库不可用」是一条要显示的结论,不是一个异常。
|
|
821
866
|
*/
|
|
867
|
+
private storeHandleOpening?;
|
|
868
|
+
/**
|
|
869
|
+
* 知识存储现在可用吗(0070)。
|
|
870
|
+
*
|
|
871
|
+
* 读路径需要它把「确认是空」与「读不到」分开:`loadCards()` 在存储不可用时返回 `[]`,
|
|
872
|
+
* 而调用方据此做写决定(例如诊断的旧格式迁移)就会把一次读故障变成一次污染写。
|
|
873
|
+
*/
|
|
874
|
+
knowledgeStoreAvailable(): Promise<boolean>;
|
|
822
875
|
private storeHandle;
|
|
876
|
+
private openStoreHandle;
|
|
823
877
|
/** 知识库不可用的原因;可用时为 `undefined`。 */
|
|
824
878
|
storeUnavailable(): string | undefined;
|
|
825
879
|
/**
|
|
@@ -859,7 +913,9 @@ export declare class KnowledgeRuntime {
|
|
|
859
913
|
*/
|
|
860
914
|
private absorbLegacyDerived;
|
|
861
915
|
/** 派生库(`<库根>/derived.db`):编译产物,**可整体删掉重算**。 */
|
|
916
|
+
private derivedHandleOpening?;
|
|
862
917
|
private derivedHandle;
|
|
918
|
+
private openDerivedHandle;
|
|
863
919
|
/** 读一份派生产物。**没有就抛** —— 与「文件不存在时 `readFile` 抛」同形,调用方的 try/catch 不用改。 */
|
|
864
920
|
private readArtifact;
|
|
865
921
|
private writeArtifact;
|
|
@@ -1120,13 +1176,15 @@ export declare class KnowledgeRuntime {
|
|
|
1120
1176
|
*/
|
|
1121
1177
|
listCardVersions(entityId: string, entityType?: SchemaType): Promise<WikiCardVersion[]>;
|
|
1122
1178
|
/**
|
|
1123
|
-
*
|
|
1179
|
+
* WikiCard 保留只读版本历史,不支持恢复。
|
|
1124
1180
|
*
|
|
1125
|
-
*
|
|
1126
|
-
* 又是一个新版本,历史只增不减。
|
|
1181
|
+
* 保留方法签名,让旧调用方收到明确错误,而不是意外修改卡片正文。
|
|
1127
1182
|
*/
|
|
1128
1183
|
revertCard(entityId: string, versionId: string, entityType?: SchemaType): Promise<Envelope<KnowledgeCard>>;
|
|
1129
1184
|
loadCards(): Promise<KnowledgeCard[]>;
|
|
1185
|
+
/** Event 与 Knowledge 同层,直接读 SQLite 的 event 表,不伪装成 WikiCard。 */
|
|
1186
|
+
readCase(id: string, version?: number): Promise<EventEntity | undefined>;
|
|
1187
|
+
loadEvents(): Promise<EventEntity[]>;
|
|
1130
1188
|
setStatus(entityId: string, status: CardStatus, problemNote?: string, lineage?: LineageContext): Promise<Envelope<{
|
|
1131
1189
|
entityId: string;
|
|
1132
1190
|
status: CardStatus;
|
|
@@ -1219,11 +1277,10 @@ export declare class KnowledgeRuntime {
|
|
|
1219
1277
|
*/
|
|
1220
1278
|
private runExtractionStage;
|
|
1221
1279
|
/**
|
|
1222
|
-
*
|
|
1280
|
+
* 最终组织阶段:按坐标检查所有卡片,只重排知识集合变化的卡片。
|
|
1223
1281
|
*
|
|
1224
|
-
*
|
|
1225
|
-
* {@link MAX_ORGANIZE_PER_COMPILE}
|
|
1226
|
-
* 是几百次模型调用,那件事不该悄悄发生。
|
|
1282
|
+
* 先比较知识指纹,只把有变化的卡片放入队列。顺序按 `entityId` 排,避免结果依赖
|
|
1283
|
+
* `loadCards()` 的顺序。每轮最多请求 {@link MAX_ORGANIZE_PER_COMPILE} 张卡片。
|
|
1227
1284
|
*/
|
|
1228
1285
|
private organizeAllCards;
|
|
1229
1286
|
/** 读回关系产物。文件不在或读不动都当「没有」,不抛。 */
|
|
@@ -1280,8 +1337,8 @@ export declare class KnowledgeRuntime {
|
|
|
1280
1337
|
* 两个来源,优先级相同(都记进 `via`,一条邻居可以有多条来路):
|
|
1281
1338
|
* 1. **图上的边**(`relates_to` 这类卡片之间的关系)—— `supported_by` 不算:
|
|
1282
1339
|
* 它连的是「卡片 → 来源」,而来源不是 wiki 卡片,进不了上下文;
|
|
1283
|
-
* 2. **共同来源**:同一份 SourceRaw
|
|
1284
|
-
*
|
|
1340
|
+
* 2. **共同来源**:同一份 SourceRaw 编译出来的卡片也是邻居。来源关联只在低度数时使用;
|
|
1341
|
+
* 大文档把很多卡片连在一起时,它只是溯源关系,不足以证明内容相关。
|
|
1285
1342
|
*
|
|
1286
1343
|
* 调用点必须在**按卡片去重之后**:先扩展再去重会把邻居与命中混在一起,
|
|
1287
1344
|
* 而上下文里必须分得清「这是召回来的」还是「这是延伸出来的」。
|
|
@@ -1361,6 +1418,14 @@ export declare class KnowledgeRuntime {
|
|
|
1361
1418
|
* 不必依赖自己那条 HTTP 请求活到编译结束。
|
|
1362
1419
|
*/
|
|
1363
1420
|
compileProgressView(runId?: string): CompileProgressView | null;
|
|
1421
|
+
/** 最近的队列与编译记录,供抽取任务页轮询。 */
|
|
1422
|
+
listCompileTasks(): CompileTaskSummary[];
|
|
1423
|
+
/** 暂停、继续或停止一趟编译。停止不会回滚已经写入的文档与卡片。 */
|
|
1424
|
+
controlCompileTask(runId: string, action: CompileTaskAction): CompileTaskControlResult;
|
|
1425
|
+
private patchCompileTaskProgress;
|
|
1426
|
+
private writeCompileProgress;
|
|
1427
|
+
private checkpointCompileTask;
|
|
1428
|
+
private trimCompileTasks;
|
|
1364
1429
|
/**
|
|
1365
1430
|
* 处理日志(`04_memory/oplog.sqlite`)。SQLite 拿不到时返回 null ——
|
|
1366
1431
|
* 调用方要如实报「操作日志不可用」,而不是假装有。
|
|
@@ -1383,6 +1448,8 @@ export declare class KnowledgeRuntime {
|
|
|
1383
1448
|
summary: string;
|
|
1384
1449
|
report: unknown;
|
|
1385
1450
|
actor?: string;
|
|
1451
|
+
/** 这条轨迹属于哪一段。省略 = 抽取(旧调用点的行为不变)。 */
|
|
1452
|
+
stage?: TrajectoryStage;
|
|
1386
1453
|
/**
|
|
1387
1454
|
* 这次轨迹的 id。**调用方可以先定**,因为注册表里的候选实体要记住「是哪一次发现的」,
|
|
1388
1455
|
* 而那个 id 在报告组装之前就得有。不给就现生成一个。
|
|
@@ -1394,13 +1461,36 @@ export declare class KnowledgeRuntime {
|
|
|
1394
1461
|
id?: string;
|
|
1395
1462
|
why?: string;
|
|
1396
1463
|
}>;
|
|
1464
|
+
/**
|
|
1465
|
+
* 归一段的轨迹(2026-10-18)。
|
|
1466
|
+
*
|
|
1467
|
+
* 这一段的产物以前只留在两处:任务里的流式输出(刷新就没),和事实表里最终写成的行
|
|
1468
|
+
* (只剩结果)。中间那步 —— 「模型给的这 283 个名字里,哪些命中了已有实体、哪些新建了
|
|
1469
|
+
* 候选、哪些因为不唯一没猜」—— 跑完就查不到了,而它恰好是坐标错了之后唯一能复盘的东西。
|
|
1470
|
+
*
|
|
1471
|
+
* **复用的那一次不落轨迹**:那一次什么都没做(指纹没变、一条事实都没重写),落一条
|
|
1472
|
+
* 「复用」只会把真正的运行挤出第一页。
|
|
1473
|
+
*/
|
|
1474
|
+
private recordNormalizeTrajectory;
|
|
1475
|
+
/**
|
|
1476
|
+
* 物化段的轨迹(2026-10-18):一个卡片分组 → 一张卡。
|
|
1477
|
+
*
|
|
1478
|
+
* 这一段的产物是卡片本身,所以「卡里有什么」已经查得到;查不到的是**这一次为什么这么排**:
|
|
1479
|
+
* 分组指纹、卡片组织的结论(模型排的还是机械拼的)、进了哪几条知识、正文里为什么链到
|
|
1480
|
+
* 那一张卡。这些是改完提示词、想知道「这次和上次差在哪」时唯一能对着看的东西。
|
|
1481
|
+
*
|
|
1482
|
+
* 粒度是**一组**而不是一个任务:一张卡组织失败,不该让同批其它卡的轨迹一起消失。
|
|
1483
|
+
*/
|
|
1484
|
+
private recordMaterializeTrajectory;
|
|
1397
1485
|
/**
|
|
1398
1486
|
* 轴注册表(0063 §3):Object / Action / Scene 的 canonical 身份。
|
|
1399
1487
|
*
|
|
1400
1488
|
* 与抽取轨迹**同一个数据库文件**(`<memoryDir>/knowledge.sqlite`):它们是同一层
|
|
1401
1489
|
* (领域实体与它的审计),而解析一条知识要同时读两边 —— 分两个文件只是多一次打开。
|
|
1402
1490
|
*/
|
|
1491
|
+
private axisRegistryOpening?;
|
|
1403
1492
|
axisRegistry(): Promise<AxisRegistry | null>;
|
|
1493
|
+
private openAxisRegistry;
|
|
1404
1494
|
/**
|
|
1405
1495
|
* 把记忆段里的 `knowledge.sqlite` 并进知识库文件(0062 v2)。
|
|
1406
1496
|
*
|
|
@@ -1420,7 +1510,21 @@ export declare class KnowledgeRuntime {
|
|
|
1420
1510
|
* 返回 `null` = 这个部署上没有注册表。调用方要如实写「这一次没查过」,
|
|
1421
1511
|
* 不能当成「没命中」。
|
|
1422
1512
|
*/
|
|
1513
|
+
resolveTrialAxisSet(input: {
|
|
1514
|
+
registry?: AxisRegistry;
|
|
1515
|
+
axes: TrialAxisSet;
|
|
1516
|
+
axesBlock?: AxisPromptBlock;
|
|
1517
|
+
runId: string;
|
|
1518
|
+
call?: ModelCall;
|
|
1519
|
+
sessionId?: string;
|
|
1520
|
+
modelRequest: {
|
|
1521
|
+
provider?: string;
|
|
1522
|
+
model?: string;
|
|
1523
|
+
reasoningEffort?: string;
|
|
1524
|
+
};
|
|
1525
|
+
}): Promise<TrialAxisSetResolution>;
|
|
1423
1526
|
resolveAxisMention(input: {
|
|
1527
|
+
registry?: AxisRegistry;
|
|
1424
1528
|
kind: AxisKind;
|
|
1425
1529
|
mention: string;
|
|
1426
1530
|
parentMention?: string;
|
|
@@ -1431,6 +1535,10 @@ export declare class KnowledgeRuntime {
|
|
|
1431
1535
|
* 与卡片层 `existing_id` 同一条纪律:模型凭一个不存在的 id 把两条知识写成一条是看不见的错误。
|
|
1432
1536
|
*/
|
|
1433
1537
|
preferMention?: string;
|
|
1538
|
+
/** 二次判定只接收本轮候选清单里经过校验的 ID。 */
|
|
1539
|
+
preferId?: string;
|
|
1540
|
+
/** false 时只查不建;补判的预检和候选命中使用它。 */
|
|
1541
|
+
create?: boolean;
|
|
1434
1542
|
/** 模型给这一轮的定义(0068)。只在新建、或给一个还没有定义的实体补一次。 */
|
|
1435
1543
|
description?: string;
|
|
1436
1544
|
}): Promise<AxisResolution | null>;
|
|
@@ -1462,6 +1570,10 @@ export declare class KnowledgeRuntime {
|
|
|
1462
1570
|
listAxisEntities(kind?: AxisKind, status?: AxisStatus): Promise<Array<AxisEntity & {
|
|
1463
1571
|
aliases: string[];
|
|
1464
1572
|
}> | null>;
|
|
1573
|
+
/** 对象轴的显式 related_to 关系,供管理界面与召回路线共用。 */
|
|
1574
|
+
listAxisRelations(entityId?: string): Promise<AxisRelation[] | null>;
|
|
1575
|
+
addAxisRelation(fromId: string, toId: string, evidence?: string): Promise<AxisRelation | null>;
|
|
1576
|
+
removeAxisRelation(id: string): Promise<boolean>;
|
|
1465
1577
|
/** 每个轴各有多少实体、其中几个待人确认。 */
|
|
1466
1578
|
axisStats(): Promise<Record<AxisKind, {
|
|
1467
1579
|
total: number;
|
|
@@ -1497,12 +1609,14 @@ export declare class KnowledgeRuntime {
|
|
|
1497
1609
|
/**
|
|
1498
1610
|
* Knowledge 库(0063 §2):事实真源。
|
|
1499
1611
|
*
|
|
1500
|
-
*
|
|
1612
|
+
* 与轴注册表共享经过校验的 `knowledge.db` 连接,使用各自的表。
|
|
1501
1613
|
* 两个模块互不认识,靠 id 字符串耦合 —— 代价是没有数据库级引用完整性,
|
|
1502
1614
|
* 收益是「一条知识挂了一个不存在的坐标」会被 §5.7 的坐标核验**报出来**,
|
|
1503
1615
|
* 而不是被数据库静默拒绝。
|
|
1504
1616
|
*/
|
|
1617
|
+
private knowledgeStoreOpening?;
|
|
1505
1618
|
knowledgeStore(): Promise<KnowledgeStore | null>;
|
|
1619
|
+
private openKnowledgeStore;
|
|
1506
1620
|
/** 收一条知识。归一化后文本一致时**合并并追加来源**,不新建(§5.2.2)。 */
|
|
1507
1621
|
ingestKnowledge(input: KnowledgeIngest): Promise<KnowledgeIngestResult | null>;
|
|
1508
1622
|
/**
|
|
@@ -1560,8 +1674,9 @@ export declare class KnowledgeRuntime {
|
|
|
1560
1674
|
private assetRoots;
|
|
1561
1675
|
private assetBucketNames;
|
|
1562
1676
|
/**
|
|
1563
|
-
* 还有没有人在引用这个桶 ——
|
|
1564
|
-
*
|
|
1677
|
+
* 还有没有人在引用这个桶 —— 判据是来源正文、来源 front matter 的 `metadata.assets`、
|
|
1678
|
+
* 卡片正文出现过 `_assets/<bucket>/`,或者它是 `image_publish` 写入的独立图床图片。
|
|
1679
|
+
* 独立图片没有来源/卡片引用是正常状态,必须保留。
|
|
1565
1680
|
*
|
|
1566
1681
|
* 为什么三处都要看:桶名是**内容哈希的前 12 位**(`convert/ingest.ts`),不是来源 id。
|
|
1567
1682
|
* 同一份内容以两个分类导入会共用同一个桶;而卡片正文会把图片引用**复制进去**
|
|
@@ -1570,6 +1685,11 @@ export declare class KnowledgeRuntime {
|
|
|
1570
1685
|
* 不看 `03_compiled/`:那是派生物,下一次 `rebuild` 会把指向已删图片的引用一起扔掉。
|
|
1571
1686
|
*/
|
|
1572
1687
|
private unreferencedBuckets;
|
|
1688
|
+
/**
|
|
1689
|
+
* `image_publish` 的图片不需要被来源或卡片引用。新写入的桶有明确标记;同时兼容
|
|
1690
|
+
* 标记加入前已发布的图片:它们以图片自身的 SHA-256 前 12 位作为桶名。
|
|
1691
|
+
*/
|
|
1692
|
+
private isPublishedImageBucket;
|
|
1573
1693
|
/**
|
|
1574
1694
|
* 回收 `source_raw/` 里**没有人再指向的底稿桶**(0067)。
|
|
1575
1695
|
*
|
|
@@ -1621,6 +1741,10 @@ export declare class KnowledgeRuntime {
|
|
|
1621
1741
|
deleted: number;
|
|
1622
1742
|
detached: number;
|
|
1623
1743
|
};
|
|
1744
|
+
events: {
|
|
1745
|
+
deleted: number;
|
|
1746
|
+
updated: number;
|
|
1747
|
+
};
|
|
1624
1748
|
assets: {
|
|
1625
1749
|
buckets: number;
|
|
1626
1750
|
files: number;
|
|
@@ -1677,6 +1801,7 @@ export declare class KnowledgeRuntime {
|
|
|
1677
1801
|
ingestTrialKnowledge(input: {
|
|
1678
1802
|
runId: string;
|
|
1679
1803
|
knowledge: TrialKnowledge[];
|
|
1804
|
+
sourceVersions?: Record<string, number | undefined>;
|
|
1680
1805
|
objects: TrialAxis[];
|
|
1681
1806
|
actions: TrialAxis[];
|
|
1682
1807
|
scenes: TrialAxis[];
|
|
@@ -1684,6 +1809,15 @@ export declare class KnowledgeRuntime {
|
|
|
1684
1809
|
saved: number;
|
|
1685
1810
|
merged: number;
|
|
1686
1811
|
skipped: number;
|
|
1812
|
+
/**
|
|
1813
|
+
* **写入失败**的条数,与 `skipped` 分开(0070)。
|
|
1814
|
+
*
|
|
1815
|
+
* `skipped` = 引文没通过核验(数据问题,重试无用);`failures` = 落库时抛错
|
|
1816
|
+
* (磁盘、锁、约束,基础设施问题,重试有意义)。合成一个数会让下游把两者
|
|
1817
|
+
* 说成同一句话,而它们的处置完全不同。
|
|
1818
|
+
*/
|
|
1819
|
+
failures: number;
|
|
1820
|
+
warnings: string[];
|
|
1687
1821
|
/**
|
|
1688
1822
|
* **报告里的知识 id → 库里的知识 id**(0069)。
|
|
1689
1823
|
*
|
|
@@ -1695,9 +1829,100 @@ export declare class KnowledgeRuntime {
|
|
|
1695
1829
|
*/
|
|
1696
1830
|
ids: Record<string, string>;
|
|
1697
1831
|
}>;
|
|
1698
|
-
/**
|
|
1832
|
+
/**
|
|
1833
|
+
* 把抽取到的 Event 写成独立事件实体,并按身份规则追加来源记录。
|
|
1834
|
+
*
|
|
1835
|
+
* Event 与 Knowledge 同层,写入 SQLite `event` 表;WikiCard 通过 `card_event` 关联表
|
|
1836
|
+
* 聚合 Event。Event 本体不进入 WikiCard 的 `card` 表。
|
|
1837
|
+
*
|
|
1838
|
+
* 判重顺序:明确的 external_id;完整时间 + 三轴 ID + 现象;否则只按来源文档内的
|
|
1839
|
+
* 核验引文识别。文本相似本身永远不触发跨文档合并。
|
|
1840
|
+
*/
|
|
1841
|
+
private pruneEvents;
|
|
1842
|
+
private syncEventReferences;
|
|
1843
|
+
ingestTrialEvents(input: {
|
|
1844
|
+
sourceId: string;
|
|
1845
|
+
runId: string;
|
|
1846
|
+
events: TrialEvent[];
|
|
1847
|
+
objects: TrialAxis[];
|
|
1848
|
+
actions: TrialAxis[];
|
|
1849
|
+
scenes: TrialAxis[];
|
|
1850
|
+
}): Promise<{
|
|
1851
|
+
saved: number;
|
|
1852
|
+
merged: number;
|
|
1853
|
+
skipped: number;
|
|
1854
|
+
ids: Record<string, string>;
|
|
1855
|
+
warnings: string[];
|
|
1856
|
+
}>;
|
|
1857
|
+
/** The stage runner shares this base's existing writer queue and audit database. */
|
|
1858
|
+
pipeline(): Promise<KnowledgePipeline>;
|
|
1859
|
+
private pipelineSources;
|
|
1860
|
+
private pipelineSource;
|
|
1861
|
+
/**
|
|
1862
|
+
* 抽取指纹(0070)。
|
|
1863
|
+
*
|
|
1864
|
+
* 判据是「这段提示词会不会变」,所以实体清单要按**本文真的提到**的条目收窄:小库发的是
|
|
1865
|
+
* 全集(`selection: 'full'`),直接哈希整块清单会让「新增一个与本文无关的实体」触发全库
|
|
1866
|
+
* 重抽 —— 而那正是既有测试钉住不许发生的退化。
|
|
1867
|
+
*
|
|
1868
|
+
* **已知的取舍**(不是疏漏):提示词里那份清单是 `promptEntries` 按相关度排/截出来的,
|
|
1869
|
+
* 而这里按字面包含关系重筛一遍。两者不完全等价 —— 「在提示词里但本文没有字面提到」的
|
|
1870
|
+
* 实体被改名时,这里不会失效。选择这条判据是因为另一条(原样哈希发出去的清单)与
|
|
1871
|
+
* 上面那条被测试钉住的产品规则直接冲突。残留风险由归一那一侧兜住:归一总是对着**实时**
|
|
1872
|
+
* 注册表重新解析坐标,所以模型当时的 `existing` 判断不会原样变成最终卡名。
|
|
1873
|
+
*
|
|
1874
|
+
* 它有两个调用点:抽取前判断能不能复用,以及归一成功后**刷新**已存的那一份。后者是必需的:
|
|
1875
|
+
* 归一学到的实体本来就出现在这份文档里,不刷新的话这份文档下次抽取永远复用不上。这与
|
|
1876
|
+
* `normalizationFingerprint` 存「补判之后」的快照是同一条规则,不是两套。
|
|
1877
|
+
*/
|
|
1878
|
+
private pipelineExtractionFingerprint;
|
|
1879
|
+
private normalizationFingerprint;
|
|
1880
|
+
private normalizePipelineSource;
|
|
1881
|
+
private activePipelineKnowledge;
|
|
1882
|
+
/**
|
|
1883
|
+
* 这一组现在能不能物化(有没有来源变了、新抽取待归一、或坐标还有歧义)。
|
|
1884
|
+
*
|
|
1885
|
+
* 抽成一处是因为它有**两个**调用点:阶段开始时的全量快照,与单组写回之前的复查。
|
|
1886
|
+
* 各写一份的话,「什么算变化」迟早会有两套说法。
|
|
1887
|
+
*/
|
|
1888
|
+
private needsNormalizationForGroup;
|
|
1889
|
+
/** 相关推荐的整库计划。它是增强,所以算不出来时给空表而不是把编译卡住。 */
|
|
1890
|
+
private relatedPlan;
|
|
1891
|
+
/** Independent, checkpointed Case -> Procedure compilation. No execution is inferred. */
|
|
1892
|
+
private deriveProcedures;
|
|
1893
|
+
/**
|
|
1894
|
+
* 一个分组的**事实指纹**:只有它变了才需要重新成卡。
|
|
1895
|
+
*
|
|
1896
|
+
* 抽成一处是因为它有**两个**调用点:阶段开始时的全库快照,与单组写回之前的复查。
|
|
1897
|
+
* 两处必须用同一个表达式,否则「什么算变化」就有两套说法。
|
|
1898
|
+
*/
|
|
1899
|
+
private pipelineGroupFingerprint;
|
|
1900
|
+
/**
|
|
1901
|
+
* **只读这一组**的事实指纹,写回之前复查用。
|
|
1902
|
+
*
|
|
1903
|
+
* 快照在阶段内是稳定的,但那有个前提:写入者都走同一条串行队列。别的进程、或同一个库的
|
|
1904
|
+
* 另一条路径(强制重归一复用同一个检查点 id、诊断载入示例、删除流程)不受它约束 ——
|
|
1905
|
+
* 那时「分组的知识行变了,而 head 指针没变」是可能的,只看 head 会漏掉,于是拿陈旧的
|
|
1906
|
+
* 行去写卡片(丢更新)。这里按坐标只读这一组,代价与该组的知识条数成正比,不扫全库。
|
|
1907
|
+
*/
|
|
1908
|
+
private organizeKnowledgeText;
|
|
1909
|
+
private renderOrganizedWiki;
|
|
1910
|
+
/** Conditions survive projection and wording changes because the compiler renders them itself. */
|
|
1911
|
+
private knowledgeBoundaryText;
|
|
1912
|
+
private freshGroupFingerprint;
|
|
1913
|
+
/**
|
|
1914
|
+
* 物化阶段的**一次**全库快照。
|
|
1915
|
+
*
|
|
1916
|
+
* 逐组现算会变成 O(组数 × 语料):每个分组要扫 4 遍全库(三次分组、一次知识),
|
|
1917
|
+
* 再加上每组一次图片分发与一次相关推荐 —— 几百张卡时单线程跑不完。这里全部算一次。
|
|
1918
|
+
*/
|
|
1919
|
+
private materializationSnapshot;
|
|
1920
|
+
private materializePipelineGroup;
|
|
1921
|
+
pipelineStatus(): Promise<PipelineStatus>;
|
|
1922
|
+
/** 轨迹列表(新→旧,不含报告本体)。`stage` 省略 = 三段一起。 */
|
|
1699
1923
|
listExtractionRuns(query?: {
|
|
1700
1924
|
docId?: string;
|
|
1925
|
+
stage?: TrajectoryStage;
|
|
1701
1926
|
limit?: number;
|
|
1702
1927
|
offset?: number;
|
|
1703
1928
|
}): Promise<ExtractionRunPage | null>;
|
|
@@ -1754,6 +1979,8 @@ export declare class KnowledgeRuntime {
|
|
|
1754
1979
|
* 抛异常不是异常路径,是必须有一条出口的路径。
|
|
1755
1980
|
*/
|
|
1756
1981
|
private settleProgressFailure;
|
|
1982
|
+
private settleProgressCancelled;
|
|
1983
|
+
private patchCompileOperation;
|
|
1757
1984
|
/** 这一趟的记录:正在跑就在槽位里,跑完了就在存档里。 */
|
|
1758
1985
|
private slotOrArchive;
|
|
1759
1986
|
/** 存一条已结束的记录,并(如果槽位还属于它)同步槽位。 */
|
|
@@ -1763,6 +1990,7 @@ export declare class KnowledgeRuntime {
|
|
|
1763
1990
|
* 它」—— 那两件事分别在 `enqueueCompile()` 与 `rebuild()` / `startCompile()` 里。
|
|
1764
1991
|
*/
|
|
1765
1992
|
private compileOnce;
|
|
1993
|
+
private prepareCompile;
|
|
1766
1994
|
/**
|
|
1767
1995
|
* The staged read path:
|
|
1768
1996
|
* 3) recall — multi-route (coordinate + keyword + vector) recall over
|
|
@@ -1796,6 +2024,11 @@ export declare class KnowledgeRuntime {
|
|
|
1796
2024
|
* 后续接入模型消歧时不需要改变召回合同。
|
|
1797
2025
|
*/
|
|
1798
2026
|
private coordinateRoute;
|
|
2027
|
+
/**
|
|
2028
|
+
* 关系路:只从查询直接命中的对象沿一跳 `related_to` 扩展到关联对象的卡片。
|
|
2029
|
+
* 不读 scopeId,也不扩展共享来源;关系候选先进入 RRF,再由重排筛选。
|
|
2030
|
+
*/
|
|
2031
|
+
private relationRoute;
|
|
1799
2032
|
/** 关键词路:FTS5 + BM25(0031)。索引不在时如实降级,不退回旧的计数打分。 */
|
|
1800
2033
|
private ftsRoute;
|
|
1801
2034
|
/**
|
|
@@ -1901,6 +2134,16 @@ export declare class KnowledgeRuntime {
|
|
|
1901
2134
|
rerankModel: string;
|
|
1902
2135
|
embeddingModelId: string;
|
|
1903
2136
|
};
|
|
2137
|
+
/** Installed resources become available without restarting the host. */
|
|
2138
|
+
reloadResources(): void;
|
|
2139
|
+
compileModelStatus(): {
|
|
2140
|
+
ready: boolean;
|
|
2141
|
+
message: string;
|
|
2142
|
+
};
|
|
2143
|
+
environmentProbe(kind: 'embedding' | 'rerank'): Promise<{
|
|
2144
|
+
ok: boolean;
|
|
2145
|
+
message: string;
|
|
2146
|
+
}>;
|
|
1904
2147
|
embeddingHealth(): Promise<Envelope<Record<string, unknown>>>;
|
|
1905
2148
|
/**
|
|
1906
2149
|
* Stage 5(旁路):读 SourceRaw 原文,**带配额**。
|
|
@@ -1915,13 +2158,18 @@ export declare class KnowledgeRuntime {
|
|
|
1915
2158
|
* 路径是知识库里的真实文件,读它与读这里的内容是同一份数据,而且没有配额。这样
|
|
1916
2159
|
* 「一次读不完」就不再等于「读不到」,也不会出现「以为拿到全文、其实只有前 4 万字符」。
|
|
1917
2160
|
*/
|
|
1918
|
-
sourceTruth(query: string, limit?: number, maxChars?: number, lineage?: LineageContext, offset?: number): Promise<Envelope<{
|
|
2161
|
+
sourceTruth(query: string, limit?: number, maxChars?: number, lineage?: LineageContext, offset?: number, sourceOffset?: number): Promise<Envelope<{
|
|
1919
2162
|
sources: SourceRawRead[];
|
|
1920
2163
|
sourceReadId: string;
|
|
1921
2164
|
maxChars: number;
|
|
1922
2165
|
offset: number;
|
|
1923
2166
|
returnedChars: number;
|
|
1924
2167
|
truncated: boolean;
|
|
2168
|
+
hasMoreInCurrentPage: boolean;
|
|
2169
|
+
totalMatchedSources: number;
|
|
2170
|
+
sourceOffset: number;
|
|
2171
|
+
hasMoreSources: boolean;
|
|
2172
|
+
nextSourceOffset?: number;
|
|
1925
2173
|
lineage?: LineageContext;
|
|
1926
2174
|
}>>;
|
|
1927
2175
|
graphQuery(action: 'entity' | 'neighbors' | 'path' | 'list' | 'types', entityId?: string, entityType?: string, depth?: number, options?: {
|
|
@@ -1945,10 +2193,7 @@ export declare class KnowledgeRuntime {
|
|
|
1945
2193
|
audit(action: string, metadata: Record<string, unknown>): Promise<void>;
|
|
1946
2194
|
}
|
|
1947
2195
|
/**
|
|
1948
|
-
*
|
|
1949
|
-
* `<agentRoot>/domain_knowledge/<知识库 id>`。这里保留旧名字只为让外部调用点
|
|
1950
|
-
* (注册表的默认库、测试)有个可迁移的入口;新代码一律用 `layout.ts` 的
|
|
1951
|
-
* `knowledgeBaseRoot()`。它返回的是**旧布局**的位置,也就是迁移的来源。
|
|
2196
|
+
* 默认知识库根路径。知识库已经属于固定的 DSH Agent 根目录,旧目录不再作为回退。
|
|
1952
2197
|
*/
|
|
1953
2198
|
export declare function defaultKnowledgeRoot(): string;
|
|
1954
2199
|
export {};
|