@integrity-labs/agt-cli 0.28.370 → 0.28.372

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.
package/dist/bin/agt.js CHANGED
@@ -40,7 +40,7 @@ import {
40
40
  success,
41
41
  table,
42
42
  warn
43
- } from "../chunk-TDZFQHXC.js";
43
+ } from "../chunk-FAMCYDMC.js";
44
44
  import {
45
45
  AnchorSessionClient,
46
46
  CHANNEL_REGISTRY,
@@ -70,7 +70,7 @@ import {
70
70
  renderTemplate,
71
71
  resolveChannels,
72
72
  serializeManifestForSlackCli
73
- } from "../chunk-NEM6OQLG.js";
73
+ } from "../chunk-NDF3YMP5.js";
74
74
  import "../chunk-XWVM4KPK.js";
75
75
 
76
76
  // src/bin/agt.ts
@@ -4829,7 +4829,7 @@ import { execFileSync, execSync } from "child_process";
4829
4829
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4830
4830
  import chalk18 from "chalk";
4831
4831
  import ora16 from "ora";
4832
- var cliVersion = true ? "0.28.370" : "dev";
4832
+ var cliVersion = true ? "0.28.372" : "dev";
4833
4833
  async function fetchLatestVersion() {
4834
4834
  const host2 = getHost();
4835
4835
  if (!host2) return null;
@@ -6001,7 +6001,7 @@ function handleError(err) {
6001
6001
  }
6002
6002
 
6003
6003
  // src/bin/agt.ts
6004
- var cliVersion2 = true ? "0.28.370" : "dev";
6004
+ var cliVersion2 = true ? "0.28.372" : "dev";
6005
6005
  var program = new Command();
6006
6006
  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");
6007
6007
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -3,6 +3,11 @@ import {
3
3
  LATE_BOUND_VARS,
4
4
  OAUTH_PROVIDERS,
5
5
  PLATFORM_STORAGE_RULE,
6
+ buildHostBrokeredRemoteMcpEntry,
7
+ buildLiveHeaderRemoteMcpProxyEntry,
8
+ buildNativeMcpEntry,
9
+ buildOAuthRemoteMcpProxyEntry,
10
+ buildRemoteMcpEntry,
6
11
  coerceEnvValue,
7
12
  expandTemplateVars,
8
13
  getFlagDefinition,
@@ -20,7 +25,7 @@ import {
20
25
  resolveConnectivityProbe,
21
26
  worseConnectivityOutcome,
22
27
  wrapScheduledTaskPrompt
23
- } from "./chunk-NEM6OQLG.js";
28
+ } from "./chunk-NDF3YMP5.js";
24
29
  import {
25
30
  parsePsRows
26
31
  } from "./chunk-XWVM4KPK.js";
@@ -1983,193 +1988,6 @@ function decryptIntegrationCredentials(credentials) {
1983
1988
  return out;
1984
1989
  }
1985
1990
 
1986
- // ../../packages/core/dist/provisioning/remote-mcp.js
1987
- function envVarForToken(definitionId) {
1988
- return `${definitionId.replace(/-/g, "_").toUpperCase()}_ACCESS_TOKEN`;
1989
- }
1990
- function credentialEnvVar(definitionId, credentialRef) {
1991
- const idPart = definitionId.replace(/-/g, "_").toUpperCase();
1992
- const credPart = credentialRef.replace(/-/g, "_").toUpperCase();
1993
- return `${idPart}_${credPart}`;
1994
- }
1995
- function assertSafeRemoteMcpUrl(url, definitionId) {
1996
- let u;
1997
- try {
1998
- u = new URL(url);
1999
- } catch {
2000
- throw new Error(`remoteMcp.url for '${definitionId}' is not a valid URL: ${url}`);
2001
- }
2002
- if (u.protocol !== "https:") {
2003
- throw new Error(`remoteMcp.url for '${definitionId}' must be https (got ${u.protocol}//): ${url}`);
2004
- }
2005
- const host = u.hostname.toLowerCase();
2006
- const blocked = host === "localhost" || host === "169.254.169.254" || // AWS/GCP/Azure instance metadata
2007
- host === "metadata.google.internal" || /^127\./.test(host) || /^10\./.test(host) || /^192\.168\./.test(host) || /^169\.254\./.test(host) || // link-local
2008
- /^172\.(1[6-9]|2\d|3[01])\./.test(host) || // 172.16.0.0/12
2009
- host.endsWith(".internal") || host.endsWith(".local");
2010
- if (blocked) {
2011
- throw new Error(`remoteMcp.url for '${definitionId}' resolves to a disallowed (internal/link-local/metadata) host: ${host}`);
2012
- }
2013
- }
2014
- function renderRemoteMcpSpec(definitionId, spec) {
2015
- assertSafeRemoteMcpUrl(spec.url, definitionId);
2016
- const headers = {};
2017
- if (spec.auth) {
2018
- const envVar = credentialEnvVar(definitionId, spec.auth.credential_ref);
2019
- const value = `\${${envVar}}`;
2020
- if (spec.auth.scheme === "bearer") {
2021
- headers["Authorization"] = `Bearer ${value}`;
2022
- } else {
2023
- if (!spec.auth.header_name) {
2024
- throw new Error(`remoteMcp.auth for '${definitionId}' uses scheme 'header' but no header_name`);
2025
- }
2026
- headers[spec.auth.header_name] = value;
2027
- }
2028
- }
2029
- Object.assign(headers, spec.headers ?? {});
2030
- return {
2031
- type: spec.type ?? "http",
2032
- url: spec.url,
2033
- ...Object.keys(headers).length > 0 ? { headers } : {}
2034
- };
2035
- }
2036
- function buildRemoteMcpEntry(definitionId, dbSpec) {
2037
- const spec = dbSpec ?? INTEGRATION_REGISTRY.find((d) => d.id === definitionId)?.remoteMcp;
2038
- if (spec) {
2039
- return renderRemoteMcpSpec(definitionId, spec);
2040
- }
2041
- const provider = OAUTH_PROVIDERS[definitionId];
2042
- if (!provider?.mcpUrl)
2043
- return null;
2044
- return {
2045
- type: "http",
2046
- url: provider.mcpUrl,
2047
- headers: {
2048
- Authorization: `Bearer \${${envVarForToken(definitionId)}}`
2049
- }
2050
- };
2051
- }
2052
- function buildHostBrokeredRemoteMcpEntry(url) {
2053
- return { type: "http", url };
2054
- }
2055
- function extractHeaderVarName(value) {
2056
- const m = /^\$\{([A-Za-z_][A-Za-z0-9_]*)\}$/.exec(value.trim());
2057
- return m ? m[1] : null;
2058
- }
2059
- function buildLiveHeaderRemoteMcpProxyEntry(definitionId, dbSpec, paths) {
2060
- const spec = dbSpec ?? INTEGRATION_REGISTRY.find((d) => d.id === definitionId)?.remoteMcp;
2061
- if (!spec?.liveHeaderRefresh)
2062
- return null;
2063
- assertSafeRemoteMcpUrl(spec.url, definitionId);
2064
- if (!spec.auth || spec.auth.scheme !== "header" || !spec.auth.header_name) {
2065
- throw new Error(`remoteMcp.liveHeaderRefresh for '${definitionId}' requires a header-scheme 'auth' with a header_name`);
2066
- }
2067
- const extraPairs = [];
2068
- for (const [header, value] of Object.entries(spec.headers ?? {})) {
2069
- const varName = extractHeaderVarName(value);
2070
- if (varName)
2071
- extraPairs.push(`${header}:${varName}`);
2072
- }
2073
- return {
2074
- command: "node",
2075
- args: [paths.proxyPath],
2076
- env: {
2077
- AGT_REMOTE_MCP_URL: spec.url,
2078
- AGT_REMOTE_MCP_TOKEN_FILE: paths.tokenFile,
2079
- AGT_REMOTE_MCP_TOKEN_VAR: credentialEnvVar(definitionId, spec.auth.credential_ref),
2080
- AGT_REMOTE_MCP_AUTH_HEADER: spec.auth.header_name,
2081
- AGT_REMOTE_MCP_LABEL: definitionId,
2082
- ...extraPairs.length > 0 ? { AGT_REMOTE_MCP_EXTRA_HEADERS: extraPairs.join(",") } : {}
2083
- }
2084
- };
2085
- }
2086
- function buildOAuthRemoteMcpProxyEntry(definitionId, paths) {
2087
- const def = INTEGRATION_REGISTRY.find((d) => d.id === definitionId);
2088
- if (def?.remoteMcp)
2089
- return null;
2090
- const provider = OAUTH_PROVIDERS[definitionId];
2091
- if (!provider?.mcpUrl)
2092
- return null;
2093
- return {
2094
- command: "node",
2095
- args: [paths.proxyPath],
2096
- env: {
2097
- AGT_REMOTE_MCP_URL: provider.mcpUrl,
2098
- AGT_REMOTE_MCP_TOKEN_FILE: paths.tokenFile,
2099
- AGT_REMOTE_MCP_TOKEN_VAR: envVarForToken(definitionId),
2100
- AGT_REMOTE_MCP_LABEL: definitionId,
2101
- // ENG-6948: cap the agent's exposed surface to the curated allowlist. The
2102
- // proxy filters tools/list and gates tools/call against this set. Omitted
2103
- // when the provider has no allowlist, leaving the proxy a pass-through.
2104
- ...provider.toolAllowlist && provider.toolAllowlist.length > 0 ? { AGT_REMOTE_MCP_TOOL_ALLOWLIST: provider.toolAllowlist.join(",") } : {},
2105
- // CS-1446: toolsets to pre-activate at session start so gated tools are
2106
- // advertised in the connect-time tools/list the harness freezes. Omitted
2107
- // when the provider configures none (no pre-enable, the default).
2108
- ...provider.preEnableToolsets && provider.preEnableToolsets.length > 0 ? { AGT_REMOTE_MCP_PREENABLE_TOOLSETS: provider.preEnableToolsets.join(",") } : {}
2109
- }
2110
- };
2111
- }
2112
-
2113
- // ../../packages/core/dist/provisioning/native-mcp.js
2114
- function buildNativeMcpEntry(spec, ctx) {
2115
- const resolvedCommand = resolveTemplate(spec.command, ctx);
2116
- if (resolvedCommand.omit) {
2117
- throw new Error("NativeMcpSpec: empty_if_no_env is only valid in env values (not in `command`)");
2118
- }
2119
- const command = resolvedCommand.value;
2120
- const args = spec.args.map((a, i) => {
2121
- const resolved = resolveTemplate(a, ctx);
2122
- if (resolved.omit) {
2123
- throw new Error(`NativeMcpSpec: empty_if_no_env is only valid in env values (not in args[${i}])`);
2124
- }
2125
- return resolved.value;
2126
- });
2127
- if (spec.env === void 0) {
2128
- return { command, args };
2129
- }
2130
- const env = {};
2131
- for (const [k, raw] of Object.entries(spec.env)) {
2132
- const { value, omit } = resolveTemplate(raw, ctx);
2133
- if (omit)
2134
- continue;
2135
- env[k] = value;
2136
- }
2137
- return { command, args, env };
2138
- }
2139
- function resolveTemplate(input, ctx) {
2140
- const TOKEN = /\{\{([^}]+)\}\}/g;
2141
- const hasEmptyIfNoEnv = /\{\{\s*empty_if_no_env\./.test(input);
2142
- const isWholeValueEmptyIfNoEnv = /^\{\{\s*empty_if_no_env\.[^}]+\}\}$/.test(input);
2143
- if (hasEmptyIfNoEnv && !isWholeValueEmptyIfNoEnv) {
2144
- throw new Error(`NativeMcpSpec: empty_if_no_env must be the sole content of the value, never mixed with literal text or other tokens (value: ${JSON.stringify(input)})`);
2145
- }
2146
- let omit = false;
2147
- const value = input.replace(TOKEN, (whole, expr) => {
2148
- const trimmed = expr.trim();
2149
- if (trimmed === "agent_id")
2150
- return ctx.agentId;
2151
- if (trimmed === "agent_code_name")
2152
- return ctx.agentCodeName;
2153
- if (trimmed === "integration_id")
2154
- return ctx.integration?.id ?? "";
2155
- if (trimmed.startsWith("process_env.")) {
2156
- const name = trimmed.slice("process_env.".length);
2157
- return process.env[name] ?? "";
2158
- }
2159
- if (trimmed.startsWith("empty_if_no_env.")) {
2160
- const name = trimmed.slice("empty_if_no_env.".length);
2161
- const v = process.env[name] ?? "";
2162
- if (v.length === 0) {
2163
- omit = true;
2164
- return "";
2165
- }
2166
- return v;
2167
- }
2168
- return whole;
2169
- });
2170
- return { value, omit };
2171
- }
2172
-
2173
1991
  // ../../packages/core/dist/provisioning/frameworks/claudecode/index.js
2174
1992
  var VALID_CODE_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
2175
1993
  var SECRET_FILE_MODE = 384;
@@ -6348,7 +6166,7 @@ function requireHost() {
6348
6166
  }
6349
6167
 
6350
6168
  // src/lib/api-client.ts
6351
- var agtCliVersion = true ? "0.28.370" : "dev";
6169
+ var agtCliVersion = true ? "0.28.372" : "dev";
6352
6170
  var lastConfigHash = null;
6353
6171
  function setConfigHash(hash) {
6354
6172
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -8794,4 +8612,4 @@ export {
8794
8612
  managerInstallSystemUnitCommand,
8795
8613
  managerUninstallSystemUnitCommand
8796
8614
  };
8797
- //# sourceMappingURL=chunk-TDZFQHXC.js.map
8615
+ //# sourceMappingURL=chunk-FAMCYDMC.js.map