@semiont/make-meaning 0.5.32 → 0.5.34

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.
@@ -1,7 +1,7 @@
1
1
  import { createServer } from 'http';
2
2
  import { HttpTransport } from '@semiont/http-transport';
3
3
  import { archivistContentReads } from '@semiont/content';
4
- import { replyChannelsFor, accessToken, EventBus, baseUrl as baseUrl$1, retryWithBackoff, isTransientFetchError, STARTUP_FETCH_RETRY, errField, deriveViews, resourceId, getResourceId, getResourceEntityTypes, annotationId, getTargetSource, getBodySource, getStorageUri, getPrimaryRepresentation, decodeRepresentation, getTargetSelector, getTextPositionSelector } from '@semiont/core';
4
+ import { replyChannelsFor, accessToken, EventBus, withDeadline, baseUrl as baseUrl$1, retryWithBackoff, isTransientFetchError, STARTUP_FETCH_RETRY, errField, deriveViews, resourceId, getResourceId, getResourceEntityTypes, annotationId, getTargetSource, getBodySource, getStorageUri, getPrimaryRepresentation, decodeRepresentation, getTargetSelector, getTextPositionSelector } from '@semiont/core';
5
5
  import { loadEnvironmentConfig, SemiontState } from '@semiont/core/node';
6
6
  import { FilesystemViewStorage } from '@semiont/event-sourcing';
7
7
  import { getGraphDatabase, compareByRecencyThenId } from '@semiont/graph';
@@ -11320,6 +11320,8 @@ function registerGatherSummaryHandler(eventBus, gatherer, parentLogger) {
11320
11320
  }
11321
11321
 
11322
11322
  // src/service.ts
11323
+ var STARTUP_CONNECT_TIMEOUT_MS = 6e4;
11324
+ var RESTART_HINT = "Exiting so the container restart policy can retry \u2014 it is normal for a dependency to be slow when every service restarts at once.";
11323
11325
  function assertMakeMeaningConfig(config2) {
11324
11326
  if (!config2.services?.graph) {
11325
11327
  throw new Error("services.graph is required for make-meaning service");
@@ -11391,8 +11393,9 @@ async function authenticate() {
11391
11393
  );
11392
11394
  }
11393
11395
  async function main() {
11394
- const { initObservabilityNode } = await import('@semiont/observability/node');
11396
+ const { initObservabilityNode, registerSupervisorRestartCount } = await import('@semiont/observability/node');
11395
11397
  initObservabilityNode({ serviceName: "semiont-librarian" });
11398
+ registerSupervisorRestartCount();
11396
11399
  logger.info("Authenticating", { baseUrl });
11397
11400
  const tokenSubject = new import_rxjs3.BehaviorSubject(accessToken(await authenticate()));
11398
11401
  logger.info("Authenticated");
@@ -11414,18 +11417,34 @@ async function main() {
11414
11417
  logger.child({ component: "view-storage" })
11415
11418
  );
11416
11419
  logger.info("Connecting to graph database", { type: graphConfig.type });
11417
- const graphDb = await getGraphDatabase(graphConfig);
11420
+ const graphDb = await withDeadline(
11421
+ "Graph database",
11422
+ STARTUP_CONNECT_TIMEOUT_MS,
11423
+ () => getGraphDatabase(graphConfig),
11424
+ RESTART_HINT
11425
+ );
11418
11426
  const embeddingConfig = config.services.embedding;
11419
11427
  logger.info("Connecting to embedding provider", { type: embeddingConfig.type, model: embeddingConfig.model });
11420
- const embeddingProvider = await createEmbeddingProvider(embeddingConfig);
11428
+ const embeddingProvider = await withDeadline(
11429
+ "Embedding provider",
11430
+ STARTUP_CONNECT_TIMEOUT_MS,
11431
+ () => createEmbeddingProvider(embeddingConfig),
11432
+ RESTART_HINT
11433
+ );
11421
11434
  const vectorsConfig = config.services.vectors;
11422
11435
  logger.info("Connecting to vector store", { type: vectorsConfig.type });
11423
- const vectorStore = await createVectorStore({
11424
- type: vectorsConfig.type,
11425
- host: vectorsConfig.host,
11426
- port: vectorsConfig.port,
11427
- dimensions: () => embeddingProvider.dimensions()
11428
- });
11436
+ const vectorStore = await withDeadline(
11437
+ "Vector store",
11438
+ STARTUP_CONNECT_TIMEOUT_MS,
11439
+ (signal) => createVectorStore({
11440
+ signal,
11441
+ type: vectorsConfig.type,
11442
+ host: vectorsConfig.host,
11443
+ port: vectorsConfig.port,
11444
+ dimensions: () => embeddingProvider.dimensions()
11445
+ }),
11446
+ RESTART_HINT
11447
+ );
11429
11448
  const httpTransport = new HttpTransport({
11430
11449
  baseUrl: baseUrl$1(baseUrl),
11431
11450
  token$: tokenSubject,