@integrity-labs/agt-cli 0.28.1278 → 0.28.1279

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.
Files changed (27) hide show
  1. package/dist/{api-client-C4Q5225W.js → api-client-YA7657ZN.js} +3 -3
  2. package/dist/bin/agt.js +7 -7
  3. package/dist/{chunk-C3NM6OTP.js → chunk-AW6F22KT.js} +2 -2
  4. package/dist/{chunk-QDYB6DUP.js → chunk-IEZRWDI2.js} +3 -3
  5. package/dist/{chunk-ZQVYTNLA.js → chunk-QAK6K6YV.js} +46 -8
  6. package/dist/{chunk-ZQVYTNLA.js.map → chunk-QAK6K6YV.js.map} +1 -1
  7. package/dist/{chunk-3POXIX7X.js → chunk-TGYLUTCA.js} +3 -3
  8. package/dist/{chunk-IEXBHI4X.js → chunk-VB63HJVE.js} +2 -2
  9. package/dist/{chunk-IASOIXOV.js → chunk-XTLIEWQ6.js} +5 -5
  10. package/dist/{claude-code-updater-GADHFGSY.js → claude-code-updater-HAUG3LWF.js} +3 -3
  11. package/dist/{claude-pair-runtime-CNYIVUOQ.js → claude-pair-runtime-EBORDHDL.js} +3 -3
  12. package/dist/lib/manager-worker.js +21 -21
  13. package/dist/{persistent-session-6B2DPG4U.js → persistent-session-GT56CLOE.js} +4 -4
  14. package/dist/{responsiveness-probe-ZN2VIGOX.js → responsiveness-probe-CNKJ7AW2.js} +4 -4
  15. package/dist/{session-auth-dead-7NXTFGDV.js → session-auth-dead-TDZADZTZ.js} +3 -3
  16. package/package.json +1 -1
  17. /package/dist/{api-client-C4Q5225W.js.map → api-client-YA7657ZN.js.map} +0 -0
  18. /package/dist/{chunk-C3NM6OTP.js.map → chunk-AW6F22KT.js.map} +0 -0
  19. /package/dist/{chunk-QDYB6DUP.js.map → chunk-IEZRWDI2.js.map} +0 -0
  20. /package/dist/{chunk-3POXIX7X.js.map → chunk-TGYLUTCA.js.map} +0 -0
  21. /package/dist/{chunk-IEXBHI4X.js.map → chunk-VB63HJVE.js.map} +0 -0
  22. /package/dist/{chunk-IASOIXOV.js.map → chunk-XTLIEWQ6.js.map} +0 -0
  23. /package/dist/{claude-code-updater-GADHFGSY.js.map → claude-code-updater-HAUG3LWF.js.map} +0 -0
  24. /package/dist/{claude-pair-runtime-CNYIVUOQ.js.map → claude-pair-runtime-EBORDHDL.js.map} +0 -0
  25. /package/dist/{persistent-session-6B2DPG4U.js.map → persistent-session-GT56CLOE.js.map} +0 -0
  26. /package/dist/{responsiveness-probe-ZN2VIGOX.js.map → responsiveness-probe-CNKJ7AW2.js.map} +0 -0
  27. /package/dist/{session-auth-dead-7NXTFGDV.js.map → session-auth-dead-TDZADZTZ.js.map} +0 -0
@@ -15,8 +15,8 @@ import {
15
15
  mintRotatedHostKey,
16
16
  probeHostKey,
17
17
  setConfigHash
18
- } from "./chunk-QDYB6DUP.js";
19
- import "./chunk-ZQVYTNLA.js";
18
+ } from "./chunk-IEZRWDI2.js";
19
+ import "./chunk-QAK6K6YV.js";
20
20
  import "./chunk-DGUM43GV.js";
