@invergent/agent-chat-react 2.0.0 → 2.0.1

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.d.cts CHANGED
@@ -209,11 +209,23 @@ interface AgentChatMissionTask {
209
209
  createdAt: string | null;
210
210
  completedAt: string | null;
211
211
  }
212
+ type AgentChatMissionWorkerKind = "task" | "worker" | "delegation";
212
213
  interface AgentChatMissionWorker {
213
- taskId: string;
214
+ /**
215
+ * Which delegation primitive produced this child:
216
+ *
217
+ * - "task" — `spawn_task` (durable Task row, retried by dispatcher)
218
+ * - "worker" — `spawn_worker` (async one-shot, durable session)
219
+ * - "delegation" — `delegate_task` (sync fork-join, ephemeral session)
220
+ *
221
+ * `taskId` / `taskStatus` are non-null only for `kind === "task"` —
222
+ * the other two primitives don't create Task rows.
223
+ */
224
+ kind: AgentChatMissionWorkerKind;
225
+ taskId: string | null;
214
226
  workerSessionId: string;
215
227
  agentDefName: string | null;
216
- taskStatus: string;
228
+ taskStatus: string | null;
217
229
  sessionStatus: string;
218
230
  latestEventId: number | null;
219
231
  latestEventKind: string | null;
package/dist/index.d.ts CHANGED
@@ -209,11 +209,23 @@ interface AgentChatMissionTask {
209
209
  createdAt: string | null;
210
210
  completedAt: string | null;
211
211
  }
212
+ type AgentChatMissionWorkerKind = "task" | "worker" | "delegation";
212
213
  interface AgentChatMissionWorker {
213
- taskId: string;
214
+ /**
215
+ * Which delegation primitive produced this child:
216
+ *
217
+ * - "task" — `spawn_task` (durable Task row, retried by dispatcher)
218
+ * - "worker" — `spawn_worker` (async one-shot, durable session)
219
+ * - "delegation" — `delegate_task` (sync fork-join, ephemeral session)
220
+ *
221
+ * `taskId` / `taskStatus` are non-null only for `kind === "task"` —
222
+ * the other two primitives don't create Task rows.
223
+ */
224
+ kind: AgentChatMissionWorkerKind;
225
+ taskId: string | null;
214
226
  workerSessionId: string;
215
227
  agentDefName: string | null;
216
- taskStatus: string;
228
+ taskStatus: string | null;
217
229
  sessionStatus: string;
218
230
  latestEventId: number | null;
219
231
  latestEventKind: string | null;
package/dist/index.js CHANGED
@@ -10470,6 +10470,16 @@ function truncate2(s, max) {
10470
10470
  return `${s.slice(0, max - 1)}\u2026`;
10471
10471
  }
10472
10472
  var DEFAULT_POLL_INTERVAL_MS = 5e3;
10473
+ var MISSION_WORKER_KIND_BADGE_CLASS = {
10474
+ task: "border-primary/40 bg-primary/10 text-primary uppercase tracking-wide text-[10px]",
10475
+ worker: "border-foreground/30 bg-foreground/5 text-foreground/80 uppercase tracking-wide text-[10px]",
10476
+ delegation: "border-foreground/20 bg-foreground/[0.03] text-foreground/60 uppercase tracking-wide text-[10px]"
10477
+ };
10478
+ var MISSION_WORKER_KIND_TOOLTIP = {
10479
+ task: "Durable Task row created by spawn_task. Retried by the dispatcher; survives across coordinator wakes.",
10480
+ worker: "Async one-shot session spawned by spawn_worker. Durable session, no retry/DAG.",
10481
+ delegation: "Sync fork-join child spawned by delegate_task. Coordinator's wake blocked until it finished."
10482
+ };
10473
10483
  var INITIAL_STATE = {
10474
10484
  mission: null,
10475
10485
  tasks: [],
@@ -10556,7 +10566,11 @@ function MissionDashboard({
10556
10566
  [state.tasks]
10557
10567
  );
10558
10568
  const runningWorkerCount = useMemo(
10559
- () => state.workers.filter((w) => w.taskStatus === "running").length,
10569
+ // "running" means the child is still consuming compute right now.
10570
+ // For task-backed children that's ``taskStatus === "running"``; for
10571
+ // spawn_worker / delegate_task direct children the Task row doesn't
10572
+ // exist, so fall back to the session-level signal.
10573
+ () => state.workers.filter((w) => w.kind === "task" ? w.taskStatus === "running" : w.sessionStatus === "active").length,
10560
10574
  [state.workers]
10561
10575
  );
10562
10576
  if (state.loading && !state.mission) {
@@ -10619,7 +10633,7 @@ function MissionDashboard({
10619
10633
  }
10620
10634
  };
10621
10635
  const statusVariant = mission.status === "satisfied" ? "default" : mission.status === "failed" || mission.status === "cancelled" ? "destructive" : "secondary";
10622
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 p-4 sm:gap-6 sm:p-6 max-w-6xl mx-auto", children: [
10636
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 p-4 sm:gap-6 sm:p-6", children: [
10623
10637
  /* @__PURE__ */ jsxs(Card, { children: [
10624
10638
  /* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-stretch gap-4 sm:flex-row sm:items-start sm:justify-between", children: [
10625
10639
  /* @__PURE__ */ jsxs("div", { className: "space-y-1 min-w-0 flex-1", children: [
@@ -10767,7 +10781,16 @@ function MissionDashboard({
10767
10781
  children: [
10768
10782
  /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1 space-y-1", children: [
10769
10783
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
10770
- /* @__PURE__ */ jsx(Badge, { className: "text-foreground/70", children: w.taskStatus }),
10784
+ /* @__PURE__ */ jsx(
10785
+ Badge,
10786
+ {
10787
+ variant: "outline",
10788
+ className: MISSION_WORKER_KIND_BADGE_CLASS[w.kind],
10789
+ title: MISSION_WORKER_KIND_TOOLTIP[w.kind],
10790
+ children: w.kind
10791
+ }
10792
+ ),
10793
+ /* @__PURE__ */ jsx(Badge, { className: "text-foreground/70", children: w.kind === "task" ? w.taskStatus ?? "\u2014" : w.sessionStatus }),
10771
10794
  w.agentDefName ? /* @__PURE__ */ jsx("span", { className: "text-xs text-foreground/70", children: w.agentDefName }) : null
10772
10795
  ] }),
10773
10796
  /* @__PURE__ */ jsx("div", { className: "text-sm wrap-break-word", children: deriveMissionWorkerActivityLabel(w) }),