@knowledgine/core 0.2.0 → 0.3.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 (107) hide show
  1. package/dist/config/config-loader.d.ts +22 -2
  2. package/dist/config/config-loader.d.ts.map +1 -1
  3. package/dist/config/config-loader.js +50 -15
  4. package/dist/config/config-loader.js.map +1 -1
  5. package/dist/embedding/model-downloader.d.ts.map +1 -1
  6. package/dist/embedding/model-downloader.js +31 -12
  7. package/dist/embedding/model-downloader.js.map +1 -1
  8. package/dist/extraction/causal-link-detector.d.ts +16 -0
  9. package/dist/extraction/causal-link-detector.d.ts.map +1 -0
  10. package/dist/extraction/causal-link-detector.js +142 -0
  11. package/dist/extraction/causal-link-detector.js.map +1 -0
  12. package/dist/extraction/incremental-extractor.d.ts +21 -0
  13. package/dist/extraction/incremental-extractor.d.ts.map +1 -0
  14. package/dist/extraction/incremental-extractor.js +113 -0
  15. package/dist/extraction/incremental-extractor.js.map +1 -0
  16. package/dist/extraction/psp-detector.d.ts +3 -3
  17. package/dist/extraction/psp-detector.d.ts.map +1 -1
  18. package/dist/extraction/psp-detector.js +51 -3
  19. package/dist/extraction/psp-detector.js.map +1 -1
  20. package/dist/feedback/feedback-learner.d.ts.map +1 -1
  21. package/dist/feedback/feedback-learner.js.map +1 -1
  22. package/dist/feedback/feedback-repository.d.ts.map +1 -1
  23. package/dist/feedback/feedback-repository.js +2 -6
  24. package/dist/feedback/feedback-repository.js.map +1 -1
  25. package/dist/graph/entity-extractor.d.ts +3 -0
  26. package/dist/graph/entity-extractor.d.ts.map +1 -1
  27. package/dist/graph/entity-extractor.js +82 -10
  28. package/dist/graph/entity-extractor.js.map +1 -1
  29. package/dist/graph/graph-repository.d.ts +5 -5
  30. package/dist/graph/graph-repository.d.ts.map +1 -1
  31. package/dist/graph/graph-repository.js +12 -12
  32. package/dist/graph/graph-repository.js.map +1 -1
  33. package/dist/index.d.ts +18 -3
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +28 -3
  36. package/dist/index.js.map +1 -1
  37. package/dist/llm/errors.d.ts +8 -0
  38. package/dist/llm/errors.d.ts.map +1 -0
  39. package/dist/llm/errors.js +11 -0
  40. package/dist/llm/errors.js.map +1 -0
  41. package/dist/llm/index.d.ts +7 -0
  42. package/dist/llm/index.d.ts.map +1 -0
  43. package/dist/llm/index.js +5 -0
  44. package/dist/llm/index.js.map +1 -0
  45. package/dist/llm/ollama-provider.d.ts +13 -0
  46. package/dist/llm/ollama-provider.d.ts.map +1 -0
  47. package/dist/llm/ollama-provider.js +130 -0
  48. package/dist/llm/ollama-provider.js.map +1 -0
  49. package/dist/llm/openai-provider.d.ts +15 -0
  50. package/dist/llm/openai-provider.d.ts.map +1 -0
  51. package/dist/llm/openai-provider.js +143 -0
  52. package/dist/llm/openai-provider.js.map +1 -0
  53. package/dist/llm/provider-factory.d.ts +3 -0
  54. package/dist/llm/provider-factory.d.ts.map +1 -0
  55. package/dist/llm/provider-factory.js +25 -0
  56. package/dist/llm/provider-factory.js.map +1 -0
  57. package/dist/llm/types.d.ts +50 -0
  58. package/dist/llm/types.d.ts.map +1 -0
  59. package/dist/llm/types.js +2 -0
  60. package/dist/llm/types.js.map +1 -0
  61. package/dist/provenance/provenance-repository.d.ts +23 -22
  62. package/dist/provenance/provenance-repository.d.ts.map +1 -1
  63. package/dist/provenance/provenance-repository.js +82 -44
  64. package/dist/provenance/provenance-repository.js.map +1 -1
  65. package/dist/search/hybrid-searcher.js +2 -2
  66. package/dist/search/hybrid-searcher.js.map +1 -1
  67. package/dist/search/knowledge-searcher.d.ts +10 -1
  68. package/dist/search/knowledge-searcher.d.ts.map +1 -1
  69. package/dist/search/knowledge-searcher.js +78 -30
  70. package/dist/search/knowledge-searcher.js.map +1 -1
  71. package/dist/search/reasoning-reranker.d.ts +59 -0
  72. package/dist/search/reasoning-reranker.d.ts.map +1 -0
  73. package/dist/search/reasoning-reranker.js +334 -0
  74. package/dist/search/reasoning-reranker.js.map +1 -0
  75. package/dist/search/semantic-searcher.d.ts.map +1 -1
  76. package/dist/search/semantic-searcher.js +3 -2
  77. package/dist/search/semantic-searcher.js.map +1 -1
  78. package/dist/services/knowledge-service.d.ts +4 -0
  79. package/dist/services/knowledge-service.d.ts.map +1 -1
  80. package/dist/services/knowledge-service.js +9 -2
  81. package/dist/services/knowledge-service.js.map +1 -1
  82. package/dist/storage/database.d.ts.map +1 -1
  83. package/dist/storage/database.js +60 -5
  84. package/dist/storage/database.js.map +1 -1
  85. package/dist/storage/knowledge-repository.d.ts +66 -1
  86. package/dist/storage/knowledge-repository.d.ts.map +1 -1
  87. package/dist/storage/knowledge-repository.js +131 -10
  88. package/dist/storage/knowledge-repository.js.map +1 -1
  89. package/dist/storage/migrations/007_spec_alignment.d.ts +3 -0
  90. package/dist/storage/migrations/007_spec_alignment.d.ts.map +1 -0
  91. package/dist/storage/migrations/007_spec_alignment.js +116 -0
  92. package/dist/storage/migrations/007_spec_alignment.js.map +1 -0
  93. package/dist/storage/migrations/008_knowledge_versioning.d.ts +15 -0
  94. package/dist/storage/migrations/008_knowledge_versioning.d.ts.map +1 -0
  95. package/dist/storage/migrations/008_knowledge_versioning.js +69 -0
  96. package/dist/storage/migrations/008_knowledge_versioning.js.map +1 -0
  97. package/dist/storage/migrations/009_extraction_metadata.d.ts +12 -0
  98. package/dist/storage/migrations/009_extraction_metadata.d.ts.map +1 -0
  99. package/dist/storage/migrations/009_extraction_metadata.js +39 -0
  100. package/dist/storage/migrations/009_extraction_metadata.js.map +1 -0
  101. package/dist/storage/migrator.d.ts +3 -1
  102. package/dist/storage/migrator.d.ts.map +1 -1
  103. package/dist/storage/migrator.js +2 -1
  104. package/dist/storage/migrator.js.map +1 -1
  105. package/dist/types.d.ts +2 -0
  106. package/dist/types.d.ts.map +1 -1
  107. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ export { defineConfig } from "./config.js";