21
21
  export {
22
22
  ApiError,
@@ -36,4 +36,4 @@ export {
36
36
  probeHostKey,
37
37
  setConfigHash
38
38
  };
39
- //# sourceMappingURL=api-client-C4Q5225W.js.map
39
+ //# sourceMappingURL=api-client-YA7657ZN.js.map
package/dist/bin/agt.js CHANGED
@@ -31,7 +31,7 @@ import {
31
31
  success,
32
32
  table,
33
33
  warn
34
- } from "../chunk-IASOIXOV.js";
34
+ } from "../chunk-XTLIEWQ6.js";
35
35
  import {
36
36
  ApiError,
37
37
  PROD_AGT_HOST,
@@ -42,17 +42,17 @@ import {
42
42
  getHost,
43
43
  getHostId,
44
44
  setActiveTeam
45
- } from "../chunk-QDYB6DUP.js";
45
+ } from "../chunk-IEZRWDI2.js";
46
46
  import {
47
47
  getProjectDir,
48
48
  isSessionResumeDisabled,
49
49
  readDirectChatSessionState
50
- } from "../chunk-3POXIX7X.js";
50
+ } from "../chunk-TGYLUTCA.js";
51
51
  import {
52
52
  markDailySessionSpawn,
53
53
  sessionFileExists,
54
54
  sessionTranscriptDir
55
- } from "../chunk-IEXBHI4X.js";
55
+ } from "../chunk-VB63HJVE.js";
56
56
  import "../chunk-XL2HPM67.js";
57
57
  import "../chunk-6HBXEJHO.js";
58
58
  import "../chunk-XWVM4KPK.js";
@@ -85,7 +85,7 @@ import {
85
85
  requiredMcpWildcard,
86
86
  resolveChannels,
87
87
  serializeManifestForSlackCli
88
- } from "../chunk-ZQVYTNLA.js";
88
+ } from "../chunk-QAK6K6YV.js";
89
89
  import "../chunk-AIUIMEUS.js";
90
90
  import "../chunk-DGUM43GV.js";
91
91
 
@@ -5207,7 +5207,7 @@ import { execFileSync, execSync } from "child_process";
5207
5207
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
5208
5208
  import chalk17 from "chalk";
5209
5209
  import ora15 from "ora";
5210
- var cliVersion = true ? "0.28.1278" : "dev";
5210
+ var cliVersion = true ? "0.28.1279" : "dev";
5211
5211
  async function fetchLatestVersion() {
5212
5212
  const host2 = getHost();
5213
5213
  if (!host2) return null;
@@ -6467,7 +6467,7 @@ function handleError(err) {
6467
6467
  }
6468
6468
 
6469
6469
  // src/bin/agt.ts
6470
- var cliVersion2 = true ? "0.28.1278" : "dev";
6470
+ var cliVersion2 = true ? "0.28.1279" : "dev";
6471
6471
  var program = new Command();
6472
6472
  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");
6473
6473
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-XWVM4KPK.js";
5
5
  import {
6
6
  FORCED_UPDATE_HARD_DEADLINE_MS
7
- } from "./chunk-ZQVYTNLA.js";
7
+ } from "./chunk-QAK6K6YV.js";
8
8
  import {
9
9
  effectiveClaudeJsonPath
10
10
  } from "./chunk-AIUIMEUS.js";
@@ -722,4 +722,4 @@ export {
722
722
  probeClaudeInstalls,
723
723
  maybeUpdateClaudeCode
724
724
  };
725
- //# sourceMappingURL=chunk-C3NM6OTP.js.map
725
+ //# sourceMappingURL=chunk-AW6F22KT.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  HOST_ROTATE_KEY_CONFLICT
3
- } from "./chunk-ZQVYTNLA.js";
3
+ } from "./chunk-QAK6K6YV.js";
4
4
 
5
5
  // src/lib/config.ts
6
6
  import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
@@ -103,7 +103,7 @@ function exchangeFailureKind(err) {
103
103
  }
104
104
 
105
105
  // src/lib/api-client.ts
