agent-transport-system 0.4.91 → 0.4.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
@@ -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.91";
30
+ var version = "0.4.92";
31
31
  var package_default = {
32
32
  $schema: "https://www.schemastore.org/package.json",
33
33
  name: "agent-transport-system",
@@ -7514,7 +7514,7 @@ async function resolveDaemonDeviceId(input) {
7514
7514
  return explicit;
7515
7515
  }
7516
7516
  const persisted = normalizeOptionalText$43(await readFile(input.deviceIdPath, "utf8").catch(() => ""));
7517
- if (persisted) return persisted;
7517
+ if (persisted && !(input.shouldDiscardPersistedDeviceId?.(persisted) ?? false)) return persisted;
7518
7518
  const generated = randomUUID();
7519
7519
  await writeDaemonDeviceId({
7520
7520
  deviceId: generated,
@@ -24267,12 +24267,14 @@ async function resolveLifecycleCommandOptions(input) {
24267
24267
  const preferCommandGateway = shouldPreferCommandResolvedGatewayForLifecycle();
24268
24268
  const gatewayUrl = explicitGatewayUrl ?? (preferCommandGateway ? commandGatewayUrl : null) ?? normalizeGatewayBaseUrlOrNull(currentContract?.gatewayUrl) ?? normalizeGatewayBaseUrlOrNull(runtimeSnapshot?.gatewayUrl) ?? commandGatewayUrl;
24269
24269
  const atsProfileId = normalizeOptionalText$43(input.profile) ?? normalizeOptionalText$43(runtimeSnapshot?.atsProfileId) ?? fallbackProfile?.atsProfileId ?? reusableCurrentContract?.profileId;
24270
+ const shouldDiscardPersistedDeviceId = resolveAtsEnvPreset() === "prod" ? isUnsafeProductionDeviceId : void 0;
24270
24271
  const deviceId = runtimePaths ? await resolveDaemonDeviceId({
24271
24272
  deviceId: resolvePreferredDaemonDeviceId({
24272
24273
  explicitDeviceId: input.deviceId,
24273
24274
  contractDeviceId: reusableCurrentContract?.deviceId
24274
24275
  }),
24275
- deviceIdPath: runtimePaths.deviceIdPath
24276
+ deviceIdPath: runtimePaths.deviceIdPath,
24277
+ ...shouldDiscardPersistedDeviceId ? { shouldDiscardPersistedDeviceId } : {}
24276
24278
  }).catch(() => reusableCurrentContract?.deviceId ?? null) : normalizeOptionalText$43(input.deviceId) ?? reusableCurrentContract?.deviceId ?? null;
24277
24279
  const heartbeatMs = normalizeHeartbeatIntervalMs(input.heartbeatMs ?? currentContract?.heartbeatMs);
24278
24280
  return {
@@ -49843,7 +49845,14 @@ async function attachDaemonReinstallEvidence(input) {
49843
49845
  };
49844
49846
  }
49845
49847
  function buildDaemonReinstallFailureMessage(input) {
49846
- if (input.resolvedView === "human") return `ATS service reinstall failed. ${buildDaemonServiceRefreshNextStep()} For diagnostics, run \`ats service status --view agent\`.`;
49848
+ if (input.resolvedView === "human") {
49849
+ if (input.errorMessage.includes("test fixture identity")) return [
49850
+ "ATS service reinstall failed because this production lane contains old test setup identity that cannot be reused.",
49851
+ "Rerun the setup command from ATS Web so ATS can write a fresh production service contract.",
49852
+ "For diagnostics, run `ats service status --view agent`."
49853
+ ].join(" ");
49854
+ return `ATS service reinstall failed. ${buildDaemonServiceRefreshNextStep()} For diagnostics, run \`ats service status --view agent\`.`;
49855
+ }
49847
49856
  const failureContext = formatDaemonFailureContextText({
49848
49857
  backupDataPath: input.backupDataPath,
49849
49858
  evidencePath: input.evidencePath,