Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.
refactor(web): share the Task status pill and drop unused Task command parsing
LeoXing2c6b88c89c89
diff --git a/apps/web/src/features/rooms/runtime-status/task-activity-block.tsx b/apps/web/src/features/rooms/runtime-status/task-activity-block.tsxindex c83703d8..8dcbb902 100644--- a/apps/web/src/features/rooms/runtime-status/task-activity-block.tsx+++ b/apps/web/src/features/rooms/runtime-status/task-activity-block.tsx@@ -137,17 +137,28 @@ export function TaskActivityBlock({}function TaskState({ execution }: { execution: TeamHubTaskExecution }) {- switch (execution.status) {+ return execution.status === "running" ? (+ <span+ aria-label="Task running"+ className="flex shrink-0 items-center text-app-info"+ role="img"+ >+ <RunningDots />+ </span>+ ) : (+ <TaskStatusPill status={execution.status} />+ );+}++/** A Task's execution state in a word, as its block and its conversation show it. */+export function TaskStatusPill({+ status,+}: {+ status: TeamHubTaskExecution["status"];+}) {+ switch (status) {case "running":- return (- <span- aria-label="Task running"- className="flex shrink-0 items-center text-app-info"- role="img"- >- <RunningDots />- </span>- );+ return <StatusPill tone="neutral">Running</StatusPill>;case "waiting_for_approval":return <StatusPill tone="warning">Needs approval</StatusPill>;case "idle":diff --git a/apps/web/src/features/rooms/runtime-status/task-command.ts b/apps/web/src/features/rooms/runtime-status/task-command.tsindex 212fd16e..d5b9803d 100644--- a/apps/web/src/features/rooms/runtime-status/task-command.ts+++ b/apps/web/src/features/rooms/runtime-status/task-command.ts@@ -9,7 +9,6 @@ export interface TaskCommand {name?: string;/** The message `task send` delivered. */message?: string;- steer?: boolean;taskId?: string;}@@ -31,19 +30,18 @@ export function parseTaskCommand(command: string): TaskCommand | undefined {const operation = words[start + 2] as TaskCommand["operation"];if (!OPERATIONS.has(operation)) return undefined;const flags = new Map<string, string>();- let steer = false;for (let index = start + 3; index < words.length; index += 1) {const word = words[index]!;if (word === "&&" || word === "|" || word === ";") break;- if (word === "--steer") {- steer = true;- continue;- }if (!word.startsWith("--")) continue;const equals = word.indexOf("=");if (equals > 0) {flags.set(word.slice(0, equals), word.slice(equals + 1));- } else if (index + 1 < words.length) {+ } else if (+ index + 1 < words.length &&+ !words[index + 1]!.startsWith("--")+ ) {+ // A flag followed by another flag, such as --steer, takes no value.flags.set(word, words[index + 1]!);index += 1;}@@ -53,7 +51,6 @@ export function parseTaskCommand(command: string): TaskCommand | undefined {...(flags.has("--name") ? { name: flags.get("--name") } : {}),...(flags.has("--message") ? { message: flags.get("--message") } : {}),...(flags.has("--task-id") ? { taskId: flags.get("--task-id") } : {}),- ...(steer ? { steer } : {}),};}diff --git a/apps/web/src/features/rooms/task-sidebar/adapters/runtime-history-view.tsx b/apps/web/src/features/rooms/task-sidebar/adapters/runtime-history-view.tsxindex 69a8f8e6..0b33b525 100644--- a/apps/web/src/features/rooms/task-sidebar/adapters/runtime-history-view.tsx+++ b/apps/web/src/features/rooms/task-sidebar/adapters/runtime-history-view.tsx@@ -375,7 +375,7 @@ export function nativeContentBlock(}}-export function isUserMessage(record: TeamHubMessageActivityRecord) {+function isUserMessage(record: TeamHubMessageActivityRecord) {return record.role === "user" || record.native_type.endsWith(".user_message");}diff --git a/apps/web/src/features/rooms/task-sidebar/adapters/task-conversation-dialog.tsx b/apps/web/src/features/rooms/task-sidebar/adapters/task-conversation-dialog.tsxindex c21db7b6..d21fbeb7 100644--- a/apps/web/src/features/rooms/task-sidebar/adapters/task-conversation-dialog.tsx+++ b/apps/web/src/features/rooms/task-sidebar/adapters/task-conversation-dialog.tsx@@ -6,14 +6,10 @@ import {import { useMemo, useState, type ReactNode } from "react";import { ModalDialog } from "@/components/ui/modal-dialog";-import { StatusPill } from "@/components/ui/status-pill";import { teamHubData } from "@/features/teamhub/teamhub-api";import { useTaskActivities } from "@/features/work-items/use-task-activities";import { useTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";-import type {- TeamHubRunStatus,- TeamHubTaskExecution,-} from "@/features/teamhub/teamhub-types";+import type { TeamHubRunStatus } from "@/features/teamhub/teamhub-types";import { CancelTaskButton } from "../../chat/cancel-task-button";import { MessageMarkdown } from "../../chat/message-markdown";@@ -26,7 +22,10 @@ import {import { ActorAvatar } from "../../members/actor-avatar";import { teamHubIdentityQueryOptions } from "../../room-queries";import { RuntimeActivityPath } from "../../runtime-status/runtime-activity-path-view";-import { TaskActivityLinksProvider } from "../../runtime-status/task-activity-block";+import {+ TaskActivityLinksProvider,+ TaskStatusPill,+} from "../../runtime-status/task-activity-block";import { useTaskActivityEvents } from "../../runtime-status/use-task-activity-events";import { PanelLoading } from "../panel-loading";import { RuntimeTrajectoryView } from "./runtime-trajectory-view";@@ -134,7 +133,7 @@ export function TaskConversationDialog({description={execution ? (<span className="inline-flex items-center gap-1">- <TaskConversationState execution={execution} />+ <TaskStatusPill status={execution.status} />{live ? (<CancelTaskButtoncancel={async () => {@@ -299,7 +298,6 @@ function TaskConversationRun({);}-/** A card the AlterEgo raised, answered here as in its Room. *//*** A card the Task's AlterEgo raised. The card itself is a Message in the Room* that delegated the Task; it is answerable here too.@@ -315,14 +313,10 @@ function TaskApprovalCard({}) {const { client } = useTeamHubRuntime();const queryClient = useQueryClient();- const queryKey = [- "teamhub",- tenantId,- "rooms",- roomId,- "messages",- messageId,- ];+ const queryKey = useMemo(+ () => ["teamhub", tenantId, "rooms", roomId, "messages", messageId],+ [messageId, roomId, tenantId],+ );const message = useQuery({queryKey,queryFn: () =>@@ -346,9 +340,7 @@ function TaskApprovalCard({roomId,tenantId,}),- // queryKey is rebuilt from these same values on every render.- // eslint-disable-next-line react-hooks/exhaustive-deps- [client, queryClient, roomId, tenantId, messageId],+ [client, queryClient, queryKey, roomId, tenantId],);const identity = useQuery(teamHubIdentityQueryOptions(client));const currentActorId = identity.data?.actors.find(@@ -369,22 +361,3 @@ function TaskApprovalCard({/>);}--function TaskConversationState({- execution,-}: {- execution: TeamHubTaskExecution;-}) {- switch (execution.status) {- case "running":- return <StatusPill tone="neutral">Running</StatusPill>;- case "waiting_for_approval":- return <StatusPill tone="warning">Needs approval</StatusPill>;- case "idle":- return <StatusPill tone="success">Reported</StatusPill>;- case "failed":- return <StatusPill tone="danger">Failed</StatusPill>;- case "canceled":- return <StatusPill>Stopped</StatusPill>;- }-}diff --git a/docs/task-delegation.md b/docs/task-delegation.mdindex 1e0f8071..7d936609 100644--- a/docs/task-delegation.md+++ b/docs/task-delegation.md@@ -28,6 +28,14 @@ canceling it from the list cancels it the way the call does. An AlterEgo neverasks you anything; a question goes into its report, and the Meta decideswhether to ask.</sub>+Each `task` step in the Meta's activity is one line with the Task's name and+state. Open it, or a Task under _tasks running in the background_, to read the+Task like a chat: the brief and follow-ups the Meta sent, every step the+AlterEgo took with the command, file or search it acted on, and the approval+cards it raised. A card is answered there or in your chat, where it also+appears, and a running Task can be canceled from the same view. Steps are read+from the AlterEgo's session on your computer each time it takes a new one.+## On the computerEach AlterEgo belongs to the Meta that started it: only the Meta talks with