@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,4 +1,4 @@
1
- import { replyChannelsFor, createTomlConfigLoader, accessToken, baseUrl as baseUrl$1, retryWithBackoff, isTransientFetchError, STARTUP_FETCH_RETRY, errField, burstBuffer, busRequest, resourceId, didToAgent, annotationId, findBodyItem } from '@semiont/core';
1
+ import { replyChannelsFor, createTomlConfigLoader, accessToken, baseUrl as baseUrl$1, retryWithBackoff, isTransientFetchError, STARTUP_FETCH_RETRY, errField, burstBuffer, busRequest, resourceId, didToAgent, annotationId, findBodyItem, isPeerUnavailable } from '@semiont/core';
2
2
  import { getGraphDatabase, intendedGraphAnnotation } from '@semiont/graph';
3
3
  import { existsSync, readFileSync, promises } from 'fs';
4
4
  import * as path from 'path';
@@ -9781,6 +9781,28 @@ function partitionByType(events) {
9781
9781
  if (currentRun.length > 0) runs.push(currentRun);
9782
9782
  return runs;
9783
9783
  }
9784
+ var RESOURCE_LISTING_RETRY = {
9785
+ attempts: 17,
9786
+ initialDelayMs: 1e3,
9787
+ maxDelayMs: 3e4
9788
+ };
9789
+ var RESOURCES_CHANNEL = "browse:resources-requested";
9790
+ async function browseAllResources(bus, options) {
9791
+ const all = [];
9792
+ for (; ; ) {
9793
+ const page = await retryWithBackoff(
9794
+ () => busRequest(bus, RESOURCES_CHANNEL, {
9795
+ ...options.archived !== void 0 ? { archived: options.archived } : {},
9796
+ offset: all.length,
9797
+ limit: options.limit
9798
+ }),
9799
+ isPeerUnavailable,
9800
+ RESOURCE_LISTING_RETRY
9801
+ );
9802
+ all.push(...page.resources);
9803
+ if (page.resources.length === 0 || all.length >= page.total) return all;
9804
+ }
9805
+ }
9784
9806
 
9785
9807
  // src/weaver.ts
9786
9808
  var Weaver = class _Weaver {
@@ -9959,17 +9981,17 @@ var Weaver = class _Weaver {
9959
9981
  * store attachment — in-process and standalone alike, catch-up and
9960
9982
  * rebuild ride `browse:resources-requested` / `browse:events-requested`.
9961
9983
  */
9962
- async fetchAllResources() {
9963
- const resources = [];
9964
- for (; ; ) {
9965
- const page = await busRequest(this.bus, "browse:resources-requested", {
9966
- offset: resources.length,
9967
- limit: _Weaver.CATCHUP_PAGE_SIZE
9968
- });
9969
- resources.push(...page.resources);
9970
- if (page.resources.length === 0 || resources.length >= page.total) break;
9971
- }
9972
- return resources;
9984
+ /**
9985
+ * Shared with the smelter since 2026-09-09 — the two had identical paging
9986
+ * loops, and one of them is where the retry belongs: `browse:*` is answered by
9987
+ * the ARCHIVIST, so a weaver that authenticates first asks a channel nobody is
9988
+ * subscribed to yet and used to give up for the life of the process.
9989
+ * `WeaverCatalogPageAwaits` is now DERIVED from the channel this actually
9990
+ * requests (`typeof RESOURCES_CHANNEL`), so the roster and the request cannot
9991
+ * disagree — where before they were two literals tied by `satisfies`.
9992
+ */
9993
+ fetchAllResources() {
9994
+ return browseAllResources(this.bus, { limit: _Weaver.CATCHUP_PAGE_SIZE });
9973
9995
  }
9974
9996
  /** A resource's full event history over the bus, sorted by sequence. */
9975
9997
  async fetchResourceEvents(resourceId6) {
@@ -10792,8 +10814,9 @@ async function authenticate() {
10792
10814
  );
10793
10815
  }
10794
10816
  async function main() {
10795
- const { initObservabilityNode } = await import('@semiont/observability/node');
10817
+ const { initObservabilityNode, registerSupervisorRestartCount } = await import('@semiont/observability/node');
10796
10818
  initObservabilityNode({ serviceName: "semiont-weaver" });
10819
+ registerSupervisorRestartCount();
10797
10820
  logger.info("Authenticating", { baseUrl });
10798
10821
  const tokenSubject = new import_rxjs3.BehaviorSubject(accessToken(await authenticate()));
10799
10822
  logger.info("Authenticated");