@semiont/make-meaning 0.2.34-build.91 → 0.2.34-build.93

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/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { JobWorker, JobQueue, AnyJob, DetectionResult, RunningJob, DetectionParams, DetectionProgress, GenerationResult, GenerationParams, GenerationProgress, HighlightDetectionResult, HighlightDetectionParams, HighlightDetectionProgress, AssessmentDetectionResult, AssessmentDetectionParams, AssessmentDetectionProgress, CommentDetectionResult, CommentDetectionParams, CommentDetectionProgress, TagDetectionResult, TagDetectionParams, TagDetectionProgress } from '@semiont/jobs';
2
2
  import { EventStore } from '@semiont/event-sourcing';
3
3
  import { RepresentationStore } from '@semiont/content';
4
- import { EnvironmentConfig, EventBus, components, StoredEvent, ResourceId, CreationMethod, UserId, AnnotationUri, ResourceAnnotations, AnnotationId, AnnotationCategory, GraphPath, GraphConnection, GenerationContext } from '@semiont/core';
4
+ import { EnvironmentConfig, EventBus, Logger, components, StoredEvent, ResourceId, CreationMethod, UserId, AnnotationUri, ResourceAnnotations, AnnotationId, AnnotationCategory, GraphPath, GraphConnection, GenerationContext } from '@semiont/core';
5
5
  import { InferenceClient } from '@semiont/inference';
6
6
  import { GraphDatabase } from '@semiont/graph';
7
7
 
@@ -27,12 +27,12 @@ interface DetectedAnnotation {
27
27
  entityTypes: string[];
28
28
  };
29
29
  }
