@semiont/core 0.5.27 → 0.5.29
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 +9 -9
- package/dist/{chunk-PPUO5IPX.js → chunk-45YGPHDK.js} +7 -7
- package/dist/{chunk-PPUO5IPX.js.map → chunk-45YGPHDK.js.map} +1 -1
- package/dist/{chunk-CUPZGI7I.js → chunk-MM4HBHMM.js} +19 -4
- package/dist/chunk-MM4HBHMM.js.map +1 -0
- package/dist/{chunk-JWTQJVKM.js → chunk-VBMXNYPL.js} +33 -16
- package/dist/chunk-VBMXNYPL.js.map +1 -0
- package/dist/chunk-YLJ4XMA6.js +33 -0
- package/dist/chunk-YLJ4XMA6.js.map +1 -0
- package/dist/config/node-config-loader.d.ts +147 -93
- package/dist/config/node-config-loader.js +78 -50
- package/dist/config/node-config-loader.js.map +1 -1
- package/dist/index.d.ts +495 -782
- package/dist/index.js +54 -11
- package/dist/index.js.map +1 -1
- package/dist/openapi.d.ts +725 -0
- package/dist/openapi.js +46980 -0
- package/dist/openapi.js.map +1 -0
- package/dist/testing/axioms.js +3 -2
- package/dist/testing/axioms.js.map +1 -1
- package/dist/testing.d.ts +4 -4
- package/dist/testing.js +3 -2
- package/package.json +15 -9
- package/dist/chunk-CUPZGI7I.js.map +0 -1
- package/dist/chunk-JWTQJVKM.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export { createTomlConfigLoader, loadTomlConfig } from './chunk-
|
|
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-
|
|
1
|
+
export { createTomlConfigLoader, loadTomlConfig } from './chunk-VBMXNYPL.js';
|
|
2
|
+
import { BUS_OPERATIONS } from './chunk-MM4HBHMM.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-MM4HBHMM.js';
|
|
4
|
+
import './chunk-YLJ4XMA6.js';
|
|
4
5
|
import { Observable, merge, TimeoutError, throwError, firstValueFrom } from 'rxjs';
|
|
5
6
|
import { filter, map, take, timeout, catchError, defaultIfEmpty } from 'rxjs/operators';
|
|
6
7
|
|
|
@@ -70,6 +71,7 @@ var CHANNEL_SCHEMAS = {
|
|
|
70
71
|
"yield:representation-added": null,
|
|
71
72
|
"yield:representation-removed": null,
|
|
72
73
|
"yield:create": "YieldCreateCommand",
|
|
74
|
+
"yield:clone-persist": "YieldClonePersistCommand",
|
|
73
75
|
"yield:update": "YieldUpdateCommand",
|
|
74
76
|
"yield:mv": "YieldMvCommand",
|
|
75
77
|
"yield:clone": null,
|
|
@@ -79,6 +81,9 @@ var CHANNEL_SCHEMAS = {
|
|
|
79
81
|
"yield:clone-create": "YieldCloneCreateCommand",
|
|
80
82
|
"yield:create-ok": "YieldCreateOk",
|
|
81
83
|
"yield:create-failed": "CommandError",
|
|
84
|
+
"yield:clone-persist-ok": "YieldClonePersistOk",
|
|
85
|
+
"yield:clone-persist-failed": null,
|
|
86
|
+
// { correlationId } & CommandError
|
|
82
87
|
"yield:update-ok": "YieldUpdateOk",
|
|
83
88
|
"yield:update-failed": null,
|
|
84
89
|
// { correlationId } & CommandError
|
|
@@ -182,6 +187,10 @@ var CHANNEL_SCHEMAS = {
|
|
|
182
187
|
"browse:anchored-text-result": "BrowseAnchoredTextResult",
|
|
183
188
|
"browse:anchored-text-failed": null,
|
|
184
189
|
// { correlationId } & CommandError
|
|
190
|
+
"browse:anchored-text-by-checksum-requested": "BrowseAnchoredTextByChecksumRequest",
|
|
191
|
+
"browse:anchored-text-by-checksum-result": "BrowseAnchoredTextResult",
|
|
192
|
+
"browse:anchored-text-by-checksum-failed": null,
|
|
193
|
+
// { correlationId } & CommandError
|
|
185
194
|
"browse:resources-requested": "BrowseResourcesRequest",
|
|
186
195
|
"browse:resources-result": "BrowseResourcesResult",
|
|
187
196
|
"browse:resources-failed": null,
|
|
@@ -264,7 +273,7 @@ var CHANNEL_SCHEMAS = {
|
|
|
264
273
|
"job:claim-failed": null,
|
|
265
274
|
"job:cancel-ok": null,
|
|
266
275
|
"job:cancel-failed": "CommandError",
|
|
267
|
-
// ── SETTINGS (
|
|
276
|
+
// ── SETTINGS (Browser-only) ────────────────────────────────────
|
|
268
277
|
"settings:theme-changed": "SettingsThemeChangedEvent",
|
|
269
278
|
"settings:line-numbers-toggled": null,
|
|
270
279
|
// void
|
|
@@ -1816,6 +1825,10 @@ function isSupportedMediaType(format) {
|
|
|
1816
1825
|
function capabilitiesOf(format) {
|
|
1817
1826
|
return REGISTRY[baseMediaType(format)];
|
|
1818
1827
|
}
|
|
1828
|
+
function cloneFormat(sourceMediaType) {
|
|
1829
|
+
const base = baseMediaType(sourceMediaType ?? "text/plain");
|
|
1830
|
+
return isSupportedMediaType(base) && capabilitiesOf(base)?.authorable ? base : "text/plain";
|
|
1831
|
+
}
|
|
1819
1832
|
function extensionForMediaType(format) {
|
|
1820
1833
|
return capabilitiesOf(format)?.extension ?? ".dat";
|
|
1821
1834
|
}
|
|
@@ -1843,6 +1856,10 @@ function textExtractionOf(format) {
|
|
|
1843
1856
|
if (caps) return caps.extractText;
|
|
1844
1857
|
return baseMediaType(format).startsWith("text/") ? "decode" : "none";
|
|
1845
1858
|
}
|
|
1859
|
+
function isAnnotatable(format) {
|
|
1860
|
+
const caps = capabilitiesOf(format);
|
|
1861
|
+
return caps !== void 0 && caps.anchoring !== "none";
|
|
1862
|
+
}
|
|
1846
1863
|
var REGISTRY_KEYS = Object.keys(MEDIA_TYPES);
|
|
1847
1864
|
var AUTHORABLE_MEDIA_TYPES = REGISTRY_KEYS.filter(
|
|
1848
1865
|
(type) => MEDIA_TYPES[type].authorable
|
|
@@ -1898,6 +1915,25 @@ function chunkText(text, config = DEFAULT_CHUNKING_CONFIG) {
|
|
|
1898
1915
|
return chunks.filter((c) => c.length > 0);
|
|
1899
1916
|
}
|
|
1900
1917
|
|
|
1918
|
+
// src/storage-uri.ts
|
|
1919
|
+
function storageFileName(name, format) {
|
|
1920
|
+
const slug = name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
1921
|
+
return `${slug}${MEDIA_TYPES[format].extension}`;
|
|
1922
|
+
}
|
|
1923
|
+
function deriveStorageUri(name, format) {
|
|
1924
|
+
return `file://${storageFileName(name, format)}`;
|
|
1925
|
+
}
|
|
1926
|
+
function folderOf(storageUri) {
|
|
1927
|
+
const path = (storageUri ?? "").replace(/^file:\/\//, "");
|
|
1928
|
+
const cut = path.lastIndexOf("/");
|
|
1929
|
+
return cut === -1 ? "" : path.slice(0, cut);
|
|
1930
|
+
}
|
|
1931
|
+
function proposeStoragePath(folder, title, format) {
|
|
1932
|
+
const name = storageFileName(title, format);
|
|
1933
|
+
if (name === MEDIA_TYPES[format].extension) return "";
|
|
1934
|
+
return folder ? `${folder}/${name}` : name;
|
|
1935
|
+
}
|
|
1936
|
+
|
|
1901
1937
|
// src/type-guards.ts
|
|
1902
1938
|
function isString(value) {
|
|
1903
1939
|
return typeof value === "string";
|
|
@@ -1931,7 +1967,7 @@ function isDefined(value) {
|
|
|
1931
1967
|
}
|
|
1932
1968
|
function isGenerationJobParams(value) {
|
|
1933
1969
|
if (!isObject(value)) return false;
|
|
1934
|
-
return typeof value.title === "string" && typeof value.storageUri === "string" && isObject(value.context);
|
|
1970
|
+
return typeof value.title === "string" && value.title.length > 0 && typeof value.storageUri === "string" && value.storageUri.length > 0 && isObject(value.context);
|
|
1935
1971
|
}
|
|
1936
1972
|
function isGatheredContext(value) {
|
|
1937
1973
|
if (!isObject(value)) return false;
|
|
@@ -2065,13 +2101,20 @@ function getAllPlatformTypes() {
|
|
|
2065
2101
|
// src/knowledge-graph-views.ts
|
|
2066
2102
|
function deriveViews(graph, mainResourceId, focalAnnotationId) {
|
|
2067
2103
|
const nodeById = new Map(graph.nodes.map((n) => [n.id, n]));
|
|
2104
|
+
const annotationOf = /* @__PURE__ */ new Map();
|
|
2105
|
+
for (const edge of graph.edges) {
|
|
2106
|
+
if (edge.type === "annotation-of") annotationOf.set(edge.source, edge.target);
|
|
2107
|
+
}
|
|
2068
2108
|
const connections = [];
|
|
2069
2109
|
const citedBy = [];
|
|
2110
|
+
const citingSeen = /* @__PURE__ */ new Set();
|
|
2070
2111
|
for (const edge of graph.edges) {
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2112
|
+
const citingResource = edge.type === "cites" && edge.target === mainResourceId ? annotationOf.get(edge.source) : void 0;
|
|
2113
|
+
if (citingResource !== void 0) {
|
|
2114
|
+
if (citingSeen.has(citingResource)) continue;
|
|
2115
|
+
citingSeen.add(citingResource);
|
|
2116
|
+
const node = nodeById.get(citingResource);
|
|
2117
|
+
citedBy.push({ resourceId: citingResource, resourceName: node?.label ?? citingResource });
|
|
2075
2118
|
} else if (edge.source === mainResourceId) {
|
|
2076
2119
|
const node = nodeById.get(edge.target);
|
|
2077
2120
|
connections.push({
|
|
@@ -2084,7 +2127,7 @@ function deriveViews(graph, mainResourceId, focalAnnotationId) {
|
|
|
2084
2127
|
}
|
|
2085
2128
|
const siblingEntityTypes = /* @__PURE__ */ new Set();
|
|
2086
2129
|
for (const node of graph.nodes) {
|
|
2087
|
-
if (node.type === "annotation" && node.id !== focalAnnotationId) {
|
|
2130
|
+
if (node.type === "annotation" && node.id !== focalAnnotationId && annotationOf.get(node.id) === mainResourceId) {
|
|
2088
2131
|
for (const et of node.entityTypes ?? []) siblingEntityTypes.add(et);
|
|
2089
2132
|
}
|
|
2090
2133
|
}
|
|
@@ -2152,6 +2195,6 @@ function getShardPath(key, numBuckets = 65536) {
|
|
|
2152
2195
|
// src/discovery.ts
|
|
2153
2196
|
var DISCOVERY_URL_PATH = "/discovery/kbs.json";
|
|
2154
2197
|
|
|
2155
|
-
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, createCircleSvg, createFragmentSelector, createPolygonSvg, createRectangleSvg, decodeRepresentation, decodeWithCharset, deriveViews, didToAgent, errField, estimateTokens, extensionForMediaType, extractBoundingBox, extractCharset, extractContext, findBestTextMatch, findBodyItem, findClaimSpan, 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, 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, reconcileSelector, resourceId, retryWithBackoff, scaleSvgToNative, serializePerKey, softwareToAgent, textExtractionOf, textUnder, userId, userToAgent, userToDid, uuidV4, validateData, validateEnvironment, validateSvgMarkup, verifyPosition };
|
|
2198
|
+
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, resourceId, retryWithBackoff, scaleSvgToNative, serializePerKey, softwareToAgent, storageFileName, textExtractionOf, textUnder, userId, userToAgent, userToDid, uuidV4, validateData, validateEnvironment, validateSvgMarkup, verifyPosition };
|
|
2156
2199
|
//# sourceMappingURL=index.js.map
|
|
2157
2200
|
//# sourceMappingURL=index.js.map
|