Motivation
The current ai command in the Puter shell can only respond with text-based answers to user queries. However, when users ask the AI to perform actions like "create a directory named test" or "list all files", the AI can only describe what command to run rather than actually executing it. This creates friction in the user experience, requiring users to manually copy and execute the suggested commands.
By enabling the ai command to recognize and execute shell commands directly, we can create a more seamless and powerful interface where users can interact with their system using natural language. This bridges the gap between conversational AI and system automation, making the shell more accessible to users who may not remember exact command syntax.
Current Behavior
The ai command currently only outputs text responses from the AI model. When a user asks the AI to perform an action that requires a shell command, the AI can only respond with a textual description or suggestion, but cannot actually execute the command.
Reproduction Steps:
- Open the Puter shell terminal. (If you don't see the terminal app, go to the App center and search)
- Run the command:
ai "create a directory named test"
- Observe: The AI responds with text explaining how to create a directory or suggesting the command, but does not actually create the directory
- Run
ls to verify that no directory was created
- Expected: The directory should have been created automatically
- Actual: Only a text response is provided, no directory exists
Expected Behavior
The ai command should be able to detect when the AI response contains a shell command that should be executed, extract that command, prompt the user for confirmation, and execute it if confirmed. The AI should be instructed via system prompts to wrap executable commands in a special marker format that can be parsed and extracted.
Acceptance Criteria:
Verification
Manual Testing:
- Run
ai create a directory named mytest in the Puter shell
- Verify that the AI responds with a message and a command wrapped in markers
- Verify that you are prompted:
Execute command: 'mkdir mytest' (y/n):
- Type
y and press Enter
- Verify that the command executes and the directory is created
- Run
ls to confirm the mytest directory exists
- Run
ai what is the weather like (a non-command query)
- Verify that the AI responds with text only, no command execution prompt
- Run
ai list all files and type n when prompted
- Verify that the command is cancelled and not executed
Testing Edge Cases:
- Test with various command types (mkdir, ls, cat, etc.)
- Test declining command execution to ensure cancellation works
- Test queries that don't require commands to ensure normal behavior is preserved
- Verify error handling when a command fails to execute
Submission
Download https://cap.so/ to record your screen (use Studio mode). Export as an mp4, and drag and drop into an issue comment below.
Guide to submitting pull requests: https://hackmd.io/@timothy1ee/Hky8kV3hlx
Motivation
The current
aicommand in the Puter shell can only respond with text-based answers to user queries. However, when users ask the AI to perform actions like "create a directory named test" or "list all files", the AI can only describe what command to run rather than actually executing it. This creates friction in the user experience, requiring users to manually copy and execute the suggested commands.By enabling the
aicommand to recognize and execute shell commands directly, we can create a more seamless and powerful interface where users can interact with their system using natural language. This bridges the gap between conversational AI and system automation, making the shell more accessible to users who may not remember exact command syntax.Current Behavior
The
aicommand currently only outputs text responses from the AI model. When a user asks the AI to perform an action that requires a shell command, the AI can only respond with a textual description or suggestion, but cannot actually execute the command.Reproduction Steps:
ai "create a directory named test"lsto verify that no directory was createdExpected Behavior
The
aicommand should be able to detect when the AI response contains a shell command that should be executed, extract that command, prompt the user for confirmation, and execute it if confirmed. The AI should be instructed via system prompts to wrap executable commands in a special marker format that can be parsed and extracted.Acceptance Criteria:
%%%command%%%)aicommand parses AI responses to detect and extract wrapped commands using pattern matchingVerification
Manual Testing:
ai create a directory named mytestin the Puter shellExecute command: 'mkdir mytest' (y/n):yand press Enterlsto confirm themytestdirectory existsai what is the weather like(a non-command query)ai list all filesand typenwhen promptedTesting Edge Cases:
Submission
Download https://cap.so/ to record your screen (use Studio mode). Export as an mp4, and drag and drop into an issue comment below.
Guide to submitting pull requests: https://hackmd.io/@timothy1ee/Hky8kV3hlx