Skip to content

Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.

1.1 KB
Raw Blame
/** Shared credential-free account storage status for all transport versions [H15,H17]. */
/** Keep account quota status only after validating its credential-free response fields. */
export function relayStorage(value) {
  if (!value || typeof value.account?.id !== 'string' || typeof value.account?.login !== 'string' ||
      !/^[A-Za-z0-9_-]{1,100}$/u.test(value.account.id) || !/^[A-Za-z0-9_-]{1,100}$/u.test(value.account.login) ||
      !Number.isSafeInteger(value.usedBytes) || value.usedBytes < 0 || !Number.isSafeInteger(value.limitBytes) || value.limitBytes < 1) return null;
  return { account: { id: value.account.id, login: value.account.login }, usedBytes: value.usedBytes, limitBytes: value.limitBytes };
}

/** Print account, used bytes and the operator-set limit without importing server-only quota storage into the CLI. */
export function relayStorageLine(value) {
  const storage = relayStorage(value);
  return storage ? `relay storage: account ${storage.account.login}, ${(storage.usedBytes / 1_000_000).toFixed(1)} MB used of ${(storage.limitBytes / 1_000_000).toFixed(1)} MB` : '';
}