@semiont/jobs 0.6.9 → 0.6.10

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.
@@ -9928,7 +9928,8 @@ Example format:
9928
9928
  /**
9929
9929
  * Build a prompt for detecting structural tags
9930
9930
  *
9931
- * @param content - The full text content to analyze (NOT truncated for structural analysis)
9931
+ * @param content - The text content to analyze — a chunk sized by the
9932
+ * caller from derived provider limits; NEVER re-truncated here
9932
9933
  * @param category - The specific category to detect
9933
9934
  * @param schemaName - Human-readable schema name
9934
9935
  * @param schemaDescription - Schema description
@@ -10356,7 +10357,7 @@ ${piece}
10356
10357
  }
10357
10358
  if (items.length * YIELD_COLLAPSE_BAND < counted) {
10358
10359
  throw new YieldCollapseError(
10359
- `Extraction found ${items.length} entities where a count call reports ~${counted} mentions (band \xD7${YIELD_COLLAPSE_BAND}) on a ${piece.length}-char chunk \u2014 silent yield collapse (F7): deterministic \u2014 a same-size retry returns the identical under-report.`,
10360
+ `Extraction found ${items.length} entities where a count call reports ~${counted} mentions (band \xD7${YIELD_COLLAPSE_BAND}) on a ${piece.length}-char chunk \u2014 silent yield collapse: deterministic \u2014 a same-size retry returns the identical under-report.`,
10360
10361
  [...items],
10361
10362
  { found: items.length, counted, pieceChars: piece.length }
10362
10363
  );
@@ -10997,9 +10998,8 @@ async function processCommentJob(content, inferenceClient, params, buildAnnotati
10997
10998
  found += comments.length;
10998
10999
  const fresh = dedupe(comments.map(
10999
11000
  (c) => (
11000
- // Match the pre-#651 CommentAnnotationWorker: include format and
11001
- // language on the body TextualBody. Optional in the schema, but
11002
- // consumers that do language-aware rendering rely on them.
11001
+ // Format and language go on the body TextualBody: optional in the
11002
+ // schema, but consumers that do language-aware rendering rely on them.
11003
11003
  buildAnnotation("commenting", c, [
11004
11004
  { type: "TextualBody", value: c.comment, purpose: "commenting", format: "text/plain", language: bodyLanguage }
11005
11005
  ])
@@ -11040,8 +11040,7 @@ async function processAssessmentJob(content, inferenceClient, params, buildAnnot
11040
11040
  const fresh = dedupe(assessments.map(
11041
11041
  (a) => (
11042
11042
  // Single-object body with purpose aligned to motivation, matching the
11043
- // pre-#651 AssessmentAnnotationWorker's shape and the majority of
11044
- // persisted assessments. Do not switch to an array or to
11043
+ // majority of persisted assessments. Do not switch to an array or to
11045
11044
  // purpose='describing' — that loses the "this is an assessment, not
11046
11045
  // a description" signal and breaks existing readers that access
11047
11046
  // `body.value` directly on the object.
@@ -11109,11 +11108,11 @@ async function processReferenceJob(content, inferenceClient, params, buildAnnota
11109
11108
  params.includeDescriptiveReferences ?? false,
11110
11109
  logger2,
11111
11110
  params.sourceLanguage,
11112
- // Liveness heartbeat (DETECTION-HEARTBEAT): fires at chunk boundaries and
11113
- // every ~15 s while a call is in flight, so a long single-chunk call is
11114
- // not silent. It repeats the current position rather than inventing an
11115
- // advance — the stall watchdog, janitor and client timeout need a signal,
11116
- // not a monotone.
11111
+ // Liveness heartbeat: fires at chunk boundaries and every ~15 s while a
11112
+ // call is in flight, so a long single-chunk call is not silent. It
11113
+ // repeats the current position rather than inventing an advance — the
11114
+ // stall watchdog, janitor and client timeout need a signal, not a
11115
+ // monotone.
11117
11116
  () => emitTypeProgress(entityTypeName),
11118
11117
  (verdict) => {
11119
11118
  underReported = {
@@ -11270,7 +11269,7 @@ async function processGenerationJob(inferenceClient, params, onProgress, logger2
11270
11269
  `Unsupported outputMediaType for generation: ${outputMediaType}. Generation produces ${GENERATABLE_MEDIA_TYPES.join(" or ")}.`
11271
11270
  );
11272
11271
  }
11273
- const title = params.title ?? "Untitled";
11272
+ const title = params.title;
11274
11273
  const entityTypes = (params.entityTypes ?? []).map(String);
11275
11274
  if (outputMediaType === "application/pdf") {
11276
11275
  onProgress(5, { code: "generating-resource" });
@@ -11548,10 +11547,9 @@ function startWorkerProcess(config) {
11548
11547
  // the question never arose, never that durability was ruled out.
11549
11548
  ...error instanceof CommitDurabilityError ? { durability: error.durability } : {},
11550
11549
  // Whether this failure is the END, answered by the same predicate
11551
- // the queue applies at failJob (JOB-RESTART-SAFETY P5). Without
11552
- // it a client cannot tell a recovering run from a dead one: it
11553
- // sees job:fail either way and would end its stream on a job the
11554
- // queue is about to re-run.
11550
+ // the queue applies at failJob. Without it a client cannot tell a
11551
+ // recovering run from a dead one: it sees job:fail either way and
11552
+ // would end its stream on a job the queue is about to re-run.
11555
11553
  willRetry: willRetryAfter(job, failureClass)
11556
11554
  }).catch(() => {
11557
11555
  });
@@ -11676,8 +11674,9 @@ async function handleJobInner(adapter, config, job, completedUnitsByJob, signal,
11676
11674
  // The durability write, per chunk, awaited; folds into the terminal
11677
11675
  // durability evidence like every commit, and carries the unit's cursor.
11678
11676
  commitChunk,
11679
- // …and the other direction: where an earlier attempt left each unit
11680
- // (CHUNK-GRAIN-RESUME P3). Empty on a first attempt.
11677
+ // …and the other direction: where an earlier attempt left each unit, so
11678
+ // a partway unit resumes at its offset instead of the top. Empty on a
11679
+ // first attempt.
11681
11680
  job.unitCursors
11682
11681
  );
11683
11682
  await emitEvent(session, "job:complete", {
@@ -11695,8 +11694,8 @@ async function handleJobInner(adapter, config, job, completedUnitsByJob, signal,
11695
11694
  // The durability write, per chunk, awaited; folds into the terminal
11696
11695
  // durability evidence like every commit, and carries the unit's cursor.
11697
11696
  commitChunk,
11698
- // …and the other direction: where an earlier attempt left each unit
11699
- // (CHUNK-GRAIN-RESUME P3). Empty on a first attempt.
11697
+ // …and the other direction: where an earlier attempt left each unit.
11698
+ // Empty on a first attempt.
11700
11699
  job.unitCursors
11701
11700
  );
11702
11701
  await emitEvent(session, "job:complete", {
@@ -11714,8 +11713,8 @@ async function handleJobInner(adapter, config, job, completedUnitsByJob, signal,
11714
11713
  // The durability write, per chunk, awaited; folds into the terminal
11715
11714
  // durability evidence like every commit, and carries the unit's cursor.
11716
11715
  commitChunk,
11717
- // …and the other direction: where an earlier attempt left each unit
11718
- // (CHUNK-GRAIN-RESUME P3). Empty on a first attempt.
11716
+ // …and the other direction: where an earlier attempt left each unit.
11717
+ // Empty on a first attempt.
11719
11718
  job.unitCursors
11720
11719
  );
11721
11720
  await emitEvent(session, "job:complete", {
@@ -11753,8 +11752,8 @@ async function handleJobInner(adapter, config, job, completedUnitsByJob, signal,
11753
11752
  // The durability write, per chunk, awaited; folds into the terminal
11754
11753
  // durability evidence like every commit, and carries the unit's cursor.
11755
11754
  commitChunk,
11756
- // …and the other direction: where an earlier attempt left each unit
11757
- // (CHUNK-GRAIN-RESUME P3). Empty on a first attempt.
11755
+ // …and the other direction: where an earlier attempt left each unit.
11756
+ // Empty on a first attempt.
11758
11757
  job.unitCursors
11759
11758
  );
11760
11759
  if (signal?.aborted) {
@@ -11780,8 +11779,8 @@ async function handleJobInner(adapter, config, job, completedUnitsByJob, signal,
11780
11779
  // The durability write, per chunk, awaited; folds into the terminal
11781
11780
  // durability evidence like every commit, and carries the unit's cursor.
11782
11781
  commitChunk,
11783
- // …and the other direction: where an earlier attempt left each unit
11784
- // (CHUNK-GRAIN-RESUME P3). Empty on a first attempt.
11782
+ // …and the other direction: where an earlier attempt left each unit.
11783
+ // Empty on a first attempt.
11785
11784
  job.unitCursors
11786
11785
  );
11787
11786
  await emitEvent(session, "job:complete", {
@@ -11801,7 +11800,6 @@ async function handleJobInner(adapter, config, job, completedUnitsByJob, signal,
11801
11800
  onProgress,
11802
11801
  config.logger
11803
11802
  );
11804
- const genParams = job.params;
11805
11803
  const genReferenceId = referenceIdOf(job);
11806
11804
  const storageUri = job.params.storageUri;
11807
11805
  const expectedExtension = capabilitiesOf(genResult.format)?.extension;
@@ -11820,9 +11818,9 @@ async function handleJobInner(adapter, config, job, completedUnitsByJob, signal,
11820
11818
  storageUri,
11821
11819
  sourceResourceId: resourceId,
11822
11820
  ...genReferenceId ? { sourceAnnotationId: genReferenceId } : {},
11823
- ...genParams.prompt ? { generationPrompt: genParams.prompt } : {},
11824
- ...genParams.language ? { language: genParams.language } : {},
11825
- ...genParams.entityTypes && genParams.entityTypes.length > 0 ? { entityTypes: genParams.entityTypes } : {},
11821
+ ...job.params.prompt ? { generationPrompt: job.params.prompt } : {},
11822
+ ...job.params.language ? { language: job.params.language } : {},
11823
+ ...job.params.entityTypes && job.params.entityTypes.length > 0 ? { entityTypes: job.params.entityTypes } : {},
11826
11824
  generator,
11827
11825
  // The resource cites the job it fulfils; who asked for it is derived
11828
11826
  // downstream from that job's events, never stated here.
@@ -11944,26 +11942,25 @@ var WORKER_AWAITED_OPERATIONS = [
11944
11942
  "job:claim",
11945
11943
  "browse:resource-requested",
11946
11944
  // Canonical geometry for a geometry-bearing detection: the consult behind
11947
- // `ConsultAnchoredText` (SMELTER-OWNS-OCR P2). Its omission broke every
11948
- // PDF detection job at the transport probe
11949
- // (.plans/WORKER-ANCHORED-TEXT-CHANNEL.md); the census below now fails the
11945
+ // `ConsultAnchoredText`, answered by the Smelter. Without it every PDF
11946
+ // detection job fails at the transport probe; the census below fails the
11950
11947
  // BUILD when this list and the declared awaits drift.
11951
11948
  "browse:anchored-text-requested",
11952
- // Durability acknowledgement for a unit's annotations (JOB-RESTART-SAFETY
11953
- // P6). The worker AWAITS this one — a unit may not advance until its
11954
- // annotations are in the event log — so its replies must be in the narrow
11955
- // channel set or every commit fails fast with `bus.unsubscribed`.
11949
+ // Durability acknowledgement for a unit's annotations. The worker AWAITS
11950
+ // this one — a unit may not advance until its annotations are in the event
11951
+ // log — so its replies must be in the narrow channel set or every commit
11952
+ // fails fast with `bus.unsubscribed`.
11956
11953
  "mark:commit",
11957
- // The durability probe for a commit whose acknowledgement never routed
11958
- // (COMMIT-ACK-FALSE-FAILURE F1). SINGULAR by design: the annotation LIST
11959
- // channel is the multi-MB fan-out this narrowing exists to keep out, and a
11960
- // rare error path is no reason to let it back in.
11954
+ // The durability probe for a commit whose acknowledgement never routed.
11955
+ // SINGULAR by design: the annotation LIST channel is the multi-MB fan-out
11956
+ // this narrowing exists to keep out, and a rare error path is no reason to
11957
+ // let it in.
11961
11958
  "browse:annotation-requested"
11962
11959
  ];
11963
11960
  var WORKER_CONSUMED_BROADCASTS = [
11964
11961
  // The queue announcement the claim adapter races for.
11965
11962
  "job:queued",
11966
- // Cooperative cancellation of the ACTIVE job (JOB-RESTART-SAFETY P4).
11963
+ // Cooperative cancellation of the ACTIVE job: it stops at a unit boundary.
11967
11964
  "job:cancel-requested"
11968
11965
  ];
11969
11966
  var WORKER_ANSWERED_OPERATIONS = [
@@ -12085,8 +12082,9 @@ async function startAgentWorker(opts) {
12085
12082
  generator,
12086
12083
  // Byte reads for decode-path media only. A geometry-bearing type's text
12087
12084
  // never comes from bytes here — it is CONSULTED from the Smelter's
12088
- // canonical anchored text over the bus (SMELTER-OWNS-OCR P2), and this
12089
- // worker cannot derive even by mistake (READ-VS-EXTRACT P2).
12085
+ // canonical anchored text over the bus, and this worker cannot derive
12086
+ // even by mistake: deriving needs the anchored-text store, which only
12087
+ // the Smelter holds.
12090
12088
  contentReads: contentReads2,
12091
12089
  logger: logger2
12092
12090
  });