@semiont/jobs 0.5.2 → 0.5.4

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 (35) hide show
  1. package/dist/fs-job-queue.d.ts +79 -0
  2. package/dist/fs-job-queue.d.ts.map +1 -0
  3. package/dist/index.d.ts +20 -623
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +74 -218
  6. package/dist/index.js.map +1 -1
  7. package/dist/job-claim-adapter.d.ts +76 -0
  8. package/dist/job-claim-adapter.d.ts.map +1 -0
  9. package/dist/job-queue-interface.d.ts +19 -0
  10. package/dist/job-queue-interface.d.ts.map +1 -0
  11. package/dist/job-queue-state-unit.d.ts +26 -0
  12. package/dist/job-queue-state-unit.d.ts.map +1 -0
  13. package/dist/job-worker.d.ts +67 -0
  14. package/dist/job-worker.d.ts.map +1 -0
  15. package/dist/processors.d.ts +41 -0
  16. package/dist/processors.d.ts.map +1 -0
  17. package/dist/types.d.ts +319 -0
  18. package/dist/types.d.ts.map +1 -0
  19. package/dist/worker-main.d.ts +22 -2
  20. package/dist/worker-main.d.ts.map +1 -0
  21. package/dist/worker-main.js +175 -276
  22. package/dist/worker-main.js.map +1 -1
  23. package/dist/worker-process.d.ts +47 -0
  24. package/dist/worker-process.d.ts.map +1 -0
  25. package/dist/workers/annotation-detection.d.ts +61 -0
  26. package/dist/workers/annotation-detection.d.ts.map +1 -0
  27. package/dist/workers/detection/entity-extractor.d.ts +42 -0
  28. package/dist/workers/detection/entity-extractor.d.ts.map +1 -0
  29. package/dist/workers/detection/motivation-parsers.d.ts +116 -0
  30. package/dist/workers/detection/motivation-parsers.d.ts.map +1 -0
  31. package/dist/workers/detection/motivation-prompts.d.ts +57 -0
  32. package/dist/workers/detection/motivation-prompts.d.ts.map +1 -0
  33. package/dist/workers/generation/resource-generation.d.ts +23 -0
  34. package/dist/workers/generation/resource-generation.d.ts.map +1 -0
  35. package/package.json +3 -3
