@dsh-libing/knowledge-base 0.1.0

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 (86) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +80 -0
  3. package/cordis.patch.yml +3 -0
  4. package/icon.svg +6 -0
  5. package/lib/chunks.d.ts +8 -0
  6. package/lib/chunks.js +197 -0
  7. package/lib/client-types/client/BrowsePanel.d.ts +13 -0
  8. package/lib/client-types/client/Icon.d.ts +4 -0
  9. package/lib/client-types/client/ImageReview.d.ts +20 -0
  10. package/lib/client-types/client/ImportPanel.d.ts +19 -0
  11. package/lib/client-types/client/JobsPanel.d.ts +6 -0
  12. package/lib/client-types/client/KnowledgePage.d.ts +7 -0
  13. package/lib/client-types/client/Metadata.d.ts +10 -0
  14. package/lib/client-types/client/QualityReport.d.ts +6 -0
  15. package/lib/client-types/client/SettingsPanel.d.ts +6 -0
  16. package/lib/client-types/client/SourceText.d.ts +3 -0
  17. package/lib/client-types/client/UsageGuide.d.ts +8 -0
  18. package/lib/client-types/client/api.d.ts +953 -0
  19. package/lib/client-types/client/common.d.ts +11 -0
  20. package/lib/client-types/client/index.d.ts +14 -0
  21. package/lib/client-types/client/locales.d.ts +284 -0
  22. package/lib/client-types/client/searchCommand.d.ts +2 -0
  23. package/lib/client-types/client/useKnowledge.d.ts +251 -0
  24. package/lib/client-types/contract.d.ts +1197 -0
  25. package/lib/client-types/data.d.ts +1972 -0
  26. package/lib/client-types/settings.d.ts +33 -0
  27. package/lib/client-types/shared.d.ts +95 -0
  28. package/lib/client.js +305 -0
  29. package/lib/config.d.ts +13 -0
  30. package/lib/config.js +13 -0
  31. package/lib/contract.d.ts +1197 -0
  32. package/lib/contract.js +18 -0
  33. package/lib/data.d.ts +1972 -0
  34. package/lib/data.js +80 -0
  35. package/lib/document/convert.d.ts +5 -0
  36. package/lib/document/convert.js +325 -0
  37. package/lib/document/pdf-data.d.ts +99 -0
  38. package/lib/document/pdf-data.js +9 -0
  39. package/lib/document/pdf-layout.d.ts +24 -0
  40. package/lib/document/pdf-layout.js +234 -0
  41. package/lib/document/pdf-session.d.ts +39 -0
  42. package/lib/document/pdf-session.js +127 -0
  43. package/lib/document/pdf-vision.d.ts +26 -0
  44. package/lib/document/pdf-vision.js +115 -0
  45. package/lib/document/pdf-worker.d.ts +1 -0
  46. package/lib/document/pdf-worker.js +210 -0
  47. package/lib/document/pdf.d.ts +3 -0
  48. package/lib/document/pdf.js +218 -0
  49. package/lib/document/zip.d.ts +3 -0
  50. package/lib/document/zip.js +59 -0
  51. package/lib/figures/process.d.ts +187 -0
  52. package/lib/figures/process.js +159 -0
  53. package/lib/figures/prompts.d.ts +7 -0
  54. package/lib/figures/prompts.js +27 -0
  55. package/lib/index.d.ts +8 -0
  56. package/lib/index.js +42 -0
  57. package/lib/indexes.d.ts +38 -0
  58. package/lib/indexes.js +101 -0
  59. package/lib/jobs.d.ts +2806 -0
  60. package/lib/jobs.js +435 -0
  61. package/lib/models.d.ts +24 -0
  62. package/lib/models.js +120 -0
  63. package/lib/retrieval.d.ts +209 -0
  64. package/lib/retrieval.js +173 -0
  65. package/lib/routes.d.ts +3 -0
  66. package/lib/routes.js +152 -0
  67. package/lib/runtime.d.ts +48 -0
  68. package/lib/runtime.js +41 -0
  69. package/lib/settings.d.ts +33 -0
  70. package/lib/settings.js +19 -0
  71. package/lib/shared.d.ts +95 -0
  72. package/lib/shared.js +17 -0
  73. package/lib/skills.d.ts +3 -0
  74. package/lib/skills.js +21 -0
  75. package/lib/store.d.ts +409 -0
  76. package/lib/store.js +328 -0
  77. package/lib/tools.d.ts +3 -0
  78. package/lib/tools.js +72 -0
  79. package/lib/util.d.ts +25 -0
  80. package/lib/util.js +89 -0
  81. package/package.json +125 -0
  82. package/skills/libing-kb-build/SKILL.md +10 -0
  83. package/skills/libing-kb-search/SKILL.md +10 -0
  84. package/skills/libing-knowledge-base/SKILL.md +15 -0
  85. package/skills/libing-knowledge-base/references/build.md +23 -0
  86. package/skills/libing-knowledge-base/references/search.md +21 -0
