dsh-data-domain-knowledge 0.1.1-alpha.8 → 0.1.1-alpha.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.
Files changed (125) hide show
  1. package/lib/client.js +6 -19
  2. package/lib/pages.js +3392 -424
  3. package/lib/types/extract-model.d.ts +2 -0
  4. package/lib/types/extract-model.d.ts.map +1 -1
  5. package/lib/types/extract-model.js.map +1 -1
  6. package/lib/types/extract-table-contract.d.ts +66 -0
  7. package/lib/types/extract-table-contract.d.ts.map +1 -1
  8. package/lib/types/extract-table-contract.js +38 -21
  9. package/lib/types/extract-table-contract.js.map +1 -1
  10. package/lib/types/extract-table.d.ts +1 -1
  11. package/lib/types/extract-table.d.ts.map +1 -1
  12. package/lib/types/extract-table.js +14 -8
  13. package/lib/types/extract-table.js.map +1 -1
  14. package/lib/types/extraction-reply.d.ts +3 -1
  15. package/lib/types/extraction-reply.d.ts.map +1 -1
  16. package/lib/types/extraction-reply.js +3 -3
  17. package/lib/types/extraction-reply.js.map +1 -1
  18. package/lib/types/index.d.ts.map +1 -1
  19. package/lib/types/index.js +57 -4
  20. package/lib/types/index.js.map +1 -1
  21. package/lib/types/knowledge.d.ts.map +1 -1
  22. package/lib/types/knowledge.js +18 -6
  23. package/lib/types/knowledge.js.map +1 -1
  24. package/lib/types/pipeline/coverage.d.ts +5 -0
  25. package/lib/types/pipeline/coverage.d.ts.map +1 -1
  26. package/lib/types/pipeline/coverage.js +1 -0
  27. package/lib/types/pipeline/coverage.js.map +1 -1
  28. package/lib/types/pipeline/engine.d.ts +3 -1
  29. package/lib/types/pipeline/engine.d.ts.map +1 -1
  30. package/lib/types/pipeline/engine.js +27 -8
  31. package/lib/types/pipeline/engine.js.map +1 -1
  32. package/lib/types/pipeline/resumable-extract.d.ts +10 -1
  33. package/lib/types/pipeline/resumable-extract.d.ts.map +1 -1
  34. package/lib/types/pipeline/resumable-extract.js +231 -58
  35. package/lib/types/pipeline/resumable-extract.js.map +1 -1
  36. package/lib/types/pipeline/store.d.ts.map +1 -1
  37. package/lib/types/pipeline/store.js +2 -1
  38. package/lib/types/pipeline/store.js.map +1 -1
  39. package/lib/types/pipeline/toon-recovery.d.ts +9 -0
  40. package/lib/types/pipeline/toon-recovery.d.ts.map +1 -0
  41. package/lib/types/pipeline/toon-recovery.js +14 -0
  42. package/lib/types/pipeline/toon-recovery.js.map +1 -0
  43. package/lib/types/pipeline/types.d.ts +5 -0
  44. package/lib/types/pipeline/types.d.ts.map +1 -1
  45. package/lib/types/pipeline/types.js.map +1 -1
  46. package/lib/types/reading-marks.d.ts +75 -0
  47. package/lib/types/reading-marks.d.ts.map +1 -0
  48. package/lib/types/reading-marks.js +162 -0
  49. package/lib/types/reading-marks.js.map +1 -0
  50. package/lib/types/runtime.d.ts +30 -0
  51. package/lib/types/runtime.d.ts.map +1 -1
  52. package/lib/types/runtime.js +78 -4
  53. package/lib/types/runtime.js.map +1 -1
  54. package/lib/types/store/knowledge-db.d.ts +2 -0
  55. package/lib/types/store/knowledge-db.d.ts.map +1 -1
  56. package/lib/types/store/knowledge-db.js +19 -0
  57. package/lib/types/store/knowledge-db.js.map +1 -1
  58. package/lib/types/tool-approval.d.ts +29 -0
  59. package/lib/types/tool-approval.d.ts.map +1 -0
  60. package/lib/types/tool-approval.js +28 -0
  61. package/lib/types/tool-approval.js.map +1 -0
  62. package/lib/types/wiki-trial-types.d.ts +21 -0
  63. package/lib/types/wiki-trial-types.d.ts.map +1 -1
  64. package/lib/types/wiki-trial.d.ts.map +1 -1
  65. package/lib/types/wiki-trial.js +63 -11
  66. package/lib/types/wiki-trial.js.map +1 -1
  67. package/lib/wire/contracts.d.ts +1 -0
  68. package/lib/wire/contracts.d.ts.map +1 -1
  69. package/lib/wire/contracts.js +8 -3
  70. package/lib/wire/contracts.js.map +1 -1
  71. package/lib/wire/toon-codec.d.ts +27 -0
  72. package/lib/wire/toon-codec.d.ts.map +1 -0
  73. package/lib/wire/toon-codec.js +158 -0
  74. package/lib/wire/toon-codec.js.map +1 -0
  75. package/lib/wire/toon-grammar.d.ts +9 -0
  76. package/lib/wire/toon-grammar.d.ts.map +1 -0
  77. package/lib/wire/toon-grammar.js +42 -0
  78. package/lib/wire/toon-grammar.js.map +1 -0
  79. package/lib/wire/toon-kit.d.ts +8 -0
  80. package/lib/wire/toon-kit.d.ts.map +1 -0
  81. package/lib/wire/toon-kit.js +8 -0
  82. package/lib/wire/toon-kit.js.map +1 -0
  83. package/lib/wire/toon-pages.d.ts +17 -0
  84. package/lib/wire/toon-pages.d.ts.map +1 -0
  85. package/lib/wire/toon-pages.js +21 -0
  86. package/lib/wire/toon-pages.js.map +1 -0
  87. package/lib/wire/toon-repair.d.ts +46 -0
  88. package/lib/wire/toon-repair.d.ts.map +1 -0
  89. package/lib/wire/toon-repair.js +226 -0
  90. package/lib/wire/toon-repair.js.map +1 -0
  91. package/lib/wire/toon-session.d.ts +56 -0
  92. package/lib/wire/toon-session.d.ts.map +1 -0
  93. package/lib/wire/toon-session.js +104 -0
  94. package/lib/wire/toon-session.js.map +1 -0
  95. package/lib/wire/toon.d.ts +19 -0
  96. package/lib/wire/toon.d.ts.map +1 -1
  97. package/lib/wire/toon.js +102 -40
  98. package/lib/wire/toon.js.map +1 -1
  99. package/package.json +1 -1
  100. package/src/client/DocumentExtractionView.tsx +29 -102
  101. package/src/client/ExtractionTasksPage.tsx +26 -4
  102. package/src/client/FileImportView.tsx +66 -19
  103. package/src/client/ImportFilesDialog.tsx +5 -18
  104. package/src/client/KnowledgeBaseTab.tsx +3 -5
  105. package/src/client/NormalizeAxesPanel.tsx +166 -0
  106. package/src/client/ReadingView.tsx +565 -0
  107. package/src/client/tasks-page.css +471 -60
  108. package/src/extract-model.ts +2 -0
  109. package/src/extract-table-contract.ts +40 -21
  110. package/src/extract-table.ts +13 -8
  111. package/src/extraction-reply.ts +6 -4
  112. package/src/index.ts +46 -3
  113. package/src/knowledge.ts +21 -7
  114. package/src/pipeline/coverage.ts +6 -0
  115. package/src/pipeline/engine.ts +30 -8
  116. package/src/pipeline/resumable-extract.ts +200 -46
  117. package/src/pipeline/store.ts +2 -1
  118. package/src/pipeline/toon-recovery.ts +15 -0
  119. package/src/pipeline/types.ts +5 -0
  120. package/src/reading-marks.ts +172 -0
  121. package/src/runtime.ts +64 -3
  122. package/src/store/knowledge-db.ts +18 -0
  123. package/src/tool-approval.ts +46 -0
  124. package/src/wiki-trial-types.ts +19 -0
  125. package/src/wiki-trial.ts +56 -11
