@integrity-labs/agt-cli 0.28.1253 → 0.28.1255

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 (36) hide show
  1. package/dist/{api-client-5ZXNFF4W.js → api-client-QWPG4CTP.js} +3 -3
  2. package/dist/bin/agt.js +7 -7
  3. package/dist/{chunk-233HXJ2D.js → chunk-FHBQ567A.js} +2 -2
  4. package/dist/{chunk-UHT6L77A.js → chunk-JNG5SRQC.js} +40 -3
  5. package/dist/chunk-JNG5SRQC.js.map +1 -0
  6. package/dist/{chunk-UBGHZ2O2.js → chunk-JZFSKDEJ.js} +202 -15
  7. package/dist/chunk-JZFSKDEJ.js.map +1 -0
  8. package/dist/{chunk-2HF77X4C.js → chunk-M4IKX2W2.js} +3 -3
  9. package/dist/{chunk-GRTMENH5.js → chunk-YRKZIOZ4.js} +73 -15
  10. package/dist/{chunk-GRTMENH5.js.map → chunk-YRKZIOZ4.js.map} +1 -1
  11. package/dist/{chunk-CMLBFY5C.js → chunk-ZGG6D257.js} +2 -2
  12. package/dist/{claude-code-updater-EKABTDXO.js → claude-code-updater-DE7N7KAQ.js} +3 -3
  13. package/dist/{claude-pair-runtime-ZA24UQ7V.js → claude-pair-runtime-NNQOJHPB.js} +3 -3
  14. package/dist/lib/manager-worker.js +58 -34
  15. package/dist/lib/manager-worker.js.map +1 -1
  16. package/dist/mcp/direct-chat-channel.js +33 -2
  17. package/dist/mcp/index.js +33 -2
  18. package/dist/mcp/origami.js +33 -2
  19. package/dist/mcp/remote-oauth-proxy.js +142 -5
  20. package/dist/mcp/slack-channel.js +33 -2
  21. package/dist/mcp/telegram-channel.js +33 -2
  22. package/dist/{persistent-session-HXK2Z6GH.js → persistent-session-JR6TQJXM.js} +4 -4
  23. package/dist/{responsiveness-probe-TPKISRGQ.js → responsiveness-probe-MOGAXCXI.js} +4 -4
  24. package/dist/{session-auth-dead-KMB35KRB.js → session-auth-dead-KZ7BTXYR.js} +3 -3
  25. package/package.json +1 -1
  26. package/dist/chunk-UBGHZ2O2.js.map +0 -1
  27. package/dist/chunk-UHT6L77A.js.map +0 -1
  28. /package/dist/{api-client-5ZXNFF4W.js.map → api-client-QWPG4CTP.js.map} +0 -0
  29. /package/dist/{chunk-233HXJ2D.js.map → chunk-FHBQ567A.js.map} +0 -0
  30. /package/dist/{chunk-2HF77X4C.js.map → chunk-M4IKX2W2.js.map} +0 -0
  31. /package/dist/{chunk-CMLBFY5C.js.map → chunk-ZGG6D257.js.map} +0 -0
  32. /package/dist/{claude-code-updater-EKABTDXO.js.map → claude-code-updater-DE7N7KAQ.js.map} +0 -0
  33. /package/dist/{claude-pair-runtime-ZA24UQ7V.js.map → claude-pair-runtime-NNQOJHPB.js.map} +0 -0
  34. /package/dist/{persistent-session-HXK2Z6GH.js.map → persistent-session-JR6TQJXM.js.map} +0 -0
  35. /package/dist/{responsiveness-probe-TPKISRGQ.js.map → responsiveness-probe-MOGAXCXI.js.map} +0 -0
  36. /package/dist/{session-auth-dead-KMB35KRB.js.map → session-auth-dead-KZ7BTXYR.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  HOST_ROTATE_KEY_CONFLICT
3
- } from "./chunk-UHT6L77A.js";
3
+ } from "./chunk-JNG5SRQC.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.1253" : "dev";
106
+ var agtCliVersion = true ? "0.28.1255" : "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-2HF77X4C.js.map
471
+ //# sourceMappingURL=chunk-M4IKX2W2.js.map
@@ -4,7 +4,7 @@ import {
4
4
  rotateDailySession,
5
5
  sessionFileExists,
6
6
  todayLocalIso
7
- } from "./chunk-CMLBFY5C.js";
7
+ } from "./chunk-ZGG6D257.js";
8
8
  import {
9
9
  classifyUnanswerablePane,
10
10
  customApiKeyDialogKeys,
@@ -51,7 +51,7 @@ import {
51
51
  remoteMcpConnectionEnvInfix,
52
52
  remoteMcpConnectionLabel,
53
53
  remoteMcpConnectionScopedEnvVar
54
- } from "./chunk-UHT6L77A.js";
54
+ } from "./chunk-JNG5SRQC.js";
55
55
  import {
56
56
  CLAUDE_CONFIG_DIR_ENV,
57
57
  approveApiKeyInClaudeConfig,
@@ -1088,6 +1088,23 @@ function hasGatedTool(tiers) {
1088
1088
  return true;
1089
1089
  return Object.values(tiers).some((tier) => !isAutoTier(tier));
1090
1090
  }
1091
+ function remoteMcpToolAllowlist(spec) {
1092
+ const raw = spec?.tool_allowlist;
1093
+ if (!Array.isArray(raw))
1094
+ return null;
1095
+ const names = raw.filter((n) => typeof n === "string" && n.trim() !== "" && !n.includes(",")).map((n) => n.trim());
1096
+ return names.length > 0 ? names : null;
1097
+ }
1098
+ function hasUnusableToolAllowlist(spec) {
1099
+ return hasToolAllowlistField(spec) && remoteMcpToolAllowlist(spec) === null;
1100
+ }
1101
+ function hasToolAllowlistField(spec) {
1102
+ return Array.isArray(spec?.tool_allowlist);
1103
+ }
1104
+ function toolAllowlistEnv(spec) {
1105
+ const names = remoteMcpToolAllowlist(spec);
1106
+ return names ? { [REMOTE_MCP_PROXY_ENV.toolAllowlist]: names.join(",") } : {};
1107
+ }
1091
1108
  function toolTiersEnv(tiers) {
1092
1109
  if (!tiers)
1093
1110
  return {};
@@ -1097,6 +1114,10 @@ function buildLiveHeaderRemoteMcpProxyEntry(definitionId, dbSpec, paths, connect
1097
1114
  const spec = dbSpec ?? INTEGRATION_REGISTRY.find((d) => d.id === definitionId)?.remoteMcp;
1098
1115
  if (!spec?.liveHeaderRefresh)
1099
1116
  return null;
1117
+ if (hasUnusableToolAllowlist(spec))
1118
+ return null;
1119
+ if (requiresRemoteMcpToolGate(definitionId, spec) && toolTiers == null)
1120
+ return null;
1100
1121
  assertSafeRemoteMcpUrl(spec.url, definitionId);
1101
1122
  if (!spec.auth || spec.auth.scheme !== "header" || !spec.auth.header_name) {
1102
1123
  throw new Error(`remoteMcp.liveHeaderRefresh for '${definitionId}' requires a header-scheme 'auth' with a header_name`);
@@ -1121,24 +1142,37 @@ function buildLiveHeaderRemoteMcpProxyEntry(definitionId, dbSpec, paths, connect
1121
1142
  // ENG-10614: the catalogued HITL floors. anchor-browser reaches the proxy
1122
1143
  // via this branch, so this is where its one gated tool
1123
1144
  // (`anchor_network_requests`, write_high_risk) starts being enforced.
1124
- ...toolTiersEnv(toolTiers)
1145
+ ...toolTiersEnv(toolTiers),
1146
+ // ENG-11915: the granted-tool allowlist, when a scope is denied.
1147
+ ...toolAllowlistEnv(spec)
1125
1148
  }
1126
1149
  };
1127
1150
  }
1128
- function buildOAuthRemoteMcpProxyEntry(definitionId, paths, connectionKey, toolTiers) {
1151
+ function isOAuthRemoteMcpDefinition(definitionId) {
1129
1152
  const def = INTEGRATION_REGISTRY.find((d) => d.id === definitionId);
1130
1153
  if (def?.remoteMcp)
1154
+ return false;
1155
+ return Boolean(OAUTH_PROVIDERS[definitionId]?.mcpUrl);
1156
+ }
1157
+ function buildOAuthRemoteMcpProxyEntry(definitionId, paths, connectionKey, toolTiers, brokerIntegrationId, brokerAgentId) {
1158
+ if (!isOAuthRemoteMcpDefinition(definitionId))
1131
1159
  return null;
1132
1160
  const provider = OAUTH_PROVIDERS[definitionId];
1133
- if (!provider?.mcpUrl)
1134
- return null;
1161
+ const mcpUrl = provider.mcpUrl;
1135
1162
  return {
1136
1163
  command: "node",
1137
1164
  args: [paths.proxyPath],
1138
1165
  env: {
1139
- AGT_REMOTE_MCP_URL: provider.mcpUrl,
1140
- AGT_REMOTE_MCP_TOKEN_FILE: paths.tokenFile,
1141
- AGT_REMOTE_MCP_TOKEN_VAR: envVarForToken(definitionId, connectionKey),
1166
+ AGT_REMOTE_MCP_URL: mcpUrl,
1167
+ ...brokerIntegrationId ? {
1168
+ [REMOTE_MCP_PROXY_ENV.integrationId]: brokerIntegrationId,
1169
+ // A literal `${...}` is a placeholder, never an id (ENG-4823). A plain
1170
+ // substring test, not a regex: linear on any input (CodeQL #200).
1171
+ ...brokerAgentId && !brokerAgentId.includes("${") ? { AGT_AGENT_ID: brokerAgentId } : {}
1172
+ } : {
1173
+ AGT_REMOTE_MCP_TOKEN_FILE: paths.tokenFile,
1174
+ AGT_REMOTE_MCP_TOKEN_VAR: envVarForToken(definitionId, connectionKey)
1175
+ },
1142
1176
  AGT_REMOTE_MCP_LABEL: remoteMcpConnectionLabel(definitionId, connectionKey),
1143
1177
  // ENG-6948: cap the agent's exposed surface to the curated allowlist. The
1144
1178
  // proxy filters tools/list and gates tools/call against this set. Omitted
@@ -1165,16 +1199,36 @@ function requiresRemoteMcpToolGate(definitionId, dbSpec) {
1165
1199
  const spec = dbSpec ?? INTEGRATION_REGISTRY.find((d) => d.id === definitionId)?.remoteMcp;
1166
1200
  return spec?.requireToolTiers === true;
1167
1201
  }
1202
+ function mustNotRenderDirectRemoteMcp(definitionId, dbSpec) {
1203
+ if (requiresRemoteMcpToolGate(definitionId, dbSpec))
1204
+ return true;
1205
+ const spec = dbSpec ?? INTEGRATION_REGISTRY.find((d) => d.id === definitionId)?.remoteMcp;
1206
+ return hasToolAllowlistField(spec);
1207
+ }
1208
+ function withheldRemoteMcpReasonFor(integration) {
1209
+ if (integration.remoteMcp?.requireToolTiers === true && integration.toolTiers == null)
1210
+ return "no_tier_table";
1211
+ if (hasToolAllowlistField(integration.remoteMcp))
1212
+ return "tool_allowlist_unrendered";
1213
+ return integration.toolTiers == null ? "no_tier_table" : "no_gated_tool";
1214
+ }
1168
1215
  function withheldRemoteMcpMessage(definitionId, reason) {
1216
+ if (reason === "tool_allowlist_unrendered") {
1217
+ return `[provisioning] ENG-11915: remote MCP '${definitionId}' WITHHELD: the agent was granted only some of its scopes, which only the remote-MCP proxy can enforce, and no proxy entry could be rendered. It gets no entry rather than one serving the denied scopes' tools.`;
1218
+ }
1169
1219
  const why = reason === "no_tier_table" ? "no tool tier table arrived this cycle (did the tool_definitions read fail?)" : reason === "no_gated_tool" ? "its tier table has no gated tool, so no proxy was rendered" : "this framework cannot gate remote MCPs";
1170
1220
  return `[provisioning] CS-1561: remote MCP '${definitionId}' WITHHELD: it requires its tool tier gate and ${why}. It gets no entry rather than an ungated one, so the agent has no ${definitionId} tools until this clears.`;
1171
1221
  }
1172
1222
  function buildApiKeyRemoteMcpProxyEntry(definitionId, dbSpec, paths, connectionKey, toolTiers) {
1173
- if (!hasGatedTool(toolTiers))
1174
- return null;
1175
1223
  const spec = dbSpec ?? INTEGRATION_REGISTRY.find((d) => d.id === definitionId)?.remoteMcp;
1176
1224
  if (!spec)
1177
1225
  return null;
1226
+ if (hasUnusableToolAllowlist(spec))
1227
+ return null;
1228
+ if (!hasGatedTool(toolTiers) && remoteMcpToolAllowlist(spec) === null)
1229
+ return null;
1230
+ if (requiresRemoteMcpToolGate(definitionId, spec) && toolTiers == null)
1231
+ return null;
1178
1232
  if (spec.liveHeaderRefresh)
1179
1233
  return null;
1180
1234
  if (!spec.auth?.credential_ref)
@@ -1204,7 +1258,8 @@ function buildApiKeyRemoteMcpProxyEntry(definitionId, dbSpec, paths, connectionK
1204
1258
  AGT_REMOTE_MCP_LABEL: remoteMcpConnectionLabel(definitionId, connectionKey),
1205
1259
  ...scheme === "header" && spec.auth.header_name ? { AGT_REMOTE_MCP_AUTH_HEADER: spec.auth.header_name } : {},
1206
1260
  ...extraPairs.length > 0 ? { AGT_REMOTE_MCP_EXTRA_HEADERS: extraPairs.join(",") } : {},
1207
- ...toolTiersEnv(toolTiers)
1261
+ ...toolTiersEnv(toolTiers),
1262
+ ...toolAllowlistEnv(spec)
1208
1263
  }
1209
1264
  };
1210
1265
  }
@@ -1341,8 +1396,8 @@ function buildOpencodeIntegrationServers(integrations, ctx) {
1341
1396
  }
1342
1397
  for (const integration of integrations) {
1343
1398
  const def = INTEGRATION_REGISTRY.find((d) => d.id === integration.definition_id);
1344
- if (requiresRemoteMcpToolGate(integration.definition_id, integration.remoteMcp ?? null)) {
1345
- console.error(withheldRemoteMcpMessage(integration.definition_id, "framework_cannot_gate"));
1399
+ if (mustNotRenderDirectRemoteMcp(integration.definition_id, integration.remoteMcp ?? null)) {
1400
+ console.error(withheldRemoteMcpMessage(integration.definition_id, hasToolAllowlistField(integration.remoteMcp ?? null) ? "tool_allowlist_unrendered" : "framework_cannot_gate"));
1346
1401
  continue;
1347
1402
  }
1348
1403
  const remote = buildRemoteMcpEntry(integration.definition_id, integration.remoteMcp ?? null);
@@ -6082,9 +6137,12 @@ export {
6082
6137
  PLATFORM_DENY_PERMISSIONS,
6083
6138
  agentTmpDirFor,
6084
6139
  buildRemoteMcpEntry,
6140
+ hasToolAllowlistField,
6085
6141
  buildLiveHeaderRemoteMcpProxyEntry,
6086
6142
  buildOAuthRemoteMcpProxyEntry,
6087
6143
  requiresRemoteMcpToolGate,
6144
+ mustNotRenderDirectRemoteMcp,
6145
+ withheldRemoteMcpReasonFor,
6088
6146
  withheldRemoteMcpMessage,
6089
6147
  buildApiKeyRemoteMcpProxyEntry,
6090
6148
  buildNativeMcpEntry,
@@ -6219,4 +6277,4 @@ export {
6219
6277
  stopAllSessionsAndWait,
6220
6278
  getProjectDir
6221
6279
  };
6222
- //# sourceMappingURL=chunk-GRTMENH5.js.map
6280
+ //# sourceMappingURL=chunk-YRKZIOZ4.js.map