@@ -0,0 +1,18 @@
1
+ /** JSON responses shared with the browser; imports stay free of Host and filesystem modules. */
2
+ import { z } from 'zod';
3
+ import { jobSchema, registrySchema, librarySchema, publishedDocumentSchema, reportSchema } from "./data.js";
4
+ export const publicJobSchema = jobSchema.omit({ schema: true, overlays: true }).extend({ outputPath: z.string().nullable(), reused: z.boolean().optional() });
5
+ export const locationSchema = z.object({ kbPath: z.string(), revision: z.string().nullable(), wikiPath: z.string().nullable(), indexPath: z.string().nullable() });
6
+ export const libraryViewSchema = librarySchema.extend({ location: locationSchema, summary: z.object({ revision: z.string().nullable(), documentCount: z.number(), chunkCount: z.number(), coverageIncomplete: z.boolean() }) });
7
+ export const stateSchema = z.object({ hostVersion: z.string(), kbs: z.array(libraryViewSchema), deletedKbs: z.array(librarySchema), activities: registrySchema.shape.activities, jobs: z.array(publicJobSchema), dataRoot: z.string(), config: z.object({ chunkTargetChars: z.number(), visionProvider: z.string(), visionModel: z.string(), maxInputBytes: z.number() }) });
8
+ export const treeDocumentSchema = publishedDocumentSchema.extend({ chunks: z.array(publishedDocumentSchema.shape.chunks.element.omit({ segments: true, anchors: true })), figures: z.array(publishedDocumentSchema.shape.figures.element.extend({ expectedHash: z.string().optional() })) });
9
+ export const treeSchema = z.object({ kbId: z.string(), revision: z.string(), location: locationSchema.optional(), previewJobId: z.string().optional(), coverageIncomplete: z.boolean(), report: reportSchema, documents: z.array(treeDocumentSchema) });
10
+ export const readSchema = z.object({ kbId: z.string(), chunkId: z.string(), revision: z.string(), text: z.string(), complete: z.boolean(), truncated: z.boolean().optional(), previewJobId: z.string().optional(),
11
+ continuation: z.object({ segmentIndex: z.number(), offset: z.number() }).nullable(), assetRefs: z.array(z.string()), relatedChunks: z.array(z.string()), warnings: z.array(z.string()),
12
+ source: z.object({ docId: z.string(), title: z.string(), sourceVersion: z.string(), sourceHash: z.string(), revision: z.string(), headingPath: z.array(z.string()), path: z.string(), contentHash: z.string(),
13
+ sourceFormat: z.literal('pdf').optional(), pageCount: z.number().optional(), selectedPages: publishedDocumentSchema.shape.selectedPages, pageRange: z.array(z.number()).optional(), scope: z.string().optional(), locations: z.array(z.object({ page: z.number(), pageLabel: z.string().nullable().optional(), method: z.string(), bbox: z.array(z.number()).nullable(), caption: z.string().optional() })).optional(), locationsTruncated: z.boolean().optional() }) });
14
+ export const searchResultSchema = z.object({ kbId: z.string(), revision: z.string(), query: z.string(), totalCandidates: z.number(), truncated: z.boolean(), candidates: z.array(z.object({ chunkId: z.string(), title: z.string(), summary: z.string(), fullChars: z.number(), reviewStatus: z.string() })), evidence: z.array(z.unknown()), warnings: z.array(z.object({ docId: z.string().optional(), chunkId: z.string().optional(), kind: z.string().optional(), message: z.string() })) });
15
+ export const modelsSchema = z.object({ providers: z.array(z.object({ id: z.string(), name: z.string(), models: z.array(z.object({ id: z.string(), name: z.string(), inputModalities: z.array(z.string()).optional() })), error: z.string().optional() })) });
16
+ export const schemaResultSchema = z.object({ content: z.string(), hash: z.string() });
17
+ export const inspectSchema = z.object({ sourceFormat: z.literal('pdf'), pageCount: z.number(), outlineCount: z.number(), samples: z.array(z.object({ page: z.number(), chars: z.number(), hasGraphics: z.boolean(), possibleOcr: z.boolean(), hasStructure: z.boolean() })), possibleOcr: z.boolean(), note: z.string() });
18
+ export const uploadResultSchema = z.object({ receiptId: z.string(), filename: z.string(), bytes: z.number() });