@integrity-labs/agt-cli 0.28.149 → 0.28.151

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.
@@ -22,7 +22,7 @@ import {
22
22
  resolveConnectivityProbe,
23
23
  worseConnectivityOutcome,
24
24
  wrapScheduledTaskPrompt
25
- } from "./chunk-5AIF4FOP.js";
25
+ } from "./chunk-SKANUWSB.js";
26
26
 
27
27
  // ../../packages/core/dist/integrations/registry.js
28
28
  var INTEGRATION_REGISTRY = [
@@ -3988,6 +3988,24 @@ function buildRemoteMcpEntry(definitionId) {
3988
3988
  function buildHostBrokeredRemoteMcpEntry(url) {
3989
3989
  return { type: "http", url };
3990
3990
  }
3991
+ function buildOAuthRemoteMcpProxyEntry(definitionId, paths) {
3992
+ const def = INTEGRATION_REGISTRY.find((d) => d.id === definitionId);
3993
+ if (def?.remoteMcp)
3994
+ return null;
3995
+ const provider = OAUTH_PROVIDERS[definitionId];
3996
+ if (!provider?.mcpUrl)
3997
+ return null;
3998
+ return {
3999
+ command: "node",
4000
+ args: [paths.proxyPath],
4001
+ env: {
4002
+ AGT_REMOTE_MCP_URL: provider.mcpUrl,
4003
+ AGT_REMOTE_MCP_TOKEN_FILE: paths.tokenFile,
4004
+ AGT_REMOTE_MCP_TOKEN_VAR: envVarForToken(definitionId),
4005
+ AGT_REMOTE_MCP_LABEL: definitionId
4006
+ }
4007
+ };
4008
+ }
3991
4009
 
3992
4010
  // ../../packages/core/dist/provisioning/native-mcp.js
3993
4011
  function buildNativeMcpEntry(spec, ctx) {
@@ -5923,7 +5941,16 @@ function buildMcpJson(input) {
5923
5941
  if (postizIntegration) {
5924
5942
  mcpServers["postiz"] = buildPostizMcpEntry(postizIntegration);
5925
5943
  }
5944
+ const remoteOAuthProxyPaths = {
5945
+ proxyPath: join4(getHomeDir3(), ".augmented", "_mcp", "remote-oauth-proxy.js"),
5946
+ tokenFile: join4(getProjectDir(input.agent.code_name), ".env.integrations")
5947
+ };
5926
5948
  for (const integration of input.integrations ?? []) {
5949
+ const proxyEntry = buildOAuthRemoteMcpProxyEntry(integration.definition_id, remoteOAuthProxyPaths);
5950
+ if (proxyEntry) {
5951
+ mcpServers[integration.definition_id] = proxyEntry;
5952
+ continue;
5953
+ }
5927
5954
  const entry = buildRemoteMcpEntry(integration.definition_id);
5928
5955
  if (entry) {
5929
5956
  mcpServers[integration.definition_id] = entry;
@@ -7007,7 +7034,16 @@ ${sections}`
7007
7034
  if (postizIntegration) {
7008
7035
  this.writeMcpServer(codeName, "postiz", buildPostizMcpEntry(postizIntegration));
7009
7036
  }
7037
+ const remoteOAuthProxyPaths = {
7038
+ proxyPath: join4(getHomeDir3(), ".augmented", "_mcp", "remote-oauth-proxy.js"),
7039
+ tokenFile: join4(getProjectDir(codeName), ".env.integrations")
7040
+ };
7010
7041
  for (const integration of integrations) {
7042
+ const proxyEntry = buildOAuthRemoteMcpProxyEntry(integration.definition_id, remoteOAuthProxyPaths);
7043
+ if (proxyEntry) {
7044
+ this.writeMcpServer(codeName, integration.definition_id, proxyEntry);
7045
+ continue;
7046
+ }
7011
7047
  const entry = buildRemoteMcpEntry(integration.definition_id);
7012
7048
  if (entry) {
7013
7049
  this.writeMcpServer(codeName, integration.definition_id, entry);
@@ -7814,7 +7850,7 @@ function requireHost() {
7814
7850
  }
7815
7851
 
7816
7852
  // src/lib/api-client.ts
7817
- var agtCliVersion = true ? "0.28.149" : "dev";
7853
+ var agtCliVersion = true ? "0.28.151" : "dev";
7818
7854
  var lastConfigHash = null;
7819
7855
  function setConfigHash(hash) {
7820
7856
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -8266,14 +8302,15 @@ function readMcpHttpServerConfig(projectDir, serverKey, env) {
8266
8302
  const raw = readFileSync8(join8(projectDir, ".mcp.json"), "utf-8");
8267
8303
  const servers = JSON.parse(raw).mcpServers ?? {};
8268
8304
  const entry = servers[serverKey];
8269
- if (entry && typeof entry.url === "string" && (entry.type === "http" || entry.type === void 0)) {
8270
- const unresolved = /* @__PURE__ */ new Set();
8271
- const sub = (value) => {
8272
- if (!env) return value;
8273
- const r = expandTemplateVars(value, env);
8274
- for (const name of r.unresolved) unresolved.add(name);
8275
- return r.value;
8276
- };
8305
+ if (!entry) return null;
8306
+ const unresolved = /* @__PURE__ */ new Set();
8307
+ const sub = (value) => {
8308
+ if (!env) return value;
8309
+ const r = expandTemplateVars(value, env);
8310
+ for (const name of r.unresolved) unresolved.add(name);
8311
+ return r.value;
8312
+ };
8313
+ if (typeof entry.url === "string" && (entry.type === "http" || entry.type === void 0)) {
8277
8314
  const url = sub(entry.url);
8278
8315
  let headers;
8279
8316
  if (entry.headers) {
@@ -8282,6 +8319,13 @@ function readMcpHttpServerConfig(projectDir, serverKey, env) {
8282
8319
  }
8283
8320
  return { url, ...headers ? { headers } : {}, unresolved: [...unresolved] };
8284
8321
  }
8322
+ const proxyUrl = entry.env?.["AGT_REMOTE_MCP_URL"];
8323
+ const tokenVar = entry.env?.["AGT_REMOTE_MCP_TOKEN_VAR"];
8324
+ if (entry.command && typeof proxyUrl === "string" && typeof tokenVar === "string") {
8325
+ const url = sub(proxyUrl);
8326
+ const bearer = sub(`\${${tokenVar}}`);
8327
+ return { url, headers: { Authorization: `Bearer ${bearer}` }, unresolved: [...unresolved] };
8328
+ }
8285
8329
  return null;
8286
8330
  } catch {
8287
8331
  return null;
@@ -9111,4 +9155,4 @@ export {
9111
9155
  managerInstallSystemUnitCommand,
9112
9156
  managerUninstallSystemUnitCommand
9113
9157
  };
9114
- //# sourceMappingURL=chunk-A4S52T2C.js.map
9158
+ //# sourceMappingURL=chunk-SZX4F3O5.js.map