@semiont/core 0.5.26 → 0.5.28

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.js CHANGED
@@ -1,6 +1,7 @@
1
- export { createTomlConfigLoader, loadTomlConfig } from './chunk-XQTWEBJ5.js';
2
- import { BUS_OPERATIONS } from './chunk-FMFOBVTE.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-FMFOBVTE.js';
1
+ export { createTomlConfigLoader, loadTomlConfig } from './chunk-JWTQJVKM.js';
2
+ import { BUS_OPERATIONS } from './chunk-CUPZGI7I.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-CUPZGI7I.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
 
@@ -45,7 +46,6 @@ var PERSISTED_EVENT_TYPES = [
45
46
  "frame:entity-type-added",
46
47
  "frame:tag-schema-added",
47
48
  "job:started",
48
- "job:progress",
49
49
  "job:completed",
50
50
  "job:failed"
51
51
  ];
@@ -218,9 +218,10 @@ var CHANNEL_SCHEMAS = {
218
218
  "browse:directory-result": "BrowseDirectoryResult",
219
219
  "browse:directory-failed": null,
220
220
  // { correlationId; path } & CommandError
221
- "browse:click": null,
221
+ "browse:click": "BrowseClickEvent",
222
222
  // includes runtime `anchorRect?: AnchorRect`
223
- "browse:reference-navigate": "BrowseReferenceNavigateEvent",
223
+ "browse:resource-open": "BrowseResourceOpenEvent",
224
+ "browse:resource-viewed": "BrowseResourceViewedEvent",
224
225
  "browse:entity-type-clicked": "BrowseEntityTypeClickedEvent",
225
226
  // ── SHELL (app-scoped UI events, fire on SemiontBrowser bus) ────
226
227
  "panel:toggle": "BrowsePanelToggleEvent",
@@ -243,7 +244,6 @@ var CHANNEL_SCHEMAS = {
243
244
  // ── JOB FLOW ────────────────────────────────────────────────────
244
245
  "job:started": null,
245
246
  // StoredEvent
246
- "job:progress": null,
247
247
  "job:completed": null,
248
248
  "job:failed": null,
249
249
  "job:start": "JobStartCommand",
@@ -291,8 +291,10 @@ var CHANNEL_SCHEMAS = {
291
291
  // Record<string, never>
292
292
  "replay-window-exceeded": null,
293
293
  // inline payload
294
- "bus:resume-gap": null
294
+ "bus:resume-gap": null,
295
295
  // inline payload
296
+ "session:joined": "SessionJoinedEvent",
297
+ "session:left": "SessionLeftEvent"
296
298
  };
297
299
 
298
300
  // src/event-utils.ts
@@ -1928,6 +1930,16 @@ function isNullish(value) {
1928
1930
  function isDefined(value) {
1929
1931
  return value !== null && value !== void 0;
1930
1932
  }
1933
+ function isGenerationJobParams(value) {
1934
+ if (!isObject(value)) return false;
1935
+ return typeof value.title === "string" && typeof value.storageUri === "string" && isObject(value.context);
1936
+ }
1937
+ function isGatheredContext(value) {
1938
+ if (!isObject(value)) return false;
1939
+ if (!isObject(value.focus)) return false;
1940
+ if (!isObject(value.graph)) return false;
1941
+ return isArray(value.graph.nodes) && isArray(value.graph.edges);
1942
+ }
1931
1943
 
1932
1944
  // src/did-utils.ts
1933
1945
  function kbDid(domain) {
@@ -2054,13 +2066,20 @@ function getAllPlatformTypes() {
2054
2066
  // src/knowledge-graph-views.ts
2055
2067
  function deriveViews(graph, mainResourceId, focalAnnotationId) {
2056
2068
  const nodeById = new Map(graph.nodes.map((n) => [n.id, n]));
2069
+ const annotationOf = /* @__PURE__ */ new Map();
2070
+ for (const edge of graph.edges) {
2071
+ if (edge.type === "annotation-of") annotationOf.set(edge.source, edge.target);
2072
+ }
2057
2073
  const connections = [];
2058
2074
  const citedBy = [];
2075
+ const citingSeen = /* @__PURE__ */ new Set();
2059
2076
  for (const edge of graph.edges) {
2060
- if (edge.type === "citation") {
2061
- if (edge.target !== mainResourceId) continue;
2062
- const node = nodeById.get(edge.source);
2063
- citedBy.push({ resourceId: edge.source, resourceName: node?.label ?? edge.source });
2077
+ const citingResource = edge.type === "cites" && edge.target === mainResourceId ? annotationOf.get(edge.source) : void 0;
2078
+ if (citingResource !== void 0) {
2079
+ if (citingSeen.has(citingResource)) continue;
2080
+ citingSeen.add(citingResource);
2081
+ const node = nodeById.get(citingResource);
2082
+ citedBy.push({ resourceId: citingResource, resourceName: node?.label ?? citingResource });
2064
2083
  } else if (edge.source === mainResourceId) {
2065
2084
  const node = nodeById.get(edge.target);
2066
2085
  connections.push({
@@ -2073,7 +2092,7 @@ function deriveViews(graph, mainResourceId, focalAnnotationId) {
2073
2092
  }
2074
2093
  const siblingEntityTypes = /* @__PURE__ */ new Set();
2075
2094
  for (const node of graph.nodes) {
2076
- if (node.type === "annotation" && node.id !== focalAnnotationId) {
2095
+ if (node.type === "annotation" && node.id !== focalAnnotationId && annotationOf.get(node.id) === mainResourceId) {
2077
2096
  for (const et of node.entityTypes ?? []) siblingEntityTypes.add(et);
2078
2097
  }
2079
2098
  }
@@ -2141,6 +2160,6 @@ function getShardPath(key, numBuckets = 65536) {
2141
2160
  // src/discovery.ts
2142
2161
  var DISCOVERY_URL_PATH = "/discovery/kbs.json";
2143
2162
 
2144
- 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, 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 };
2163
+ 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 };
2145
2164
  //# sourceMappingURL=index.js.map
2146
2165
  //# sourceMappingURL=index.js.map