ghostykit 0.6.5 → 0.6.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.
@@ -2400,11 +2400,13 @@ function usePilot(transport, opts = {}) {
2400
2400
  if (!steering && (input.messages.length || input.resume?.length || input.forwardedProps?.continueRun)) liveRun.current = input.runId;
2401
2401
  optsRef.current.onSend?.(input);
2402
2402
  let ended = false;
2403
+ let gotEvent = false;
2403
2404
  try {
2404
2405
  await t.run(
2405
2406
  input,
2406
2407
  (e) => {
2407
2408
  if (c.signal.aborted) return;
2409
+ gotEvent = true;
2408
2410
  optsRef.current.onEvent?.(e);
2409
2411
  if (e.type === "RUN_FINISHED" || e.type === "RUN_ERROR") {
2410
2412
  ended = true;
@@ -2416,6 +2418,11 @@ function usePilot(transport, opts = {}) {
2416
2418
  );
2417
2419
  } catch (err) {
2418
2420
  if (c.signal.aborted) return;
2421
+ if (gotEvent && !(err instanceof PilotHttpError)) {
2422
+ if (!reopening) return runNow({ messages: [] }, true);
2423
+ commit(sendFailed(ref.current, "Se cort\xF3 la conexi\xF3n con el agente."));
2424
+ return;
2425
+ }
2419
2426
  const code = err instanceof PilotHttpError ? err.code : void 0;
2420
2427
  if (code === "run_not_live" && steering && userMsg) {
2421
2428
  const { text } = fromUserMessage(userMsg.content);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ghostykit",
3
- "version": "0.6.5",
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.6.6",
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",