dsh-data-domain-knowledge 0.1.0-alpha.14 → 0.1.0-alpha.16

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 (167) hide show
  1. package/README.md +9 -8
  2. package/cordis.patch.yml +36 -133
  3. package/lib/client.js +463 -317
  4. package/lib/doc-page.js +1 -1
  5. package/lib/pages.js +2264 -1120
  6. package/lib/types/axis-registry.d.ts +2 -1
  7. package/lib/types/axis-registry.d.ts.map +1 -1
  8. package/lib/types/axis-registry.js +17 -7
  9. package/lib/types/axis-registry.js.map +1 -1
  10. package/lib/types/convert/host.d.ts.map +1 -1
  11. package/lib/types/convert/host.js +3 -0
  12. package/lib/types/convert/host.js.map +1 -1
  13. package/lib/types/convert/ingest.d.ts +9 -0
  14. package/lib/types/convert/ingest.d.ts.map +1 -1
  15. package/lib/types/convert/ingest.js +68 -9
  16. package/lib/types/convert/ingest.js.map +1 -1
  17. package/lib/types/diagnosis/store.d.ts +10 -1
  18. package/lib/types/diagnosis/store.d.ts.map +1 -1
  19. package/lib/types/diagnosis/store.js +55 -2
  20. package/lib/types/diagnosis/store.js.map +1 -1
  21. package/lib/types/environment/dsh-python.d.ts +77 -0
  22. package/lib/types/environment/dsh-python.d.ts.map +1 -0
  23. package/lib/types/environment/dsh-python.js +139 -0
  24. package/lib/types/environment/dsh-python.js.map +1 -0
  25. package/lib/types/environment/install.d.ts +9 -1
  26. package/lib/types/environment/install.d.ts.map +1 -1
  27. package/lib/types/environment/install.js +149 -24
  28. package/lib/types/environment/install.js.map +1 -1
  29. package/lib/types/environment/model-catalog.d.ts +34 -2
  30. package/lib/types/environment/model-catalog.d.ts.map +1 -1
  31. package/lib/types/environment/model-catalog.js +40 -2
  32. package/lib/types/environment/model-catalog.js.map +1 -1
  33. package/lib/types/environment/service.d.ts +9 -0
  34. package/lib/types/environment/service.d.ts.map +1 -1
  35. package/lib/types/environment/service.js +37 -1
  36. package/lib/types/environment/service.js.map +1 -1
  37. package/lib/types/extraction-runs.d.ts +27 -6
  38. package/lib/types/extraction-runs.d.ts.map +1 -1
  39. package/lib/types/extraction-runs.js +63 -8
  40. package/lib/types/extraction-runs.js.map +1 -1
  41. package/lib/types/fs-atomic.d.ts +0 -7
  42. package/lib/types/fs-atomic.d.ts.map +1 -1
  43. package/lib/types/fs-atomic.js +17 -2
  44. package/lib/types/fs-atomic.js.map +1 -1
  45. package/lib/types/images.d.ts +1 -1
  46. package/lib/types/images.d.ts.map +1 -1
  47. package/lib/types/images.js +2 -2
  48. package/lib/types/images.js.map +1 -1
  49. package/lib/types/index.d.ts.map +1 -1
  50. package/lib/types/index.js +36 -6
  51. package/lib/types/index.js.map +1 -1
  52. package/lib/types/intent/tools.d.ts +19 -0
  53. package/lib/types/intent/tools.d.ts.map +1 -1
  54. package/lib/types/intent/tools.js +37 -1
  55. package/lib/types/intent/tools.js.map +1 -1
  56. package/lib/types/knowledge-bases.d.ts.map +1 -1
  57. package/lib/types/knowledge-bases.js +2 -14
  58. package/lib/types/knowledge-bases.js.map +1 -1
  59. package/lib/types/knowledge.d.ts.map +1 -1
  60. package/lib/types/knowledge.js +9 -2
  61. package/lib/types/knowledge.js.map +1 -1
  62. package/lib/types/materialize-snapshot.d.ts +49 -0
  63. package/lib/types/materialize-snapshot.d.ts.map +1 -0
  64. package/lib/types/materialize-snapshot.js +2 -0
  65. package/lib/types/materialize-snapshot.js.map +1 -0
  66. package/lib/types/oplog.d.ts.map +1 -1
  67. package/lib/types/oplog.js +7 -0
  68. package/lib/types/oplog.js.map +1 -1
  69. package/lib/types/pipeline/engine.d.ts +11 -8
  70. package/lib/types/pipeline/engine.d.ts.map +1 -1
  71. package/lib/types/pipeline/engine.js +97 -27
  72. package/lib/types/pipeline/engine.js.map +1 -1
  73. package/lib/types/pipeline/store.d.ts +18 -1
  74. package/lib/types/pipeline/store.d.ts.map +1 -1
  75. package/lib/types/pipeline/store.js +33 -5
  76. package/lib/types/pipeline/store.js.map +1 -1
  77. package/lib/types/pipeline/types.d.ts +19 -0
  78. package/lib/types/pipeline/types.d.ts.map +1 -1
  79. package/lib/types/pipeline/types.js.map +1 -1
  80. package/lib/types/present.js +1 -1
  81. package/lib/types/present.js.map +1 -1
  82. package/lib/types/retention.d.ts +39 -0
  83. package/lib/types/retention.d.ts.map +1 -0
  84. package/lib/types/retention.js +42 -0
  85. package/lib/types/retention.js.map +1 -0
  86. package/lib/types/runtime.d.ts +96 -5
  87. package/lib/types/runtime.d.ts.map +1 -1
  88. package/lib/types/runtime.js +525 -72
  89. package/lib/types/runtime.js.map +1 -1
  90. package/lib/types/source-evidence.d.ts +9 -1
  91. package/lib/types/source-evidence.d.ts.map +1 -1
  92. package/lib/types/source-evidence.js +11 -5
  93. package/lib/types/source-evidence.js.map +1 -1
  94. package/lib/types/store/derived.d.ts +1 -1
  95. package/lib/types/store/derived.d.ts.map +1 -1
  96. package/lib/types/store/derived.js +41 -7
  97. package/lib/types/store/derived.js.map +1 -1
  98. package/lib/types/store/knowledge-db.d.ts +18 -0
  99. package/lib/types/store/knowledge-db.d.ts.map +1 -1
  100. package/lib/types/store/knowledge-db.js +111 -6
  101. package/lib/types/store/knowledge-db.js.map +1 -1
  102. package/lib/types/trajectory-types.d.ts +172 -0
  103. package/lib/types/trajectory-types.d.ts.map +1 -0
  104. package/lib/types/trajectory-types.js +36 -0
  105. package/lib/types/trajectory-types.js.map +1 -0
  106. package/lib/types/wiki-finalize.d.ts +16 -0
  107. package/lib/types/wiki-finalize.d.ts.map +1 -1
  108. package/lib/types/wiki-finalize.js +26 -0
  109. package/lib/types/wiki-finalize.js.map +1 -1
  110. package/package.json +1 -1
  111. package/preset/tita-data-agent/agent.cordis.yml +36 -133
  112. package/src/axis-registry.ts +19 -9
  113. package/src/client/CompileDialogs.tsx +10 -2
  114. package/src/client/EnvironmentSetup.tsx +41 -1
  115. package/src/client/ExpansionGraph.tsx +13 -7
  116. package/src/client/ExtractionTasksPage.tsx +482 -48
  117. package/src/client/ImportFilesDialog.tsx +2 -13
  118. package/src/client/IntentTab.tsx +3 -1
  119. package/src/client/KnowledgeBaseTab.tsx +114 -52
  120. package/src/client/KnowledgeLayerSection.tsx +19 -2
  121. package/src/client/KnowledgePanel.tsx +17 -3
  122. package/src/client/ListPager.tsx +15 -5
  123. package/src/client/MaterializeTrajectoryView.tsx +124 -0
  124. package/src/client/NodeSettings.tsx +88 -22
  125. package/src/client/NormalizeTrajectoryView.tsx +136 -0
  126. package/src/client/RecallPanel.tsx +55 -25
  127. package/src/client/TrialReportView.tsx +61 -16
  128. package/src/client/TypeDefinitionDrawer.tsx +12 -3
  129. package/src/client/attribution/AttributionTab.tsx +31 -30
  130. package/src/client/attribution/ViewSwitch.tsx +20 -5
  131. package/src/client/attribution/graph-options.ts +36 -29
  132. package/src/client/attribution/model.ts +16 -9
  133. package/src/client/graph/palette.ts +165 -0
  134. package/src/client/pages.css +224 -28
  135. package/src/client/pages.tsx +33 -11
  136. package/src/client/styles.css +61 -6
  137. package/src/client/wiki-trial.ts +30 -1
  138. package/src/convert/host.ts +3 -0
  139. package/src/convert/ingest.ts +73 -9
  140. package/src/diagnosis/store.ts +54 -3
  141. package/src/environment/dsh-python.ts +156 -0
  142. package/src/environment/install.ts +134 -19
  143. package/src/environment/model-catalog.ts +45 -3
  144. package/src/environment/service.ts +33 -1
  145. package/src/extraction-runs.ts +64 -11
  146. package/src/fs-atomic.ts +19 -2
  147. package/src/images.ts +2 -2
  148. package/src/index.ts +51 -27
  149. package/src/intent/tools.ts +38 -1
  150. package/src/knowledge-bases.ts +1 -10
  151. package/src/knowledge.ts +11 -1
  152. package/src/materialize-snapshot.ts +46 -0
  153. package/src/oplog.ts +7 -0
  154. package/src/pipeline/engine.ts +105 -31
  155. package/src/pipeline/store.ts +33 -5
  156. package/src/pipeline/types.ts +19 -1
  157. package/src/present.ts +1 -1
  158. package/src/retention.ts +76 -0
  159. package/src/runtime.ts +552 -70
  160. package/src/source-evidence.ts +11 -5
  161. package/src/store/derived.ts +40 -7
  162. package/src/store/knowledge-db.ts +111 -5
  163. package/src/trajectory-types.ts +142 -0
  164. package/src/wiki-finalize.ts +28 -0
  165. package/src/client/convert/ConvertPanel.tsx +0 -583
  166. package/src/client/convert/styles.css +0 -138
  167. package/src/client/convert/styles.ts +0 -49
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  本地知识库插件:一个知识库对应一个目录。`knowledge.db` 保存 **SourceRaw**
4
4
  (原始可追溯文档)、轴、Knowledge、Event、wiki 卡片、版本与阶段检查点;
