@meistrari/tela-cli 0.7.36 → 0.7.38

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 (2) hide show
  1. package/dist/index.js +32 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2186,6 +2186,7 @@ var require_config2 = __commonJS({
2186
2186
  "use strict";
2187
2187
  Object.defineProperty(exports2, "__esModule", { value: true });
2188
2188
  exports2.getDefaultAgentCloneRoot = getDefaultAgentCloneRoot;
2189
+ exports2.isDirectAgentApiUrl = isDirectAgentApiUrl;
2189
2190
  exports2.resolveAgentConfig = resolveAgentConfig;
2190
2191
  exports2.ensureConfigInteractive = ensureConfigInteractive;
2191
2192
  var node_os_1 = require("node:os");
@@ -2193,10 +2194,23 @@ var require_config2 = __commonJS({
2193
2194
  var tela_local_config_1 = require_dist();
2194
2195
  var credentials_1 = require_credentials2();
2195
2196
  var errors_1 = require_errors();
2197
+ var AGENT_GATEWAY_HOSTS = /* @__PURE__ */ new Set([
2198
+ "agent-gateway-api.tela.tools"
2199
+ ]);
2196
2200
  function getDefaultAgentCloneRoot(env = process.env) {
2197
2201
  const configured = env.TELA_AGENT_CLONE_ROOT?.trim();
2198
2202
  return configured ? (0, node_path_1.resolve)(configured.replace(/^~(?=$|\/)/, (0, node_os_1.homedir)())) : (0, node_path_1.join)((0, node_os_1.homedir)(), "tela-agents");
2199
2203
  }
2204
+ function isDirectAgentApiUrl(value) {
2205
+ if (!value)
2206
+ return false;
2207
+ try {
2208
+ const url = new URL(value);
2209
+ return !AGENT_GATEWAY_HOSTS.has(url.hostname);
2210
+ } catch {
2211
+ return false;
2212
+ }
2213
+ }
2200
2214
  async function resolveAgentConfig(options = {}) {
2201
2215
  const env = options.env ?? process.env;
2202
2216
  const localConfig = await (0, tela_local_config_1.loadConfig)();
@@ -2206,13 +2220,22 @@ var require_config2 = __commonJS({
2206
2220
  workspace: options.workspace,
2207
2221
  env
2208
2222
  });
2209
- if (options.requireAgentService !== false && !Object.prototype.hasOwnProperty.call(resolved.environment.services, "agent")) {
2223
+ const shouldRequireAgentService = options.requireAgentService !== false || options.requireDirectAgentService === true;
2224
+ if (shouldRequireAgentService && !Object.prototype.hasOwnProperty.call(resolved.environment.services, "agent")) {
2210
2225
  throw (0, errors_1.createUserFacingError)({
2211
2226
  code: "agent_service_missing",
2212
2227
  summary: `Context ${resolved.id} does not define an agent service URL.`,
2213
2228
  fixes: ["Add services.agent to the selected Tela environment in Dock before running agent commands."]
2214
2229
  });
2215
2230
  }
2231
+ const configuredAgentServiceUrl = resolved.environment.services.agent;
2232
+ if (options.requireDirectAgentService === true && !isDirectAgentApiUrl(configuredAgentServiceUrl)) {
2233
+ throw (0, errors_1.createUserFacingError)({
2234
+ code: "agent_service_gateway_unsupported",
2235
+ summary: `Context ${resolved.id} points Agent API to an Agent Gateway URL, which cannot be used for tela agent setup.`,
2236
+ fixes: ["Connect an environment with a direct Agent API URL, such as Staging, before running agent setup."]
2237
+ });
2238
+ }
2216
2239
  const credentials = options.credentials ?? (0, credentials_1.createAgentCredentialAdapter)(env);
2217
2240
  const credential = await credentials.get(resolved.context.credentialRef);
2218
2241
  if (!credential) {
@@ -5890,7 +5913,8 @@ var require_setup = __commonJS({
5890
5913
  environmentId: options.environmentId,
5891
5914
  workspace: options.workspace,
5892
5915
  credentials: options.credentials,
5893
- env: options.env
5916
+ env: options.env,
5917
+ requireDirectAgentService: true
5894
5918
  });
5895
5919
  if (!config.contextId) {
5896
5920
  throw new Error("Agent setup requires a resolved Tela context.");
@@ -6004,7 +6028,8 @@ var require_setup = __commonJS({
6004
6028
  const config = await (0, config_1.resolveAgentConfig)({
6005
6029
  contextId: input.contextId,
6006
6030
  credentials,
6007
- env: options.env
6031
+ env: options.env,
6032
+ requireDirectAgentService: true
6008
6033
  });
6009
6034
  const organizations = await (0, agent_api_1.listOrganizations)(config, options.fetchFn);
6010
6035
  const organization = organizations.find((item) => item.id === input.organizationId);
@@ -6940,7 +6965,7 @@ var require_dist2 = __commonJS({
6940
6965
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
6941
6966
  };
6942
6967
  Object.defineProperty(exports2, "__esModule", { value: true });
6943
- exports2.ensureConfigInteractive = exports2.resolveAgentConfig = exports2.getDefaultAgentCloneRoot = void 0;
6968
+ exports2.ensureConfigInteractive = exports2.resolveAgentConfig = exports2.isDirectAgentApiUrl = exports2.getDefaultAgentCloneRoot = void 0;
6944
6969
  __exportStar(require_agent_api(), exports2);
6945
6970
  __exportStar(require_auth2(), exports2);
6946
6971
  __exportStar(require_claude(), exports2);
@@ -6953,6 +6978,9 @@ var require_dist2 = __commonJS({
6953
6978
  Object.defineProperty(exports2, "getDefaultAgentCloneRoot", { enumerable: true, get: function() {
6954
6979
  return config_1.getDefaultAgentCloneRoot;
6955
6980
  } });
6981
+ Object.defineProperty(exports2, "isDirectAgentApiUrl", { enumerable: true, get: function() {
6982
+ return config_1.isDirectAgentApiUrl;
6983
+ } });
6956
6984
  Object.defineProperty(exports2, "resolveAgentConfig", { enumerable: true, get: function() {
6957
6985
  return config_1.resolveAgentConfig;
6958
6986
  } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meistrari/tela-cli",
3
- "version": "0.7.36",
3
+ "version": "0.7.38",
4
4
  "description": "Tela command line tools for local state and agent workflows.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {