sema-core 1.0.13 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -9
- package/dist/{constants → conf}/config.d.ts +0 -1
- package/dist/conf/config.d.ts.map +1 -0
- package/dist/{constants → conf}/config.js +1 -3
- package/dist/conf/config.js.map +1 -0
- package/dist/core/Conversation.d.ts +3 -14
- package/dist/core/Conversation.d.ts.map +1 -1
- package/dist/core/Conversation.js +53 -89
- package/dist/core/Conversation.js.map +1 -1
- package/dist/core/RunTools.d.ts +5 -5
- package/dist/core/RunTools.d.ts.map +1 -1
- package/dist/core/RunTools.js +22 -31
- package/dist/core/RunTools.js.map +1 -1
- package/dist/core/SemaCore.d.ts +21 -22
- package/dist/core/SemaCore.d.ts.map +1 -1
- package/dist/core/SemaCore.js +16 -24
- package/dist/core/SemaCore.js.map +1 -1
- package/dist/core/SemaEngine.d.ts +2 -2
- package/dist/core/SemaEngine.d.ts.map +1 -1
- package/dist/core/SemaEngine.js +30 -33
- package/dist/core/SemaEngine.js.map +1 -1
- package/dist/events/EventSystem.d.ts.map +1 -1
- package/dist/events/EventSystem.js +3 -2
- package/dist/events/EventSystem.js.map +1 -1
- package/dist/events/types.d.ts +75 -41
- package/dist/events/types.d.ts.map +1 -1
- package/dist/manager/ConfManager.d.ts +10 -3
- package/dist/manager/ConfManager.d.ts.map +1 -1
- package/dist/manager/ConfManager.js +30 -13
- package/dist/manager/ConfManager.js.map +1 -1
- package/dist/manager/CronManager.d.ts +3 -6
- package/dist/manager/CronManager.d.ts.map +1 -1
- package/dist/manager/CronManager.js +62 -74
- package/dist/manager/CronManager.js.map +1 -1
- package/dist/manager/ModelManager.d.ts +0 -3
- package/dist/manager/ModelManager.d.ts.map +1 -1
- package/dist/manager/ModelManager.js +2 -4
- package/dist/manager/ModelManager.js.map +1 -1
- package/dist/manager/PermissionManager.d.ts +4 -6
- package/dist/manager/PermissionManager.d.ts.map +1 -1
- package/dist/manager/PermissionManager.js +70 -65
- package/dist/manager/PermissionManager.js.map +1 -1
- package/dist/manager/StateManager.d.ts +40 -7
- package/dist/manager/StateManager.d.ts.map +1 -1
- package/dist/manager/StateManager.js +79 -22
- package/dist/manager/StateManager.js.map +1 -1
- package/dist/manager/TaskManager.d.ts +2 -9
- package/dist/manager/TaskManager.d.ts.map +1 -1
- package/dist/manager/TaskManager.js +64 -66
- package/dist/manager/TaskManager.js.map +1 -1
- package/dist/prompt/agents.d.ts +3 -0
- package/dist/prompt/agents.d.ts.map +1 -0
- package/dist/prompt/agents.js +52 -0
- package/dist/prompt/agents.js.map +1 -0
- package/dist/prompt/commands.d.ts +3 -0
- package/dist/prompt/commands.d.ts.map +1 -0
- package/dist/prompt/commands.js +19 -0
- package/dist/prompt/commands.js.map +1 -0
- package/dist/prompt/compact.d.ts +2 -0
- package/dist/prompt/compact.d.ts.map +1 -0
- package/dist/prompt/compact.js +22 -0
- package/dist/prompt/compact.js.map +1 -0
- package/dist/prompt/define.d.ts +5 -0
- package/dist/prompt/define.d.ts.map +1 -0
- package/dist/prompt/define.js +8 -0
- package/dist/prompt/define.js.map +1 -0
- package/dist/prompt/design/design.d.ts +47 -0
- package/dist/prompt/design/design.d.ts.map +1 -0
- package/dist/prompt/design/design.js +224 -0
- package/dist/prompt/design/design.js.map +1 -0
- package/dist/prompt/design/designPhilosophy.d.ts +2 -0
- package/dist/prompt/design/designPhilosophy.d.ts.map +1 -0
- package/dist/prompt/design/designPhilosophy.js +79 -0
- package/dist/prompt/design/designPhilosophy.js.map +1 -0
- package/dist/prompt/design/designSystemSpec.d.ts +2 -0
- package/dist/prompt/design/designSystemSpec.d.ts.map +1 -0
- package/dist/prompt/design/designSystemSpec.js +44 -0
- package/dist/prompt/design/designSystemSpec.js.map +1 -0
- package/dist/prompt/design/imgPlaceholder.d.ts +2 -0
- package/dist/prompt/design/imgPlaceholder.d.ts.map +1 -0
- package/dist/prompt/design/imgPlaceholder.js +56 -0
- package/dist/prompt/design/imgPlaceholder.js.map +1 -0
- package/dist/prompt/memory.d.ts +2 -0
- package/dist/prompt/memory.d.ts.map +1 -0
- package/dist/prompt/memory.js +23 -0
- package/dist/prompt/memory.js.map +1 -0
- package/dist/prompt/plan.d.ts +2 -0
- package/dist/prompt/plan.d.ts.map +1 -0
- package/dist/prompt/plan.js +30 -0
- package/dist/prompt/plan.js.map +1 -0
- package/dist/prompt/quickchat.d.ts +2 -0
- package/dist/prompt/quickchat.d.ts.map +1 -0
- package/dist/prompt/quickchat.js +16 -0
- package/dist/prompt/quickchat.js.map +1 -0
- package/dist/prompt/system.d.ts +3 -0
- package/dist/prompt/system.d.ts.map +1 -0
- package/dist/prompt/system.js +76 -0
- package/dist/prompt/system.js.map +1 -0
- package/dist/prompt/tool.d.ts +22 -0
- package/dist/prompt/tool.d.ts.map +1 -0
- package/dist/prompt/tool.js +25 -0
- package/dist/prompt/tool.js.map +1 -0
- package/dist/prompt/toolAliases.d.ts +16 -0
- package/dist/prompt/toolAliases.d.ts.map +1 -0
- package/dist/prompt/toolAliases.js +46 -0
- package/dist/prompt/toolAliases.js.map +1 -0
- package/dist/prompt/tools/createCron.d.ts +2 -0
- package/dist/prompt/tools/createCron.d.ts.map +1 -0
- package/dist/prompt/tools/createCron.js +29 -0
- package/dist/prompt/tools/createCron.js.map +1 -0
- package/dist/prompt/tools/createTodo.d.ts +2 -0
- package/dist/prompt/tools/createTodo.d.ts.map +1 -0
- package/dist/prompt/tools/createTodo.js +23 -0
- package/dist/prompt/tools/createTodo.js.map +1 -0
- package/dist/prompt/tools/fetchUrl.d.ts +3 -0
- package/dist/prompt/tools/fetchUrl.d.ts.map +1 -0
- package/dist/prompt/tools/fetchUrl.js +27 -0
- package/dist/prompt/tools/fetchUrl.js.map +1 -0
- package/dist/prompt/tools/planToAgent.d.ts +2 -0
- package/dist/prompt/tools/planToAgent.d.ts.map +1 -0
- package/dist/prompt/tools/planToAgent.js +24 -0
- package/dist/prompt/tools/planToAgent.js.map +1 -0
- package/dist/prompt/tools/runShell.d.ts +2 -0
- package/dist/prompt/tools/runShell.d.ts.map +1 -0
- package/dist/prompt/tools/runShell.js +31 -0
- package/dist/prompt/tools/runShell.js.map +1 -0
- package/dist/prompt/tools/searchContent.d.ts +2 -0
- package/dist/prompt/tools/searchContent.d.ts.map +1 -0
- package/dist/prompt/tools/searchContent.js +18 -0
- package/dist/prompt/tools/searchContent.js.map +1 -0
- package/dist/prompt/tools/skill.d.ts +2 -0
- package/dist/prompt/tools/skill.d.ts.map +1 -0
- package/dist/prompt/tools/skill.js +14 -0
- package/dist/prompt/tools/skill.js.map +1 -0
- package/dist/prompt/tools/subAgent.d.ts +2 -0
- package/dist/prompt/tools/subAgent.d.ts.map +1 -0
- package/dist/prompt/tools/subAgent.js +45 -0
- package/dist/prompt/tools/subAgent.js.map +1 -0
- package/dist/prompt/tools/viewFile.d.ts +4 -0
- package/dist/prompt/tools/viewFile.d.ts.map +1 -0
- package/dist/prompt/tools/viewFile.js +26 -0
- package/dist/prompt/tools/viewFile.js.map +1 -0
- package/dist/services/agents/agentsManager.d.ts +12 -15
- package/dist/services/agents/agentsManager.d.ts.map +1 -1
- package/dist/services/agents/agentsManager.js +67 -65
- package/dist/services/agents/agentsManager.js.map +1 -1
- package/dist/services/agents/genDesignSystemReminder.d.ts +3 -0
- package/dist/services/agents/genDesignSystemReminder.d.ts.map +1 -0
- package/dist/services/agents/genDesignSystemReminder.js +149 -0
- package/dist/services/agents/genDesignSystemReminder.js.map +1 -0
- package/dist/services/agents/genSystemPrompt.d.ts +11 -11
- package/dist/services/agents/genSystemPrompt.d.ts.map +1 -1
- package/dist/services/agents/genSystemPrompt.js +58 -121
- package/dist/services/agents/genSystemPrompt.js.map +1 -1
- package/dist/services/agents/{systemReminder.d.ts → genSystemReminder.d.ts} +2 -7
- package/dist/services/agents/genSystemReminder.d.ts.map +1 -0
- package/dist/services/agents/genSystemReminder.js +86 -0
- package/dist/services/agents/genSystemReminder.js.map +1 -0
- package/dist/services/api/adapt/anthropic.d.ts +3 -5
- package/dist/services/api/adapt/anthropic.d.ts.map +1 -1
- package/dist/services/api/adapt/anthropic.js +32 -18
- package/dist/services/api/adapt/anthropic.js.map +1 -1
- package/dist/services/api/adapt/openai.d.ts +3 -3
- package/dist/services/api/adapt/openai.d.ts.map +1 -1
- package/dist/services/api/adapt/openai.js +20 -23
- package/dist/services/api/adapt/openai.js.map +1 -1
- package/dist/services/api/adapt/util.d.ts +0 -1
- package/dist/services/api/adapt/util.d.ts.map +1 -1
- package/dist/services/api/adapt/util.js +3 -5
- package/dist/services/api/adapt/util.js.map +1 -1
- package/dist/services/api/apiUtil.d.ts +3 -0
- package/dist/services/api/apiUtil.d.ts.map +1 -1
- package/dist/services/api/apiUtil.js +32 -28
- package/dist/services/api/apiUtil.js.map +1 -1
- package/dist/services/api/cache.d.ts +5 -5
- package/dist/services/api/cache.d.ts.map +1 -1
- package/dist/services/api/cache.js +16 -20
- package/dist/services/api/cache.js.map +1 -1
- package/dist/services/api/queryLLM.d.ts +4 -5
- package/dist/services/api/queryLLM.d.ts.map +1 -1
- package/dist/services/api/queryLLM.js +2 -6
- package/dist/services/api/queryLLM.js.map +1 -1
- package/dist/services/commands/commandsManager.d.ts +11 -14
- package/dist/services/commands/commandsManager.d.ts.map +1 -1
- package/dist/services/commands/commandsManager.js +54 -64
- package/dist/services/commands/commandsManager.js.map +1 -1
- package/dist/services/commands/runCommand.d.ts.map +1 -1
- package/dist/services/commands/runCommand.js +3 -27
- package/dist/services/commands/runCommand.js.map +1 -1
- package/dist/services/design/designManager.d.ts +29 -0
- package/dist/services/design/designManager.d.ts.map +1 -0
- package/dist/services/design/designManager.js +365 -0
- package/dist/services/design/designManager.js.map +1 -0
- package/dist/services/mcp/MCPClient.d.ts.map +1 -1
- package/dist/services/mcp/MCPClient.js +9 -1
- package/dist/services/mcp/MCPClient.js.map +1 -1
- package/dist/services/mcp/MCPManager.d.ts +9 -29
- package/dist/services/mcp/MCPManager.d.ts.map +1 -1
- package/dist/services/mcp/MCPManager.js +53 -147
- package/dist/services/mcp/MCPManager.js.map +1 -1
- package/dist/services/mcp/MCPToolAdapter.js +4 -4
- package/dist/services/mcp/MCPToolAdapter.js.map +1 -1
- package/dist/services/memory/memManager.d.ts +6 -9
- package/dist/services/memory/memManager.d.ts.map +1 -1
- package/dist/services/memory/memManager.js +22 -42
- package/dist/services/memory/memManager.js.map +1 -1
- package/dist/services/plugins/pluginsManager.d.ts +9 -17
- package/dist/services/plugins/pluginsManager.d.ts.map +1 -1
- package/dist/services/plugins/pluginsManager.js +33 -104
- package/dist/services/plugins/pluginsManager.js.map +1 -1
- package/dist/services/rules/rulesManager.d.ts +7 -9
- package/dist/services/rules/rulesManager.d.ts.map +1 -1
- package/dist/services/rules/rulesManager.js +19 -39
- package/dist/services/rules/rulesManager.js.map +1 -1
- package/dist/services/skills/skillsManager.d.ts +10 -13
- package/dist/services/skills/skillsManager.d.ts.map +1 -1
- package/dist/services/skills/skillsManager.js +41 -54
- package/dist/services/skills/skillsManager.js.map +1 -1
- package/dist/tools/CreateCron.d.ts +68 -0
- package/dist/tools/CreateCron.d.ts.map +1 -0
- package/dist/tools/CreateCron.js +76 -0
- package/dist/tools/CreateCron.js.map +1 -0
- package/dist/tools/CreateTodo.d.ts +48 -0
- package/dist/tools/CreateTodo.d.ts.map +1 -0
- package/dist/tools/CreateTodo.js +50 -0
- package/dist/tools/CreateTodo.js.map +1 -0
- package/dist/tools/{CronDelete/CronDelete.d.ts → DelCron.d.ts} +11 -11
- package/dist/tools/DelCron.d.ts.map +1 -0
- package/dist/tools/{CronDelete/CronDelete.js → DelCron.js} +12 -12
- package/dist/tools/DelCron.js.map +1 -0
- package/dist/tools/{NotebookEdit/NotebookEdit.d.ts → EditNotebook.d.ts} +37 -37
- package/dist/tools/EditNotebook.d.ts.map +1 -0
- package/dist/tools/EditNotebook.js +220 -0
- package/dist/tools/EditNotebook.js.map +1 -0
- package/dist/tools/{WebFetch/WebFetch.d.ts → FetchUrl.d.ts} +8 -8
- package/dist/tools/FetchUrl.d.ts.map +1 -0
- package/dist/tools/{WebFetch/WebFetch.js → FetchUrl.js} +30 -34
- package/dist/tools/FetchUrl.js.map +1 -0
- package/dist/tools/GetTodo.d.ts +34 -0
- package/dist/tools/GetTodo.d.ts.map +1 -0
- package/dist/tools/{TaskGet/TaskGet.js → GetTodo.js} +21 -20
- package/dist/tools/GetTodo.js.map +1 -0
- package/dist/tools/{CronList/CronList.d.ts → ListCrons.d.ts} +12 -13
- package/dist/tools/ListCrons.d.ts.map +1 -0
- package/dist/tools/{CronList/CronList.js → ListCrons.js} +20 -20
- package/dist/tools/ListCrons.js.map +1 -0
- package/dist/tools/ListTodos.d.ts +27 -0
- package/dist/tools/ListTodos.d.ts.map +1 -0
- package/dist/tools/{TaskList/TaskList.js → ListTodos.js} +20 -19
- package/dist/tools/ListTodos.js.map +1 -0
- package/dist/tools/{Edit/Edit.d.ts → PatchFile.d.ts} +39 -43
- package/dist/tools/PatchFile.d.ts.map +1 -0
- package/dist/tools/PatchFile.js +214 -0
- package/dist/tools/PatchFile.js.map +1 -0
- package/dist/tools/PeekBgJob.d.ts +58 -0
- package/dist/tools/PeekBgJob.d.ts.map +1 -0
- package/dist/tools/PeekBgJob.js +92 -0
- package/dist/tools/PeekBgJob.js.map +1 -0
- package/dist/tools/PickOption.d.ts +463 -0
- package/dist/tools/PickOption.d.ts.map +1 -0
- package/dist/tools/PickOption.js +226 -0
- package/dist/tools/PickOption.js.map +1 -0
- package/dist/tools/PlanToAgent.d.ts +42 -0
- package/dist/tools/PlanToAgent.d.ts.map +1 -0
- package/dist/tools/{ExitPlanMode/ExitPlanMode.js → PlanToAgent.js} +47 -43
- package/dist/tools/PlanToAgent.js.map +1 -0
- package/dist/tools/{Bash/Bash.d.ts → RunShell.d.ts} +23 -21
- package/dist/tools/RunShell.d.ts.map +1 -0
- package/dist/tools/{Bash/Bash.js → RunShell.js} +55 -58
- package/dist/tools/RunShell.js.map +1 -0
- package/dist/tools/SearchContent.d.ts +86 -0
- package/dist/tools/SearchContent.d.ts.map +1 -0
- package/dist/tools/SearchContent.js +237 -0
- package/dist/tools/SearchContent.js.map +1 -0
- package/dist/tools/{Glob/Glob.d.ts → SearchFiles.d.ts} +8 -8
- package/dist/tools/SearchFiles.d.ts.map +1 -0
- package/dist/tools/{Glob/Glob.js → SearchFiles.js} +24 -31
- package/dist/tools/SearchFiles.js.map +1 -0
- package/dist/tools/{Skill/Skill.d.ts → Skill.d.ts} +11 -11
- package/dist/tools/Skill.d.ts.map +1 -0
- package/dist/tools/{Skill/Skill.js → Skill.js} +21 -19
- package/dist/tools/Skill.js.map +1 -0
- package/dist/tools/{TaskStop/TaskStop.d.ts → StopBgJob.d.ts} +17 -17
- package/dist/tools/StopBgJob.d.ts.map +1 -0
- package/dist/tools/StopBgJob.js +69 -0
- package/dist/tools/StopBgJob.js.map +1 -0
- package/dist/tools/SubAgent.d.ts +67 -0
- package/dist/tools/SubAgent.d.ts.map +1 -0
- package/dist/tools/{Agent/Agent.js → SubAgent.js} +60 -58
- package/dist/tools/SubAgent.js.map +1 -0
- package/dist/tools/UpdateTodo.d.ts +76 -0
- package/dist/tools/UpdateTodo.d.ts.map +1 -0
- package/dist/tools/UpdateTodo.js +111 -0
- package/dist/tools/UpdateTodo.js.map +1 -0
- package/dist/tools/{Read/Read.d.ts → ViewFile.d.ts} +26 -64
- package/dist/tools/ViewFile.d.ts.map +1 -0
- package/dist/tools/ViewFile.js +365 -0
- package/dist/tools/ViewFile.js.map +1 -0
- package/dist/tools/{Write/Write.d.ts → WriteFile.d.ts} +12 -12
- package/dist/tools/WriteFile.d.ts.map +1 -0
- package/dist/tools/WriteFile.js +150 -0
- package/dist/tools/WriteFile.js.map +1 -0
- package/dist/tools/base/Tool.d.ts +2 -2
- package/dist/tools/base/Tool.d.ts.map +1 -1
- package/dist/tools/base/tools.d.ts +1 -0
- package/dist/tools/base/tools.d.ts.map +1 -1
- package/dist/tools/base/tools.js +56 -50
- package/dist/tools/base/tools.js.map +1 -1
- package/dist/types/agent.d.ts +0 -1
- package/dist/types/agent.d.ts.map +1 -1
- package/dist/types/command.d.ts +0 -2
- package/dist/types/command.d.ts.map +1 -1
- package/dist/types/cron.d.ts +6 -6
- package/dist/types/cron.d.ts.map +1 -1
- package/dist/types/design.d.ts +24 -0
- package/dist/types/design.d.ts.map +1 -0
- package/dist/types/design.js +6 -0
- package/dist/types/design.js.map +1 -0
- package/dist/types/errors.d.ts +0 -2
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/errors.js +0 -2
- package/dist/types/errors.js.map +1 -1
- package/dist/types/index.d.ts +16 -12
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +28 -5
- package/dist/types/index.js.map +1 -1
- package/dist/types/mcp.d.ts +1 -3
- package/dist/types/mcp.d.ts.map +1 -1
- package/dist/types/message.d.ts +5 -4
- package/dist/types/message.d.ts.map +1 -1
- package/dist/types/model.d.ts +1 -1
- package/dist/types/model.d.ts.map +1 -1
- package/dist/types/plugin.d.ts +8 -11
- package/dist/types/plugin.d.ts.map +1 -1
- package/dist/types/skill.d.ts +0 -3
- package/dist/types/skill.d.ts.map +1 -1
- package/dist/types/skill.js +0 -2
- package/dist/types/skill.js.map +1 -1
- package/dist/types/task.d.ts +10 -10
- package/dist/types/task.d.ts.map +1 -1
- package/dist/types/todoTask.d.ts +4 -5
- package/dist/types/todoTask.d.ts.map +1 -1
- package/dist/util/adapter.d.ts +8 -3
- package/dist/util/adapter.d.ts.map +1 -1
- package/dist/util/adapter.js +22 -49
- package/dist/util/adapter.js.map +1 -1
- package/dist/util/agentStats.d.ts +1 -1
- package/dist/util/agentStats.d.ts.map +1 -1
- package/dist/util/agentStats.js +16 -24
- package/dist/util/agentStats.js.map +1 -1
- package/dist/util/cacheLLM.d.ts +5 -5
- package/dist/util/cacheLLM.d.ts.map +1 -1
- package/dist/util/cacheLLM.js.map +1 -1
- package/dist/util/color.d.ts +44 -0
- package/dist/util/color.d.ts.map +1 -0
- package/dist/util/color.js +247 -0
- package/dist/util/color.js.map +1 -0
- package/dist/util/commands.d.ts +4 -5
- package/dist/util/commands.d.ts.map +1 -1
- package/dist/util/commands.js +22 -112
- package/dist/util/commands.js.map +1 -1
- package/dist/util/compact.d.ts +6 -3
- package/dist/util/compact.d.ts.map +1 -1
- package/dist/util/compact.js +20 -149
- package/dist/util/compact.js.map +1 -1
- package/dist/util/cron.d.ts +1 -9
- package/dist/util/cron.d.ts.map +1 -1
- package/dist/util/cron.js +2 -29
- package/dist/util/cron.js.map +1 -1
- package/dist/util/cwd.d.ts +2 -35
- package/dist/util/cwd.d.ts.map +1 -1
- package/dist/util/cwd.js +7 -57
- package/dist/util/cwd.js.map +1 -1
- package/dist/util/diff.d.ts +6 -4
- package/dist/util/diff.d.ts.map +1 -1
- package/dist/util/diff.js +63 -104
- package/dist/util/diff.js.map +1 -1
- package/dist/{tools/Edit/utils.d.ts → util/edit.d.ts} +2 -5
- package/dist/util/edit.d.ts.map +1 -0
- package/dist/util/edit.js +44 -0
- package/dist/util/edit.js.map +1 -0
- package/dist/util/env.d.ts +1 -4
- package/dist/util/env.d.ts.map +1 -1
- package/dist/util/env.js +22 -15
- package/dist/util/env.js.map +1 -1
- package/dist/util/fetchUrl.d.ts +18 -0
- package/dist/util/fetchUrl.d.ts.map +1 -0
- package/dist/util/fetchUrl.js +101 -0
- package/dist/util/fetchUrl.js.map +1 -0
- package/dist/util/file.d.ts +32 -45
- package/dist/util/file.d.ts.map +1 -1
- package/dist/util/file.js +153 -236
- package/dist/util/file.js.map +1 -1
- package/dist/util/fileReference.d.ts +1 -9
- package/dist/util/fileReference.d.ts.map +1 -1
- package/dist/util/fileReference.js +45 -58
- package/dist/util/fileReference.js.map +1 -1
- package/dist/util/format.d.ts +1 -9
- package/dist/util/format.d.ts.map +1 -1
- package/dist/util/format.js +5 -46
- package/dist/util/format.js.map +1 -1
- package/dist/util/formatter.d.ts +5 -8
- package/dist/util/formatter.d.ts.map +1 -1
- package/dist/util/formatter.js +5 -15
- package/dist/util/formatter.js.map +1 -1
- package/dist/util/git.d.ts +2 -3
- package/dist/util/git.d.ts.map +1 -1
- package/dist/util/git.js +34 -39
- package/dist/util/git.js.map +1 -1
- package/dist/util/history.d.ts +0 -7
- package/dist/util/history.d.ts.map +1 -1
- package/dist/util/history.js +3 -50
- package/dist/util/history.js.map +1 -1
- package/dist/util/log.d.ts +0 -1
- package/dist/util/log.d.ts.map +1 -1
- package/dist/util/log.js +2 -7
- package/dist/util/log.js.map +1 -1
- package/dist/util/logLLM.d.ts +0 -4
- package/dist/util/logLLM.d.ts.map +1 -1
- package/dist/util/logLLM.js +6 -16
- package/dist/util/logLLM.js.map +1 -1
- package/dist/util/message.d.ts +12 -11
- package/dist/util/message.d.ts.map +1 -1
- package/dist/util/message.js +68 -89
- package/dist/util/message.js.map +1 -1
- package/dist/util/model.d.ts +0 -3
- package/dist/util/model.d.ts.map +1 -1
- package/dist/util/model.js +1 -5
- package/dist/util/model.js.map +1 -1
- package/dist/util/notebook.d.ts +1 -8
- package/dist/util/notebook.d.ts.map +1 -1
- package/dist/util/notebook.js +36 -63
- package/dist/util/notebook.js.map +1 -1
- package/dist/util/pdf.d.ts +14 -72
- package/dist/util/pdf.d.ts.map +1 -1
- package/dist/util/pdf.js +51 -460
- package/dist/util/pdf.js.map +1 -1
- package/dist/util/process.d.ts +1 -1
- package/dist/util/process.d.ts.map +1 -1
- package/dist/util/process.js +7 -11
- package/dist/util/process.js.map +1 -1
- package/dist/util/quickchat.d.ts +6 -0
- package/dist/util/quickchat.d.ts.map +1 -0
- package/dist/util/{btw.js → quickchat.js} +14 -32
- package/dist/util/quickchat.js.map +1 -0
- package/dist/util/ripgrep.d.ts +4 -2
- package/dist/util/ripgrep.d.ts.map +1 -1
- package/dist/util/ripgrep.js +40 -116
- package/dist/util/ripgrep.js.map +1 -1
- package/dist/util/savePath.d.ts +2 -18
- package/dist/util/savePath.d.ts.map +1 -1
- package/dist/util/savePath.js +7 -47
- package/dist/util/savePath.js.map +1 -1
- package/dist/util/secureFile.d.ts +13 -135
- package/dist/util/secureFile.d.ts.map +1 -1
- package/dist/util/secureFile.js +74 -478
- package/dist/util/secureFile.js.map +1 -1
- package/dist/util/session.d.ts +0 -21
- package/dist/util/session.d.ts.map +1 -1
- package/dist/util/session.js +0 -49
- package/dist/util/session.js.map +1 -1
- package/dist/util/shell.d.ts +23 -3
- package/dist/util/shell.d.ts.map +1 -1
- package/dist/util/shell.js +199 -290
- package/dist/util/shell.js.map +1 -1
- package/dist/util/time.d.ts +6 -5
- package/dist/util/time.d.ts.map +1 -1
- package/dist/util/time.js +10 -6
- package/dist/util/time.js.map +1 -1
- package/dist/util/tokens.d.ts +0 -1
- package/dist/util/tokens.d.ts.map +1 -1
- package/dist/util/tokens.js +12 -23
- package/dist/util/tokens.js.map +1 -1
- package/dist/util/topic.d.ts +1 -4
- package/dist/util/topic.d.ts.map +1 -1
- package/dist/util/topic.js +12 -11
- package/dist/util/topic.js.map +1 -1
- package/dist/util/writeFile.d.ts +12 -0
- package/dist/util/writeFile.d.ts.map +1 -0
- package/dist/util/writeFile.js +69 -0
- package/dist/util/writeFile.js.map +1 -0
- package/package.json +1 -1
- package/dist/constants/config.d.ts.map +0 -1
- package/dist/constants/config.js.map +0 -1
- package/dist/constants/message.d.ts +0 -10
- package/dist/constants/message.d.ts.map +0 -1
- package/dist/constants/message.js +0 -25
- package/dist/constants/message.js.map +0 -1
- package/dist/constants/product.d.ts +0 -4
- package/dist/constants/product.d.ts.map +0 -1
- package/dist/constants/product.js +0 -7
- package/dist/constants/product.js.map +0 -1
- package/dist/services/agents/defaultBuiltInAgentsConfs.d.ts +0 -3
- package/dist/services/agents/defaultBuiltInAgentsConfs.d.ts.map +0 -1
- package/dist/services/agents/defaultBuiltInAgentsConfs.js +0 -125
- package/dist/services/agents/defaultBuiltInAgentsConfs.js.map +0 -1
- package/dist/services/agents/prompt.d.ts +0 -10
- package/dist/services/agents/prompt.d.ts.map +0 -1
- package/dist/services/agents/prompt.js +0 -144
- package/dist/services/agents/prompt.js.map +0 -1
- package/dist/services/agents/systemReminder.d.ts.map +0 -1
- package/dist/services/agents/systemReminder.js +0 -68
- package/dist/services/agents/systemReminder.js.map +0 -1
- package/dist/tools/Agent/Agent.d.ts +0 -67
- package/dist/tools/Agent/Agent.d.ts.map +0 -1
- package/dist/tools/Agent/Agent.js.map +0 -1
- package/dist/tools/Agent/prompt.d.ts +0 -6
- package/dist/tools/Agent/prompt.d.ts.map +0 -1
- package/dist/tools/Agent/prompt.js +0 -73
- package/dist/tools/Agent/prompt.js.map +0 -1
- package/dist/tools/AskUserQuestion/AskUserQuestion.d.ts +0 -179
- package/dist/tools/AskUserQuestion/AskUserQuestion.d.ts.map +0 -1
- package/dist/tools/AskUserQuestion/AskUserQuestion.js +0 -165
- package/dist/tools/AskUserQuestion/AskUserQuestion.js.map +0 -1
- package/dist/tools/AskUserQuestion/prompt.d.ts +0 -3
- package/dist/tools/AskUserQuestion/prompt.d.ts.map +0 -1
- package/dist/tools/AskUserQuestion/prompt.js +0 -17
- package/dist/tools/AskUserQuestion/prompt.js.map +0 -1
- package/dist/tools/Bash/Bash.d.ts.map +0 -1
- package/dist/tools/Bash/Bash.js.map +0 -1
- package/dist/tools/Bash/prompt.d.ts +0 -5
- package/dist/tools/Bash/prompt.d.ts.map +0 -1
- package/dist/tools/Bash/prompt.js +0 -130
- package/dist/tools/Bash/prompt.js.map +0 -1
- package/dist/tools/Bash/utils.d.ts +0 -9
- package/dist/tools/Bash/utils.d.ts.map +0 -1
- package/dist/tools/Bash/utils.js +0 -41
- package/dist/tools/Bash/utils.js.map +0 -1
- package/dist/tools/CronCreate/CronCreate.d.ts +0 -68
- package/dist/tools/CronCreate/CronCreate.d.ts.map +0 -1
- package/dist/tools/CronCreate/CronCreate.js +0 -75
- package/dist/tools/CronCreate/CronCreate.js.map +0 -1
- package/dist/tools/CronCreate/prompt.d.ts +0 -3
- package/dist/tools/CronCreate/prompt.d.ts.map +0 -1
- package/dist/tools/CronCreate/prompt.js +0 -41
- package/dist/tools/CronCreate/prompt.js.map +0 -1
- package/dist/tools/CronDelete/CronDelete.d.ts.map +0 -1
- package/dist/tools/CronDelete/CronDelete.js.map +0 -1
- package/dist/tools/CronDelete/prompt.d.ts +0 -3
- package/dist/tools/CronDelete/prompt.d.ts.map +0 -1
- package/dist/tools/CronDelete/prompt.js +0 -6
- package/dist/tools/CronDelete/prompt.js.map +0 -1
- package/dist/tools/CronList/CronList.d.ts.map +0 -1
- package/dist/tools/CronList/CronList.js.map +0 -1
- package/dist/tools/CronList/prompt.d.ts +0 -3
- package/dist/tools/CronList/prompt.d.ts.map +0 -1
- package/dist/tools/CronList/prompt.js +0 -6
- package/dist/tools/CronList/prompt.js.map +0 -1
- package/dist/tools/Edit/Edit.d.ts.map +0 -1
- package/dist/tools/Edit/Edit.js +0 -225
- package/dist/tools/Edit/Edit.js.map +0 -1
- package/dist/tools/Edit/prompt.d.ts +0 -3
- package/dist/tools/Edit/prompt.d.ts.map +0 -1
- package/dist/tools/Edit/prompt.js +0 -15
- package/dist/tools/Edit/prompt.js.map +0 -1
- package/dist/tools/Edit/utils.d.ts.map +0 -1
- package/dist/tools/Edit/utils.js +0 -60
- package/dist/tools/Edit/utils.js.map +0 -1
- package/dist/tools/ExitPlanMode/ExitPlanMode.d.ts +0 -42
- package/dist/tools/ExitPlanMode/ExitPlanMode.d.ts.map +0 -1
- package/dist/tools/ExitPlanMode/ExitPlanMode.js.map +0 -1
- package/dist/tools/ExitPlanMode/prompt.d.ts +0 -3
- package/dist/tools/ExitPlanMode/prompt.d.ts.map +0 -1
- package/dist/tools/ExitPlanMode/prompt.js +0 -28
- package/dist/tools/ExitPlanMode/prompt.js.map +0 -1
- package/dist/tools/Glob/Glob.d.ts.map +0 -1
- package/dist/tools/Glob/Glob.js.map +0 -1
- package/dist/tools/Glob/prompt.d.ts +0 -3
- package/dist/tools/Glob/prompt.d.ts.map +0 -1
- package/dist/tools/Glob/prompt.js +0 -11
- package/dist/tools/Glob/prompt.js.map +0 -1
- package/dist/tools/Grep/Grep.d.ts +0 -106
- package/dist/tools/Grep/Grep.d.ts.map +0 -1
- package/dist/tools/Grep/Grep.js +0 -301
- package/dist/tools/Grep/Grep.js.map +0 -1
- package/dist/tools/Grep/prompt.d.ts +0 -3
- package/dist/tools/Grep/prompt.d.ts.map +0 -1
- package/dist/tools/Grep/prompt.js +0 -17
- package/dist/tools/Grep/prompt.js.map +0 -1
- package/dist/tools/NotebookEdit/NotebookEdit.d.ts.map +0 -1
- package/dist/tools/NotebookEdit/NotebookEdit.js +0 -312
- package/dist/tools/NotebookEdit/NotebookEdit.js.map +0 -1
- package/dist/tools/NotebookEdit/prompt.d.ts +0 -3
- package/dist/tools/NotebookEdit/prompt.d.ts.map +0 -1
- package/dist/tools/NotebookEdit/prompt.js +0 -6
- package/dist/tools/NotebookEdit/prompt.js.map +0 -1
- package/dist/tools/Read/Read.d.ts.map +0 -1
- package/dist/tools/Read/Read.js +0 -472
- package/dist/tools/Read/Read.js.map +0 -1
- package/dist/tools/Read/prompt.d.ts +0 -4
- package/dist/tools/Read/prompt.d.ts.map +0 -1
- package/dist/tools/Read/prompt.js +0 -23
- package/dist/tools/Read/prompt.js.map +0 -1
- package/dist/tools/Skill/Skill.d.ts.map +0 -1
- package/dist/tools/Skill/Skill.js.map +0 -1
- package/dist/tools/Skill/prompt.d.ts +0 -3
- package/dist/tools/Skill/prompt.d.ts.map +0 -1
- package/dist/tools/Skill/prompt.js +0 -27
- package/dist/tools/Skill/prompt.js.map +0 -1
- package/dist/tools/TaskCreate/TaskCreate.d.ts +0 -54
- package/dist/tools/TaskCreate/TaskCreate.d.ts.map +0 -1
- package/dist/tools/TaskCreate/TaskCreate.js +0 -51
- package/dist/tools/TaskCreate/TaskCreate.js.map +0 -1
- package/dist/tools/TaskCreate/prompt.d.ts +0 -3
- package/dist/tools/TaskCreate/prompt.d.ts.map +0 -1
- package/dist/tools/TaskCreate/prompt.js +0 -45
- package/dist/tools/TaskCreate/prompt.js.map +0 -1
- package/dist/tools/TaskGet/TaskGet.d.ts +0 -34
- package/dist/tools/TaskGet/TaskGet.d.ts.map +0 -1
- package/dist/tools/TaskGet/TaskGet.js.map +0 -1
- package/dist/tools/TaskGet/prompt.d.ts +0 -3
- package/dist/tools/TaskGet/prompt.d.ts.map +0 -1
- package/dist/tools/TaskGet/prompt.js +0 -26
- package/dist/tools/TaskGet/prompt.js.map +0 -1
- package/dist/tools/TaskList/TaskList.d.ts +0 -27
- package/dist/tools/TaskList/TaskList.d.ts.map +0 -1
- package/dist/tools/TaskList/TaskList.js.map +0 -1
- package/dist/tools/TaskList/prompt.d.ts +0 -3
- package/dist/tools/TaskList/prompt.d.ts.map +0 -1
- package/dist/tools/TaskList/prompt.js +0 -25
- package/dist/tools/TaskList/prompt.js.map +0 -1
- package/dist/tools/TaskOutput/TaskOutput.d.ts +0 -58
- package/dist/tools/TaskOutput/TaskOutput.d.ts.map +0 -1
- package/dist/tools/TaskOutput/TaskOutput.js +0 -95
- package/dist/tools/TaskOutput/TaskOutput.js.map +0 -1
- package/dist/tools/TaskStop/TaskStop.d.ts.map +0 -1
- package/dist/tools/TaskStop/TaskStop.js +0 -69
- package/dist/tools/TaskStop/TaskStop.js.map +0 -1
- package/dist/tools/TaskUpdate/TaskUpdate.d.ts +0 -88
- package/dist/tools/TaskUpdate/TaskUpdate.d.ts.map +0 -1
- package/dist/tools/TaskUpdate/TaskUpdate.js +0 -115
- package/dist/tools/TaskUpdate/TaskUpdate.js.map +0 -1
- package/dist/tools/TaskUpdate/prompt.d.ts +0 -3
- package/dist/tools/TaskUpdate/prompt.d.ts.map +0 -1
- package/dist/tools/TaskUpdate/prompt.js +0 -80
- package/dist/tools/TaskUpdate/prompt.js.map +0 -1
- package/dist/tools/TodoWrite/TodoWrite.d.ts +0 -92
- package/dist/tools/TodoWrite/TodoWrite.d.ts.map +0 -1
- package/dist/tools/TodoWrite/TodoWrite.js +0 -101
- package/dist/tools/TodoWrite/TodoWrite.js.map +0 -1
- package/dist/tools/TodoWrite/prompt.d.ts +0 -3
- package/dist/tools/TodoWrite/prompt.d.ts.map +0 -1
- package/dist/tools/TodoWrite/prompt.js +0 -187
- package/dist/tools/TodoWrite/prompt.js.map +0 -1
- package/dist/tools/WebFetch/WebFetch.d.ts.map +0 -1
- package/dist/tools/WebFetch/WebFetch.js.map +0 -1
- package/dist/tools/WebFetch/prompt.d.ts +0 -4
- package/dist/tools/WebFetch/prompt.d.ts.map +0 -1
- package/dist/tools/WebFetch/prompt.js +0 -38
- package/dist/tools/WebFetch/prompt.js.map +0 -1
- package/dist/tools/WebFetch/utils.d.ts +0 -20
- package/dist/tools/WebFetch/utils.d.ts.map +0 -1
- package/dist/tools/WebFetch/utils.js +0 -223
- package/dist/tools/WebFetch/utils.js.map +0 -1
- package/dist/tools/Write/Write.d.ts.map +0 -1
- package/dist/tools/Write/Write.js +0 -197
- package/dist/tools/Write/Write.js.map +0 -1
- package/dist/tools/Write/prompt.d.ts +0 -3
- package/dist/tools/Write/prompt.d.ts.map +0 -1
- package/dist/tools/Write/prompt.js +0 -13
- package/dist/tools/Write/prompt.js.map +0 -1
- package/dist/util/assembleTools.d.ts +0 -6
- package/dist/util/assembleTools.d.ts.map +0 -1
- package/dist/util/assembleTools.js +0 -17
- package/dist/util/assembleTools.js.map +0 -1
- package/dist/util/btw.d.ts +0 -6
- package/dist/util/btw.d.ts.map +0 -1
- package/dist/util/btw.js.map +0 -1
- package/dist/util/directory.d.ts +0 -37
- package/dist/util/directory.d.ts.map +0 -1
- package/dist/util/directory.js +0 -137
- package/dist/util/directory.js.map +0 -1
- package/dist/util/exec.d.ts +0 -6
- package/dist/util/exec.d.ts.map +0 -1
- package/dist/util/exec.js +0 -43
- package/dist/util/exec.js.map +0 -1
- package/dist/util/filePermission.d.ts +0 -14
- package/dist/util/filePermission.d.ts.map +0 -1
- package/dist/util/filePermission.js +0 -47
- package/dist/util/filePermission.js.map +0 -1
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const questionSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
3
|
+
type: z.ZodLiteral<"radio">;
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
label: z.ZodString;
|
|
6
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
7
|
+
options: z.ZodArray<z.ZodString, "many">;
|
|
8
|
+
}, "strict", z.ZodTypeAny, {
|
|
9
|
+
options: string[];
|
|
10
|
+
type: "radio";
|
|
11
|
+
id: string;
|
|
12
|
+
label: string;
|
|
13
|
+
required?: boolean | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
options: string[];
|
|
16
|
+
type: "radio";
|
|
17
|
+
id: string;
|
|
18
|
+
label: string;
|
|
19
|
+
required?: boolean | undefined;
|
|
20
|
+
}>, z.ZodObject<{
|
|
21
|
+
type: z.ZodLiteral<"checkbox">;
|
|
22
|
+
id: z.ZodString;
|
|
23
|
+
label: z.ZodString;
|
|
24
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
25
|
+
options: z.ZodArray<z.ZodString, "many">;
|
|
26
|
+
maxSelections: z.ZodOptional<z.ZodNumber>;
|
|
27
|
+
}, "strict", z.ZodTypeAny, {
|
|
28
|
+
options: string[];
|
|
29
|
+
type: "checkbox";
|
|
30
|
+
id: string;
|
|
31
|
+
label: string;
|
|
32
|
+
required?: boolean | undefined;
|
|
33
|
+
maxSelections?: number | undefined;
|
|
34
|
+
}, {
|
|
35
|
+
options: string[];
|
|
36
|
+
type: "checkbox";
|
|
37
|
+
id: string;
|
|
38
|
+
label: string;
|
|
39
|
+
required?: boolean | undefined;
|
|
40
|
+
maxSelections?: number | undefined;
|
|
41
|
+
}>, z.ZodObject<{
|
|
42
|
+
type: z.ZodLiteral<"select">;
|
|
43
|
+
id: z.ZodString;
|
|
44
|
+
label: z.ZodString;
|
|
45
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
46
|
+
options: z.ZodArray<z.ZodString, "many">;
|
|
47
|
+
}, "strict", z.ZodTypeAny, {
|
|
48
|
+
options: string[];
|
|
49
|
+
type: "select";
|
|
50
|
+
id: string;
|
|
51
|
+
label: string;
|
|
52
|
+
required?: boolean | undefined;
|
|
53
|
+
}, {
|
|
54
|
+
options: string[];
|
|
55
|
+
type: "select";
|
|
56
|
+
id: string;
|
|
57
|
+
label: string;
|
|
58
|
+
required?: boolean | undefined;
|
|
59
|
+
}>, z.ZodObject<{
|
|
60
|
+
type: z.ZodLiteral<"text">;
|
|
61
|
+
id: z.ZodString;
|
|
62
|
+
label: z.ZodString;
|
|
63
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
64
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
65
|
+
}, "strict", z.ZodTypeAny, {
|
|
66
|
+
type: "text";
|
|
67
|
+
id: string;
|
|
68
|
+
label: string;
|
|
69
|
+
required?: boolean | undefined;
|
|
70
|
+
placeholder?: string | undefined;
|
|
71
|
+
}, {
|
|
72
|
+
type: "text";
|
|
73
|
+
id: string;
|
|
74
|
+
label: string;
|
|
75
|
+
required?: boolean | undefined;
|
|
76
|
+
placeholder?: string | undefined;
|
|
77
|
+
}>, z.ZodObject<{
|
|
78
|
+
type: z.ZodLiteral<"textarea">;
|
|
79
|
+
id: z.ZodString;
|
|
80
|
+
label: z.ZodString;
|
|
81
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
82
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
83
|
+
}, "strict", z.ZodTypeAny, {
|
|
84
|
+
type: "textarea";
|
|
85
|
+
id: string;
|
|
86
|
+
label: string;
|
|
87
|
+
required?: boolean | undefined;
|
|
88
|
+
placeholder?: string | undefined;
|
|
89
|
+
}, {
|
|
90
|
+
type: "textarea";
|
|
91
|
+
id: string;
|
|
92
|
+
label: string;
|
|
93
|
+
required?: boolean | undefined;
|
|
94
|
+
placeholder?: string | undefined;
|
|
95
|
+
}>]>;
|
|
96
|
+
declare const toolParams: z.ZodObject<{
|
|
97
|
+
questions: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
98
|
+
type: z.ZodLiteral<"radio">;
|
|
99
|
+
id: z.ZodString;
|
|
100
|
+
label: z.ZodString;
|
|
101
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
102
|
+
options: z.ZodArray<z.ZodString, "many">;
|
|
103
|
+
}, "strict", z.ZodTypeAny, {
|
|
104
|
+
options: string[];
|
|
105
|
+
type: "radio";
|
|
106
|
+
id: string;
|
|
107
|
+
label: string;
|
|
108
|
+
required?: boolean | undefined;
|
|
109
|
+
}, {
|
|
110
|
+
options: string[];
|
|
111
|
+
type: "radio";
|
|
112
|
+
id: string;
|
|
113
|
+
label: string;
|
|
114
|
+
required?: boolean | undefined;
|
|
115
|
+
}>, z.ZodObject<{
|
|
116
|
+
type: z.ZodLiteral<"checkbox">;
|
|
117
|
+
id: z.ZodString;
|
|
118
|
+
label: z.ZodString;
|
|
119
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
120
|
+
options: z.ZodArray<z.ZodString, "many">;
|
|
121
|
+
maxSelections: z.ZodOptional<z.ZodNumber>;
|
|
122
|
+
}, "strict", z.ZodTypeAny, {
|
|
123
|
+
options: string[];
|
|
124
|
+
type: "checkbox";
|
|
125
|
+
id: string;
|
|
126
|
+
label: string;
|
|
127
|
+
required?: boolean | undefined;
|
|
128
|
+
maxSelections?: number | undefined;
|
|
129
|
+
}, {
|
|
130
|
+
options: string[];
|
|
131
|
+
type: "checkbox";
|
|
132
|
+
id: string;
|
|
133
|
+
label: string;
|
|
134
|
+
required?: boolean | undefined;
|
|
135
|
+
maxSelections?: number | undefined;
|
|
136
|
+
}>, z.ZodObject<{
|
|
137
|
+
type: z.ZodLiteral<"select">;
|
|
138
|
+
id: z.ZodString;
|
|
139
|
+
label: z.ZodString;
|
|
140
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
141
|
+
options: z.ZodArray<z.ZodString, "many">;
|
|
142
|
+
}, "strict", z.ZodTypeAny, {
|
|
143
|
+
options: string[];
|
|
144
|
+
type: "select";
|
|
145
|
+
id: string;
|
|
146
|
+
label: string;
|
|
147
|
+
required?: boolean | undefined;
|
|
148
|
+
}, {
|
|
149
|
+
options: string[];
|
|
150
|
+
type: "select";
|
|
151
|
+
id: string;
|
|
152
|
+
label: string;
|
|
153
|
+
required?: boolean | undefined;
|
|
154
|
+
}>, z.ZodObject<{
|
|
155
|
+
type: z.ZodLiteral<"text">;
|
|
156
|
+
id: z.ZodString;
|
|
157
|
+
label: z.ZodString;
|
|
158
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
159
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
160
|
+
}, "strict", z.ZodTypeAny, {
|
|
161
|
+
type: "text";
|
|
162
|
+
id: string;
|
|
163
|
+
label: string;
|
|
164
|
+
required?: boolean | undefined;
|
|
165
|
+
placeholder?: string | undefined;
|
|
166
|
+
}, {
|
|
167
|
+
type: "text";
|
|
168
|
+
id: string;
|
|
169
|
+
label: string;
|
|
170
|
+
required?: boolean | undefined;
|
|
171
|
+
placeholder?: string | undefined;
|
|
172
|
+
}>, z.ZodObject<{
|
|
173
|
+
type: z.ZodLiteral<"textarea">;
|
|
174
|
+
id: z.ZodString;
|
|
175
|
+
label: z.ZodString;
|
|
176
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
177
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
178
|
+
}, "strict", z.ZodTypeAny, {
|
|
179
|
+
type: "textarea";
|
|
180
|
+
id: string;
|
|
181
|
+
label: string;
|
|
182
|
+
required?: boolean | undefined;
|
|
183
|
+
placeholder?: string | undefined;
|
|
184
|
+
}, {
|
|
185
|
+
type: "textarea";
|
|
186
|
+
id: string;
|
|
187
|
+
label: string;
|
|
188
|
+
required?: boolean | undefined;
|
|
189
|
+
placeholder?: string | undefined;
|
|
190
|
+
}>]>, "many">;
|
|
191
|
+
estimatedTime: z.ZodOptional<z.ZodString>;
|
|
192
|
+
intro: z.ZodOptional<z.ZodString>;
|
|
193
|
+
}, "strict", z.ZodTypeAny, {
|
|
194
|
+
questions: ({
|
|
195
|
+
options: string[];
|
|
196
|
+
type: "radio";
|
|
197
|
+
id: string;
|
|
198
|
+
label: string;
|
|
199
|
+
required?: boolean | undefined;
|
|
200
|
+
} | {
|
|
201
|
+
options: string[];
|
|
202
|
+
type: "checkbox";
|
|
203
|
+
id: string;
|
|
204
|
+
label: string;
|
|
205
|
+
required?: boolean | undefined;
|
|
206
|
+
maxSelections?: number | undefined;
|
|
207
|
+
} | {
|
|
208
|
+
options: string[];
|
|
209
|
+
type: "select";
|
|
210
|
+
id: string;
|
|
211
|
+
label: string;
|
|
212
|
+
required?: boolean | undefined;
|
|
213
|
+
} | {
|
|
214
|
+
type: "text";
|
|
215
|
+
id: string;
|
|
216
|
+
label: string;
|
|
217
|
+
required?: boolean | undefined;
|
|
218
|
+
placeholder?: string | undefined;
|
|
219
|
+
} | {
|
|
220
|
+
type: "textarea";
|
|
221
|
+
id: string;
|
|
222
|
+
label: string;
|
|
223
|
+
required?: boolean | undefined;
|
|
224
|
+
placeholder?: string | undefined;
|
|
225
|
+
})[];
|
|
226
|
+
estimatedTime?: string | undefined;
|
|
227
|
+
intro?: string | undefined;
|
|
228
|
+
}, {
|
|
229
|
+
questions: ({
|
|
230
|
+
options: string[];
|
|
231
|
+
type: "radio";
|
|
232
|
+
id: string;
|
|
233
|
+
label: string;
|
|
234
|
+
required?: boolean | undefined;
|
|
235
|
+
} | {
|
|
236
|
+
options: string[];
|
|
237
|
+
type: "checkbox";
|
|
238
|
+
id: string;
|
|
239
|
+
label: string;
|
|
240
|
+
required?: boolean | undefined;
|
|
241
|
+
maxSelections?: number | undefined;
|
|
242
|
+
} | {
|
|
243
|
+
options: string[];
|
|
244
|
+
type: "select";
|
|
245
|
+
id: string;
|
|
246
|
+
label: string;
|
|
247
|
+
required?: boolean | undefined;
|
|
248
|
+
} | {
|
|
249
|
+
type: "text";
|
|
250
|
+
id: string;
|
|
251
|
+
label: string;
|
|
252
|
+
required?: boolean | undefined;
|
|
253
|
+
placeholder?: string | undefined;
|
|
254
|
+
} | {
|
|
255
|
+
type: "textarea";
|
|
256
|
+
id: string;
|
|
257
|
+
label: string;
|
|
258
|
+
required?: boolean | undefined;
|
|
259
|
+
placeholder?: string | undefined;
|
|
260
|
+
})[];
|
|
261
|
+
estimatedTime?: string | undefined;
|
|
262
|
+
intro?: string | undefined;
|
|
263
|
+
}>;
|
|
264
|
+
type Question = z.infer<typeof questionSchema>;
|
|
265
|
+
interface PickOptionOutput {
|
|
266
|
+
questions: Question[];
|
|
267
|
+
estimatedTime?: string;
|
|
268
|
+
intro?: string;
|
|
269
|
+
answers: string | null;
|
|
270
|
+
}
|
|
271
|
+
export declare const PickOption: {
|
|
272
|
+
name: string;
|
|
273
|
+
description(): string;
|
|
274
|
+
toolParams: z.ZodObject<{
|
|
275
|
+
questions: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
276
|
+
type: z.ZodLiteral<"radio">;
|
|
277
|
+
id: z.ZodString;
|
|
278
|
+
label: z.ZodString;
|
|
279
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
280
|
+
options: z.ZodArray<z.ZodString, "many">;
|
|
281
|
+
}, "strict", z.ZodTypeAny, {
|
|
282
|
+
options: string[];
|
|
283
|
+
type: "radio";
|
|
284
|
+
id: string;
|
|
285
|
+
label: string;
|
|
286
|
+
required?: boolean | undefined;
|
|
287
|
+
}, {
|
|
288
|
+
options: string[];
|
|
289
|
+
type: "radio";
|
|
290
|
+
id: string;
|
|
291
|
+
label: string;
|
|
292
|
+
required?: boolean | undefined;
|
|
293
|
+
}>, z.ZodObject<{
|
|
294
|
+
type: z.ZodLiteral<"checkbox">;
|
|
295
|
+
id: z.ZodString;
|
|
296
|
+
label: z.ZodString;
|
|
297
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
298
|
+
options: z.ZodArray<z.ZodString, "many">;
|
|
299
|
+
maxSelections: z.ZodOptional<z.ZodNumber>;
|
|
300
|
+
}, "strict", z.ZodTypeAny, {
|
|
301
|
+
options: string[];
|
|
302
|
+
type: "checkbox";
|
|
303
|
+
id: string;
|
|
304
|
+
label: string;
|
|
305
|
+
required?: boolean | undefined;
|
|
306
|
+
maxSelections?: number | undefined;
|
|
307
|
+
}, {
|
|
308
|
+
options: string[];
|
|
309
|
+
type: "checkbox";
|
|
310
|
+
id: string;
|
|
311
|
+
label: string;
|
|
312
|
+
required?: boolean | undefined;
|
|
313
|
+
maxSelections?: number | undefined;
|
|
314
|
+
}>, z.ZodObject<{
|
|
315
|
+
type: z.ZodLiteral<"select">;
|
|
316
|
+
id: z.ZodString;
|
|
317
|
+
label: z.ZodString;
|
|
318
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
319
|
+
options: z.ZodArray<z.ZodString, "many">;
|
|
320
|
+
}, "strict", z.ZodTypeAny, {
|
|
321
|
+
options: string[];
|
|
322
|
+
type: "select";
|
|
323
|
+
id: string;
|
|
324
|
+
label: string;
|
|
325
|
+
required?: boolean | undefined;
|
|
326
|
+
}, {
|
|
327
|
+
options: string[];
|
|
328
|
+
type: "select";
|
|
329
|
+
id: string;
|
|
330
|
+
label: string;
|
|
331
|
+
required?: boolean | undefined;
|
|
332
|
+
}>, z.ZodObject<{
|
|
333
|
+
type: z.ZodLiteral<"text">;
|
|
334
|
+
id: z.ZodString;
|
|
335
|
+
label: z.ZodString;
|
|
336
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
337
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
338
|
+
}, "strict", z.ZodTypeAny, {
|
|
339
|
+
type: "text";
|
|
340
|
+
id: string;
|
|
341
|
+
label: string;
|
|
342
|
+
required?: boolean | undefined;
|
|
343
|
+
placeholder?: string | undefined;
|
|
344
|
+
}, {
|
|
345
|
+
type: "text";
|
|
346
|
+
id: string;
|
|
347
|
+
label: string;
|
|
348
|
+
required?: boolean | undefined;
|
|
349
|
+
placeholder?: string | undefined;
|
|
350
|
+
}>, z.ZodObject<{
|
|
351
|
+
type: z.ZodLiteral<"textarea">;
|
|
352
|
+
id: z.ZodString;
|
|
353
|
+
label: z.ZodString;
|
|
354
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
355
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
356
|
+
}, "strict", z.ZodTypeAny, {
|
|
357
|
+
type: "textarea";
|
|
358
|
+
id: string;
|
|
359
|
+
label: string;
|
|
360
|
+
required?: boolean | undefined;
|
|
361
|
+
placeholder?: string | undefined;
|
|
362
|
+
}, {
|
|
363
|
+
type: "textarea";
|
|
364
|
+
id: string;
|
|
365
|
+
label: string;
|
|
366
|
+
required?: boolean | undefined;
|
|
367
|
+
placeholder?: string | undefined;
|
|
368
|
+
}>]>, "many">;
|
|
369
|
+
estimatedTime: z.ZodOptional<z.ZodString>;
|
|
370
|
+
intro: z.ZodOptional<z.ZodString>;
|
|
371
|
+
}, "strict", z.ZodTypeAny, {
|
|
372
|
+
questions: ({
|
|
373
|
+
options: string[];
|
|
374
|
+
type: "radio";
|
|
375
|
+
id: string;
|
|
376
|
+
label: string;
|
|
377
|
+
required?: boolean | undefined;
|
|
378
|
+
} | {
|
|
379
|
+
options: string[];
|
|
380
|
+
type: "checkbox";
|
|
381
|
+
id: string;
|
|
382
|
+
label: string;
|
|
383
|
+
required?: boolean | undefined;
|
|
384
|
+
maxSelections?: number | undefined;
|
|
385
|
+
} | {
|
|
386
|
+
options: string[];
|
|
387
|
+
type: "select";
|
|
388
|
+
id: string;
|
|
389
|
+
label: string;
|
|
390
|
+
required?: boolean | undefined;
|
|
391
|
+
} | {
|
|
392
|
+
type: "text";
|
|
393
|
+
id: string;
|
|
394
|
+
label: string;
|
|
395
|
+
required?: boolean | undefined;
|
|
396
|
+
placeholder?: string | undefined;
|
|
397
|
+
} | {
|
|
398
|
+
type: "textarea";
|
|
399
|
+
id: string;
|
|
400
|
+
label: string;
|
|
401
|
+
required?: boolean | undefined;
|
|
402
|
+
placeholder?: string | undefined;
|
|
403
|
+
})[];
|
|
404
|
+
estimatedTime?: string | undefined;
|
|
405
|
+
intro?: string | undefined;
|
|
406
|
+
}, {
|
|
407
|
+
questions: ({
|
|
408
|
+
options: string[];
|
|
409
|
+
type: "radio";
|
|
410
|
+
id: string;
|
|
411
|
+
label: string;
|
|
412
|
+
required?: boolean | undefined;
|
|
413
|
+
} | {
|
|
414
|
+
options: string[];
|
|
415
|
+
type: "checkbox";
|
|
416
|
+
id: string;
|
|
417
|
+
label: string;
|
|
418
|
+
required?: boolean | undefined;
|
|
419
|
+
maxSelections?: number | undefined;
|
|
420
|
+
} | {
|
|
421
|
+
options: string[];
|
|
422
|
+
type: "select";
|
|
423
|
+
id: string;
|
|
424
|
+
label: string;
|
|
425
|
+
required?: boolean | undefined;
|
|
426
|
+
} | {
|
|
427
|
+
type: "text";
|
|
428
|
+
id: string;
|
|
429
|
+
label: string;
|
|
430
|
+
required?: boolean | undefined;
|
|
431
|
+
placeholder?: string | undefined;
|
|
432
|
+
} | {
|
|
433
|
+
type: "textarea";
|
|
434
|
+
id: string;
|
|
435
|
+
label: string;
|
|
436
|
+
required?: boolean | undefined;
|
|
437
|
+
placeholder?: string | undefined;
|
|
438
|
+
})[];
|
|
439
|
+
estimatedTime?: string | undefined;
|
|
440
|
+
intro?: string | undefined;
|
|
441
|
+
}>;
|
|
442
|
+
isSafe(): true;
|
|
443
|
+
genToolResultMessage(output: PickOptionOutput): {
|
|
444
|
+
title: string;
|
|
445
|
+
summary: string;
|
|
446
|
+
content: string;
|
|
447
|
+
};
|
|
448
|
+
validateInput({ questions }: z.infer<typeof toolParams>, _agentContext: any): Promise<{
|
|
449
|
+
result: false;
|
|
450
|
+
message: string;
|
|
451
|
+
} | {
|
|
452
|
+
result: true;
|
|
453
|
+
message?: undefined;
|
|
454
|
+
}>;
|
|
455
|
+
call(input: z.infer<typeof toolParams>, agentContext: any): AsyncGenerator<{
|
|
456
|
+
type: "result";
|
|
457
|
+
data: PickOptionOutput;
|
|
458
|
+
resultForAssistant: string | (import("@anthropic-ai/sdk/resources").TextBlockParam | import("@anthropic-ai/sdk/resources").ImageBlockParam)[] | undefined;
|
|
459
|
+
}, void, unknown>;
|
|
460
|
+
genResultForAssistant(output: PickOptionOutput): string;
|
|
461
|
+
};
|
|
462
|
+
export {};
|
|
463
|
+
//# sourceMappingURL=PickOption.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PickOption.d.ts","sourceRoot":"","sources":["../../src/tools/PickOption.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AA4FvB,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAMlB,CAAA;AAEF,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsBd,CAAA;AAEF,KAAK,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AAE9C,UAAU,gBAAgB;IACxB,SAAS,EAAE,QAAQ,EAAE,CAAA;IACrB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CACvB;AAED,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAkCQ,gBAAgB;;;;;iCAkB5B,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,iBAC1B,GAAG;;;;;;;gBA8BD,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,gBAAgB,GAAG;;;;;kCAiDlC,gBAAgB;CASK,CAAA"}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PickOption = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const EventSystem_1 = require("../events/EventSystem");
|
|
6
|
+
const errors_1 = require("../types/errors");
|
|
7
|
+
const tool_1 = require("../prompt/tool");
|
|
8
|
+
const idField = zod_1.z
|
|
9
|
+
.string()
|
|
10
|
+
.min(1)
|
|
11
|
+
.describe('Unique stable identifier for this question (lowercase snake_case, e.g. "platform", "tone"). Used internally; not shown to the user.');
|
|
12
|
+
const labelField = zod_1.z
|
|
13
|
+
.string()
|
|
14
|
+
.describe('The question shown to the user (max 60 chars). Be concise and unambiguous.');
|
|
15
|
+
const requiredField = zod_1.z
|
|
16
|
+
.boolean()
|
|
17
|
+
.optional()
|
|
18
|
+
.describe('If true, the user must answer this question to submit the form. Default false.');
|
|
19
|
+
const radioQ = zod_1.z.strictObject({
|
|
20
|
+
type: zod_1.z.literal('radio'),
|
|
21
|
+
id: idField,
|
|
22
|
+
label: labelField,
|
|
23
|
+
required: requiredField,
|
|
24
|
+
options: zod_1.z
|
|
25
|
+
.array(zod_1.z.string())
|
|
26
|
+
.min(2)
|
|
27
|
+
.max(5)
|
|
28
|
+
.describe('Mutually exclusive choices. 2–5 items. If you need 6 or more options, use "select" instead.'),
|
|
29
|
+
});
|
|
30
|
+
const checkboxQ = zod_1.z.strictObject({
|
|
31
|
+
type: zod_1.z.literal('checkbox'),
|
|
32
|
+
id: idField,
|
|
33
|
+
label: labelField,
|
|
34
|
+
required: requiredField,
|
|
35
|
+
options: zod_1.z
|
|
36
|
+
.array(zod_1.z.string())
|
|
37
|
+
.min(2)
|
|
38
|
+
.max(7)
|
|
39
|
+
.describe('Non-exclusive choices the user can combine. 2–7 items.'),
|
|
40
|
+
maxSelections: zod_1.z
|
|
41
|
+
.number()
|
|
42
|
+
.int()
|
|
43
|
+
.min(1)
|
|
44
|
+
.optional()
|
|
45
|
+
.describe('Optional cap on how many options can be selected at once.'),
|
|
46
|
+
});
|
|
47
|
+
const selectQ = zod_1.z.strictObject({
|
|
48
|
+
type: zod_1.z.literal('select'),
|
|
49
|
+
id: idField,
|
|
50
|
+
label: labelField,
|
|
51
|
+
required: requiredField,
|
|
52
|
+
options: zod_1.z
|
|
53
|
+
.array(zod_1.z.string())
|
|
54
|
+
.min(6)
|
|
55
|
+
.max(10)
|
|
56
|
+
.describe('Dropdown choices. 6–10 items. Last-resort fallback — only use "select" when you truly need 6+ options. For 5 or fewer options, always use "radio".'),
|
|
57
|
+
});
|
|
58
|
+
const textQ = zod_1.z.strictObject({
|
|
59
|
+
type: zod_1.z.literal('text'),
|
|
60
|
+
id: idField,
|
|
61
|
+
label: labelField,
|
|
62
|
+
required: requiredField,
|
|
63
|
+
placeholder: zod_1.z
|
|
64
|
+
.string()
|
|
65
|
+
.optional()
|
|
66
|
+
.describe('Hint text shown inside the empty input.'),
|
|
67
|
+
});
|
|
68
|
+
const textareaQ = zod_1.z.strictObject({
|
|
69
|
+
type: zod_1.z.literal('textarea'),
|
|
70
|
+
id: idField,
|
|
71
|
+
label: labelField,
|
|
72
|
+
required: requiredField,
|
|
73
|
+
placeholder: zod_1.z.string().optional(),
|
|
74
|
+
});
|
|
75
|
+
const questionSchema = zod_1.z.discriminatedUnion('type', [
|
|
76
|
+
radioQ,
|
|
77
|
+
checkboxQ,
|
|
78
|
+
selectQ,
|
|
79
|
+
textQ,
|
|
80
|
+
textareaQ,
|
|
81
|
+
]);
|
|
82
|
+
const toolParams = zod_1.z.strictObject({
|
|
83
|
+
questions: zod_1.z
|
|
84
|
+
.array(questionSchema)
|
|
85
|
+
.min(1)
|
|
86
|
+
.max(7)
|
|
87
|
+
.describe('An array of 1–7 questions to ask the user in a single round. Batch related questions into ONE call instead of issuing multiple pick_option calls back-to-back.'),
|
|
88
|
+
estimatedTime: zod_1.z
|
|
89
|
+
.string()
|
|
90
|
+
.max(20)
|
|
91
|
+
.optional()
|
|
92
|
+
.describe('Short, human-readable estimate of how long answering will take. Rendered in the UI as a quick-confirm hint. Examples: "~30 sec", "about 1 min". Keep it under ~10 characters.'),
|
|
93
|
+
intro: zod_1.z
|
|
94
|
+
.string()
|
|
95
|
+
.max(80)
|
|
96
|
+
.optional()
|
|
97
|
+
.describe('A single short sentence (≤80 chars) that frames the form for the user — what answering these unlocks or what happens next. Example: "Lock these in and I\'ll start building.". Skip if the questions are self-explanatory.'),
|
|
98
|
+
});
|
|
99
|
+
exports.PickOption = {
|
|
100
|
+
name: tool_1.TOOL_NAME_PICK_OPTION,
|
|
101
|
+
description() {
|
|
102
|
+
return `Ask the user one or more questions in a single form. Use this for: getting missing details/preferences, clarifying vague requests, deciding between approaches, or letting the user choose a path forward.
|
|
103
|
+
|
|
104
|
+
Question types:
|
|
105
|
+
- radio : pick exactly one — 2–5 options. Default for any single-choice question.
|
|
106
|
+
- select : pick exactly one from a dropdown — 6–10 options. LAST-RESORT fallback only when you genuinely need 6+ options. Before reaching for it, try to merge similar options or trim niche ones until you fit into radio (≤5).
|
|
107
|
+
- checkbox : pick zero or more; set maxSelections to cap (2–7 options)
|
|
108
|
+
- text : ONE-LINE free-form input. Good for: project names, URLs, numeric counts/estimates, short identifiers. Bad for: anything that fits 2–5 enumerable options.
|
|
109
|
+
- textarea : MULTI-LINE free-form input. Good for: constraints/requirements, references, "anything else I should know" catch-all. Bad for: short answers (use text) or enumerable answers (use radio/checkbox).
|
|
110
|
+
|
|
111
|
+
Choice types FIRST. Free-form is the last resort:
|
|
112
|
+
- Always prefer radio/checkbox/select. Before using text or textarea, ask yourself: "Can I enumerate the 3–5 most likely answers?" If yes, use radio.
|
|
113
|
+
- For single-choice: always prefer radio. Use select ONLY when the question genuinely cannot be answered with 5 or fewer options.
|
|
114
|
+
- AT MOST ONE textarea per form. Multiple textareas drain user attention and the form will be skipped.
|
|
115
|
+
|
|
116
|
+
Response format:
|
|
117
|
+
The user's answers come back as a pre-formatted plain-text list — one line per question, in the form "- <label>: <answer>". A skipped question shows "(skipped)". For checkbox questions, multiple selections are joined with "; " (semicolon + space), e.g. "- Features: Auth; Billing; Notifications".
|
|
118
|
+
|
|
119
|
+
Rules:
|
|
120
|
+
- The 'questions' field is an ARRAY — batch up to 7 related questions into ONE call. Never make multiple TOOL_NAME_PICK_OPTION calls back-to-back.
|
|
121
|
+
- Keep forms tight: do NOT exceed 5 questions unless every one of them is essential.
|
|
122
|
+
- Prefer choice types (radio/checkbox/select) over text/textarea. Only use free-form input when the answer truly cannot be enumerated.
|
|
123
|
+
- To recommend a default, put that option first and append " (Recommended)" to its label.
|
|
124
|
+
- Each question must have a unique 'id' (lowercase snake_case).
|
|
125
|
+
- Do NOT restate UI affordances in the label. The frontend automatically appends type/constraint hints — for example, a checkbox question with maxSelections: 3 is rendered as "<label> (multi-select, max 3)". Writing labels like "Core modules (select multiple, max 3)" produces duplicated hints. Just write the bare question, e.g. "Core modules".
|
|
126
|
+
- Do NOT add an "Other" / "Skip" / "None" option yourself — the UI handles per-question skipping.
|
|
127
|
+
- CRITICAL: Never re-ask a question the user has already answered OR skipped in this session, and never issue a rephrased version of it. Treat answered or skipped questions as final and proceed with reasonable defaults based on existing context.`;
|
|
128
|
+
},
|
|
129
|
+
toolParams,
|
|
130
|
+
isSafe() {
|
|
131
|
+
return true;
|
|
132
|
+
},
|
|
133
|
+
genToolResultMessage(output) {
|
|
134
|
+
const { questions, answers } = output;
|
|
135
|
+
if (answers && answers.trim().length > 0) {
|
|
136
|
+
return {
|
|
137
|
+
title: 'User Response',
|
|
138
|
+
summary: '',
|
|
139
|
+
content: answers,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
title: 'User Cancelled',
|
|
144
|
+
summary: '',
|
|
145
|
+
content: questions.map((q) => `- ${q.label}`).join('\n'),
|
|
146
|
+
};
|
|
147
|
+
},
|
|
148
|
+
async validateInput({ questions }, _agentContext) {
|
|
149
|
+
const ids = new Set();
|
|
150
|
+
let textareaCount = 0;
|
|
151
|
+
for (const q of questions) {
|
|
152
|
+
if (q.label.length > 60) {
|
|
153
|
+
return {
|
|
154
|
+
result: false,
|
|
155
|
+
message: `Label "${q.label}" exceeds maximum length of 60 characters.`,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
if (ids.has(q.id)) {
|
|
159
|
+
return {
|
|
160
|
+
result: false,
|
|
161
|
+
message: `Duplicate question id "${q.id}". Each question must have a unique id.`,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
ids.add(q.id);
|
|
165
|
+
if (q.type === 'textarea') {
|
|
166
|
+
textareaCount++;
|
|
167
|
+
if (textareaCount > 1) {
|
|
168
|
+
return {
|
|
169
|
+
result: false,
|
|
170
|
+
message: `A form may contain at most one "textarea" question. Use "text" for short free-form answers, or merge multi-line questions into a single catch-all.`,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return { result: true };
|
|
176
|
+
},
|
|
177
|
+
async *call(input, agentContext) {
|
|
178
|
+
const eventBus = (0, EventSystem_1.getEventBus)();
|
|
179
|
+
const abortController = agentContext.abortController;
|
|
180
|
+
const requestData = {
|
|
181
|
+
agentId: agentContext.agentId,
|
|
182
|
+
questions: input.questions,
|
|
183
|
+
estimatedTime: input.estimatedTime,
|
|
184
|
+
intro: input.intro,
|
|
185
|
+
};
|
|
186
|
+
eventBus.emit('pick:option:request', requestData);
|
|
187
|
+
const answers = await new Promise((resolve, reject) => {
|
|
188
|
+
const handleResponse = (response) => {
|
|
189
|
+
if (response.agentId !== agentContext.agentId)
|
|
190
|
+
return;
|
|
191
|
+
eventBus.off('pick:option:response', handleResponse);
|
|
192
|
+
resolve(response.answers);
|
|
193
|
+
};
|
|
194
|
+
const onAbortRequested = () => {
|
|
195
|
+
eventBus.off('pick:option:response', handleResponse);
|
|
196
|
+
reject(new Error('User cancelled the question'));
|
|
197
|
+
};
|
|
198
|
+
if (abortController?.signal) {
|
|
199
|
+
abortController.signal.addEventListener('abort', onAbortRequested, {
|
|
200
|
+
once: true,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
eventBus.on('pick:option:response', handleResponse);
|
|
204
|
+
});
|
|
205
|
+
(0, errors_1.checkAbortSignal)(abortController);
|
|
206
|
+
const data = {
|
|
207
|
+
questions: input.questions,
|
|
208
|
+
estimatedTime: input.estimatedTime,
|
|
209
|
+
intro: input.intro,
|
|
210
|
+
answers,
|
|
211
|
+
};
|
|
212
|
+
yield {
|
|
213
|
+
type: 'result',
|
|
214
|
+
data,
|
|
215
|
+
resultForAssistant: this.genResultForAssistant(data),
|
|
216
|
+
};
|
|
217
|
+
},
|
|
218
|
+
genResultForAssistant(output) {
|
|
219
|
+
const { answers } = output;
|
|
220
|
+
if (answers && answers.trim().length > 0) {
|
|
221
|
+
return `The user responded:\n${answers}`;
|
|
222
|
+
}
|
|
223
|
+
return `The user cancelled the form without submitting any answers. Proceed with reasonable defaults based on existing context.`;
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
//# sourceMappingURL=PickOption.js.map
|