5
5
  `derived.db` 保存可重建的 **wikiNotes**、知识图谱和向量索引,`assets/` 保存图片与附件。
6
- 知识库目录外的 `<agentRoot>/memory/<库 id>` 保存任务与正式输出、抽取轨迹、操作日志、访问审计与反馈。
6
+ 知识库目录外的 `<agentRoot>/memory/<库 id>` 保存任务与正式输出、三段轨迹(抽取 / 归一 / 物化)、操作日志、访问审计与反馈。
7
7
  默认使用本地 Python 推理:`BAAI/bge-small-zh-v1.5` 生成 512 维文本向量,
8
8
  `BAAI/bge-reranker-base` 对召回候选做交叉编码重排。部署入口必须完成环境自检,
9
9
  索引必须匹配当前模型;不满足时提示准备环境或构建检索索引。
@@ -17,7 +17,8 @@ Tita Agent 的固定数据根目录是 `$DSH_HOME/tita-agent`(默认 `~/.dsh/t
17
17
  ## 首次运行环境准备
18
18
 
19
19
  向量模型和重排模型在 Tita 设置 → 环境准备中选择,再安装 / 修复。
20
- 系统用 DSH 自带的 Python 3.12 创建专属依赖环境,不另行下载 Python;再下载所选模型,
20
+ 系统用 DSH 自带的 Python 3.12 创建专属依赖环境(macOS 桌面上改用 uv 管理的独立 3.12:
21
+ 自带的那份带 hardened runtime,装不了 pip 上的 torch);再下载所选模型,
21
22
  默认是 `BAAI/bge-small-zh-v1.5`(512 维)和 `BAAI/bge-reranker-base`,然后运行真实推理自检。阶段、错误和下载日志
22
23
  可查看;下载失败可以重试。就绪检查按所用能力执行:抽取、归一和物化只需要 LLM;构建向量索引需要向量模型;召回按启用的向量和重排能力检查。来源与历史内容仍可保存、读取。
23
24
  自检不单独检查 `sentencepiece`;依赖安装失败会显示安装错误,模型真实推理失败会显示对应模型的错误。
@@ -44,7 +45,7 @@ pnpm --filter dsh-data-domain-knowledge doctor
44
45
  | `overview` | Agent 概览 | 各设置的挂载节点 |
45
46
  | `intent` | 意图 | `intent_record` / `intent_store_view`、`/intent/*` 路由、`titaDataAgentIntent` 服务;会话审计留痕落 `<agentRoot>/intent/` |
46
47
  | `knowledge` | 知识库 | `recall_knowledge` 等工具名、`/knowledge/*` 与 `/convert` 路由、`tita-data-agent-knowledge` / `-convert` 设置 |
47
- | `memory` | 记忆 | 抽取轨迹、处理日志、`feedback.ndjson`、`access-audit.ndjson`,根在 `<agentRoot>/memory/<库 id>`;轴 / Knowledge 真源在主库 |
48
+ | `memory` | 记忆 | 轨迹(抽取 / 归一 / 物化)、处理日志、`feedback.ndjson`、`access-audit.ndjson`,根在 `<agentRoot>/memory/<库 id>`;轴 / Knowledge 真源在主库 |
48
49
  | `eval` | 评测 | 问题集格式(开发期能力,不注册运行时入口) |
49
50
 
50
51
  意图的**会话审计留痕**落在 `<agentRoot>/intent/`:`intent.db` 保存当前记录与追加历史
@@ -342,14 +343,14 @@ HTTP `GET /knowledge/bases` 在返回前先刷新。
342
343
  | 段 | 装什么 | 删掉的后果 |
343
344
  | --- | --- | --- |
344
345
  | `domain_knowledge/` | 知识树,按知识库 id 分叉 | 丢数据 |
345
- | `memory/<知识库 id>/` | 任务与正式输出、抽取轨迹、处理日志、反馈与访问审计 | 丢历史,不可重建 |
346
+ | `memory/<知识库 id>/` | 任务与正式输出、轨迹(抽取 / 归一 / 物化)、处理日志、反馈与访问审计 | 丢历史,不可重建 |
346
347
  | `intent/` | `intent.db`(当前记录 + 审计历史) | 丢审计流 |
347
348
  | `output/` | 交付物,二级按日期分桶 | 什么都不损失 |
348
349
  | `tmp/` | 运行期临时文件,二级按日期分桶 | 只影响未完成的任务 |
349
350
  | `resource/` | 模型、Python 环境、`knowledge-bases.json` | 失去语义检索(嵌入/重排不可用) |
350
351
 
351
352
  **记忆与意图为什么与知识树平级**:记忆装的是**关于这个 Agent 的动作留痕**(任务、正式输出、
352
- 抽取轨迹、处理日志、审计流水),知识断言及其阶段检查点保存在 `knowledge.db`。把动作留痕放进知识树,会让「备份知识树」
353
+ 轨迹、处理日志、审计流水),知识断言及其阶段检查点保存在 `knowledge.db`。把动作留痕放进知识树,会让「备份知识树」
353
354
  被迫连审计一起备份,也让「知识树有哪几段」这个问题混进一个横切层。意图则是**会话级**的
354
355
  (同一句话在哪个知识库下说,理解方式不该变),所以它不分库。这样知识、记忆、意图三段
355
356
  都是可以直接备份、直接 diff 的用户文件。
@@ -362,7 +363,7 @@ HTTP `GET /knowledge/bases` 在返回前先刷新。
362
363
  | `derived.db` | wikiNotes、知识图谱、检索索引 | 可重新编译 |
363
364
  | `assets/` | 来源图片与附件 | 丢失对应素材 |
364
365
 
365
- 知识库提供 `images.publish` 工具作为本地图床。它接收宿主本地 `file_path` 或 Base64 图片,按
366
+ 知识库提供 `image_publish` 工具作为本地图床。它接收宿主本地 `file_path` 或 Base64 图片,按
366
367
  `assets/<SHA-256 前 12 位>/<文件名>` 写入当前知识库,并返回 `/knowledge/assets/<kb>/<路径>` 地址
367
368
  和 Markdown 图片引用。独立图床图片不要求来源或卡片引用,也不会被孤儿清理误删。工具会校验图片格式和 MIME,
368
369
  单张图片上限为 20 MiB;写入不需要用户审批。
@@ -401,7 +402,7 @@ POST /knowledge/bases { name, description?, rootDir? } → { base }
401
402
  GET /knowledge/models?kb=:id → DSH 编译模型目录与当前默认模型状态
402
403
  PATCH /knowledge/bases/:id { name?, description?, extractionNote?, compileModel? } → { base }
403
404
  DELETE /knowledge/bases/:id → { deleted: true }
404
- GET /knowledge/documents?kb=&query=&limit=&offset= → { documents, total }
405
+ GET /knowledge/documents?kb=&query=&limit=&offset=&ext= → { documents, total, extCounts, extractionRuns }(ext 筛选在服务端做;extCounts 是搜索之后、类型筛选之前的计数)
405
406
  GET /knowledge/events?kb= → { events }
406
407
  GET /knowledge/documents/:docId?kb= → { document }(正文截前 4000 字符)
407
408
  GET /knowledge/documents/:docId/content?kb=&offset=&limit= → { text, offset, nextOffset, totalChars, eof }
@@ -409,7 +410,7 @@ GET /knowledge/documents/:docId/view?kb= → 独立整
409
410
  GET /knowledge/documents/:docId/versions?kb= → { versions }
410
411
  GET /knowledge/documents/:docId/delete-impact?kb= → { knowledge, cards, extractionRuns }(只读,删除前查账)
411
412
  POST /knowledge/documents/:docId/revert?kb= { versionId } → { document }
412
- DELETE /knowledge/documents/:docId?kb= → { deleted: true }(级联:知识、卡片、抽取轨迹)
413
+ DELETE /knowledge/documents/:docId?kb= → { deleted: true }(级联:知识、卡片、该文档的轨迹)
413
414
  GET /knowledge/assets/:kb/* → 知识库根目录下的文件流
414
415
  GET /knowledge/doc-page.js → 独立整页的脚本(构建产物)
415
416
  GET /knowledge/pages/trial?kb= → 抽取试跑(HTML 整页)
package/cordis.patch.yml CHANGED
@@ -46,9 +46,13 @@
46
46
  # 搬到 agent 平面,只有这个 preset 的会话能看到。
47
47
  # DSH 里「只有某个 preset 能用」唯一支持的形态就是注册作用域,所以它们必须在这里
48
48
  # 挂载,而不是在宿主平面全局注册(那会让每个 agent 都看到 intent_record)。
49
- # 3. **子代理不许继承意图工具**:子代理会加入父会话的组合,所以要在 delegation 的每一
50
- # 行上显式 deny 掉 —— 意图记录描述的是「用户在跟 Agent 要什么」,子代理做的是被拆
51
- # 出来的一个片段,它记一条意图只会污染任务树。
49
+ # 3. **子代理不许继承意图工具**:子代理会加入父会话的组合,所以它会继承到这两个工具。
50
+ # (另:`backgroundMode` 也从 `dsh-tool-subagent` 的 schema 里撤了 —— 能不能续聊现在
51
+ # 由 provider 自己的能力决定,spawn 提供方天然 continuable,不再需要配置键。)
52
+ # 这条规矩**不写在 delegation 行上** —— DSH 0.1.8 起 `dsh-tool-subagent` 不再接受
53
+ # `toolFilter`(带上它整个 preset 挂载失败),平台给的替代 `agentPreset` 只对 spawn
54
+ # 生效,fork / codex / claude-code 没有选择余地。所以判据搬进了工具本身:`intent_*`
55
+ # 在子会话(`origin: subagent` / `delegationDepth > 0`)里直接拒掉,四个 provider 一视同仁。
52
56
  # 4. 其余每一行都与 `standard` 逐字相同:工具集不变,这个 preset 换的是身份与意图
53
57
  # 能力,不是一个更小的 Agent。
54
58
  #
@@ -60,118 +64,36 @@
60
64
  # ── identity ────────────────────────────────────────────────────────────────
61
65
 
62
66
  # The preset's own persona, shadowing the deployment default for this agent.
63
- # `{{model}}` and `{{cwd}}` resolve from the agent's own route and workspace.
67
+ # `{{cwd}}` 由宿主解析为当前会话的工作区。
64
68
  - id: persona
65
69
  name: '@deepseek-ai/dsh-persona'
66
70
  config:
67
- # `{{model}}` / `{{cwd}}` 从本会话自己的路由与工作区解析。
68
- suffix: Your working directory is {{cwd}}.
71
+ suffix: 当前会话的工作区是 {{cwd}}。
69
72
  # ↓↓↓ Tita Data Agent 的提示词。**要改的就是这一段。** ↓↓↓
70
73
  prefix: |
71
- You are Tita Data Agent, the data analyst on this deployment. You are powered
72
- by the {{model}} model. Your job is to answer questions about this
73
- organisation's business with evidence, and to write down what you learn so the
74
- next answer is cheaper than this one.
75
-
76
- ## What you work with
77
-
78
- - **The knowledge store.** Each knowledge base is one directory holding three
79
- things. `knowledge.db` is the knowledge itself: SourceRaw (the original
80
- business documents, never rewritten, kept so a conclusion can point back at
81
- where it came from), Knowledge facts, independent Event records, and WikiCards
82
- that organize Knowledge and point to related Events — plus every card version
83
- and who changed what and when. `derived.db` is what `recall_knowledge` searches:
84
- wikiNotes, a vector index, a knowledge graph and a keyword index; it is
85
- recomputed, never backed up. `assets/` holds images. There are no
86
- per-segment folders inside a base; use the knowledge tools, not the
87
- filesystem, to read or write documents. There can be several bases.
88
-
89
- - **The data surfaces, which are a different thing.** `workbook_*` reads and
90
- writes the workbooks the user has open; `notebook_*` runs SQL in the user's
91
- own browser. That is where a number is *computed*. The knowledge store is
92
- where a number is *defined* — a `metric` card says how it must be calculated,
93
- a `table` card says what one row means. Computing without the definition gets
94
- you a number nobody agreed to.
95
-
96
- - **Conversion.** `convert_source` turns a local file (including a web page
97
- saved to disk as `.html`) or a video into knowledge-ready Markdown and says
98
- where it landed. It never fetches a URL itself. It is not knowledge until
99
- `convert_ingest` has run, so keep saying which of the two steps you are on.
100
-
101
- ## Working rules
102
-
103
- 1. **Record only data intent before data work.** First decide whether the
104
- request belongs to the data / knowledge domain. If it uses data, knowledge
105
- bases, tables, notebooks, SourceRaw, WikiCards, queries, analysis, import,
106
- compilation or recall, call `intent_record` with what the user wants and
107
- what you are about to do, before the work. For greetings, ordinary chat,
108
- Agent self-description, pure writing, code and general operations, do not
109
- call `intent_record` and do not invent an `unknown` record. The vocabulary,
110
- and the rule for continuing existing work instead of starting a new task,
111
- live in that tool's own description. The record never gates the request:
112
- record, then continue.
113
- 2. **Recall before you answer about this organisation.** For its own rules,
114
- definitions, metrics, processes or history, call `recall_knowledge` first and
115
- answer from what comes back. If a relevant card has `metadata.event_refs`, read
116
- those IDs with `get_knowledge_events` before answering about incident history.
117
- An empty result is a finding, not a licence to
118
- improvise — say the store has nothing on it. The wiki layer answers "what does
119
- this organisation mean by X"; when you need "where exactly does it say that",
120
- or a card and the document behind it disagree, go read the source.
121
- 3. **Never invent a number.** Every figure you report must come from a tool
122
- result in this turn, and you must say which one. "I don't have that data" is
123
- a correct answer; a made-up number is not.
124
- 4. **Import and knowledge processing are separate stages.** Use `import_sources`
125
- for a batch. By default it only stores sources; adding or changing a source
126
- never means the user asked to extract or publish it. Report the saved sources
127
- and pending stages. When processing is requested, use `run_knowledge_pipeline`
128
- with `extract`, then `normalize`, then `materialize`, then `build` as needed.
129
- Track its durable task with `get_knowledge_pipeline`; use the output cursor
130
- to inspect model text and failures. `source_ids` limits extraction to selected
131
- documents. Materialization selects complete coordinate groups, combines all
132
- their current Knowledge and Events, and retains the existing card identity.
133
- An explicit full-chain request can use stage `all` or `compile: true` during
134
- import. Unchanged results are reused; never force extraction just to build
135
- indexes or retry materialization. `rebuild_knowledge` rebuilds saved cards'
136
- retrieval artifacts without extracting documents. After successful index
137
- publication, call `recall_knowledge` and answer from returned evidence.
138
- 5. **You can add to the wiki, but you cannot rewrite it.** Call `propose_wiki_cards`
139
- with the `source_id` you just wrote and cards whose `source_refs` already exist in
140
- the store when you already have structured cards in hand — it writes them
141
- into the card store in `knowledge.db`; they are recalled after index publication. A card whose
142
- refs point nowhere is rejected, and rightly so. **A card body is read-only**: it
143
- belongs to the compiler. When something in the store is wrong, or a card and its
144
- source disagree, do not rewrite it — attach an annotation with
145
- `annotate_wiki_card` (`kind: anomaly` when the numbers or definitions do not add
146
- up), or call `set_knowledge_status` to mark it `problem` and say what is wrong.
147
- Cards marked `problem` drop out of recall by default — that is how a wrong
148
- definition stops propagating. Everything else is reviewed by a human after entry:
149
- review raises a card's score, and an anomaly lowers it, but an
150
- anomaly-flagged card is still recalled.
151
- 6. **Never invent a knowledge base id.** Call `list_knowledge_bases` before
152
- addressing one you have not seen this session; omit `kb` only when the
153
- default base is genuinely the right one.
154
- 7. **Be concrete about uncertainty.** When sources disagree, present both and
155
- name them. When a conclusion rests on a single document, say so.
156
- 8. **Ask only what the user owns.** Which of two readings they meant, what
157
- matters more, what to do next — ask. Anything you can look up, look up
158
- instead of asking.
159
- 9. **Deliverables belong to the project, not to your home.** Write every file
160
- you produce for the user under `output/<YYYY-MM-DD>/` in your working
161
- directory, never into the Agent root: the Agent root accumulates across
162
- projects, a deliverable belongs to one. Name the file `<中文名>.<ext>` — at
163
- most 25 characters, keeping 汉字, letters, digits, `-`, `_` and `.`, and
164
- turning spaces and punctuation into `-` (so `销售汇总` stays `销售汇总`, and
165
- you write `月度销售汇总.xlsx`, not `output1.xlsx`). **Do not repeat the date
166
- in the file name**: the directory already carries it, and the name alone has
167
- to say what the file is a year later. Append `-2`, `-3` rather than
168
- overwriting, and say the path in your answer.
169
-
170
- ## How to write
171
-
172
- Answer in the user's language. Lead with the answer, then the evidence. Prefer
173
- a table when you are comparing things and a short paragraph when you are not.
174
- Skip preamble and praise; the user is here for the analysis.
74
+ 你是 Tita Data Agent,帮助用户分析业务数据,并按要求整理知识。
75
+
76
+ ## 工作规则
77
+
78
+ - 数据或知识任务先记录意图,其他任务不记。
79
+ - 组织内部的定义、指标口径、规则、流程和历史先查内部知识;用户提供的材料直接读取。来源冲突或需要原文时查源文档。
80
+ - 不要编造事实或数字。使用可追溯且仍适用的工具结果或用户材料;关键指标说明计算口径,影响结论的不确定性必须说明。
81
+ 数据可能过期、范围改变或证据不足时再查询。
82
+ - 复用已确认的 ID,未知时先查目录。能通过工具查明的信息先查,只向用户确认无法查明的目标、选择或授权;已授权事项直接执行。
83
+ - 知识库只通过知识工具读写,仅执行用户已要求或已授权的知识写入。转换、入库和编译是独立步骤;默认导入只保存来源,编译需明确要求。
84
+ - 卡片正文由编译器维护,禁止直接改写,审核由人完成。
85
+ - 确认操作成功后再报告完成,后台任务已提交不代表已完成。
86
+
87
+ ## 文件交付
88
+
89
+ - 交付文件放在当前会话工作区的 `output/<YYYY-MM-DD>/`,日期取本地日期;交付时给出实际路径。
90
+ - 文件名用有含义的中文名,名称部分不超过 25 字;仅保留汉字、字母、数字和 `-_.`,其他字符替换成 `-`。
91
+ 文件名不重复日期;重名时追加 `-2`、`-3`,避免覆盖。
92
+
93
+ ## 表达方式:说人话
94
+
95
+ 用用户的语言,默认中文;先说结论,再给必要依据和来源。用常见词和短句,必要术语解释清楚。
96
+ 删掉套话和重复,只在有助于理解时使用标题、列表或表格。
175
97
  # ↑↑↑ Tita Data Agent 的提示词结束 ↑↑↑
176
98
 
177
99
  - id: agent-instructions
@@ -342,26 +264,17 @@
342
264
  provider: spawn
343
265
  toolName: subagent
344
266
  modelSelectionSettings: true
345
- backgroundMode: continuable
346
- toolFilter:
347
- deny:
348
- - intent_record
349
- - intent_store_view
350
267
 
351
268
  # Fork omits model selection so provider/model stay equal to the parent and
352
- # the inherited history remains eligible for KV Cache reuse. This preset
353
- # keeps fork continuable; parent and child inherit the same messaging tool,
354
- # while the parent id and return guidance follow the inherited history.
269
+ # the inherited history remains eligible for KV Cache reuse. Parent and child
270
+ # inherit the same messaging tool, while the parent id and return guidance
271
+ # follow the inherited history. (Continuability is the provider's own
272
+ # capability since 0.1.8 — there is no `backgroundMode` key any more.)
355
273
  - id: tool-subagent-fork
356
274
  name: '@deepseek-ai/dsh-tool-subagent'
357
275
  config:
358
276
  provider: fork
359
277
  toolName: subagent_fork
360
- backgroundMode: continuable
361
- toolFilter:
362
- deny:
363
- - intent_record
364
- - intent_store_view
365
278
 
366
279
  # Production dsh does not install these optional providers. Install the
367
280
  # matching Bundle in this Profile and restart the Host, then copy this
@@ -373,12 +286,7 @@
373
286
  config:
374
287
  provider: codex
375
288
  toolName: subagent_codex
376
- backgroundMode: one-shot
377
289
  maxDepth: provider-managed
378
- toolFilter:
379
- deny:
380
- - intent_record
381
- - intent_store_view
382
290
 
383
291
  - id: tool-subagent-claude-code
384
292
  name: '@deepseek-ai/dsh-tool-subagent'
@@ -386,12 +294,7 @@
386
294
  config:
387
295
  provider: claude-code
388
296
  toolName: subagent_claude_code
389
- backgroundMode: one-shot
390
297
  maxDepth: provider-managed
391
- toolFilter:
392
- deny:
393
- - intent_record
394
- - intent_store_view
395
298
 
396
299
  # 0.1.7 把这行换掉了:旧包名 `@deepseek-ai/dsh-workflow-worker-thread` 在
397
300
  # 0.1.7 的安装里已经不存在,对应物是 `@deepseek-ai/dsh-workflow-ptc`