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.
Files changed (438) hide show
  1. package/README.md +118 -567
  2. package/cordis.patch.yml +5 -418
  3. package/eval/README.md +19 -8
  4. package/eval/benchmark-extraction-format.mjs +20 -0
  5. package/eval/evaluate-retrieval.mjs +17 -8
  6. package/eval/queries.example.jsonl +1 -0
  7. package/lib/client.js +4181 -3239
  8. package/lib/contract-envelope.d.ts +91 -0
  9. package/lib/contract-envelope.js +106 -0
  10. package/lib/contract-layout.d.ts +130 -0
  11. package/lib/contract-layout.js +138 -0
  12. package/lib/contract-refs.d.ts +39 -0
  13. package/lib/contract-refs.js +9 -0
  14. package/lib/contract-version.d.ts +311 -0
  15. package/lib/contract-version.js +270 -0
  16. package/lib/contract-wire.d.ts +147 -0
  17. package/lib/contract-wire.js +99 -0
  18. package/lib/contracts.d.ts +12 -0
  19. package/lib/contracts.js +12 -0
  20. package/lib/doc-page.js +2 -2
  21. package/lib/pages.js +3329 -1296
  22. package/lib/types/agent-behavior-rules.d.ts +10 -0
  23. package/lib/types/agent-behavior-rules.d.ts.map +1 -0
  24. package/lib/types/agent-behavior-rules.js +28 -0
  25. package/lib/types/agent-behavior-rules.js.map +1 -0
  26. package/lib/types/axis-registry.d.ts +37 -5
  27. package/lib/types/axis-registry.d.ts.map +1 -1
  28. package/lib/types/axis-registry.js +234 -26
  29. package/lib/types/axis-registry.js.map +1 -1
  30. package/lib/types/card-organize.d.ts +27 -12
  31. package/lib/types/card-organize.d.ts.map +1 -1
  32. package/lib/types/card-organize.js +58 -73
  33. package/lib/types/card-organize.js.map +1 -1
  34. package/lib/types/compiler/embedding-identity.d.ts +3 -0
  35. package/lib/types/compiler/embedding-identity.d.ts.map +1 -0
  36. package/lib/types/compiler/embedding-identity.js +24 -0
  37. package/lib/types/compiler/embedding-identity.js.map +1 -0
  38. package/lib/types/compiler/snapshot.d.ts +16 -0
  39. package/lib/types/compiler/snapshot.d.ts.map +1 -0
  40. package/lib/types/compiler/snapshot.js +2 -0
  41. package/lib/types/compiler/snapshot.js.map +1 -0
  42. package/lib/types/config-schema.d.ts +6 -3
  43. package/lib/types/config-schema.d.ts.map +1 -1
  44. package/lib/types/config-schema.js +6 -2
  45. package/lib/types/config-schema.js.map +1 -1
  46. package/lib/types/convert/host.d.ts +6 -5
  47. package/lib/types/convert/host.d.ts.map +1 -1
  48. package/lib/types/convert/host.js +58 -18
  49. package/lib/types/convert/host.js.map +1 -1
  50. package/lib/types/convert/ingest.d.ts +10 -1
  51. package/lib/types/convert/ingest.d.ts.map +1 -1
  52. package/lib/types/convert/ingest.js +68 -9
  53. package/lib/types/convert/ingest.js.map +1 -1
  54. package/lib/types/derive-contract.d.ts +3 -0
  55. package/lib/types/derive-contract.d.ts.map +1 -0
  56. package/lib/types/derive-contract.js +15 -0
  57. package/lib/types/derive-contract.js.map +1 -0
  58. package/lib/types/diagnosis/cards.d.ts +7 -3
  59. package/lib/types/diagnosis/cards.d.ts.map +1 -1
  60. package/lib/types/diagnosis/cards.js +13 -8
  61. package/lib/types/diagnosis/cards.js.map +1 -1
  62. package/lib/types/diagnosis/run.d.ts +4 -13
  63. package/lib/types/diagnosis/run.d.ts.map +1 -1
  64. package/lib/types/diagnosis/run.js +26 -16
  65. package/lib/types/diagnosis/run.js.map +1 -1
  66. package/lib/types/diagnosis/schema.js +2 -2
  67. package/lib/types/diagnosis/schema.js.map +1 -1
  68. package/lib/types/diagnosis/seed-source.d.ts +1 -1
  69. package/lib/types/diagnosis/seed-source.d.ts.map +1 -1
  70. package/lib/types/diagnosis/seed-source.js +5 -4
  71. package/lib/types/diagnosis/seed-source.js.map +1 -1
  72. package/lib/types/diagnosis/seed.d.ts +4 -4
  73. package/lib/types/diagnosis/seed.d.ts.map +1 -1
  74. package/lib/types/diagnosis/seed.js +6 -8
  75. package/lib/types/diagnosis/seed.js.map +1 -1
  76. package/lib/types/diagnosis/store.d.ts +24 -18
  77. package/lib/types/diagnosis/store.d.ts.map +1 -1
  78. package/lib/types/diagnosis/store.js +130 -65
  79. package/lib/types/diagnosis/store.js.map +1 -1
  80. package/lib/types/diagnosis/types.d.ts +47 -15
  81. package/lib/types/diagnosis/types.d.ts.map +1 -1
  82. package/lib/types/diagnosis/types.js.map +1 -1
  83. package/lib/types/environment/dsh-python.d.ts +77 -0
  84. package/lib/types/environment/dsh-python.d.ts.map +1 -0
  85. package/lib/types/environment/dsh-python.js +139 -0
  86. package/lib/types/environment/dsh-python.js.map +1 -0
  87. package/lib/types/environment/install.d.ts +15 -0
  88. package/lib/types/environment/install.d.ts.map +1 -0
  89. package/lib/types/environment/install.js +297 -0
  90. package/lib/types/environment/install.js.map +1 -0
  91. package/lib/types/environment/manifest.d.ts +208 -0
  92. package/lib/types/environment/manifest.d.ts.map +1 -0
  93. package/lib/types/environment/manifest.js +26 -0
  94. package/lib/types/environment/manifest.js.map +1 -0
  95. package/lib/types/environment/model-catalog.d.ts +223 -0
  96. package/lib/types/environment/model-catalog.d.ts.map +1 -0
  97. package/lib/types/environment/model-catalog.js +129 -0
  98. package/lib/types/environment/model-catalog.js.map +1 -0
  99. package/lib/types/environment/process.d.ts +10 -0
  100. package/lib/types/environment/process.d.ts.map +1 -0
  101. package/lib/types/environment/process.js +54 -0
  102. package/lib/types/environment/process.js.map +1 -0
  103. package/lib/types/environment/selection.d.ts +9 -0
  104. package/lib/types/environment/selection.d.ts.map +1 -0
  105. package/lib/types/environment/selection.js +29 -0
  106. package/lib/types/environment/selection.js.map +1 -0
  107. package/lib/types/environment/service.d.ts +64 -0
  108. package/lib/types/environment/service.d.ts.map +1 -0
  109. package/lib/types/environment/service.js +424 -0
  110. package/lib/types/environment/service.js.map +1 -0
  111. package/lib/types/environment/types.d.ts +56 -0
  112. package/lib/types/environment/types.d.ts.map +1 -0
  113. package/lib/types/environment/types.js +2 -0
  114. package/lib/types/environment/types.js.map +1 -0
  115. package/lib/types/events.d.ts +76 -0
  116. package/lib/types/events.d.ts.map +1 -0
  117. package/lib/types/events.js +52 -0
  118. package/lib/types/events.js.map +1 -0
  119. package/lib/types/extract-contract.d.ts +3 -0
  120. package/lib/types/extract-contract.d.ts.map +1 -0
  121. package/lib/types/extract-contract.js +41 -0
  122. package/lib/types/extract-contract.js.map +1 -0
  123. package/lib/types/extract-model.d.ts +5 -0
  124. package/lib/types/extract-model.d.ts.map +1 -1
  125. package/lib/types/extract-model.js.map +1 -1
  126. package/lib/types/extract-table-contract.d.ts +3 -0
  127. package/lib/types/extract-table-contract.d.ts.map +1 -0
  128. package/lib/types/extract-table-contract.js +27 -0
  129. package/lib/types/extract-table-contract.js.map +1 -0
  130. package/lib/types/extract-table.d.ts +8 -0
  131. package/lib/types/extract-table.d.ts.map +1 -0
  132. package/lib/types/extract-table.js +158 -0
  133. package/lib/types/extract-table.js.map +1 -0
  134. package/lib/types/extraction-runs.d.ts +30 -6
  135. package/lib/types/extraction-runs.d.ts.map +1 -1
  136. package/lib/types/extraction-runs.js +69 -8
  137. package/lib/types/extraction-runs.js.map +1 -1
  138. package/lib/types/fs-atomic.d.ts +0 -7
  139. package/lib/types/fs-atomic.d.ts.map +1 -1
  140. package/lib/types/fs-atomic.js +17 -2
  141. package/lib/types/fs-atomic.js.map +1 -1
  142. package/lib/types/images.d.ts +26 -0
  143. package/lib/types/images.d.ts.map +1 -0
  144. package/lib/types/images.js +196 -0
  145. package/lib/types/images.js.map +1 -0
  146. package/lib/types/index.d.ts +2 -2
  147. package/lib/types/index.d.ts.map +1 -1
  148. package/lib/types/index.js +598 -209
  149. package/lib/types/index.js.map +1 -1
  150. package/lib/types/intent/engine.d.ts +12 -4
  151. package/lib/types/intent/engine.d.ts.map +1 -1
  152. package/lib/types/intent/engine.js +43 -5
  153. package/lib/types/intent/engine.js.map +1 -1
  154. package/lib/types/intent/host.d.ts +5 -8
  155. package/lib/types/intent/host.d.ts.map +1 -1
  156. package/lib/types/intent/host.js +56 -11
  157. package/lib/types/intent/host.js.map +1 -1
  158. package/lib/types/intent/scope.d.ts +25 -0
  159. package/lib/types/intent/scope.d.ts.map +1 -0
  160. package/lib/types/intent/scope.js +116 -0
  161. package/lib/types/intent/scope.js.map +1 -0
  162. package/lib/types/intent/tools.d.ts +24 -20
  163. package/lib/types/intent/tools.d.ts.map +1 -1
  164. package/lib/types/intent/tools.js +65 -23
  165. package/lib/types/intent/tools.js.map +1 -1
  166. package/lib/types/intent/types.d.ts +11 -4
  167. package/lib/types/intent/types.d.ts.map +1 -1
  168. package/lib/types/knowledge-bases.d.ts +11 -5
  169. package/lib/types/knowledge-bases.d.ts.map +1 -1
  170. package/lib/types/knowledge-bases.js +52 -20
  171. package/lib/types/knowledge-bases.js.map +1 -1
  172. package/lib/types/knowledge-contract.d.ts +32 -0
  173. package/lib/types/knowledge-contract.d.ts.map +1 -0
  174. package/lib/types/knowledge-contract.js +116 -0
  175. package/lib/types/knowledge-contract.js.map +1 -0
  176. package/lib/types/knowledge.d.ts +31 -9
  177. package/lib/types/knowledge.d.ts.map +1 -1
  178. package/lib/types/knowledge.js +137 -60
  179. package/lib/types/knowledge.js.map +1 -1
  180. package/lib/types/layout.d.ts +10 -29
  181. package/lib/types/layout.d.ts.map +1 -1
  182. package/lib/types/layout.js +17 -36
  183. package/lib/types/layout.js.map +1 -1
  184. package/lib/types/materialize-snapshot.d.ts +49 -0
  185. package/lib/types/materialize-snapshot.d.ts.map +1 -0
  186. package/lib/types/materialize-snapshot.js +2 -0
  187. package/lib/types/materialize-snapshot.js.map +1 -0
  188. package/lib/types/migrate.d.ts +11 -0
  189. package/lib/types/migrate.d.ts.map +1 -1
  190. package/lib/types/migrate.js +83 -2
  191. package/lib/types/migrate.js.map +1 -1
  192. package/lib/types/model-text.d.ts +58 -1
  193. package/lib/types/model-text.d.ts.map +1 -1
  194. package/lib/types/model-text.js +85 -30
  195. package/lib/types/model-text.js.map +1 -1
  196. package/lib/types/oplog.d.ts.map +1 -1
  197. package/lib/types/oplog.js +7 -0
  198. package/lib/types/oplog.js.map +1 -1
  199. package/lib/types/organize-contract.d.ts +18 -0
  200. package/lib/types/organize-contract.d.ts.map +1 -0
  201. package/lib/types/organize-contract.js +82 -0
  202. package/lib/types/organize-contract.js.map +1 -0
  203. package/lib/types/pipeline/engine.d.ts +66 -0
  204. package/lib/types/pipeline/engine.d.ts.map +1 -0
  205. package/lib/types/pipeline/engine.js +352 -0
  206. package/lib/types/pipeline/engine.js.map +1 -0
  207. package/lib/types/pipeline/store.d.ts +73 -0
  208. package/lib/types/pipeline/store.d.ts.map +1 -0
  209. package/lib/types/pipeline/store.js +143 -0
  210. package/lib/types/pipeline/store.js.map +1 -0
  211. package/lib/types/pipeline/types.d.ts +102 -0
  212. package/lib/types/pipeline/types.d.ts.map +1 -0
  213. package/lib/types/pipeline/types.js +5 -0
  214. package/lib/types/pipeline/types.js.map +1 -0
  215. package/lib/types/present.d.ts +2 -0
  216. package/lib/types/present.d.ts.map +1 -1
  217. package/lib/types/present.js +9 -4
  218. package/lib/types/present.js.map +1 -1
  219. package/lib/types/preset-ids.d.ts +4 -0
  220. package/lib/types/preset-ids.d.ts.map +1 -0
  221. package/lib/types/preset-ids.js +6 -0
  222. package/lib/types/preset-ids.js.map +1 -0
  223. package/lib/types/query-analysis.d.ts +13 -1
  224. package/lib/types/query-analysis.d.ts.map +1 -1
  225. package/lib/types/query-analysis.js +62 -6
  226. package/lib/types/query-analysis.js.map +1 -1
  227. package/lib/types/recall-rank.d.ts +3 -3
  228. package/lib/types/recall-rank.d.ts.map +1 -1
  229. package/lib/types/recall-rank.js +4 -4
  230. package/lib/types/recall-rank.js.map +1 -1
  231. package/lib/types/retention.d.ts +39 -0
  232. package/lib/types/retention.d.ts.map +1 -0
  233. package/lib/types/retention.js +42 -0
  234. package/lib/types/retention.js.map +1 -0
  235. package/lib/types/retrieval/vector-index.d.ts +32 -0
  236. package/lib/types/retrieval/vector-index.d.ts.map +1 -0
  237. package/lib/types/retrieval/vector-index.js +15 -0
  238. package/lib/types/retrieval/vector-index.js.map +1 -0
  239. package/lib/types/retrieval/visibility.d.ts +6 -0
  240. package/lib/types/retrieval/visibility.d.ts.map +1 -0
  241. package/lib/types/retrieval/visibility.js +11 -0
  242. package/lib/types/retrieval/visibility.js.map +1 -0
  243. package/lib/types/runtime.d.ts +272 -27
  244. package/lib/types/runtime.d.ts.map +1 -1
  245. package/lib/types/runtime.js +2751 -537
  246. package/lib/types/runtime.js.map +1 -1
  247. package/lib/types/settings-schema.d.ts +17 -15
  248. package/lib/types/settings-schema.d.ts.map +1 -1
  249. package/lib/types/settings-schema.js +50 -47
  250. package/lib/types/settings-schema.js.map +1 -1
  251. package/lib/types/settings-volatile.d.ts +4 -4
  252. package/lib/types/settings-volatile.js +4 -4
  253. package/lib/types/source-evidence.d.ts +14 -0
  254. package/lib/types/source-evidence.d.ts.map +1 -0
  255. package/lib/types/source-evidence.js +36 -0
  256. package/lib/types/source-evidence.js.map +1 -0
  257. package/lib/types/store/axis-references.d.ts +5 -0
  258. package/lib/types/store/axis-references.d.ts.map +1 -0
  259. package/lib/types/store/axis-references.js +106 -0
  260. package/lib/types/store/axis-references.js.map +1 -0
  261. package/lib/types/store/derived.d.ts +12 -1
  262. package/lib/types/store/derived.d.ts.map +1 -1
  263. package/lib/types/store/derived.js +71 -12
  264. package/lib/types/store/derived.js.map +1 -1
  265. package/lib/types/store/knowledge-db.d.ts +31 -1
  266. package/lib/types/store/knowledge-db.d.ts.map +1 -1
  267. package/lib/types/store/knowledge-db.js +252 -18
  268. package/lib/types/store/knowledge-db.js.map +1 -1
  269. package/lib/types/store/migrate.d.ts.map +1 -1
  270. package/lib/types/store/migrate.js +17 -6
  271. package/lib/types/store/migrate.js.map +1 -1
  272. package/lib/types/trajectory-types.d.ts +172 -0
  273. package/lib/types/trajectory-types.d.ts.map +1 -0
  274. package/lib/types/trajectory-types.js +36 -0
  275. package/lib/types/trajectory-types.js.map +1 -0
  276. package/lib/types/types.d.ts +59 -27
  277. package/lib/types/types.d.ts.map +1 -1
  278. package/lib/types/types.js +6 -15
  279. package/lib/types/types.js.map +1 -1
  280. package/lib/types/wiki-finalize.d.ts +16 -0
  281. package/lib/types/wiki-finalize.d.ts.map +1 -1
  282. package/lib/types/wiki-finalize.js +26 -0
  283. package/lib/types/wiki-finalize.js.map +1 -1
  284. package/lib/types/wiki-materialize.d.ts +4 -0
  285. package/lib/types/wiki-materialize.d.ts.map +1 -1
  286. package/lib/types/wiki-materialize.js +21 -7
  287. package/lib/types/wiki-materialize.js.map +1 -1
  288. package/lib/types/wiki-trial-types.d.ts +87 -0
  289. package/lib/types/wiki-trial-types.d.ts.map +1 -1
  290. package/lib/types/wiki-trial-types.js +0 -16
  291. package/lib/types/wiki-trial-types.js.map +1 -1
  292. package/lib/types/wiki-trial.d.ts +40 -16
  293. package/lib/types/wiki-trial.d.ts.map +1 -1
  294. package/lib/types/wiki-trial.js +337 -224
  295. package/lib/types/wiki-trial.js.map +1 -1
  296. package/package.json +29 -20
  297. package/python/prepare-models.py +19 -0
  298. package/python/requirements.txt +8 -6
  299. package/scripts/doctor.mjs +13 -19
  300. package/scripts/environment.mjs +29 -0
  301. package/scripts/setup-embedding.sh +15 -5
  302. package/src/agent-behavior-rules.ts +37 -0
  303. package/src/axis-registry.ts +234 -27
  304. package/src/card-organize.ts +69 -75
  305. package/src/client/AgentBehaviorRulesCard.tsx +65 -0
  306. package/src/client/AttributionEventGuide.tsx +41 -39
  307. package/src/client/AxisRegistrySection.tsx +204 -164
  308. package/src/client/CompileDialogs.tsx +44 -29
  309. package/src/client/DeleteDocumentDialog.tsx +36 -5
  310. package/src/client/DirectoryPicker.tsx +0 -10
  311. package/src/client/EnvironmentSetup.tsx +243 -0
  312. package/src/client/ExpansionGraph.tsx +13 -7
  313. package/src/client/ExtractionTasksPage.tsx +578 -0
  314. package/src/client/GuideArchitectureCanvas.tsx +470 -0
  315. package/src/client/ImportFilesDialog.tsx +2 -13
  316. package/src/client/IntentLogic.tsx +2 -2
  317. package/src/client/IntentTab.tsx +118 -47
  318. package/src/client/KnowledgeBaseTab.tsx +277 -197
  319. package/src/client/KnowledgeLayerSection.tsx +24 -6
  320. package/src/client/KnowledgePanel.tsx +58 -93
  321. package/src/client/KnowledgeSettingsDrawer.tsx +90 -0
  322. package/src/client/ListPager.tsx +15 -5
  323. package/src/client/MaterializeTrajectoryView.tsx +124 -0
  324. package/src/client/NodeSettings.tsx +210 -89
  325. package/src/client/NormalizeTrajectoryView.tsx +136 -0
  326. package/src/client/PipelineNotice.tsx +26 -0
  327. package/src/client/PreviewSections.tsx +118 -51
  328. package/src/client/RecallPanel.tsx +89 -85
  329. package/src/client/TabGuide.tsx +159 -184
  330. package/src/client/TrialReportView.tsx +391 -214
  331. package/src/client/TypeDefinitionDrawer.tsx +150 -23
  332. package/src/client/WikiCardPreview.tsx +62 -16
  333. package/src/client/WikiFlowPanel.tsx +4 -4
  334. package/src/client/arch/NodeLogicPanel.tsx +3 -4
  335. package/src/client/arch/model.ts +6 -9
  336. package/src/client/architecture.tsx +23 -33
  337. package/src/client/attribution/AttributionGraph.tsx +10 -6
  338. package/src/client/attribution/AttributionTab.tsx +136 -84
  339. package/src/client/attribution/CaseView.tsx +3 -1
  340. package/src/client/attribution/EventView.tsx +108 -0
  341. package/src/client/attribution/RunView.tsx +2 -2
  342. package/src/client/attribution/StageChrome.tsx +34 -3
  343. package/src/client/attribution/ViewSwitch.tsx +20 -5
  344. package/src/client/attribution/graph-options.ts +47 -39
  345. package/src/client/attribution/model.ts +17 -10
  346. package/src/client/config-scope.ts +3 -3
  347. package/src/client/graph/palette.ts +165 -0
  348. package/src/client/index.ts +49 -42
  349. package/src/client/pages.css +459 -135
  350. package/src/client/pages.tsx +37 -9
  351. package/src/client/problem-domains.ts +1 -1
  352. package/src/client/session-remote.ts +9 -0
  353. package/src/client/styles.css +205 -62
  354. package/src/client/wiki-trial.ts +44 -3
  355. package/src/compiler/embedding-identity.ts +21 -0
  356. package/src/compiler/snapshot.ts +17 -0
  357. package/src/config-schema.ts +8 -3
  358. package/src/convert/host.ts +56 -21
  359. package/src/convert/ingest.ts +74 -10
  360. package/src/derive-contract.ts +14 -0
  361. package/src/diagnosis/cards.ts +13 -8
  362. package/src/diagnosis/run.ts +27 -17
  363. package/src/diagnosis/schema.ts +2 -2
  364. package/src/diagnosis/seed-source.ts +5 -4
  365. package/src/diagnosis/seed.ts +6 -8
  366. package/src/diagnosis/store.ts +138 -69
  367. package/src/diagnosis/types.ts +34 -15
  368. package/src/environment/dsh-python.ts +156 -0
  369. package/src/environment/install.ts +244 -0
  370. package/src/environment/manifest.ts +28 -0
  371. package/src/environment/model-catalog.ts +147 -0
  372. package/src/environment/process.ts +54 -0
  373. package/src/environment/selection.ts +29 -0
  374. package/src/environment/service.ts +348 -0
  375. package/src/environment/types.ts +45 -0
  376. package/src/events.ts +108 -0
  377. package/src/extract-contract.ts +42 -0
  378. package/src/extract-model.ts +10 -1
  379. package/src/extract-table-contract.ts +26 -0
  380. package/src/extract-table.ts +132 -0
  381. package/src/extraction-runs.ts +70 -11
  382. package/src/fs-atomic.ts +19 -2
  383. package/src/images.ts +203 -0
  384. package/src/index.ts +553 -205
  385. package/src/intent/README.md +8 -6
  386. package/src/intent/engine.ts +44 -6
  387. package/src/intent/host.ts +59 -18
  388. package/src/intent/scope.ts +125 -0
  389. package/src/intent/tools.ts +70 -28
  390. package/src/intent/types.ts +11 -4
  391. package/src/knowledge-bases.ts +56 -20
  392. package/src/knowledge-contract.ts +114 -0
  393. package/src/knowledge.ts +138 -69
  394. package/src/layout.ts +17 -37
  395. package/src/materialize-snapshot.ts +46 -0
  396. package/src/migrate.ts +75 -2
  397. package/src/model-text.ts +109 -4
  398. package/src/oplog.ts +7 -0
  399. package/src/organize-contract.ts +83 -0
  400. package/src/pipeline/engine.ts +323 -0
  401. package/src/pipeline/store.ts +147 -0
  402. package/src/pipeline/types.ts +93 -0
  403. package/src/present.ts +10 -4
  404. package/src/preset-ids.ts +6 -0
  405. package/src/python/embedding_worker.py +66 -2
  406. package/src/query-analysis.ts +68 -8
  407. package/src/recall-rank.ts +5 -5
  408. package/src/retention.ts +76 -0
  409. package/src/retrieval/vector-index.ts +45 -0
  410. package/src/retrieval/visibility.ts +14 -0
  411. package/src/runtime.ts +2708 -567
  412. package/src/settings-schema.ts +11 -8
  413. package/src/settings-volatile.ts +4 -4
  414. package/src/source-evidence.ts +37 -0
  415. package/src/store/axis-references.ts +96 -0
  416. package/src/store/derived.ts +70 -12
  417. package/src/store/knowledge-db.ts +248 -17
  418. package/src/store/migrate.ts +16 -6
  419. package/src/trajectory-types.ts +142 -0
  420. package/src/types.ts +61 -35
  421. package/src/wiki-finalize.ts +28 -0
  422. package/src/wiki-materialize.ts +25 -6
  423. package/src/wiki-trial-types.ts +83 -1
  424. package/src/wiki-trial.ts +357 -185
  425. package/lib/types/intent/preset-tools.d.ts +0 -37
  426. package/lib/types/intent/preset-tools.d.ts.map +0 -1
  427. package/lib/types/intent/preset-tools.js +0 -45
  428. package/lib/types/intent/preset-tools.js.map +0 -1
  429. package/preset/tita-data-agent/agent.cordis.yml +0 -394
  430. package/preset/tita-data-agent/preset.yml +0 -3
  431. package/scripts/install-agent-preset.mjs +0 -92
  432. package/scripts/sync-agent-preset.mjs +0 -188
  433. package/src/client/AgentPresetCard.tsx +0 -247
  434. package/src/client/agent-preset.ts +0 -121
  435. package/src/client/convert/ConvertPanel.tsx +0 -583
  436. package/src/client/convert/styles.css +0 -138
  437. package/src/client/convert/styles.ts +0 -49
  438. package/src/intent/preset-tools.ts +0 -48
