@integrity-labs/agt-cli 0.28.516 → 0.28.517

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/bin/agt.js CHANGED
@@ -40,7 +40,7 @@ import {
40
40
  success,
41
41
  table,
42
42
  warn
43
- } from "../chunk-IBI6VSGP.js";
43
+ } from "../chunk-P2WZKAPY.js";
44
44
  import {
45
45
  AnchorSessionClient,
46
46
  CHANNEL_REGISTRY,
@@ -4834,7 +4834,7 @@ import { execFileSync, execSync } from "child_process";
4834
4834
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4835
4835
  import chalk18 from "chalk";
4836
4836
  import ora16 from "ora";
4837
- var cliVersion = true ? "0.28.516" : "dev";
4837
+ var cliVersion = true ? "0.28.517" : "dev";
4838
4838
  async function fetchLatestVersion() {
4839
4839
  const host2 = getHost();
4840
4840
  if (!host2) return null;
@@ -6006,7 +6006,7 @@ function handleError(err) {
6006
6006
  }
6007
6007
 
6008
6008
  // src/bin/agt.ts
6009
- var cliVersion2 = true ? "0.28.516" : "dev";
6009
+ var cliVersion2 = true ? "0.28.517" : "dev";
6010
6010
  var program = new Command();
6011
6011
  program.name("agt").description("Augmented CLI \u2014 agent provisioning and management").version(cliVersion2).option("--json", "Emit machine-readable JSON output (suppress spinners and colors)").option("--skip-update-check", "Skip the automatic update check on startup");
6012
6012
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -5317,7 +5317,7 @@ function exchangeFailureKind(err) {
5317
5317
  }
5318
5318
 
5319
5319
  // src/lib/api-client.ts
5320
- var agtCliVersion = true ? "0.28.516" : "dev";
5320
+ var agtCliVersion = true ? "0.28.517" : "dev";
5321
5321
  var lastConfigHash = null;
5322
5322
  function setConfigHash(hash) {
5323
5323
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -8629,4 +8629,4 @@ export {
8629
8629
  managerInstallSystemUnitCommand,
8630
8630
  managerUninstallSystemUnitCommand
8631
8631
  };
8632
- //# sourceMappingURL=chunk-IBI6VSGP.js.map
8632
+ //# sourceMappingURL=chunk-P2WZKAPY.js.map
@@ -53,7 +53,7 @@ import {
53
53
  safeWriteJsonAtomic,
54
54
  setConfigHash,
55
55
  tripClass
56
- } from "../chunk-IBI6VSGP.js";
56
+ } from "../chunk-P2WZKAPY.js";
57
57
  import {
58
58
  getProjectDir as getProjectDir2,
59
59
  getReadyTasks,
@@ -10106,7 +10106,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
10106
10106
  var lastVersionCheckAt = 0;
10107
10107
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
10108
10108
  var lastResponsivenessProbeAt = 0;
10109
- var agtCliVersion = true ? "0.28.516" : "dev";
10109
+ var agtCliVersion = true ? "0.28.517" : "dev";
10110
10110
  function resolveBrewPath(execFileSync2) {
10111
10111
  try {
10112
10112
  const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
package/dist/mcp/xero.js CHANGED
@@ -114299,12 +114299,39 @@ var {
114299
114299
  var import_dotenv = __toESM(require_main(), 1);
114300
114300
  var import_xero_node = __toESM(require_dist2(), 1);
114301
114301
 
114302
+ // src/helpers/redact-sensitive.ts
114303
+ var SENSITIVE_HEADER_NAMES = [
114304
+ "authorization",
114305
+ "proxy-authorization",
114306
+ "www-authenticate",
114307
+ "cookie",
114308
+ "set-cookie",
114309
+ "x-api-key",
114310
+ "api-key",
114311
+ "x-auth-token",
114312
+ "x-access-token",
114313
+ "refresh_token",
114314
+ "access_token",
114315
+ "client_secret"
114316
+ ];
114317
+ var REDACTED = "<redacted>";
114318
+ var NAME_ALTERNATION = SENSITIVE_HEADER_NAMES.join("|");
114319
+ var JSON_PAIR_RE = new RegExp(
114320
+ `("(?:${NAME_ALTERNATION})"\\s*:\\s*)("(?:[^"\\\\]|\\\\.)*"|\\[[^\\]]*\\])`,
114321
+ "gi"
114322
+ );
114323
+ var HEADER_LINE_RE = new RegExp(`\\b(${NAME_ALTERNATION})\\s*:\\s*([^\\r\\n,}"]+)`, "gi");
114324
+ var BEARER_VALUE_RE = /\b(Bearer|Basic)\s+[A-Za-z0-9._~+/=-]{8,}/gi;
114325
+ function redactSensitiveText(input) {
114326
+ return input.replace(JSON_PAIR_RE, (_m, key) => `${key}"${REDACTED}"`).replace(HEADER_LINE_RE, (_m, name) => `${name}: ${REDACTED}`).replace(BEARER_VALUE_RE, (_m, scheme) => `${scheme} ${REDACTED}`);
114327
+ }
114328
+
114302
114329
  // src/helpers/ensure-error.ts
114303
114330
  function ensureError(value) {
114304
114331
  if (value instanceof Error) return value;
114305
114332
  let stringified = "[Unable to stringify the thrown value]";
114306
114333
  try {
114307
- stringified = JSON.stringify(value);
114334
+ stringified = redactSensitiveText(JSON.stringify(value) ?? String(value));
114308
114335
  } catch {
114309
114336
  }
114310
114337
  const error2 = new Error(`Error thrown: ${stringified}`);
@@ -114692,9 +114719,12 @@ var XeroScopeMissingError = class extends Error {
114692
114719
  }
114693
114720
  };
114694
114721
  function classifyXeroError(error2) {
114695
- if (!(error2 instanceof AxiosError2)) return null;
114696
- if (error2.response?.status !== 401) return null;
114697
- const detail = readXeroDetail(error2.response.data);
114722
+ const rejection = parseXeroApiRejection(error2);
114723
+ const status = rejection ? rejection.statusCode : axiosStatus(error2);
114724
+ if (status !== 401) return null;
114725
+ const detail = readXeroDetail(
114726
+ rejection ? rejection.body : error2.response?.data
114727
+ );
114698
114728
  if (detail !== "AuthorizationUnsuccessful") return null;
114699
114729
  return new XeroScopeMissingError(
114700
114730
  `Xero rejected this call as scope-missing \u2014 the OAuth consent did not grant the scope this endpoint requires. Token refresh will not help: refresh tokens cannot widen scope. Ask the user to click "Reconnect" on the Xero card in the Augmented console so the consent screen requests the scopes the agent's installed skills need.`,
@@ -114702,6 +114732,25 @@ function classifyXeroError(error2) {
114702
114732
  detail
114703
114733
  );
114704
114734
  }
114735
+ function axiosStatus(error2) {
114736
+ return error2 instanceof AxiosError2 ? error2.response?.status : void 0;
114737
+ }
114738
+ function parseXeroApiRejection(error2) {
114739
+ if (typeof error2 !== "string") return null;
114740
+ if (!error2.startsWith("{")) return null;
114741
+ let parsed;
114742
+ try {
114743
+ parsed = JSON.parse(error2);
114744
+ } catch {
114745
+ return null;
114746
+ }
114747
+ if (!parsed || typeof parsed !== "object") return null;
114748
+ const response = parsed.response;
114749
+ if (!response || typeof response !== "object") return null;
114750
+ const statusCode = response.statusCode;
114751
+ if (typeof statusCode !== "number") return null;
114752
+ return { statusCode, body: response.body };
114753
+ }
114705
114754
  function readXeroDetail(data) {
114706
114755
  if (data && typeof data === "object" && "Detail" in data) {
114707
114756
  const d = data.Detail;
@@ -114717,23 +114766,36 @@ function readXeroDetail(data) {
114717
114766
  function formatError2(error2) {
114718
114767
  const scopeMissing = classifyXeroError(error2);
114719
114768
  if (scopeMissing) return scopeMissing.message;
114769
+ const rejection = parseXeroApiRejection(error2);
114770
+ if (rejection) {
114771
+ return messageForStatus(rejection.statusCode, readDetail(rejection.body));
114772
+ }
114720
114773
  if (error2 instanceof AxiosError2) {
114721
- const status = error2.response?.status;
114722
- const detail = error2.response?.data?.Detail;
114723
- switch (status) {
114724
- case 401:
114725
- return "Authentication failed. Please check your Xero credentials.";
114726
- case 403:
114727
- return "You don't have permission to access this resource in Xero.";
114728
- case 404:
114729
- return "The requested resource was not found in Xero.";
114730
- case 429:
114731
- return "Too many requests to Xero. Please try again in a moment.";
114732
- default:
114733
- return detail || "An error occurred while communicating with Xero.";
114734
- }
114774
+ return messageForStatus(error2.response?.status, readDetail(error2.response?.data));
114735
114775
  }
114736
- return error2 instanceof Error ? error2.message : `An unexpected error occurred: ${error2}`;
114776
+ if (error2 instanceof Error) return redactSensitiveText(error2.message);
114777
+ return "An unexpected error occurred while communicating with Xero.";
114778
+ }
114779
+ function messageForStatus(status, detail) {
114780
+ switch (status) {
114781
+ case 401:
114782
+ return "Authentication failed. Please check your Xero credentials.";
114783
+ case 403:
114784
+ return "You don't have permission to access this resource in Xero.";
114785
+ case 404:
114786
+ return "The requested resource was not found in Xero.";
114787
+ case 429:
114788
+ return "Too many requests to Xero. Please try again in a moment.";
114789
+ default:
114790
+ return detail ? redactSensitiveText(detail) : "An error occurred while communicating with Xero.";
114791
+ }
114792
+ }
114793
+ function readDetail(body) {
114794
+ if (body && typeof body === "object" && "Detail" in body) {
114795
+ const d = body.Detail;
114796
+ return typeof d === "string" ? d : null;
114797
+ }
114798
+ return null;
114737
114799
  }
114738
114800
 
114739
114801
  // src/helpers/get-package-version.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integrity-labs/agt-cli",
3
- "version": "0.28.516",
3
+ "version": "0.28.517",
4
4
  "description": "Augmented Team CLI — agent provisioning and management",
5
5
  "type": "module",
6
6
  "engines": {