@semiont/jobs 0.5.13 → 0.5.15

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
@@ -691,5 +691,37 @@ declare function generateResourceFromTopic(topic: string, entityTypes: string[],
691
691
  content: string;
692
692
  }>;
693
693
 
694
- export { AnnotationDetection, FsJobQueue, generateResourceFromTopic, isCancelledJob, isCompleteJob, isFailedJob, isPendingJob, isRunningJob, processAssessmentJob, processCommentJob, processGenerationJob, processHighlightJob, processReferenceJob, processTagJob };
694
+ /**
695
+ * Worker Runtime — the importable half of the worker host.
696
+ *
697
+ * `worker-main.ts` is a process entrypoint (config at module scope,
698
+ * `main()` at import) and therefore untestable by construction; everything
699
+ * a unit test needs to reach lives here instead, fully parameterized — no
700
+ * module-scope env reads, no side effects at import.
701
+ *
702
+ * The load-bearing contract this module owns (and the reason it was
703
+ * extracted): a worker's stamped identity is the DID the
704
+ * `/api/tokens/agent` exchange MINTED for it, carried verbatim — never
705
+ * re-derived from the URL the worker happens to dial. One logical agent
706
+ * previously got two DIDs that way (.plans/bugs/agent-did-host-skew.md).
707
+ */
708
+
709
+ /**
710
+ * Stall watchdog (WORKER-LIVENESS.md P3) — the fail-fast line behind the
711
+ * inference timeout. There is no poll loop to heartbeat; the honest
712
+ * stall signal in this push-driven architecture is *processing without
713
+ * activity*: an agent holding a claimed job whose `lastActivityAt`
714
+ * (claim / progress / finish) has stopped advancing is wedged — the
715
+ * adapter ignores every announcement while `isProcessing`, so a wedged
716
+ * agent never recovers on its own. Silent hang → loud crash → whatever
717
+ * restart policy the deployment chose.
718
+ *
719
+ * Thresholds are fixed by design (no env knobs) and deliberately
720
+ * layered: inference timeout (10 min, P2) fires first; this watchdog
721
+ * (15 min) catches the failure modes nobody predicted; the backend's
722
+ * dead-worker janitor (30 min) re-queues the job regardless.
723
+ */
724
+ declare const STALL_THRESHOLD_MS: number;
725
+
726
+ export { AnnotationDetection, FsJobQueue, STALL_THRESHOLD_MS, generateResourceFromTopic, isCancelledJob, isCompleteJob, isFailedJob, isPendingJob, isRunningJob, processAssessmentJob, processCommentJob, processGenerationJob, processHighlightJob, processReferenceJob, processTagJob };
695
727
  export type { AnyJob, AssessmentDetectionJob, AssessmentDetectionParams, AssessmentDetectionProgress, AssessmentDetectionResult, CancelledJob, CommentDetectionJob, CommentDetectionParams, CommentDetectionProgress, CommentDetectionResult, CompleteJob, DetectionJob, DetectionParams, DetectionProgress, DetectionResult, FailedJob, GenerationJob, GenerationParams, GenerationResult, HighlightDetectionJob, HighlightDetectionParams, HighlightDetectionProgress, HighlightDetectionResult, JobMetadata, JobQueryFilters, JobQueue, JobStatus, JobType, OnProgress, PendingJob, ProcessorResult, RunningJob, TagDetectionJob, TagDetectionParams, TagDetectionProgress, TagDetectionResult, YieldProgress };
package/dist/index.js CHANGED
@@ -2,6 +2,10 @@ import { promises } from 'fs';
2
2
  import * as path from 'path';
3
3
  import { jobId, deriveViews, reconcileSelector, isObject, isString, getLocaleEnglishName, didToAgent, isArray } from '@semiont/core';
4
4
  import { generateAnnotationId } from '@semiont/event-sourcing';
5
+ import '@semiont/content';
6
+ import '@semiont/observability';
7
+ import '@semiont/sdk';
8
+ import '@semiont/http-transport';
5
9
 
6
10
  // src/fs-job-queue.ts
7
11
  var REANNOUNCE_INTERVAL_MS = 3e4;
@@ -1697,7 +1701,8 @@ async function processGenerationJob(inferenceClient, params, onProgress, logger)
1697
1701
  }
1698
1702
  };
1699
1703
  }
1704
+ var STALL_THRESHOLD_MS = 15 * 6e4;
1700
1705
 
1701
- export { AnnotationDetection, FsJobQueue, generateResourceFromTopic, isCancelledJob, isCompleteJob, isFailedJob, isPendingJob, isRunningJob, processAssessmentJob, processCommentJob, processGenerationJob, processHighlightJob, processReferenceJob, processTagJob };
1706
+ export { AnnotationDetection, FsJobQueue, STALL_THRESHOLD_MS, generateResourceFromTopic, isCancelledJob, isCompleteJob, isFailedJob, isPendingJob, isRunningJob, processAssessmentJob, processCommentJob, processGenerationJob, processHighlightJob, processReferenceJob, processTagJob };
1702
1707
  //# sourceMappingURL=index.js.map
1703
1708
  //# sourceMappingURL=index.js.map