dsh-data-domain-knowledge 0.1.0-alpha.1

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 (231) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +360 -0
  3. package/cordis.patch.yml +410 -0
  4. package/eval/README.md +76 -0
  5. package/eval/evaluate-retrieval.mjs +121 -0
  6. package/eval/queries.example.jsonl +2 -0
  7. package/lib/client.js +111415 -0
  8. package/lib/types/config-schema.d.ts +35 -0
  9. package/lib/types/config-schema.d.ts.map +1 -0
  10. package/lib/types/config-schema.js +34 -0
  11. package/lib/types/config-schema.js.map +1 -0
  12. package/lib/types/convert/core-loader.d.ts +32 -0
  13. package/lib/types/convert/core-loader.d.ts.map +1 -0
  14. package/lib/types/convert/core-loader.js +60 -0
  15. package/lib/types/convert/core-loader.js.map +1 -0
  16. package/lib/types/convert/host.d.ts +88 -0
  17. package/lib/types/convert/host.d.ts.map +1 -0
  18. package/lib/types/convert/host.js +479 -0
  19. package/lib/types/convert/host.js.map +1 -0
  20. package/lib/types/convert/ingest.d.ts +125 -0
  21. package/lib/types/convert/ingest.d.ts.map +1 -0
  22. package/lib/types/convert/ingest.js +228 -0
  23. package/lib/types/convert/ingest.js.map +1 -0
  24. package/lib/types/convert/settings-schema.d.ts +18 -0
  25. package/lib/types/convert/settings-schema.d.ts.map +1 -0
  26. package/lib/types/convert/settings-schema.js +26 -0
  27. package/lib/types/convert/settings-schema.js.map +1 -0
  28. package/lib/types/convert/types.d.ts +46 -0
  29. package/lib/types/convert/types.d.ts.map +1 -0
  30. package/lib/types/convert/types.js +41 -0
  31. package/lib/types/convert/types.js.map +1 -0
  32. package/lib/types/diagnosis/cards.d.ts +71 -0
  33. package/lib/types/diagnosis/cards.d.ts.map +1 -0
  34. package/lib/types/diagnosis/cards.js +482 -0
  35. package/lib/types/diagnosis/cards.js.map +1 -0
  36. package/lib/types/diagnosis/problem-classes.d.ts +51 -0
  37. package/lib/types/diagnosis/problem-classes.d.ts.map +1 -0
  38. package/lib/types/diagnosis/problem-classes.js +66 -0
  39. package/lib/types/diagnosis/problem-classes.js.map +1 -0
  40. package/lib/types/diagnosis/schema.d.ts +65 -0
  41. package/lib/types/diagnosis/schema.d.ts.map +1 -0
  42. package/lib/types/diagnosis/schema.js +208 -0
  43. package/lib/types/diagnosis/schema.js.map +1 -0
  44. package/lib/types/diagnosis/seed-source.d.ts +20 -0
  45. package/lib/types/diagnosis/seed-source.d.ts.map +1 -0
  46. package/lib/types/diagnosis/seed-source.js +96 -0
  47. package/lib/types/diagnosis/seed-source.js.map +1 -0
  48. package/lib/types/diagnosis/seed.d.ts +50 -0
  49. package/lib/types/diagnosis/seed.d.ts.map +1 -0
  50. package/lib/types/diagnosis/seed.js +242 -0
  51. package/lib/types/diagnosis/seed.js.map +1 -0
  52. package/lib/types/diagnosis/store.d.ts +81 -0
  53. package/lib/types/diagnosis/store.d.ts.map +1 -0
  54. package/lib/types/diagnosis/store.js +409 -0
  55. package/lib/types/diagnosis/store.js.map +1 -0
  56. package/lib/types/diagnosis/types.d.ts +124 -0
  57. package/lib/types/diagnosis/types.d.ts.map +1 -0
  58. package/lib/types/diagnosis/types.js +13 -0
  59. package/lib/types/diagnosis/types.js.map +1 -0
  60. package/lib/types/directory-picker.d.ts +94 -0
  61. package/lib/types/directory-picker.d.ts.map +1 -0
  62. package/lib/types/directory-picker.js +110 -0
  63. package/lib/types/directory-picker.js.map +1 -0
  64. package/lib/types/extract-model.d.ts +76 -0
  65. package/lib/types/extract-model.d.ts.map +1 -0
  66. package/lib/types/extract-model.js +193 -0
  67. package/lib/types/extract-model.js.map +1 -0
  68. package/lib/types/extract.d.ts +121 -0
  69. package/lib/types/extract.d.ts.map +1 -0
  70. package/lib/types/extract.js +549 -0
  71. package/lib/types/extract.js.map +1 -0
  72. package/lib/types/fts.d.ts +96 -0
  73. package/lib/types/fts.d.ts.map +1 -0
  74. package/lib/types/fts.js +184 -0
  75. package/lib/types/fts.js.map +1 -0
  76. package/lib/types/index.d.ts +39 -0
  77. package/lib/types/index.d.ts.map +1 -0
  78. package/lib/types/index.js +1112 -0
  79. package/lib/types/index.js.map +1 -0
  80. package/lib/types/intent/engine.d.ts +108 -0
  81. package/lib/types/intent/engine.d.ts.map +1 -0
  82. package/lib/types/intent/engine.js +501 -0
  83. package/lib/types/intent/engine.js.map +1 -0
  84. package/lib/types/intent/host.d.ts +88 -0
  85. package/lib/types/intent/host.d.ts.map +1 -0
  86. package/lib/types/intent/host.js +389 -0
  87. package/lib/types/intent/host.js.map +1 -0
  88. package/lib/types/intent/preset-tools.d.ts +37 -0
  89. package/lib/types/intent/preset-tools.d.ts.map +1 -0
  90. package/lib/types/intent/preset-tools.js +45 -0
  91. package/lib/types/intent/preset-tools.js.map +1 -0
  92. package/lib/types/intent/settings-schema.d.ts +59 -0
  93. package/lib/types/intent/settings-schema.d.ts.map +1 -0
  94. package/lib/types/intent/settings-schema.js +57 -0
  95. package/lib/types/intent/settings-schema.js.map +1 -0
  96. package/lib/types/intent/store.d.ts +75 -0
  97. package/lib/types/intent/store.d.ts.map +1 -0
  98. package/lib/types/intent/store.js +139 -0
  99. package/lib/types/intent/store.js.map +1 -0
  100. package/lib/types/intent/tools.d.ts +63 -0
  101. package/lib/types/intent/tools.d.ts.map +1 -0
  102. package/lib/types/intent/tools.js +108 -0
  103. package/lib/types/intent/tools.js.map +1 -0
  104. package/lib/types/intent/types.d.ts +189 -0
  105. package/lib/types/intent/types.d.ts.map +1 -0
  106. package/lib/types/intent/types.js +62 -0
  107. package/lib/types/intent/types.js.map +1 -0
  108. package/lib/types/knowledge-bases.d.ts +266 -0
  109. package/lib/types/knowledge-bases.d.ts.map +1 -0
  110. package/lib/types/knowledge-bases.js +1107 -0
  111. package/lib/types/knowledge-bases.js.map +1 -0
  112. package/lib/types/layout.d.ts +262 -0
  113. package/lib/types/layout.d.ts.map +1 -0
  114. package/lib/types/layout.js +312 -0
  115. package/lib/types/layout.js.map +1 -0
  116. package/lib/types/migrate.d.ts +110 -0
  117. package/lib/types/migrate.d.ts.map +1 -0
  118. package/lib/types/migrate.js +280 -0
  119. package/lib/types/migrate.js.map +1 -0
  120. package/lib/types/recall-rank.d.ts +158 -0
  121. package/lib/types/recall-rank.d.ts.map +1 -0
  122. package/lib/types/recall-rank.js +261 -0
  123. package/lib/types/recall-rank.js.map +1 -0
  124. package/lib/types/runtime.d.ts +568 -0
  125. package/lib/types/runtime.d.ts.map +1 -0
  126. package/lib/types/runtime.js +3045 -0
  127. package/lib/types/runtime.js.map +1 -0
  128. package/lib/types/settings-schema.d.ts +117 -0
  129. package/lib/types/settings-schema.d.ts.map +1 -0
  130. package/lib/types/settings-schema.js +92 -0
  131. package/lib/types/settings-schema.js.map +1 -0
  132. package/lib/types/settings-volatile.d.ts +102 -0
  133. package/lib/types/settings-volatile.d.ts.map +1 -0
  134. package/lib/types/settings-volatile.js +114 -0
  135. package/lib/types/settings-volatile.js.map +1 -0
  136. package/lib/types/types.d.ts +799 -0
  137. package/lib/types/types.d.ts.map +1 -0
  138. package/lib/types/types.js +387 -0
  139. package/lib/types/types.js.map +1 -0
  140. package/lib/types/wiki-types.d.ts +68 -0
  141. package/lib/types/wiki-types.d.ts.map +1 -0
  142. package/lib/types/wiki-types.js +322 -0
  143. package/lib/types/wiki-types.js.map +1 -0
  144. package/package.json +101 -0
  145. package/preset/tita-data-agent/agent.cordis.yml +376 -0
  146. package/preset/tita-data-agent/preset.yml +3 -0
  147. package/python/requirements.txt +8 -0
  148. package/scripts/doctor.mjs +70 -0
  149. package/scripts/e2e-pipeline.mjs +355 -0
  150. package/scripts/install-agent-preset.mjs +92 -0
  151. package/scripts/setup-embedding.sh +34 -0
  152. package/scripts/sync-agent-preset.mjs +188 -0
  153. package/src/client/AgentPresetCard.tsx +247 -0
  154. package/src/client/DirectoryPicker.tsx +357 -0
  155. package/src/client/InfoHint.tsx +65 -0
  156. package/src/client/IntentLogicTab.tsx +185 -0
  157. package/src/client/IntentTab.tsx +715 -0
  158. package/src/client/KnowledgeBaseTab.tsx +1454 -0
  159. package/src/client/KnowledgeGraphView.tsx +306 -0
  160. package/src/client/KnowledgePanel.tsx +381 -0
  161. package/src/client/KnowledgeStepRail.tsx +60 -0
  162. package/src/client/NodeSettings.tsx +392 -0
  163. package/src/client/PreviewSections.tsx +116 -0
  164. package/src/client/RecallPanel.tsx +399 -0
  165. package/src/client/TypeDefinitionDrawer.tsx +215 -0
  166. package/src/client/WikiFlowCard.tsx +226 -0
  167. package/src/client/WikiTypeEditor.tsx +332 -0
  168. package/src/client/agent-preset.ts +121 -0
  169. package/src/client/arch/AgentArchitectureGraph.tsx +219 -0
  170. package/src/client/arch/NodeLogicPanel.tsx +133 -0
  171. package/src/client/arch/ProblemDetailPanel.tsx +88 -0
  172. package/src/client/arch/model.ts +691 -0
  173. package/src/client/architecture.css +191 -0
  174. package/src/client/architecture.tsx +530 -0
  175. package/src/client/attribution/AttributionGraph.tsx +104 -0
  176. package/src/client/attribution/AttributionTab.tsx +332 -0
  177. package/src/client/attribution/CaseView.tsx +102 -0
  178. package/src/client/attribution/GraphStage.tsx +87 -0
  179. package/src/client/attribution/RunView.tsx +184 -0
  180. package/src/client/attribution/StageChrome.tsx +403 -0
  181. package/src/client/attribution/ViewSwitch.tsx +107 -0
  182. package/src/client/attribution/graph-options.ts +381 -0
  183. package/src/client/attribution/model.ts +462 -0
  184. package/src/client/config-scope.ts +119 -0
  185. package/src/client/convert/ConvertPanel.tsx +594 -0
  186. package/src/client/convert/styles.css +138 -0
  187. package/src/client/convert/styles.ts +49 -0
  188. package/src/client/format.ts +39 -0
  189. package/src/client/graph/layout.ts +181 -0
  190. package/src/client/graph.css +113 -0
  191. package/src/client/index.ts +98 -0
  192. package/src/client/problem-domains.ts +114 -0
  193. package/src/client/styles.css +940 -0
  194. package/src/client/styles.ts +11 -0
  195. package/src/client/useFitScale.ts +68 -0
  196. package/src/config-schema.ts +45 -0
  197. package/src/convert/core-loader.ts +68 -0
  198. package/src/convert/host.ts +579 -0
  199. package/src/convert/ingest.ts +367 -0
  200. package/src/convert/settings-schema.ts +27 -0
  201. package/src/convert/types.ts +65 -0
  202. package/src/diagnosis/cards.ts +498 -0
  203. package/src/diagnosis/problem-classes.ts +117 -0
  204. package/src/diagnosis/schema.ts +260 -0
  205. package/src/diagnosis/seed-source.ts +107 -0
  206. package/src/diagnosis/seed.ts +291 -0
  207. package/src/diagnosis/store.ts +432 -0
  208. package/src/diagnosis/types.ts +152 -0
  209. package/src/directory-picker.ts +164 -0
  210. package/src/extract-model.ts +227 -0
  211. package/src/extract.ts +632 -0
  212. package/src/fts.ts +203 -0
  213. package/src/index.ts +1091 -0
  214. package/src/intent/README.md +63 -0
  215. package/src/intent/engine.ts +527 -0
  216. package/src/intent/host.ts +462 -0
  217. package/src/intent/preset-tools.ts +48 -0
  218. package/src/intent/settings-schema.ts +63 -0
  219. package/src/intent/store.ts +143 -0
  220. package/src/intent/tools.ts +139 -0
  221. package/src/intent/types.ts +245 -0
  222. package/src/knowledge-bases.ts +1160 -0
  223. package/src/layout.ts +350 -0
  224. package/src/migrate.ts +262 -0
  225. package/src/python/embedding_worker.py +471 -0
  226. package/src/recall-rank.ts +299 -0
  227. package/src/runtime.ts +3069 -0
  228. package/src/settings-schema.ts +94 -0
  229. package/src/settings-volatile.ts +122 -0
  230. package/src/types.ts +1140 -0
  231. package/src/wiki-types.ts +357 -0
