@semiont/make-meaning 0.5.33 → 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.
package/dist/index.d.ts CHANGED
@@ -1675,6 +1675,9 @@ declare class Smelter {
1675
1675
  */
1676
1676
  private classifyEmbeddable;
1677
1677
  /** Page through `browse:resources-requested` until the catalog is exhausted. */
1678
+ /** Shared with the weaver since 2026-09-09 — see `browse-resources.ts` for why the
1679
+ * retry lives at the page rather than around the pass. `archived: false` is
1680
+ * the smelter's own filter and the one difference between the two loops. */
1678
1681
  private listAllResources;
1679
1682
  }
1680
1683
 
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { STALL_THRESHOLD_MS, FsJobQueue } from '@semiont/jobs';
2
2
  import { FilesystemViewStorage, resolveStorageUri, EventQuery, createEventStore } from '@semiont/event-sourcing';
3
- import { getResourceEntityTypes, getResourceId, getTargetSource, resourceId, decodeRepresentation, getBodySource, getStorageUri, getPrimaryRepresentation, getTargetSelector, deriveViews, getTextPositionSelector, annotationId, errField, userId, generateUuid, getExactText, busRequest, cloneToken, assembleAnnotation, applyBodyOperations, didToAgent, isGenerationJobParams, jobId, entityType, baseUrl, busLog, BRIDGED_CHANNELS, burstBuffer, textSourceOf, chunkText, getPrimaryMediaType, yieldsGeometryOf, isAnnotatable, softwareToAgent } from '@semiont/core';
3
+ import { getResourceEntityTypes, getResourceId, getTargetSource, resourceId, decodeRepresentation, getBodySource, getStorageUri, getPrimaryRepresentation, getTargetSelector, deriveViews, getTextPositionSelector, annotationId, errField, userId, generateUuid, getExactText, busRequest, cloneToken, assembleAnnotation, applyBodyOperations, didToAgent, isGenerationJobParams, jobId, entityType, baseUrl, busLog, BRIDGED_CHANNELS, burstBuffer, textSourceOf, chunkText, getPrimaryMediaType, yieldsGeometryOf, isAnnotatable, retryWithBackoff, isPeerUnavailable, withDeadline, softwareToAgent } from '@semiont/core';
4
4
  import { recordGatherDegrade, withActorSpan, recordBusEmit, withSpan, SpanKind, registerJobQueueProvider, registerVectorIndexSizeProvider } from '@semiont/observability';
5
5
  import { createInferenceClient } from '@semiont/inference';
6
6
  import { compareByRecencyThenId, getGraphDatabase } from '@semiont/graph';
@@ -13420,43 +13420,36 @@ async function createJobQueue(state, eventBus, logger) {
13420
13420
  return { jobQueue, jobStatusSubscription };
13421
13421
  }
13422
13422
  var STARTUP_CONNECT_TIMEOUT_MS = 6e4;
