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/migrate.ts
CHANGED
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
31
|
import { cpSync, existsSync, mkdirSync, readdirSync, renameSync, rmdirSync, rmSync, statSync } from 'node:fs'
|
|
32
|
-
import { basename, join, resolve } from 'node:path'
|
|
33
|
-
import { knowledgeBaseRoot, looksLikeKnowledgeTree, memoryRoot, resourceRoot, KNOWLEDGE_DB_FILE, DERIVED_DB_FILE, ASSETS_DIR, SOURCE_RAW_DIR } from './layout.js'
|
|
32
|
+
import { basename, dirname, join, resolve } from 'node:path'
|
|
33
|
+
import { AGENT_DIRS, knowledgeBaseRoot, looksLikeKnowledgeTree, memoryRoot, resourceRoot, KNOWLEDGE_DB_FILE, DERIVED_DB_FILE, ASSETS_DIR, SOURCE_RAW_DIR } from './layout.js'
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* 知识树的段。与 `runtime.ts` 的 `LAYOUT` 同源,这里重列是为了不引入 runtime 依赖。
|
|
@@ -83,6 +83,79 @@ function skipped(reason: string, from?: string, to?: string): MigrationOutcome {
|
|
|
83
83
|
return { status: 'skipped', reason, ...(from ? { from } : {}), ...(to ? { to } : {}) }
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
/**
|
|
87
|
+
* 把旧版完整的 Agent 根目录合并到新的固定根目录。
|
|
88
|
+
*
|
|
89
|
+
* 这和 `migrateLegacyKnowledgeTree` 不同:后者只认识一棵知识库树,而这里要把
|
|
90
|
+
* `domain_knowledge`、`memory`、`intent`、`resource` 与 `tmp` 一起搬走。目标里已经有
|
|
91
|
+
* 同名目录时逐层合并,任何同名文件都不覆盖,并把冲突留下来交给界面报告。
|
|
92
|
+
*/
|
|
93
|
+
export function migrateLegacyAgentRoot(input: { agentRoot: string; legacyRoot: string }): MigrationOutcome {
|
|
94
|
+
const from = resolve(input.legacyRoot)
|
|
95
|
+
const to = resolve(input.agentRoot)
|
|
96
|
+
if (from === to) return skipped('新旧 Agent 根路径相同', from, to)
|
|
97
|
+
if (!existsSync(from)) return skipped('旧 Agent 根路径不存在', from, to)
|
|
98
|
+
|
|
99
|
+
const moved: string[] = []
|
|
100
|
+
const conflicts: string[] = []
|
|
101
|
+
|
|
102
|
+
const moveTree = (source: string, target: string, relative: string): void => {
|
|
103
|
+
if (!existsSync(source)) return
|
|
104
|
+
if (existsSync(target)) {
|
|
105
|
+
const sourceIsDir = statSync(source).isDirectory()
|
|
106
|
+
const targetIsDir = statSync(target).isDirectory()
|
|
107
|
+
if (!sourceIsDir || !targetIsDir) {
|
|
108
|
+
conflicts.push(relative)
|
|
109
|
+
return
|
|
110
|
+
}
|
|
111
|
+
for (const name of readdirSync(source)) {
|
|
112
|
+
moveTree(join(source, name), join(target, name), join(relative, name))
|
|
113
|
+
}
|
|
114
|
+
try { rmdirSync(source) } catch { /* 仍有冲突项,保留源目录 */ }
|
|
115
|
+
return
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
mkdirSync(dirname(target), { recursive: true })
|
|
119
|
+
try {
|
|
120
|
+
renameSync(source, target)
|
|
121
|
+
} catch (cause) {
|
|
122
|
+
if ((cause as NodeJS.ErrnoException)?.code !== 'EXDEV') throw cause
|
|
123
|
+
cpSync(source, target, { recursive: true })
|
|
124
|
+
rmSync(source, { recursive: true, force: true })
|
|
125
|
+
}
|
|
126
|
+
moved.push(relative)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
try {
|
|
130
|
+
// 新根已经存在时只合并属于 Agent 的目录,不碰用户可能放在旧根下的其他文件。
|
|
131
|
+
for (const name of AGENT_DIRS) {
|
|
132
|
+
const source = join(from, name)
|
|
133
|
+
if (existsSync(source)) moveTree(source, join(to, name), name)
|
|
134
|
+
}
|
|
135
|
+
try { rmdirSync(from) } catch { /* 还有未迁移的冲突或用户文件,保留源目录 */ }
|
|
136
|
+
} catch (cause) {
|
|
137
|
+
return {
|
|
138
|
+
status: 'failed',
|
|
139
|
+
from,
|
|
140
|
+
to,
|
|
141
|
+
moved,
|
|
142
|
+
reason: cause instanceof Error ? cause.message : String(cause),
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (conflicts.length > 0) {
|
|
147
|
+
return {
|
|
148
|
+
status: 'failed',
|
|
149
|
+
from,
|
|
150
|
+
to,
|
|
151
|
+
moved,
|
|
152
|
+
reason: `有 ${conflicts.length} 个同名文件未覆盖:${conflicts.slice(0, 5).join('、')}${conflicts.length > 5 ? '…' : ''}`,
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (moved.length === 0) return skipped('旧 Agent 根目录没有可搬内容', from, to)
|
|
156
|
+
return { status: 'moved', from, to, moved, reason: `已迁移 ${moved.length} 项 Agent 数据` }
|
|
157
|
+
}
|
|
158
|
+
|
|
86
159
|
/**
|
|
87
160
|
* 把 `legacyRoot` 下的知识树搬进 `<agentRoot>/domain_knowledge/<kbId>`。
|
|
88
161
|
*
|
package/src/model-text.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { TrialTokenUsage } from './wiki-trial-types.js'
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* 把平台 `llm` 服务的 chunk 流收成一段文本(0044 实机验证第三批)。
|
|
3
5
|
*
|
|
@@ -29,6 +31,7 @@
|
|
|
29
31
|
interface StreamChunkLike {
|
|
30
32
|
type?: string
|
|
31
33
|
text?: string
|
|
34
|
+
usage?: TrialTokenUsage
|
|
32
35
|
reason?: { kind?: string; failure?: { code?: string; message?: string } }
|
|
33
36
|
}
|
|
34
37
|
|
|
@@ -95,7 +98,11 @@ export function buildModelRequest(input: {
|
|
|
95
98
|
* @throws 流以 error / aborted 结束时,抛出带 code 与 message 的错误;
|
|
96
99
|
* 流正常结束但一个字符都没有时,也抛 —— 「模型没说话」不是一次成功的调用。
|
|
97
100
|
*/
|
|
98
|
-
export async function collectModelText(
|
|
101
|
+
export async function collectModelText(
|
|
102
|
+
stream: AsyncIterable<StreamChunkLike>,
|
|
103
|
+
onUsage?: (usage: TrialTokenUsage) => void,
|
|
104
|
+
onDelta?: (text: string) => void,
|
|
105
|
+
): Promise<string> {
|
|
99
106
|
let text = ''
|
|
100
107
|
/** 流怎么结束的。用来区分「正常但空」「失败」「中止」三种情况。 */
|
|
101
108
|
let finish: string | undefined
|
|
@@ -103,8 +110,10 @@ export async function collectModelText(stream: AsyncIterable<StreamChunkLike>):
|
|
|
103
110
|
|
|
104
111
|
for await (const chunk of stream) {
|
|
105
112
|
if (!chunk || typeof chunk !== 'object') continue
|
|
113
|
+
if (chunk.type === 'usage' && chunk.usage) onUsage?.(chunk.usage)
|
|
106
114
|
if (chunk.type === 'text-delta' && typeof chunk.text === 'string') {
|
|
107
115
|
text += chunk.text
|
|
116
|
+
onDelta?.(chunk.text)
|
|
108
117
|
continue
|
|
109
118
|
}
|
|
110
119
|
if (chunk.type === 'finish') {
|
|
@@ -113,9 +122,9 @@ export async function collectModelText(stream: AsyncIterable<StreamChunkLike>):
|
|
|
113
122
|
}
|
|
114
123
|
}
|
|
115
124
|
|
|
116
|
-
if (failure) {
|
|
117
|
-
const code = failure
|
|
118
|
-
const message = failure
|
|
125
|
+
if (failure || finish === 'error' || finish === 'aborted' || finish === 'max-tokens') {
|
|
126
|
+
const code = failure?.code?.trim() || (finish === 'max-tokens' ? 'OUTPUT_TRUNCATED' : '未知错误码')
|
|
127
|
+
const message = failure?.message?.trim() || (finish === 'max-tokens' ? '输出达到长度上限,部分返回已保留,请调整模型限制后重试' : '模型服务没有给出说明')
|
|
119
128
|
throw new Error(`模型调用失败(${code}):${message}`)
|
|
120
129
|
}
|
|
121
130
|
if (text.length === 0) {
|
|
@@ -124,3 +133,99 @@ export async function collectModelText(stream: AsyncIterable<StreamChunkLike>):
|
|
|
124
133
|
}
|
|
125
134
|
return text
|
|
126
135
|
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* 这次失败**重发一次有没有意义**。
|
|
139
|
+
*
|
|
140
|
+
* ## 为什么需要这个判断
|
|
141
|
+
*
|
|
142
|
+
* 知识抽取是一次**长**调用:一次调用要吐出几十条 Knowledge,实测一次
|
|
143
|
+
* `deepseek-v4.1-flash` 的抽取要生成约四万 token、跑两三分钟(见实机轨迹)。
|
|
144
|
+
* 上游网关、本机代理、账号额度任何一处短暂抽风,都会让流在半路结束 ——
|
|
145
|
+
* 适配器报出来就是 `TRANSPORT: Stream ended without finish_reason`,
|
|
146
|
+
* 一次失败就让整份文档的抽取作废,而重发一次多半是好的。
|
|
147
|
+
*
|
|
148
|
+
* 但**不是所有失败都值得重发**:
|
|
149
|
+
*
|
|
150
|
+
* - 凭据无效、模型不存在、请求体不合法 → 重发只会同样失败,还多等两分钟;
|
|
151
|
+
* - 输出撞上长度上限(`OUTPUT_TRUNCATED`)→ 同样的提示词会得到同样的截断;
|
|
152
|
+
* - 用户主动取消(`ABORTED`)→ 再发一次等于不听取消。
|
|
153
|
+
*
|
|
154
|
+
* 所以这里只承认「网络/网关/上游临时故障」这一类。判据用**错误码优先**:
|
|
155
|
+
* 适配器的 code 是稳定契约,message 是给人看的,会随版本改。
|
|
156
|
+
*/
|
|
157
|
+
export function isRetryableModelFailure(error: unknown): boolean {
|
|
158
|
+
const message = error instanceof Error ? error.message : String(error)
|
|
159
|
+
const code = /模型调用失败(([^)]*))/.exec(message)?.[1]?.trim().toUpperCase() ?? ''
|
|
160
|
+
|
|
161
|
+
// 明确不可重试:配置问题与用户取消。宁可让人去改设置,也不要在错的地方重试。
|
|
162
|
+
if (['ABORTED', 'INVALID_CREDENTIAL', 'AUTH', 'UNAUTHORIZED', 'NOT_FOUND', 'INVALID_REQUEST', 'CONTEXT_LENGTH', 'OUTPUT_TRUNCATED'].includes(code)) return false
|
|
163
|
+
|
|
164
|
+
// 明确可重试:上游在流式过程中断掉。
|
|
165
|
+
if (['TRANSPORT', 'NETWORK', 'TIMEOUT', 'RATE_LIMIT', 'OVERLOADED', 'SERVER_ERROR', 'INTERNAL'].includes(code)) return true
|
|
166
|
+
|
|
167
|
+
// 没有 code 的情况(旧适配器、或错误被包了一层):按可辨认的措辞判断。
|
|
168
|
+
if (/没有返回任何文本|没有收到 finish 块|Stream ended without finish_reason/i.test(message)) return true
|
|
169
|
+
if (/ECONNRESET|ECONNREFUSED|ETIMEDOUT|EPIPE|socket hang up|premature close|other side closed|fetch failed|network error|HTTP 5\d\d|HTTP 429/i.test(message)) return true
|
|
170
|
+
|
|
171
|
+
return false
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** 重试策略:最多几次、每次之前等多久。 */
|
|
175
|
+
export interface ModelRetryOptions {
|
|
176
|
+
/** 总尝试次数(含第一次)。默认 3。 */
|
|
177
|
+
attempts?: number
|
|
178
|
+
/** 第 N 次重试前等多久;用完后沿用最后一个。默认 2s / 6s。 */
|
|
179
|
+
delaysMs?: number[]
|
|
180
|
+
/** 每次重试前告诉调用方(打日志、写面板)。 */
|
|
181
|
+
onRetry?: (info: { attempt: number; attempts: number; error: unknown; delayMs: number }) => void
|
|
182
|
+
/** 重试时往**流式预览**里写的一行说明;不给就写默认文案。传 null 表示不写。 */
|
|
183
|
+
notice?: ((info: { attempt: number; attempts: number; error: unknown }) => string | null) | null
|
|
184
|
+
/** 注入 sleep,测试里不必真的等。 */
|
|
185
|
+
sleep?: (ms: number) => Promise<void>
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* 用**同一个请求**重发几次,直到成功或遇到不可重试的失败。
|
|
190
|
+
*
|
|
191
|
+
* `send` 每次都会收到一个新的 `onDelta` —— 调用方按 attempt 收流,失败的那几次
|
|
192
|
+
* 收过的字不会被算进最终结果(`collectModelText` 每轮从空串开始)。
|
|
193
|
+
*
|
|
194
|
+
* 重试时往预览里写一句 `[模型流中断…正在重试 N/M]`:不写的话,界面上会出现
|
|
195
|
+
* 「前半份 JSON + 后半份 JSON」拼在一起,看起来像模型答错了,而不是流断了。
|
|
196
|
+
*/
|
|
197
|
+
export async function callModelWithRetry(
|
|
198
|
+
send: (onDelta: (text: string) => void) => Promise<string>,
|
|
199
|
+
options: ModelRetryOptions & { onDelta?: (text: string) => void } = {},
|
|
200
|
+
): Promise<string> {
|
|
201
|
+
const attempts = Math.max(1, Math.floor(options.attempts ?? 3))
|
|
202
|
+
const delays = options.delaysMs ?? [2000, 6000]
|
|
203
|
+
const sleep = options.sleep ?? ((ms: number) => new Promise<void>(resolve => { setTimeout(resolve, ms) }))
|
|
204
|
+
const notice = options.notice === undefined
|
|
205
|
+
? (info: { attempt: number; attempts: number; error: unknown }) =>
|
|
206
|
+
`\n\n[模型流中断(${info.error instanceof Error ? info.error.message : String(info.error)}),正在重试 ${info.attempt}/${info.attempts - 1}]\n\n`
|
|
207
|
+
: options.notice
|
|
208
|
+
|
|
209
|
+
let lastError: unknown
|
|
210
|
+
for (let attempt = 1; attempt <= attempts; attempt++) {
|
|
211
|
+
try {
|
|
212
|
+
return await send(text => options.onDelta?.(text))
|
|
213
|
+
} catch (error) {
|
|
214
|
+
lastError = error
|
|
215
|
+
if (attempt >= attempts || !isRetryableModelFailure(error)) throw error
|
|
216
|
+
const delayMs = delays[Math.min(attempt - 1, delays.length - 1)] ?? 0
|
|
217
|
+
options.onRetry?.({ attempt, attempts, error, delayMs })
|
|
218
|
+
const line = notice?.({ attempt, attempts, error }) ?? ''
|
|
219
|
+
if (line) options.onDelta?.(line)
|
|
220
|
+
await sleep(delayMs)
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* 用尽之后的报错要说出**重过几次**。
|
|
225
|
+
*
|
|
226
|
+
* 「一次就失败」与「重了两次还是失败」对读的人是两件事:前者查代码/提示词,
|
|
227
|
+
* 后者查额度、代理和上游状态。不写这一句,新加的重试在界面上等于不存在。
|
|
228
|
+
*/
|
|
229
|
+
const message = lastError instanceof Error ? lastError.message : String(lastError)
|
|
230
|
+
throw new Error(`${message}(已自动重试 ${attempts - 1} 次仍失败;可稍后重试此阶段,或检查账号额度与网络代理)`)
|
|
231
|
+
}
|
package/src/oplog.ts
CHANGED
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
import { mkdir } from 'node:fs/promises'
|
|
31
31
|
import { dirname } from 'node:path'
|
|
32
32
|
import { loadSqlite, type SqliteDatabase } from './fts.js'
|
|
33
|
+
import { applyRetention } from './retention.js'
|
|
33
34
|
import type { OperationDetail, OperationKind, OperationStatus } from './types.js'
|
|
34
35
|
|
|
35
36
|
/** 谁发起的:面板按钮,还是 Agent 的工具。 */
|
|
@@ -125,6 +126,12 @@ export class OperationLog {
|
|
|
125
126
|
this.db.prepare(
|
|
126
127
|
'INSERT INTO operations (id, kind, status, actor, kb, title, summary, started_at, finished_at, detail) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)',
|
|
127
128
|
).run(entry.id, entry.kind, entry.status, entry.actor, entry.kb, entry.title, entry.summary, entry.startedAt, entry.finishedAt ?? null, JSON.stringify(entry.detail))
|
|
129
|
+
/*
|
|
130
|
+
* 处理日志的保留上限(0070)。这张表原来只增不减:每编译一次、每导入一批都加行,
|
|
131
|
+
* 而 `detail` 里还塞着整批文件清单。上限同样只作用在**水位以上**的新行 ——
|
|
132
|
+
* 升级那一刻已有的日志一条不删(见 `retention.ts`)。
|
|
133
|
+
*/
|
|
134
|
+
applyRetention(this.db, 'operations', { table: 'operations', key: 'rowid', keep: 2000 })
|
|
128
135
|
}
|
|
129
136
|
|
|
130
137
|
async patch(
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 组织阶段(Organize)的 system 段。
|
|
3
|
+
*
|
|
4
|
+
* 与 `extract-contract.ts` 同一个理由:说明页要把「这一步发给模型的提示词」原样显示出来,
|
|
5
|
+
* 所以它必须能从浏览器 bundle 里 import。它原来住在 `card-organize.ts` 里,那个模块
|
|
6
|
+
* import 了 `node:crypto`(算版面指纹),客户端进不去。
|
|
7
|
+
*
|
|
8
|
+
* 服务端照旧通过 `card-organize.ts` 的 re-export 拿它 —— 界面与真正发出去的提示词
|
|
9
|
+
* 读的是同一份文本。
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 组织阶段的 system 提示词。
|
|
14
|
+
*
|
|
15
|
+
* 四条规则是这份提示词的全部:**只组织不创造**、**每条知识都要落地**、
|
|
16
|
+
* **每句都要挂引用**。其余全是输出形状。
|
|
17
|
+
*/
|
|
18
|
+
export function buildOrganizeSystem(wikiKind: 'fact' | 'way' = 'fact'): string {
|
|
19
|
+
return [
|
|
20
|
+
'你在把一批已经抽好的知识组织成一张 Wiki 卡片。',
|
|
21
|
+
'',
|
|
22
|
+
`文件类型:${wikiKind === 'way' ? 'Wiki Way;同 Object + Action 的 Procedure' : 'Wiki Fact;同 Object 的 Fact'}。Scene 可以不同,必须保留每条的条件、状态与限制。`,
|
|
23
|
+
'这些条目是 Knowledge 真源。你不许新增、',
|
|
24
|
+
'删除或改动它们说的事实。你能做的是:分小节、定顺序、把它们改写成读得下去的',
|
|
25
|
+
'叙述、给卡片起一个自然的标题、写一句概述。',
|
|
26
|
+
'',
|
|
27
|
+
'## 三条规则',
|
|
28
|
+
'',
|
|
29
|
+
'1. **只组织,不创造。** 你写的每一句话,说的都必须是这批知识里已经有的事。',
|
|
30
|
+
' 你觉得「应该还有一步」而知识里没有 —— 那就不要写。',
|
|
31
|
+
'2. **每条知识都要落地。** 输入给了几条,正文里就必须用上几条,一条都不能丢。',
|
|
32
|
+
' 可以把两条合成一行表格、合成一个步骤 —— 但它们的 id 都要挂上。',
|
|
33
|
+
'3. **每句都要挂引用。** 陈述事实的句子末尾挂 `[^知识id]`,可以挂多个。',
|
|
34
|
+
' 只有很短的导语(「这一节讲取数流程」)可以不挂。长句子不挂引用 = 没有来源的',
|
|
35
|
+
' 断言,整份方案会被打回。',
|
|
36
|
+
'4. **标题只做归纳,不要机械拼接。** 标题要能让人一眼知道卡片讲什么;不要照抄候选卡名,',
|
|
37
|
+
' 不要写成「对象的动作」「动作的动作」这类重复结构,不要加入知识里没有的新事实。',
|
|
38
|
+
' 保留区分这张卡所需的业务对象、字段名和动作词。知识条目附带的原文标题路径是定位线索,',
|
|
39
|
+
' 可用来补回被知识正文省略的对象或动作词;它不能单独证明新的业务事实。',
|
|
40
|
+
'',
|
|
41
|
+
'## 可以做的改写',
|
|
42
|
+
'',
|
|
43
|
+
'- 允许缩写与重排,不改变原意,不从 Fact 推导新方法,不从 Case 新提炼 Procedure。',
|
|
44
|
+
'- 把两条同类的知识合成一张表或一个步骤。',
|
|
45
|
+
'- 把字段名、SQL、URL 放进反引号。',
|
|
46
|
+
'- 加很短的小节导语,把一节的内容串起来。',
|
|
47
|
+
'',
|
|
48
|
+
'## 输出形状',
|
|
49
|
+
'',
|
|
50
|
+
'只回一个 JSON 对象,不要散文,不要代码围栏。',
|
|
51
|
+
'',
|
|
52
|
+
'```json',
|
|
53
|
+
'{',
|
|
54
|
+
' "title": "简洁、自然、可检索的标题;保留必要的业务对象、字段名和动作词",',
|
|
55
|
+
' "summary": "一句话说清这张卡讲什么。挂引用,如 [^k_abc]。",',
|
|
56
|
+
' "sections": [',
|
|
57
|
+
' {',
|
|
58
|
+
' "title": "一、这一节讲什么",',
|
|
59
|
+
' "blocks": [',
|
|
60
|
+
' { "kind": "prose", "text": "一段话。[^k_abc]" },',
|
|
61
|
+
' { "kind": "steps", "items": ["第一步。[^k_def]", "第二步。[^k_ghi]"] },',
|
|
62
|
+
' { "kind": "bullets", "items": ["一个要点。[^k_jkl]"] },',
|
|
63
|
+
' { "kind": "table", "header": ["", "甲", "乙"], "rows": [["来源", "A[^k_mno]", "B[^k_pqr]"]] },',
|
|
64
|
+
' { "kind": "note", "text": "一句提醒。[^k_stu]" }',
|
|
65
|
+
' ]',
|
|
66
|
+
' }',
|
|
67
|
+
' ]',
|
|
68
|
+
'}',
|
|
69
|
+
'```',
|
|
70
|
+
'',
|
|
71
|
+
'`kind` 只能是这五个之一:`prose`(一段话)、`steps`(有序步骤)、`bullets`(无序要点)、',
|
|
72
|
+
'`table`(对比表)、`note`(提醒)。表格的每一行列数必须与表头一致。',
|
|
73
|
+
'',
|
|
74
|
+
'二级章节用于召回;一个章节服务一个明确的信息需求或一组等价问法。',
|
|
75
|
+
'回答同一需求的内容放一起;服务不同需求时拆分;必要条件、例外、步骤不因形式被拆散。',
|
|
76
|
+
'不要套固定目录,不使用无主体的说明、其他、注意事项、操作步骤等标题。',
|
|
77
|
+
'标题写具体对象、任务、字段及改变答案的条件。章节不必等于一条 Fact 或 Procedure。',
|
|
78
|
+
'Scene 分支可用三级标题;正文不能再出现 Markdown 二级标题。',
|
|
79
|
+
'每节返回 section_id(复用已有 ID,新节为 null)、retrieval_need(检索需求)、knowledge_ids(正文引用的记录 ID)。',
|
|
80
|
+
'小节数量由检索需求决定;不要为凑目录数量而丢失知识或合并无关问题。协议最多支持 200 节,超过时应报错。',
|
|
81
|
+
].join('\n')
|
|
82
|
+
}
|
|
83
|
+
|