@@ -0,0 +1,376 @@
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
+ # `intent_registry_list` 三个工具搬到 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 on disk is a tree.
47
+ `01_source_truth` holds SourceRaw: the original business documents, never
48
+ rewritten, kept so that a conclusion can point back at where it came from.
49
+ `02_wiki` holds the cards people read — one per entity, each with mandatory
50
+ `source_refs`, each following a type (`concept`, `metric`, `table`, `event`,
51
+ `playbook`, `case`). `03_compiled` is what `recall_knowledge` actually
52
+ searches: wikiNotes, a vector index and a knowledge graph. `05_diagnosis` is
53
+ the attribution graph the panel renders. There can be several bases.
54
+
55
+ - **The data surfaces, which are a different thing.** `workbook_*` reads and
56
+ writes the workbooks the user has open; `notebook_*` runs SQL in the user's
57
+ own browser. That is where a number is *computed*. The knowledge store is
58
+ where a number is *defined* — a `metric` card says how it must be calculated,
59
+ a `table` card says what one row means. Computing without the definition gets
60
+ you a number nobody agreed to.
61
+
62
+ - **Conversion.** `convert_source` turns a file, a web page or a video into
63
+ knowledge-ready Markdown and says where it landed. It is not knowledge until
64
+ `convert_ingest` has run, so keep saying which of the two steps you are on.
65
+
66
+ ## Working rules
67
+
68
+ 1. **Record the intent before the work.** Call `intent_record` with what the
69
+ user wants and what you are about to do, before you do it. The vocabulary,
70
+ and the rule for continuing existing work instead of starting a new task,
71
+ live in that tool's own description. The record never gates the request:
72
+ record, then continue.
73
+ 2. **Recall before you answer about this organisation.** For its own rules,
74
+ definitions, metrics, processes or history, call `recall_knowledge` first and
75
+ answer from what comes back. An empty result is a finding, not a licence to
76
+ improvise — say the store has nothing on it. The wiki layer answers "what does
77
+ this organisation mean by X"; when you need "where exactly does it say that",
78
+ or a card and the document behind it disagree, go read the source.
79
+ 3. **Never invent a number.** Every figure you report must come from a tool
80
+ result in this turn, and you must say which one. "I don't have that data" is
81
+ a correct answer; a made-up number is not.
82
+ 4. **Put it in writing while you still have the evidence.** A definition, a
83
+ metric's exact calculation, a process, a diagnosed cause — if it will be
84
+ asked again, write it as a card with `write_knowledge_card`, with
85
+ `source_refs` that already exist in the store. A card whose refs point
86
+ nowhere is rejected, and rightly so.
87
+ 5. **Correct a card, do not quietly overwrite it.** When something in the store
88
+ is wrong, set its status to `problem` and say what is wrong with it. Cards
89
+ marked `problem` drop out of recall by default — that is how a wrong
90
+ definition stops propagating.
91
+ 6. **Never invent a knowledge base id.** Call `list_knowledge_bases` before
92
+ addressing one you have not seen this session; omit `kb` only when the
93
+ default base is genuinely the right one.
94
+ 7. **Be concrete about uncertainty.** When sources disagree, present both and
95
+ name them. When a conclusion rests on a single document, say so.
96
+ 8. **Ask only what the user owns.** Which of two readings they meant, what
97
+ matters more, what to do next — ask. Anything you can look up, look up
98
+ instead of asking.
99
+ 9. **Deliverables belong to the project, not to your home.** Write every file
100
+ you produce for the user under `output/<YYYY-MM-DD>/` in your working
101
+ directory, never into the Agent root: the Agent root accumulates across
102
+ projects, a deliverable belongs to one. Name it `<topic>-<kind>.<ext>` where
103
+ `<kind>` is exactly one of `报告`, `图表`, `数据集`, `清洗脚本`, `SQL` — the
104
+ name alone has to say what the file is a year later. Append `-2`, `-3` rather
105
+ than overwriting, and say the path in your answer.
106
+
107
+ ## How to write
108
+
109
+ Answer in the user's language. Lead with the answer, then the evidence. Prefer
110
+ a table when you are comparing things and a short paragraph when you are not.
111
+ Skip preamble and praise; the user is here for the analysis.
112
+ # ↑↑↑ Tita Data Agent 的提示词结束 ↑↑↑
113
+
114
+ - id: agent-instructions
115
+ name: '@deepseek-ai/dsh-agent-instructions'
116
+ config:
117
+ maxBytes: 65536
118
+
119
+ # ── 意图记录(agent 平面)────────────────────────────────────────────────────
120
+ #
121
+ # 0029 之前这三个工具由知识插件在**宿主平面**全局注册,于是每个 agent、每个 preset
122
+ # 的会话都会在提示词里看到 `intent_record`。现在它们只在这里挂载:这个模块只往
123
+ # `tools` 注册表里塞定义、不 provide 任何服务,所以和随包的 `tool-fs` 一样不需要
124
+ # realm,而它的注册只覆盖加入本 preset 的会话。
125
+ #
126
+ # 引擎本身(设置、轮次记账、`/intent/**` 只读面)仍在宿主平面,通过
127
+ # `titaDataAgentIntent` 服务把操作面暴露给这一行 —— 引擎只有一份。
128
+ - id: intent-tools
129
+ name: 'dsh-data-domain-knowledge/intent-tools'
130
+
131
+ # ── shell ───────────────────────────────────────────────────────────────────
132
+
133
+ # `shell-env` stays in the HOST composition: `apps/cli/src/web.ts` injects it to
134
+ # publish `DSH_WEB_URL`/`DSH_WEB_MODE`, and a host row that injects a service is
135
+ # the criterion for host-plane ownership — injection resolves before any session
136
+ # exists, so there is no agent to key by. Behind a preset realm those variables
137
+ # never reached the model's shell at all. Both shell tools consume the host
138
+ # registry from here; their executors (`bash-sandbox`/`pwsh-sandbox`) are
139
+ # host-plane too.
140
+ - id: tool-bash
141
+ name: '@deepseek-ai/dsh-tool-bash'
142
+ disabled: !!js process.platform === 'win32'
143
+
144
+ - id: tool-pwsh
145
+ name: '@deepseek-ai/dsh-tool-pwsh'
146
+ disabled: !!js process.platform !== 'win32'
147
+
148
+ # ── filesystem ──────────────────────────────────────────────────────────────
149
+
150
+ # Both register into the host `tools` registry and provide nothing, so
151
+ # they need no realm. The `fs` service and its policy stay in the host.
152
+ - id: tool-fs
153
+ name: '@deepseek-ai/dsh-tool-fs'
154
+
155
+ - id: tool-fs-search
156
+ name: '@deepseek-ai/dsh-tool-fs-search'
157
+ config:
158
+ sampleOverCapGlobResults: false
159
+
160
+ # ── background jobs ────────────────────────────────────────────────────────
161
+
162
+ # Only the model-facing controls. The task REGISTRY stays on the host plane:
163
+ # its producers sit outside any realm this file could put it in — `tool-bash`
164
+ # above resolves it with `ctx.get`, and an entry-local realm here is invisible
165
+ # to every sibling row, so `run_in_background` would answer "background jobs
166
+ # unavailable" while these controls sat in the catalog. The registry is keyed by
167
+ # owning agent anyway, so one host instance serves every session. What a preset
168
+ # chooses is whether its agent can collect and stop background work at all.
169
+ - id: tool-jobs
170
+ name: '@deepseek-ai/dsh-tool-jobs'
171
+
172
+ # ── skills ──────────────────────────────────────────────────────────────────
173
+
174
+ # The skill REGISTRY lives in the host composition and is layered per scope:
175
+ # these rows register into THIS preset's layer of it, so they need no realm.
176
+ # `skill-filesystem` contributes local-root discovery for agents on this preset, and
177
+ # `tool-skill` gives them the catalog and loader; the merged catalog also
178
+ # carries whatever the deployment registered globally (repository plugins).
179
+ - id: skill-filesystem
180
+ name: '@deepseek-ai/dsh-skill-filesystem'
181
+
182
+ - id: tool-skill
183
+ name: '@deepseek-ai/dsh-tool-skill'
184
+
185
+ # ── goals ───────────────────────────────────────────────────────────────────
186
+
187
+ # The goal service and session driver stay on the host plane, where the Gateway
188
+ # can resolve them. The human command and model-facing tool register into this
189
+ # preset's scoped layers.
190
+ - id: command-goal
191
+ name: '@deepseek-ai/dsh-command-goal'
192
+
193
+ - id: tool-goal
194
+ name: '@deepseek-ai/dsh-tool-goal'
195
+
196
+ # ── plan mode ───────────────────────────────────────────────────────────────
197
+
198
+ # Plan state is per-agent by nature, so an entry-local realm is not a
199
+ # workaround here — it is the correct lifetime.
200
+ - id: planning
201
+ name: cordis:group
202
+ group: true
203
+ isolate:
204
+ planMode: true
205
+ config:
206
+ - id: plan-mode
207
+ name: '@deepseek-ai/dsh-plan-mode'
208
+ config:
209
+ section: |
210
+ 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.
211
+
212
+ 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.
213
+
214
+ 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.
215
+
216
+ 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.
217
+
218
+ 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.
219
+
220
+ 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.
221
+
222
+ # ── compaction ──────────────────────────────────────────────────────────────
223
+
224
+ # `compaction-basic` reads `toolResultPrune` through `ctx.get`, so the pruner must
225
+ # share this realm rather than sit outside it.
226
+ #
227
+ # `tokenMeter` is deliberately NOT in this realm: the meter stays on the HOST
228
+ # plane, and the rows here resolve that one instance. It takes no configuration,
229
+ # keys every fold by Session, and owns the context-meter projection units the
230
+ # browser reads for every session — behind a realm those units would come and go
231
+ # with whichever presets happen to be mounted. What a preset chooses is whether
232
+ # its agent compacts at all, which is `compaction-basic` below.
233
+ - id: compaction
234
+ name: cordis:group
235
+ group: true
236
+ isolate:
237
+ compaction: true
238
+ toolResultPruner: true
239
+ config:
240
+ - id: compaction-basic
241
+ name: '@deepseek-ai/dsh-compaction-basic'
242
+
243
+ - id: command-compact
244
+ name: '@deepseek-ai/dsh-command-compact'
245
+
246
+ - id: tool-result-pruner
247
+ name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
248
+ config:
249
+ thresholdChars: 8192
250
+ headChars: 4096
251
+ tailChars: 1024
252
+
253
+ # ── delegation and workflows ────────────────────────────────────────────────
254
+
255
+ # The `subagents` registry and its spawn/fork backends live in the HOST
256
+ # composition: the registry is a process singleton whose cross-session queries
257
+ # the api-proxy serves to the browser, and a provider name may only be
258
+ # registered once. This preset contributes the delegation TOOLS, which resolve
259
+ # that host registry.
260
+ #
261
+ # `workflows` is different — nothing outside an agent reads it — so every row
262
+ # that reaches it shares one entry-local realm here, and a consumer left
263
+ # outside would resolve a host registry this preset does not populate.
264
+ - id: delegation
265
+ name: cordis:group
266
+ group: true
267
+ isolate:
268
+ workflowEngine: true
269
+ config:
270
+ - id: tool-subagent-control
271
+ name: '@deepseek-ai/dsh-tool-subagent-control'
272
+
273
+ - id: tool-subagent-list-agents
274
+ name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
275
+
276
+ - id: tool-subagent
277
+ name: '@deepseek-ai/dsh-tool-subagent'
278
+ config:
279
+ provider: spawn
280
+ toolName: subagent
281
+ modelSelectionSettings: true
282
+ backgroundMode: continuable
283
+ toolFilter:
284
+ deny:
285
+ - intent_record
286
+ - intent_store_view
287
+ - intent_registry_list
288
+
289
+ # Fork omits model selection so provider/model stay equal to the parent and
290
+ # the inherited history remains eligible for KV Cache reuse. This preset
291
+ # keeps fork continuable; parent and child inherit the same messaging tool,
292
+ # while the parent id and return guidance follow the inherited history.
293
+ - id: tool-subagent-fork
294
+ name: '@deepseek-ai/dsh-tool-subagent'
295
+ config:
296
+ provider: fork
297
+ toolName: subagent_fork
298
+ backgroundMode: continuable
299
+ toolFilter:
300
+ deny:
301
+ - intent_record
302
+ - intent_store_view
303
+ - intent_registry_list
304
+
305
+ # Production dsh does not install these optional providers. Install the
306
+ # matching Bundle in this Profile and restart the Host, then copy this
307
+ # preset and remove `disabled` from the matching tool row. Host availability
308
+ # alone grants no tool.
309
+ - id: tool-subagent-codex
310
+ name: '@deepseek-ai/dsh-tool-subagent'
311
+ disabled: true
312
+ config:
313
+ provider: codex
314
+ toolName: subagent_codex
315
+ backgroundMode: one-shot
316
+ maxDepth: provider-managed
317
+ toolFilter:
318
+ deny:
319
+ - intent_record
320
+ - intent_store_view
321
+ - intent_registry_list
322
+
323
+ - id: tool-subagent-claude-code
324
+ name: '@deepseek-ai/dsh-tool-subagent'
325
+ disabled: true
326
+ config:
327
+ provider: claude-code
328
+ toolName: subagent_claude_code
329
+ backgroundMode: one-shot
330
+ maxDepth: provider-managed
331
+ toolFilter:
332
+ deny:
333
+ - intent_record
334
+ - intent_store_view
335
+ - intent_registry_list
336
+
337
+ # 0.1.7 把这行换掉了:旧包名 `@deepseek-ai/dsh-workflow-worker-thread` 在
338
+ # 0.1.7 的安装里已经不存在,对应物是 `@deepseek-ai/dsh-workflow-ptc`
339
+ # (见 `dsh-web-app` 的 `presets/cordis.patch.yml`)。留着旧名不会报「找不到
340
+ # 包」,而是让**整个 preset 挂载失败**,症状是它出现在 Agent 预设名单里、
341
+ # 却带一条 `workflow-worker-thread (…): never started` 诊断 —— 这也是
342
+ # 「自定义 agent 没生效」最像「配置没生效」的一种失败。
343
+ - id: workflow-ptc
344
+ name: '@deepseek-ai/dsh-workflow-ptc'
345
+ config:
346
+ provider: spawn
347
+
348
+ - id: tool-workflow
349
+ name: '@deepseek-ai/dsh-tool-workflow'
350
+
351
+ - id: tool-ralph
352
+ name: '@deepseek-ai/dsh-tool-ralph'
353
+ config:
354
+ subagentProvider: spawn
355
+ maxRounds: 64
356
+
357
+ # ── remaining model-facing rows ─────────────────────────────────────────────
358
+
359
+ - id: tool-ask-user
360
+ name: '@deepseek-ai/dsh-tool-ask-user'
361
+
362
+ - id: tool-todo
363
+ name: '@deepseek-ai/dsh-tool-todo'
364
+ config:
365
+ allowParallelInProgress: true
366
+
367
+ # The `web` service and its search provider stay in the host composition; only
368
+ # the model-facing tool is per-session.
369
+ - id: tool-web
370
+ name: '@deepseek-ai/dsh-tool-web'
371
+ config:
372
+ fetch: true
373
+ searchTimeoutMs: 60000
374
+
375
+ - id: present
376
+ name: '@deepseek-ai/dsh-tool-present'
@@ -0,0 +1,3 @@
1
+ name: Tita Data Agent
2
+ description: TitaAgent 自己的组合:数据 Agent 的提示词,加上只有这个 preset 才有的意图记录工具。
3
+ order: 10
@@ -0,0 +1,8 @@
1
+ torch
2
+ torchvision
3
+ pillow
4
+ transformers==5.2.0
5
+ sentence-transformers>=5.7.0
6
+ accelerate>=1.1.0
7
+ qwen-vl-utils==0.0.14
8
+ huggingface_hub[cli]
@@ -0,0 +1,70 @@
1
+ import assert from 'node:assert/strict'
2
+ import { spawnSync } from 'node:child_process'
3
+ import { existsSync } from 'node:fs'
4
+ import { mkdtemp, rm } from 'node:fs/promises'
5
+ import { tmpdir } from 'node:os'
6
+ import { join } from 'node:path'
7
+ import { fileURLToPath } from 'node:url'
8
+ import { loadConvertCore } from '../lib/types/convert/core-loader.js'
9
+ import { IntentEngine } from '../lib/types/intent/engine.js'
10
+ import { defaultKnowledgeRoot, KnowledgeRuntime } from '../lib/types/runtime.js'
11
+
12
+ const root = defaultKnowledgeRoot()
13
+ const runtime = new KnowledgeRuntime(root)
14
+ assert.ok(root.length > 0)
15
+ assert.ok(runtime.config.embeddingDimension > 0)
16
+ assert.equal(existsSync(new URL('../lib/client.js', import.meta.url)), true)
17
+
18
+ // The 意图 module came from @tita-data-agent/data-domain-intent (0019). Its
19
+ // registry is the contract behind `intent_registry_list` and the injected
20
+ // routing prompt, so the doctor keeps the same assertion the old package had.
21
+ const registry = new IntentEngine().registry()
22
+ assert.equal(registry.categories.length, 12)
23
+ // v0.7 起 acts 是对象(IntentActDef:id / label / description / enabled),
24
+ // 断言相应地按 id 判成员 —— 这条固定的是「unknown 这个动作还在」,不是它的形状。
25
+ assert.ok(registry.acts.some(act => act.id === 'unknown'))
26
+
27
+ // The conversion kernel is optional (0018): report it, never fail on it.
28
+ let convert
29
+ let scratch
30
+ try {
31
+ const core = await loadConvertCore()
32
+ scratch = await mkdtemp(join(tmpdir(), 'tita-convert-doctor-'))
33
+ const service = await core.createConvertService({ rootDir: scratch, maxConcurrent: 1 })
34
+ const capabilities = await service.capabilities()
35
+ convert = {
36
+ ok: true,
37
+ adapters: capabilities.adapters.map(adapter => adapter.id),
38
+ extensions: capabilities.extensions.length,
39
+ }
40
+ await service.close()
41
+ } catch (error) {
42
+ convert = { ok: false, code: error?.code ?? 'UNKNOWN', message: error?.message ?? String(error) }
43
+ } finally {
44
+ if (scratch) await rm(scratch, { recursive: true, force: true }).catch(() => undefined)
45
+ }
46
+
47
+ // preset 声明必须与 `preset/` 真源同步(0036)。DSH 只读 `cordis.patch.yml` 里
48
+ // 那条 `@deepseek-ai/dsh-agent-preset` 声明,真源改了没编译的话,症状是「我改了
49
+ // 提示词但没生效」—— 最难自己发现的一类失败。所以这一项不同步即 doctor 失败,
50
+ // 不像 convert 那样只报告。
51
+ const presetCheck = spawnSync(
52
+ process.execPath,
53
+ [fileURLToPath(new URL('./sync-agent-preset.mjs', import.meta.url)), '--check'],
54
+ { encoding: 'utf8' },
55
+ )
56
+ const preset = {
57
+ synced: presetCheck.status === 0,
58
+ message: `${presetCheck.stdout ?? ''}${presetCheck.stderr ?? ''}`.trim() || undefined,
59
+ }
60
+ if (!preset.synced) process.exitCode = 1
61
+
62
+ console.log(JSON.stringify({
63
+ ok: true,
64
+ package: 'dsh-data-domain-knowledge',
65
+ root,
66
+ maxSourceBytes: runtime.config.maxSourceBytes,
67
+ convert,
68
+ intent: { categories: registry.categories.length, acts: registry.acts.length },
69
+ preset,
70
+ }))