mitra-interactions-sdk 1.0.60-beta.37 → 1.0.60-beta.39

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
@@ -868,6 +868,7 @@ var AgentTaskSession = class {
868
868
  // ── Eventos do stream (WsOutboundMessage { type, payload, timestamp }) ──
869
869
  _handleWsEvent(msg) {
870
870
  var _a, _b, _c, _d, _e, _f, _g, _h;
871
+ if (!msg || typeof msg.type !== "string" || !msg.type) return;
871
872
  const { type, payload } = msg;
872
873
  switch (type) {
873
874
  case "textDelta": {
@@ -1010,11 +1011,11 @@ function getGatewayOrigin() {
1010
1011
  return new URL(config.baseURL).origin;
1011
1012
  }
1012
1013
  function getTaskHttpBase() {
1013
- const token = getRawToken();
1014
- if (!hasAppScope(token)) {
1015
- throw new Error("Agent Chat: o token configurado \xE9 uma sess\xE3o do console (sem app_id) \u2014 o canal HTTP do copilot exige token de app. Fa\xE7a loginMitra({ projectId }).");
1014
+ const config = getConfig();
1015
+ if (!config.baseURL) {
1016
+ throw new Error("Agent Chat: baseURL n\xE3o configurada. Configure via configureSdkMitra({ baseURL }).");
1016
1017
  }
1017
- return `${getGatewayOrigin()}/copilot/api/v1/tasks`;
1018
+ return `${config.baseURL.replace(/\/+$/, "")}/agentAiShortcut/tasks`;
1018
1019
  }
1019
1020
  function getTaskWsUrl(taskId) {
1020
1021
  const token = getRawToken();