@formigio/fazemos-cli 0.11.0 → 0.11.1

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/index.js CHANGED
@@ -6869,8 +6869,15 @@ program
6869
6869
  agentMemberId = agent.id;
6870
6870
  }
6871
6871
  // Build rich context from agent config and source resource
6872
- const agentName = opts.agent.toLowerCase();
6872
+ // [CLI-EXEC-AGENTNAME-UUID / ED-11-28y] The GET must run BEFORE
6873
+ // agentName is derived: agentName is sourced from the resolved
6874
+ // member's display_name, never from the raw --agent value (which may
6875
+ // be a UUID on the UUID-shaped-agent path). If display_name is
6876
+ // missing, agentName is omitted entirely — no UUID fallback — so the
6877
+ // API's resolveLaunchPrincipal binds on agentMemberId alone.
6873
6878
  const memberDetail = await api('GET', `/api/members/${agentMemberId}`);
6879
+ const displayName = memberDetail.member?.display_name;
6880
+ const agentName = displayName ? String(displayName).toLowerCase() : undefined;
6874
6881
  const agentConfig = memberDetail.member?.agent_config || {};
6875
6882
  const repoNames = opts.repos || agentConfig.repos || [];
6876
6883
  const context = {
@@ -6976,9 +6983,14 @@ program
6976
6983
  sourceType: opts.sourceType,
6977
6984
  sourceId,
6978
6985
  agentMemberId,
6979
- agentName,
6980
6986
  context,
6981
6987
  };
6988
+ // Omit agentName entirely when the member has no display_name — do
6989
+ // NOT fall back to the UUID (ED-11-28y). An explicit undefined-valued
6990
+ // key would still satisfy `'agentName' in body`, so this is a
6991
+ // conditional assignment, not `agentName: agentName`.
6992
+ if (agentName)
6993
+ body.agentName = agentName;
6982
6994
  const data = await api('POST', '/api/executions', body);
6983
6995
  const exec = data.execution;
6984
6996
  console.log(chalk.green(`Execution created: ${exec.id}`));