ghostykit 0.8.1 → 0.8.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.
@@ -958,11 +958,13 @@ function usePilot(transport, opts = {}) {
958
958
  if (!steering && (input.messages.length || input.resume?.length || input.forwardedProps?.continueRun)) liveRun.current = input.runId;
959
959
  optsRef.current.onSend?.(input);
960
960
  let ended = false;
961
+ let gotEvent = false;
961
962
  try {
962
963
  await t.run(
963
964
  input,
964
965
  (e) => {
965
966
  if (c.signal.aborted) return;
967
+ gotEvent = true;
966
968
  optsRef.current.onEvent?.(e);
967
969
  for (const fn of listeners.current) fn(e);
968
970
  if (e.type === "RUN_FINISHED" || e.type === "RUN_ERROR") {
@@ -975,6 +977,11 @@ function usePilot(transport, opts = {}) {
975
977
  );
976
978
  } catch (err) {
977
979
  if (c.signal.aborted) return;
980
+ if (gotEvent && !(err instanceof PilotHttpError)) {
981
+ if (!reopening) return runNow({ messages: [] }, true);
982
+ commit(sendFailed(ref.current, "Se cort\xF3 la conexi\xF3n con el agente."));
983
+ return;
984
+ }
978
985
  const code = err instanceof PilotHttpError ? err.code : void 0;
979
986
  if (code === "run_not_live" && steering && userMsg) {
980
987
  const { text } = fromUserMessage(userMsg.content);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ghostykit",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
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",