106
- var agtCliVersion = true ? "0.28.1278" : "dev";
106
+ var agtCliVersion = true ? "0.28.1279" : "dev";
107
107
  var lastConfigHash = null;
108
108
  function setConfigHash(hash) {
109
109
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -468,4 +468,4 @@ export {
468
468
  api,
469
469
  getHostId
470
470
  };
471
- //# sourceMappingURL=chunk-QDYB6DUP.js.map
471
+ //# sourceMappingURL=chunk-IEZRWDI2.js.map
@@ -15344,6 +15344,9 @@ var SCOPE_DEFICIT_ERROR_PATTERNS = [
15344
15344
  // Shopify custom-app specifics.
15345
15345
  "read_content",
15346
15346
  "write_content",
15347
+ // ENG-12209: Shopify's Admin API wording for an ungranted scope:
15348
+ // "This action requires merchant approval for read_customers scope".
15349
+ "requires merchant approval",
15347
15350
  "sales channel is not enabled"
15348
15351
  ];
15349
15352
  var QUOTA_EXHAUSTED_ERROR_PATTERNS = [
@@ -15384,11 +15387,20 @@ function isReadonlyToolDescriptor(t) {
15384
15387
  return !(Array.isArray(required) && required.length > 0);
15385
15388
  }
15386
15389
  function pickSafeReadonlyTool(tools) {
15387
- for (const t of tools) {
15388
- if (isReadonlyToolDescriptor(t))
15389
- return t.name;
15390
- }
15391
- return null;
15390
+ const safe = tools.filter((t) => isReadonlyToolDescriptor(t));
15391
+ const identity = safe.find((t) => isIdentityReadTool(t.name));
15392
+ return (identity ?? safe[0])?.name ?? null;
15393
+ }
15394
+ var IDENTITY_READ_TOKENS = ["SHOP", "ME", "WHOAMI", "PROFILE", "ACCOUNT", "ORGANIZATION", "WORKSPACE", "USER"];
15395
+ function isIdentityReadTool(name) {
15396
+ const tokens = name.toUpperCase().split(/[^A-Z0-9]+/).filter(Boolean);
15397
+ if (tokens.includes("CURRENT") && tokens.includes("USER"))
15398
+ return true;
15399
+ const verbAt = tokens.indexOf("GET");
15400
+ if (verbAt < 0)
15401
+ return false;
15402
+ const last = tokens[tokens.length - 1] ?? "";
15403
+ return verbAt < tokens.length - 1 && IDENTITY_READ_TOKENS.includes(last);
15392
15404
  }
15393
15405
  function resolveProbeTool(tools, override) {
15394
15406
  const requested = override?.tool?.trim();
@@ -15427,7 +15439,10 @@ function isScopeDeficitError(message) {
15427
15439
  const m = message.toLowerCase();
15428
15440
  if (SCOPE_DEFICIT_ERROR_PATTERNS.some((p2) => m.includes(p2)))
15429
15441
  return true;
15430
- return m.includes("scope") && ["doesn't have", "does not have", "not have the", "not granted", "lacks the", "not authorized for"].some((p2) => m.includes(p2));
15442
+ if (m.includes("scope") && ["doesn't have", "does not have", "not have the", "not granted", "lacks the", "not authorized for"].some((p2) => m.includes(p2))) {
15443
+ return true;
15444
+ }
15445
+ return false;
15431
15446
  }
15432
15447
  function isQuotaExhaustedError(message) {
15433
15448
  const m = message.toLowerCase();
@@ -15469,6 +15484,9 @@ function isProviderAccessBlockedError(message) {
15469
15484
  const m = message.toLowerCase();
15470
15485
  return PROVIDER_ACCESS_BLOCKED_ERROR_PATTERNS.some((p2) => m.includes(p2));
15471
15486
  }
15487
+ function isProvenScopeDeficit(message) {
15488
+ return /requires merchant approval for [^"{}\n]{1,80}? scope\b/i.test(message);
15489
+ }
15472
15490
  function classifyToolCallFailure(text) {
15473
15491
  if (isAccountResolutionError(text))
15474
15492
  return "account";
@@ -15601,6 +15619,7 @@ async function probeComposioMcpToolCall(config, fetchImpl = fetch) {
15601
15619
  const redactedFailure = redactSentHeaders(failureText, config.headers);
15602
15620
  const snippet = redactedFailure.length > 200 ? `${redactedFailure.slice(0, 200)}\u2026` : redactedFailure;
15603
15621
  const kind = classifyToolCallFailure(failureText);
15622
+ const usedPrescribedTest = Boolean(resolved.requestedTool && !resolved.fallback && toolName === resolved.requestedTool);
15604
15623
  if (kind === "account") {
15605
15624
  return {
15606
15625
  status: "down",
@@ -15625,7 +15644,19 @@ async function probeComposioMcpToolCall(config, fetchImpl = fetch) {
15625
15644
  return {
15626
15645
  status: "degraded",
15627
15646
  message: `Live tool call '${toolName}' was refused for a missing permission \u2014 the connection is valid, but its app/token isn't granted the scope this tool needs. Grant the required scope in the provider app and re-authorise (this is NOT a reconnect): ${snippet}`,
15628
- details: { ...baseDetails, reason: "scope_deficit" }
15647
+ details: { ...baseDetails, reason: "scope_deficit" },
15648
+ // ENG-12209: the self-heal cause, on the wire, ONLY when (1) the text is
15649
+ // the exact observed wording (isProvenScopeDeficit), never a broad scope
15650
+ // match (Obi Wan 2e4968da67c1), and (2) the refused tool is NOT this
15651
+ // integration's prescribed connectivity test. A prescribed test missing a
15652
+ // scope means the integration cannot do its job (the ENG-8406 case), so
15653
+ // it stays a non-healing degraded that keeps alerting (Obi Wan
15654
+ // 409f3829b983). An optional-scope tool picked by the heuristic or a
15655
+ // fallback is exactly the read-only-store case the self-heal is for.
15656
+ // Each ORIGINAL response string on its own (the RPC error, and each content
15657
+ // item): a phrase assembled across them by the space-join must not qualify
15658
+ // (CodeRabbit on #7713).
15659
+ ...[rpcErrMsg, ...(result?.content ?? []).map((c) => c.text)].some((t) => typeof t === "string" && isProvenScopeDeficit(t)) && !usedPrescribedTest ? { cause: "scope_deficit" } : {}
15629
15660
  };
15630
15661
  }
15631
15662
  if (kind === "auth") {
@@ -15656,6 +15687,13 @@ async function probeComposioMcpToolCall(config, fetchImpl = fetch) {
15656
15687
  details: { ...baseDetails, reason: "connectivity_test_failed", tool_error: snippet }
15657
15688
  };
15658
15689
  }
15690
+ if (/\bscopes?\b/i.test(failureText)) {
15691
+ return {
15692
+ status: "degraded",
15693
+ message: `Live tool call '${toolName}' was refused with a scope-related error the probe does not recognise, so the connection cannot be confirmed working: ${snippet}`,
15694
+ details: { ...baseDetails, reason: "unrecognised_scope_refusal", tool_error: snippet }
15695
+ };
15696
+ }
15659
15697
  return {
15660
15698
  status: "ok",
15661
15699
  message: `Live tool call '${toolName}' resolved the account (tool error: ${snippet})`,
@@ -18986,4 +19024,4 @@ export {
18986
19024
  HOST_ROTATE_KEY_CONFLICT,
18987
19025
  shouldMintReplacementKey
18988
19026
  };
18989
- //# sourceMappingURL=chunk-ZQVYTNLA.js.map
19027
+ //# sourceMappingURL=chunk-QAK6K6YV.js.map