@biaoo/tiangong-wiki 0.3.8 → 0.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -117,6 +117,8 @@ tiangong-wiki dashboard # open dashboard in browse
117
117
 
118
118
  > Environment variables are managed via `.wiki.env` (created by `tiangong-wiki setup`). The CLI prefers the nearest local `.wiki.env`, then falls back to the global default workspace config. See [references/troubleshooting.md](./references/troubleshooting.md) for the full reference. For a centralized Linux + `systemd` + Nginx deployment, see [references/centralized-service-deployment.md](./references/centralized-service-deployment.md). That deployment guide now also includes Git repository / GitHub remote setup for daemon-side commit and optional auto-push.
119
119
 
120
+ For document-heavy vaults, set `WIKI_PARSER_SKILLS=document-granular-decompose` and configure `UNSTRUCTURED_API_BASE_URL` plus `UNSTRUCTURED_AUTH_TOKEN` to prefer the TianGong Unstructure parser. The wiki workflow uses `return_txt=true` and consumes the plain `txt` text as the agent input; `UNSTRUCTURED_PROVIDER` and `UNSTRUCTURED_MODEL` are optional overrides.
121
+
120
122
  ## MCP Server
121
123
 
122
124
  Tiangong Wiki ships a separate MCP adapter that talks to the daemon over HTTP. It uses the MCP Streamable HTTP transport, not stdio.
package/README.zh-CN.md CHANGED
@@ -117,6 +117,8 @@ tiangong-wiki dashboard # 在浏览器中打开仪
117
117
 
118
118
  > 环境变量通过 `.wiki.env` 管理(由 `tiangong-wiki setup` 创建)。CLI 会优先使用最近的本地 `.wiki.env`,找不到时再 fallback 到全局默认工作区配置。完整参考见 [references/troubleshooting.md](./references/troubleshooting.md)。如需部署中心化服务(Linux + `systemd` + Nginx),见 [references/centralized-service-deployment.md](./references/centralized-service-deployment.md)。该部署文档现在也包含了 Git 仓库初始化、GitHub remote 配置和 daemon 自动 push 的 Git 配置说明。
119
119
 
120
+ 如果 vault 里以文档解析为主,可设置 `WIKI_PARSER_SKILLS=document-granular-decompose`,并配置 `UNSTRUCTURED_API_BASE_URL` 与 `UNSTRUCTURED_AUTH_TOKEN`,让 workflow 优先使用 TianGong Unstructure parser。wiki workflow 会使用 `return_txt=true`,并把返回的纯 `txt` 文本作为 agent 主输入;`UNSTRUCTURED_PROVIDER` 和 `UNSTRUCTURED_MODEL` 只是可选覆盖项。
121
+
120
122
  ## MCP Server
121
123
 
122
124
  Tiangong Wiki 提供了独立的 MCP 适配层,通过 HTTP 调用 daemon。它使用的是 MCP 的 Streamable HTTP 传输,不是 stdio。
