UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

52 lines (51 loc) • 3.54 kB
/** * What a workflow declares it needs (`meta.requires`, a preset's `requires`) against what a mount provides — ONE function, * read in two places: the Workflow tool's card (a saved workflow with a gap is not offered) and its launch (a run with a gap * is refused before anything starts). A host's catalog listing reads it through {@link listWorkflowCatalogRows}. * * Each declared member kind is folded the way the engine folds a member of that kind when it starts: the deployment * baseline's base spec, then the agent definition its `agent` names ({@link applyWorkflowAgentType}, over the run's agent * registry {@link workflowAgentRegistry}); the skills and MCP servers that kind must have are looked for in what that fold * hands it. Models are looked for among the names a script may pick ({@link workflowModelNamesOf}). */ import type { Model } from "../internal/llm.js"; import type { AgentDefinition, WorkflowGovernanceBaseline } from "../core/types.js"; import type { WorkflowRequires } from "./workflow-script-runner.js"; import type { WorkflowCatalog, WorkflowCatalogEntry, WorkflowCatalogListing, WorkflowCatalogNotice } from "./workflow-catalog.js"; /** What kind of thing a gap names. CLOSED. */ export type WorkflowRequirementGapKind = "agent" | "skill" | "mcpServer" | "model"; /** One thing a workflow needs that the mount does not provide. `member` = the agent definition of the member kind that * needs it (absent: the default member, or a model). */ export interface WorkflowRequirementGap { readonly kind: WorkflowRequirementGapKind; readonly name: string; readonly member?: string; } /** What the check reads of a mount: the deployment's workflow baseline, its model catalog and agent definitions. */ export interface WorkflowRequirementMount { readonly governanceBaseline: WorkflowGovernanceBaseline; readonly models?: Record<string, Model>; readonly agents?: AgentDefinition[]; readonly builtinAgents?: boolean; } /** Every declared need the mount lacks, in declaration order; empty when `requires` is absent or fully met. */ export declare function workflowRequirementGaps(requires: WorkflowRequires | undefined, mount: WorkflowRequirementMount): WorkflowRequirementGap[]; export declare const WORKFLOW_REQUIREMENTS_UNMET_CODE = "workflow.requirements_unmet"; /** The refusal a launch with gaps answers (code {@link WORKFLOW_REQUIREMENTS_UNMET_CODE}): what is missing, by kind, and that * nothing ran. */ export declare function workflowRequirementsUnmetSentence(name: string, gaps: readonly WorkflowRequirementGap[]): string; /** One catalog row as a host lists it: the entry and what this mount lacks for it. */ export interface WorkflowCatalogRow extends WorkflowCatalogEntry { readonly gaps: readonly WorkflowRequirementGap[]; } /** The catalog's listing as one mount sees it — every entry with its {@link workflowRequirementGaps}, and the catalog's * notices. The Workflow tool's card offers the rows whose `gaps` is empty; a host's catalog listing returns them all. */ export declare function listWorkflowCatalogRows(catalog: WorkflowCatalog, mount: WorkflowRequirementMount): Promise<{ rows: WorkflowCatalogRow[]; notices: readonly WorkflowCatalogNotice[]; }>; /** {@link listWorkflowCatalogRows} over a listing already read (a mount's snapshot). */ export declare function workflowCatalogRowsOf(listing: WorkflowCatalogListing, mount: WorkflowRequirementMount): { rows: WorkflowCatalogRow[]; notices: readonly WorkflowCatalogNotice[]; };