UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

16 lines (15 loc) • 948 B
import { resolveToolSubset } from "./tool-filter.js"; import { TASK_CREATE_TOOL_NAME, TASK_GET_TOOL_NAME, TASK_LIST_TOOL_NAME, TASK_UPDATE_TOOL_NAME } from "../core/tool-catalog-entries.js"; export const TEAM_TASK_LIST_TOOL_NAMES = Object.freeze([TASK_CREATE_TOOL_NAME, TASK_GET_TOOL_NAME, TASK_LIST_TOOL_NAME, TASK_UPDATE_TOOL_NAME]); export function callerToolMembership(tools) { const mounted = new Set(Array.isArray(tools) ? tools : []); return (tool) => mounted.has(tool); } export function inheritedChildPool(surface, mountsCallerTool, anonymousBackground) { if (mountsCallerTool === undefined) return []; return surface.filter((t) => mountsCallerTool(t) && !(anonymousBackground && TEAM_TASK_LIST_TOOL_NAMES.includes(t.name))); } export function teammateInheritedFamily(inherited, denyTools) { return resolveToolSubset(inherited.filter((t) => TEAM_TASK_LIST_TOOL_NAMES.includes(t.name)), undefined, denyTools); }