@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.
- package/CHANGELOG.md +16 -0
- package/README.md +80 -0
- package/cordis.patch.yml +3 -0
- package/icon.svg +6 -0
- package/lib/chunks.d.ts +8 -0
- package/lib/chunks.js +197 -0
- package/lib/client-types/client/BrowsePanel.d.ts +13 -0
- package/lib/client-types/client/Icon.d.ts +4 -0
- package/lib/client-types/client/ImageReview.d.ts +20 -0
- package/lib/client-types/client/ImportPanel.d.ts +19 -0
- package/lib/client-types/client/JobsPanel.d.ts +6 -0
- package/lib/client-types/client/KnowledgePage.d.ts +7 -0
- package/lib/client-types/client/Metadata.d.ts +10 -0
- package/lib/client-types/client/QualityReport.d.ts +6 -0
- package/lib/client-types/client/SettingsPanel.d.ts +6 -0
- package/lib/client-types/client/SourceText.d.ts +3 -0
- package/lib/client-types/client/UsageGuide.d.ts +8 -0
- package/lib/client-types/client/api.d.ts +953 -0
- package/lib/client-types/client/common.d.ts +11 -0
- package/lib/client-types/client/index.d.ts +14 -0
- package/lib/client-types/client/locales.d.ts +284 -0
- package/lib/client-types/client/searchCommand.d.ts +2 -0
- package/lib/client-types/client/useKnowledge.d.ts +251 -0
- package/lib/client-types/contract.d.ts +1197 -0
- package/lib/client-types/data.d.ts +1972 -0
- package/lib/client-types/settings.d.ts +33 -0
- package/lib/client-types/shared.d.ts +95 -0
- package/lib/client.js +305 -0
- package/lib/config.d.ts +13 -0
- package/lib/config.js +13 -0
- package/lib/contract.d.ts +1197 -0
- package/lib/contract.js +18 -0
- package/lib/data.d.ts +1972 -0
- package/lib/data.js +80 -0
- package/lib/document/convert.d.ts +5 -0
- package/lib/document/convert.js +325 -0
- package/lib/document/pdf-data.d.ts +99 -0
- package/lib/document/pdf-data.js +9 -0
- package/lib/document/pdf-layout.d.ts +24 -0
- package/lib/document/pdf-layout.js +234 -0
- package/lib/document/pdf-session.d.ts +39 -0
- package/lib/document/pdf-session.js +127 -0
- package/lib/document/pdf-vision.d.ts +26 -0
- package/lib/document/pdf-vision.js +115 -0
- package/lib/document/pdf-worker.d.ts +1 -0
- package/lib/document/pdf-worker.js +210 -0
- package/lib/document/pdf.d.ts +3 -0
- package/lib/document/pdf.js +218 -0
- package/lib/document/zip.d.ts +3 -0
- package/lib/document/zip.js +59 -0
- package/lib/figures/process.d.ts +187 -0
- package/lib/figures/process.js +159 -0
- package/lib/figures/prompts.d.ts +7 -0
- package/lib/figures/prompts.js +27 -0
- package/lib/index.d.ts +8 -0
- package/lib/index.js +42 -0
- package/lib/indexes.d.ts +38 -0
- package/lib/indexes.js +101 -0
- package/lib/jobs.d.ts +2806 -0
- package/lib/jobs.js +435 -0
- package/lib/models.d.ts +24 -0
- package/lib/models.js +120 -0
- package/lib/retrieval.d.ts +209 -0
- package/lib/retrieval.js +173 -0
- package/lib/routes.d.ts +3 -0
- package/lib/routes.js +152 -0
- package/lib/runtime.d.ts +48 -0
- package/lib/runtime.js +41 -0
- package/lib/settings.d.ts +33 -0
- package/lib/settings.js +19 -0
- package/lib/shared.d.ts +95 -0
- package/lib/shared.js +17 -0
- package/lib/skills.d.ts +3 -0
- package/lib/skills.js +21 -0
- package/lib/store.d.ts +409 -0
- package/lib/store.js +328 -0
- package/lib/tools.d.ts +3 -0
- package/lib/tools.js +72 -0
- package/lib/util.d.ts +25 -0
- package/lib/util.js +89 -0
- package/package.json +125 -0
- package/skills/libing-kb-build/SKILL.md +10 -0
- package/skills/libing-kb-search/SKILL.md +10 -0
- package/skills/libing-knowledge-base/SKILL.md +15 -0
- package/skills/libing-knowledge-base/references/build.md +23 -0
- package/skills/libing-knowledge-base/references/search.md +21 -0
package/lib/contract.js
ADDED
|
@@ -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() });
|