@semiont/jobs 0.5.38 → 0.5.39

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,4 +1,4 @@
1
- import { JobId, UserId, UnitCursor, ResourceId, EntityType, JobReferenceAnnotationResult, GenerationJobParams, JobHighlightAnnotationResult, JobAssessmentAnnotationResult, JobCommentAnnotationResult, TagSchema, JobTagAnnotationResult, Logger, EventBus, components, Annotation, SupportedMediaType, GatheredContext } from '@semiont/core';
1
+ import { JobId, UserId, UnitCursor, ResourceId, EntityType, JobReferenceAnnotationResult, GenerationJobParams, JobHighlightAnnotationResult, JobAssessmentAnnotationResult, JobCommentAnnotationResult, TagSchema, JobTagAnnotationResult, Logger, EventBus, components, Annotation, SupportedMediaType, GatheredContext, EventMap } from '@semiont/core';
2
2
  import { SemiontState } from '@semiont/core/node';
3
3
  import { InferenceClient } from '@semiont/inference';
4
4
 
@@ -1046,6 +1046,26 @@ declare function generateResourceFromTopic(topic: string, entityTypes: string[],
1046
1046
  * guarantee a blocked loop defeats is not one; the janitor is the guarantee.
1047
1047
  */
1048
1048
  declare const STALL_THRESHOLD_MS: number;
1049
+ /**
1050
+ * The broadcasts a worker CONSUMES — announcements nobody replies to, which
1051
+ * therefore derive from no operation.
1052
+ *
1053
+ * One home, because the alternative was proven: these lived as `addChannels`
1054
+ * calls beside their consumers, so the worker's complete set existed nowhere
1055
+ * and a widening could be deleted without any list getting shorter. That is
1056
+ * the 2026-09-16 outage — every worker idle on a `job:queued` its transport
1057
+ * would never carry, `lastQueuedEventAt: null`, nothing thrown and nothing
1058
+ * logged.
1059
+ *
1060
+ * An entry here must have a consumer and a consumer must have an entry; the
1061
+ * census beside this file asserts both directions.
1062
+ */
1063
+ declare const WORKER_CONSUMED_BROADCASTS: readonly ["job:queued", "job:cancel-requested"];
1064
+ /**
1065
+ * The global SSE channel set for a worker's transport: the whole manifest,
1066
+ * stated once and passed at construction. Nothing widens it afterwards.
1067
+ */
1068
+ declare const WORKER_CHANNELS: readonly (keyof EventMap)[];
1049
1069
 
1050
- export { AnnotationDetection, FsJobQueue, JOBS_STREAM_SUBJECTS, JOB_QUEUE_EMITS, JetStreamJobQueue, STALL_THRESHOLD_MS, generateResourceFromTopic, isCancelledJob, isCompleteJob, isFailedJob, isPendingJob, isRunningJob, processAssessmentJob, processCommentJob, processGenerationJob, processHighlightJob, processReferenceJob, processTagJob };
1070
+ export { AnnotationDetection, FsJobQueue, JOBS_STREAM_SUBJECTS, JOB_QUEUE_EMITS, JetStreamJobQueue, STALL_THRESHOLD_MS, WORKER_CHANNELS, WORKER_CONSUMED_BROADCASTS, generateResourceFromTopic, isCancelledJob, isCompleteJob, isFailedJob, isPendingJob, isRunningJob, processAssessmentJob, processCommentJob, processGenerationJob, processHighlightJob, processReferenceJob, processTagJob };
1051
1071
  export type { AnyJob, AssessmentDetectionJob, AssessmentDetectionParams, AssessmentDetectionProgress, CancelledJob, CommentDetectionJob, CommentDetectionParams, CommentDetectionProgress, CompleteJob, DetectionJob, DetectionParams, DetectionProgress, FailedJob, GenerationJob, GenerationResult, HighlightDetectionJob, HighlightDetectionParams, HighlightDetectionProgress, JetStreamJobQueueOptions, JobMetadata, JobQueryFilters, JobQueue, JobStatus, JobType, OnProgress, PendingJob, ProcessorResult, RunningJob, TagDetectionJob, TagDetectionParams, TagDetectionProgress, YieldProgress };
package/dist/index.js CHANGED
@@ -111,7 +111,7 @@ var FsJobQueue = class {
111
111
  */
112
112
  announce(job) {
113
113
  if (this.eventBus && "params" in job && "resourceId" in job.params) {
114
- this.eventBus.get("job:queued").next({
114
+ this.eventBus.emit("job:queued", {
115
115
  jobId: job.metadata.id,
116
116
  jobType: job.metadata.type,
117
117
  resourceId: job.params.resourceId,
@@ -673,7 +673,7 @@ var JetStreamJobQueue = class {
673
673
  /** Same wire shape as the fs driver: only jobs with a resourceId announce. */
674
674
  announce(job) {
675
675
  if (this.eventBus && "params" in job && "resourceId" in job.params) {
676
- this.eventBus.get("job:queued").next({
676
+ this.eventBus.emit("job:queued", {
677
677
  jobId: job.metadata.id,
678
678
  jobType: job.metadata.type,
679
679
  resourceId: job.params.resourceId,
@@ -2935,8 +2935,17 @@ var WORKER_AWAITED_OPERATIONS = [
2935
2935
  // rare error path is no reason to let it back in.
2936
2936
  "browse:annotation-requested"
2937
2937
  ];
2938
- replyChannelsFor(WORKER_AWAITED_OPERATIONS);
2938
+ var WORKER_CONSUMED_BROADCASTS = [
2939
+ // The queue announcement the claim adapter races for.
2940
+ "job:queued",
2941
+ // Cooperative cancellation of the ACTIVE job (JOB-RESTART-SAFETY P4).
2942
+ "job:cancel-requested"
2943
+ ];
2944
+ var WORKER_CHANNELS = [
2945
+ ...replyChannelsFor(WORKER_AWAITED_OPERATIONS),
2946
+ ...WORKER_CONSUMED_BROADCASTS
2947
+ ];
2939
2948
 
2940
- export { AnnotationDetection, FsJobQueue, JOBS_STREAM_SUBJECTS, JOB_QUEUE_EMITS, JetStreamJobQueue, STALL_THRESHOLD_MS, generateResourceFromTopic, isCancelledJob, isCompleteJob, isFailedJob, isPendingJob, isRunningJob, processAssessmentJob, processCommentJob, processGenerationJob, processHighlightJob, processReferenceJob, processTagJob };
2949
+ export { AnnotationDetection, FsJobQueue, JOBS_STREAM_SUBJECTS, JOB_QUEUE_EMITS, JetStreamJobQueue, STALL_THRESHOLD_MS, WORKER_CHANNELS, WORKER_CONSUMED_BROADCASTS, generateResourceFromTopic, isCancelledJob, isCompleteJob, isFailedJob, isPendingJob, isRunningJob, processAssessmentJob, processCommentJob, processGenerationJob, processHighlightJob, processReferenceJob, processTagJob };
2941
2950
  //# sourceMappingURL=index.js.map
2942
2951
  //# sourceMappingURL=index.js.map