30
- declare class ReferenceDetectionWorker extends JobWorker {
30
+ declare class ReferenceAnnotationWorker extends JobWorker {
31
31
  private config;
32
32
  private eventStore;
33
33
  private inferenceClient;
34
34
  private eventBus;
35
- constructor(jobQueue: JobQueue, config: EnvironmentConfig, eventStore: EventStore, inferenceClient: InferenceClient, eventBus: EventBus);
35
+ constructor(jobQueue: JobQueue, config: EnvironmentConfig, eventStore: EventStore, inferenceClient: InferenceClient, eventBus: EventBus, logger: Logger);
36
36
  protected getWorkerName(): string;
37
37
  protected canProcessJob(job: AnyJob): boolean;
38
38
  protected executeJob(job: AnyJob): Promise<DetectionResult>;
@@ -71,7 +71,7 @@ declare class GenerationWorker extends JobWorker {
71
71
  private eventStore;
72
72
  private inferenceClient;
73
73
  private eventBus;
74
- constructor(jobQueue: JobQueue, config: EnvironmentConfig, eventStore: EventStore, inferenceClient: InferenceClient, eventBus: EventBus);
74
+ constructor(jobQueue: JobQueue, config: EnvironmentConfig, eventStore: EventStore, inferenceClient: InferenceClient, eventBus: EventBus, logger: Logger);
75
75
  protected getWorkerName(): string;
76
76
  protected canProcessJob(job: AnyJob): boolean;
77
77
  protected executeJob(job: AnyJob): Promise<GenerationResult>;
@@ -81,6 +81,7 @@ declare class GenerationWorker extends JobWorker {
81
81
  * Override base class to emit job.completed event with resultResourceId
82
82
  */
83
83
  protected emitCompletionEvent(job: RunningJob<GenerationParams, GenerationProgress>, result: GenerationResult): Promise<void>;
84
+ protected handleJobFailure(job: AnyJob, error: any): Promise<void>;
84
85
  /**
85
86
  * Update job progress and emit events to Event Store
86
87
  * Overrides base class to also emit job progress events
@@ -95,13 +96,13 @@ declare class GenerationWorker extends JobWorker {
95
96
  * that should be highlighted and creates highlight annotations.
96
97
  */
97
98
 
98
- declare class HighlightDetectionWorker extends JobWorker {
99
+ declare class HighlightAnnotationWorker extends JobWorker {
99
100
  private config;
100
101
  private eventStore;
101
102
  private inferenceClient;
102
103
  private eventBus;
103
104
  private isFirstProgress;
104
- constructor(jobQueue: JobQueue, config: EnvironmentConfig, eventStore: EventStore, inferenceClient: InferenceClient, eventBus: EventBus);
105
+ constructor(jobQueue: JobQueue, config: EnvironmentConfig, eventStore: EventStore, inferenceClient: InferenceClient, eventBus: EventBus, logger: Logger);
105
106
  protected getWorkerName(): string;
106
107
  protected canProcessJob(job: AnyJob): boolean;
107
108
  protected executeJob(job: AnyJob): Promise<HighlightDetectionResult>;
@@ -126,13 +127,13 @@ declare class HighlightDetectionWorker extends JobWorker {
126
127
  * passages in the text and creates assessment annotations.
127
128
  */
128
129
 
129
- declare class AssessmentDetectionWorker extends JobWorker {
130
+ declare class AssessmentAnnotationWorker extends JobWorker {
130
131
  private config;
131
132
  private eventStore;
132
133
  private inferenceClient;
133
134
  private eventBus;
134
135
  private isFirstProgress;
135
- constructor(jobQueue: JobQueue, config: EnvironmentConfig, eventStore: EventStore, inferenceClient: InferenceClient, eventBus: EventBus);
136
+ constructor(jobQueue: JobQueue, config: EnvironmentConfig, eventStore: EventStore, inferenceClient: InferenceClient, eventBus: EventBus, logger: Logger);
136
137
  protected getWorkerName(): string;
137
138
  protected canProcessJob(job: AnyJob): boolean;
138
139
  protected executeJob(job: AnyJob): Promise<AssessmentDetectionResult>;
@@ -157,13 +158,13 @@ declare class AssessmentDetectionWorker extends JobWorker {
157
158
  * that would benefit from explanatory comments and creates comment annotations.
158
159
  */
159
160
 
160
- declare class CommentDetectionWorker extends JobWorker {
161
+ declare class CommentAnnotationWorker extends JobWorker {
161
162
  private config;
162
163
  private eventStore;
163
164
  private inferenceClient;
164
165
  private eventBus;
165
166
  private isFirstProgress;
166
- constructor(jobQueue: JobQueue, config: EnvironmentConfig, eventStore: EventStore, inferenceClient: InferenceClient, eventBus: EventBus);
167
+ constructor(jobQueue: JobQueue, config: EnvironmentConfig, eventStore: EventStore, inferenceClient: InferenceClient, eventBus: EventBus, logger: Logger);
167
168
  protected getWorkerName(): string;
168
169
  protected canProcessJob(job: AnyJob): boolean;
169
170
  protected executeJob(job: AnyJob): Promise<CommentDetectionResult>;
@@ -189,13 +190,13 @@ declare class CommentDetectionWorker extends JobWorker {
189
190
  * creates tag annotations with dual-body structure.
190
191
  */
191
192
 
192
- declare class TagDetectionWorker extends JobWorker {
193
+ declare class TagAnnotationWorker extends JobWorker {
193
194
  private config;
194
195
  private eventStore;
195
196
  private inferenceClient;
196
197
  private eventBus;
197
198
  private isFirstProgress;
198
- constructor(jobQueue: JobQueue, config: EnvironmentConfig, eventStore: EventStore, inferenceClient: InferenceClient, eventBus: EventBus);
199
+ constructor(jobQueue: JobQueue, config: EnvironmentConfig, eventStore: EventStore, inferenceClient: InferenceClient, eventBus: EventBus, logger: Logger);
199
200
  protected getWorkerName(): string;
200
201
  protected canProcessJob(job: AnyJob): boolean;
201
202
  protected executeJob(job: AnyJob): Promise<TagDetectionResult>;
@@ -227,7 +228,8 @@ declare class GraphDBConsumer {
227
228
  private _globalSubscription;
228
229
  private processing;
229
230
  private lastProcessed;
230
- constructor(config: EnvironmentConfig, eventStore: EventStore, graphDb: GraphDatabase);
231
+ private readonly logger;
232
+ constructor(config: EnvironmentConfig, eventStore: EventStore, graphDb: GraphDatabase, logger: Logger);
231
233
  initialize(): Promise<void>;
232
234
  /**
233
235
  * Subscribe globally to ALL events (system AND resource events)
@@ -291,17 +293,17 @@ interface MakeMeaningService {
291
293
  inferenceClient: InferenceClient;
292
294
  graphDb: GraphDatabase;
293
295
  workers: {
294
- detection: ReferenceDetectionWorker;
296
+ detection: ReferenceAnnotationWorker;
295
297
  generation: GenerationWorker;
296
- highlight: HighlightDetectionWorker;
297
- assessment: AssessmentDetectionWorker;
298
- comment: CommentDetectionWorker;
299
- tag: TagDetectionWorker;
298
+ highlight: HighlightAnnotationWorker;
299
+ assessment: AssessmentAnnotationWorker;
300
+ comment: CommentAnnotationWorker;
301
+ tag: TagAnnotationWorker;
300
302
  };
301
303
  graphConsumer: GraphDBConsumer;
302
304
  stop: () => Promise<void>;
303
305
  }
304
- declare function startMakeMeaning(config: EnvironmentConfig, eventBus: EventBus): Promise<MakeMeaningService>;
306
+ declare function startMakeMeaning(config: EnvironmentConfig, eventBus: EventBus, logger: Logger): Promise<MakeMeaningService>;
305
307
 
306
308
  /**
307
309
  * Entity Types Bootstrap Service
@@ -315,7 +317,7 @@ declare function startMakeMeaning(config: EnvironmentConfig, eventBus: EventBus)
315
317
  * Bootstrap entity types projection if it doesn't exist.
316
318
  * Uses a system user ID (00000000-0000-0000-0000-000000000000) for bootstrap events.
317
319
  */
318
- declare function bootstrapEntityTypes(eventStore: EventStore, config: EnvironmentConfig): Promise<void>;
320
+ declare function bootstrapEntityTypes(eventStore: EventStore, config: EnvironmentConfig, logger?: Logger): Promise<void>;
319
321
  /**
320
322
  * Reset the bootstrap flag (used for testing)
321
323
  */
@@ -394,6 +396,7 @@ declare class ResourceOperations {
394
396
  * - Create annotations (ID generation, validation, event emission)
395
397
  * - Update annotation body (operations: add/remove/replace)
396
398
  * - Delete annotations (validation, event emission)
399
+ *
397
400
  */
398
401
 
399
402
  type Annotation$2 = components['schemas']['Annotation'];
@@ -417,7 +420,7 @@ declare class AnnotationOperations {
417
420
  /**
418
421
  * Delete an annotation
419
422
  */
420
- static deleteAnnotation(id: string, resourceIdUri: string, userId: UserId, eventStore: EventStore, config: EnvironmentConfig): Promise<void>;
423
+ static deleteAnnotation(id: string, resourceIdUri: string, userId: UserId, eventStore: EventStore, config: EnvironmentConfig, logger?: Logger): Promise<void>;
421
424
  /**
422
425
  * Apply body operations (add/remove/replace) to annotation body
423
426
  */
@@ -468,6 +471,9 @@ declare class ResourceContext {
468
471
  * - Building LLM context for annotations
469
472
  * - Extracting annotation text context
470
473
  * - Generating AI summaries
474
+ *
475
+ * NOTE: This class contains static utility methods without logger access.
476
+ * Console statements kept for debugging - consider adding logger parameter in future.
471
477
  */
472
478
 
473
479
  type AnnotationLLMContextResponse = components['schemas']['AnnotationLLMContextResponse'];
@@ -490,7 +496,7 @@ declare class AnnotationContext {
490
496
  * @returns Rich context for LLM processing
491
497
  * @throws Error if annotation or resource not found
492
498
  */
493
- static buildLLMContext(annotationUri: AnnotationUri, resourceId: ResourceId, config: EnvironmentConfig, options?: BuildContextOptions): Promise<AnnotationLLMContextResponse>;
499
+ static buildLLMContext(annotationUri: AnnotationUri, resourceId: ResourceId, config: EnvironmentConfig, options?: BuildContextOptions, logger?: Logger): Promise<AnnotationLLMContextResponse>;
494
500
  /**
495
501
  * Get resource annotations from view storage (fast path)
496
502
  * Throws if view missing
@@ -541,7 +547,7 @@ declare class AnnotationContext {
541
547
  /**
542
548
  * Generate AI summary of annotation in context
543
549
  */
544
- static generateAnnotationSummary(annotationId: AnnotationId, resourceId: ResourceId, config: EnvironmentConfig): Promise<ContextualSummaryResponse>;
550
+ static generateAnnotationSummary(annotationId: AnnotationId, resourceId: ResourceId, config: EnvironmentConfig, logger?: Logger): Promise<ContextualSummaryResponse>;
545
551
  /**
546
552
  * Get resource content as string
547
553
  */
@@ -640,6 +646,9 @@ declare class LLMContext {
640
646
  * Provides static methods to parse and validate AI responses for each motivation type.
641
647
  * Includes offset validation and correction logic.
642
648
  * Extracted from worker implementations to centralize parsing logic.
649
+ *
650
+ * NOTE: These are static utility methods without logger access.
651
+ * Console statements kept for debugging - consider adding logger parameter in future.
643
652
  */
644
653
  /**
645
654
  * Represents a detected comment with validated position
@@ -870,12 +879,13 @@ interface ExtractedEntity {
870
879
  * @param entityTypes - Array of entity types to detect (optionally with examples)
871
880
  * @param client - Inference client for AI operations
872
881
  * @param includeDescriptiveReferences - Include anaphoric/cataphoric references (default: false)
882
+ * @param logger - Optional logger for debugging entity extraction
873
883
  * @returns Array of extracted entities with their character offsets
874
884
  */
875
885
  declare function extractEntities(exact: string, entityTypes: string[] | {
876
886
  type: string;
877
887
  examples?: string[];
878
- }[], client: InferenceClient, includeDescriptiveReferences?: boolean): Promise<ExtractedEntity[]>;
888
+ }[], client: InferenceClient, includeDescriptiveReferences?: boolean, logger?: Logger): Promise<ExtractedEntity[]>;
879
889
 
880
890
  /**
881
891
  * Resource Generation Functions
@@ -885,12 +895,13 @@ declare function extractEntities(exact: string, entityTypes: string[] | {
885
895
  * - Resource summary generation
886
896
  * - Reference suggestion generation
887
897
  * - Language handling and template processing
898
+ *
888
899
  */
889
900
 
890
901
  /**
891
902
  * Generate resource content using inference
892
903
  */
893
- declare function generateResourceFromTopic(topic: string, entityTypes: string[], client: InferenceClient, userPrompt?: string, locale?: string, context?: GenerationContext, temperature?: number, maxTokens?: number): Promise<{
904
+ declare function generateResourceFromTopic(topic: string, entityTypes: string[], client: InferenceClient, userPrompt?: string, locale?: string, context?: GenerationContext, temperature?: number, maxTokens?: number, logger?: Logger): Promise<{
894
905
  title: string;
895
906
  content: string;
896
907
  }>;
@@ -914,4 +925,4 @@ declare function generateUuid(): string;
914
925
  declare const PACKAGE_NAME = "@semiont/make-meaning";
915
926
  declare const VERSION = "0.1.0";
916
927
 
917
- export { AnnotationContext, AnnotationDetection, AnnotationOperations, AssessmentDetectionWorker, type AssessmentMatch, type BuildContextOptions, CommentDetectionWorker, type CommentMatch, type CreateAnnotationResult, type CreateResourceInput, type ExtractedEntity, GenerationWorker, GraphContext, GraphDBConsumer, type GraphEdge, type GraphNode, type GraphRepresentation, HighlightDetectionWorker, type HighlightMatch, LLMContext, type LLMContextOptions, type ListResourcesFilters, type MakeMeaningService, MotivationParsers, MotivationPrompts, PACKAGE_NAME, ReferenceDetectionWorker, ResourceContext, ResourceOperations, TagDetectionWorker, type TagMatch, type UpdateAnnotationBodyResult, type UpdateResourceInput, VERSION, bootstrapEntityTypes, extractEntities, generateReferenceSuggestions, generateResourceFromTopic, generateResourceSummary, generateUuid, readEntityTypesProjection, resetBootstrap, startMakeMeaning };
928
+ export { AnnotationContext, AnnotationDetection, AnnotationOperations, AssessmentAnnotationWorker, type AssessmentMatch, type BuildContextOptions, CommentAnnotationWorker, type CommentMatch, type CreateAnnotationResult, type CreateResourceInput, type ExtractedEntity, GenerationWorker, GraphContext, GraphDBConsumer, type GraphEdge, type GraphNode, type GraphRepresentation, HighlightAnnotationWorker, type HighlightMatch, LLMContext, type LLMContextOptions, type ListResourcesFilters, type MakeMeaningService, MotivationParsers, MotivationPrompts, PACKAGE_NAME, ReferenceAnnotationWorker, ResourceContext, ResourceOperations, TagAnnotationWorker, type TagMatch, type UpdateAnnotationBodyResult, type UpdateResourceInput, VERSION, bootstrapEntityTypes, extractEntities, generateReferenceSuggestions, generateResourceFromTopic, generateResourceSummary, generateUuid, readEntityTypesProjection, resetBootstrap, startMakeMeaning };