Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
feat(web): expand platform link badges
Gus85dadbf8e826
diff --git a/src/web/src/components/community/messages/platform-link-badge.test.ts b/src/web/src/components/community/messages/platform-link-badge.test.tsindex 5453b290a..cdaef36e2 100644--- a/src/web/src/components/community/messages/platform-link-badge.test.ts+++ b/src/web/src/components/community/messages/platform-link-badge.test.ts@@ -50,6 +50,41 @@ describe("PlatformLinkBadge", () => {)})+ it("uses a local-machine icon for localhost links", () => {+ let renderer: TestRenderer.ReactTestRenderer+ act(() => {+ renderer = TestRenderer.create(+ React.createElement(+ PlatformLinkBadge,+ { href: "http://localhost:3000/c/me" },+ "http://localhost:3000/c/me",+ ),+ )+ })++ const link = renderer!.root.findByType("a")+ expect(link.props["data-platform-link"]).toBe("local")+ expect(link.props["aria-label"]).toBe("Local: http://localhost:3000/c/me")+ expect(renderer!.root.findAllByType("svg")).toHaveLength(1)+ })++ it("reuses the product's official OpenAI mark", () => {+ let renderer: TestRenderer.ReactTestRenderer+ act(() => {+ renderer = TestRenderer.create(+ React.createElement(+ PlatformLinkBadge,+ { href: "https://platform.openai.com/docs" },+ "https://platform.openai.com/docs",+ ),+ )+ })++ const link = renderer!.root.findByType("a")+ expect(link.props["data-platform-link"]).toBe("openai")+ expect(renderer!.root.findByProps({ "data-provider-logo": "openai" })).toBeTruthy()+ })+it("gives an unsupported URL the generic link icon and the same badge treatment", () => {let renderer: TestRenderer.ReactTestRendereract(() => {diff --git a/src/web/src/components/community/messages/platform-link-badge.tsx b/src/web/src/components/community/messages/platform-link-badge.tsxindex 3f2810ab6..66002a837 100644--- a/src/web/src/components/community/messages/platform-link-badge.tsx+++ b/src/web/src/components/community/messages/platform-link-badge.tsx@@ -1,29 +1,68 @@import type { ComponentPropsWithoutRef } from "react"import Image from "next/image"-import { Link2 } from "lucide-react"+import { Link2, MonitorDot } from "lucide-react"import {+ SiAnthropic,+ SiArxiv,+ SiCloudflare,+ SiDevdotto,SiDiscord,SiFigma,SiGithub,+ SiGitlab,+ SiGoogledrive,+ SiHashnode,+ SiLinear,+ SiLoom,+ SiMedium,SiNotion,+ SiNpm,+ SiProducthunt,SiReddit,+ SiStackoverflow,+ SiSubstack,+ SiVercel,+ SiWikipedia,SiX,+ SiXiaohongshu,+ SiYcombinator,SiYoutube,+ SiZhihu,} from "@icons-pack/react-simple-icons"import type { PlatformLinkKind } from "@/lib/community/platform-link"import { matchPlatformLink } from "@/lib/community/platform-link"import { cn } from "@/lib/utils"+import { OpenAILogo } from "@/components/provider-logo"import { MessageExternalLink } from "./message-external-link"const ICONS = {github: SiGithub,+ gitlab: SiGitlab,x: SiX,reddit: SiReddit,youtube: SiYoutube,figma: SiFigma,notion: SiNotion,discord: SiDiscord,-} satisfies Record<Exclude<PlatformLinkKind, "alook">, typeof SiGithub>+ linear: SiLinear,+ "google-drive": SiGoogledrive,+ cloudflare: SiCloudflare,+ vercel: SiVercel,+ npm: SiNpm,+ loom: SiLoom,+ anthropic: SiAnthropic,+ stackoverflow: SiStackoverflow,+ "hacker-news": SiYcombinator,+ substack: SiSubstack,+ medium: SiMedium,+ "dev-community": SiDevdotto,+ hashnode: SiHashnode,+ "product-hunt": SiProducthunt,+ arxiv: SiArxiv,+ wikipedia: SiWikipedia,+ zhihu: SiZhihu,+ xiaohongshu: SiXiaohongshu,+} satisfies Record<Exclude<PlatformLinkKind, "alook" | "local" | "openai">, typeof SiGithub>type PlatformLinkBadgeProps = ComponentPropsWithoutRef<"a"> & {node?: unknown@@ -53,8 +92,9 @@ export function PlatformLinkBadge({)}- const icon = platform.kind === "alook"- ? (+ const icon = (() => {+ if (platform.kind === "alook") {+ return (<Imagesrc="/favicon.ico"alt=""@@ -65,10 +105,20 @@ export function PlatformLinkBadge({aria-hidden="true"/>)- : (() => {- const Icon = ICONS[platform.kind]- return <Icon className="platform-link-badge-icon" aria-hidden="true" />- })()+ }++ if (platform.kind === "local") {+ return <MonitorDot className="platform-link-badge-icon" aria-hidden="true" />+ }++ if (platform.kind === "openai") {+ return <OpenAILogo className="platform-link-badge-icon" aria-hidden="true" />+ }++ const Icon = ICONS[platform.kind]+ return <Icon className="platform-link-badge-icon" aria-hidden="true" />+ })()+return (<MessageExternalLink{...props}diff --git a/src/web/src/components/provider-logo.tsx b/src/web/src/components/provider-logo.tsxindex 108d1b171..33e50a42e 100644--- a/src/web/src/components/provider-logo.tsx+++ b/src/web/src/components/provider-logo.tsx@@ -1,3 +1,4 @@+import type { ComponentPropsWithoutRef } from "react";import { Monitor } from "lucide-react";function ClaudeLogo({ className }: { className: string }) {@@ -8,9 +9,15 @@ function ClaudeLogo({ className }: { className: string }) {);}-function CodexLogo({ className }: { className: string }) {+export function OpenAILogo({ className, ...props }: ComponentPropsWithoutRef<"svg">) {return (- <svg viewBox="0 0 16 16" fill="currentColor" className={className}>+ <svg+ viewBox="0 0 16 16"+ fill="currentColor"+ className={className}+ data-provider-logo="openai"+ {...props}+ ><path d="M14.949 6.547a3.94 3.94 0 0 0-.348-3.273 4.11 4.11 0 0 0-4.4-1.934A4.1 4.1 0 0 0 8.423.2 4.15 4.15 0 0 0 6.305.086a4.1 4.1 0 0 0-1.891.948 4.04 4.04 0 0 0-1.158 1.753 4.1 4.1 0 0 0-1.563.679A4 4 0 0 0 .554 4.72a3.99 3.99 0 0 0 .502 4.731 3.94 3.94 0 0 0 .346 3.274 4.11 4.11 0 0 0 4.402 1.933c.382.425.852.764 1.377.995.526.231 1.095.35 1.67.346 1.78.002 3.358-1.132 3.901-2.804a4.1 4.1 0 0 0 1.563-.68 4 4 0 0 0 1.14-1.253 3.99 3.99 0 0 0-.506-4.716m-6.097 8.406a3.05 3.05 0 0 1-1.945-.694l.096-.054 3.23-1.838a.53.53 0 0 0 .265-.455v-4.49l1.366.778q.02.011.025.035v3.722c-.003 1.653-1.361 2.992-3.037 2.996m-6.53-2.75a2.95 2.95 0 0 1-.36-2.01l.095.057L5.29 12.09a.53.53 0 0 0 .527 0l3.949-2.246v1.555a.05.05 0 0 1-.022.041L6.473 13.3c-1.454.826-3.311.335-4.15-1.098m-.85-6.94A3.02 3.02 0 0 1 3.07 3.949v3.785a.51.51 0 0 0 .262.451l3.93 2.237-1.366.779a.05.05 0 0 1-.048 0L2.585 9.342a2.98 2.98 0 0 1-1.113-4.094zm11.216 2.571L8.747 5.576l1.362-.776a.05.05 0 0 1 .048 0l3.265 1.86a3 3 0 0 1 1.173 1.207 2.96 2.96 0 0 1-.27 3.2 3.05 3.05 0 0 1-1.36.997V8.279a.52.52 0 0 0-.276-.445m1.36-2.015-.097-.057-3.226-1.855a.53.53 0 0 0-.53 0L6.249 6.153V4.598a.04.04 0 0 1 .019-.04L9.533 2.7a3.07 3.07 0 0 1 3.257.139c.474.325.843.778 1.066 1.303.223.526.289 1.103.191 1.664zM5.503 8.575 4.139 7.8a.05.05 0 0 1-.026-.037V4.049c0-.57.166-1.127.476-1.607s.752-.864 1.275-1.105a3.08 3.08 0 0 1 3.234.41l-.096.054-3.23 1.838a.53.53 0 0 0-.265.455zm.742-1.577 1.758-1 1.762 1v2l-1.755 1-1.762-1z" /></svg>);@@ -141,7 +148,7 @@ export function ProviderLogo({case "claude":return <ClaudeLogo className={className} />;case "codex":- return <CodexLogo className={className} />;+ return <OpenAILogo className={className} />;case "opencode":return <OpenCodeLogo className={className} />;case "openclaw":diff --git a/src/web/src/lib/community/platform-link.test.ts b/src/web/src/lib/community/platform-link.test.tsindex a6f59396d..cfb96ae31 100644--- a/src/web/src/lib/community/platform-link.test.ts+++ b/src/web/src/lib/community/platform-link.test.ts@@ -5,8 +5,16 @@ describe("matchPlatformLink", () => {it.each([["https://alook.ai/c/invite/abcdef", "alook", "Alook"],["https://www.alook.ai/c/invite/abcdef", "alook", "Alook"],+ ["http://localhost:3000/c/me", "local", "Local"],+ ["http://app.localhost:8787/preview", "local", "Local"],+ ["http://127.0.0.1:3000/c/me", "local", "Local"],+ ["http://127.12.34.56:8787/preview", "local", "Local"],+ ["http://0.0.0.0:3000/c/me", "local", "Local"],+ ["http://[::1]:3000/c/me", "local", "Local"],+ ["http://[::ffff:127.0.0.1]:3000/c/me", "local", "Local"],["https://github.com/alookai/alook/pull/598", "github", "GitHub"],["https://gist.github.com/alookai/abc", "github", "GitHub"],+ ["https://gitlab.com/alookai/alook/-/merge_requests/1", "gitlab", "GitLab"],["https://x.com/alookai/status/1", "x", "X"],["https://mobile.twitter.com/alookai/status/1", "x", "X"],["https://old.reddit.com/r/LocalLLaMA/comments/abc", "reddit", "Reddit"],@@ -16,6 +24,30 @@ describe("matchPlatformLink", () => {["https://www.figma.com/design/abc", "figma", "Figma"],["https://workspace.notion.site/Page-abc", "notion", "Notion"],["https://discord.gg/abc", "discord", "Discord"],+ ["https://linear.app/alook/issue/ALO-123", "linear", "Linear"],+ ["https://docs.google.com/document/d/abc/edit", "google-drive", "Google Drive"],+ ["https://drive.google.com/file/d/abc/view", "google-drive", "Google Drive"],+ ["https://developers.cloudflare.com/workers/", "cloudflare", "Cloudflare"],+ ["https://alook.vercel.app/preview", "vercel", "Vercel"],+ ["https://www.npmjs.com/package/@alook/daemon", "npm", "npm"],+ ["https://www.loom.com/share/abc", "loom", "Loom"],+ ["https://platform.openai.com/docs", "openai", "OpenAI"],+ ["https://chatgpt.com/c/abc", "openai", "OpenAI"],+ ["https://docs.anthropic.com/en/docs", "anthropic", "Anthropic"],+ ["https://claude.ai/chat/abc", "anthropic", "Anthropic"],+ ["https://claude.com/product", "anthropic", "Anthropic"],+ ["https://stackoverflow.com/questions/1/example", "stackoverflow", "Stack Overflow"],+ ["https://news.ycombinator.com/item?id=1", "hacker-news", "Hacker News"],+ ["https://alook.substack.com/p/example", "substack", "Substack"],+ ["https://medium.com/@alook/example", "medium", "Medium"],+ ["https://dev.to/alook/example", "dev-community", "DEV Community"],+ ["https://alook.hashnode.com/example", "hashnode", "Hashnode"],+ ["https://www.producthunt.com/posts/alook", "product-hunt", "Product Hunt"],+ ["https://arxiv.org/abs/2609.00001", "arxiv", "arXiv"],+ ["https://en.wikipedia.org/wiki/Multi-agent_system", "wikipedia", "Wikipedia"],+ ["https://www.zhihu.com/question/1", "zhihu", "Zhihu"],+ ["https://www.xiaohongshu.com/explore/abc", "xiaohongshu", "Xiaohongshu"],+ ["https://xhslink.com/a/abc", "xiaohongshu", "Xiaohongshu"],])("recognizes %s", (href, kind, label) => {expect(matchPlatformLink(href)).toEqual({ kind, label })})@@ -24,6 +56,8 @@ describe("matchPlatformLink", () => {"https://github.com.evil.example/alookai/alook","https://notgithub.com/alookai/alook","https://alook.ai.evil.example/c/invite/abcdef",+ "https://127.0.0.1.evil.example/c/me",+ "https://notlinear.app/alook/issue/ALO-123","https://example.com/story","ftp://github.com/alookai/alook","/c/invite/abcdef",diff --git a/src/web/src/lib/community/platform-link.ts b/src/web/src/lib/community/platform-link.tsindex 3c9619adf..256616291 100644--- a/src/web/src/lib/community/platform-link.ts+++ b/src/web/src/lib/community/platform-link.ts@@ -1,12 +1,33 @@export type PlatformLinkKind =| "alook"+ | "local"| "github"+ | "gitlab"| "x"| "reddit"| "youtube"| "figma"| "notion"| "discord"+ | "linear"+ | "google-drive"+ | "cloudflare"+ | "vercel"+ | "npm"+ | "loom"+ | "openai"+ | "anthropic"+ | "stackoverflow"+ | "hacker-news"+ | "substack"+ | "medium"+ | "dev-community"+ | "hashnode"+ | "product-hunt"+ | "arxiv"+ | "wikipedia"+ | "zhihu"+ | "xiaohongshu"export type PlatformLinkMatch = {kind: PlatformLinkKind@@ -20,18 +41,47 @@ type PlatformDefinition = PlatformLinkMatch & {const PLATFORM_DEFINITIONS: readonly PlatformDefinition[] = [{ kind: "alook", label: "Alook", domains: ["alook.ai"] },{ kind: "github", label: "GitHub", domains: ["github.com"] },+ { kind: "gitlab", label: "GitLab", domains: ["gitlab.com"] },{ kind: "x", label: "X", domains: ["x.com", "twitter.com"] },{ kind: "reddit", label: "Reddit", domains: ["reddit.com", "redd.it"] },{ kind: "youtube", label: "YouTube", domains: ["youtube.com", "youtu.be"] },{ kind: "figma", label: "Figma", domains: ["figma.com"] },{ kind: "notion", label: "Notion", domains: ["notion.so", "notion.site"] },{ kind: "discord", label: "Discord", domains: ["discord.com", "discord.gg"] },+ { kind: "linear", label: "Linear", domains: ["linear.app"] },+ { kind: "google-drive", label: "Google Drive", domains: ["drive.google.com", "docs.google.com"] },+ { kind: "cloudflare", label: "Cloudflare", domains: ["cloudflare.com"] },+ { kind: "vercel", label: "Vercel", domains: ["vercel.com", "vercel.app"] },+ { kind: "npm", label: "npm", domains: ["npmjs.com"] },+ { kind: "loom", label: "Loom", domains: ["loom.com"] },+ { kind: "openai", label: "OpenAI", domains: ["openai.com", "chatgpt.com"] },+ { kind: "anthropic", label: "Anthropic", domains: ["anthropic.com", "claude.ai", "claude.com"] },+ { kind: "stackoverflow", label: "Stack Overflow", domains: ["stackoverflow.com"] },+ { kind: "hacker-news", label: "Hacker News", domains: ["news.ycombinator.com"] },+ { kind: "substack", label: "Substack", domains: ["substack.com"] },+ { kind: "medium", label: "Medium", domains: ["medium.com"] },+ { kind: "dev-community", label: "DEV Community", domains: ["dev.to"] },+ { kind: "hashnode", label: "Hashnode", domains: ["hashnode.com"] },+ { kind: "product-hunt", label: "Product Hunt", domains: ["producthunt.com"] },+ { kind: "arxiv", label: "arXiv", domains: ["arxiv.org"] },+ { kind: "wikipedia", label: "Wikipedia", domains: ["wikipedia.org"] },+ { kind: "zhihu", label: "Zhihu", domains: ["zhihu.com"] },+ { kind: "xiaohongshu", label: "Xiaohongshu", domains: ["xiaohongshu.com", "xhslink.com"] },]function hostMatchesDomain(host: string, domain: string): boolean {return host === domain || host.endsWith(`.${domain}`)}+function isLocalDevelopmentHost(host: string): boolean {+ return host === "localhost"+ || host.endsWith(".localhost")+ || host === "0.0.0.0"+ || host === "[::1]"+ || /^\[::ffff:7f[0-9a-f]{2}:[0-9a-f]{1,4}\]$/.test(host)+ || /^127(?:\.\d{1,3}){3}$/.test(host)+}+/*** Classifies a fully-qualified HTTP(S) URL using hostname boundaries only.* No request, metadata lookup, redirect resolution, or storage is involved.@@ -49,6 +99,8 @@ export function matchPlatformLink(href: string | undefined): PlatformLinkMatch |if (url.protocol !== "http:" && url.protocol !== "https:") return nullconst host = url.hostname.toLowerCase().replace(/\.$/, "")+ if (isLocalDevelopmentHost(host)) return { kind: "local", label: "Local" }+const definition = PLATFORM_DEFINITIONS.find(({ domains }) =>domains.some((domain) => hostMatchesDomain(host, domain)),)