🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
import { ArtboardIdentifier } from '@lobechat/builtin-tool-artboard';
import { DashboardIdentifier, LegacyDashboardIdentifier } from '@lobechat/builtin-tool-dashboard';
import { WebhookIdentifier } from '@lobechat/builtin-tool-webhook';
import type { IFeatureFlagsState } from '@lobechat/types';
/** Builtin tools that exist only while a runtime feature flag is on for the user. */
export const FEATURE_GATED_TOOLS: Record<string, keyof IFeatureFlagsState> = {
[ArtboardIdentifier]: 'enableArtboard',
[DashboardIdentifier]: 'enableDashboard',
// A legacy pinned or replayed id must stay behind the same flag.
[LegacyDashboardIdentifier]: 'enableDashboard',
// Managing inbound webhooks is offered only where they can run at all.
[WebhookIdentifier]: 'enableWebhook',
};
/**
* Identifiers to drop from a run's tool pool for the user's resolved flags.
* Fails closed: a flag that is unset or anything but `true` hides its tool.
* Hosts add these to the run's disabled identifiers, which leave the pool
* outright — explicit activation cannot bring them back.
*/
export const getFeatureDisabledToolIds = (flags: Partial<IFeatureFlagsState> | undefined) =>
Object.entries(FEATURE_GATED_TOOLS)
.filter(([, flag]) => flags?.[flag] !== true)
.map(([identifier]) => identifier);
/** Whether a builtin tool may be offered / listed for the user's resolved flags. */
export const isToolEnabledByFeatureFlags = (
identifier: string,
flags: Partial<IFeatureFlagsState> | undefined,
) => {
const flag = FEATURE_GATED_TOOLS[identifier];
return !flag || flags?.[flag] === true;
};