@semiont/core 0.5.30 → 0.5.32
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/{chunk-IQGH6UJN.js → chunk-LAKUQM2K.js} +3 -3
- package/dist/{chunk-IQGH6UJN.js.map → chunk-LAKUQM2K.js.map} +1 -1
- package/dist/{chunk-EWOITHBH.js → chunk-W6N56PWO.js} +2 -3
- package/dist/chunk-W6N56PWO.js.map +1 -0
- package/dist/index.d.ts +145 -56
- package/dist/index.js +37 -21
- package/dist/index.js.map +1 -1
- package/dist/openapi.d.ts +6 -3
- package/dist/openapi.js +1690 -1519
- package/dist/openapi.js.map +1 -1
- package/dist/testing/axioms.js +2 -2
- package/dist/testing.js +2 -2
- package/package.json +2 -2
- package/dist/chunk-EWOITHBH.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { createTomlConfigLoader, loadTomlConfig } from './chunk-UGI6IOOX.js';
|
|
2
|
-
import { BUS_OPERATIONS } from './chunk-
|
|
3
|
-
export { BRIDGED_CHANNELS, BUS_OPERATIONS, EventBus, ScopedEventBus, accessToken, annotationUri, authCode, baseUrl, busLog, busLogEnabled, cloneToken, email, entityType, googleCredential, jobId, mcpToken, refreshToken, resourceAnnotationUri, resourceUri, searchQuery, setBusLogTraceIdProvider, userDID } from './chunk-
|
|
2
|
+
import { BUS_OPERATIONS } from './chunk-W6N56PWO.js';
|
|
3
|
+
export { BRIDGED_CHANNELS, BUS_OPERATIONS, EventBus, ScopedEventBus, accessToken, annotationUri, authCode, baseUrl, busLog, busLogEnabled, cloneToken, email, entityType, googleCredential, jobId, mcpToken, refreshToken, resourceAnnotationUri, resourceUri, searchQuery, setBusLogTraceIdProvider, userDID } from './chunk-W6N56PWO.js';
|
|
4
4
|
import './chunk-YLJ4XMA6.js';
|
|
5
5
|
import { Observable, merge, TimeoutError, throwError, firstValueFrom } from 'rxjs';
|
|
6
6
|
import { filter, map, take, timeout, catchError, defaultIfEmpty } from 'rxjs/operators';
|
|
@@ -190,10 +190,6 @@ var CHANNEL_SCHEMAS = {
|
|
|
190
190
|
"browse:anchored-text-result": "BrowseAnchoredTextResult",
|
|
191
191
|
"browse:anchored-text-failed": null,
|
|
192
192
|
// { correlationId } & CommandError
|
|
193
|
-
"browse:anchored-text-by-checksum-requested": "BrowseAnchoredTextByChecksumRequest",
|
|
194
|
-
"browse:anchored-text-by-checksum-result": "BrowseAnchoredTextResult",
|
|
195
|
-
"browse:anchored-text-by-checksum-failed": null,
|
|
196
|
-
// { correlationId } & CommandError
|
|
197
193
|
"browse:resources-requested": "BrowseResourcesRequest",
|
|
198
194
|
"browse:resources-result": "BrowseResourcesResult",
|
|
199
195
|
"browse:resources-failed": null,
|
|
@@ -1753,26 +1749,26 @@ var storedBinary = (extension, label) => ({
|
|
|
1753
1749
|
label,
|
|
1754
1750
|
render: "none",
|
|
1755
1751
|
anchoring: "none",
|
|
1756
|
-
|
|
1752
|
+
textSource: "none",
|
|
1757
1753
|
authorable: false,
|
|
1758
1754
|
uploadable: true,
|
|
1759
1755
|
generatable: false
|
|
1760
1756
|
});
|
|
1761
1757
|
var storedText = (extension, label) => ({
|
|
1762
1758
|
...storedBinary(extension, label),
|
|
1763
|
-
|
|
1759
|
+
textSource: "decode"
|
|
1764
1760
|
});
|
|
1765
1761
|
var MEDIA_TYPES = {
|
|
1766
1762
|
// Full-capability tier
|
|
1767
1763
|
// `generatable: application/pdf` — the Typst renderer (PDF-GENERATION P3):
|
|
1768
1764
|
// the model writes Typst, the worker's pinned binary compiles it.
|
|
1769
|
-
"text/markdown": { extension: ".md", label: "Markdown", render: "text", anchoring: "text-selector",
|
|
1770
|
-
"text/plain": { extension: ".txt", label: "Plain Text", render: "text", anchoring: "text-selector",
|
|
1771
|
-
"text/html": { extension: ".html", label: "HTML", render: "text", anchoring: "text-selector",
|
|
1772
|
-
"application/json": { extension: ".json", label: "JSON", render: "text", anchoring: "text-selector",
|
|
1773
|
-
"image/png": { extension: ".png", label: "PNG image", render: "image", anchoring: "spatial",
|
|
1774
|
-
"image/jpeg": { extension: ".jpg", label: "JPEG image", render: "image", anchoring: "spatial",
|
|
1775
|
-
"application/pdf": { extension: ".pdf", label: "PDF", render: "pdf", anchoring: "spatial",
|
|
1765
|
+
"text/markdown": { extension: ".md", label: "Markdown", render: "text", anchoring: "text-selector", textSource: "decode", authorable: true, uploadable: true, generatable: true },
|
|
1766
|
+
"text/plain": { extension: ".txt", label: "Plain Text", render: "text", anchoring: "text-selector", textSource: "decode", authorable: true, uploadable: true, generatable: true },
|
|
1767
|
+
"text/html": { extension: ".html", label: "HTML", render: "text", anchoring: "text-selector", textSource: "decode", authorable: true, uploadable: true, generatable: false },
|
|
1768
|
+
"application/json": { extension: ".json", label: "JSON", render: "text", anchoring: "text-selector", textSource: "decode", authorable: false, uploadable: true, generatable: false },
|
|
1769
|
+
"image/png": { extension: ".png", label: "PNG image", render: "image", anchoring: "spatial", textSource: "none", authorable: false, uploadable: true, generatable: false },
|
|
1770
|
+
"image/jpeg": { extension: ".jpg", label: "JPEG image", render: "image", anchoring: "spatial", textSource: "none", authorable: false, uploadable: true, generatable: false },
|
|
1771
|
+
"application/pdf": { extension: ".pdf", label: "PDF", render: "pdf", anchoring: "spatial", textSource: "pdf-text-layer", authorable: false, uploadable: true, generatable: true },
|
|
1776
1772
|
// Storage tier — the big tent. Every row is a deliberate admission,
|
|
1777
1773
|
// promotable by editing its row. Text-flavored rows embed (decode).
|
|
1778
1774
|
// Text
|
|
@@ -1878,11 +1874,19 @@ function mediaTypeForExtension(ext) {
|
|
|
1878
1874
|
const dotted = lower.startsWith(".") ? lower : `.${lower}`;
|
|
1879
1875
|
return EXTENSION_TO_MEDIA_TYPE.get(EXTENSION_ALIASES[dotted] ?? dotted);
|
|
1880
1876
|
}
|
|
1881
|
-
function
|
|
1877
|
+
function textSourceOf(format) {
|
|
1882
1878
|
const caps = capabilitiesOf(format);
|
|
1883
|
-
if (caps) return caps.
|
|
1879
|
+
if (caps) return caps.textSource;
|
|
1884
1880
|
return baseMediaType(format).startsWith("text/") ? "decode" : "none";
|
|
1885
1881
|
}
|
|
1882
|
+
var GEOMETRY_BY_STRATEGY = {
|
|
1883
|
+
"decode": false,
|
|
1884
|
+
"pdf-text-layer": true,
|
|
1885
|
+
"none": false
|
|
1886
|
+
};
|
|
1887
|
+
function yieldsGeometryOf(format) {
|
|
1888
|
+
return GEOMETRY_BY_STRATEGY[textSourceOf(format)];
|
|
1889
|
+
}
|
|
1886
1890
|
function isAnnotatable(format) {
|
|
1887
1891
|
const caps = capabilitiesOf(format);
|
|
1888
1892
|
return caps !== void 0 && caps.anchoring !== "none";
|
|
@@ -1892,7 +1896,7 @@ var AUTHORABLE_MEDIA_TYPES = REGISTRY_KEYS.filter(
|
|
|
1892
1896
|
(type) => MEDIA_TYPES[type].authorable
|
|
1893
1897
|
);
|
|
1894
1898
|
var EMBEDDABLE_MEDIA_TYPES = REGISTRY_KEYS.filter(
|
|
1895
|
-
(type) => MEDIA_TYPES[type].
|
|
1899
|
+
(type) => MEDIA_TYPES[type].textSource !== "none"
|
|
1896
1900
|
);
|
|
1897
1901
|
var GENERATABLE_MEDIA_TYPES = REGISTRY_KEYS.filter(
|
|
1898
1902
|
(type) => MEDIA_TYPES[type].generatable
|
|
@@ -2167,6 +2171,9 @@ function deriveViews(graph, mainResourceId, focalAnnotationId) {
|
|
|
2167
2171
|
}
|
|
2168
2172
|
|
|
2169
2173
|
// src/retry.ts
|
|
2174
|
+
function equalJitter(cap) {
|
|
2175
|
+
return cap / 2 + Math.random() * (cap / 2);
|
|
2176
|
+
}
|
|
2170
2177
|
var STARTUP_FETCH_RETRY = {
|
|
2171
2178
|
attempts: 8,
|
|
2172
2179
|
initialDelayMs: 1e3,
|
|
@@ -2178,16 +2185,25 @@ function isTransientFetchError(error) {
|
|
|
2178
2185
|
const code = error.cause?.code;
|
|
2179
2186
|
return typeof code === "string" && code.length > 0;
|
|
2180
2187
|
}
|
|
2188
|
+
var RETRYABLE_STATUSES = /* @__PURE__ */ new Set([429, 503, 504]);
|
|
2189
|
+
function isRetryableRequestError(error) {
|
|
2190
|
+
if (isTransientFetchError(error)) return true;
|
|
2191
|
+
if (typeof error !== "object" || error === null) return false;
|
|
2192
|
+
if (error.name === "TimeoutError") return true;
|
|
2193
|
+
const status = error.status;
|
|
2194
|
+
return typeof status === "number" && RETRYABLE_STATUSES.has(status);
|
|
2195
|
+
}
|
|
2181
2196
|
async function retryWithBackoff(fn, isRetryable, policy, onRetry) {
|
|
2182
|
-
let
|
|
2197
|
+
let cap = policy.initialDelayMs;
|
|
2183
2198
|
for (let attempt = 1; ; attempt++) {
|
|
2184
2199
|
try {
|
|
2185
2200
|
return await fn();
|
|
2186
2201
|
} catch (error) {
|
|
2187
2202
|
if (attempt >= policy.attempts || !isRetryable(error)) throw error;
|
|
2203
|
+
const delayMs = equalJitter(cap);
|
|
2188
2204
|
onRetry?.({ attempt, attempts: policy.attempts, delayMs, error });
|
|
2189
2205
|
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
2190
|
-
|
|
2206
|
+
cap = Math.min(cap * 2, policy.maxDelayMs);
|
|
2191
2207
|
}
|
|
2192
2208
|
}
|
|
2193
2209
|
}
|
|
@@ -2222,6 +2238,6 @@ function getShardPath(key, numBuckets = 65536) {
|
|
|
2222
2238
|
// src/discovery.ts
|
|
2223
2239
|
var DISCOVERY_URL_PATH = "/discovery/kbs.json";
|
|
2224
2240
|
|
|
2225
|
-
export { AUTHORABLE_MEDIA_TYPES, BusRequestError, CHANNEL_SCHEMAS, CONTEXT_FULL_WEIGHT, CONTEXT_PARTIAL_WEIGHT, ConfigurationError, ConflictError, DEFAULT_CHUNKING_CONFIG, DISCOVERY_URL_PATH, EMBEDDABLE_MEDIA_TYPES, GENERATABLE_MEDIA_TYPES, JWTTokenSchema, LOCALES, MEDIA_TYPES, NotFoundError, PERSISTED_EVENT_TYPES, POSITION_WEIGHT_MAX, POSITION_WINDOW, RESOURCE_BROADCAST_TYPES, STARTUP_FETCH_RETRY, ScriptError, SemiontError, UnauthorizedError, ValidationError, agentToDid, anchorAnnotation, anchorRuns, annotationId, applyBodyOperations, assembleAnnotation, baseMediaType, buildContentCache, burstBuffer, busRequest, capabilitiesOf, chunkText, cloneFormat, createCircleSvg, createFragmentSelector, createPolygonSvg, createRectangleSvg, decodeRepresentation, decodeWithCharset, deriveStorageUri, deriveViews, didToAgent, errField, estimateTokens, extensionForMediaType, extractBoundingBox, extractCharset, extractContext, findBestTextMatch, findBodyItem, findClaimSpan, folderOf, formatLocaleDisplay, generateUuid, getAllLocaleCodes, getAllPlatformTypes, getAnnotationExactText, getAnnotationUriFromEvent, getBodySource, getBodyType, getChecksum, getCommentText, getCreator, getDerivedFrom, getExactText, getFragmentSelector, getLanguage, getLocaleEnglishName, getLocaleInfo, getLocaleNativeName, getNodeEncoding, getPageFromFragment, getPrimaryMediaType, getPrimaryRepresentation, getPrimarySelector, getResourceEntityTypes, getResourceId, getShardPath, getStorageUri, getSvgSelector, getTargetSelector, getTargetSource, getTextPositionSelector, getTextQuoteSelector, hasTargetSelector, isAnnotatable, isAnnotationId, isArchived, isArray, isAssessment, isBodyResolved, isBoolean, isComment, isDefined, isDraft, isEventRelatedToAnnotation, isFunction, isGatheredContext, isGenerationJobParams, isHighlight, isNull, isNullish, isNumber, isObject, isReference, isResolvedReference, isResourceId, isStoredEvent, isString, isStubReference, isSupportedMediaType, isTag, isTextRun, isTransientFetchError, isUndefined, isValidEmail, isValidPlatformType, jumpConsistentHash, kbDid, locate, mediaTypeForExtension, normalizeCoordinates, normalizeText, parseEnvironment, parseFragmentSelector, parseSvgSelector, proposeStoragePath, reconcileSelector, replyChannelsFor, resourceId, retryWithBackoff, scaleSvgToNative, serializePerKey, softwareToAgent, storageFileName,
|
|
2241
|
+
export { AUTHORABLE_MEDIA_TYPES, BusRequestError, CHANNEL_SCHEMAS, CONTEXT_FULL_WEIGHT, CONTEXT_PARTIAL_WEIGHT, ConfigurationError, ConflictError, DEFAULT_CHUNKING_CONFIG, DISCOVERY_URL_PATH, EMBEDDABLE_MEDIA_TYPES, GENERATABLE_MEDIA_TYPES, JWTTokenSchema, LOCALES, MEDIA_TYPES, NotFoundError, PERSISTED_EVENT_TYPES, POSITION_WEIGHT_MAX, POSITION_WINDOW, RESOURCE_BROADCAST_TYPES, STARTUP_FETCH_RETRY, ScriptError, SemiontError, UnauthorizedError, ValidationError, agentToDid, anchorAnnotation, anchorRuns, annotationId, applyBodyOperations, assembleAnnotation, baseMediaType, buildContentCache, burstBuffer, busRequest, capabilitiesOf, chunkText, cloneFormat, createCircleSvg, createFragmentSelector, createPolygonSvg, createRectangleSvg, decodeRepresentation, decodeWithCharset, deriveStorageUri, deriveViews, didToAgent, errField, estimateTokens, extensionForMediaType, extractBoundingBox, extractCharset, extractContext, findBestTextMatch, findBodyItem, findClaimSpan, folderOf, formatLocaleDisplay, generateUuid, getAllLocaleCodes, getAllPlatformTypes, getAnnotationExactText, getAnnotationUriFromEvent, getBodySource, getBodyType, getChecksum, getCommentText, getCreator, getDerivedFrom, getExactText, getFragmentSelector, getLanguage, getLocaleEnglishName, getLocaleInfo, getLocaleNativeName, getNodeEncoding, getPageFromFragment, getPrimaryMediaType, getPrimaryRepresentation, getPrimarySelector, getResourceEntityTypes, getResourceId, getShardPath, getStorageUri, getSvgSelector, getTargetSelector, getTargetSource, getTextPositionSelector, getTextQuoteSelector, hasTargetSelector, isAnnotatable, isAnnotationId, isArchived, isArray, isAssessment, isBodyResolved, isBoolean, isComment, isDefined, isDraft, isEventRelatedToAnnotation, isFunction, isGatheredContext, isGenerationJobParams, isHighlight, isNull, isNullish, isNumber, isObject, isReference, isResolvedReference, isResourceId, isRetryableRequestError, isStoredEvent, isString, isStubReference, isSupportedMediaType, isTag, isTextRun, isTransientFetchError, isUndefined, isValidEmail, isValidPlatformType, jumpConsistentHash, kbDid, locate, mediaTypeForExtension, normalizeCoordinates, normalizeText, parseEnvironment, parseFragmentSelector, parseSvgSelector, proposeStoragePath, reconcileSelector, replyChannelsFor, resourceId, retryWithBackoff, scaleSvgToNative, serializePerKey, softwareToAgent, storageFileName, textSourceOf, textUnder, userId, userToAgent, userToDid, uuidV4, validateData, validateEnvironment, validateSvgMarkup, verifyPosition, yieldsGeometryOf };
|
|
2226
2242
|
//# sourceMappingURL=index.js.map
|
|
2227
2243
|
//# sourceMappingURL=index.js.map
|