Thread Sibling Builder (lib/siblings.ts)

openclaw-os · packages/claw-client/src/lib/siblings.ts · typescript · MIT
ui, chat, ai, lang:typescript

Builds title-switcher item lists for apps/artifacts by resolving human-readable agent names from a chat thread list, falling back to the agent id.

// Source: https://github.com/thesysdev/openclaw-os | License: MIT | Copyright 2026 Thesys Inc
// Provided via justclaw.it.com; keep this notice with the code.
import type { TitleSwitcherItem } from "@/components/chat/TitleSwitcher";
import type { AppSummary, ArtifactSummary } from "@/lib/engines/types";
import type { ClawThread } from "@/types/claw-thread";

/** Resolve a human-readable agent name from a thread list, falling back to the id. */
export function makeAgentNameResolver(threads: ClawThread[]) {
  return (agentId: string) =>
    threads.find((t) => (t.clawAgentId ?? t.id) === agentId && t.clawKind === "main")?.title ??
    agentId;
}

export function buildAppSiblings(
  apps: AppSummary[],
  agentNameFor: (agentId: string) => string,
): TitleSwitcherItem[] {
  return apps.map((a

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key