ghostykit 0.7.1 → 0.7.2

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.
@@ -957,11 +957,13 @@ function usePilot(transport, opts = {}) {
957
957
  if (!steering && (input.messages.length || input.resume?.length || input.forwardedProps?.continueRun)) liveRun.current = input.runId;
958
958
  optsRef.current.onSend?.(input);
959
959
  let ended = false;
960
+ let gotEvent = false;
960
961
  try {
961
962
  await t.run(
962
963
  input,
963
964
  (e) => {
964
965
  if (c.signal.aborted) return;
966
+ gotEvent = true;
965
967
  optsRef.current.onEvent?.(e);
966
968
  for (const fn of listeners.current) fn(e);
967
969
  if (e.type === "RUN_FINISHED" || e.type === "RUN_ERROR") {
@@ -974,6 +976,11 @@ function usePilot(transport, opts = {}) {
974
976
  );
975
977
  } catch (err) {
976
978
  if (c.signal.aborted) return;
979
+ if (gotEvent && !(err instanceof PilotHttpError)) {
980
+ if (!reopening) return runNow({ messages: [] }, true);
981
+ commit(sendFailed(ref.current, "Se cort\xF3 la conexi\xF3n con el agente."));
982
+ return;
983
+ }
977
984
  const code = err instanceof PilotHttpError ? err.code : void 0;
978
985
  if (code === "run_not_live" && steering && userMsg) {
979
986
  const { text } = fromUserMessage(userMsg.content);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ghostykit",
3
- "version": "0.7.1",
4
- "description": "Ghosty Autopilot \u2014 the autopilot chat for your React app, on AG-UI: works with LangGraph, Mastra, CrewAI or any AG-UI agent. Streaming text, agent steps, human approval cards (interrupt/resume), attachments and voice.",
3
+ "version": "0.7.2",
4
+ "description": "Ghosty Autopilot — the autopilot chat for your React app, on AG-UI: works with LangGraph, Mastra, CrewAI or any AG-UI agent. Streaming text, agent steps, human approval cards (interrupt/resume), attachments and voice.",
5
5
  "type": "module",
6
6
  "main": "./dist/core/index.js",
7
7
  "types": "./dist/core/index.d.ts",