@integrity-labs/agt-cli 0.28.497 → 0.28.498

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.
@@ -6063,6 +6063,42 @@ function buildForwardHeaders(token, authHeader, extras, readVar) {
6063
6063
  return headers;
6064
6064
  }
6065
6065
 
6066
+ // ../../packages/core/dist/integrations/remote-mcp-connection.js
6067
+ var DEFAULT_REMOTE_MCP_CONNECTION_KEY = "default";
6068
+ function isDefaultRemoteMcpConnection(connectionKey) {
6069
+ return !connectionKey || connectionKey === DEFAULT_REMOTE_MCP_CONNECTION_KEY;
6070
+ }
6071
+ function sanitizeBase(definitionId) {
6072
+ return definitionId.replace(/[^a-z0-9]/gi, "_").toLowerCase();
6073
+ }
6074
+ function remoteMcpServerKey(definitionId, connectionKey) {
6075
+ if (isDefaultRemoteMcpConnection(connectionKey))
6076
+ return definitionId;
6077
+ return `${sanitizeBase(definitionId)}-${connectionKey}`;
6078
+ }
6079
+ function remoteMcpConnectionEnvInfix(connectionKey) {
6080
+ if (isDefaultRemoteMcpConnection(connectionKey))
6081
+ return "";
6082
+ return `__${connectionKey.replace(/-/g, "_").toUpperCase()}`;
6083
+ }
6084
+ function remoteMcpEnvPrefix(definitionId, connectionKey) {
6085
+ const idPart = definitionId.toUpperCase().replace(/[^A-Z0-9]/g, "_");
6086
+ return `${idPart}${remoteMcpConnectionEnvInfix(connectionKey)}`;
6087
+ }
6088
+ function remoteMcpConnectionScopedEnvVar(definitionId, varName, connectionKey) {
6089
+ if (isDefaultRemoteMcpConnection(connectionKey))
6090
+ return varName;
6091
+ const idPart = definitionId.toUpperCase().replace(/[^A-Z0-9]/g, "_");
6092
+ if (!varName.startsWith(`${idPart}_`))
6093
+ return varName;
6094
+ return `${idPart}${remoteMcpConnectionEnvInfix(connectionKey)}_${varName.slice(idPart.length + 1)}`;
6095
+ }
6096
+ function remoteMcpConnectionLabel(definitionId, connectionKey) {
6097
+ if (isDefaultRemoteMcpConnection(connectionKey))
6098
+ return definitionId;
6099
+ return `${definitionId} (${connectionKey})`;
6100
+ }
6101
+
6066
6102
  // ../../packages/core/dist/integrations/registry.js
