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/TabGuide.tsx
CHANGED
|
@@ -1,38 +1,55 @@
|
|
|
1
|
-
import { useCallback, useState, type
|
|
1
|
+
import { useCallback, useState, type ReactNode } from 'react'
|
|
2
2
|
import {
|
|
3
3
|
ArrowDown, ArrowRight, BarChart3, BrainCircuit, Check, CircleDot, CircleHelp, Database,
|
|
4
|
-
|
|
4
|
+
Stethoscope,
|
|
5
5
|
} from '@tita-agent/ui/icons'
|
|
6
6
|
import type { LucideIcon } from '@tita-agent/ui/icons'
|
|
7
7
|
import { Button } from '@tita-agent/ui/components'
|
|
8
8
|
import { AXIS_CONTRACT_LINES } from '../axis-contract.ts'
|
|
9
|
+
/* 两段 system 提示词**直接从服务端那条链路读** —— 说明页里写的与真正发出去的必须是同一份文本。
|
|
10
|
+
它们各自住在一个只做字符串组装的文件里(`extract-contract.ts` / `organize-contract.ts`),
|
|
11
|
+
所以浏览器 bundle 也 import 得进来。 */
|
|
12
|
+
import { buildTrialSystem } from '../extract-contract.ts'
|
|
13
|
+
import { buildOrganizeSystem } from '../organize-contract.ts'
|
|
9
14
|
import {
|
|
10
|
-
|
|
15
|
+
NODE_META, NODE_ORDER, laneOf,
|
|
11
16
|
type NodeId, type NodeStatus, type NodeStep,
|
|
12
17
|
} from './architecture.tsx'
|
|
18
|
+
import { LANE_PALETTE } from './arch/model.ts'
|
|
13
19
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} from './arch/model.ts'
|
|
18
|
-
import { PROBLEM_DOMAINS } from './problem-domains.ts'
|
|
20
|
+
GUIDE_CHAIN_TABS, GuideArchitectureCanvas, chainOfNode,
|
|
21
|
+
type GuideChainId, type GuideNodeId,
|
|
22
|
+
} from './GuideArchitectureCanvas.tsx'
|
|
19
23
|
|
|
20
24
|
/**
|
|
21
|
-
*
|
|
25
|
+
* 架构说明页(`/knowledge/pages/help/overview?node=...`)。
|
|
22
26
|
*
|
|
23
|
-
*
|
|
24
|
-
* - 五个产品 Tab 是用户理解系统的概念入口,其中 Knowledge / 归因 / 记忆 / 评测
|
|
25
|
-
* 不一定各自对应一个运行时节点,所以保留为概念说明入口。
|
|
27
|
+
* ## 这一页的形状是「一块画布 + 画布内 Inspector」
|
|
26
28
|
*
|
|
27
|
-
*
|
|
29
|
+
* 两个入口在同一页上回答两个问题:
|
|
30
|
+
*
|
|
31
|
+
* - **画布**回答「系统长什么样」:节点位置来自 `arch/model.ts`(与 Agent 概览同一份),
|
|
32
|
+
* 所有核心节点始终在场,左上角的 Tab 只控制链路高亮。
|
|
33
|
+
* - **Inspector**回答「这个环节具体怎么做」:定义、输入输出、具体步骤、实现状态与边界。
|
|
34
|
+
*
|
|
35
|
+
* 两者在同一块画布上:读一个环节时,眼睛在「图上哪个节点」和「它做什么」之间来回走,
|
|
36
|
+
* Inspector 不参与画布缩放,也不会压缩节点布局。
|
|
37
|
+
*
|
|
38
|
+
* ## 两类对象共用一份详情
|
|
39
|
+
*
|
|
40
|
+
* 架构节点是 Agent 概览里的真实节点(复用 `NODE_META`);四个产品 Tab
|
|
41
|
+
* (知识库 / 智能归因 / 记忆 / 评测)是用户理解系统的**概念入口**,它们不一定各自
|
|
42
|
+
* 对应一个运行时节点,所以保留为并列的说明条目 —— 这也是 `?node=knowledge` 这类
|
|
43
|
+
* 深链(面板上五个 Tab 的「查看说明」都指向它们)继续可用的原因。
|
|
28
44
|
*/
|
|
29
|
-
export type GuideNodeId = NodeId | 'knowledge' | 'attribution' | 'memory' | 'eval'
|
|
30
45
|
|
|
31
46
|
interface GuideSection {
|
|
32
47
|
title: string
|
|
33
48
|
points?: string[]
|
|
34
49
|
definitions?: Array<{ label: string; text: string }>
|
|
35
50
|
prompt?: string
|
|
51
|
+
/** 长提示词收进 `<details>`:380px 的栏里整段铺开会占掉好几屏。 */
|
|
52
|
+
promptSummary?: string
|
|
36
53
|
wide?: boolean
|
|
37
54
|
}
|
|
38
55
|
|
|
@@ -132,7 +149,51 @@ const CONCEPT_GUIDES: GuideNode[] = [
|
|
|
132
149
|
},
|
|
133
150
|
]
|
|
134
151
|
|
|
135
|
-
|
|
152
|
+
/**
|
|
153
|
+
* 编译节点额外要说清的一件事:**这四段里到底哪几段在跟模型说话,说的是什么。**
|
|
154
|
+
*
|
|
155
|
+
* 这是读一条「编译」链路时最该能回答的问题 —— 而它以前只有两句散文
|
|
156
|
+
* (「一次调用抽出 Knowledge」「按 (对象, 动作, 场景) 分组」),看不出提示词长什么样。
|
|
157
|
+
*
|
|
158
|
+
* 两段提示词都**从真正构建它们的函数读**,不在这里抄一份:抄一份就等于给「界面上写的」
|
|
159
|
+
* 和「真正发出去的」各留一个真相,而它们一定会漂移。
|
|
160
|
+
*/
|
|
161
|
+
const COMPILE_PROMPT_SECTIONS: GuideSection[] = [
|
|
162
|
+
{
|
|
163
|
+
title: '这一步发给模型的提示词',
|
|
164
|
+
points: [
|
|
165
|
+
'抽取 Knowledge / Event 使用 LLM;归一遇到歧义时调用模型补判;WikiCard 可选择模型组织。三个阶段独立运行。',
|
|
166
|
+
'**归一坐标**(Resolve)优先查 canonical、alias 与作用域;需要语义比较时由模型在已有候选中补判,不确定就保留待处理。',
|
|
167
|
+
'**建索引**(Index)从已保存卡片切召回单元,构建关键词、向量和图谱;向量编码使用所选向量模型,不重复文档抽取。',
|
|
168
|
+
'所以下面两段就是这条链路全部的模型输入。它们都是 **system 段**;user 段每次都不同(文档正文、这一坐标下的知识清单),列不出固定文本。',
|
|
169
|
+
],
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
title: '① 抽取 Knowledge · system',
|
|
173
|
+
prompt: buildTrialSystem(),
|
|
174
|
+
promptSummary: '展开抽取契约(约 60 行)',
|
|
175
|
+
points: [
|
|
176
|
+
'这是**稳定前缀**:同一份契约每份文档都发一遍,所以它进 system 而不是 user。',
|
|
177
|
+
'运行时在这段之后还会注入两样随库与文档变化的东西,所以不在上面那段里:本库**已有的坐标清单**(对象 / 动作 / 场景,含定义与别名),以及**本库骨架允许的小节名**。',
|
|
178
|
+
'已有坐标刻意放在 user 段 —— system 保持稳定,上游缓存才命中得了(`sessionId` 被钉成 `knowledge:<库 id>` 就是为了这件事)。',
|
|
179
|
+
'模型默认回 TOON 固定列表格,历史 JSON 仍兼容:`knowledge` 是抽出来的知识(每条只挂一个坐标),`objects` / `actions` / `scenes` 是它用到的原始说法与定义,`dropped` 是它丢掉且说得出理由的片段。',
|
|
180
|
+
],
|
|
181
|
+
wide: true,
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
title: '② 物化 WikiCard · 组织 system',
|
|
185
|
+
prompt: buildOrganizeSystem(),
|
|
186
|
+
promptSummary: '展开组织契约(约 50 行)',
|
|
187
|
+
points: [
|
|
188
|
+
'「按坐标分组、卡名由公式推导」是**程序**做的;调模型的只是最后那一步:把这批知识组织成读得下去的正文。',
|
|
189
|
+
'界线不靠提示词请求,靠两件机械的事:输出形状里没有「原文」这个字段;每句叙述都要挂 `[^知识id]` 引用,程序校验每条知识至少被引用一次。编出来的事实挂不上引用,整份方案会被打回。',
|
|
190
|
+
'user 段发的是这一坐标下的知识清单(每条一个 id),外加候选卡名与骨架小节。',
|
|
191
|
+
],
|
|
192
|
+
wide: true,
|
|
193
|
+
},
|
|
194
|
+
]
|
|
195
|
+
|
|
196
|
+
const ARCHITECTURE_SECTIONS: Partial<Record<NodeId, GuideSection[]>> = { intent: TAB_SECTIONS.intent, compile: COMPILE_PROMPT_SECTIONS }
|
|
136
197
|
|
|
137
198
|
const ARCHITECTURE_GUIDES: GuideNode[] = NODE_ORDER.map((id): GuideNode => {
|
|
138
199
|
const meta = NODE_META[id]
|
|
@@ -144,7 +205,7 @@ const ARCHITECTURE_GUIDES: GuideNode[] = NODE_ORDER.map((id): GuideNode => {
|
|
|
144
205
|
}
|
|
145
206
|
})
|
|
146
207
|
|
|
147
|
-
const GUIDE_NODES: GuideNode[] = [...ARCHITECTURE_GUIDES, ...CONCEPT_GUIDES
|
|
208
|
+
const GUIDE_NODES: GuideNode[] = [...ARCHITECTURE_GUIDES, ...CONCEPT_GUIDES]
|
|
148
209
|
const NODE_BY_ID: Record<GuideNodeId, GuideNode> = GUIDE_NODES.reduce((result, node) => {
|
|
149
210
|
result[node.id] = node
|
|
150
211
|
return result
|
|
@@ -154,8 +215,6 @@ export function isGuideNodeId(value: string | undefined): value is GuideNodeId {
|
|
|
154
215
|
return value !== undefined && Object.prototype.hasOwnProperty.call(NODE_BY_ID, value)
|
|
155
216
|
}
|
|
156
217
|
|
|
157
|
-
const STATUS_MARK: Record<NodeStatus, string> = { live: '已实现', partial: '部分实现', planned: '待实现', host: '宿主提供' }
|
|
158
|
-
|
|
159
218
|
function knowledgeEventRelationFor(id: GuideNodeId): string | null {
|
|
160
219
|
if (id === 'compile') return '编译阶段产出 Knowledge 和 WikiCard,负责定义与组织可复用内容;它本身不产生 Event。Event 要等 Knowledge 在一次真实请求中被使用或验证后才产生。'
|
|
161
220
|
if (id === 'context') return 'Context 把召回到的 Knowledge 交给 Runtime;Runtime 实际引用、执行或验证这些内容时,形成一条 Event。'
|
|
@@ -167,134 +226,6 @@ function knowledgeEventRelationFor(id: GuideNodeId): string | null {
|
|
|
167
226
|
return null
|
|
168
227
|
}
|
|
169
228
|
|
|
170
|
-
function edgePath(edge: ArchEdge): string {
|
|
171
|
-
const source = boxOf(edge.source)
|
|
172
|
-
const target = boxOf(edge.target)
|
|
173
|
-
const rightward = target.x >= source.x
|
|
174
|
-
const start: [number, number] = [source.x + (rightward ? source.width / 2 : -source.width / 2), source.y]
|
|
175
|
-
const end: [number, number] = [target.x + (rightward ? -target.width / 2 : target.width / 2), target.y]
|
|
176
|
-
|
|
177
|
-
if (edge.id === 'x1') {
|
|
178
|
-
const outer = CANVAS_WIDTH - 25
|
|
179
|
-
return `M ${start[0]} ${start[1]} H ${outer} V ${end[1]} H ${end[0]}`
|
|
180
|
-
}
|
|
181
|
-
if (edge.id === 'x2') {
|
|
182
|
-
const outer = GUTTER - 25
|
|
183
|
-
return `M ${start[0]} ${start[1]} H ${outer} V ${end[1]} H ${end[0]}`
|
|
184
|
-
}
|
|
185
|
-
if (edge.id === 'x3') {
|
|
186
|
-
const gap = columnGapX(1)
|
|
187
|
-
const lowerGap = laneGapY(0)
|
|
188
|
-
return `M ${start[0]} ${start[1]} H ${gap} V ${lowerGap} H ${target.x} V ${end[1]} H ${end[0]}`
|
|
189
|
-
}
|
|
190
|
-
if (edge.id === 'x4') {
|
|
191
|
-
const gap = columnGapX(2)
|
|
192
|
-
const upperGap = laneGapY(0)
|
|
193
|
-
return `M ${start[0]} ${start[1]} H ${gap} V ${upperGap} H ${target.x} V ${end[1]} H ${end[0]}`
|
|
194
|
-
}
|
|
195
|
-
if (Math.abs(source.y - target.y) < 1) return `M ${start[0]} ${start[1]} H ${end[0]}`
|
|
196
|
-
const trunk = (start[0] + end[0]) / 2
|
|
197
|
-
return `M ${start[0]} ${start[1]} H ${trunk} V ${end[1]} H ${end[0]}`
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
function laneCenterFor(index: number): number {
|
|
201
|
-
return laneTop(index) + LANE_HEAD_H + 12 + 184 / 2
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
const EDGE_LABEL_POSITIONS: Record<string, { x: number; y: number }> = {
|
|
205
|
-
x1: { x: CANVAS_WIDTH - 92, y: laneCenterFor(2) },
|
|
206
|
-
x2: { x: GUTTER - 18, y: laneGapY(1) + 4 },
|
|
207
|
-
x3: { x: columnGapX(1) + 42, y: laneGapY(0) - 8 },
|
|
208
|
-
x4: { x: columnGapX(2) + 42, y: laneGapY(0) + 18 },
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
function ArchitectureNodeShape({ id, selected, onSelect }: { id: NodeId; selected: boolean; onSelect: (id: GuideNodeId) => void }): ReactNode {
|
|
212
|
-
const meta = NODE_META[id]
|
|
213
|
-
const box = boxOf(id)
|
|
214
|
-
const title = meta.shortTitle ?? meta.title
|
|
215
|
-
const activate = (): void => onSelect(id)
|
|
216
|
-
const onKeyDown = (event: KeyboardEvent<SVGGElement>): void => {
|
|
217
|
-
if (event.key !== 'Enter' && event.key !== ' ') return
|
|
218
|
-
event.preventDefault()
|
|
219
|
-
activate()
|
|
220
|
-
}
|
|
221
|
-
const compact = box.height < 70
|
|
222
|
-
return <g
|
|
223
|
-
className={`tabGuideArchitectureNode${selected ? ' tabGuideArchitectureNodeSelected' : ''}`}
|
|
224
|
-
role="button" tabIndex={0} aria-label={`查看${meta.title}说明`} aria-pressed={selected}
|
|
225
|
-
transform={`translate(${box.x - box.width / 2} ${box.y - box.height / 2})`}
|
|
226
|
-
onClick={activate} onKeyDown={onKeyDown}
|
|
227
|
-
>
|
|
228
|
-
<title>{`${meta.title}:${meta.subtitle} · ${NODE_STATUS_LABEL[meta.status]}`}</title>
|
|
229
|
-
<rect className="tabGuideArchitectureNodeRect" width={box.width} height={box.height} rx="8" />
|
|
230
|
-
<text className="tabGuideArchitectureNodeTitle" x="12" y={compact ? 20 : 23}>{title}</text>
|
|
231
|
-
<text className="tabGuideArchitectureNodeSubtitle" x="12" y={compact ? 37 : 44}>{meta.subtitle}</text>
|
|
232
|
-
{!compact && <text className="tabGuideArchitectureNodeStatus" x="12" y={box.height - 12}>{STATUS_MARK[meta.status]}</text>}
|
|
233
|
-
</g>
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
function ArchitectureDiagram({ selected, onSelect }: { selected: GuideNodeId; onSelect: (id: GuideNodeId) => void }): ReactNode {
|
|
237
|
-
return <div className="tabGuideMap" aria-label="TitaAgent 完整架构图">
|
|
238
|
-
<svg className="tabGuideArchitectureSvg" viewBox={`0 0 ${CANVAS_WIDTH} ${CANVAS_HEIGHT}`} role="img" aria-labelledby="tab-guide-diagram-title tab-guide-diagram-desc">
|
|
239
|
-
<title id="tab-guide-diagram-title">TitaAgent 完整架构和逻辑图</title>
|
|
240
|
-
<desc id="tab-guide-diagram-desc">用户操作、知识编译与召回、自进化 Agent 三条链路,以及它们之间的交互回采、知识沉淀、反馈和上下文注入。</desc>
|
|
241
|
-
<defs>
|
|
242
|
-
<marker id="tabGuideFlowArrow" markerWidth="8" markerHeight="8" refX="7" refY="4" orient="auto" markerUnits="strokeWidth"><path d="M0 0 L8 4 L0 8 Z" fill={EDGE_STYLE.flow.stroke} /></marker>
|
|
243
|
-
<marker id="tabGuideCrossArrow" markerWidth="8" markerHeight="8" refX="7" refY="4" orient="auto" markerUnits="strokeWidth"><path d="M0 0 L8 4 L0 8 Z" fill={EDGE_STYLE.inject.stroke} /></marker>
|
|
244
|
-
<marker id="tabGuideFeedbackArrow" markerWidth="8" markerHeight="8" refX="7" refY="4" orient="auto" markerUnits="strokeWidth"><path d="M0 0 L8 4 L0 8 Z" fill={EDGE_STYLE.feedback.stroke} /></marker>
|
|
245
|
-
</defs>
|
|
246
|
-
|
|
247
|
-
<g className="tabGuideArchitectureLegend" aria-hidden="true">
|
|
248
|
-
<text className="tabGuideArchitectureLegendTitle" x="14" y="30">架构阅读方式</text>
|
|
249
|
-
<line className="tabGuideArchitectureLegendLine tabGuideArchitectureLegendLine-flow" x1="142" y1="27" x2="184" y2="27" />
|
|
250
|
-
<text className="tabGuideArchitectureLegendText" x="193" y="30">链路内流向</text>
|
|
251
|
-
<line className="tabGuideArchitectureLegendLine tabGuideArchitectureLegendLine-cross" x1="285" y1="27" x2="327" y2="27" />
|
|
252
|
-
<text className="tabGuideArchitectureLegendText" x="336" y="30">跨链路流转</text>
|
|
253
|
-
<line className="tabGuideArchitectureLegendLine tabGuideArchitectureLegendLine-feedback" x1="438" y1="27" x2="480" y2="27" />
|
|
254
|
-
<text className="tabGuideArchitectureLegendText" x="489" y="30">反馈回路</text>
|
|
255
|
-
<text className="tabGuideArchitectureLegendNote" x={CANVAS_WIDTH - 14} y="30">点击节点查看定义与执行步骤</text>
|
|
256
|
-
</g>
|
|
257
|
-
|
|
258
|
-
{NODE_LANES.map((lane, index) => <g key={lane.id}>
|
|
259
|
-
<rect className="tabGuideArchitectureBand" x="14" y={laneTop(index)} width={CANVAS_WIDTH - 28} height={BAND_H} rx="10" />
|
|
260
|
-
<rect className={`tabGuideArchitectureLaneBadge tabGuideArchitectureLaneBadge-${lane.id}`} x={GUTTER} y={laneTop(index) + 10} width="300" height={LANE_HEAD_H - 4} rx="6" />
|
|
261
|
-
<text className="tabGuideArchitectureLaneLabel" x={GUTTER + 12} y={laneTop(index) + 29}>{`${lane.index} · ${lane.title}`}</text>
|
|
262
|
-
<text className="tabGuideArchitectureLaneNote" x={GUTTER + 148} y={laneTop(index) + 29}>{lane.note}</text>
|
|
263
|
-
</g>)}
|
|
264
|
-
|
|
265
|
-
<g className="tabGuideArchitectureEdges" aria-hidden="true">
|
|
266
|
-
{ARCH_EDGES.map(edge => {
|
|
267
|
-
const style = EDGE_STYLE[edge.kind]
|
|
268
|
-
const marker = edge.kind === 'feedback' ? 'tabGuideFeedbackArrow' : edge.kind === 'inject' || edge.kind === 'collect' ? 'tabGuideCrossArrow' : 'tabGuideFlowArrow'
|
|
269
|
-
const labelPosition = edge.label ? EDGE_LABEL_POSITIONS[edge.id] : undefined
|
|
270
|
-
return <g key={edge.id}>
|
|
271
|
-
<path className={`tabGuideArchitectureEdge tabGuideArchitectureEdge-${edge.kind}`} d={edgePath(edge)} style={{ stroke: style.stroke, strokeWidth: style.lineWidth, strokeDasharray: style.lineDash?.join(' ') }} markerEnd={`url(#${marker})`} />
|
|
272
|
-
{edge.label && labelPosition && <text className="tabGuideArchitectureEdgeLabel" x={labelPosition.x} y={labelPosition.y}>{edge.label}</text>}
|
|
273
|
-
</g>
|
|
274
|
-
})}
|
|
275
|
-
</g>
|
|
276
|
-
|
|
277
|
-
{NODE_ORDER.map(id => <ArchitectureNodeShape key={id} id={id} selected={selected === id} onSelect={onSelect} />)}
|
|
278
|
-
|
|
279
|
-
<g className="tabGuideArchitectureProblemBand">
|
|
280
|
-
<rect className="tabGuideArchitectureBand" x="14" y={CANVAS_HEIGHT - 276} width={CANVAS_WIDTH - 28} height="236" rx="10" />
|
|
281
|
-
<text className="tabGuideArchitectureProblemTitle" x={GUTTER} y={CANVAS_HEIGHT - 238}>完整闭环落到三个问题域</text>
|
|
282
|
-
<text className="tabGuideArchitectureProblemNote" x={GUTTER + 280} y={CANVAS_HEIGHT - 238}>口径可信 · 可复用 · 可追溯</text>
|
|
283
|
-
{PROBLEM_DOMAINS.map((domain, index) => {
|
|
284
|
-
const x = GUTTER + index * 330
|
|
285
|
-
return <g key={domain.id} className="tabGuideArchitectureProblem">
|
|
286
|
-
<rect className="tabGuideArchitectureProblemRect" x={x} y={CANVAS_HEIGHT - 218} width="300" height="150" rx="8" />
|
|
287
|
-
<text className="tabGuideArchitectureProblemIndex" x={x + 15} y={CANVAS_HEIGHT - 193}>{domain.index}</text>
|
|
288
|
-
<text className="tabGuideArchitectureProblemLabel" x={x + 50} y={CANVAS_HEIGHT - 193}>{domain.title}</text>
|
|
289
|
-
<text className="tabGuideArchitectureProblemText" x={x + 15} y={CANVAS_HEIGHT - 166}>{domain.question.slice(0, 42)}…</text>
|
|
290
|
-
<text className="tabGuideArchitectureProblemMeasure" x={x + 15} y={CANVAS_HEIGHT - 94}>衡量:{domain.measure.slice(0, 28)}…</text>
|
|
291
|
-
</g>
|
|
292
|
-
})}
|
|
293
|
-
</g>
|
|
294
|
-
</svg>
|
|
295
|
-
</div>
|
|
296
|
-
}
|
|
297
|
-
|
|
298
229
|
function RelationNode({ id, label, note, selected, onSelect }: { id: GuideNodeId; label: string; note: string; selected: boolean; onSelect: (id: GuideNodeId) => void }): ReactNode {
|
|
299
230
|
return <Button variant={selected ? 'default' : 'outline'} size="sm" className="tabGuideRelationNode" aria-pressed={selected} onClick={() => onSelect(id)}>
|
|
300
231
|
<span>{label}</span><small>{note}</small>
|
|
@@ -304,7 +235,6 @@ function RelationNode({ id, label, note, selected, onSelect }: { id: GuideNodeId
|
|
|
304
235
|
function KnowledgeEventRelation({ selected, onSelect }: { selected: GuideNodeId; onSelect: (id: GuideNodeId) => void }): ReactNode {
|
|
305
236
|
return <section className="tabGuideConceptRelation" aria-label="Knowledge 与 Event 的关系">
|
|
306
237
|
<div className="tabGuideConceptRelationIntro">
|
|
307
|
-
<p className="tabGuideEyebrow">核心对象关系</p>
|
|
308
238
|
<h3>Knowledge 是内容,Event 是一次使用或验证</h3>
|
|
309
239
|
<p>Knowledge 先被编译和组织;当 Agent 在真实请求中引用、执行或验证它时,才产生 Event。Event 经过质量检查后,才可能沉淀为记忆或回流 SourceRaw。</p>
|
|
310
240
|
</div>
|
|
@@ -333,18 +263,33 @@ function KnowledgeEventRelation({ selected, onSelect }: { selected: GuideNodeId;
|
|
|
333
263
|
</section>
|
|
334
264
|
}
|
|
335
265
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
266
|
+
/**
|
|
267
|
+
* 当前链路里的环节轨:**把「这条链路有哪几环」摆成一排可点的表头**。
|
|
268
|
+
*
|
|
269
|
+
* 它回答的是画布回答不了的那个问题 —— 画布上一条链路是空间关系,
|
|
270
|
+
* 而「我现在读的是第几环、下一环是什么」是顺序关系。点一下就走过去。
|
|
271
|
+
*
|
|
272
|
+
* 「全部链路」不出这条轨:它不是一条链路,把十七个环节平铺成三行只是噪声,
|
|
273
|
+
* 而那张图本身已经把全部环节摆在一起了。
|
|
274
|
+
*/
|
|
275
|
+
function ChainRail({ chain, selected, onSelect }: { chain: GuideChainId; selected: GuideNodeId | null; onSelect: (id: GuideNodeId) => void }): ReactNode {
|
|
276
|
+
const tab = GUIDE_CHAIN_TABS.find(item => item.id === chain)
|
|
277
|
+
if (!tab || tab.id === 'all' || tab.nodes.length === 0) return null
|
|
278
|
+
return <nav className="tabGuideChainRail" aria-label={`${tab.label}的环节`}>
|
|
279
|
+
<span className="tabGuideChainRailHead">{tab.label}</span>
|
|
280
|
+
<ol>
|
|
281
|
+
{tab.nodes.map((id, index) => {
|
|
282
|
+
const meta = NODE_META[id]
|
|
283
|
+
const on = selected === id
|
|
284
|
+
return <li key={id}>
|
|
285
|
+
<button type="button" className="tabGuideChainRailStep" aria-pressed={on} onClick={() => onSelect(id)}>
|
|
286
|
+
<span className="tabGuideChainRailIndex">{index + 1}</span>
|
|
287
|
+
<span className="tabGuideChainRailTitle">{meta.shortTitle ?? meta.title}</span>
|
|
288
|
+
</button>
|
|
289
|
+
</li>
|
|
290
|
+
})}
|
|
291
|
+
</ol>
|
|
292
|
+
</nav>
|
|
348
293
|
}
|
|
349
294
|
|
|
350
295
|
function StepList({ steps }: { steps: NodeStep[] }): ReactNode {
|
|
@@ -362,15 +307,18 @@ function StepList({ steps }: { steps: NodeStep[] }): ReactNode {
|
|
|
362
307
|
function GuideDetail({ node }: { node: GuideNode }): ReactNode {
|
|
363
308
|
const Icon = node.icon
|
|
364
309
|
const relation = knowledgeEventRelationFor(node.id)
|
|
310
|
+
const lane = node.architectureNode ? laneOf(node.id as NodeId) : null
|
|
365
311
|
return <section className="tabGuideDetail" id={`tab-guide-node-${node.id}`} aria-labelledby={`tab-guide-detail-title-${node.id}`}>
|
|
366
312
|
<div className="tabGuideDetailHeader">
|
|
367
313
|
<span className={`tabGuideDetailIcon tabGuideDetailIcon-${node.id}`}><Icon size={20} strokeWidth={1.8} /></span>
|
|
368
314
|
<div>
|
|
369
|
-
<p className="tabGuideEyebrow">{node.architectureNode ? '架构节点' : '产品模块'}</p>
|
|
370
315
|
<h2 id={`tab-guide-detail-title-${node.id}`}>{node.title}</h2>
|
|
371
316
|
<p className="tabGuideDetailSubtitle">{node.subtitle}</p>
|
|
317
|
+
{lane && <span className="tabGuideDetailLane">
|
|
318
|
+
<i style={{ background: LANE_PALETTE[lane.id].accent }} aria-hidden="true" />{lane.index} · {lane.title}
|
|
319
|
+
</span>}
|
|
320
|
+
{!lane && <span className="tabGuideDetailLane tabGuideDetailLaneConcept">产品模块 · 不占运行时坐标</span>}
|
|
372
321
|
</div>
|
|
373
|
-
{node.status && <span className="tabGuideDetailState"><ShieldCheck size={14} />{NODE_STATUS_LABEL[node.status]}</span>}
|
|
374
322
|
</div>
|
|
375
323
|
|
|
376
324
|
<div className="tabGuideDefinitionBlock">
|
|
@@ -398,42 +346,69 @@ function GuideDetail({ node }: { node: GuideNode }): ReactNode {
|
|
|
398
346
|
<dt>{definition.label}</dt><dd>{definition.text}</dd>
|
|
399
347
|
</div>)}
|
|
400
348
|
</dl>}
|
|
401
|
-
{section.prompt &&
|
|
349
|
+
{section.prompt && (section.promptSummary
|
|
350
|
+
? <details className="tabGuidePromptDetails">
|
|
351
|
+
<summary>{section.promptSummary}</summary>
|
|
352
|
+
<pre className="tabGuidePrompt" aria-label={`${section.title}正文`}>{section.prompt}</pre>
|
|
353
|
+
</details>
|
|
354
|
+
: <pre className="tabGuidePrompt" aria-label={`${section.title}正文`}>{section.prompt}</pre>)}
|
|
402
355
|
{section.points && <ul>{section.points.map(point => <li key={point}>{point}</li>)}</ul>}
|
|
403
356
|
</div>)}
|
|
404
357
|
</div>
|
|
405
358
|
</section>
|
|
406
359
|
}
|
|
407
360
|
|
|
361
|
+
function writeAddress(id: GuideNodeId): void {
|
|
362
|
+
const next = new URL(window.location.href)
|
|
363
|
+
next.searchParams.set('node', id)
|
|
364
|
+
window.history.replaceState(null, '', `${next.pathname}${next.search}${next.hash}`)
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
function clearAddress(): void {
|
|
368
|
+
const next = new URL(window.location.href)
|
|
369
|
+
next.searchParams.delete('node')
|
|
370
|
+
window.history.replaceState(null, '', `${next.pathname}${next.search}${next.hash}`)
|
|
371
|
+
}
|
|
372
|
+
|
|
408
373
|
export function TabGuidePage({ initialNode }: { initialNode?: string }): ReactNode {
|
|
409
|
-
const
|
|
374
|
+
const start: GuideNodeId | null = isGuideNodeId(initialNode) ? initialNode : null
|
|
375
|
+
const [selected, setSelected] = useState<GuideNodeId | null>(start)
|
|
376
|
+
const [chain, setChain] = useState<GuideChainId>(() => start ? chainOfNode(start) ?? 'all' : 'all')
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* 选中一个环节只打开它自己的说明。链路高亮只由左上角 Tab 控制,节点点击不改变当前链路。
|
|
380
|
+
*/
|
|
410
381
|
const selectNode = useCallback((id: GuideNodeId): void => {
|
|
411
382
|
setSelected(id)
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
383
|
+
writeAddress(id)
|
|
384
|
+
}, [])
|
|
385
|
+
|
|
386
|
+
/** 切链路 = 换一批点亮的环节,并把详情带到这条链路的入口环节。 */
|
|
387
|
+
const selectChain = useCallback((id: GuideChainId): void => {
|
|
388
|
+
setChain(id)
|
|
389
|
+
const entry = GUIDE_CHAIN_TABS.find(tab => tab.id === id)?.entry
|
|
390
|
+
if (!entry) return
|
|
391
|
+
setSelected(entry)
|
|
392
|
+
writeAddress(entry)
|
|
418
393
|
}, [])
|
|
419
|
-
|
|
394
|
+
|
|
395
|
+
const closeInspector = useCallback((): void => {
|
|
396
|
+
setSelected(null)
|
|
397
|
+
clearAddress()
|
|
398
|
+
}, [])
|
|
399
|
+
const node = selected ? NODE_BY_ID[selected] : undefined
|
|
400
|
+
const inspector = selected && node ? <div className="tabGuideDetailColumn" aria-label="架构环节说明">
|
|
401
|
+
<ChainRail chain={chain} selected={selected} onSelect={selectNode} />
|
|
402
|
+
<GuideDetail node={node} />
|
|
403
|
+
<KnowledgeEventRelation selected={selected} onSelect={selectNode} />
|
|
404
|
+
</div> : undefined
|
|
420
405
|
|
|
421
406
|
return <div className="tabGuide">
|
|
422
|
-
<div className="
|
|
423
|
-
<div>
|
|
424
|
-
<
|
|
425
|
-
|
|
426
|
-
<p>这不是单个 Tab 的使用说明,而是 TitaAgent 的完整架构和逻辑说明。上方图按 Agent 概览的真实节点展示三条链路;点击节点后,下方会给出定义、输入输出、具体步骤、实现状态和边界。</p>
|
|
427
|
-
</div>
|
|
428
|
-
<div className="tabGuideIntroMeta">
|
|
429
|
-
<FileText size={16} />
|
|
430
|
-
<span>图上节点可点击<br />地址会同步保留当前节点</span>
|
|
407
|
+
<div className="tabGuideWorkbench">
|
|
408
|
+
<div className="tabGuideCanvasColumn">
|
|
409
|
+
<GuideArchitectureCanvas chain={chain} onChainChange={selectChain} selected={selected} onSelect={selectNode}
|
|
410
|
+
inspector={inspector} onCloseInspector={closeInspector} />
|
|
431
411
|
</div>
|
|
432
412
|
</div>
|
|
433
|
-
<ArchitectureDiagram selected={selected} onSelect={selectNode} />
|
|
434
|
-
<p className="tabGuideMapHint"><span className="tabGuideHintDot" /> 当前说明:{node.title} · 灰线是链路内流向,蓝线是跨链路流转,虚线是反馈回路</p>
|
|
435
|
-
<KnowledgeEventRelation selected={selected} onSelect={selectNode} />
|
|
436
|
-
<ModuleEntryRail selected={selected} onSelect={selectNode} />
|
|
437
|
-
<GuideDetail node={node} />
|
|
438
413
|
</div>
|
|
439
414
|
}
|