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/client/IntentTab.tsx
CHANGED
|
@@ -91,6 +91,24 @@ function intentTitle(record: IntentRecord): string {
|
|
|
91
91
|
|
|
92
92
|
const SOURCE_LABEL: Record<IntentRecord['source'], string> = { model: '模型判断', fallback: '系统兜底' }
|
|
93
93
|
|
|
94
|
+
function filterOptions(
|
|
95
|
+
records: IntentRecord[],
|
|
96
|
+
field: 'category' | 'act',
|
|
97
|
+
labels: Record<string, string>,
|
|
98
|
+
allLabel: string,
|
|
99
|
+
): Array<{ value: string; label: string }> {
|
|
100
|
+
const values = new Set(records.flatMap(record => {
|
|
101
|
+
const value = record[field]
|
|
102
|
+
return value ? [value] : []
|
|
103
|
+
}))
|
|
104
|
+
const known = Object.keys(labels).filter(value => values.has(value))
|
|
105
|
+
const unknown = [...values].filter(value => !(value in labels)).sort()
|
|
106
|
+
return [
|
|
107
|
+
{ value: '', label: allLabel },
|
|
108
|
+
...[...known, ...unknown].map(value => ({ value, label: humanize(value, labels) ?? value })),
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
|
|
94
112
|
function DiagnosticDetails({ record }: { record: IntentRecord }): ReactNode {
|
|
95
113
|
return <details className={styles.intentDiagnostics}>
|
|
96
114
|
<summary>查看诊断信息</summary>
|
|
@@ -109,33 +127,38 @@ function Interpretation({ record }: { record: IntentRecord }): ReactNode {
|
|
|
109
127
|
return <Card className={styles.intentInterpretation}>
|
|
110
128
|
<div className={styles.intentSectionHead}>
|
|
111
129
|
<div>
|
|
112
|
-
<span className={styles.intentEyebrow}>最近一轮</span>
|
|
113
130
|
<h3>Agent 是这样理解的</h3>
|
|
131
|
+
<p className={styles.intentSectionSubhead}>最新一条判断 · 按时间倒序</p>
|
|
114
132
|
</div>
|
|
115
133
|
<time dateTime={record.updatedAt}>{formatTime(record.updatedAt)}</time>
|
|
116
134
|
</div>
|
|
117
135
|
|
|
118
|
-
<div className={styles.
|
|
119
|
-
<span className={styles.
|
|
120
|
-
<
|
|
121
|
-
<span className={styles.intentStepLabel}>用户原话</span>
|
|
122
|
-
<p className={styles.intentUserInput}>{record.userInput.slice(0, 320) || '(无用户原文)'}</p>
|
|
123
|
-
</div>
|
|
136
|
+
<div className={styles.intentUserBlock}>
|
|
137
|
+
<span className={styles.intentStepLabel}>用户原话</span>
|
|
138
|
+
<p className={styles.intentUserInput}>{record.userInput.slice(0, 320) || '(无用户原文)'}</p>
|
|
124
139
|
</div>
|
|
125
140
|
|
|
126
|
-
<div className={styles.
|
|
127
|
-
|
|
128
|
-
<div className={`${styles.intentStep} ${styles.intentStepResult}`}>
|
|
129
|
-
<span className={styles.intentStepNumber}>2</span>
|
|
130
|
-
<div className={styles.intentStepBody}>
|
|
141
|
+
<div className={styles.intentVerdict}>
|
|
142
|
+
<div className={styles.intentVerdictHead}>
|
|
131
143
|
<span className={styles.intentStepLabel}>Agent 判断</span>
|
|
132
|
-
<
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
</
|
|
144
|
+
{record.lowConfidence && <span className={styles.intentLowConfidence}>需要复核</span>}
|
|
145
|
+
</div>
|
|
146
|
+
<h4 className={styles.intentResultTitle}>{intentTitle(record)}</h4>
|
|
147
|
+
<p className={styles.intentResultText}>{relationLabel(record.relation)}。这条判断{record.lowConfidence ? '的把握较低,建议复核。' : '用于记录本轮对话走向。'}</p>
|
|
148
|
+
<div className={styles.intentResultTags}>
|
|
149
|
+
<Badge tone={record.lowConfidence ? 'warning' : 'blue'}>{humanize(record.act, ACT_LABEL) ?? '未判定'}</Badge>
|
|
150
|
+
{record.category && <Badge tone="violet">{humanize(record.category, CATEGORY_LABEL)}</Badge>}
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
|
|
154
|
+
<div className={styles.intentMetaGrid}>
|
|
155
|
+
<div className={styles.intentMetaCell}>
|
|
156
|
+
<span>任务关系</span>
|
|
157
|
+
<strong>{relationLabel(record.relation)}</strong>
|
|
158
|
+
</div>
|
|
159
|
+
<div className={styles.intentMetaCell}>
|
|
160
|
+
<span>记录来源</span>
|
|
161
|
+
<strong>{SOURCE_LABEL[record.source]}</strong>
|
|
139
162
|
</div>
|
|
140
163
|
</div>
|
|
141
164
|
|
|
@@ -145,19 +168,24 @@ function Interpretation({ record }: { record: IntentRecord }): ReactNode {
|
|
|
145
168
|
|
|
146
169
|
function HistoryItem({ record }: { record: IntentRecord }): ReactNode {
|
|
147
170
|
return <li className={styles.intentHistoryItem}>
|
|
148
|
-
<div className={styles.
|
|
171
|
+
<div className={styles.intentHistoryPrimary}>
|
|
172
|
+
<strong>{intentTitle(record)}</strong>
|
|
149
173
|
<time dateTime={record.updatedAt}><Clock3 size={11} />{formatTime(record.updatedAt)}</time>
|
|
174
|
+
</div>
|
|
175
|
+
<p>{record.userInput.slice(0, 180) || '(无用户原文)'}</p>
|
|
176
|
+
<div className={styles.intentHistoryMeta}>
|
|
150
177
|
<span>{relationLabel(record.relation)}</span>
|
|
178
|
+
<span>{SOURCE_LABEL[record.source]}</span>
|
|
151
179
|
{record.lowConfidence && <span className={styles.intentHistoryWarning}>需复核</span>}
|
|
152
180
|
</div>
|
|
153
|
-
<p>{record.userInput.slice(0, 180) || '(无用户原文)'}</p>
|
|
154
|
-
<strong>{intentTitle(record)}</strong>
|
|
155
181
|
</li>
|
|
156
182
|
}
|
|
157
183
|
|
|
158
184
|
export function IntentTab({ visible }: { visible: boolean }): ReactNode {
|
|
159
185
|
const [sessions, setSessions] = useState<SessionSummary[]>([])
|
|
160
186
|
const [sessionKey, setSessionKey] = useState('')
|
|
187
|
+
const [categoryFilter, setCategoryFilter] = useState('')
|
|
188
|
+
const [actFilter, setActFilter] = useState('')
|
|
161
189
|
const [store, setStore] = useState<StoreView | null>(null)
|
|
162
190
|
const [loading, setLoading] = useState(false)
|
|
163
191
|
const [error, setError] = useState<string | null>(null)
|
|
@@ -186,6 +214,8 @@ export function IntentTab({ visible }: { visible: boolean }): ReactNode {
|
|
|
186
214
|
|
|
187
215
|
const selectSession = async (key: string): Promise<void> => {
|
|
188
216
|
setSessionKey(key)
|
|
217
|
+
setCategoryFilter('')
|
|
218
|
+
setActFilter('')
|
|
189
219
|
setLoading(true)
|
|
190
220
|
try {
|
|
191
221
|
setStore((await getJson<{ store: StoreView }>(`/intent/store?session_key=${encodeURIComponent(key)}`)).store)
|
|
@@ -198,19 +228,25 @@ export function IntentTab({ visible }: { visible: boolean }): ReactNode {
|
|
|
198
228
|
}
|
|
199
229
|
|
|
200
230
|
const recent = store?.recent ?? []
|
|
201
|
-
const
|
|
202
|
-
const
|
|
231
|
+
const categoryOptions = useMemo(() => filterOptions(recent, 'category', CATEGORY_LABEL, '全部意图'), [recent])
|
|
232
|
+
const actOptions = useMemo(() => filterOptions(recent, 'act', ACT_LABEL, '全部动作'), [recent])
|
|
233
|
+
const filteredRecent = useMemo(() => recent.filter(record => (
|
|
234
|
+
(!categoryFilter || record.category === categoryFilter)
|
|
235
|
+
&& (!actFilter || record.act === actFilter)
|
|
236
|
+
)), [actFilter, categoryFilter, recent])
|
|
237
|
+
const latest = filteredRecent[0]
|
|
238
|
+
const history = filteredRecent.slice(1)
|
|
239
|
+
const hasFilter = Boolean(categoryFilter || actFilter)
|
|
203
240
|
const auditStats = useMemo(() => ({
|
|
204
|
-
lowConfidence:
|
|
205
|
-
fallback:
|
|
206
|
-
}), [
|
|
241
|
+
lowConfidence: filteredRecent.filter(record => record.lowConfidence).length,
|
|
242
|
+
fallback: filteredRecent.filter(record => record.source === 'fallback').length,
|
|
243
|
+
}), [filteredRecent])
|
|
207
244
|
|
|
208
245
|
return <div className={styles.viewStack}>
|
|
209
246
|
<div className={styles.intentTop}>
|
|
210
247
|
<div>
|
|
211
|
-
<
|
|
212
|
-
<
|
|
213
|
-
<p>先看用户原话,再看 Agent 的判断。这里只做记录,不参与召回或执行。</p>
|
|
248
|
+
<h2>意图记录</h2>
|
|
249
|
+
<p>先看意图结论,再核对用户原话和任务关系。这里只做审计,不参与召回或执行。</p>
|
|
214
250
|
</div>
|
|
215
251
|
<InfoHint
|
|
216
252
|
className={styles.kbToolbarHint}
|
|
@@ -221,21 +257,56 @@ export function IntentTab({ visible }: { visible: boolean }): ReactNode {
|
|
|
221
257
|
</div>
|
|
222
258
|
|
|
223
259
|
<div className={styles.intentControls}>
|
|
224
|
-
<
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
260
|
+
<div className={styles.intentPrimaryFilter}>
|
|
261
|
+
<div className={styles.intentFilterHeading}>
|
|
262
|
+
<span className={styles.intentControlLabel}>意图</span>
|
|
263
|
+
<small>优先筛选</small>
|
|
264
|
+
</div>
|
|
265
|
+
<SelectMenu
|
|
266
|
+
value={categoryFilter}
|
|
267
|
+
onValueChange={setCategoryFilter}
|
|
268
|
+
disabled={recent.length === 0}
|
|
269
|
+
aria-label="按意图筛选"
|
|
270
|
+
options={categoryOptions}
|
|
271
|
+
/>
|
|
272
|
+
<span className={styles.intentFilterCount}>{filteredRecent.length} 条</span>
|
|
273
|
+
</div>
|
|
274
|
+
<div className={styles.intentSecondaryFilters}>
|
|
275
|
+
<span className={styles.intentControlLabel}>动作</span>
|
|
276
|
+
<SelectMenu
|
|
277
|
+
value={actFilter}
|
|
278
|
+
onValueChange={setActFilter}
|
|
279
|
+
className="w-full min-w-0"
|
|
280
|
+
size="sm"
|
|
281
|
+
disabled={recent.length === 0}
|
|
282
|
+
aria-label="按动作筛选"
|
|
283
|
+
options={actOptions}
|
|
284
|
+
/>
|
|
285
|
+
<span className={styles.intentControlLabel}>会话</span>
|
|
286
|
+
<SelectMenu
|
|
287
|
+
value={sessionKey}
|
|
288
|
+
onValueChange={next => void selectSession(next)}
|
|
289
|
+
className="w-full min-w-0"
|
|
290
|
+
size="sm"
|
|
291
|
+
disabled={sessions.length === 0}
|
|
292
|
+
aria-label="选择意图记录会话"
|
|
293
|
+
placeholder={sessions.length === 0 ? '还没有会话记录' : '选择会话'}
|
|
294
|
+
options={sessions.map(item => ({ value: item.sessionKey, label: `${item.sessionKey.slice(0, 18)} · ${item.recordCount} 条 · ${formatTime(item.lastAt)}` }))}
|
|
295
|
+
/>
|
|
296
|
+
<Button variant="ghost" size="icon" title="刷新" aria-label="刷新意图记录" onClick={() => void load(sessionKey)} disabled={loading}><RefreshCw size={14} /></Button>
|
|
297
|
+
</div>
|
|
298
|
+
<div className={styles.intentFilterSummary} aria-live="polite">
|
|
299
|
+
<span>当前会话显示 {filteredRecent.length} / {recent.length} 条</span>
|
|
300
|
+
{categoryFilter && <Badge tone="blue">{humanize(categoryFilter, CATEGORY_LABEL) ?? categoryFilter}</Badge>}
|
|
301
|
+
{actFilter && <Badge tone="violet">{humanize(actFilter, ACT_LABEL) ?? actFilter}</Badge>}
|
|
302
|
+
</div>
|
|
234
303
|
</div>
|
|
235
304
|
|
|
236
305
|
{pageNotice !== null && <p className={styles.kbNotice} role="alert">
|
|
237
306
|
<AlertCircle size={13} /><span>{pageNotice}</span>
|
|
238
|
-
|
|
307
|
+
{/* 这一枚原来是手写的 `<button>`,命中区只有 12px、图标用自己的字号档,焦点圈
|
|
308
|
+
也是另写的一条。现在用与面板里其余关闭动作同一枚共享控件。 */}
|
|
309
|
+
<Button className={styles.kbNoticeClose} variant="ghost" size="icon" aria-label="关闭提示" title="关闭提示" onClick={() => setPageNotice(null)}><X size={13} /></Button>
|
|
239
310
|
</p>}
|
|
240
311
|
{error && <p className={styles.kbNotice}><AlertCircle size={13} /><span>{error}</span></p>}
|
|
241
312
|
|
|
@@ -243,27 +314,27 @@ export function IntentTab({ visible }: { visible: boolean }): ReactNode {
|
|
|
243
314
|
? <Interpretation record={latest} />
|
|
244
315
|
: <Card className={styles.intentEmptyCard}>
|
|
245
316
|
<BrainCircuit size={18} />
|
|
246
|
-
<strong
|
|
247
|
-
<p
|
|
317
|
+
<strong>{hasFilter ? '当前筛选下没有判断' : '还没有可展示的判断'}</strong>
|
|
318
|
+
<p>{hasFilter ? '调整“意图”或“动作”筛选后再看。' : '选择一个有记录的会话后,这里会显示用户原话和 Agent 判断。'}</p>
|
|
248
319
|
</Card>}
|
|
249
320
|
|
|
250
321
|
<section className={styles.intentHistory}>
|
|
251
322
|
<div className={styles.intentSectionHead}>
|
|
252
323
|
<div>
|
|
253
|
-
<
|
|
254
|
-
<
|
|
324
|
+
<h3>历史判断</h3>
|
|
325
|
+
<p className={styles.intentSectionSubhead}>当前会话中更早的记录</p>
|
|
255
326
|
</div>
|
|
256
327
|
<span className={styles.intentSectionCount}>{history.length} 条</span>
|
|
257
328
|
</div>
|
|
258
329
|
{history.length === 0
|
|
259
|
-
? <p className={styles.intentEmpty}>{latest ? '这是当前会话的第一条判断。' : '暂无历史记录。'}</p>
|
|
330
|
+
? <p className={styles.intentEmpty}>{hasFilter ? '当前筛选下没有更早的判断。' : latest ? '这是当前会话的第一条判断。' : '暂无历史记录。'}</p>
|
|
260
331
|
: <ol className={styles.intentHistoryList}>
|
|
261
332
|
{history.map(record => <HistoryItem key={record.id} record={record} />)}
|
|
262
333
|
</ol>}
|
|
263
334
|
</section>
|
|
264
335
|
|
|
265
336
|
<div className={styles.intentFooter}>
|
|
266
|
-
<span>共 {recent.length}
|
|
337
|
+
<span>共 {filteredRecent.length} 条判断{hasFilter ? `(当前会话 ${recent.length} 条)` : ''}</span>
|
|
267
338
|
{auditStats.lowConfidence > 0 && <span>{auditStats.lowConfidence} 条需要复核</span>}
|
|
268
339
|
{auditStats.fallback > 0 && <span>{auditStats.fallback} 条系统兜底</span>}
|
|
269
340
|
{store?.expiresAt && <span>保留至 {formatTime(store.expiresAt)}</span>}
|