ghostykit 0.6.3 → 0.6.5

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.
@@ -193,7 +193,7 @@ function toolLabel(t, v) {
193
193
  if (str(x.title)) patch.label = str(x.title);
194
194
  if (str(x.kind)) patch.kind = str(x.kind);
195
195
  if (str(x.path)) patch.path = str(x.path);
196
- if (str(x.detail)) patch.detail = str(x.detail);
196
+ if (str(x.detail)) Object.assign(patch, { detail: str(x.detail), detailFromServer: true });
197
197
  t.tools = (t.tools ?? []).map((y) => y.id === x.toolCallId ? { ...y, ...patch } : y);
198
198
  }
199
199
  function applyStoredCustom(t, m) {
@@ -259,7 +259,8 @@ function applySnapshot(s, messages) {
259
259
  const tools = t.tools?.map((x) => {
260
260
  const prev = o?.role === t.role ? o.tools?.find((y) => y.id === x.id) : void 0;
261
261
  const status = x.status === "pending" && (prev?.status ?? (live ? "in_progress" : void 0));
262
- return { ...prev, ...x, ...status ? { status } : {} };
262
+ const keepDetail = prev?.detailFromServer && !x.detailFromServer ? { detail: prev.detail, detailFromServer: true } : {};
263
+ return { ...prev, ...x, ...status ? { status } : {}, ...keepDetail };
263
264
  });
264
265
  const base = tools ? { ...t, tools } : t;
265
266
  if (!o || o.role !== t.role) return base;
@@ -325,6 +326,7 @@ function reduceAgUiEvent(prev, e, now = Date.now()) {
325
326
  }
326
327
  case "TOOL_CALL_END": {
327
328
  const known = s.turns[s.turns.length - 1]?.tools?.find((x) => x.id === e.toolCallId);
329
+ if (known?.detailFromServer) return s;
328
330
  return upsertTool(s, e.toolCallId, { detail: argsDetail(known?.args) });
329
331
  }
330
332
  case "TOOL_CALL_RESULT": {
@@ -369,7 +371,7 @@ function reduceAgUiEvent(prev, e, now = Date.now()) {
369
371
  if (str(v.title)) patch.label = str(v.title);
370
372
  if (str(v.kind)) patch.kind = str(v.kind);
371
373
  if (str(v.path)) patch.path = str(v.path);
372
- if (str(v.detail)) patch.detail = str(v.detail);
374
+ if (str(v.detail)) Object.assign(patch, { detail: str(v.detail), detailFromServer: true });
373
375
  return upsertTool(s, v.toolCallId, patch);
374
376
  }
375
377
  if (e.name === "ghosty.replace") {
@@ -31,7 +31,7 @@ import {
31
31
  toPermission,
32
32
  toolName,
33
33
  toolNames
34
- } from "../chunks/chunk-LFFJLMDO.js";
34
+ } from "../chunks/chunk-LPPND5ME.js";
35
35
  import {
36
36
  applyReferences,
37
37
  cleanUserText,
@@ -23,6 +23,8 @@ export interface ToolEntry {
23
23
  path?: string;
24
24
  /** Los argumentos, en corto («job: purge-notifications»). */
25
25
  detail?: string;
26
+ /** `detail` lo puso el servidor (`ghosty.tool`): ya no se deriva de los argumentos. */
27
+ detailFromServer?: boolean;
26
28
  /** Los argumentos en JSON tal como llegaron (TOOL_CALL_ARGS). */
27
29
  args?: string;
28
30
  }
@@ -70,6 +70,15 @@ export interface PilotoProps extends UsePilotOptions {
70
70
  text: string;
71
71
  key?: string | number;
72
72
  } | null;
73
+ /**
74
+ * Trabajo que sigue FUERA del run (ayudantes en segundo plano, una tarea larga): con el run ya
75
+ * cerrado, el hilo enseña `label` y cuenta desde `since` (ms) para que no parezca terminado.
76
+ * Con un run vivo manda su propia espera. `null` = nada pendiente.
77
+ */
78
+ background?: {
79
+ label: string;
80
+ since: number;
81
+ } | null;
73
82
  /** Referencias controladas (si no, Piloto las guarda; agrégalas con `ref.addReference`). */
74
83
  references?: Reference[];
75
84
  onReferencesChange?: (refs: Reference[]) => void;
@@ -1,6 +1,8 @@
1
1
  /** Los tres puntitos de «escribiendo» (color y animación en CSS: `gc-typing`). */
2
2
  export declare function TypingDots(): import("react").JSX.Element;
3
- export declare function WaitLabel({ since, showDuration, step, }: {
3
+ export declare function WaitLabel({ since, showDuration, step, text, }: {
4
+ /** Frase fija que gana a las del turno (p. ej. «2 ayudantes trabajando» con el run ya cerrado). */
5
+ text?: string | null;
4
6
  /** El paso con nombre en curso (`STEP_STARTED`): si `strings.steps` lo nombra, esa es la frase. */
5
7
  step?: string | null;
6
8
  /** Desde que se MANDÓ el mensaje (no desde que se montó la etiqueta). */
@@ -31,7 +31,7 @@ import {
31
31
  toPermission,
32
32
  toolName,
33
33
  toolNames
34
- } from "../chunks/chunk-LFFJLMDO.js";
34
+ } from "../chunks/chunk-LPPND5ME.js";
35
35
  import {
36
36
  PilotHttpError,
37
37
  createAgUiTransport,
@@ -2285,7 +2285,8 @@ function TypingDots() {
2285
2285
  function WaitLabel({
2286
2286
  since,
2287
2287
  showDuration = true,
2288
- step
2288
+ step,
2289
+ text
2289
2290
  }) {
2290
2291
  const { strings: t } = usePiloto();
2291
2292
  const [mounted] = useState7(() => Date.now());
@@ -2297,7 +2298,7 @@ function WaitLabel({
2297
2298
  const seconds = Math.max(0, Math.floor((now - (since || mounted)) / 1e3));
2298
2299
  const phrases = t.thinkingPhrases;
2299
2300
  const stepText = step ? t.steps?.[step] : void 0;
2300
- const what = stepText ? stepText : phrases?.length ? seconds >= STILL_WORKING_S ? t.stillWorking : phrases[Math.floor(seconds / 4) % phrases.length] : t.howItGoes(seconds);
2301
+ const what = text ? text : stepText ? stepText : phrases?.length ? seconds >= STILL_WORKING_S ? t.stillWorking : phrases[Math.floor(seconds / 4) % phrases.length] : t.howItGoes(seconds);
2301
2302
  return /* @__PURE__ */ jsx9("div", { className: "flex flex-col gap-0.5 text-sm text-text-secondary", children: /* @__PURE__ */ jsxs7("p", { className: "flex items-center", children: [
2302
2303
  /* @__PURE__ */ jsx9(AnimatePresence2, { mode: "wait", initial: false, children: /* @__PURE__ */ jsx9(
2303
2304
  motion2.span,
@@ -2912,6 +2913,10 @@ var Piloto = forwardRef3(function Piloto2(props, handle) {
2912
2913
  /* @__PURE__ */ jsx10(TypingDots, {}),
2913
2914
  /* @__PURE__ */ jsx10(WaitLabel, { since: state.turnStartedAt, step: state.step, showDuration: features.duration !== false })
2914
2915
  ] }),
2916
+ !busy && props.background && /* @__PURE__ */ jsxs8("div", { "data-background": true, className: "flex flex-col gap-1.5", children: [
2917
+ /* @__PURE__ */ jsx10(TypingDots, {}),
2918
+ /* @__PURE__ */ jsx10(WaitLabel, { text: props.background.label, since: props.background.since, showDuration: features.duration !== false })
2919
+ ] }),
2915
2920
  notice && /* @__PURE__ */ jsx10("p", { className: "text-sm text-text-tertiary", children: notice }),
2916
2921
  error && /* @__PURE__ */ jsx10("p", { className: "text-sm text-text-danger", children: error })
2917
2922
  ] }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ghostykit",
3
- "version": "0.6.3",
3
+ "version": "0.6.5",
4
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.",
5
5
  "type": "module",
6
6
  "main": "./dist/core/index.js",