import type { AgentInit, FabricContext, JsonObject, PromptOptions, SessionOptions, ShellOptions, ShellResult, Skill, SkillOptions, TaskOptions } from "./types.js"; import type { FabricSession } from "./session.js"; import type { Schema } from "./schema.js"; import type { WebhookSubscriptionDefinition } from "./webhook-subscription.js"; import type { ToolDef } from "./tools.js"; import type { CapabilityPolicy } from "./policy.js"; import { invoke as invokeJob, type JobInvocationContext } from "./job-invoke.js"; export interface AgentTriggers { webhook?: boolean; schedule?: string | string[]; manual?: boolean; [key: string]: string | string[] | boolean | undefined; } export interface AgentDefinition { name?: string; description?: string; instructions?: string; input?: Schema; output?: Schema; model?: string; target?: "node" | "temporal-worker"; skills?: Skill[]; tools?: ToolDef[]; triggers?: AgentTriggers; policy?: import("./policy.js").CapabilityPolicy; costBudget?: import("./cost-budget.js").CostLimit; approvals?: import("./types.js").ApprovalOptions; /** Options applied when the agent lazily initializes its runtime. */ init?: AgentInit; /** Ordered wrappers for logging, tracing, authorization, and shared concerns. */ middleware?: readonly AgentMiddleware[]; /** * Webhook subscription definitions. Each subscription gets its own HTTP * route (`/agents//subscriptions/`) on the Node server and wakes the * agent on inbound events. The host event system decides what payloads * land here — fabric-harness has no opinion on the upstream taxonomy. */ subscriptions?: WebhookSubscriptionDefinition[]; run: (context: AgentRunContext) => Promise | TOutput; } /** Runtime-ready context for finite agents. The default session is initialized lazily. */ export interface AgentRunContext extends FabricContext { input: TInput; /** Stable server-side run identity, available when admitted through a job runtime. */ run?: JobInvocationContext; session(id?: string, options?: SessionOptions): Promise; prompt(text: string, options?: PromptOptions): Promise; skill(name: string, options?: SkillOptions): Promise; task(text: string, options?: TaskOptions): Promise; shell(command: string, options?: ShellOptions): Promise; /** Admit a child finite job without an HTTP round trip. */ invoke: typeof invokeJob; } export type AgentMiddleware = { bivarianceHack(context: AgentRunContext, next: () => Promise): Promise | TOutput; }["bivarianceHack"]; declare const definitionSymbol: unique symbol; type AgentDefinitionMetadata = Omit, "middleware" | "run"> & { middleware?: readonly AgentMiddleware[]; run: (context: AgentRunContext) => unknown; }; export type DefinedAgent = ((context: FabricContext) => Promise | TOutput) & { readonly [definitionSymbol]: AgentDefinitionMetadata; readonly __fabricAgent?: AgentDefinitionMetadata; }; /** * No-defaults finite-agent builder with lazy default-session helpers. * * The runtime admits these finite definitions through its job/run protocol, * but authors define an agent. Use {@link createAgent} for a persistent, * URL-addressable agent whose sessions span multiple submissions. */ export declare function defineAgent(definition: AgentDefinition): DefinedAgent; /** Defaults-injecting finite-agent builder exported from the bare SDK entry point. */ export declare function defineAgentWithDefaults(definition: AgentDefinition): DefinedAgent; /** * Treat a definition policy as a security floor. Invocation policy can add * denials and approval requirements, but cannot replace definition allowlists. */ export declare function mergeCapabilityPolicies(definition: CapabilityPolicy | undefined, invocation: CapabilityPolicy | undefined): CapabilityPolicy | undefined; export declare function getAgentDefinition(value: unknown): AgentDefinition | undefined; export {}; //# sourceMappingURL=agent-definition.d.ts.map