agent-transport-system 0.7.48 → 0.7.49

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/ats.js CHANGED
@@ -27,7 +27,7 @@ import wrapAnsi from "wrap-ansi";
27
27
  import { Box, Container, Editor, Key, ProcessTerminal, TUI, Text, getEditorKeybindings, matchesKey } from "@mariozechner/pi-tui";
28
28
 
29
29
  //#region package.json
30
- var version = "0.7.48";
30
+ var version = "0.7.49";
31
31
  var package_default = {
32
32
  $schema: "https://www.schemastore.org/package.json",
33
33
  name: "agent-transport-system",
@@ -45375,6 +45375,8 @@ async function runDaemonSocketSession(input) {
45375
45375
  let nextCatalogSyncAtMs = 0;
45376
45376
  let nextProviderConversationProofSyncAtMs = 0;
45377
45377
  let nextRuntimeAgentControllerReportSyncAtMs = 0;
45378
+ let providerConversationProofSyncInFlight = false;
45379
+ let runtimeAgentControllerReportSyncInFlight = false;
45378
45380
  let latestCatalogSyncStatus = null;
45379
45381
  let latestSkippedProfilesFingerprint = null;
45380
45382
  let latestCatalogSyncSignalUpdatedAtMs = 0;
@@ -45614,8 +45616,6 @@ async function runDaemonSocketSession(input) {
45614
45616
  heartbeatAt: nowIsoString(),
45615
45617
  updatedAt: nowIsoString()
45616
45618
  });
45617
- await syncRuntimeAgentControllerReportsIfDue();
45618
- await syncProviderConversationProofsIfDue();
45619
45619
  flushDispatchResultOutbox({
45620
45620
  currentSocketRef,
45621
45621
  ledgerPaths: input.ledgerPaths,
@@ -45644,6 +45644,7 @@ async function runDaemonSocketSession(input) {
45644
45644
  code: "daemon.run.heartbeat",
45645
45645
  text: `heartbeat ok; active leases=${leasesByProfileId.size}, stale leases=${heartbeatResponse.staleLeases.length}, next=${String(currentHeartbeatIntervalMs)}ms`
45646
45646
  });
45647
+ startSupplementalEvidenceSyncs();
45647
45648
  } catch (error) {
45648
45649
  consecutiveHeartbeatFailures += 1;
45649
45650
  const shouldCloseSocket = consecutiveHeartbeatFailures >= HEARTBEAT_CONSECUTIVE_FAILURES_BEFORE_CLOSE;
@@ -45940,7 +45941,8 @@ async function runDaemonSocketSession(input) {
45940
45941
  await runCatalogSync(forceReason ? { forceReason } : void 0);
45941
45942
  };
45942
45943
  const syncRuntimeAgentControllerReportsIfDue = async () => {
45943
- if (Date.now() < nextRuntimeAgentControllerReportSyncAtMs) return;
45944
+ if (runtimeAgentControllerReportSyncInFlight || Date.now() < nextRuntimeAgentControllerReportSyncAtMs) return;
45945
+ runtimeAgentControllerReportSyncInFlight = true;
45944
45946
  try {
45945
45947
  const result = await syncLocalServiceRuntimeAgentControllerReports({ localAdapterContainer: input.localAdapterContainer });
45946
45948
  const retryInMs = result.failedCount > 0 ? RUNTIME_AGENT_CONTROLLER_REPORT_SYNC_RETRY_INTERVAL_MS : RUNTIME_AGENT_CONTROLLER_REPORT_SYNC_INTERVAL_MS;
@@ -45969,10 +45971,13 @@ async function runDaemonSocketSession(input) {
45969
45971
  code: "daemon.run.runtime_agent_controller_report_sync_failed",
45970
45972
  text: `runtime agent controller report sync failed: ${toErrorMessage$29(error)}`
45971
45973
  });
45974
+ } finally {
45975
+ runtimeAgentControllerReportSyncInFlight = false;
45972
45976
  }
45973
45977
  };
45974
45978
  const syncProviderConversationProofsIfDue = async () => {
45975
- if (Date.now() < nextProviderConversationProofSyncAtMs) return;
45979
+ if (providerConversationProofSyncInFlight || Date.now() < nextProviderConversationProofSyncAtMs) return;
45980
+ providerConversationProofSyncInFlight = true;
45976
45981
  try {
45977
45982
  const result = await syncLocalServiceProviderConversationProofs({ routeCatalog: createRouteCatalogFromMutableState(input.routeCatalogState) });
45978
45983
  const retryInMs = result.failedCount > 0 ? PROVIDER_CONVERSATION_PROOF_SYNC_RETRY_INTERVAL_MS : PROVIDER_CONVERSATION_PROOF_SYNC_INTERVAL_MS;
@@ -46001,8 +46006,26 @@ async function runDaemonSocketSession(input) {
46001
46006
  code: "daemon.run.provider_conversation_proof_sync_failed",
46002
46007
  text: `provider conversation proof sync failed: ${toErrorMessage$29(error)}`
46003
46008
  });
46009
+ } finally {
46010
+ providerConversationProofSyncInFlight = false;
46004
46011
  }
46005
46012
  };
46013
+ const startSupplementalEvidenceSyncs = () => {
46014
+ syncRuntimeAgentControllerReportsIfDue().catch((error) => {
46015
+ emitRunLine({
46016
+ presenter: input.presenter,
46017
+ code: "daemon.run.runtime_agent_controller_report_sync_failed",
46018
+ text: `runtime agent controller report sync failed: ${toErrorMessage$29(error)}`
46019
+ });
46020
+ });
46021
+ syncProviderConversationProofsIfDue().catch((error) => {
46022
+ emitRunLine({
46023
+ presenter: input.presenter,
46024
+ code: "daemon.run.provider_conversation_proof_sync_failed",
46025
+ text: `provider conversation proof sync failed: ${toErrorMessage$29(error)}`
46026
+ });
46027
+ });
46028
+ };
46006
46029
  input.socket.onError((error) => {
46007
46030
  emitRunLine({
46008
46031
  presenter: input.presenter,