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/src/types.ts
CHANGED
|
@@ -7,10 +7,8 @@ export type KnowledgeStatus = CardStatus
|
|
|
7
7
|
/**
|
|
8
8
|
* 知识卡片的 entity_type 白名单。
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* 返回 `SCHEMA_TYPE_INVALID`,`readCards` 也会跳过 —— 于是排查思路**永远进不了 wikiNotes,
|
|
13
|
-
* 也就永远召不回来**。列表本身在 `diagnosis/schema.ts` 里定义一次,这里只做联合。
|
|
10
|
+
* 诊断卡片类型留在联合里供历史数据兼容。当前排查记录落 SourceRaw,Case 是只读投影;
|
|
11
|
+
* 新运行不会创建 `diagnosis/case` WikiCard。列表本身在 `diagnosis/schema.ts` 里定义一次。
|
|
14
12
|
*/
|
|
15
13
|
export type SchemaType =
|
|
16
14
|
| 'concept' | 'metric' | 'table' | 'event' | 'playbook' | 'case'
|
|
@@ -19,8 +17,24 @@ export type SchemaType =
|
|
|
19
17
|
export type EmbeddingProvider = 'wemm-python' | 'ollama' | 'none'
|
|
20
18
|
export type EmbeddingDevice = 'auto' | 'mps' | 'cpu'
|
|
21
19
|
export type RerankProvider = 'bert-python' | 'none'
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 知识库编译使用的模型路由。
|
|
23
|
+
*
|
|
24
|
+
* 这是知识库的部署配置,不是 Knowledge / WikiCard 的事实数据:`default` 只引用
|
|
25
|
+
* DSH 当前默认模型,`fixed` 才在本库注册表里保存一条明确的 provider + model。
|
|
26
|
+
*/
|
|
27
|
+
export type CompileModelMode = 'default' | 'fixed'
|
|
28
|
+
export interface CompileModelSelection {
|
|
29
|
+
reasoningEffort?: string
|
|
30
|
+
mode: CompileModelMode
|
|
31
|
+
provider?: string
|
|
32
|
+
model?: string
|
|
33
|
+
}
|
|
34
|
+
export const DEFAULT_COMPILE_MODEL: CompileModelSelection = { mode: 'default' }
|
|
35
|
+
|
|
22
36
|
/** 召回与结果诊断中的路线名。`graph` 仅用于后置 boost / 扩展,不是 RecallMode。 */
|
|
23
|
-
export type RecallRoute = 'fts' | 'vector' | 'coordinate' | 'graph'
|
|
37
|
+
export type RecallRoute = 'fts' | 'vector' | 'coordinate' | 'relation' | 'graph'
|
|
24
38
|
/**
|
|
25
39
|
* 召回路线选择(0031 起语义有变)。
|
|
26
40
|
*
|
|
@@ -28,11 +42,8 @@ export type RecallRoute = 'fts' | 'vector' | 'coordinate' | 'graph'
|
|
|
28
42
|
* 不参与候选路线选择。
|
|
29
43
|
*/
|
|
30
44
|
export type RecallMode = 'fts' | 'vector' | 'hybrid'
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import { join, resolve } from 'node:path'
|
|
34
|
-
import type { DataError, Envelope as WireEnvelope } from 'dsh-data-contracts/envelope'
|
|
35
|
-
import type { LineageContext, LineageRef } from 'dsh-data-contracts/refs'
|
|
45
|
+
import type { DataError, Envelope as WireEnvelope } from '#contracts'
|
|
46
|
+
import type { LineageContext, LineageRef } from '#contracts'
|
|
36
47
|
|
|
37
48
|
export interface KnowledgeError extends DataError {
|
|
38
49
|
code: string
|
|
@@ -46,26 +57,24 @@ export interface KnowledgeError extends DataError {
|
|
|
46
57
|
* (`spec/contracts/envelope.json`) with the error narrowed to `KnowledgeError`,
|
|
47
58
|
* so `retryable` / `suggestion` stay visible to callers and the panel.
|
|
48
59
|
*
|
|
49
|
-
* The shape itself lives in
|
|
60
|
+
* The shape itself lives in the shared contract source — the status rule
|
|
50
61
|
* "warnings make it partial" is defined once there, not re-spelled here.
|
|
51
62
|
*/
|
|
52
63
|
export type Envelope<T> = WireEnvelope<T, KnowledgeError>
|
|
53
64
|
|
|
54
65
|
export interface KnowledgeConfig {
|
|
55
66
|
/**
|
|
56
|
-
* **Tita Agent 根路径** ——
|
|
67
|
+
* **Tita Agent 根路径** —— 固定为 DSH 下的 `tita-agent` 专属目录。
|
|
57
68
|
*
|
|
58
69
|
* 根路径下固定四段:`domain_knowledge/`(知识树,按知识库 id 分叉)、
|
|
59
70
|
* `output/`(交付物,二级按日期)、`tmp/`(运行期临时文件,二级按日期)、
|
|
60
71
|
* `resource/`(模型、Python 环境、注册表)。
|
|
61
|
-
*
|
|
72
|
+
* 用户可在设置里查看并打开它,但不能从设置里切换;见 `layout.ts`。
|
|
62
73
|
*/
|
|
63
74
|
agentRoot: string
|
|
64
75
|
/**
|
|
65
|
-
* @deprecated 0029
|
|
66
|
-
*
|
|
67
|
-
* 值非空且新位置还是空的时,把旧树搬进 `<agentRoot>/domain_knowledge/default`。
|
|
68
|
-
* 搬完(或本来就没有)它就不再有意义。
|
|
76
|
+
* @deprecated 0029:旧布局的知识树根。字段仅为兼容旧配置保留;它不再可设置,
|
|
77
|
+
* 不再决定路径,也不会触发旧树读取或迁移。
|
|
69
78
|
*/
|
|
70
79
|
rootDir: string
|
|
71
80
|
schemaTypes: SchemaType[]
|
|
@@ -120,11 +129,11 @@ export interface KnowledgeConfig {
|
|
|
120
129
|
* 组织(表达层)。两步都开着才是完整的「Knowledge Compiler + Wiki Materializer」。
|
|
121
130
|
*/
|
|
122
131
|
cardOrganize: boolean
|
|
123
|
-
/** Python 解释器。空串 =
|
|
132
|
+
/** Python 解释器。空串 = 自动(隔离依赖环境,再退回 `DSH_PYTHON` / `python3`)。 */
|
|
124
133
|
python: string
|
|
125
134
|
embeddingProvider: EmbeddingProvider
|
|
126
135
|
embeddingBaseUrl: string
|
|
127
|
-
/** 嵌入模型:一个本地目录或一个 HF 模型名。空串 =
|
|
136
|
+
/** 嵌入模型:一个本地目录或一个 HF 模型名。空串 = 自动(根路径下的本地模型,再退回 HF 名)。 */
|
|
128
137
|
embeddingModel: string
|
|
129
138
|
embeddingDimension: number
|
|
130
139
|
embeddingBatchSize: number
|
|
@@ -174,14 +183,6 @@ export interface KnowledgeConfig {
|
|
|
174
183
|
rerankTimeoutMs: number
|
|
175
184
|
}
|
|
176
185
|
|
|
177
|
-
/**
|
|
178
|
-
* 旧的「家当」目录(0029 之前模型与虚拟环境住在这里)。
|
|
179
|
-
*
|
|
180
|
-
* 现在它们是**兜底**:路径解析优先看 `<agentRoot>/resource/`,找不到再回这里,
|
|
181
|
-
* 最后才退回裸的模型名(从 HuggingFace 拉)。这样搬完家当、或还没搬完家当,
|
|
182
|
-
* 行为都对;而 `TITA_DATA_AGENT_HOME` 仍然是覆盖它的入口。
|
|
183
|
-
*/
|
|
184
|
-
export const legacyResourceHome = (): string => resolve(process.env.TITA_DATA_AGENT_HOME || join(homedir(), '.tita-data-agent'))
|
|
185
186
|
/** 本地模型目录名。与 `layout.ts` 的 `resourceModels()` 拼在一起就是主位置。 */
|
|
186
187
|
export const LOCAL_EMBEDDING_MODEL_DIR = 'WeMM-Embedding-2B-Quantized'
|
|
187
188
|
/**
|
|
@@ -229,10 +230,9 @@ export const DEFAULT_KNOWLEDGE_CONFIG: RuntimeKnowledgeConfig = {
|
|
|
229
230
|
// 卡片组织(模型)默认**开**:Knowledge 只是事实层,Wiki 卡片正文必须经过这一步
|
|
230
231
|
// 物化成可读的表达。只有显式写 `false` / `0` 才关闭兼容路径。
|
|
231
232
|
cardOrganize: !['false', '0'].includes((process.env.DSH_KNOWLEDGE_CARD_ORGANIZE ?? '').trim().toLowerCase()),
|
|
232
|
-
// 0029
|
|
233
|
-
//
|
|
234
|
-
|
|
235
|
-
python: process.env.DSH_PYTHON || '',
|
|
233
|
+
// 0029:空串 = 自动。优先用 `<agentRoot>/resource/python/` 的隔离依赖环境;
|
|
234
|
+
// DSH_PYTHON 只作为创建该环境的基础解释器和未准备时的运行时回退。
|
|
235
|
+
python: '',
|
|
236
236
|
embeddingProvider: 'wemm-python',
|
|
237
237
|
embeddingBaseUrl: process.env.DSH_EMBEDDING_BASE_URL || 'http://127.0.0.1:11434',
|
|
238
238
|
embeddingModel: process.env.DSH_EMBEDDING_MODEL || process.env.DSH_EMBEDDING_MODEL_PATH || '',
|
|
@@ -243,7 +243,8 @@ export const DEFAULT_KNOWLEDGE_CONFIG: RuntimeKnowledgeConfig = {
|
|
|
243
243
|
embeddingDevice: (process.env.DSH_EMBEDDING_DEVICE as 'auto' | 'mps' | 'cpu' | undefined) || 'auto',
|
|
244
244
|
recallTopK: Number(process.env.DSH_KNOWLEDGE_RECALL_TOP_K || 10),
|
|
245
245
|
recallCandidatePool: Number(process.env.DSH_KNOWLEDGE_CANDIDATE_POOL || 50),
|
|
246
|
-
|
|
246
|
+
// 默认与设置侧栏的产品行为一致:召回固定为多路径融合。
|
|
247
|
+
recallMode: 'hybrid',
|
|
247
248
|
// 阈值初值:关键词与重排沿用 WeKnora 的出厂值(0.3 / 0.2),**向量阈值必须改** ——
|
|
248
249
|
// 见下。
|
|
249
250
|
keywordThreshold: Number(process.env.DSH_KNOWLEDGE_KEYWORD_THRESHOLD || 0.3),
|
|
@@ -505,12 +506,12 @@ export interface WikiCardVersion {
|
|
|
505
506
|
export interface SearchHit extends WikiNote {
|
|
506
507
|
score: number
|
|
507
508
|
/** 坐标路由也是一条正式召回路由,不能在融合后写进类型之外。 */
|
|
508
|
-
match: 'fts' | 'vector' | 'coordinate' | 'graph' | 'hybrid'
|
|
509
|
+
match: 'fts' | 'vector' | 'coordinate' | 'relation' | 'graph' | 'hybrid'
|
|
509
510
|
/**
|
|
510
511
|
* 这个命中在每一路里的**名次**(1 起,0031)。
|
|
511
512
|
*
|
|
512
513
|
* 融合改用 RRF 之后,名次是唯一进入融合的量 —— 所以它必须留痕:界面上的
|
|
513
|
-
*
|
|
514
|
+
* 各路状态、`match` 的推导、以及「为什么这条排第一」都读它。
|
|
514
515
|
* 缺失 = 那一路没有召回它。
|
|
515
516
|
*/
|
|
516
517
|
ranks?: Partial<Record<RecallRoute, number>>
|
|
@@ -558,6 +559,12 @@ export interface RecallHit extends SearchHit {
|
|
|
558
559
|
export interface RecallKnowledge {
|
|
559
560
|
id: string
|
|
560
561
|
text: string
|
|
562
|
+
/** Citation anchors are checked; semantic entailment is not established. */
|
|
563
|
+
claimVerification?: 'unverified'
|
|
564
|
+
requiresReview?: boolean
|
|
565
|
+
evidenceStatus?: 'current' | 'historical' | 'unversioned' | 'missing' | 'human'
|
|
566
|
+
sourceVersion?: number
|
|
567
|
+
currentSourceVersion?: number
|
|
561
568
|
/**
|
|
562
569
|
* Knowledge 的真值状态。**如实带出来,不许静默过滤**:Card review 不是 Knowledge 验证,
|
|
563
570
|
* 因此 candidate / disputed / deprecated 都必须让上层看到。
|
|
@@ -700,6 +707,8 @@ export interface RecallTimings {
|
|
|
700
707
|
ftsMs: number
|
|
701
708
|
/** Coordinate 路:注册表 OAS 解析 + 卡片坐标命中 + Section 展开。 */
|
|
702
709
|
coordinateMs: number
|
|
710
|
+
/** 对象关系路:沿显式 related_to 关系展开候选。 */
|
|
711
|
+
relationMs?: number
|
|
703
712
|
/** 向量路整体(= `embedMs` + `scanMs` + 阈值与排序)。 */
|
|
704
713
|
vectorMs: number
|
|
705
714
|
/** 其中:查询编码。**首次含模型加载**,所以它可能是 8000ms 而不是 270ms。 */
|
|
@@ -741,6 +750,8 @@ export interface RecallLedgerRow {
|
|
|
741
750
|
export interface RecallLedger {
|
|
742
751
|
/** Coordinate 路:坐标命中后展开的 Section 候选。 */
|
|
743
752
|
coordinate: RecallLedgerRow[]
|
|
753
|
+
/** 关系路:查询命中对象的一跳 related_to 候选。 */
|
|
754
|
+
relation: RecallLedgerRow[]
|
|
744
755
|
/** 关键词路:`rows` 含没过阈值的那些。 */
|
|
745
756
|
fts: RecallLedgerRow[]
|
|
746
757
|
/** 向量路:同上。 */
|
|
@@ -797,7 +808,7 @@ export interface RecallResult {
|
|
|
797
808
|
/** 融合之前每一路的超采深度(0031)。 */
|
|
798
809
|
candidatePool: number
|
|
799
810
|
/**
|
|
800
|
-
*
|
|
811
|
+
* 多路融合**去重之后**的候选条数。
|
|
801
812
|
*
|
|
802
813
|
* 它和相邻那两个数都不是一回事,混用就是「召回了 17 + 2 条,融合后怎么变成 0」的来源:
|
|
803
814
|
* `candidatePool` 是融合前每一路各自的超采深度(50),`fusedCount` 才是融合后的池子
|
|
@@ -858,6 +869,8 @@ export interface KnowledgeBase {
|
|
|
858
869
|
* 空串 = 没有备注(此时提示词里那一段整个不出现)。
|
|
859
870
|
*/
|
|
860
871
|
extractionNote: string
|
|
872
|
+
/** 编译模型路由:默认跟随 DSH,或固定到模型目录中的一项。 */
|
|
873
|
+
compileModel: CompileModelSelection
|
|
861
874
|
createdAt: string
|
|
862
875
|
updatedAt: string
|
|
863
876
|
sourceCount: number
|
|
@@ -984,6 +997,15 @@ export interface DocumentDeleteImpact {
|
|
|
984
997
|
shared: number
|
|
985
998
|
items: Array<{ entityId: string; entityType: string; title: string; exclusive: boolean }>
|
|
986
999
|
}
|
|
1000
|
+
events: {
|
|
1001
|
+
/** 提到这份文档的独立 Event 条数。 */
|
|
1002
|
+
total: number
|
|
1003
|
+
/** 只由这份文档支撑 —— 删除文档后 Event 一并删除。 */
|
|
1004
|
+
exclusive: number
|
|
1005
|
+
/** 还有其他来源 —— Event 保留,只移除这份来源记录。 */
|
|
1006
|
+
shared: number
|
|
1007
|
+
items: Array<{ id: string; title: string; occurredAt: string | null; exclusive: boolean }>
|
|
1008
|
+
}
|
|
987
1009
|
/** 这份文档的抽取轨迹条数,一起删。 */
|
|
988
1010
|
extractionRuns: number
|
|
989
1011
|
}
|
|
@@ -1186,6 +1208,10 @@ export interface OperationDetail {
|
|
|
1186
1208
|
phases?: {
|
|
1187
1209
|
/** Extract:这一轮抽出的 Knowledge 条数。 */
|
|
1188
1210
|
knowledge: number
|
|
1211
|
+
/** Extract:这一轮抽出的 Event 条数。 */
|
|
1212
|
+
events?: number
|
|
1213
|
+
/** Resolve:按稳定 Event 身份并入已有事件的条数。 */
|
|
1214
|
+
eventsMerged?: number
|
|
1189
1215
|
/** Resolve:命中已有轴实体 / 新建候选 / 作用域不确定。 */
|
|
1190
1216
|
axesMatched: number
|
|
1191
1217
|
axesCreated: number
|
package/src/wiki-finalize.ts
CHANGED
|
@@ -167,6 +167,34 @@ export function cardKey(card: { entityType: string; entityId: string }): string
|
|
|
167
167
|
* 弱的那一类是有用的:知识库刚建起来时,关系一条都没有,而「这几张卡来自同一篇文章」
|
|
168
168
|
* 恰好是人最需要的导航。
|
|
169
169
|
*/
|
|
170
|
+
/**
|
|
171
|
+
* 把「按**卡片身份**」的相关推荐计划,映射到「按**分组键**」(0070)。
|
|
172
|
+
*
|
|
173
|
+
* 两个键空间不同:`planRelated` 的键是 `type:entityId`,而物化阶段的分组键是坐标
|
|
174
|
+
* (`objectId\u0001actionId\u0001sceneId`)。不映射会出现一个**静默的**退化:
|
|
175
|
+
* `organizeCard` 拿不到「可引用的邻居」,而模型一旦照样写出 `[[名字]]`,校验会判
|
|
176
|
+
* `ORGANIZE_UNKNOWN_REFERENCE`,整组物化失败、卡片永远写不出来。
|
|
177
|
+
*
|
|
178
|
+
* 只映射**已经有卡片**的分组:新建的卡片在相关计划里本来就不存在(与旧的
|
|
179
|
+
* `relatedForCard(existing)` 行为一致)。键用卡片自己的类型,也与旧路径一致。
|
|
180
|
+
*/
|
|
181
|
+
/** `T` 是相关推荐条目的形状:调用方按自己的投影传进来,这里只管键的映射。 */
|
|
182
|
+
export function relatedByGroupKey<T>(
|
|
183
|
+
groups: ReadonlyArray<{ key: string; cardId?: string }>,
|
|
184
|
+
cardKeyOf: (groupKey: string) => string | undefined,
|
|
185
|
+
plan: ReadonlyMap<string, T[]>,
|
|
186
|
+
): Map<string, T[]> {
|
|
187
|
+
const mapped = new Map<string, T[]>()
|
|
188
|
+
for (const group of groups) {
|
|
189
|
+
if (group.cardId === undefined) continue
|
|
190
|
+
const key = cardKeyOf(group.key)
|
|
191
|
+
if (key === undefined) continue
|
|
192
|
+
const entries = plan.get(key)
|
|
193
|
+
if (entries !== undefined) mapped.set(group.key, entries)
|
|
194
|
+
}
|
|
195
|
+
return mapped
|
|
196
|
+
}
|
|
197
|
+
|
|
170
198
|
export function planRelated(
|
|
171
199
|
cards: Array<Pick<KnowledgeCard, 'entityType' | 'entityId' | 'title' | 'sourceRefs'>>,
|
|
172
200
|
relations: Array<{ fromKey: string; toKey: string }>,
|
package/src/wiki-materialize.ts
CHANGED
|
@@ -84,7 +84,11 @@ export function coordinateIdsOf(
|
|
|
84
84
|
scene: string | null,
|
|
85
85
|
): CardCoordinate {
|
|
86
86
|
const idOf = (list: TrialAxis[], name: string | null): string =>
|
|
87
|
-
name === null ? '' :
|
|
87
|
+
name === null ? '' : (() => {
|
|
88
|
+
const axis = list.find(item => item.name === name)
|
|
89
|
+
// ambiguous 仍保留 mention 供 review,但不能写入一个看似有效的猜测 id。
|
|
90
|
+
return axis?.outcome === 'ambiguous' ? '' : axis?.id ?? ''
|
|
91
|
+
})()
|
|
88
92
|
return {
|
|
89
93
|
objectId: idOf(axes.objects, object),
|
|
90
94
|
actionId: idOf(axes.actions, action),
|
|
@@ -107,6 +111,10 @@ export function candidatesFromReport(input: {
|
|
|
107
111
|
report: TrialReport
|
|
108
112
|
profileId: SchemaType
|
|
109
113
|
sourceId: string
|
|
114
|
+
/** 坐标 ID → 该坐标下全部独立 Event ID。 */
|
|
115
|
+
eventIdsByCoordinate?: Record<string, string[]>
|
|
116
|
+
/** 本次试跑的临时 Event id → 已落库的 Event id。 */
|
|
117
|
+
eventIds?: Record<string, string>
|
|
110
118
|
}): MaterializeResult {
|
|
111
119
|
const { report, profileId, sourceId } = input
|
|
112
120
|
const byId = new Map(report.knowledge.map(item => [item.id, item]))
|
|
@@ -116,12 +124,9 @@ export function candidatesFromReport(input: {
|
|
|
116
124
|
let unresolvedCoordinates = 0
|
|
117
125
|
|
|
118
126
|
for (const card of report.wikiCards) {
|
|
119
|
-
// 一条 Knowledge 都没引用到的卡不建 —— 空壳卡没有任何东西可召回,
|
|
120
|
-
// 而它占的 id 会让下一份真正说了点什么的文档并进这张空卡里。
|
|
121
127
|
const items = card.placements
|
|
122
128
|
.map(placement => byId.get(placement.item))
|
|
123
129
|
.filter((item): item is TrialKnowledge => item !== undefined)
|
|
124
|
-
if (items.length === 0) continue
|
|
125
130
|
|
|
126
131
|
/**
|
|
127
132
|
* 撞名检测。键是**坐标**而不是卡名 —— 要抓的正是「两个不同坐标、同一个名字」。
|
|
@@ -140,6 +145,19 @@ export function candidatesFromReport(input: {
|
|
|
140
145
|
const usable = coordinateIsEmpty(ids) ? undefined : ids
|
|
141
146
|
if (usable === undefined) unresolvedCoordinates += 1
|
|
142
147
|
|
|
148
|
+
// Event 只有三轴都明确归一后才能挂到坐标 WikiCard。部分坐标仍保留在 Event
|
|
149
|
+
// 元数据和原文里,但不能让它被误聚合进某个更宽泛的坐标卡。
|
|
150
|
+
const completeCoordinate = Boolean(ids.objectId && ids.actionId && ids.sceneId)
|
|
151
|
+
const coordinateKey = `${ids.objectId}\u0001${ids.actionId}\u0001${ids.sceneId}`
|
|
152
|
+
const eventIds = completeCoordinate
|
|
153
|
+
? input.eventIdsByCoordinate?.[coordinateKey]
|
|
154
|
+
?? card.events.map(id => input.eventIds?.[id]).filter((id): id is string => Boolean(id))
|
|
155
|
+
: []
|
|
156
|
+
if (items.length === 0) continue
|
|
157
|
+
const knowledgeBody = renderFallbackBody(card.placements, byId)
|
|
158
|
+
const body = knowledgeBody
|
|
159
|
+
const evidence = evidenceOf(items, sourceId)
|
|
160
|
+
|
|
143
161
|
cards.push({
|
|
144
162
|
candidate: {
|
|
145
163
|
kind: 'entity',
|
|
@@ -148,7 +166,7 @@ export function candidatesFromReport(input: {
|
|
|
148
166
|
// 旧的无分隔拼接标题继续参与召回与判重,但不再占据展示标题。
|
|
149
167
|
aliases: [...new Set([legacyCardNameFor(card.object, card.action, card.scene)])]
|
|
150
168
|
.filter(alias => alias !== card.name),
|
|
151
|
-
body
|
|
169
|
+
body,
|
|
152
170
|
...(items[0] ? { summary: items[0].text } : {}),
|
|
153
171
|
/**
|
|
154
172
|
* 证据取这条卡里**第一条核对得上的引文**。
|
|
@@ -157,7 +175,8 @@ export function candidatesFromReport(input: {
|
|
|
157
175
|
* 逐条知识各自的出处留在 Knowledge 上(那是真源)。所以这里挑一条就够,
|
|
158
176
|
* 不把每条知识的引文都堆到卡片上:那会让同一句话在库里存很多份。
|
|
159
177
|
*/
|
|
160
|
-
evidence
|
|
178
|
+
evidence,
|
|
179
|
+
fields: { event_refs: JSON.stringify([...new Set(eventIds)]) },
|
|
161
180
|
confidence: 0.7,
|
|
162
181
|
},
|
|
163
182
|
...(usable === undefined ? {} : { coordinate: usable }),
|
package/src/wiki-trial-types.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { KnowledgeContent, KnowledgeKind } from './knowledge-contract.js'
|
|
1
2
|
/**
|
|
2
3
|
* Wiki 抽取试跑(0063)的**类型真源**。
|
|
3
4
|
*
|
|
@@ -48,6 +49,9 @@ export interface TrialSource {
|
|
|
48
49
|
* **只有 `text` 是内容**,其余全是索引与出处。
|
|
49
50
|
*/
|
|
50
51
|
export interface TrialKnowledge {
|
|
52
|
+
scopeIdentity?: boolean
|
|
53
|
+
kind?: KnowledgeKind
|
|
54
|
+
data?: KnowledgeContent
|
|
51
55
|
id: string
|
|
52
56
|
text: string
|
|
53
57
|
/** 三个轴实体的**名字**,不是 id —— 换成 id 是第 4 步的事。 */
|
|
@@ -75,6 +79,38 @@ export interface TrialKnowledge {
|
|
|
75
79
|
noCoordinate: boolean
|
|
76
80
|
}
|
|
77
81
|
|
|
82
|
+
export type TrialEventStepKind = 'observation' | 'check' | 'action' | 'result' | 'conclusion'
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* 一次具体发生。Event 与 Knowledge 并列抽取:Event 记录本次经过,Knowledge 记录可复用内容。
|
|
86
|
+
* 坐标名已由同一套轴注册表归一;来源引文由本地按原文核验。
|
|
87
|
+
*/
|
|
88
|
+
export interface TrialEvent {
|
|
89
|
+
id: string
|
|
90
|
+
externalId: string | null
|
|
91
|
+
title: string
|
|
92
|
+
summary: string
|
|
93
|
+
object: string | null
|
|
94
|
+
action: string | null
|
|
95
|
+
scene: string | null
|
|
96
|
+
occurredAt: string | null
|
|
97
|
+
symptom: string | null
|
|
98
|
+
timeline: Array<{
|
|
99
|
+
id: string
|
|
100
|
+
type: TrialEventStepKind
|
|
101
|
+
description: string
|
|
102
|
+
result: string | null
|
|
103
|
+
at: string | null
|
|
104
|
+
sources: TrialSource[]
|
|
105
|
+
}>
|
|
106
|
+
rootCause: string | null
|
|
107
|
+
rootCauseStatus: 'confirmed' | 'suspected' | null
|
|
108
|
+
outcome: string | null
|
|
109
|
+
missing: string[]
|
|
110
|
+
sources: TrialSource[]
|
|
111
|
+
noCoordinate: boolean
|
|
112
|
+
}
|
|
113
|
+
|
|
78
114
|
/**
|
|
79
115
|
* 一个轴实体。
|
|
80
116
|
*
|
|
@@ -142,6 +178,8 @@ export interface TrialWikiCard {
|
|
|
142
178
|
/** 系统按坐标推导的自然语言展示标题。 */
|
|
143
179
|
name: string
|
|
144
180
|
placements: TrialPlacement[]
|
|
181
|
+
/** 同一坐标下的 Event 引用;Event 自身仍保留独立身份与来源。 */
|
|
182
|
+
events: string[]
|
|
145
183
|
}
|
|
146
184
|
|
|
147
185
|
/**
|
|
@@ -155,10 +193,13 @@ export interface TrialMatrixGroup {
|
|
|
155
193
|
scene: string
|
|
156
194
|
/** 落在这一组的知识条数。 */
|
|
157
195
|
knowledge: number
|
|
196
|
+
/** 落在这一组的事件数。 */
|
|
197
|
+
events: number
|
|
158
198
|
/** 这一组的 Wiki Card 名。没有成卡时是空串。 */
|
|
159
199
|
card: string
|
|
160
200
|
/** 这一组里的知识 id,按它们在报告里的顺序。 */
|
|
161
201
|
items: string[]
|
|
202
|
+
eventItems: string[]
|
|
162
203
|
}
|
|
163
204
|
|
|
164
205
|
/** 矩阵的一格。**场景落在格子内部**,不进坐标轴。 */
|
|
@@ -169,6 +210,7 @@ export interface TrialMatrixCell {
|
|
|
169
210
|
groups: TrialMatrixGroup[]
|
|
170
211
|
/** 这一格的合计条数。 */
|
|
171
212
|
knowledge: number
|
|
213
|
+
events: number
|
|
172
214
|
}
|
|
173
215
|
|
|
174
216
|
/**
|
|
@@ -184,6 +226,7 @@ export interface TrialMatrixLoose {
|
|
|
184
226
|
name: string
|
|
185
227
|
groups: TrialMatrixGroup[]
|
|
186
228
|
knowledge: number
|
|
229
|
+
events: number
|
|
187
230
|
}
|
|
188
231
|
|
|
189
232
|
export interface TrialMatrix {
|
|
@@ -198,6 +241,8 @@ export interface TrialMatrix {
|
|
|
198
241
|
noObject: TrialMatrixLoose[]
|
|
199
242
|
/** 三个分量都空的知识条数。它不进矩阵、不成卡,只被全库命中。 */
|
|
200
243
|
noCoordinate: number
|
|
244
|
+
/** 有坐标但未能归入格子的事件数。 */
|
|
245
|
+
noCoordinateEvents: number
|
|
201
246
|
/** 有知识的格子数。 */
|
|
202
247
|
withKnowledge: number
|
|
203
248
|
/** 有内容的格子数(有知识或有卡)。 */
|
|
@@ -253,6 +298,26 @@ export interface TrialAudit {
|
|
|
253
298
|
dropped: Array<{ quote: string; why: string }>
|
|
254
299
|
}
|
|
255
300
|
|
|
301
|
+
/** 模型端返回的本次调用用量;缓存字段与普通输入 token 分开计数。 */
|
|
302
|
+
export interface TrialTokenUsage {
|
|
303
|
+
inputTokens?: number
|
|
304
|
+
outputTokens?: number
|
|
305
|
+
totalTokens?: number
|
|
306
|
+
cacheReadTokens?: number
|
|
307
|
+
cacheWriteTokens?: number
|
|
308
|
+
reasoningTokens?: number
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/** 坐标补判的模型调用轨迹,和主抽取请求分开保存。 */
|
|
312
|
+
export interface TrialModelCallTrace {
|
|
313
|
+
ok: boolean
|
|
314
|
+
why?: string
|
|
315
|
+
request?: { provider?: string; model?: string; reasoningEffort?: string; sessionId?: string }
|
|
316
|
+
prompt: { system: string; user: string }
|
|
317
|
+
response?: string
|
|
318
|
+
usage?: TrialTokenUsage
|
|
319
|
+
}
|
|
320
|
+
|
|
256
321
|
export interface TrialReport {
|
|
257
322
|
title: string
|
|
258
323
|
subject: string
|
|
@@ -263,6 +328,7 @@ export interface TrialReport {
|
|
|
263
328
|
actions: TrialAxis[]
|
|
264
329
|
scenes: TrialAxis[]
|
|
265
330
|
knowledge: TrialKnowledge[]
|
|
331
|
+
events: TrialEvent[]
|
|
266
332
|
wikiCards: TrialWikiCard[]
|
|
267
333
|
matrix: TrialMatrix
|
|
268
334
|
checks: TrialCheck[]
|
|
@@ -274,7 +340,23 @@ export interface TrialReport {
|
|
|
274
340
|
* `raw` 是模型实际回了什么的一小段。**没有它,降级告警没有下一步** ——
|
|
275
341
|
* 「模型的回答里没有 JSON」这句话本身不告诉人该去改什么。
|
|
276
342
|
*/
|
|
277
|
-
model: {
|
|
343
|
+
model: {
|
|
344
|
+
ok: boolean
|
|
345
|
+
/** Structural decoding succeeded, including a valid empty extraction. */
|
|
346
|
+
parsed?: boolean
|
|
347
|
+
outputFormat?: 'json' | 'table'
|
|
348
|
+
why?: string
|
|
349
|
+
/** 解析失败时的短摘录,保留旧界面的错误提示。 */
|
|
350
|
+
raw?: string
|
|
351
|
+
/** 本次实际送出的模型路由与会话信息。 */
|
|
352
|
+
request?: { provider?: string; model?: string; reasoningEffort?: string; sessionId?: string }
|
|
353
|
+
/** 模型返回的完整原文,供抽取轨迹复核。 */
|
|
354
|
+
response?: string
|
|
355
|
+
/** 模型端返回的本次调用用量。 */
|
|
356
|
+
usage?: TrialTokenUsage
|
|
357
|
+
/** 有坐标无法直接解析时,额外调用一次模型作候选判定。 */
|
|
358
|
+
axisResolution?: TrialModelCallTrace
|
|
359
|
+
}
|
|
278
360
|
/**
|
|
279
361
|
* 原样发出去的提示词。
|
|
280
362
|
*
|