notte-sdk 0.0.5 → 0.0.6

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
@@ -1738,6 +1738,15 @@ function prepareAgentRequest(data) {
1738
1738
  }
1739
1739
  return { apiData, zodSchema: null };
1740
1740
  }
1741
+ function parseAgentStatusMessage(parsed, agentId) {
1742
+ if (parsed?.status === "agent_stop" && parsed.agent && parsed.agent.agent_id === agentId && parsed.agent.task !== void 0 && parsed.agent.status !== void 0) {
1743
+ return parsed.agent;
1744
+ }
1745
+ if (parsed?.agent_id === agentId && parsed.task !== void 0 && parsed.status !== void 0) {
1746
+ return parsed;
1747
+ }
1748
+ return null;
1749
+ }
1741
1750
  function validatePersonaOption(persona, persona_id) {
1742
1751
  if (persona) {
1743
1752
  try {
@@ -1964,19 +1973,19 @@ var Agent = class {
1964
1973
  } catch {
1965
1974
  return;
1966
1975
  }
1967
- if (parsed.agent_id === agentId && parsed.task !== void 0 && parsed.status !== void 0) {
1968
- const response = parsed;
1976
+ const finalStatus = parseAgentStatusMessage(parsed, agentId);
1977
+ if (finalStatus) {
1969
1978
  if (updateHandler) {
1970
1979
  updateHandler({
1971
1980
  type: "completion",
1972
- data: response,
1981
+ data: finalStatus,
1973
1982
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
1974
1983
  });
1975
- } else if (!response.success) {
1976
- console.error(response.answer);
1984
+ } else if (!finalStatus.success) {
1985
+ console.error(finalStatus.answer);
1977
1986
  }
1978
1987
  this.disconnectWebSocket();
1979
- resolve(response);
1988
+ resolve(finalStatus);
1980
1989
  return;
1981
1990
  }
1982
1991
  if (log) {
@@ -2625,7 +2634,7 @@ var NottePersona = class {
2625
2634
  };
2626
2635
 
2627
2636
  // src/version.ts
2628
- var SDK_VERSION = true ? "0.0.5" : "dev";
2637
+ var SDK_VERSION = true ? "0.0.6" : "dev";
2629
2638
 
2630
2639
  // src/functions.ts
2631
2640
  var NotteFunction = class {