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.mjs CHANGED
@@ -1628,6 +1628,15 @@ function prepareAgentRequest(data) {
1628
1628
  }
1629
1629
  return { apiData, zodSchema: null };
1630
1630
  }
1631
+ function parseAgentStatusMessage(parsed, agentId) {
1632
+ if (parsed?.status === "agent_stop" && parsed.agent && parsed.agent.agent_id === agentId && parsed.agent.task !== void 0 && parsed.agent.status !== void 0) {
1633
+ return parsed.agent;
1634
+ }
1635
+ if (parsed?.agent_id === agentId && parsed.task !== void 0 && parsed.status !== void 0) {
1636
+ return parsed;
1637
+ }
1638
+ return null;
1639
+ }
1631
1640
  function validatePersonaOption(persona, persona_id) {
1632
1641
  if (persona) {
1633
1642
  try {
@@ -1854,19 +1863,19 @@ var Agent = class {
1854
1863
  } catch {
1855
1864
  return;
1856
1865
  }
1857
- if (parsed.agent_id === agentId && parsed.task !== void 0 && parsed.status !== void 0) {
1858
- const response = parsed;
1866
+ const finalStatus = parseAgentStatusMessage(parsed, agentId);
1867
+ if (finalStatus) {
1859
1868
  if (updateHandler) {
1860
1869
  updateHandler({
1861
1870
  type: "completion",
1862
- data: response,
1871
+ data: finalStatus,
1863
1872
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
1864
1873
  });
1865
- } else if (!response.success) {
1866
- console.error(response.answer);
1874
+ } else if (!finalStatus.success) {
1875
+ console.error(finalStatus.answer);
1867
1876
  }
1868
1877
  this.disconnectWebSocket();
1869
- resolve(response);
1878
+ resolve(finalStatus);
1870
1879
  return;
1871
1880
  }
1872
1881
  if (log) {
@@ -2515,7 +2524,7 @@ var NottePersona = class {
2515
2524
  };
2516
2525
 
2517
2526
  // src/version.ts
2518
- var SDK_VERSION = true ? "0.0.5" : "dev";
2527
+ var SDK_VERSION = true ? "0.0.6" : "dev";
2519
2528
 
2520
2529
  // src/functions.ts
2521
2530
  var NotteFunction = class {