fix(backends,conversations,telegram,ui): a background subagent reports back as its own turn
This commit is contained in:
1 parent
2afd3bc3c1
commit
8019c76e53
15 files changed
+608
-91
No files matched your search
@@ -9,7 +9,7 @@
|
||||
fmtTokens,
|
||||
} from "$lib/format";
|
||||
import { cn } from "$lib/utils";
|
||||
import type { Turn } from "./activity.svelte";
|
||||
import { isLive, ORIGIN_LABELS, type Turn } from "./activity.svelte";
|
||||
import Markdown from "./markdown.svelte";
|
||||
import ToolNodeView from "./tool-node.svelte";
|
||||
|
||||
@@ -18,10 +18,14 @@
|
||||
const duration = $derived(
|
||||
turn.usage?.duration_ms ?? elapsedMs(turn.startedAt, turn.endedAt, now)
|
||||
);
|
||||
const origin = $derived(ORIGIN_LABELS[turn.origin] ?? turn.origin);
|
||||
const originLabel = $derived(
|
||||
turn.itemOrigin && turn.itemOrigin !== turn.origin
|
||||
? `${turn.origin} · ${turn.itemOrigin}`
|
||||
: turn.origin
|
||||
? `${origin} · ${turn.itemOrigin}`
|
||||
: origin
|
||||
);
|
||||
const pill = $derived(
|
||||
turn.status !== "running" && isLive(turn) ? "running" : turn.status
|
||||
);
|
||||
const toolCount = $derived(Object.keys(turn.nodes).length);
|
||||
</script>
|
||||
@@ -29,15 +33,20 @@
|
||||
<article
|
||||
class={cn(
|
||||
"flex flex-col gap-2 border-b py-3",
|
||||
turn.status === "running" && "bg-signal/[0.03]"
|
||||
pill === "running" && "bg-signal/[0.03]"
|
||||
)}
|
||||
>
|
||||
<header class="flex flex-wrap items-center gap-x-3 gap-y-1 px-1 text-xs">
|
||||
<StatusPill status={turn.status} />
|
||||
{#if turn.origin !== "agent"}
|
||||
<StatusPill status={pill} />
|
||||
{/if}
|
||||
<span
|
||||
class={cn(
|
||||
"font-medium",
|
||||
turn.origin === "inject" ? "text-note" : "text-foreground"
|
||||
turn.origin === "inject" && "text-note",
|
||||
turn.origin === "agent" || turn.origin === "task"
|
||||
? "text-kind-deep"
|
||||
: "text-foreground"
|
||||
)}
|
||||
>
|
||||
{originLabel}
|
||||
@@ -65,7 +74,9 @@
|
||||
</span>
|
||||
{/if}
|
||||
</header>
|
||||
{#if turn.userText}
|
||||
{#if turn.userText && turn.origin === "task"}
|
||||
<p class="mx-1 px-1 text-muted-foreground text-xs">{turn.userText}</p>
|
||||
{:else if turn.userText}
|
||||
<Markdown
|
||||
class="mx-1 rounded-md bg-muted/50 px-2.5 py-1.5"
|
||||
text={turn.userText}
|
||||
@@ -88,7 +99,7 @@
|
||||
{/each}
|
||||
{#if turn.text}
|
||||
<Markdown class="mx-1 px-1" text={turn.text} />
|
||||
{:else if turn.status === "running" && turn.roots.length === 0 && turn.thinking === 0}
|
||||
{:else if turn.status === "running" && turn.origin !== "agent" && turn.roots.length === 0 && turn.thinking === 0}
|
||||
<p class="mx-1 px-1 text-muted-foreground text-sm">
|
||||
Waiting for the model…
|
||||
</p>
|
||||
|
||||
Reference in new issue
Block a user