package/lib/client.js CHANGED
@@ -110907,15 +110907,6 @@ var Progress3 = React44.forwardRef(function Progress4({ className, value, max: m
110907
110907
 
110908
110908
  // src/client/ImportFilesDialog.tsx
110909
110909
  var import_jsx_runtime61 = require("react/jsx-runtime");
110910
- var SOURCE_ORIGIN_OPTIONS = [
110911
- { value: "local", label: "\u672C\u5730\u6587\u4EF6" },
110912
- { value: "web", label: "\u7F51\u9875" },
110913
- { value: "feishu", label: "\u98DE\u4E66 / Lark" },
110914
- { value: "google_docs", label: "Google Docs" },
110915
- { value: "notion", label: "Notion" },
110916
- { value: "wechat", label: "\u5FAE\u4FE1\u516C\u4F17\u53F7" },
110917
- { value: "other", label: "\u5176\u4ED6\u6765\u6E90" }
110918
- ];
110919
110910
  var EXT_TONE = {
110920
110911
  pdf: styles.importExtPdf,
110921
110912
  docx: styles.importExtOffice,
@@ -110941,7 +110932,6 @@ function ImportFilesDialog({
110941
110932
  summary,
110942
110933
  onPick,
110943
110934
  onAddFiles,
110944
- onOriginChange,
110945
110935
  onRemove,
110946
110936
  onStart,
110947
110937
  onBackground,
@@ -110997,7 +110987,7 @@ function ImportFilesDialog({
110997
110987
  /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Upload, { size: 18, "aria-hidden": "true" }),
110998
110988
  /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("span", { className: styles.importDropText, children: [
110999
110989
  /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("b", { children: busy ? "\u672C\u6279\u6587\u4EF6\u6B63\u5728\u5904\u7406\uFF0C\u6682\u4E0D\u80FD\u6DFB\u52A0" : "\u628A\u6587\u4EF6\u62D6\u5230\u8FD9\u91CC\uFF0C\u6216\u70B9\u8FD9\u91CC\u9009\u62E9" }),
111000
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("small", { children: busy ? "\u8BF7\u7B49\u5F85\u672C\u6279\u5B8C\u6210\u540E\u518D\u5BFC\u5165" : "\u4EC5 Markdown \u6587\u6863\uFF0C\u53EF\u4E00\u6B21\u9009\u591A\u4E2A\uFF1B\u9010\u4EFD\u9009\u62E9\u5185\u5BB9\u6765\u6E90" })
110990
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("small", { children: busy ? "\u8BF7\u7B49\u5F85\u672C\u6279\u5B8C\u6210\u540E\u518D\u5BFC\u5165" : "\u4EC5 Markdown \u6587\u6863\uFF0C\u53EF\u4E00\u6B21\u9009\u591A\u4E2A" })
111001
110991
  ] })
111002
110992
  ]
111003
110993
  }
@@ -111011,7 +111001,6 @@ function ImportFilesDialog({
111011
111001
  item.note !== void 0 && item.stage !== "pending" ? ` \xB7 ${item.note}` : ""
111012
111002
  ] })
111013
111003
  ] }),
111014
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(SelectMenu, { size: "sm", className: "knImportOrigin", "aria-label": `${item.name} \u7684\u5185\u5BB9\u6765\u6E90`, placeholder: "\u9009\u62E9\u5185\u5BB9\u6765\u6E90", value: item.sourceOrigin ?? "", options: SOURCE_ORIGIN_OPTIONS, disabled: busy || item.stage === "ingested", onValueChange: (value) => onOriginChange(item.id, value) }),
111015
111004
  /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
111016
111005
  Button,
111017
111006
  {
@@ -111026,7 +111015,7 @@ function ImportFilesDialog({
111026
111015
  )
111027
111016
  ] }, item.id)) })
