@hasna/knowledge 0.2.21 → 0.2.23

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/src/service.ts CHANGED
@@ -26,6 +26,7 @@ import { retrieveKnowledgeContext, type RetrievalOptions } from './retrieval';
26
26
  import { hybridSearch, type HybridSearchOptions } from './search';
27
27
  import { resolveSafetyPolicy } from './safety';
28
28
  import { runProviderWebSearch, type WebSearchOptions } from './web-search';
29
+ import { compileWikiPage, fileAnswerToWiki, lintWiki, type WikiCompileOptions } from './wiki-compiler';
29
30
  import {
30
31
  recordStorageObjects,
31
32
  resolveStorageContract,
@@ -245,6 +246,49 @@ export class KnowledgeService {
245
246
  return result;
246
247
  }
247
248
 
249
+ async compileWiki(options: Omit<WikiCompileOptions, 'dbPath' | 'store'> = {}) {
250
+ const workspace = this.ensureWorkspace();
251
+ return compileWikiPage({
252
+ ...options,
253
+ dbPath: workspace.knowledgeDbPath,
254
+ store: this.artifactStore(),
255
+ });
256
+ }
257
+
258
+ async fileAnswer(options: {
259
+ prompt: string;
260
+ answer: string;
261
+ approveWrite?: boolean;
262
+ limit?: number;
263
+ semantic?: boolean;
264
+ modelRef?: string;
265
+ dimensions?: number;
266
+ fake?: boolean;
267
+ }) {
268
+ const workspace = this.ensureWorkspace();
269
+ const context = await this.retrieveContext({
270
+ query: options.prompt,
271
+ limit: options.limit,
272
+ semantic: options.semantic,
273
+ modelRef: options.modelRef,
274
+ dimensions: options.dimensions,
275
+ fake: options.fake,
276
+ });
277
+ return fileAnswerToWiki({
278
+ dbPath: workspace.knowledgeDbPath,
279
+ store: this.artifactStore(),
280
+ prompt: options.prompt,
281
+ answer: options.answer,
282
+ context,
283
+ approveWrite: options.approveWrite,
284
+ });
285
+ }
286
+
287
+ lintWiki() {
288
+ const workspace = this.ensureWorkspace();
289
+ return lintWiki({ dbPath: workspace.knowledgeDbPath });
290
+ }
291
+
248
292
  async ingestManifest(input: string) {
249
293
  const workspace = this.ensureWorkspace();
250
294
  return ingestOpenFilesManifest({