6
6
  // Errors
7
7
  export { KnowledgeError, KnowledgeNotFoundError, FTSIndexError, ValidationError, DatabaseError, ClassificationError, LinkGenerationError, MemoryNotFoundError, MemoryPromotionError, MemoryDemotionError, EmbeddingNotAvailableError, VectorExtensionError, EmbeddingError, } from "./errors.js";
8
8
  // Config loader
9
- export { loadConfig, writeRcConfig } from "./config/config-loader.js";
9
+ export { loadConfig, writeRcConfig, resolveDefaultPath } from "./config/config-loader.js";
10
10
  // Storage
11
11
  export { createDatabase, loadSqliteVecExtension } from "./storage/database.js";
12
12
  export { KnowledgeRepository } from "./storage/knowledge-repository.js";
@@ -20,6 +20,9 @@ export { migration005a } from "./storage/migrations/005a_events_layer.js";
20
20
  export { migration006 } from "./storage/migrations/006_extraction_feedback.js";
21
21
  export { migration005b } from "./storage/migrations/005b_bitemporal.js";
22
22
  export { migration005c } from "./storage/migrations/005c_provenance.js";
23
+ export { migration007 } from "./storage/migrations/007_spec_alignment.js";
24
+ export { migration008 } from "./storage/migrations/008_knowledge_versioning.js";
25
+ export { migration009 } from "./storage/migrations/009_extraction_metadata.js";
23
26
  // Feedback
24
27
  export { FeedbackRepository } from "./feedback/feedback-repository.js";
25
28
  export { FeedbackLearner } from "./feedback/feedback-learner.js";