111028
111017
  ] }),
111029
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("p", { className: "knImportHint", children: "\u6240\u6709\u6765\u6E90\u4EE5 Markdown \u4FDD\u5B58\u3002\u6765\u6E90\u5E73\u53F0\u3001\u539F\u59CB\u94FE\u63A5\u548C\u552F\u4E00 ID \u7684 YAML \u7531 Agent \u6309 skill \u6574\u7406\uFF1B\u6B64\u5904\u53EA\u767B\u8BB0\u5185\u5BB9\u6765\u6E90\u3002" }),
111018
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("p", { className: "knImportHint", children: "\u6240\u6709\u6765\u6E90\u4EE5 Markdown \u4FDD\u5B58\u3002\u6765\u6E90\u5E73\u53F0\u3001\u539F\u59CB\u94FE\u63A5\u548C\u552F\u4E00 ID \u7684 YAML \u7531 Agent \u6309 skill \u6574\u7406\u3002" }),
111030
111019
  items.length > 0 && (busy || items.some((item) => item.stage !== "pending") || compileProgress !== null) && /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("section", { className: styles.importSection, children: [
111031
111020
  /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: styles.importSectionHead, children: [
111032
111021
  /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("h4", { children: "\u5904\u7406\u8FDB\u5C55" }),
@@ -111176,7 +111165,7 @@ function ImportFilesDialog({
111176
111165
  /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("span", { className: styles.importActions, children: [
111177
111166
  failed.length > 0 && onRetryFailed !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Button, { variant: "outline", size: "sm", disabled: busy, onClick: onRetryFailed, children: "\u91CD\u8BD5\u5931\u8D25\u9879" }),
111178
111167
  busy && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Button, { variant: "outline", size: "sm", onClick: () => onBackground?.() ?? onOpenChange(false), children: "\u540E\u53F0\u8FD0\u884C" }),
111179
- /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(Button, { variant: "default", size: "sm", disabled: busy || pending.length === 0 || pending.some((item) => !item.sourceOrigin), onClick: onStart, children: [
111168
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(Button, { variant: "default", size: "sm", disabled: busy || pending.length === 0, onClick: onStart, children: [
111180
111169
  /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(FileText, { size: 13 }),
111181
111170
  busy ? "\u5904\u7406\u4E2D\u2026" : `\u5F00\u59CB\u5BFC\u5165${pending.length > 0 ? ` \xB7 ${pending.length} \u4E2A` : ""}`
111182
111171
  ] })
@@ -111872,13 +111861,13 @@ function KnowledgeBaseTab({ visible, onChanged, onActiveBaseChange, knowledge, f
111872
111861
  setNotice({ tone, text });
111873
111862
  onChanged?.();
111874
111863
  };
111875
- const writeSource = async (title, content, sourceId, sourceOrigin) => {
111864
+ const writeSource = async (title, content, sourceId) => {
111876
111865
  const base2 = active;
111877
111866
  if (!base2) throw new Error("\u8BF7\u5148\u9009\u62E9\u4E00\u4E2A\u77E5\u8BC6\u5E93");
111878
111867
  const payload = await requestJson("/knowledge/sources", {
111879
111868
  method: "POST",
111880
111869
  headers: { "content-type": "application/json" },
111881
- body: JSON.stringify({ kb: base2.id, source_id: sourceId, title, external_id: `upload:${sourceId}`, content, allow_duplicate_title: true, metadata: { original_filename: title, source_format: "markdown", ...sourceOrigin ? { source_origin: sourceOrigin } : {} } })
111870
+ body: JSON.stringify({ kb: base2.id, source_id: sourceId, title, external_id: `upload:${sourceId}`, content, allow_duplicate_title: true, metadata: { original_filename: title, source_format: "markdown" } })
111882
111871
  });
111883
111872
  const assets = payload.data?.assets;
111884
111873
  return [...payload.warnings ?? [], ...assets !== void 0 && assets.missing > 0 && assets.missing === assets.refs ? [`\u6B63\u6587\u5F15\u7528\u7684 ${assets.refs} \u5F20\u56FE\u7247\u4E00\u5F20\u90FD\u6CA1\u8FDB\u5E93`] : []];
@@ -111987,12 +111976,11 @@ function KnowledgeBaseTab({ visible, onChanged, onActiveBaseChange, knowledge, f
111987
111976
  for (const item of queue) {
111988
111977
  patchImportItem(item.id, { stage: "converting", note: void 0 });
111989
111978
  try {
111990
- if (!item.sourceOrigin) throw new Error("\u8BF7\u9009\u62E9\u8FD9\u4EFD\u6587\u6863\u7684\u5185\u5BB9\u6765\u6E90");
111991
111979
  const ext = item.name.slice(item.name.lastIndexOf(".")).toLowerCase();
111992
111980
  let notes = [];
111993
111981
  if (DIRECT_READ_EXT.has(ext)) {
111994
111982
  const content = await directReadText(item.file);
111995
- notes = await writeSource(item.name, content, item.sourceId, item.sourceOrigin);
111983
+ notes = await writeSource(item.name, content, item.sourceId);
111996
111984
  } else {
111997
111985
  notes = await convertAndIngest(item.file, item.sourceId, (note2) => patchImportItem(item.id, { note: note2 }));
111998
111986
  }
@@ -112874,7 +112862,6 @@ ${card.summary ?? ""}`.toLocaleLowerCase().includes(needle)));
112874
112862
  compileProgress,
112875
112863
  onPick: () => importInput.current?.click(),
112876
112864
  onAddFiles: addImportFiles,
112877
- onOriginChange: (id3, origin) => patchImportItem(id3, { sourceOrigin: origin }),
112878
112865
  onRemove: (id3) => setImportItems((current2) => current2.filter((item) => item.id !== id3)),
112879
112866
  onStart: () => void runImportQueue(),
112880
112867
  onBackground: () => setImportOpen(false),