13423
- async function withStartupTimeout(what, work) {
13424
- let timer;
13425
- try {
13426
- return await Promise.race([
13427
- work,
13428
- new Promise((_resolve, reject) => {
13429
- timer = setTimeout(
13430
- () => reject(
13431
- new Error(
13432
- `${what} did not become available within ${STARTUP_CONNECT_TIMEOUT_MS / 1e3}s. Exiting so the container restart policy can retry \u2014 it is normal for a dependency to be slow when every service restarts at once.`
13433
- )
13434
- ),
13435
- STARTUP_CONNECT_TIMEOUT_MS
13436
- );
13437
- })
13438
- ]);
13439
- } finally {
13440
- if (timer !== void 0) clearTimeout(timer);
13441
- }
13442
- }
13423
+ 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.";
13443
13424
  async function connectStores(project, config, eventBus, logger, skipRebuild) {
13444
13425
  const graphConfig = config.services.graph;
13445
13426
  logger.info("Connecting to graph database", { type: graphConfig.type });
13446
- const graphDb = await withStartupTimeout("Graph database", getGraphDatabase(graphConfig));
13427
+ const graphDb = await withDeadline(
13428
+ "Graph database",
13429
+ STARTUP_CONNECT_TIMEOUT_MS,
13430
+ () => getGraphDatabase(graphConfig),
13431
+ RESTART_HINT
13432
+ );
13447
13433
  const eventStore = createEventStore(project, eventBus, logger.child({ component: "event-store" }));
13448
13434
  const vectorsConfig = config.services.vectors;
13449
13435
  const embeddingConfig = config.services.embedding;
13450
13436
  const { createVectorStore, createEmbeddingProvider } = await import('@semiont/vectors');
13451
13437
  logger.info("Connecting to embedding provider", { type: embeddingConfig.type, model: embeddingConfig.model });
13452
- const embeddingProvider = await withStartupTimeout(
13438
+ const embeddingProvider = await withDeadline(
13453
13439
  "Embedding provider",
13454
- createEmbeddingProvider(embeddingConfig)
13440
+ STARTUP_CONNECT_TIMEOUT_MS,
13441
+ () => createEmbeddingProvider(embeddingConfig),
13442
+ RESTART_HINT
13455
13443
  );
13456
13444
  logger.info("Connecting to vector store", { type: vectorsConfig.type });
13457
- const vectorStore = await withStartupTimeout(
13445
+ const vectorStore = await withDeadline(
13458
13446
  "Vector store",
13459
- createVectorStore({
13447
+ STARTUP_CONNECT_TIMEOUT_MS,
13448
+ (signal) => createVectorStore({
13449
+ // The deadline this call is already being raced against, handed down so
13450
+ // the dimension-probe retry stops when it fires instead of being abandoned
13451
+ // mid-flight. This is the whole point of the signal parameter.
13452
+ signal,
13460
13453
  type: vectorsConfig.type,
13461
13454
  host: vectorsConfig.host,
13462
13455
  port: vectorsConfig.port,
@@ -13468,7 +13461,8 @@ async function connectStores(project, config, eventBus, logger, skipRebuild) {
13468
13461
  // network round-trip a precondition of booting. A `memory` store, or a
13469
13462
  // Qdrant whose collections already exist, never consults the provider.
13470
13463
  dimensions: () => embeddingProvider.dimensions()
13471
- })
13464
+ }),
13465
+ RESTART_HINT
13472
13466
  );
13473
13467
  if (vectorsConfig.type === "memory") {
13474
13468
  logger.info("memory vector store: the index rebuilds from the event log on every restart (reconcile re-embeds)");
@@ -13825,6 +13819,28 @@ function partitionByType(events) {
13825
13819
  if (currentRun.length > 0) runs.push(currentRun);
13826
13820
  return runs;
13827
13821
  }
13822
+ var RESOURCE_LISTING_RETRY = {
13823
+ attempts: 17,
13824
+ initialDelayMs: 1e3,
13825
+ maxDelayMs: 3e4
13826
+ };
13827
+ var RESOURCES_CHANNEL = "browse:resources-requested";
13828
+ async function browseAllResources(bus, options) {
13829
+ const all = [];
13830
+ for (; ; ) {
13831
+ const page = await retryWithBackoff(
13832
+ () => busRequest(bus, RESOURCES_CHANNEL, {
13833
+ ...options.archived !== void 0 ? { archived: options.archived } : {},
13834
+ offset: all.length,
13835
+ limit: options.limit
13836
+ }),
13837
+ isPeerUnavailable,
13838
+ RESOURCE_LISTING_RETRY
13839
+ );
13840
+ all.push(...page.resources);
13841
+ if (page.resources.length === 0 || all.length >= page.total) return all;
13842
+ }
13843
+ }
13828
13844
 
13829
13845
  // src/smelter.ts
13830
13846
  function sameStringSet(a, b) {
@@ -14580,17 +14596,11 @@ var Smelter = class _Smelter {
14580
14596
  return embeddable;
14581
14597
  }
14582
14598
  /** Page through `browse:resources-requested` until the catalog is exhausted. */
14583
- async listAllResources() {
14584
- const all = [];
14585
- for (; ; ) {
14586
- const page = await busRequest(
14587
- this.bus,
14588
- "browse:resources-requested",
14589
- { archived: false, offset: all.length, limit: _Smelter.RECONCILE_PAGE_SIZE }
14590
- );
14591
- all.push(...page.resources);
14592
- if (page.resources.length === 0 || all.length >= page.total) return all;
14593
- }
14599
+ /** Shared with the weaver since 2026-09-09 — see `browse-resources.ts` for why the
14600
+ * retry lives at the page rather than around the pass. `archived: false` is
14601
+ * the smelter's own filter and the one difference between the two loops. */
14602
+ listAllResources() {
14603
+ return browseAllResources(this.bus, { limit: _Smelter.RECONCILE_PAGE_SIZE, archived: false });
14594
14604
  }
14595
14605
  };
14596
14606