agent-transport-system 0.4.9 → 0.4.91

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.4.9";
30
+ var version = "0.4.91";
31
31
  var package_default = {
32
32
  $schema: "https://www.schemastore.org/package.json",
33
33
  name: "agent-transport-system",
@@ -7663,6 +7663,11 @@ const DAEMON_SERVICE_ARTIFACT_DRIFT_ANOMALIES = new Set([
7663
7663
  "service_manager_path_drift",
7664
7664
  "version_outdated"
7665
7665
  ]);
7666
+ const DAEMON_SERVICE_RUN_BLOCKING_ANOMALIES = new Set([
7667
+ ...[...DAEMON_SERVICE_ARTIFACT_DRIFT_ANOMALIES].filter((code) => code !== "runtime_stale" && code !== "version_outdated"),
7668
+ "duplicate_owned_processes",
7669
+ "foreground_background_conflict"
7670
+ ]);
7666
7671
  const DAEMON_SERVICE_WAKEABILITY_HARD_BLOCKER_ANOMALIES = new Set([
7667
7672
  "duplicate_owned_processes",
7668
7673
  "manager_running_without_runtime",
@@ -7716,6 +7721,13 @@ function classifyDaemonServiceWakeability(input) {
7716
7721
  executionEvidenceSafe
7717
7722
  };
7718
7723
  }
7724
+ function classifyDaemonServiceRunStartability(input) {
7725
+ const blockingCodes = collectUniqueAnomalyCodes(input.inventory).filter((code) => DAEMON_SERVICE_RUN_BLOCKING_ANOMALIES.has(code));
7726
+ return {
7727
+ blockingCodes,
7728
+ blocksStart: blockingCodes.length > 0
7729
+ };
7730
+ }
7719
7731
  function shouldBlockConditionalWakeabilityAnomaly(input) {
7720
7732
  return !input.executionEvidenceSafe;
7721
7733
  }
@@ -23160,10 +23172,11 @@ function resolveRuntimeHeadlineFromStatus(status) {
23160
23172
  }
23161
23173
  function createServiceUpdateAvailableProjection(input) {
23162
23174
  const nextSteps = [formatAtsCliCommand("ats service reinstall")];
23175
+ const serviceIsRunning = input.runtimeHeadline === "running";
23163
23176
  return createServiceStatusProjection({
23164
23177
  anomalyCodes: input.anomalyCodes,
23165
- detailText: "ATS Service update available. Local agents can keep replying if this service is still execution-compatible.",
23166
- nextStepSummary: "Update ATS Service when convenient with `ats service reinstall`.",
23178
+ detailText: serviceIsRunning ? "ATS Service update available. Local agents can keep replying if this service is still execution-compatible." : "ATS Service update available, and ATS Service is not ready. Update and start ATS Service before local agents can reply from this computer.",
23179
+ nextStepSummary: serviceIsRunning ? "Update ATS Service when convenient with `ats service reinstall`." : "Update and start ATS Service with `ats service reinstall`.",
23167
23180
  nextSteps,
23168
23181
  runtimeHeadline: input.runtimeHeadline,
23169
23182
  state: "update_available",
@@ -23245,12 +23258,13 @@ function resolveDaemonStatusAttention(input) {
23245
23258
  };
23246
23259
  if (repairCodes.length === 0) {
23247
23260
  if (updateAvailableCodes.length === 0) return null;
23261
+ const serviceIsRunning = isRuntimeActive(input.runtimeState);
23248
23262
  return {
23249
23263
  level: "info",
23250
23264
  code: "service_update_available",
23251
23265
  title: "ATS Service Update Available",
23252
- message: "An ATS Service update is available. Local agents can keep replying if this service is still execution-compatible.",
23253
- nextStep: "Update ATS Service when convenient with `ats service reinstall`.",
23266
+ message: serviceIsRunning ? "An ATS Service update is available. Local agents can keep replying if this service is still execution-compatible." : "An ATS Service update is available, and ATS Service is not ready. Update and start ATS Service before local agents can reply from this computer.",
23267
+ nextStep: serviceIsRunning ? "Update ATS Service when convenient with `ats service reinstall`." : "Update and start ATS Service with `ats service reinstall`.",
23254
23268
  anomalyCodes: updateAvailableCodes
23255
23269
  };
23256
23270
  }
@@ -23276,6 +23290,9 @@ function collectAnomalyCodes(inventory, allowedCodes) {
23276
23290
  function isForegroundRuntimeActive(runtimeState) {
23277
23291
  return runtimeState?.status === "running" && runtimeState.mode === "foreground";
23278
23292
  }
23293
+ function isRuntimeActive(runtimeState) {
23294
+ return runtimeState?.status === "running";
23295
+ }
23279
23296
  function createStatusAttentionReplyReadiness() {
23280
23297
  return {
23281
23298
  reasonCodes: [],
@@ -49579,11 +49596,7 @@ async function syncCurrentDeviceBootstrapObservationAfterLocalStateChange(input)
49579
49596
  //#endregion
49580
49597
  //#region src/commands/daemon.ts
49581
49598
  const STATUS_CLEANUP_SIGNIFICANT_ANOMALIES = DAEMON_SERVICE_REPAIR_ANOMALIES;
49582
- const DAEMON_RUN_BLOCKING_ANOMALIES = new Set([
49583
- ...[...DAEMON_SERVICE_ARTIFACT_DRIFT_ANOMALIES].filter((code) => code !== "runtime_stale" && code !== "version_outdated"),
49584
- "duplicate_owned_processes",
49585
- "foreground_background_conflict"
49586
- ]);
49599
+ const DAEMON_RUN_BLOCKING_ANOMALIES = DAEMON_SERVICE_RUN_BLOCKING_ANOMALIES;
49587
49600
  const DAEMON_STARTUP_BLOCKING_ANOMALIES = new Set([
49588
49601
  "duplicate_owned_processes",
49589
49602
  "multiple_active_owners",
@@ -54081,7 +54094,8 @@ async function resolveDaemonServiceParticipationStatus(input) {
54081
54094
  };
54082
54095
  const installedVersion = inventory.installStatus.state.daemonVersion;
54083
54096
  const blockingServiceDriftCodes = classifyDaemonServiceWakeability({ inventory }).blockingCodes;
54084
- const repairAnomalies = inventory.anomalies.filter((anomaly) => blockingServiceDriftCodes.includes(anomaly.code));
54097
+ const runBlockingServiceDriftCodes = classifyDaemonServiceRunStartability({ inventory }).blockingCodes;
54098
+ const repairAnomalies = inventory.anomalies.filter((anomaly) => [...blockingServiceDriftCodes, ...runBlockingServiceDriftCodes].includes(anomaly.code));
54085
54099
  if (repairAnomalies.length > 0) return {
54086
54100
  kind: "needs_repair",
54087
54101
  expectedVersion,
@@ -59849,16 +59863,20 @@ async function maybeCompleteServiceReadinessAfterPreparation(input) {
59849
59863
  profile: input.profile
59850
59864
  }));
59851
59865
  if (reasonCodes.length === 0) return;
59852
- if (classifyDaemonServiceWakeability({ inventory: await inspectDaemonServiceInventory({
59866
+ const inventory = await inspectDaemonServiceInventory({
59853
59867
  expectedVersion: resolveCurrentDaemonExpectedVersion(),
59854
59868
  intent: "status_cleanup"
59855
- }) }).blocksWake || reasonCodes.includes("service.drifted")) {
59869
+ });
59870
+ const hasBlockingServiceDrift = classifyDaemonServiceWakeability({ inventory }).blocksWake;
59871
+ const serviceRunWouldBeBlocked = classifyDaemonServiceRunStartability({ inventory }).blocksStart;
59872
+ if (hasBlockingServiceDrift || serviceRunWouldBeBlocked || reasonCodes.includes("service.drifted")) {
59856
59873
  const refreshOutcome = await runDaemonReinstall({
59857
59874
  agentOverviewHandled: true,
59858
59875
  gatewayUrl: await resolveBaseUrl(),
59859
59876
  profile: input.profile.atsProfileId,
59860
59877
  view: input.view
59861
59878
  }, {
59879
+ skipConfirm: true,
59862
59880
  startAfterInstallMode: "always",
59863
59881
  suppressAgentOverview: true
59864
59882
  });