@@ -34,20 +37,41 @@ import { migration005a } from "./storage/migrations/005a_events_layer.js";
34
37
  import { migration005b } from "./storage/migrations/005b_bitemporal.js";
35
38
  import { migration005c } from "./storage/migrations/005c_provenance.js";
36
39
  import { migration006 } from "./storage/migrations/006_extraction_feedback.js";
37
- export const ALL_MIGRATIONS = [migration001, migration002, migration003, migration004, migration005a, migration006, migration005b, migration005c];
40
+ import { migration007 } from "./storage/migrations/007_spec_alignment.js";
41
+ import { migration008 } from "./storage/migrations/008_knowledge_versioning.js";
42
+ import { migration009 } from "./storage/migrations/009_extraction_metadata.js";
43
+ export const ALL_MIGRATIONS = [
44
+ migration001,
45
+ migration002,
46
+ migration003,
47
+ migration004,
48
+ migration005a,
49
+ migration006,
50
+ migration005b,
51
+ migration005c,
52
+ migration007,
53
+ migration008,
54
+ migration009,
55
+ ];
38
56
  // Provenance
39
57
  export { ProvenanceRepository } from "./provenance/provenance-repository.js";
40
58
  // Graph
41
59
  export { GraphRepository } from "./graph/graph-repository.js";
42
60
  export { EntityExtractor } from "./graph/entity-extractor.js";
43
61
  export { RelationInferrer } from "./graph/relation-inferrer.js";
62
+ export { LLMProviderError } from "./llm/errors.js";
63
+ export { OllamaProvider } from "./llm/ollama-provider.js";
64
+ export { OpenAICompatibleProvider } from "./llm/openai-provider.js";
65
+ export { createLLMProvider } from "./llm/provider-factory.js";
44
66
  export { OnnxEmbeddingProvider } from "./embedding/onnx-embedding-provider.js";
45
- export { ModelManager } from "./embedding/model-manager.js";
67
+ export { ModelManager, DEFAULT_MODEL_NAME } from "./embedding/model-manager.js";
46
68
  export { downloadModel, MODEL_FILES } from "./embedding/model-downloader.js";
47
69
  // Search (semantic)
48
70
  export { SemanticSearcher } from "./search/semantic-searcher.js";
49
71
  export { HybridSearcher } from "./search/hybrid-searcher.js";
50
72
  // Extraction
73
+ export { CausalLinkDetector } from "./extraction/causal-link-detector.js";
74
+ export { IncrementalExtractor } from "./extraction/incremental-extractor.js";
51
75
  export { PatternExtractor } from "./extraction/pattern-extractor.js";
52
76
  export { ProblemSolutionDetector } from "./extraction/psp-detector.js";
53
77
  export { RuleBasedClassifier } from "./extraction/rule-based-classifier.js";
@@ -55,6 +79,7 @@ export { ContextAnalyzer, ContextType } from "./extraction/context-analyzer.js";
55
79
  export { DEFAULT_PATTERNS } from "./extraction/default-patterns.js";
56
80
  // Search
57
81
  export { KnowledgeSearcher } from "./search/knowledge-searcher.js";
82
+ export { ReasoningReranker } from "./search/reasoning-reranker.js";
58
83
  export { LocalLinkGenerator } from "./search/link-generator.js";
59
84
  // Processing
60
85
  export { FileProcessor } from "./processing/file-processor.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EA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AAE,MAAM,6BAA6B,CAAC;AAE7D,aAAa;AACb,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAE1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAE7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAE5E,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAEhF,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAOpE,SAAS;AACT,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AASnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGhE,aAAa;AACb,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAG/D,QAAQ;AACR,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAGnE,WAAW;AACX,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { KnowledgeError } from "../errors.js";
