@integrity-labs/agt-cli 0.28.317 → 0.28.319

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.
@@ -18,7 +18,7 @@ import {
18
18
  resolveConnectivityProbe,
19
19
  worseConnectivityOutcome,
20
20
  wrapScheduledTaskPrompt
21
- } from "./chunk-ORTMG5E3.js";
21
+ } from "./chunk-ISHK77EM.js";
22
22
  import {
23
23
  parsePsRows
24
24
  } from "./chunk-XWVM4KPK.js";
@@ -1962,6 +1962,37 @@ function buildRemoteMcpEntry(definitionId, dbSpec) {
1962
1962
  function buildHostBrokeredRemoteMcpEntry(url) {
1963
1963
  return { type: "http", url };
1964
1964
  }
1965
+ function extractHeaderVarName(value) {
1966
+ const m = /^\$\{([A-Za-z_][A-Za-z0-9_]*)\}$/.exec(value.trim());
1967
+ return m ? m[1] : null;
1968
+ }
1969
+ function buildLiveHeaderRemoteMcpProxyEntry(definitionId, dbSpec, paths) {
1970
+ const spec = dbSpec ?? INTEGRATION_REGISTRY.find((d) => d.id === definitionId)?.remoteMcp;
1971
+ if (!spec?.liveHeaderRefresh)
1972
+ return null;
1973
+ assertSafeRemoteMcpUrl(spec.url, definitionId);
1974
+ if (!spec.auth || spec.auth.scheme !== "header" || !spec.auth.header_name) {
1975
+ throw new Error(`remoteMcp.liveHeaderRefresh for '${definitionId}' requires a header-scheme 'auth' with a header_name`);
1976
+ }
1977
+ const extraPairs = [];
1978
+ for (const [header, value] of Object.entries(spec.headers ?? {})) {
1979
+ const varName = extractHeaderVarName(value);
1980
+ if (varName)
1981
+ extraPairs.push(`${header}:${varName}`);
1982
+ }
1983
+ return {
1984
+ command: "node",
1985
+ args: [paths.proxyPath],
1986
+ env: {
1987
+ AGT_REMOTE_MCP_URL: spec.url,
1988
+ AGT_REMOTE_MCP_TOKEN_FILE: paths.tokenFile,
1989
+ AGT_REMOTE_MCP_TOKEN_VAR: credentialEnvVar(definitionId, spec.auth.credential_ref),
1990
+ AGT_REMOTE_MCP_AUTH_HEADER: spec.auth.header_name,
1991
+ AGT_REMOTE_MCP_LABEL: definitionId,
1992
+ ...extraPairs.length > 0 ? { AGT_REMOTE_MCP_EXTRA_HEADERS: extraPairs.join(",") } : {}
1993
+ }
1994
+ };
1995
+ }
1965
1996
  function buildOAuthRemoteMcpProxyEntry(definitionId, paths) {
1966
1997
  const def = INTEGRATION_REGISTRY.find((d) => d.id === definitionId);
1967
1998
  if (def?.remoteMcp)
@@ -4184,6 +4215,11 @@ function buildMcpJson(input) {
4184
4215
  tokenFile: join2(getProjectDir(input.agent.code_name), ".env.integrations")
4185
4216
  };
4186
4217
  for (const integration of input.integrations ?? []) {
4218
+ const liveEntry = buildLiveHeaderRemoteMcpProxyEntry(integration.definition_id, integration.remoteMcp, remoteOAuthProxyPaths);
4219
+ if (liveEntry) {
4220
+ mcpServers[integration.definition_id] = liveEntry;
4221
+ continue;
4222
+ }
4187
4223
  const proxyEntry = buildOAuthRemoteMcpProxyEntry(integration.definition_id, remoteOAuthProxyPaths);
4188
4224
  if (proxyEntry) {
4189
4225
  mcpServers[integration.definition_id] = proxyEntry;
@@ -5328,6 +5364,11 @@ ${sections}`
5328
5364
  tokenFile: join2(getProjectDir(codeName), ".env.integrations")
5329
5365
  };
5330
5366
  for (const integration of integrations) {
5367
+ const liveEntry = buildLiveHeaderRemoteMcpProxyEntry(integration.definition_id, integration.remoteMcp, remoteOAuthProxyPaths);
5368
+ if (liveEntry) {
5369
+ this.writeMcpServer(codeName, integration.definition_id, liveEntry);
5370
+ continue;
5371
+ }
5331
5372
  const proxyEntry = buildOAuthRemoteMcpProxyEntry(integration.definition_id, remoteOAuthProxyPaths);
5332
5373
  if (proxyEntry) {
5333
5374
  this.writeMcpServer(codeName, integration.definition_id, proxyEntry);
@@ -5900,7 +5941,7 @@ function requireHost() {
5900
5941
  }
5901
5942
 
5902
5943
  // src/lib/api-client.ts
5903
- var agtCliVersion = true ? "0.28.317" : "dev";
5944
+ var agtCliVersion = true ? "0.28.319" : "dev";
5904
5945
  var lastConfigHash = null;
5905
5946
  function setConfigHash(hash) {
5906
5947
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -6472,6 +6513,21 @@ function envOnlyRespawnVars(changedVars, mcp, channelSecretKeys) {
6472
6513
  (v) => !channelSet.has(v) && findMcpServersUsingVars(mcp, [v]).length === 0
6473
6514
  );
6474
6515
  }
6516
+ function liveProxyExtraHeaderVars(mcp) {
6517
+ const out = /* @__PURE__ */ new Set();
6518
+ if (!mcp?.mcpServers) return out;
6519
+ for (const entry of Object.values(mcp.mcpServers)) {
6520
+ const spec = entry?.env?.["AGT_REMOTE_MCP_EXTRA_HEADERS"];
6521
+ if (typeof spec !== "string") continue;
6522
+ for (const pair of spec.split(",")) {
6523
+ const colon = pair.indexOf(":");
6524
+ if (colon <= 0) continue;
6525
+ const varName = pair.slice(colon + 1).trim();
6526
+ if (varName) out.add(varName);
6527
+ }
6528
+ }
6529
+ return out;
6530
+ }
6475
6531
  function buildArgvMatchersForEntry(key, entry) {
6476
6532
  const escapeRe = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
6477
6533
  const patterns = [];
@@ -8256,6 +8312,7 @@ export {
8256
8312
  classifyEnvIntegrationsDiff,
8257
8313
  findMcpServersUsingVars,
8258
8314
  envOnlyRespawnVars,
8315
+ liveProxyExtraHeaderVars,
8259
8316
  reapStaleMcpChildren,
8260
8317
  clearPresenceReaperState,
8261
8318
  clearPresenceReaperStateForKeys,
@@ -8278,4 +8335,4 @@ export {
8278
8335
  managerInstallSystemUnitCommand,
8279
8336
  managerUninstallSystemUnitCommand
8280
8337
  };
8281
- //# sourceMappingURL=chunk-OYOZL3N4.js.map
8338
+ //# sourceMappingURL=chunk-373GH3RH.js.map