@semiont/make-meaning 0.2.30-build.59 → 0.2.30-build.61

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
@@ -2,6 +2,8 @@ import { components, AnnotationUri } from '@semiont/api-client';
2
2
  import { ResourceId, EnvironmentConfig, ResourceAnnotations, AnnotationId, AnnotationCategory, GraphPath, GraphConnection } from '@semiont/core';
3
3
  import { CommentMatch, HighlightMatch, AssessmentMatch, TagMatch } from '@semiont/inference';
4
4
  export { AssessmentMatch, CommentMatch, HighlightMatch, TagMatch } from '@semiont/inference';
5
+ import { JobWorker, JobQueue, Job } from '@semiont/jobs';
6
+ import { EventStore } from '@semiont/event-sourcing';
5
7
 
6
8
  /**
7
9
  * Resource Context
@@ -10,7 +12,7 @@ export { AssessmentMatch, CommentMatch, HighlightMatch, TagMatch } from '@semion
10
12
  * Does NOT touch the graph - graph queries go through GraphContext
11
13
  */
12
14
 
13
- type ResourceDescriptor$1 = components['schemas']['ResourceDescriptor'];
15
+ type ResourceDescriptor$2 = components['schemas']['ResourceDescriptor'];
14
16
  interface ListResourcesFilters {
15
17
  search?: string;
16
18
  archived?: boolean;
@@ -19,16 +21,16 @@ declare class ResourceContext {
19
21
  /**
20
22
  * Get resource metadata from view storage
21
23
  */
22
- static getResourceMetadata(resourceId: ResourceId, config: EnvironmentConfig): Promise<ResourceDescriptor$1 | null>;
24
+ static getResourceMetadata(resourceId: ResourceId, config: EnvironmentConfig): Promise<ResourceDescriptor$2 | null>;
23
25
  /**
24
26
  * List all resources by scanning view storage
25
27
  */
26
- static listResources(filters: ListResourcesFilters | undefined, config: EnvironmentConfig): Promise<ResourceDescriptor$1[]>;
28
+ static listResources(filters: ListResourcesFilters | undefined, config: EnvironmentConfig): Promise<ResourceDescriptor$2[]>;
27
29
  /**
28
30
  * Add content previews to resources (for search results)
29
31
  * Retrieves and decodes the first 200 characters of each resource's primary representation
30
32
  */
31
- static addContentPreviews(resources: ResourceDescriptor$1[], config: EnvironmentConfig): Promise<Array<ResourceDescriptor$1 & {
33
+ static addContentPreviews(resources: ResourceDescriptor$2[], config: EnvironmentConfig): Promise<Array<ResourceDescriptor$2 & {
32
34
  content: string;
33
35
  }>>;
34
36
  }
@@ -138,7 +140,7 @@ declare class AnnotationContext {
138
140
  */
139
141
 
140
142
  type Annotation = components['schemas']['Annotation'];
141
- type ResourceDescriptor = components['schemas']['ResourceDescriptor'];
143
+ type ResourceDescriptor$1 = components['schemas']['ResourceDescriptor'];
142
144
  declare class GraphContext {
143
145
  /**
144
146
  * Get all resources referencing this resource (backlinks)
@@ -159,7 +161,7 @@ declare class GraphContext {
159
161
  * Search resources by name (cross-resource query)
160
162
  * Requires full-text search - must use graph database
161
163
  */
162
- static searchResources(query: string, config: EnvironmentConfig, limit?: number): Promise<ResourceDescriptor[]>;
164
+ static searchResources(query: string, config: EnvironmentConfig, limit?: number): Promise<ResourceDescriptor$1[]>;
163
165
  }
164
166
 
165
167
  /**
@@ -230,7 +232,173 @@ declare class AnnotationDetection {
230
232
  private static loadResourceContent;
231
233
  }
232
234
 
235
+ /**
236
+ * Comment Detection Worker
237
+ *
238
+ * Processes comment-detection jobs: runs AI inference to identify passages
239
+ * that would benefit from explanatory comments and creates comment annotations.
240
+ */
241
+
242
+ declare class CommentDetectionWorker extends JobWorker {
243
+ private config;
244
+ private eventStore;
245
+ private isFirstProgress;
246
+ constructor(jobQueue: JobQueue, config: EnvironmentConfig, eventStore: EventStore);
247
+ protected getWorkerName(): string;
248
+ protected canProcessJob(job: Job): boolean;
249
+ protected executeJob(job: Job): Promise<void>;
250
+ /**
251
+ * Override updateJobProgress to emit events to Event Store
252
+ */
253
+ protected updateJobProgress(job: Job): Promise<void>;
254
+ protected handleJobFailure(job: Job, error: any): Promise<void>;
255
+ private processCommentDetectionJob;
256
+ private createCommentAnnotation;
257
+ }
258
+
259
+ /**
260
+ * Highlight Detection Worker
261
+ *
262
+ * Processes highlight-detection jobs: runs AI inference to find passages
263
+ * that should be highlighted and creates highlight annotations.
264
+ */
265
+
266
+ declare class HighlightDetectionWorker extends JobWorker {
267
+ private config;
268
+ private eventStore;
269
+ private isFirstProgress;
270
+ constructor(jobQueue: JobQueue, config: EnvironmentConfig, eventStore: EventStore);
271
+ protected getWorkerName(): string;
272
+ protected canProcessJob(job: Job): boolean;
273
+ protected executeJob(job: Job): Promise<void>;
274
+ /**
275
+ * Override updateJobProgress to emit events to Event Store
276
+ */
277
+ protected updateJobProgress(job: Job): Promise<void>;
278
+ protected handleJobFailure(job: Job, error: any): Promise<void>;
279
+ private processHighlightDetectionJob;
280
+ private createHighlightAnnotation;
281
+ }
282
+
283
+ /**
284
+ * Assessment Detection Worker
285
+ *
286
+ * Processes assessment-detection jobs: runs AI inference to assess/evaluate
287
+ * passages in the text and creates assessment annotations.
288
+ */
289
+
290
+ declare class AssessmentDetectionWorker extends JobWorker {
291
+ private config;
292
+ private eventStore;
293
+ private isFirstProgress;
294
+ constructor(jobQueue: JobQueue, config: EnvironmentConfig, eventStore: EventStore);
295
+ protected getWorkerName(): string;
296
+ protected canProcessJob(job: Job): boolean;
297
+ protected executeJob(job: Job): Promise<void>;
298
+ /**
299
+ * Override updateJobProgress to emit events to Event Store
300
+ */
301
+ protected updateJobProgress(job: Job): Promise<void>;
302
+ protected handleJobFailure(job: Job, error: any): Promise<void>;
303
+ private processAssessmentDetectionJob;
304
+ private createAssessmentAnnotation;
305
+ }
306
+
307
+ /**
308
+ * Tag Detection Worker
309
+ *
310
+ * Processes tag-detection jobs: runs AI inference to identify passages
311
+ * serving specific structural roles (IRAC, IMRAD, Toulmin, etc.) and
312
+ * creates tag annotations with dual-body structure.
313
+ */
314
+
315
+ declare class TagDetectionWorker extends JobWorker {
316
+ private config;
317
+ private eventStore;
318
+ private isFirstProgress;
319
+ constructor(jobQueue: JobQueue, config: EnvironmentConfig, eventStore: EventStore);
320
+ protected getWorkerName(): string;
321
+ protected canProcessJob(job: Job): boolean;
322
+ protected executeJob(job: Job): Promise<void>;
323
+ /**
324
+ * Override updateJobProgress to emit events to Event Store
325
+ */
326
+ protected updateJobProgress(job: Job): Promise<void>;
327
+ protected handleJobFailure(job: Job, error: any): Promise<void>;
328
+ private processTagDetectionJob;
329
+ private createTagAnnotation;
330
+ }
331
+
332
+ /**
333
+ * Reference Detection Worker
334
+ *
335
+ * Processes detection jobs: runs AI inference to find entities in resources
336
+ * and emits reference.created events for each detected entity.
337
+ *
338
+ * This worker is INDEPENDENT of HTTP clients - it just processes jobs and emits events.
339
+ */
340
+
341
+ type ResourceDescriptor = components['schemas']['ResourceDescriptor'];
342
+ interface DetectedAnnotation {
343
+ annotation: {
344
+ selector: {
345
+ start: number;
346
+ end: number;
347
+ exact: string;
348
+ prefix?: string;
349
+ suffix?: string;
350
+ };
351
+ entityTypes: string[];
352
+ };
353
+ }
354
+ declare class ReferenceDetectionWorker extends JobWorker {
355
+ private config;
356
+ private eventStore;
357
+ constructor(jobQueue: JobQueue, config: EnvironmentConfig, eventStore: EventStore);
358
+ protected getWorkerName(): string;
359
+ protected canProcessJob(job: Job): boolean;
360
+ protected executeJob(job: Job): Promise<void>;
361
+ /**
362
+ * Detect entity references in resource using AI
363
+ * Self-contained implementation for reference detection
364
+ *
365
+ * Public for testing charset handling - see entity-detection-charset.test.ts
366
+ */
367
+ detectReferences(resource: ResourceDescriptor, entityTypes: string[], includeDescriptiveReferences?: boolean): Promise<DetectedAnnotation[]>;
368
+ private processDetectionJob;
369
+ protected handleJobFailure(job: Job, error: any): Promise<void>;
370
+ /**
371
+ * Update job progress and emit events to Event Store
372
+ * Overrides base class to also emit job progress events
373
+ */
374
+ protected updateJobProgress(job: Job): Promise<void>;
375
+ }
376
+
377
+ /**
378
+ * Generation Worker
379
+ *
380
+ * Processes generation jobs: runs AI inference to generate new resources
381
+ * and emits resource.created and annotation.body.updated events.
382
+ *
383
+ * This worker is INDEPENDENT of HTTP clients - it just processes jobs and emits events.
384
+ */
385
+
386
+ declare class GenerationWorker extends JobWorker {
387
+ private config;
388
+ private eventStore;
389
+ constructor(jobQueue: JobQueue, config: EnvironmentConfig, eventStore: EventStore);
390
+ protected getWorkerName(): string;
391
+ protected canProcessJob(job: Job): boolean;
392
+ protected executeJob(job: Job): Promise<void>;
393
+ private processGenerationJob;
394
+ /**
395
+ * Update job progress and emit events to Event Store
396
+ * Overrides base class to also emit job progress events
397
+ */
398
+ protected updateJobProgress(job: Job): Promise<void>;
399
+ }
400
+
233
401
  declare const PACKAGE_NAME = "@semiont/make-meaning";
234
402
  declare const VERSION = "0.1.0";
235
403
 
236
- export { AnnotationContext, AnnotationDetection, type BuildContextOptions, GraphContext, type ListResourcesFilters, PACKAGE_NAME, ResourceContext, VERSION };
404
+ export { AnnotationContext, AnnotationDetection, AssessmentDetectionWorker, type BuildContextOptions, CommentDetectionWorker, GenerationWorker, GraphContext, HighlightDetectionWorker, type ListResourcesFilters, PACKAGE_NAME, ReferenceDetectionWorker, ResourceContext, TagDetectionWorker, VERSION };