@@ -83,6 +83,8 @@ export function buildVaultWorkflowPrompt(input) {
83
83
  "",
84
84
  "1. Read queue-item.json next to RESULT_JSON_PATH.",
85
85
  "2. Read the target vault file at VAULT_FILE_PATH. Refer to `references/vault-to-wiki-instruction.md` (Phase 1) in the wiki package for file-type-specific reading strategies, parser skill discovery, image handling, and metadata utilization.",
86
+ " - If `WIKI_PARSER_SKILLS` includes `document-granular-decompose` and `UNSTRUCTURED_API_BASE_URL` plus `UNSTRUCTURED_AUTH_TOKEN` are set, prefer that skill for supported document/image formats before the legacy type-specific parser skills.",
87
+ " - When using `document-granular-decompose`, request `return_txt=true`, treat the pure text extracted from `response.txt`/`txt` as the main input, and keep raw JSON only for debugging or page-number evidence.",
86
88
  "3. Discover the current page type ontology via `tiangong-wiki type list` and `tiangong-wiki type show <type>`. Do not assume any type, template, or default target type.",
87
89
  "4. Search the existing wiki for overlapping or related content:",
88
90
  " - Use `tiangong-wiki fts` and `tiangong-wiki search` with key terms from the source.",
@@ -8,14 +8,21 @@ import { copyDirectoryContentsSync, ensureDirSync, pathExistsSync, readTextFileS
8
8
  import { resolveRuntimePaths } from "./paths.js";
9
9
  import { toOffsetIso } from "../utils/time.js";
10
10
  export const PARSER_SKILL_SOURCE = "https://github.com/anthropics/skills";
11
+ export const TIANGONG_PARSER_SKILL_SOURCE = "https://github.com/tiangong-ai/skills";
11
12
  export const MANAGED_SKILL_STATE_FILE = ".tiangong-wiki-skill.json";
12
13
  export const OPTIONAL_PARSER_SKILLS = [
13
- { name: "pdf", summary: "Process PDF files" },
14
- { name: "docx", summary: "Process DOCX files" },
15
- { name: "pptx", summary: "Process PPTX files" },
16
- { name: "xlsx", summary: "Process XLSX/CSV files" },
14
+ { name: "pdf", summary: "Process PDF files", source: PARSER_SKILL_SOURCE },
15
+ { name: "docx", summary: "Process DOCX files", source: PARSER_SKILL_SOURCE },
16
+ { name: "pptx", summary: "Process PPTX files", source: PARSER_SKILL_SOURCE },
17
+ { name: "xlsx", summary: "Process XLSX/CSV files", source: PARSER_SKILL_SOURCE },
18
+ {
19
+ name: "document-granular-decompose",
20
+ summary: "Process documents through TianGong Unstructure and return plain fulltext",
21
+ source: TIANGONG_PARSER_SKILL_SOURCE,
22
+ },
17
23
  ];
18
24
  const OPTIONAL_PARSER_SKILL_NAMES = new Set(OPTIONAL_PARSER_SKILLS.map((skill) => skill.name));
25
+ const OPTIONAL_PARSER_SKILL_BY_NAME = new Map(OPTIONAL_PARSER_SKILLS.map((skill) => [skill.name, skill]));
19
26
  const MANAGED_SKILL_SOURCE_KINDS = new Set([
20
27
  "workspace-package",
21
28
  "curated-parser",
@@ -228,11 +235,15 @@ function normalizeManagedSource(rawSource) {
228
235
  return source;
229
236
  }
230
237
  function createParserDescriptor(workspaceRoot, name, configured) {
238
+ const definition = OPTIONAL_PARSER_SKILL_BY_NAME.get(name);
239
+ if (!definition) {
240
+ throw new AppError(`Unsupported parser skill: ${name}`, "config");
241
+ }
231
242
  return {
232
243
  name,
233
244
  sourceKind: "curated-parser",
234
245
  configured,
235
- source: PARSER_SKILL_SOURCE,
246
+ source: definition.source,
236
247
  skillPath: resolveWorkspaceSkillPath(workspaceRoot, name),
237
248
  };
238
249
  }
@@ -656,7 +667,11 @@ export function ensureWikiSkillInstall(wikiPath, packageRoot) {
656
667
  };
657
668
  }
658
669
  export function buildParserSkillInstallInvocation(skillName) {
659
- return buildExternalSkillInstallInvocation(PARSER_SKILL_SOURCE, skillName);
670
+ const definition = OPTIONAL_PARSER_SKILL_BY_NAME.get(skillName);
671
+ if (!definition) {
672
+ throw new AppError(`Unsupported parser skill: ${skillName}`, "config");
673
+ }
674
+ return buildExternalSkillInstallInvocation(definition.source, skillName);
660
675
  }
661
676
  export function installParserSkill(skillName, workspaceRoot, options = {}) {
662
677
  const installed = installManagedExternalSkill(createParserDescriptor(workspaceRoot, skillName, true), {