@semiont/jobs 0.6.7 → 0.6.8
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/README.md +27 -64
- package/dist/index.d.ts +215 -522
- package/dist/index.js +9281 -974
- package/dist/index.js.map +1 -1
- package/dist/worker-main.js +4 -21
- package/dist/worker-main.js.map +1 -1
- package/package.json +9 -10
package/dist/worker-main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { replyChannelsFor, createTomlConfigLoader, didToAgent, baseUrl, STARTUP_FETCH_RETRY, retryWithBackoff, serviceAccountToken, isTransientFetchError, isObject, isString, isNumber, RETRY_RULES, resourceId, getPrimaryMediaType, isGenerationJobParams, capabilitiesOf, assembleAnnotation, findClaimSpan, busRequest, BusRequestError, isArray, textSourceOf, yieldsGeometryOf, decodeRepresentation, GENERATABLE_MEDIA_TYPES, locate, createFragmentSelector, deriveViews, annotationId, estimateTokens, reconcileSelector, getLocaleEnglishName, cutChunk, chunkText } from '@semiont/core';
|
|
1
|
+
import { JOB_TYPES, replyChannelsFor, createTomlConfigLoader, didToAgent, baseUrl, STARTUP_FETCH_RETRY, retryWithBackoff, serviceAccountToken, isTransientFetchError, isObject, isString, isNumber, RETRY_RULES, resourceId, getPrimaryMediaType, isGenerationJobParams, capabilitiesOf, assembleAnnotation, findClaimSpan, busRequest, BusRequestError, isArray, textSourceOf, yieldsGeometryOf, decodeRepresentation, GENERATABLE_MEDIA_TYPES, locate, createFragmentSelector, deriveViews, annotationId, estimateTokens, reconcileSelector, getLocaleEnglishName, cutChunk, chunkText } from '@semiont/core';
|
|
2
2
|
import { archivistContentReads, extractPdfTextLayer, withinByteBudget, MAX_PDF_BYTES } from '@semiont/content';
|
|
3
3
|
import { withSpan, SpanKind, recordJobOutcome, recordAnchorOutcome, recordDetectionCall } from '@semiont/observability';
|
|
4
4
|
import { createInferenceClient, answerLimitsRequests, StructuredReadError } from '@semiont/inference';
|
|
@@ -9384,18 +9384,9 @@ function createJobClaimAdapter(options) {
|
|
|
9384
9384
|
function willRetryAfter(metadata, failureClass) {
|
|
9385
9385
|
return failureClass !== "deterministic" && metadata.retryCount < metadata.maxRetries;
|
|
9386
9386
|
}
|
|
9387
|
-
|
|
9388
|
-
// src/types.ts
|
|
9389
|
-
var JOB_TYPES = /* @__PURE__ */ new Set([
|
|
9390
|
-
"reference-annotation",
|
|
9391
|
-
"generation",
|
|
9392
|
-
"highlight-annotation",
|
|
9393
|
-
"assessment-annotation",
|
|
9394
|
-
"comment-annotation",
|
|
9395
|
-
"tag-annotation"
|
|
9396
|
-
]);
|
|
9387
|
+
var KNOWN_JOB_TYPES = new Set(JOB_TYPES);
|
|
9397
9388
|
function isJobType(value) {
|
|
9398
|
-
return
|
|
9389
|
+
return KNOWN_JOB_TYPES.has(value);
|
|
9399
9390
|
}
|
|
9400
9391
|
function asJobParams(params) {
|
|
9401
9392
|
if (typeof params.resourceId !== "string") {
|
|
@@ -12163,14 +12154,6 @@ async function startAgentWorker(opts) {
|
|
|
12163
12154
|
}
|
|
12164
12155
|
};
|
|
12165
12156
|
}
|
|
12166
|
-
var ALL_JOB_TYPES = [
|
|
12167
|
-
"reference-annotation",
|
|
12168
|
-
"generation",
|
|
12169
|
-
"highlight-annotation",
|
|
12170
|
-
"assessment-annotation",
|
|
12171
|
-
"comment-annotation",
|
|
12172
|
-
"tag-annotation"
|
|
12173
|
-
];
|
|
12174
12157
|
var configPath = join(homedir(), ".semiontconfig");
|
|
12175
12158
|
var tomlReader = {
|
|
12176
12159
|
readIfExists: (p) => existsSync(p) ? readFileSync(p, "utf-8") : null
|
|
@@ -12227,7 +12210,7 @@ function toClientConfig(w) {
|
|
|
12227
12210
|
};
|
|
12228
12211
|
}
|
|
12229
12212
|
var groups = /* @__PURE__ */ new Map();
|
|
12230
|
-
for (const jobType of
|
|
12213
|
+
for (const jobType of JOB_TYPES) {
|
|
12231
12214
|
const inference = resolveWorker(jobType);
|
|
12232
12215
|
const key = clientKey(inference);
|
|
12233
12216
|
let group = groups.get(key);
|