/** * Helper functions for common human-in-the-loop patterns */ import type { Role as RoleType, Team as TeamType, Goal as GoalType, KPI as KPIType, OKR as OKRType } from 'org.ai'; import type { Human as HumanType, ApprovalResponse } from './types.js'; import { Human } from './human.js'; /** * Define a human role * * @example * ```ts * const techLead = defineRole({ * id: 'tech-lead', * name: 'Tech Lead', * description: 'Technical leadership role', * skills: ['code-review', 'architecture'], * escalateTo: 'engineering-manager', * }) * ``` */ export declare function defineRole(role: RoleType): RoleType; /** * Define a team * * @example * ```ts * const engineering = defineTeam({ * id: 'engineering', * name: 'Engineering Team', * members: [{ id: 'alice', name: 'Alice', type: 'human' }], * }) * ``` */ export declare function defineTeam(team: TeamType): TeamType; /** * Define goals for a team or individual * * @example * ```ts * const q1Goals = defineGoals([{ * id: 'q1-2024', * name: 'Q1 Goals', * description: 'Launch v2.0 and improve performance', * target: 100, * progress: 0, * status: 'not-started', * targetDate: new Date('2024-03-31'), * }]) * ``` */ export declare function defineGoals(goals: GoalType[]): GoalType[]; /** * Request approval from a human * * @example * ```ts * const result = await approve({ * title: 'Deploy to production', * description: 'Deploy v2.0.0 to production', * subject: 'Production Deployment', * input: { version: '2.0.0', environment: 'prod' }, * assignee: 'tech-lead@example.com', * priority: 'high', * }) * * if (result.approved) { * await deploy() * } * ``` */ export declare function approve(params: { title: string; description: string; subject: string; input: TData; assignee?: string | string[]; role?: string; team?: string; priority?: 'low' | 'normal' | 'high' | 'critical'; timeout?: number; escalatesTo?: string | string[]; requiresApproval?: boolean; approvers?: string[]; metadata?: Record; }): Promise; /** * Ask a question to a human * * @example * ```ts * const answer = await ask({ * title: 'Product naming', * question: 'What should we name the new feature?', * context: { feature: 'AI Assistant' }, * assignee: 'product-manager@example.com', * }) * ``` */ export declare function ask(params: { title: string; question: string; context?: unknown; assignee?: string | string[]; role?: string; team?: string; priority?: 'low' | 'normal' | 'high' | 'critical'; timeout?: number; suggestions?: string[]; metadata?: Record; }): Promise; /** * Request a human to perform a task * * This uses the digital-workers interface for humans * * @example * ```ts * const result = await do({ * title: 'Review code', * instructions: 'Review the PR and provide feedback', * input: { prUrl: 'https://github.com/...' }, * assignee: 'senior-dev@example.com', * }) * ``` */ export declare function do_(params: { title: string; instructions: string; input: TInput; assignee?: string | string[]; role?: string; team?: string; priority?: 'low' | 'normal' | 'high' | 'critical'; timeout?: number; tools?: any[]; estimatedEffort?: string; metadata?: Record; }): Promise; export { do_ as do }; /** * Request a human to make a decision * * @example * ```ts * const choice = await decide({ * title: 'Pick deployment strategy', * options: ['blue-green', 'canary', 'rolling'], * context: { risk: 'high', users: 100000 }, * assignee: 'devops-lead@example.com', * }) * ``` */ export declare function decide(params: { title: string; description?: string; options: TOptions[]; context?: unknown; assignee?: string | string[]; role?: string; team?: string; priority?: 'low' | 'normal' | 'high' | 'critical'; timeout?: number; criteria?: string[]; metadata?: Record; }): Promise; /** * Request generation/content creation from a human * * This is a specialized form of do() for content generation * * @example * ```ts * const content = await generate({ * title: 'Write blog post', * instructions: 'Write a blog post about our new feature', * input: { topic: 'AI Assistant', targetAudience: 'developers' }, * assignee: 'content-writer@example.com', * }) * ``` */ export declare function generate(params: { title: string; instructions: string; input: TInput; assignee?: string | string[]; role?: string; team?: string; priority?: 'low' | 'normal' | 'high' | 'critical'; timeout?: number; metadata?: Record; }): Promise; /** * Type checking/validation request * * Ask a human to validate data or check type compliance * * @example * ```ts * const valid = await is({ * title: 'Validate user data', * question: 'Is this user data valid and complete?', * input: userData, * assignee: 'data-specialist@example.com', * }) * ``` */ export declare function is(params: { title: string; question: string; input: unknown; assignee?: string | string[]; role?: string; team?: string; priority?: 'low' | 'normal' | 'high' | 'critical'; timeout?: number; metadata?: Record; }): Promise; /** * Send a notification to a human * * @example * ```ts * await notify({ * type: 'info', * title: 'Deployment complete', * message: 'Version 2.0.0 deployed successfully', * recipient: 'team@example.com', * channels: ['slack', 'email'], * }) * ``` */ export declare function notify(params: { type: 'info' | 'warning' | 'error' | 'success'; title: string; message: string; recipient: string | string[]; channels?: ('slack' | 'email' | 'sms' | 'web')[]; priority?: 'low' | 'normal' | 'high' | 'critical'; data?: unknown; }): Promise; /** * Track Key Performance Indicators * * @example * ```ts * kpis({ * id: 'monthly-revenue', * name: 'Monthly Revenue', * value: 150000, * target: 200000, * unit: 'USD', * trend: 'up', * }) * ``` */ export declare function kpis(kpi: KPIType): KPIType; /** * Define Objectives and Key Results * * @example * ```ts * okrs({ * id: 'q1-2024-growth', * objective: 'Accelerate user growth', * keyResults: [ * { * description: 'Increase active users by 50%', * progress: 0.3, * current: 13000, * target: 15000, * }, * { * description: 'Achieve 95% customer satisfaction', * progress: 0.85, * current: 0.93, * target: 0.95, * }, * ], * period: 'Q1 2024', * owner: 'ceo@example.com', * }) * ``` */ export declare function okrs(okr: OKRType): OKRType; /** * Register a human worker in the system * * @example * ```ts * const alice = registerHuman({ * id: 'alice', * name: 'Alice Smith', * email: 'alice@example.com', * roles: ['tech-lead', 'developer'], * teams: ['engineering', 'frontend'], * channels: { * slack: '@alice', * email: 'alice@example.com', * }, * }) * ``` */ export declare function registerHuman(human: HumanType): HumanType; /** * Get the default Human manager instance * * Use this to access the underlying HumanManager for advanced operations */ export declare function getDefaultHuman(): ReturnType; //# sourceMappingURL=helpers.d.ts.map