/** * Info Gatherer Skill - Guides an AI agent through a sequence of questions, * collecting and storing answers in namespaced SWAIG `global_data`. * * Tier 2 built-in skill with no external dependencies. Direct port of * Python's `signalwire.skills.info_gatherer.skill.InfoGathererSkill` * (core/skill_base.py usage; skill.py:16-312). Supports multiple instances * with different `prefix` values so several question sets can coexist on a * single agent (e.g. "intake" and "medical" questionnaires running side by * side). */ import { SkillBase } from '../SkillBase.js'; import type { SkillToolDefinition, SkillPromptSection, SkillConfig, ParameterSchemaEntry } from '../SkillBase.js'; /** * Collects answers to a configurable list of questions, one at a time. * * Mirrors Python `InfoGathererSkill` exactly: the same required * `questions` config, the same `prefix` / `completion_message` options, * the same two tools (`start_questions`, `submit_answer`), and the same * state shape in `global_data`. * * @example * ```ts * agent.addSkill('info_gatherer', { * questions: [ * { key_name: 'name', question_text: 'What is your name?' }, * { key_name: 'email', question_text: 'Your email?', confirm: true }, * ], * }); * ``` */ export declare class InfoGathererSkill extends SkillBase { static SKILL_NAME: string; static SKILL_DESCRIPTION: string; static SKILL_VERSION: string; static REQUIRED_PACKAGES: readonly string[]; static REQUIRED_ENV_VARS: readonly string[]; static SUPPORTS_MULTIPLE_INSTANCES: boolean; /** List of question definitions populated in `setup()`. */ private questions; /** Derived tool name for the start tool (prefix-aware). */ private startToolName; /** Derived tool name for the submit tool (prefix-aware). */ private submitToolName; /** Message returned once all questions are answered. */ private completionMessage; static getParameterSchema(): Record; /** * Instance key for the SkillManager. When `prefix` is configured, returns * `info_gatherer_` to support multi-instance use. Matches Python's * `get_instance_key()` (skill.py:81-85). */ getInstanceKey(): string; /** * Validate the `questions` config, derive tool names (with optional prefix), * and cache the completion message. * * Python parity: skill.py:91-121. Returns `false` (logging an error) when * `questions` is missing or fails validation; setup must produce a * functional skill or fail closed. */ setup(): Promise; /** * Seed SWAIG `global_data` with the initial question state under this * skill's namespace. Mirrors Python `get_global_data()` (skill.py:127-135). * * Defensive no-op when the skill was not successfully set up (empty * `questions`). Python relies on the SkillManager to skip unloaded skills; * TS adds this guard so `getGlobalData()` called without a successful * `setup()` returns `{}` instead of a malformed state payload. */ getGlobalData(): Record; /** * Register the two sequential-flow tools. Mirrors Python * `register_tools()` (skill.py:162-184). Returns an empty array when * `setup()` did not complete (no questions) so the skill never exposes * half-initialized tools. */ getTools(): SkillToolDefinition[]; /** * Handle the `start_questions` tool: read state from global_data and return * an instruction for the first question. Mirrors Python * `_handle_start_questions` (skill.py:190-208). */ private _handleStartQuestions; /** * Handle the `submit_answer` tool: validate confirmation, record the answer, * advance the index, and either return the next question or the completion * message (disabling both tools on completion). Mirrors Python * `_handle_submit_answer` (skill.py:210-262). */ private _handleSubmitAnswer; /** * Generate the per-question instruction returned to the agent. Mirrors * Python `_generate_question_instruction` (skill.py:268-297). */ private static _generateQuestionInstruction; /** * Validate that `questions` is a non-empty array of objects each having * `key_name` and `question_text`. Throws on invalid input. Mirrors Python * `_validate_questions` (skill.py:299-311). */ private static _validateQuestions; /** * Prompt section describing the question flow to the agent. Mirrors Python * `_get_prompt_sections` (skill.py:141-156). */ protected _getPromptSections(): SkillPromptSection[]; } /** * Factory function for creating InfoGathererSkill instances. * @param config - Optional skill configuration. * @returns A new InfoGathererSkill instance. */ export declare function createSkill(config?: SkillConfig): InfoGathererSkill;