agent-transport-system 0.7.25 → 0.7.26

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.25";
30
+ var version = "0.7.26";
31
31
  var package_default = {
32
32
  $schema: "https://www.schemastore.org/package.json",
33
33
  name: "agent-transport-system",
@@ -8213,7 +8213,7 @@ function normalizeFixtureText(value) {
8213
8213
  }
8214
8214
  function buildContractCandidate(input, pathInput, current) {
8215
8215
  const lane = input.lane ?? resolveAtsEnvPreset(pathInput);
8216
- const connectedComputerId = input.connectedComputerId ?? (current && current.lane === lane && current.gatewayUrl === input.gatewayUrl && current.profileId === input.profileId && current.deviceId === input.deviceId ? current.connectedComputerId : void 0);
8216
+ const connectedComputerId = input.connectedComputerId ?? (current && current.lane === lane && current.gatewayUrl === input.gatewayUrl && current.deviceId === input.deviceId ? current.connectedComputerId : void 0);
8217
8217
  return {
8218
8218
  schema: "ats-daemon-service-contract-v1",
8219
8219
  v: 1,
@@ -73552,21 +73552,27 @@ function buildSpacePasswordRequirementsText() {
73552
73552
  function resolveSpacePasswordPromptReason(error) {
73553
73553
  const parsed = parseHttpErrorMessage$1(error);
73554
73554
  const rawMessage = toErrorMessage$6(error);
73555
- const requiredByRaw = SPACE_PASSWORD_REQUIRED_HINT_REGEX.test(rawMessage);
73556
- const invalidByRaw = SPACE_PASSWORD_INVALID_HINT_REGEX.test(rawMessage);
73557
73555
  if (!parsed) {
73558
- if (requiredByRaw) return "required";
73559
- if (invalidByRaw) return "invalid";
73556
+ if (isLegacyPlainPasswordError(rawMessage, "required")) return "required";
73557
+ if (isLegacyPlainPasswordError(rawMessage, "invalid")) return "invalid";
73560
73558
  return null;
73561
73559
  }
73562
73560
  const code = parsed.code.toLowerCase();
73563
- const parsedMessage = `${parsed.message}\n${parsed.body}`;
73564
- const requiredByParsed = SPACE_PASSWORD_REQUIRED_HINT_REGEX.test(parsedMessage);
73565
- const invalidByParsed = SPACE_PASSWORD_INVALID_HINT_REGEX.test(parsedMessage);
73566
- if (code === "space.password_required" || requiredByRaw || requiredByParsed) return "required";
73567
- if (code === "space.password_invalid" || invalidByRaw || invalidByParsed) return "invalid";
73561
+ if (code === "space.password_required" || isWrappedHttpPasswordError(parsed, "required")) return "required";
73562
+ if (code === "space.password_invalid" || isWrappedHttpPasswordError(parsed, "invalid")) return "invalid";
73568
73563
  return null;
73569
73564
  }
73565
+ function isLegacyPlainPasswordError(message, reason) {
73566
+ const normalized = message.trim().toLowerCase();
73567
+ if (reason === "required") return normalized === "space password required";
73568
+ return normalized === "space password invalid";
73569
+ }
73570
+ function isWrappedHttpPasswordError(parsed, reason) {
73571
+ const expectedStatus = reason === "required" ? 401 : 403;
73572
+ const hintRegex = reason === "required" ? SPACE_PASSWORD_REQUIRED_HINT_REGEX : SPACE_PASSWORD_INVALID_HINT_REGEX;
73573
+ if (parsed.status === expectedStatus && hintRegex.test(parsed.message)) return true;
73574
+ return new RegExp(`\\bHTTP\\s+${expectedStatus}\\b`, "i").test(parsed.message) && hintRegex.test(parsed.message);
73575
+ }
73570
73576
  async function promptSpacePassword() {
73571
73577
  const password$1 = await password({
73572
73578
  message: "Space password",
@@ -73637,7 +73643,8 @@ function parseHttpErrorMessage$1(error) {
73637
73643
  if (parsedFailure) return {
73638
73644
  body: parsedFailure.body,
73639
73645
  code: parsedFailure.code,
73640
- message: parsedFailure.message
73646
+ message: parsedFailure.message,
73647
+ status: parsedFailure.status
73641
73648
  };
73642
73649
  const message = toErrorMessage$6(error);
73643
73650
  const match = HTTP_ERROR_MESSAGE_REGEX.exec(message.trim());
@@ -73649,7 +73656,8 @@ function parseHttpErrorMessage$1(error) {
73649
73656
  return {
73650
73657
  body,
73651
73658
  code: readHttpErrorField$1(payload, "code"),
73652
- message: readHttpErrorField$1(payload, "message")
73659
+ message: readHttpErrorField$1(payload, "message"),
73660
+ status
73653
73661
  };
73654
73662
  }
73655
73663
  function readHttpErrorField$1(payload, field) {
@@ -76582,6 +76590,11 @@ function buildSpaceListProofPayload() {
76582
76590
  async function runSpaceAddMembers(input) {
76583
76591
  const hasExplicitBaseUrlInput = String(input.baseUrl ?? "").trim().length > 0;
76584
76592
  const explicitMemberIds = (input.members ?? []).map((memberId) => normalizeOptionalString$8(memberId)).filter((memberId) => Boolean(memberId));
76593
+ if (input.all === true || explicitMemberIds.length > 0) validateSpaceMemberSelectionInput({
76594
+ all: input.all === true,
76595
+ command: "add-members",
76596
+ explicitMemberIds
76597
+ });
76585
76598
  const currentProfileId = normalizeOptionalString$8(input.profile) ?? getCurrentCommandCheckState().selectedProfile?.profile?.atsProfileId ?? null;
76586
76599
  if (currentProfileId && explicitMemberIds.includes(currentProfileId)) throw createSpaceAddMembersCurrentProfileGuideError({ profileId: currentProfileId });
76587
76600
  const context = await prepareAuthenticatedSpaceCommandContext({
@@ -88738,14 +88751,6 @@ function recordCliStartHandoffFailure(input) {
88738
88751
 
88739
88752
  //#endregion
88740
88753
  //#region src/commands/local-runtime-observed-metadata.ts
88741
- async function syncStandaloneLocalRuntimeObservedMetadata(input) {
88742
- const deviceId = readCliStartDeviceProjection(input.foundation).value?.deviceId ?? null;
88743
- if (!deviceId) return;
88744
- await createCurrentDeviceApi(createCliApiClientFoundation(input.gatewayUrl)).writeObservedMetadata({
88745
- deviceId,
88746
- metadata: await collectObservedDeviceMetadata({ now: input.now })
88747
- });
88748
- }
88749
88754
  async function syncSetupTokenLocalRuntimeObservedMetadata(input) {
88750
88755
  await input.currentDeviceApi.writeSetupTokenObservedMetadata({
88751
88756
  opaqueToken: input.opaqueToken,
@@ -92361,10 +92366,6 @@ async function runStart(input) {
92361
92366
  foundation,
92362
92367
  gatewayUrl
92363
92368
  });
92364
- await syncStandaloneLocalRuntimeObservedMetadata({
92365
- foundation,
92366
- gatewayUrl
92367
- });
92368
92369
  if (await runStartServiceStep({
92369
92370
  foundation,
92370
92371
  runtime,