mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-09-25 14:06:18 +00:00
* feat(plugins): add full-stack contributions and bookmarks example * ci(plugins): provision bookmark gateway for browser tests * fix(plugins): authenticate module downloads through configured backend * fix(plugins): isolate contributions and localize extension UI * fix(plugins): preserve bookmark agent routing and contain async callbacks * fix(plugins): pin durable batch workers to app extension snapshots
29 lines
877 B
TypeScript
29 lines
877 B
TypeScript
import { z } from "zod";
|
|
|
|
import { fetch } from "@/core/api/fetcher";
|
|
import { getBackendBaseURL } from "@/core/config";
|
|
|
|
const contributions = z.array(
|
|
z.object({
|
|
namespace: z.string(),
|
|
viewer_id: z.string().nullable().optional(),
|
|
module: z.string().nullable(),
|
|
backend_actions: z.array(z.string()).optional(),
|
|
entry: z.string().nullable(),
|
|
title: z.string(),
|
|
description: z.string(),
|
|
settings: z.record(z.union([z.boolean(), z.number(), z.string()])),
|
|
}),
|
|
);
|
|
|
|
export const frontendExtensionsQueryKey = ["frontend-extensions"] as const;
|
|
|
|
export async function fetchFrontendExtensions() {
|
|
const response = await fetch(`${getBackendBaseURL()}/api/plugins`, {
|
|
cache: "no-store",
|
|
});
|
|
if (!response.ok)
|
|
throw new Error(`Frontend extensions unavailable (${response.status})`);
|
|
return contributions.parse(await response.json());
|
|
}
|