6067
6103
  var INTEGRATION_REGISTRY = [
6068
6104
  {
@@ -10047,6 +10083,18 @@ var FLAG_REGISTRY = [
10047
10083
  // env var is retired.
10048
10084
  envVar: "AUGMENTED_CONNECTIVITY_ESCALATION_ENABLED"
10049
10085
  },
10086
+ {
10087
+ key: "integration-reauth-reminders",
10088
+ description: "Re-notify an integration that stays in needs_reauth (ENG-8370). Failure notification is at-most-once PER TRANSITION, so an integration nobody repairs is announced once and then silent forever - prod carried a row failing every 30-minute tick for ~21 days on a single day-one notification. When on, the IntegrationReauthReminder cron re-fires the existing reconnect notification on a backoff measured from failure ONSET (+1d, +3d, +7d, then weekly), skipping rows an operator has muted. When off the cron still scans and logs what it WOULD have sent, so the volume can be sized before anyone is messaged. Boolean gate; ships dark.",
10089
+ flagType: "boolean",
10090
+ // `false` is both the pre-ENG-8370 fleet behaviour AND the fail-safe
10091
+ // direction: this flag governs how often real humans get messaged, so a
10092
+ // flag-DB read error must never start sending on its own. Turning it on is
10093
+ // a deliberate per-org act from the admin Feature Flags page, never a
10094
+ // side-effect of a deploy. No env override - net-new gate, registry-only
10095
+ // (ADR-0022).
10096
+ defaultValue: false
10097
+ },
10050
10098
  {
10051
10099
  key: "managed-health-connectivity-flip",
10052
10100
  description: "Arm the managed-connection-health status flip on data-plane hard-down (ENG-7539). When on, the managed-connection-health cron flips a managed integration to needs_reauth when the host-side connectivity probe reports a sustained hard-down (consecutive_connectivity_failures at/over the hysteresis threshold with a down observation), even if Composio account-status still reads ACTIVE. When off it keeps the pre-ENG-7539 behaviour: status is driven only by the account-status probe, so a live 401 behind an ACTIVE account never flips status. Boolean gate; ships dark. Sibling of integration-connectivity-escalation: that flag arms the alert; this flag arms the status flip plus the reconnect notification.",
@@ -10760,13 +10808,14 @@ function generateAgentsMd(input) {
10760
10808
  }
10761
10809
 
10762
10810
  // ../../packages/core/dist/provisioning/remote-mcp.js
10763
- function envVarForToken(definitionId) {
10764
- return `${definitionId.replace(/-/g, "_").toUpperCase()}_ACCESS_TOKEN`;
10811
+ function envVarForToken(definitionId, connectionKey) {
10812
+ const idPart = definitionId.replace(/-/g, "_").toUpperCase();
10813
+ return `${idPart}${remoteMcpConnectionEnvInfix(connectionKey)}_ACCESS_TOKEN`;
10765
10814
  }
10766
- function credentialEnvVar(definitionId, credentialRef) {
10815
+ function credentialEnvVar(definitionId, credentialRef, connectionKey) {
10767
10816
  const idPart = definitionId.replace(/-/g, "_").toUpperCase();
10768
10817
  const credPart = credentialRef.replace(/-/g, "_").toUpperCase();
10769
- return `${idPart}_${credPart}`;
10818
+ return `${idPart}${remoteMcpConnectionEnvInfix(connectionKey)}_${credPart}`;
10770
10819
  }
10771
10820
  function assertSafeRemoteMcpUrl(url, definitionId) {
10772
10821
  let u;
@@ -10787,11 +10836,11 @@ function assertSafeRemoteMcpUrl(url, definitionId) {
10787
10836
  throw new Error(`remoteMcp.url for '${definitionId}' resolves to a disallowed (internal/link-local/metadata) host: ${host}`);
10788
10837
  }
10789
10838
  }
10790
- function renderRemoteMcpSpec(definitionId, spec) {
10839
+ function renderRemoteMcpSpec(definitionId, spec, connectionKey) {
10791
10840
  assertSafeRemoteMcpUrl(spec.url, definitionId);
10792
10841
  const headers = {};
10793
10842
  if (spec.auth) {
10794
- const envVar = credentialEnvVar(definitionId, spec.auth.credential_ref);
10843
+ const envVar = credentialEnvVar(definitionId, spec.auth.credential_ref, connectionKey);
10795
10844
  const value = `\${${envVar}}`;
10796
10845
  if (spec.auth.scheme === "bearer") {
10797
10846
  headers["Authorization"] = `Bearer ${value}`;
@@ -10802,17 +10851,24 @@ function renderRemoteMcpSpec(definitionId, spec) {
10802
10851
  headers[spec.auth.header_name] = value;
10803
10852
  }
10804
10853
  }
10805
- Object.assign(headers, spec.headers ?? {});
10854
+ if (isDefaultRemoteMcpConnection(connectionKey)) {
10855
+ Object.assign(headers, spec.headers ?? {});
10856
+ } else {
10857
+ for (const [header, value] of Object.entries(spec.headers ?? {})) {
10858
+ const varName = extractHeaderVarName(value);
10859
+ headers[header] = varName ? `\${${remoteMcpConnectionScopedEnvVar(definitionId, varName, connectionKey)}}` : value;
10860
+ }
10861
+ }
10806
10862
  return {
10807
10863
  type: spec.type ?? "http",
10808
10864
  url: spec.url,
10809
10865
  ...Object.keys(headers).length > 0 ? { headers } : {}
10810
10866
  };
10811
10867
  }
10812
- function buildRemoteMcpEntry(definitionId, dbSpec) {
10868
+ function buildRemoteMcpEntry(definitionId, dbSpec, connectionKey) {
10813
10869
  const spec = dbSpec ?? INTEGRATION_REGISTRY.find((d) => d.id === definitionId)?.remoteMcp;
10814
10870
  if (spec) {
10815
- return renderRemoteMcpSpec(definitionId, spec);
10871
+ return renderRemoteMcpSpec(definitionId, spec, connectionKey);
10816
10872
  }
10817
10873
  const provider = OAUTH_PROVIDERS[definitionId];
10818
10874
  if (!provider?.mcpUrl)
@@ -10821,7 +10877,7 @@ function buildRemoteMcpEntry(definitionId, dbSpec) {
10821
10877
  type: "http",
10822
10878
  url: provider.mcpUrl,
10823
10879
  headers: {
10824
- Authorization: `Bearer \${${envVarForToken(definitionId)}}`
10880
+ Authorization: `Bearer \${${envVarForToken(definitionId, connectionKey)}}`
10825
10881
  }
10826
10882
  };
10827
10883
  }
@@ -10832,7 +10888,7 @@ function extractHeaderVarName(value) {
10832
10888
  const m = /^\$\{([A-Za-z_][A-Za-z0-9_]*)\}$/.exec(value.trim());
10833
10889
  return m ? m[1] : null;
10834
10890
  }
10835
- function buildLiveHeaderRemoteMcpProxyEntry(definitionId, dbSpec, paths) {
10891
+ function buildLiveHeaderRemoteMcpProxyEntry(definitionId, dbSpec, paths, connectionKey) {
10836
10892
  const spec = dbSpec ?? INTEGRATION_REGISTRY.find((d) => d.id === definitionId)?.remoteMcp;
10837
10893
  if (!spec?.liveHeaderRefresh)
10838
10894
  return null;
@@ -10843,8 +10899,9 @@ function buildLiveHeaderRemoteMcpProxyEntry(definitionId, dbSpec, paths) {
10843
10899
  const extraPairs = [];
10844
10900
  for (const [header, value] of Object.entries(spec.headers ?? {})) {
10845
10901
  const varName = extractHeaderVarName(value);
10846
- if (varName)
10847
- extraPairs.push(`${header}:${varName}`);
10902
+ if (varName) {
10903
+ extraPairs.push(`${header}:${remoteMcpConnectionScopedEnvVar(definitionId, varName, connectionKey)}`);
10904
+ }
10848
10905
  }
10849
10906
  return {
10850
10907
  command: "node",
@@ -10852,14 +10909,14 @@ function buildLiveHeaderRemoteMcpProxyEntry(definitionId, dbSpec, paths) {
10852
10909
  env: {
10853
10910
  AGT_REMOTE_MCP_URL: spec.url,
10854
10911
  AGT_REMOTE_MCP_TOKEN_FILE: paths.tokenFile,
10855
- AGT_REMOTE_MCP_TOKEN_VAR: credentialEnvVar(definitionId, spec.auth.credential_ref),
10912
+ AGT_REMOTE_MCP_TOKEN_VAR: credentialEnvVar(definitionId, spec.auth.credential_ref, connectionKey),
10856
10913
  AGT_REMOTE_MCP_AUTH_HEADER: spec.auth.header_name,
10857
- AGT_REMOTE_MCP_LABEL: definitionId,
10914
+ AGT_REMOTE_MCP_LABEL: remoteMcpConnectionLabel(definitionId, connectionKey),
10858
10915
  ...extraPairs.length > 0 ? { AGT_REMOTE_MCP_EXTRA_HEADERS: extraPairs.join(",") } : {}
10859
10916
  }
10860
10917
  };
10861
10918
  }
10862
- function buildOAuthRemoteMcpProxyEntry(definitionId, paths) {
10919
+ function buildOAuthRemoteMcpProxyEntry(definitionId, paths, connectionKey) {
10863
10920
  const def = INTEGRATION_REGISTRY.find((d) => d.id === definitionId);
10864
10921
  if (def?.remoteMcp)
10865
10922
  return null;
@@ -10872,8 +10929,8 @@ function buildOAuthRemoteMcpProxyEntry(definitionId, paths) {
10872
10929
  env: {
10873
10930
  AGT_REMOTE_MCP_URL: provider.mcpUrl,
10874
10931
  AGT_REMOTE_MCP_TOKEN_FILE: paths.tokenFile,
10875
- AGT_REMOTE_MCP_TOKEN_VAR: envVarForToken(definitionId),
10876
- AGT_REMOTE_MCP_LABEL: definitionId,
10932
+ AGT_REMOTE_MCP_TOKEN_VAR: envVarForToken(definitionId, connectionKey),
10933
+ AGT_REMOTE_MCP_LABEL: remoteMcpConnectionLabel(definitionId, connectionKey),
10877
10934
  // ENG-6948: cap the agent's exposed surface to the curated allowlist. The
10878
10935
  // proxy filters tools/list and gates tools/call against this set. Omitted
10879
10936
  // when the provider has no allowlist, leaving the proxy a pass-through.
@@ -14490,6 +14547,10 @@ export {
14490
14547
  INTEGRATION_REGISTRY,
14491
14548
  getIntegration,
14492
14549
  OAUTH_PROVIDERS,
14550
+ isDefaultRemoteMcpConnection,
14551
+ remoteMcpServerKey,
14552
+ remoteMcpEnvPrefix,
14553
+ remoteMcpConnectionScopedEnvVar,
14493
14554
  buildRemoteMcpEntry,
14494
14555
  buildHostBrokeredRemoteMcpEntry,
14495
14556
  buildLiveHeaderRemoteMcpProxyEntry,
@@ -14647,4 +14708,4 @@ export {
14647
14708
  stopAllSessionsAndWait,
14648
14709
  getProjectDir
14649
14710
  };
14650
- //# sourceMappingURL=chunk-UNAP4CMY.js.map
14711
+ //# sourceMappingURL=chunk-WRII2Q5W.js.map