agent-transport-system 0.7.91 → 0.7.92

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
@@ -31,7 +31,7 @@ import { Box, Container, Editor, Key, ProcessTerminal, TUI, Text, getEditorKeybi
31
31
  import { ReadStream, WriteStream } from "node:tty";
32
32
 
33
33
  //#region package.json
34
- var version = "0.7.91";
34
+ var version = "0.7.92";
35
35
  var package_default = {
36
36
  $schema: "https://www.schemastore.org/package.json",
37
37
  name: "agent-transport-system",
@@ -36414,6 +36414,13 @@ function resolveDaemonStopStrategy(snapshot) {
36414
36414
  function hasActiveDaemonOwners(snapshot) {
36415
36415
  return snapshot.activeOwnerKinds.length > 0 || snapshot.ownedProcesses.length > 0 || snapshot.serviceManagerStatus?.running === true;
36416
36416
  }
36417
+ function resolveStoppedContractWriteBlockedReason(snapshot) {
36418
+ if (snapshot.ownedProcesses.length > 0) return "owned_processes_still_active";
36419
+ if (snapshot.serviceManagerStatus?.running === true) return "service_manager_still_running";
36420
+ if (snapshot.serviceManagerStatus?.enabled === true) return "service_manager_still_enabled";
36421
+ if (hasActiveDaemonOwners(snapshot)) return "daemon_owners_still_active";
36422
+ return null;
36423
+ }
36417
36424
  function summarizeDaemonOwnerSnapshot(snapshot) {
36418
36425
  return {
36419
36426
  activeOwnerKinds: snapshot.activeOwnerKinds,
@@ -49879,7 +49886,7 @@ async function attachDaemonReinstallEvidence(input) {
49879
49886
  function buildDaemonReinstallFailureMessage(input) {
49880
49887
  const actionLabel = formatDaemonServiceMaintenanceActionLabel(input.action);
49881
49888
  const actionCommand = formatDaemonServiceMaintenanceCommand(input.action);
49882
- if (input.resolvedView === "human") {
49889
+ if (input.resolvedView === "human" && input.includeDiagnosticDetails !== true) {
49883
49890
  if (input.errorMessage.includes("test fixture identity")) return formatInlineAtsCliCommands([
49884
49891
  `ATS Service ${actionLabel} failed because this production lane contains old test setup identity that cannot be reused.`,
49885
49892
  "Rerun the setup command from ATS Web so ATS can write a fresh production service contract.",
@@ -51359,6 +51366,7 @@ async function runDaemonReinstall(input, options = {}) {
51359
51366
  runtime,
51360
51367
  phase: "after_failure"
51361
51368
  }),
51369
+ includeDiagnosticDetails: input.json === true || runtime.resolvedView === "agent",
51362
51370
  resolvedView: runtime.resolvedView
51363
51371
  }), { cause: error.cause });
51364
51372
  throw error;
@@ -52938,7 +52946,8 @@ async function stageDaemonBackgroundServiceContract(input) {
52938
52946
  }
52939
52947
  async function maybeWriteDaemonStoppedContract(input) {
52940
52948
  const ownerSnapshot = input.ownerSnapshot ?? await readCurrentDaemonOwnerSnapshot().catch(() => null);
52941
- if (ownerSnapshot && !canWriteStoppedContract(ownerSnapshot)) {
52949
+ const stoppedContractWriteBlockedReason = ownerSnapshot ? resolveStoppedContractWriteBlockedReason(ownerSnapshot) : null;
52950
+ if (ownerSnapshot && stoppedContractWriteBlockedReason) {
52942
52951
  await emitDaemonLifecycleEvent({
52943
52952
  type: "service_contract.write",
52944
52953
  result: "skipped",
@@ -52946,7 +52955,7 @@ async function maybeWriteDaemonStoppedContract(input) {
52946
52955
  autoStart: false,
52947
52956
  desiredState: "stopped",
52948
52957
  ownerSnapshot: summarizeDaemonOwnerSnapshot(ownerSnapshot),
52949
- reason: "daemon_owners_still_active"
52958
+ reason: stoppedContractWriteBlockedReason
52950
52959
  }
52951
52960
  });
52952
52961
  return;
@@ -52987,12 +52996,6 @@ async function maybeWriteDaemonStoppedContract(input) {
52987
52996
  }
52988
52997
  });
52989
52998
  }
52990
- function canWriteStoppedContract(ownerSnapshot) {
52991
- if (ownerSnapshot.ownedProcesses.length > 0) return false;
52992
- if (ownerSnapshot.serviceManagerStatus?.running === true) return false;
52993
- if (ownerSnapshot.serviceManagerStatus?.enabled === true) return false;
52994
- return !hasActiveDaemonOwners(ownerSnapshot);
52995
- }
52996
52999
  async function restoreDaemonServiceContractSnapshot(snapshot) {
52997
53000
  if (!snapshot) {
52998
53001
  await clearDaemonServiceContract();