@@ -1,37 +0,0 @@
1
- /**
2
- * `intent_*` 工具的 **agent 平面**挂载行(0029)。
3
- *
4
- * ## 为什么这两个工具要单独一个挂载行
5
- *
6
- * 意图记录是这个方案自己的东西:只有跑 TitaAgent 那套组合的会话才该在提示词里看到
7
- * `intent_record`。而 DSH 里「只有某个 preset 能用」唯一支持的形态就是**注册作用域** ——
8
- * 注册在哪个作用域,就只在哪个作用域可见。宿主平面注册 = 全局工具,每个 agent 都会
9
- * 看到它;`ctx.tools.restrict()` 只能做减法、且宿主平面调它会直接抛,没有「只给某一个
10
- * 作用域」的正向开关。
11
- *
12
- * 所以这两个工具的注册搬到这里:这个模块**只被自定义 preset 的 `agent.cordis.yml`
13
- * 挂载**,它 `apply` 时拿到的 ctx 是那个 preset 的 standing mount 作用域,于是注册出来
14
- * 的工具只覆盖加入该 preset 的会话。别的 preset、临时会话都看不到它们 —— 而「看不到」
15
- * 与「调不了」在 `dsh-tools` 里是同一件事(不可见的工具会以 `UNKNOWN_TOOL` 拒掉)。
16
- *
17
- * ## 两条约束
18
- *
19
- * 1. **它不 provide 任何服务。** preset 的挂载审计拒绝在根 realm 发布服务;这个行只往
20
- * `tools` 注册表里塞定义,和随包的 `tool-fs` / `tool-bash` 是同一类行。
21
- * 2. **它不自己造引擎。** 引擎(设置、轮次记账、HTTP 只读面)住在宿主平面,通过
22
- * `INTENT_SERVICE` 暴露操作面;这一行只按那个面注册工具。引擎因此只有一份。
23
- *
24
- * @module
25
- */
26
- import type { Context } from '@deepseek-ai/cordis';
27
- /** 与 `package.json` 的 `exports["./intent-tools"]` 对应。 */
28
- export declare const name = "dsh-data-domain-knowledge/intent-tools";
29
- /**
30
- * `tools` 是注册目标;`INTENT_SERVICE` 是引擎操作面。
31
- *
32
- * 把服务写进 `inject` 而不是在 `apply` 里判空:宿主平面还没就绪时这一行应该**等**,
33
- * 而不是挂上一个没有引擎可用的空壳 —— 后者会让模型看到一个必然报错的工具。
34
- */
35
- export declare const inject: readonly ["tools", "titaDataAgentIntent"];
36
- export declare function apply(ctx: Context): void;
37
- //# sourceMappingURL=preset-tools.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"preset-tools.d.ts","sourceRoot":"","sources":["../../../src/intent/preset-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAIlD,yDAAyD;AACzD,eAAO,MAAM,IAAI,2CAA2C,CAAA;AAE5D;;;;;GAKG;AACH,eAAO,MAAM,MAAM,2CAAqC,CAAA;AAExD,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAMxC"}
@@ -1,45 +0,0 @@
1
- /**
2
- * `intent_*` 工具的 **agent 平面**挂载行(0029)。
3
- *
4
- * ## 为什么这两个工具要单独一个挂载行
5
- *
6
- * 意图记录是这个方案自己的东西:只有跑 TitaAgent 那套组合的会话才该在提示词里看到
7
- * `intent_record`。而 DSH 里「只有某个 preset 能用」唯一支持的形态就是**注册作用域** ——
8
- * 注册在哪个作用域,就只在哪个作用域可见。宿主平面注册 = 全局工具,每个 agent 都会
9
- * 看到它;`ctx.tools.restrict()` 只能做减法、且宿主平面调它会直接抛,没有「只给某一个
10
- * 作用域」的正向开关。
11
- *
12
- * 所以这两个工具的注册搬到这里:这个模块**只被自定义 preset 的 `agent.cordis.yml`
13
- * 挂载**,它 `apply` 时拿到的 ctx 是那个 preset 的 standing mount 作用域,于是注册出来
14
- * 的工具只覆盖加入该 preset 的会话。别的 preset、临时会话都看不到它们 —— 而「看不到」
15
- * 与「调不了」在 `dsh-tools` 里是同一件事(不可见的工具会以 `UNKNOWN_TOOL` 拒掉)。
16
- *
17
- * ## 两条约束
18
- *
19
- * 1. **它不 provide 任何服务。** preset 的挂载审计拒绝在根 realm 发布服务;这个行只往
20
- * `tools` 注册表里塞定义,和随包的 `tool-fs` / `tool-bash` 是同一类行。
21
- * 2. **它不自己造引擎。** 引擎(设置、轮次记账、HTTP 只读面)住在宿主平面,通过
22
- * `INTENT_SERVICE` 暴露操作面;这一行只按那个面注册工具。引擎因此只有一份。
23
- *
24
- * @module
25
- */
26
- import { INTENT_SERVICE } from './host.js';
27
- import { registerIntentTools } from './tools.js';
28
- /** 与 `package.json` 的 `exports["./intent-tools"]` 对应。 */
29
- export const name = 'dsh-data-domain-knowledge/intent-tools';
30
- /**
31
- * `tools` 是注册目标;`INTENT_SERVICE` 是引擎操作面。
32
- *
33
- * 把服务写进 `inject` 而不是在 `apply` 里判空:宿主平面还没就绪时这一行应该**等**,
34
- * 而不是挂上一个没有引擎可用的空壳 —— 后者会让模型看到一个必然报错的工具。
35
- */
36
- export const inject = ['tools', INTENT_SERVICE];
37
- export function apply(ctx) {
38
- const service = ctx.get(INTENT_SERVICE);
39
- if (!service)
40
- return;
41
- // `effect` 把 disposer 绑到这个 fiber 上:卸载时两个工具一起撤掉,不留下悬空的
42
- // 注册。preset 换掉或进程退出都走这条路径。
43
- ctx.effect(() => registerIntentTools(ctx, service), 'tita intent tools');
44
- }
45
- //# sourceMappingURL=preset-tools.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"preset-tools.js","sourceRoot":"","sources":["../../../src/intent/preset-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EAAE,cAAc,EAAsB,MAAM,WAAW,CAAA;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAEhD,yDAAyD;AACzD,MAAM,CAAC,MAAM,IAAI,GAAG,wCAAwC,CAAA;AAE5D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,OAAO,EAAE,cAAc,CAAU,CAAA;AAExD,MAAM,UAAU,KAAK,CAAC,GAAY;IAChC,MAAM,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC,cAAc,CAA8B,CAAA;IACpE,IAAI,CAAC,OAAO;QAAE,OAAM;IACpB,sDAAsD;IACtD,2BAA2B;IAC3B,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,mBAAmB,CAAC,GAAuE,EAAE,OAAO,CAAC,EAAE,mBAAmB,CAAC,CAAA;AAC9I,CAAC"}
@@ -1,394 +0,0 @@
1
- # Tita Data Agent 的 agent 组合(0029)。
2
- #
3
- # 这是 `standard` 的一份**拷贝**,只改了四件事。preset 是「一份完整组合」,没有
4
- # patch 语义(`dsh-agent-presets` 的 authoring 是 copy-only),所以它必须是一整份
5
- # 文件、而不是对 standard 的增量。
6
- #
7
- # 改了什么:
8
- #
9
- # 1. **身份**(`persona` 行):把「你是一个编码 Agent」换成 Tita Data Agent 自己的
10
- # 提示词。这一行是**这个 preset 存在的理由** —— 它 shadow 掉部署级的 persona,
11
- # 所以只有加入这个 preset 的会话会以数据 Agent 的身份说话。提示词正文就在下面,
12
- # 直接改它即可;改完**新建一个会话**才生效(preset 在会话创建时固定)。
13
- # 2. **意图工具**(`intent-tools` 行):`intent_record` / `intent_store_view` 两个工具
14
- # 搬到 agent 平面,只有这个 preset 的会话能看到。
15
- # DSH 里「只有某个 preset 能用」唯一支持的形态就是注册作用域,所以它们必须在这里
16
- # 挂载,而不是在宿主平面全局注册(那会让每个 agent 都看到 intent_record)。
17
- # 3. **子代理不许继承意图工具**:子代理会加入父会话的组合,所以要在 delegation 的每一
18
- # 行上显式 deny 掉 —— 意图记录描述的是「用户在跟 Agent 要什么」,子代理做的是被拆
19
- # 出来的一个片段,它记一条意图只会污染任务树。
20
- # 4. 其余每一行都与 `standard` 逐字相同:工具集不变,这个 preset 换的是身份与意图
21
- # 能力,不是一个更小的 Agent。
22
- #
23
- # 其余纪律与 `standard` 一致:这是 AGENT-PLANE 组合,roster 在 standing scope 下挂载
24
- # 一次,每个命名它的会话按作用域父子关系加入。需要 provide 服务的行必须落在带
25
- # `isolate` realm 的 group 里,否则它会发布到根 realm(进程级)并被挂载审计拒绝 ——
26
- # 本文件里唯一这样的行是 delegation 那个 group。
27
-
28
- # ── identity ────────────────────────────────────────────────────────────────
29
-
30
- # The preset's own persona, shadowing the deployment default for this agent.
31
- # `{{model}}` and `{{cwd}}` resolve from the agent's own route and workspace.
32
- - id: persona
33
- name: '@deepseek-ai/dsh-persona'
34
- config:
35
- # `{{model}}` / `{{cwd}}` 从本会话自己的路由与工作区解析。
36
- suffix: Your working directory is {{cwd}}.
37
- # ↓↓↓ Tita Data Agent 的提示词。**要改的就是这一段。** ↓↓↓
38
- prefix: |
39
- You are Tita Data Agent, the data analyst on this deployment. You are powered
40
- by the {{model}} model. Your job is to answer questions about this
41
- organisation's business with evidence, and to write down what you learn so the
42
- next answer is cheaper than this one.
43
-
44
- ## What you work with
45
-
46
- - **The knowledge store.** Each knowledge base is one directory holding three
47
- things. `knowledge.db` is the knowledge itself: SourceRaw (the original
48
- business documents, never rewritten, kept so a conclusion can point back at
49
- where it came from), the cards people read — one per entity, each with
50
- mandatory `source_refs`, each following a type (`concept`, `metric`, `table`,
51
- `event`, `playbook`, `case`) — and every version of both, plus who changed
52
- what and when. `derived.db` is what `recall_knowledge` actually searches:
53
- wikiNotes, a vector index, a knowledge graph and a keyword index; it is
54
- recomputed, never backed up. `assets/` holds images. There are no
55
- per-segment folders inside a base; use the knowledge tools, not the
56
- filesystem, to read or write documents. There can be several bases.
57
-
58
- - **The data surfaces, which are a different thing.** `workbook_*` reads and
59
- writes the workbooks the user has open; `notebook_*` runs SQL in the user's
60
- own browser. That is where a number is *computed*. The knowledge store is
61
- where a number is *defined* — a `metric` card says how it must be calculated,
62
- a `table` card says what one row means. Computing without the definition gets
63
- you a number nobody agreed to.
64
-
65
- - **Conversion.** `convert_source` turns a local file (including a web page
66
- saved to disk as `.html`) or a video into knowledge-ready Markdown and says
67
- where it landed. It never fetches a URL itself. It is not knowledge until
68
- `convert_ingest` has run, so keep saying which of the two steps you are on.
69
-
70
- ## Working rules
71
-
72
- 1. **Record the intent before the work.** Call `intent_record` with what the
73
- user wants and what you are about to do, before you do it. The vocabulary,
74
- and the rule for continuing existing work instead of starting a new task,
75
- live in that tool's own description. The record never gates the request:
76
- record, then continue.
77
- 2. **Recall before you answer about this organisation.** For its own rules,
78
- definitions, metrics, processes or history, call `recall_knowledge` first and
79
- answer from what comes back. An empty result is a finding, not a licence to
80
- improvise — say the store has nothing on it. The wiki layer answers "what does
81
- this organisation mean by X"; when you need "where exactly does it say that",
82
- or a card and the document behind it disagree, go read the source.
83
- 3. **Never invent a number.** Every figure you report must come from a tool
84
- result in this turn, and you must say which one. "I don't have that data" is
85
- a correct answer; a made-up number is not.
86
- 4. **Compiling is the normal path, and it writes cards by itself.** You do not
87
- have to create wiki cards: when a source is added or changed, `rebuild_knowledge`
88
- extracts entities from it, follows each wiki type's schema (required sections and
89
- fields), checks whether the wiki already has that entity, and either appends to
90
- the existing card or creates a new one. A card with missing sections is still
91
- written — the store keeps what it knows and fills the rest in when a later
92
- document covers it. So after adding a source, rebuild; then `recall_knowledge`
93
- and answer from what comes back. **More than one document at a time: use
94
- `import_sources`** — it writes the whole batch and compiles once, in one call.
95
- Ten documents through `add_source` means ten approvals and ten compiles, and the
96
- first nine results are thrown away by the tenth.
97
- 5. **You can add to the wiki, but you cannot rewrite it.** Call `propose_wiki_cards`
98
- with the `source_id` you just wrote and cards whose `source_refs` already exist in
99
- the store when you already have structured cards in hand — it writes them
100
- straight into `02_wiki`, they are recalled from the next compile on. A card whose
101
- refs point nowhere is rejected, and rightly so. **A card body is read-only**: it
102
- belongs to the compiler. When something in the store is wrong, or a card and its
103
- source disagree, do not rewrite it — attach an annotation with
104
- `annotate_wiki_card` (`kind: anomaly` when the numbers or definitions do not add
105
- up), or call `set_knowledge_status` to mark it `problem` and say what is wrong.
106
- Cards marked `problem` drop out of recall by default — that is how a wrong
107
- definition stops propagating. Everything else is reviewed by a human after entry:
108
- review raises a card's score, and an anomaly lowers it, but an
109
- anomaly-flagged card is still recalled.
110
- 6. **Never invent a knowledge base id.** Call `list_knowledge_bases` before
111
- addressing one you have not seen this session; omit `kb` only when the
112
- default base is genuinely the right one.
113
- 7. **Be concrete about uncertainty.** When sources disagree, present both and
114
- name them. When a conclusion rests on a single document, say so.
115
- 8. **Ask only what the user owns.** Which of two readings they meant, what
116
- matters more, what to do next — ask. Anything you can look up, look up
117
- instead of asking.
118
- 9. **Deliverables belong to the project, not to your home.** Write every file
119
- you produce for the user under `output/<YYYY-MM-DD>/` in your working
120
- directory, never into the Agent root: the Agent root accumulates across
121
- projects, a deliverable belongs to one. Name the file `<中文名>.<ext>` — at
122
- most 25 characters, keeping 汉字, letters, digits, `-`, `_` and `.`, and
123
- turning spaces and punctuation into `-` (so `销售汇总` stays `销售汇总`, and
124
- you write `月度销售汇总.xlsx`, not `output1.xlsx`). **Do not repeat the date
125
- in the file name**: the directory already carries it, and the name alone has
126
- to say what the file is a year later. Append `-2`, `-3` rather than
127
- overwriting, and say the path in your answer.
128
-
129
- ## How to write
130
-
131
- Answer in the user's language. Lead with the answer, then the evidence. Prefer
132
- a table when you are comparing things and a short paragraph when you are not.
133
- Skip preamble and praise; the user is here for the analysis.
134
- # ↑↑↑ Tita Data Agent 的提示词结束 ↑↑↑
135
-
136
- - id: agent-instructions
137
- name: '@deepseek-ai/dsh-agent-instructions'
138
- config:
139
- maxBytes: 65536
140
-
141
- # ── 意图记录(agent 平面)────────────────────────────────────────────────────
142
- #
143
- # 0029 之前这三个工具由知识插件在**宿主平面**全局注册,于是每个 agent、每个 preset
144
- # 的会话都会在提示词里看到 `intent_record`。现在它们只在这里挂载:这个模块只往
145
- # `tools` 注册表里塞定义、不 provide 任何服务,所以和随包的 `tool-fs` 一样不需要
146
- # realm,而它的注册只覆盖加入本 preset 的会话。
147
- #
148
- # 引擎本身(设置、轮次记账、`/intent/**` 只读面)仍在宿主平面,通过
149
- # `titaDataAgentIntent` 服务把操作面暴露给这一行 —— 引擎只有一份。
150
- - id: intent-tools
151
- name: 'dsh-data-domain-knowledge/intent-tools'
152
-
153
- # ── shell ───────────────────────────────────────────────────────────────────
154
-
155
- # `shell-env` stays in the HOST composition: `apps/cli/src/web.ts` injects it to
156
- # publish `DSH_WEB_URL`/`DSH_WEB_MODE`, and a host row that injects a service is
157
- # the criterion for host-plane ownership — injection resolves before any session
158
- # exists, so there is no agent to key by. Behind a preset realm those variables
159
- # never reached the model's shell at all. Both shell tools consume the host
160
- # registry from here; their executors (`bash-sandbox`/`pwsh-sandbox`) are
161
- # host-plane too.
162
- - id: tool-bash
163
- name: '@deepseek-ai/dsh-tool-bash'
164
- disabled: !!js process.platform === 'win32'
165
-
166
- - id: tool-pwsh
167
- name: '@deepseek-ai/dsh-tool-pwsh'
168
- disabled: !!js process.platform !== 'win32'
169
-
170
- # ── filesystem ──────────────────────────────────────────────────────────────
171
-
172
- # Both register into the host `tools` registry and provide nothing, so
173
- # they need no realm. The `fs` service and its policy stay in the host.
174
- - id: tool-fs
175
- name: '@deepseek-ai/dsh-tool-fs'
176
-
177
- - id: tool-fs-search
178
- name: '@deepseek-ai/dsh-tool-fs-search'
179
- config:
180
- sampleOverCapGlobResults: false
181
-
182
- # ── background jobs ────────────────────────────────────────────────────────
183
-
184
- # Only the model-facing controls. The task REGISTRY stays on the host plane:
185
- # its producers sit outside any realm this file could put it in — `tool-bash`
186
- # above resolves it with `ctx.get`, and an entry-local realm here is invisible
187
- # to every sibling row, so `run_in_background` would answer "background jobs
188
- # unavailable" while these controls sat in the catalog. The registry is keyed by
189
- # owning agent anyway, so one host instance serves every session. What a preset
190
- # chooses is whether its agent can collect and stop background work at all.
191
- - id: tool-jobs
192
- name: '@deepseek-ai/dsh-tool-jobs'
193
-
194
- # ── skills ──────────────────────────────────────────────────────────────────
195
-
196
- # The skill REGISTRY lives in the host composition and is layered per scope:
197
- # these rows register into THIS preset's layer of it, so they need no realm.
198
- # `skill-filesystem` contributes local-root discovery for agents on this preset, and
199
- # `tool-skill` gives them the catalog and loader; the merged catalog also
200
- # carries whatever the deployment registered globally (repository plugins).
201
- - id: skill-filesystem
202
- name: '@deepseek-ai/dsh-skill-filesystem'
203
-
204
- - id: tool-skill
205
- name: '@deepseek-ai/dsh-tool-skill'
206
-
207
- # ── goals ───────────────────────────────────────────────────────────────────
208
-
209
- # The goal service and session driver stay on the host plane, where the Gateway
210
- # can resolve them. The human command and model-facing tool register into this
211
- # preset's scoped layers.
212
- - id: command-goal
213
- name: '@deepseek-ai/dsh-command-goal'
214
-
215
- - id: tool-goal
216
- name: '@deepseek-ai/dsh-tool-goal'
217
-
218
- # ── plan mode ───────────────────────────────────────────────────────────────
219
-
220
- # Plan state is per-agent by nature, so an entry-local realm is not a
221
- # workaround here — it is the correct lifetime.
222
- - id: planning
223
- name: cordis:group
224
- group: true
225
- isolate:
226
- planMode: true
227
- config:
228
- - id: plan-mode
229
- name: '@deepseek-ai/dsh-plan-mode'
230
- config:
231
- section: |
232
- You are in plan mode. Stay in plan mode until exit_plan_mode succeeds or the user switches the session mode. Imperative language to implement changes means plan the implementation, not execute it. A user's conversational agreement — including an answer confirming something you asked — approves nothing and does not end plan mode; fold the confirmed decision into the plan and submit it through exit_plan_mode.
233
-
234
- Explore first. Use non-mutating reads, searches, static analysis, and checks to ground the plan in the actual repository. Do not edit or write files, change configuration, run formatters or code generation that rewrites tracked files, commit, or otherwise carry out the plan. Prefer existing functions and patterns over new machinery.
235
-
236
- The tool catalog stays the same across modes for request-cache stability. These plan-mode rules override any later tool description or guidance that suggests using mutation tools; those tools remain listed to keep the tool catalog unchanged. Do not use todo_write to track this planning phase: it tracks implementation after an approved plan, while the plan itself belongs in exit_plan_mode.
237
-
238
- Resolve discoverable facts by inspection. Use ask_user_question only for user-owned choices or material ambiguity that inspection cannot answer. Do not ask the user where code lives or how current behavior works when you can find out.
239
-
240
- Make the plan decision-complete: state the goal and success criteria; group implementation changes by subsystem; identify public API, schema, and data-flow changes; cover edge cases, failure modes, tests, acceptance criteria, and explicit assumptions. Keep it concise enough to review but detailed enough that another engineer can implement it without making design decisions.
241
-
242
- When ready, call exit_plan_mode with the complete plan markdown, starting with a # title. Make exit_plan_mode the only and final tool call in that assistant response: it presents the plan for approval, and implementation begins only in a later step after approval. Do not paste the final plan as a plain reply or ask "should I proceed?" through prose or ask_user_question. If review rejects it, incorporate the feedback and present again. If the review channel is unavailable or aborted, stay in plan mode and ask the user to switch modes manually; do not proceed with implementation.
243
-
244
- # ── compaction ──────────────────────────────────────────────────────────────
245
-
246
- # `compaction-basic` reads `toolResultPrune` through `ctx.get`, so the pruner must
247
- # share this realm rather than sit outside it.
248
- #
249
- # `tokenMeter` is deliberately NOT in this realm: the meter stays on the HOST
250
- # plane, and the rows here resolve that one instance. It takes no configuration,
251
- # keys every fold by Session, and owns the context-meter projection units the
252
- # browser reads for every session — behind a realm those units would come and go
253
- # with whichever presets happen to be mounted. What a preset chooses is whether
254
- # its agent compacts at all, which is `compaction-basic` below.
255
- - id: compaction
256
- name: cordis:group
257
- group: true
258
- isolate:
259
- compaction: true
260
- toolResultPruner: true
261
- config:
262
- - id: compaction-basic
263
- name: '@deepseek-ai/dsh-compaction-basic'
264
-
265
- - id: command-compact
266
- name: '@deepseek-ai/dsh-command-compact'
267
-
268
- - id: tool-result-pruner
269
- name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
270
- config:
271
- thresholdChars: 8192
272
- headChars: 4096
273
- tailChars: 1024
274
-
275
- # ── delegation and workflows ────────────────────────────────────────────────
276
-
277
- # The `subagents` registry and its spawn/fork backends live in the HOST
278
- # composition: the registry is a process singleton whose cross-session queries
279
- # the api-proxy serves to the browser, and a provider name may only be
280
- # registered once. This preset contributes the delegation TOOLS, which resolve
281
- # that host registry.
282
- #
283
- # `workflows` is different — nothing outside an agent reads it — so every row
284
- # that reaches it shares one entry-local realm here, and a consumer left
285
- # outside would resolve a host registry this preset does not populate.
286
- - id: delegation
287
- name: cordis:group
288
- group: true
289
- isolate:
290
- workflowEngine: true
291
- config:
292
- - id: tool-subagent-control
293
- name: '@deepseek-ai/dsh-tool-subagent-control'
294
-
295
- - id: tool-subagent-list-agents
296
- name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
297
-
298
- - id: tool-subagent
299
- name: '@deepseek-ai/dsh-tool-subagent'
300
- config:
301
- provider: spawn
302
- toolName: subagent
303
- modelSelectionSettings: true
304
- backgroundMode: continuable
305
- toolFilter:
306
- deny:
307
- - intent_record
308
- - intent_store_view
309
-
310
- # Fork omits model selection so provider/model stay equal to the parent and
311
- # the inherited history remains eligible for KV Cache reuse. This preset
312
- # keeps fork continuable; parent and child inherit the same messaging tool,
313
- # while the parent id and return guidance follow the inherited history.
314
- - id: tool-subagent-fork
315
- name: '@deepseek-ai/dsh-tool-subagent'
316
- config:
317
- provider: fork
318
- toolName: subagent_fork
319
- backgroundMode: continuable
320
- toolFilter:
321
- deny:
322
- - intent_record
323
- - intent_store_view
324
-
325
- # Production dsh does not install these optional providers. Install the
326
- # matching Bundle in this Profile and restart the Host, then copy this
327
- # preset and remove `disabled` from the matching tool row. Host availability
328
- # alone grants no tool.
329
- - id: tool-subagent-codex
330
- name: '@deepseek-ai/dsh-tool-subagent'
331
- disabled: true
332
- config:
333
- provider: codex
334
- toolName: subagent_codex
335
- backgroundMode: one-shot
336
- maxDepth: provider-managed
337
- toolFilter:
338
- deny:
339
- - intent_record
340
- - intent_store_view
341
-
342
- - id: tool-subagent-claude-code
343
- name: '@deepseek-ai/dsh-tool-subagent'
344
- disabled: true
345
- config:
346
- provider: claude-code
347
- toolName: subagent_claude_code
348
- backgroundMode: one-shot
349
- maxDepth: provider-managed
350
- toolFilter:
351
- deny:
352
- - intent_record
353
- - intent_store_view
354
-
355
- # 0.1.7 把这行换掉了:旧包名 `@deepseek-ai/dsh-workflow-worker-thread` 在
356
- # 0.1.7 的安装里已经不存在,对应物是 `@deepseek-ai/dsh-workflow-ptc`
357
- # (见 `dsh-web-app` 的 `presets/cordis.patch.yml`)。留着旧名不会报「找不到
358
- # 包」,而是让**整个 preset 挂载失败**,症状是它出现在 Agent 预设名单里、
359
- # 却带一条 `workflow-worker-thread (…): never started` 诊断 —— 这也是
360
- # 「自定义 agent 没生效」最像「配置没生效」的一种失败。
361
- - id: workflow-ptc
362
- name: '@deepseek-ai/dsh-workflow-ptc'
363
- config:
364
- provider: spawn
365
-
366
- - id: tool-workflow
367
- name: '@deepseek-ai/dsh-tool-workflow'
368
-
369
- - id: tool-ralph
370
- name: '@deepseek-ai/dsh-tool-ralph'
371
- config:
372
- subagentProvider: spawn
373
- maxRounds: 64
374
-
375
- # ── remaining model-facing rows ─────────────────────────────────────────────
376
-
377
- - id: tool-ask-user
378
- name: '@deepseek-ai/dsh-tool-ask-user'
379
-
380
- - id: tool-todo
381
- name: '@deepseek-ai/dsh-tool-todo'
382
- config:
383
- allowParallelInProgress: true
384
-
385
- # The `web` service and its search provider stay in the host composition; only
386
- # the model-facing tool is per-session.
387
- - id: tool-web
388
- name: '@deepseek-ai/dsh-tool-web'
389
- config:
390
- fetch: true
391
- searchTimeoutMs: 60000
392
-
393
- - id: present
394
- name: '@deepseek-ai/dsh-tool-present'
@@ -1,3 +0,0 @@
1
- name: Tita Data Agent
2
- description: TitaAgent 自己的组合:数据 Agent 的提示词,加上只有这个 preset 才有的意图记录工具。
3
- order: 10
@@ -1,92 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Tita Data Agent preset 的**迁移与自检**(0.1.7 改写)。
4
- *
5
- * ## 这个脚本以前做什么,为什么不能那么做了
6
- *
7
- * 它以前把 `preset/tita-data-agent/` 拷进 `$DSH_HOME/.agent-presets/<id>/`,
8
- * 因为 0.1.5 的用户 preset 就是那个目录里的 `preset.yml` + `agent.cordis.yml`。
9
- *
10
- * **0.1.7 不再读那个目录。** registry 只接受 `agentPresets.register(config)`,
11
- * 没有任何文件系统扫描;preset 的唯一形态是 profile 组合里的一条
12
- * `@deepseek-ai/dsh-agent-preset` 声明行。所以「安装」这一步没有了 —— preset 现在
13
- * 随插件自己的 bundle patch 分发(`cordis.patch.yml` 的生成标记区),装插件就是装
14
- * preset。
15
- *
16
- * ## 它现在做什么
17
- *
18
- * 1. **校验同步**:`cordis.patch.yml` 的声明必须与 `preset/` 真源一致。真源改了
19
- * 没跑 `pnpm sync:preset` 的话,DSH 读到的还是旧组合 —— 这正是「我改了提示词
20
- * 但没生效」最可能的原因。
21
- * 2. **报告遗留目录**:`$DSH_HOME/.agent-presets/` 里的旧 preset 已经没有任何
22
- * 消费者。留着它只会让人继续以为 preset 装在那里,所以这里如实报出来,并给
23
- * `--remove-legacy` 让人显式清掉。
24
- * 3. **打印设默认的两条路径** —— 这个脚本不替用户决定默认 preset。
25
- *
26
- * 用法:
27
- * node scripts/install-agent-preset.mjs
28
- * node scripts/install-agent-preset.mjs --remove-legacy # 顺手删掉旧目录
29
- */
30
- import { rm, stat } from 'node:fs/promises'
31
- import { homedir } from 'node:os'
32
- import { dirname, join, resolve } from 'node:path'
33
- import { fileURLToPath } from 'node:url'
34
- import { spawnSync } from 'node:child_process'
35
-
36
- /** 与 `src/client/agent-preset.ts` 的 `TITA_PRESET_ID` 一致。 */
37
- const PRESET_ID = 'tita-data-agent'
38
-
39
- const pluginRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..')
40
- const dshHome = resolve(process.env.DSH_HOME || join(homedir(), '.dsh'))
41
- const legacyDir = join(dshHome, '.agent-presets', PRESET_ID)
42
-
43
- const removeLegacy = process.argv.includes('--remove-legacy')
44
-
45
- async function exists(path) {
46
- try { await stat(path); return true } catch { return false }
47
- }
48
-
49
- async function main() {
50
- let problems = 0
51
-
52
- // ── 1. 声明与真源是否同步 ────────────────────────────────────────────────
53
- console.log('检查 cordis.patch.yml 里的 preset 声明 …')
54
- const sync = spawnSync(process.execPath, [join(pluginRoot, 'scripts', 'sync-agent-preset.mjs'), '--check'], {
55
- stdio: 'inherit',
56
- cwd: pluginRoot,
57
- })
58
- if (sync.status !== 0) {
59
- problems += 1
60
- console.log(' → 不同步。跑 `pnpm sync:preset` 把 preset/ 真源编译进 patch。')
61
- }
62
-
63
- // ── 2. 遗留的旧目录 ──────────────────────────────────────────────────────
64
- console.log(`\n检查旧目录 ${legacyDir} …`)
65
- if (await exists(legacyDir)) {
66
- console.log(' 存在,但**现在没有任何东西读它**(0.1.7 起 DSH 不扫描 .agent-presets/)。')
67
- if (removeLegacy) {
68
- await rm(legacyDir, { recursive: true, force: true })
69
- console.log(' 已按 --remove-legacy 删除。')
70
- } else {
71
- console.log(' 它不会生效,也不会造成冲突;要清掉加 --remove-legacy。')
72
- problems += 1
73
- }
74
- } else {
75
- console.log(' 不存在,无需迁移。')
76
- }
77
-
78
- // ── 3. 怎么让它成为默认 ─────────────────────────────────────────────────
79
- console.log('\n让它成为默认(脚本不替你做这个决定):')
80
- // 只有一个入口:DSH 设置里那一项。TitaAgent 面板里曾经有同一个下拉,已经撤了 ——
81
- // 它写的是同一个字段,摆两处只会让用户猜哪处算数。
82
- console.log(` · DSH 设置 → Agent 预设 →「${PRESET_ID}」→ 设为默认`)
83
- console.log(' · TitaAgent 面板只**告诉你它还不是默认**,并给出提示词的编辑入口(打开 preset 目录)')
84
- console.log('\n改动生效需要**重启 DSH**;preset 在会话创建时固定,正在跑的会话不受影响。')
85
-
86
- if (problems > 0) process.exitCode = 1
87
- }
88
-
89
- main().catch(error => {
90
- console.error(`检查失败:${error instanceof Error ? error.message : String(error)}`)
91
- process.exitCode = 1
92
- })