2
+ export type LLMErrorCode = "connection_refused" | "timeout" | "auth" | "rate_limit" | "model_not_found" | "parse_error" | "network";
3
+ /** Error thrown when an LLM provider operation fails */
4
+ export declare class LLMProviderError extends KnowledgeError {
5
+ readonly errorCode: LLMErrorCode;
6
+ constructor(message: string, errorCode: LLMErrorCode, context?: Record<string, unknown>);
7
+ }
8
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/llm/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,YAAY,GACpB,oBAAoB,GACpB,SAAS,GACT,MAAM,GACN,YAAY,GACZ,iBAAiB,GACjB,aAAa,GACb,SAAS,CAAC;AAEd,wDAAwD;AACxD,qBAAa,gBAAiB,SAAQ,cAAc;aAGhC,SAAS,EAAE,YAAY;gBADvC,OAAO,EAAE,MAAM,EACC,SAAS,EAAE,YAAY,EACvC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAKpC"}
@@ -0,0 +1,11 @@
1
+ import { KnowledgeError } from "../errors.js";
2
+ /** Error thrown when an LLM provider operation fails */
3
+ export class LLMProviderError extends KnowledgeError {
4
+ errorCode;
5
+ constructor(message, errorCode, context) {
6
+ super(message, { errorCode, ...context });
7
+ this.errorCode = errorCode;
8
+ this.name = "LLMProviderError";
9
+ }
10
+ }
11
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/llm/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAW9C,wDAAwD;AACxD,MAAM,OAAO,gBAAiB,SAAQ,cAAc;IAGhC;IAFlB,YACE,OAAe,EACC,SAAuB,EACvC,OAAiC;QAEjC,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;QAH1B,cAAS,GAAT,SAAS,CAAc;QAIvC,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF"}
@@ -0,0 +1,7 @@
1
+ export type { LLMCompletionMessage, LLMCompletionOptions, LLMCompletionResult, LLMProvider, OllamaProviderConfig, OpenAIProviderConfig, LLMProviderType, LLMConfig, } from "./types.js";
2
+ export { LLMProviderError } from "./errors.js";
3
+ export type { LLMErrorCode } from "./errors.js";
4
+ export { OllamaProvider } from "./ollama-provider.js";
5
+ export { OpenAICompatibleProvider } from "./openai-provider.js";
6
+ export { createLLMProvider } from "./provider-factory.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/llm/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,SAAS,GACV,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { LLMProviderError } from "./errors.js";
2
+ export { OllamaProvider } from "./ollama-provider.js";
3
+ export { OpenAICompatibleProvider } from "./openai-provider.js";
4
+ export { createLLMProvider } from "./provider-factory.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/llm/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { LLMProvider, LLMCompletionOptions, LLMCompletionResult, OllamaProviderConfig } from "./types.js";
2
+ export declare class OllamaProvider implements LLMProvider {
3
+ private baseUrl;
4
+ private model;
5
+ private maxRetries;
6
+ private timeoutMs;
7
+ private retryDelayMs;
8
+ constructor(config: OllamaProviderConfig);
9
+ getModelName(): string;
10
+ isAvailable(): Promise<boolean>;
11
+ complete(options: LLMCompletionOptions): Promise<LLMCompletionResult>;
12
+ }
13
+ //# sourceMappingURL=ollama-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ollama-provider.d.ts","sourceRoot":"","sources":["../../src/llm/ollama-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAQpB,qBAAa,cAAe,YAAW,WAAW;IAChD,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,YAAY,CAAS;gBAEjB,MAAM,EAAE,oBAAoB;IAQxC,YAAY,IAAI,MAAM;IAIhB,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAiB/B,QAAQ,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAgH5E"}
@@ -0,0 +1,130 @@
1
+ import { LLMProviderError } from "./errors.js";
2
+ const DEFAULT_BASE_URL = "http://localhost:11434";
3
+ const DEFAULT_MAX_RETRIES = 3;
4
+ const DEFAULT_TIMEOUT_MS = 30000;
5
+ const DEFAULT_RETRY_DELAY_MS = 500;
6
+ export class OllamaProvider {
7
+ baseUrl;
8
+ model;
9
+ maxRetries;
10
+ timeoutMs;
11
+ retryDelayMs;
12
+ constructor(config) {
13
+ this.baseUrl = config.baseUrl ?? DEFAULT_BASE_URL;
14
+ this.model = config.model;
15
+ this.maxRetries = config.maxRetries ?? DEFAULT_MAX_RETRIES;
16
+ this.timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
17
+ this.retryDelayMs = config.retryDelayMs ?? DEFAULT_RETRY_DELAY_MS;
18
+ }
19
+ getModelName() {
20
+ return this.model;
21
+ }
22
+ async isAvailable() {
23
+ try {
24
+ const controller = new AbortController();
25
+ const timeoutId = setTimeout(() => controller.abort(), this.timeoutMs);
26
+ try {
27
+ const res = await fetch(`${this.baseUrl}/api/tags`, {
28
+ signal: controller.signal,
29
+ });
30
+ return res.status === 200;
31
+ }
32
+ finally {
33
+ clearTimeout(timeoutId);
34
+ }
35
+ }
36
+ catch {
37
+ return false;
38
+ }
39
+ }
40
+ async complete(options) {
41
+ const timeoutMs = options.timeoutMs ?? this.timeoutMs;
42
+ const startTime = Date.now();
43
+ const body = {
44
+ model: this.model,
45
+ messages: options.messages,
46
+ stream: false,
47
+ options: {
48
+ temperature: options.temperature ?? 0.0,
49
+ num_predict: options.maxTokens ?? 1024,
50
+ },
51
+ };
52
+ if (options.responseFormat === "json") {
53
+ body.format = "json";
54
+ }
55
+ let lastError = null;
56
+ for (let attempt = 0; attempt <= this.maxRetries; attempt++) {
57
+ if (attempt > 0) {
58
+ const delay = this.retryDelayMs * Math.pow(2, attempt - 1);
59
+ await sleep(delay);
60
+ }
61
+ const controller = new AbortController();
62
+ const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
63
+ try {
64
+ const res = await fetch(`${this.baseUrl}/api/chat`, {
65
+ method: "POST",
66
+ headers: { "Content-Type": "application/json" },
67
+ body: JSON.stringify(body),
68
+ signal: controller.signal,
69
+ });
70
+ clearTimeout(timeoutId);
71
+ if (res.status === 404) {
72
+ throw new LLMProviderError(`Model not found: ${this.model}`, "model_not_found", {
73
+ status: 404,
74
+ });
75
+ }
76
+ if (res.status === 401) {
77
+ throw new LLMProviderError("Unauthorized", "auth", { status: 401 });
78
+ }
79
+ if (res.status === 429 || res.status >= 500) {
80
+ lastError = new LLMProviderError(`Ollama request failed with status ${res.status}`, res.status === 429 ? "rate_limit" : "network", { status: res.status });
81
+ continue; // retry
82
+ }
83
+ if (!res.ok) {
84
+ throw new LLMProviderError(`Ollama request failed with status ${res.status}`, "network", {
85
+ status: res.status,
86
+ });
87
+ }
88
+ const data = (await res.json());
89
+ const latencyMs = Date.now() - startTime;
90
+ return {
91
+ content: data.message.content,
92
+ model: data.model,
93
+ usage: data.eval_count !== undefined
94
+ ? {
95
+ promptTokens: data.prompt_eval_count ?? 0,
96
+ completionTokens: data.eval_count,
97
+ }
98
+ : undefined,
99
+ latencyMs,
100
+ };
101
+ }
102
+ catch (err) {
103
+ clearTimeout(timeoutId);
104
+ if (err instanceof LLMProviderError) {
105
+ // 404/401は即リトライしない
106
+ if (err.errorCode === "model_not_found" || err.errorCode === "auth") {
107
+ throw err;
108
+ }
109
+ lastError = err;
110
+ continue;
111
+ }
112
+ if (isAbortError(err)) {
113
+ throw new LLMProviderError(`Ollama request timed out after ${timeoutMs}ms`, "timeout", {
114
+ timeoutMs,
115
+ });
116
+ }
117
+ lastError = new LLMProviderError(`Ollama network error: ${err instanceof Error ? err.message : String(err)}`, "network", { cause: err });
118
+ continue;
119
+ }
120
+ }
121
+ throw lastError ?? new LLMProviderError("Ollama request failed after retries", "network");
122
+ }
123
+ }
124
+ function isAbortError(err) {
125
+ return err instanceof DOMException && err.name === "AbortError";
126
+ }
127
+ function sleep(ms) {
128
+ return new Promise((resolve) => setTimeout(resolve, ms));
129
+ }
130
+ //# sourceMappingURL=ollama-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ollama-provider.js","sourceRoot":"","sources":["../../src/llm/ollama-provider.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,gBAAgB,GAAG,wBAAwB,CAAC;AAClD,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAC9B,MAAM,kBAAkB,GAAG,KAAK,CAAC;AACjC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAEnC,MAAM,OAAO,cAAc;IACjB,OAAO,CAAS;IAChB,KAAK,CAAS;IACd,UAAU,CAAS;IACnB,SAAS,CAAS;IAClB,YAAY,CAAS;IAE7B,YAAY,MAA4B;QACtC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,O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AC,SAAS,CAAC,CAAC;gBAExB,IAAI,GAAG,YAAY,gBAAgB,EAAE,CAAC;oBACpC,mBAAmB;oBACnB,IAAI,GAAG,CAAC,SAAS,KAAK,iBAAiB,IAAI,GAAG,CAAC,SAAS,KAAK,MAAM,EAAE,CAAC;wBACpE,MAAM,GAAG,CAAC;oBACZ,CAAC;oBACD,SAAS,GAAG,GAAG,CAAC;oBAChB,SAAS;gBACX,CAAC;gBAED,IAAI,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC;oBACtB,MAAM,IAAI,gBAAgB,CAAC,kCAAkC,SAAS,IAAI,EAAE,SAAS,EAAE;wBACrF,SAAS;qBACV,CAAC,CAAC;gBACL,CAAC;gBAED,SAAS,GAAG,IAAI,gBAAgB,CAC9B,yBAAyB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAC3E,SAAS,EACT,EAAE,KAAK,EAAE,GAAG,EAAE,CACf,CAAC;gBACF,SAAS;YACX,CAAC;QACH,CAAC;QAED,MAAM,SAAS,IAAI,IAAI,gBAAgB,CAAC,qCAAqC,EAAE,SAAS,CAAC,CAAC;IAC5F,CAAC;CACF;AAED,SAAS,YAAY,CAAC,GAAY;IAChC,OAAO,GAAG,YAAY,YAAY,IAAI,GAAG,CAAC,IAAI,KAAK,YAAY,CAAC;AAClE,CAAC;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { LLMProvider, LLMCompletionOptions, LLMCompletionResult, OpenAIProviderConfig } from "./types.js";
2
+ export declare class OpenAICompatibleProvider implements LLMProvider {
3
+ private baseUrl;
4
+ private model;
5
+ private apiKey;
6
+ private maxRetries;
7
+ private timeoutMs;
8
+ private retryDelayMs;
9
+ constructor(config: OpenAIProviderConfig);
10
+ getModelName(): string;
11
+ isAvailable(): Promise<boolean>;
12
+ complete(options: LLMCompletionOptions): Promise<LLMCompletionResult>;
13
+ private buildHeaders;
14
+ }
15
+ //# sourceMappingURL=openai-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openai-provider.d.ts","sourceRoot":"","sources":["../../src/llm/openai-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAOpB,qBAAa,wBAAyB,YAAW,WAAW;IAC1D,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,YAAY,CAAS;gBAEjB,MAAM,EAAE,oBAAoB;IASxC,YAAY,IAAI,MAAM;IAIhB,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAwB/B,QAAQ,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IA2G3E,OAAO,CAAC,YAAY;CASrB"}
@@ -0,0 +1,143 @@
1
+ import { LLMProviderError } from "./errors.js";
2
+ const DEFAULT_MAX_RETRIES = 3;
3
+ const DEFAULT_TIMEOUT_MS = 30000;
4
+ const DEFAULT_RETRY_DELAY_MS = 500;
5
+ export class OpenAICompatibleProvider {
6
+ baseUrl;
7
+ model;
8
+ apiKey;
9
+ maxRetries;
10
+ timeoutMs;
11
+ retryDelayMs;
12
+ constructor(config) {
13
+ this.baseUrl = config.baseUrl;
14
+ this.model = config.model;
15
+ this.apiKey = config.apiKey ?? process.env["KNOWLEDGINE_LLM_API_KEY"];
16
+ this.maxRetries = config.maxRetries ?? DEFAULT_MAX_RETRIES;
17
+ this.timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
18
+ this.retryDelayMs = config.retryDelayMs ?? DEFAULT_RETRY_DELAY_MS;
19
+ }
20
+ getModelName() {
21
+ return this.model;
22
+ }
23
+ async isAvailable() {
24
+ try {
25
+ const controller = new AbortController();
26
+ const timeoutId = setTimeout(() => controller.abort(), this.timeoutMs);
27
+ try {
28
+ const res = await fetch(`${this.baseUrl}/v1/chat/completions`, {
29
+ method: "POST",
30
+ headers: this.buildHeaders(),
31
+ body: JSON.stringify({
32
+ model: this.model,
33
+ messages: [{ role: "user", content: "ping" }],
34
+ max_tokens: 1,
35
+ }),
36
+ signal: controller.signal,
37
+ });
38
+ return res.status === 200;
39
+ }
40
+ finally {
41
+ clearTimeout(timeoutId);
42
+ }
43
+ }
44
+ catch {
45
+ return false;
46
+ }
47
+ }
48
+ async complete(options) {
49
+ const timeoutMs = options.timeoutMs ?? this.timeoutMs;
50
+ const startTime = Date.now();
51
+ const body = {
52
+ model: this.model,
53
+ messages: options.messages,
54
+ temperature: options.temperature ?? 0.0,
55
+ max_tokens: options.maxTokens ?? 1024,
56
+ };
57
+ if (options.responseFormat === "json") {
58
+ body.response_format = { type: "json_object" };
59
+ }
60
+ let lastError = null;
61
+ for (let attempt = 0; attempt <= this.maxRetries; attempt++) {
62
+ if (attempt > 0) {
63
+ const delay = this.retryDelayMs * Math.pow(2, attempt - 1);
64
+ await sleep(delay);
65
+ }
66
+ const controller = new AbortController();
67
+ const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
68
+ try {
69
+ const res = await fetch(`${this.baseUrl}/v1/chat/completions`, {
70
+ method: "POST",
71
+ headers: this.buildHeaders(),
72
+ body: JSON.stringify(body),
73
+ signal: controller.signal,
74
+ });
75
+ clearTimeout(timeoutId);
76
+ if (res.status === 404) {
77
+ throw new LLMProviderError(`Model not found: ${this.model}`, "model_not_found", {
78
+ status: 404,
79
+ });
80
+ }
81
+ if (res.status === 401) {
82
+ throw new LLMProviderError("Unauthorized: invalid API key", "auth", { status: 401 });
83
+ }
84
+ if (res.status === 429 || res.status >= 500) {
85
+ lastError = new LLMProviderError(`OpenAI request failed with status ${res.status}`, res.status === 429 ? "rate_limit" : "network", { status: res.status });
86
+ continue; // retry
87
+ }
88
+ if (!res.ok) {
89
+ throw new LLMProviderError(`OpenAI request failed with status ${res.status}`, "network", {
90
+ status: res.status,
91
+ });
92
+ }
93
+ const data = (await res.json());
94
+ const latencyMs = Date.now() - startTime;
95
+ return {
96
+ content: data.choices[0].message.content,
97
+ model: data.model,
98
+ usage: data.usage
99
+ ? {
100
+ promptTokens: data.usage.prompt_tokens,
101
+ completionTokens: data.usage.completion_tokens,
102
+ }
103
+ : undefined,
104
+ latencyMs,
105
+ };
106
+ }
107
+ catch (err) {
108
+ clearTimeout(timeoutId);
109
+ if (err instanceof LLMProviderError) {
110
+ if (err.errorCode === "model_not_found" || err.errorCode === "auth") {
111
+ throw err;
112
+ }
113
+ lastError = err;
114
+ continue;
115
+ }
116
+ if (isAbortError(err)) {
117
+ throw new LLMProviderError(`OpenAI request timed out after ${timeoutMs}ms`, "timeout", {
118
+ timeoutMs,
119
+ });
120
+ }
121
+ lastError = new LLMProviderError(`OpenAI network error: ${err instanceof Error ? err.message : String(err)}`, "network", { cause: err });
122
+ continue;
123
+ }
124
+ }
125
+ throw lastError ?? new LLMProviderError("OpenAI request failed after retries", "network");
126
+ }
127
+ buildHeaders() {
128
+ const headers = {
129
+ "Content-Type": "application/json",
130
+ };
131
+ if (this.apiKey) {
132
+ headers["Authorization"] = `Bearer ${this.apiKey}`;
133
+ }
134
+ return headers;
135
+ }
136
+ }
137
+ function isAbortError(err) {
138
+ return err instanceof DOMException && err.name === "AbortError";
139
+ }
140
+ function sleep(ms) {
141
+ return new Promise((resolve) => setTimeout(resolve, ms));
142
+ }
143
+ //# sourceMappingURL=openai-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openai-provider.js","sourceRoot":"","sources":["../../src/llm/openai-provider.ts"],"names":[],"mappings":"AAMA,O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GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAC3E,SAAS,EACT,EAAE,KAAK,EAAE,GAAG,EAAE,CACf,CAAC;gBACF,SAAS;YACX,CAAC;QACH,CAAC;QAED,MAAM,SAAS,IAAI,IAAI,gBAAgB,CAAC,qCAAqC,EAAE,SAAS,CAAC,CAAC;IAC5F,CAAC;IAEO,YAAY;QAClB,MAAM,OAAO,GAA2B;YACtC,cAAc,EAAE,kBAAkB;SACnC,CAAC;QACF,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,IAAI,CAAC,MAAM,EAAE,CAAC;QACrD,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAED,SAAS,YAAY,CAAC,GAAY;IAChC,OAAO,GAAG,YAAY,YAAY,IAAI,GAAG,CAAC,IAAI,KAAK,YAAY,CAAC;AAClE,CAAC;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { LLMConfig, LLMProvider } from "./types.js";
2
+ export declare function createLLMProvider(config: LLMConfig | undefined): LLMProvider | undefined;
3
+ //# sourceMappingURL=provider-factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-factory.d.ts","sourceRoot":"","sources":["../../src/llm/provider-factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAIzD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAqBxF"}
@@ -0,0 +1,25 @@
1
+ import { OllamaProvider } from "./ollama-provider.js";
2
+ import { OpenAICompatibleProvider } from "./openai-provider.js";
3
+ export function createLLMProvider(config) {
4
+ if (!config)
5
+ return undefined;
6
+ switch (config.provider) {
7
+ case "ollama": {
8
+ const ollamaConfig = config.ollama ?? {
9
+ model: config.model ?? "llama3",
10
+ baseUrl: config.baseUrl,
11
+ };
12
+ return new OllamaProvider(ollamaConfig);
13
+ }
14
+ case "openai": {
15
+ const openaiConfig = config.openai ?? {
16
+ model: config.model ?? "gpt-4o",
17
+ baseUrl: config.baseUrl ?? "https://api.openai.com",
18
+ };
19
+ return new OpenAICompatibleProvider(openaiConfig);
20
+ }
21
+ default:
22
+ return undefined;
23
+ }
24
+ }
25
+ //# sourceMappingURL=provider-factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-factory.js","sourceRoot":"","sources":["../../src/llm/provider-factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,MAAM,UAAU,iBAAiB,CAAC,MAA6B;IAC7D,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAE9B,QAAQ,MAAM,CAAC,QAAQ,EAAE,CAAC;QACxB,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,IAAI;gBACpC,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,QAAQ;gBAC/B,OAAO,EAAE,MAAM,CAAC,OAAO;aACxB,CAAC;YACF,OAAO,IAAI,cAAc,CAAC,YAAY,CAAC,CAAC;QAC1C,CAAC;QACD,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,IAAI;gBACpC,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,QAAQ;gBAC/B,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,wBAAwB;aACpD,CAAC;YACF,OAAO,IAAI,wBAAwB,CAAC,YAAY,CAAC,CAAC;QACpD,CAAC;QACD;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC"}
@@ -0,0 +1,50 @@
1
+ export interface LLMCompletionMessage {
2
+ role: "system" | "user" | "assistant";
3
+ content: string;
4
+ }
5
+ export interface LLMCompletionOptions {
6
+ messages: LLMCompletionMessage[];
7
+ temperature?: number;
8
+ maxTokens?: number;
9
+ responseFormat?: "text" | "json";
10
+ timeoutMs?: number;
11
+ }
12
+ export interface LLMCompletionResult {
13
+ content: string;
14
+ usage?: {
15
+ promptTokens: number;
16
+ completionTokens: number;
17
+ };
18
+ model: string;
19
+ latencyMs: number;
20
+ }
21
+ export interface LLMProvider {
22
+ complete(options: LLMCompletionOptions): Promise<LLMCompletionResult>;
23
+ isAvailable(): Promise<boolean>;
24
+ getModelName(): string;
25
+ }
26
+ export interface OllamaProviderConfig {
27
+ baseUrl?: string;
28
+ model: string;
29
+ maxRetries?: number;
30
+ timeoutMs?: number;
31
+ retryDelayMs?: number;
32
+ }
33
+ export interface OpenAIProviderConfig {
34
+ baseUrl: string;
35
+ model: string;
36
+ apiKey?: string;
37
+ maxRetries?: number;
38
+ timeoutMs?: number;
39
+ retryDelayMs?: number;
40
+ rateLimitRPM?: number;
41
+ }
42
+ export type LLMProviderType = "ollama" | "openai";
43
+ export interface LLMConfig {
44
+ provider: LLMProviderType;
45
+ model?: string;
46
+ baseUrl?: string;
47
+ ollama?: OllamaProviderConfig;
48
+ openai?: OpenAIProviderConfig;
49
+ }
50
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/llm/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,oBAAoB,EAAE,CAAC;IACjC,WAAW,CAA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AE,oBAAoB,CAAC;IAC9B,MAAM,CAAC,EAAE,oBAAoB,CAAC;CAC/B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/llm/types.ts"],"names":[],"mappings":""}