package/dist/index.d.ts CHANGED
@@ -1,624 +1,21 @@
1
- import { Readable } from 'stream';
2
- import * as _semiont_core from '@semiont/core';
3
- import { ResourceId, JobId, UserId, EntityType, AnnotationId, Annotation, GatheredContext, Logger, EventBus, components } from '@semiont/core';
4
- import { SemiontProject } from '@semiont/core/node';
5
- import { InferenceClient } from '@semiont/inference';
6
-
7
1
  /**
8
- * Job Queue Type Definitions - Discriminated Union Design
9
- *
10
- * Jobs represent async work that can be queued, processed, and monitored.
11
- * Uses TypeScript discriminated unions to enforce valid state transitions.
12
- *
13
- * Design principles:
14
- * - Each job status has specific valid fields
15
- * - Type narrowing works automatically via status discriminant
16
- * - No optional fields that may or may not exist
17
- * - State machine is explicit and type-safe
18
- */
19
-
20
- /**
21
- * Content fetcher - turns a ResourceId into a readable stream.
22
- * Workers use this to access resource content on demand.
23
- * The implementation is provided by the backend at startup.
24
- */
25
- type ContentFetcher = (resourceId: ResourceId) => Promise<Readable | null>;
26
- type JobType = 'reference-annotation' | 'generation' | 'highlight-annotation' | 'assessment-annotation' | 'comment-annotation' | 'tag-annotation';
27
- type JobStatus = 'pending' | 'running' | 'complete' | 'failed' | 'cancelled';
28
- /**
29
- * Job metadata - common to all states
30
- */
31
- interface JobMetadata {
32
- id: JobId;
33
- type: JobType;
34
- userId: UserId;
35
- userName: string;
36
- userEmail: string;
37
- userDomain: string;
38
- created: string;
39
- retryCount: number;
40
- maxRetries: number;
41
- }
42
- /**
43
- * Locale conventions for detection/generation params.
44
- *
45
- * Two independent locales flow through these jobs:
46
- *
47
- * - `language` — *annotation body* locale. The BCP-47 tag the LLM should
48
- * write generated body text in (comment text, assessment text, generated
49
- * resource content, tag category label). Sourced from the user's UI
50
- * locale. Stamped onto the W3C `TextualBody.language` field.
51
- *
52
- * - `sourceLanguage` — *source resource* locale. The BCP-47 tag of the
53
- * content being analyzed. Sourced from `ResourceDescriptor` (carried as
54
- * `Representation.language` on the primary representation). Used in
55
- * prompts so the LLM analyzes non-English source correctly even when
56
- * the user's UI locale differs.
57
- *
58
- * Examples: a German user analyzing an English document → `language='de'`,
59
- * `sourceLanguage='en'`. An English user detecting entities in a French
60
- * document → `language='en'` (unused for entity references), `sourceLanguage='fr'`.
61
- */
62
- /**
63
- * Detection job parameters
64
- */
65
- interface DetectionParams {
66
- resourceId: ResourceId;
67
- entityTypes: EntityType[];
68
- includeDescriptiveReferences?: boolean;
69
- /** Annotation body locale — see locale conventions above. */
70
- language?: string;
71
- /** Source-resource locale — see locale conventions above. */
72
- sourceLanguage?: string;
73
- }
74
- /**
75
- * Generation job parameters
76
- */
77
- interface GenerationParams {
78
- referenceId: AnnotationId;
79
- sourceResourceId: ResourceId;
80
- sourceResourceName: string;
81
- annotation: Annotation;
82
- prompt?: string;
83
- title?: string;
84
- entityTypes?: EntityType[];
85
- /** Annotation body locale — language the *generated resource* is written in. */
86
- language?: string;
87
- /**
88
- * Source-resource locale — language of the resource being referenced.
89
- * Used in the prompt so the LLM understands the embedded source-context
90
- * snippet correctly when source ≠ target language.
91
- */
92
- sourceLanguage?: string;
93
- context?: GatheredContext;
94
- temperature?: number;
95
- maxTokens?: number;
96
- storageUri?: string;
97
- }
98
- /**
99
- * Highlight detection job parameters
100
- */
101
- interface HighlightDetectionParams {
102
- resourceId: ResourceId;
103
- instructions?: string;
104
- density?: number;
105
- /** Source-resource locale — see locale conventions above. */
106
- sourceLanguage?: string;
107
- }
108
- /**
109
- * Assessment detection job parameters
110
- */
111
- interface AssessmentDetectionParams {
112
- resourceId: ResourceId;
113
- instructions?: string;
114
- tone?: 'analytical' | 'critical' | 'balanced' | 'constructive';
115
- density?: number;
116
- /** Annotation body locale — see locale conventions above. */
117
- language?: string;
118
- /** Source-resource locale — see locale conventions above. */
119
- sourceLanguage?: string;
120
- }
121
- /**
122
- * Comment detection job parameters
123
- */
124
- interface CommentDetectionParams {
125
- resourceId: ResourceId;
126
- instructions?: string;
127
- tone?: 'scholarly' | 'explanatory' | 'conversational' | 'technical';
128
- density?: number;
129
- /** Annotation body locale — see locale conventions above. */
130
- language?: string;
131
- /** Source-resource locale — see locale conventions above. */
132
- sourceLanguage?: string;
133
- }
134
- /**
135
- * Tag detection job parameters
136
- */
137
- interface TagDetectionParams {
138
- resourceId: ResourceId;
139
- schemaId: string;
140
- categories: string[];
141
- /** Annotation body locale — see locale conventions above. */
142
- language?: string;
143
- /** Source-resource locale — see locale conventions above. */
144
- sourceLanguage?: string;
145
- }
146
- /**
147
- * Detection job progress
148
- */
149
- interface DetectionProgress {
150
- totalEntityTypes: number;
151
- processedEntityTypes: number;
152
- currentEntityType?: string;
153
- entitiesFound: number;
154
- entitiesEmitted: number;
155
- }
156
- /**
157
- * Detection job result
158
- */
159
- interface DetectionResult {
160
- totalFound: number;
161
- totalEmitted: number;
162
- errors: number;
163
- }
164
- /**
165
- * Generation job progress
166
- */
167
- interface YieldProgress {
168
- stage: 'fetching' | 'generating' | 'creating' | 'linking';
169
- percentage: number;
170
- message?: string;
171
- }
172
- /**
173
- * Generation job result
174
- */
175
- interface GenerationResult {
176
- resourceId: ResourceId;
177
- resourceName: string;
178
- }
179
- /**
180
- * Highlight detection job progress
181
- */
182
- interface HighlightDetectionProgress {
183
- stage: 'analyzing' | 'creating';
184
- percentage: number;
185
- message?: string;
186
- }
187
- /**
188
- * Highlight detection job result
189
- */
190
- interface HighlightDetectionResult {
191
- highlightsFound: number;
192
- highlightsCreated: number;
193
- }
194
- /**
195
- * Assessment detection job progress
196
- */
197
- interface AssessmentDetectionProgress {
198
- stage: 'analyzing' | 'creating';
199
- percentage: number;
200
- message?: string;
201
- }
202
- /**
203
- * Assessment detection job result
204
- */
205
- interface AssessmentDetectionResult {
206
- assessmentsFound: number;
207
- assessmentsCreated: number;
208
- }
209
- /**
210
- * Comment detection job progress
211
- */
212
- interface CommentDetectionProgress {
213
- stage: 'analyzing' | 'creating';
214
- percentage: number;
215
- message?: string;
216
- }
217
- /**
218
- * Comment detection job result
219
- */
220
- interface CommentDetectionResult {
221
- commentsFound: number;
222
- commentsCreated: number;
223
- }
224
- /**
225
- * Tag detection job progress
226
- */
227
- interface TagDetectionProgress {
228
- stage: 'analyzing' | 'creating';
229
- percentage: number;
230
- currentCategory?: string;
231
- processedCategories: number;
232
- totalCategories: number;
233
- message?: string;
234
- }
235
- /**
236
- * Tag detection job result
237
- */
238
- interface TagDetectionResult {
239
- tagsFound: number;
240
- tagsCreated: number;
241
- byCategory: Record<string, number>;
242
- }
243
- /**
244
- * Pending job - just created, waiting to be picked up
245
- */
246
- interface PendingJob<P> {
247
- status: 'pending';
248
- metadata: JobMetadata;
249
- params: P;
250
- }
251
- /**
252
- * Running job - actively being processed
253
- */
254
- interface RunningJob<P, PG> {
255
- status: 'running';
256
- metadata: JobMetadata;
257
- params: P;
258
- startedAt: string;
259
- progress: PG;
260
- }
261
- /**
262
- * Complete job - successfully finished
263
- */
264
- interface CompleteJob<P, R> {
265
- status: 'complete';
266
- metadata: JobMetadata;
267
- params: P;
268
- startedAt: string;
269
- completedAt: string;
270
- result: R;
271
- }
272
- /**
273
- * Failed job - encountered an error
274
- */
275
- interface FailedJob<P> {
276
- status: 'failed';
277
- metadata: JobMetadata;
278
- params: P;
279
- startedAt?: string;
280
- completedAt: string;
281
- error: string;
282
- }
283
- /**
284
- * Cancelled job - stopped by user
285
- */
286
- interface CancelledJob<P> {
287
- status: 'cancelled';
288
- metadata: JobMetadata;
289
- params: P;
290
- startedAt?: string;
291
- completedAt: string;
292
- }
293
- /**
294
- * Generic job - discriminated union of all states
295
- */
296
- type Job<P, PG, R> = PendingJob<P> | RunningJob<P, PG> | CompleteJob<P, R> | FailedJob<P> | CancelledJob<P>;
297
- type DetectionJob = Job<DetectionParams, DetectionProgress, DetectionResult>;
298
- type GenerationJob = Job<GenerationParams, YieldProgress, GenerationResult>;
299
- type HighlightDetectionJob = Job<HighlightDetectionParams, HighlightDetectionProgress, HighlightDetectionResult>;
300
- type AssessmentDetectionJob = Job<AssessmentDetectionParams, AssessmentDetectionProgress, AssessmentDetectionResult>;
301
- type CommentDetectionJob = Job<CommentDetectionParams, CommentDetectionProgress, CommentDetectionResult>;
302
- type TagDetectionJob = Job<TagDetectionParams, TagDetectionProgress, TagDetectionResult>;
303
- /**
304
- * Discriminated union of all job types
305
- */
306
- type AnyJob = DetectionJob | GenerationJob | HighlightDetectionJob | AssessmentDetectionJob | CommentDetectionJob | TagDetectionJob;
307
- declare function isPendingJob(job: AnyJob): job is PendingJob<any>;
308
- declare function isRunningJob(job: AnyJob): job is RunningJob<any, any>;
309
- declare function isCompleteJob(job: AnyJob): job is CompleteJob<any, any>;
310
- declare function isFailedJob(job: AnyJob): job is FailedJob<any>;
311
- declare function isCancelledJob(job: AnyJob): job is CancelledJob<any>;
312
- interface JobQueryFilters {
313
- status?: JobStatus;
314
- type?: JobType;
315
- userId?: UserId;
316
- limit?: number;
317
- offset?: number;
318
- }
319
-
320
- interface JobQueue {
321
- initialize(): Promise<void>;
322
- destroy(): void;
323
- createJob(job: AnyJob): Promise<void>;
324
- getJob(jobId: JobId): Promise<AnyJob | null>;
325
- updateJob(job: AnyJob, oldStatus?: JobStatus): Promise<void>;
326
- pollNextPendingJob(predicate?: (job: AnyJob) => boolean): Promise<AnyJob | null>;
327
- cancelJob(jobId: JobId): Promise<boolean>;
328
- getStats(): Promise<{
329
- pending: number;
330
- running: number;
331
- complete: number;
332
- failed: number;
333
- cancelled: number;
334
- }>;
335
- }
336
-
337
- /**
338
- * Job Queue Manager
339
- *
340
- * Filesystem-based job queue with atomic operations.
341
- * Jobs are stored in directories by status for easy polling.
342
- */
343
-
344
- declare class FsJobQueue implements JobQueue {
345
- private eventBus?;
346
- private jobsDir;
347
- private logger;
348
- private pendingQueue;
349
- private watcher;
350
- private loadDebounceTimer;
351
- constructor(project: SemiontProject, logger: Logger, eventBus?: EventBus | undefined);
352
- /**
353
- * Initialize job queue directories, load pending jobs, and start fs.watch
354
- */
355
- initialize(): Promise<void>;
356
- /**
357
- * Clean up watcher
358
- */
359
- destroy(): void;
360
- /**
361
- * Load pending jobs from disk into in-memory queue
362
- */
363
- private loadPendingJobs;
364
- /**
365
- * Debounced version of loadPendingJobs — fs.watch can fire rapidly
366
- */
367
- private debouncedLoadPendingJobs;
368
- /**
369
- * Create a new job
370
- */
371
- createJob(job: AnyJob): Promise<void>;
372
- /**
373
- * Get a job by ID (searches all status directories)
374
- */
375
- getJob(jobId: JobId): Promise<AnyJob | null>;
376
- /**
377
- * Update a job (atomic: delete old, write new)
378
- */
379
- updateJob(job: AnyJob, oldStatus?: JobStatus): Promise<void>;
380
- /**
381
- * Poll for next pending job (FIFO) from in-memory queue.
382
- * If a predicate is provided, returns the first matching job (skipping non-matching ones).
383
- */
384
- pollNextPendingJob(predicate?: (job: AnyJob) => boolean): Promise<AnyJob | null>;
385
- /**
386
- * List jobs with filters
387
- */
388
- listJobs(filters?: JobQueryFilters): Promise<AnyJob[]>;
389
- /**
390
- * Cancel a job
391
- */
392
- cancelJob(jobId: JobId): Promise<boolean>;
393
- /**
394
- * Clean up old completed/failed jobs (older than retention period)
395
- */
396
- cleanupOldJobs(retentionHours?: number): Promise<number>;
397
- /**
398
- * Get job file path
399
- */
400
- private getJobPath;
401
- /**
402
- * Get statistics about the queue
403
- */
404
- getStats(): Promise<{
405
- pending: number;
406
- running: number;
407
- complete: number;
408
- failed: number;
409
- cancelled: number;
410
- }>;
411
- }
412
-
413
- /**
414
- * Job Worker Base Class
415
- *
416
- * Abstract worker that polls the job queue and processes jobs.
417
- * Subclasses implement specific job processing logic.
418
- */
419
-
420
- declare abstract class JobWorker {
421
- private running;
422
- private currentJob;
423
- private pollIntervalMs;
424
- private errorBackoffMs;
425
- protected jobQueue: JobQueue;
426
- protected logger: Logger;
427
- constructor(jobQueue: JobQueue, pollIntervalMs: number | undefined, errorBackoffMs: number | undefined, logger: Logger);
428
- /**
429
- * Start the worker (polls queue in loop)
430
- */
431
- start(): Promise<void>;
432
- /**
433
- * Stop the worker (graceful shutdown)
434
- */
435
- stop(): Promise<void>;
436
- /**
437
- * Poll for next job to process
438
- */
439
- private pollNextJob;
440
- /**
441
- * Process a job (handles state transitions and error handling)
442
- */
443
- private processJob;
444
- /**
445
- * Handle job failure (retry or move to failed)
446
- */
447
- protected handleJobFailure(job: AnyJob, error: any): Promise<void>;
448
- /**
449
- * Update job progress (best-effort, doesn't throw)
450
- */
451
- protected updateJobProgress(job: AnyJob): Promise<void>;
452
- /**
453
- * Sleep utility
454
- */
455
- protected sleep(ms: number): Promise<void>;
456
- /**
457
- * Emit completion event (optional hook for subclasses)
458
- * Override this to emit job-specific completion events (e.g., job.completed)
459
- */
460
- protected emitCompletionEvent(_job: RunningJob<any, any>, _result: any): Promise<void>;
461
- /**
462
- * Get worker name (for logging)
463
- */
464
- protected abstract getWorkerName(): string;
465
- /**
466
- * Check if this worker can process the given job
467
- */
468
- protected abstract canProcessJob(job: AnyJob): boolean;
469
- /**
470
- * Execute the job (job-specific logic)
471
- * This is where the actual work happens
472
- * Return the result object (or void for jobs without results)
473
- * Throw an error to trigger retry logic
474
- */
475
- protected abstract executeJob(job: AnyJob): Promise<any>;
476
- }
477
-
478
- type Agent = components['schemas']['Agent'];
479
- /**
480
- * Progress callback. The three positional args satisfy the minimum
481
- * `JobProgress` required fields (`percentage`, `message`, `stage`).
482
- * The fourth optional arg carries job-type-specific fields
483
- * (`currentEntityType`, `completedEntityTypes`, `requestParams`, etc.)
484
- * that the progress UI renders.
485
- */
486
- type OnProgress = (percentage: number, message: string, stage: string, extra?: Partial<JobProgress>) => void;
487
- type JobProgress = components['schemas']['JobProgress'];
488
- interface ProcessorResult<R> {
489
- annotations: Record<string, unknown>[];
490
- result: R;
491
- }
492
- declare function processHighlightJob(content: string, inferenceClient: InferenceClient, params: HighlightDetectionParams, userId: string, generator: Agent, onProgress: OnProgress): Promise<ProcessorResult<HighlightDetectionResult>>;
493
- declare function processCommentJob(content: string, inferenceClient: InferenceClient, params: CommentDetectionParams, userId: string, generator: Agent, onProgress: OnProgress): Promise<ProcessorResult<CommentDetectionResult>>;
494
- declare function processAssessmentJob(content: string, inferenceClient: InferenceClient, params: AssessmentDetectionParams, userId: string, generator: Agent, onProgress: OnProgress): Promise<ProcessorResult<AssessmentDetectionResult>>;
495
- declare function processReferenceJob(content: string, inferenceClient: InferenceClient, params: DetectionParams, userId: string, generator: Agent, onProgress: OnProgress, logger?: _semiont_core.Logger): Promise<ProcessorResult<DetectionResult>>;
496
- declare function processTagJob(content: string, inferenceClient: InferenceClient, params: TagDetectionParams, userId: string, generator: Agent, onProgress: OnProgress): Promise<ProcessorResult<TagDetectionResult>>;
497
- declare function processGenerationJob(inferenceClient: InferenceClient, params: GenerationParams, onProgress: OnProgress): Promise<{
498
- content: string;
499
- title: string;
500
- format: string;
501
- result: GenerationResult;
502
- }>;
503
-
504
- /**
505
- * Represents a detected comment with validated position
506
- */
507
- interface CommentMatch {
508
- exact: string;
509
- start: number;
510
- end: number;
511
- prefix?: string;
512
- suffix?: string;
513
- comment: string;
514
- }
515
- /**
516
- * Represents a detected highlight with validated position
517
- */
518
- interface HighlightMatch {
519
- exact: string;
520
- start: number;
521
- end: number;
522
- prefix?: string;
523
- suffix?: string;
524
- }
525
- /**
526
- * Represents a detected assessment with validated position
527
- */
528
- interface AssessmentMatch {
529
- exact: string;
530
- start: number;
531
- end: number;
532
- prefix?: string;
533
- suffix?: string;
534
- assessment: string;
535
- }
536
- /**
537
- * Represents a detected tag with validated position
538
- */
539
- interface TagMatch {
540
- exact: string;
541
- start: number;
542
- end: number;
543
- prefix?: string;
544
- suffix?: string;
545
- category: string;
546
- }
547
-
548
- /**
549
- * Annotation Detection
550
- *
551
- * Orchestrates the full annotation detection pipeline:
552
- * 1. Build AI prompts using MotivationPrompts
553
- * 2. Call AI inference
554
- * 3. Parse and validate results using MotivationParsers
555
- *
556
- * All methods take content as a string parameter.
557
- * Workers are responsible for fetching content via ContentFetcher.
558
- */
559
-
560
- declare class AnnotationDetection {
561
- /**
562
- * Fetch content from a ContentFetcher and read the stream to a string.
563
- * Shared helper for all workers.
564
- */
565
- static fetchContent(contentFetcher: ContentFetcher, resourceId: ResourceId): Promise<string>;
566
- /**
567
- * Detect comments in content.
568
- *
569
- * `language` is the locale the LLM should write comment text in (annotation
570
- * body locale). `sourceLanguage` is the locale of the content being analyzed
571
- * (source-resource locale). See `types.ts` "Locale conventions" for the
572
- * full discussion.
573
- */
574
- static detectComments(content: string, client: InferenceClient, instructions?: string, tone?: string, density?: number, language?: string, sourceLanguage?: string): Promise<CommentMatch[]>;
575
- /**
576
- * Detect highlights in content.
577
- *
578
- * Highlights have no body — only `sourceLanguage` (source-resource locale)
579
- * applies, used in the prompt so the LLM analyzes non-English source
580
- * correctly.
581
- */
582
- static detectHighlights(content: string, client: InferenceClient, instructions?: string, density?: number, sourceLanguage?: string): Promise<HighlightMatch[]>;
583
- /**
584
- * Detect assessments in content.
585
- *
586
- * `language` is the locale the LLM should write assessment text in
587
- * (annotation body locale). `sourceLanguage` is the locale of the content
588
- * being analyzed (source-resource locale).
589
- */
590
- static detectAssessments(content: string, client: InferenceClient, instructions?: string, tone?: string, density?: number, language?: string, sourceLanguage?: string): Promise<AssessmentMatch[]>;
591
- /**
592
- * Detect tags in content for a specific category.
593
- *
594
- * `sourceLanguage` is the locale of the content being analyzed. Body-locale
595
- * (`language`) doesn't influence the tag prompt — categories are schema
596
- * identifiers, not LLM-generated text — so it's consumed at the body-stamp
597
- * site, not here.
598
- */
599
- static detectTags(content: string, client: InferenceClient, schemaId: string, category: string, sourceLanguage?: string): Promise<TagMatch[]>;
600
- }
601
-
602
- /**
603
- * Resource Generation
604
- *
605
- * Generates markdown resources from topics using AI inference.
606
- */
607
-
608
- /**
609
- * Generate resource content using inference.
610
- *
611
- * Locale parameters: `locale` is the *body* locale — the language the
612
- * generated resource should be written in (sourced from the user's UI
613
- * locale). `sourceLanguage` is the *source* locale — the language of the
614
- * referenced resource whose context (selected passage, surrounding text)
615
- * is embedded into the prompt. They're independent: a German user can
616
- * generate German content from an English source resource. See
617
- * `types.ts` "Locale conventions" for the full discussion.
618
- */
619
- declare function generateResourceFromTopic(topic: string, entityTypes: string[], client: InferenceClient, userPrompt?: string, locale?: string, context?: GatheredContext, temperature?: number, maxTokens?: number, logger?: Logger, sourceLanguage?: string): Promise<{
620
- title: string;
621
- content: string;
622
- }>;
623
-
624
- export { AnnotationDetection, type AnyJob, type AssessmentDetectionJob, type AssessmentDetectionParams, type AssessmentDetectionProgress, type AssessmentDetectionResult, type CancelledJob, type CommentDetectionJob, type CommentDetectionParams, type CommentDetectionProgress, type CommentDetectionResult, type CompleteJob, type ContentFetcher, type DetectionJob, type DetectionParams, type DetectionProgress, type DetectionResult, type FailedJob, FsJobQueue, type GenerationJob, type GenerationParams, type GenerationResult, type HighlightDetectionJob, type HighlightDetectionParams, type HighlightDetectionProgress, type HighlightDetectionResult, type JobMetadata, type JobQueryFilters, type JobQueue, type JobStatus, type JobType, JobWorker, type OnProgress, type PendingJob, type ProcessorResult, type RunningJob, type TagDetectionJob, type TagDetectionParams, type TagDetectionProgress, type TagDetectionResult, type YieldProgress, generateResourceFromTopic, isCancelledJob, isCompleteJob, isFailedJob, isPendingJob, isRunningJob, processAssessmentJob, processCommentJob, processGenerationJob, processHighlightJob, processReferenceJob, processTagJob };
2
+ * @semiont/jobs
3
+ *
4
+ * Job queue and worker infrastructure
5
+ *
6
+ * Provides:
7
+ * - JobQueue interface: backing-store-agnostic contract
8
+ * - FsJobQueue: Filesystem-backed implementation
9
+ * - JobWorker: Abstract base class for job workers
10
+ * - Job processors: Extracted functions for each job type
11
+ * - Job types: All job type definitions
12
+ */
13
+ export type { JobQueue } from './job-queue-interface';
14
+ export { FsJobQueue } from './fs-job-queue';
15
+ export { JobWorker } from './job-worker';
16
+ export type { JobType, JobStatus, JobMetadata, DetectionJob, GenerationJob, HighlightDetectionJob, AssessmentDetectionJob, CommentDetectionJob, TagDetectionJob, AnyJob, PendingJob, RunningJob, CompleteJob, FailedJob, CancelledJob, JobQueryFilters, DetectionParams, GenerationParams, HighlightDetectionParams, AssessmentDetectionParams, CommentDetectionParams, TagDetectionParams, DetectionProgress, YieldProgress, HighlightDetectionProgress, AssessmentDetectionProgress, CommentDetectionProgress, TagDetectionProgress, DetectionResult, GenerationResult, HighlightDetectionResult, AssessmentDetectionResult, CommentDetectionResult, TagDetectionResult, ContentFetcher, } from './types';
17
+ export { isPendingJob, isRunningJob, isCompleteJob, isFailedJob, isCancelledJob, } from './types';
18
+ export { processHighlightJob, processCommentJob, processAssessmentJob, processReferenceJob, processTagJob, processGenerationJob, type OnProgress, type ProcessorResult, } from './processors';
19
+ export { AnnotationDetection } from './workers/annotation-detection';
20
+ export { generateResourceFromTopic } from './workers/generation/resource-generation';
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,YAAY,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG5C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,YAAY,EACV,OAAO,EACP,SAAS,EACT,WAAW,EACX,YAAY,EACZ,aAAa,EACb,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,eAAe,EACf,MAAM,EACN,UAAU,EACV,UAAU,EACV,WAAW,EACX,SAAS,EACT,YAAY,EACZ,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,0BAA0B,EAC1B,2BAA2B,EAC3B,wBAAwB,EACxB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACtB,kBAAkB,EAClB,cAAc,GACf,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,WAAW,EACX,cAAc,GACf,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,KAAK,UAAU,EACf,KAAK,eAAe,GACrB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAGrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC"}