732
}
733
734
>
function createGenericDescription(shellType: string, isSandboxEnabled: boolean, networkDomains?: ITerminalSandboxResolvedNetworkDomains): string {
copilotShellTools.ts
735
>
const parts = [`
736
>
Command Execution:
737
>
- Use && to chain simple commands on one line
738
>
- Prefer pipelines | over temporary files for data flow
739
>
- Never create a sub-shell (eg. bash -c "command") unless explicitly asked
740
>
741
>
Directory Management:
742
>
- Prefer relative paths when navigating directories, only use absolute when the path is far away or the current cwd is not expected
743
>
- By default (mode=sync), shell and cwd are reused by subsequent sync commands
744
>
- Use $PWD for current directory references
745
>
- Consider using pushd/popd for directory stack management
746
>
- Supports directory shortcuts like ~ and -
747
>
748
>
Program Execution:
749
>
- Supports Python, Node.js, and other executables
750
>
- Install packages via package managers (brew, apt, etc.)
751
>
- Use which or command -v to verify command availability
752
>
753
>
Async Mode:
754
>
- For long-running tasks (e.g., servers), use mode=async
755
>
- Returns a terminal ID for checking status and runtime later
756
>
757
>
Use write_${shellType} to send commands or input to a terminal session.`];
758
>
759
>
if (isSandboxEnabled) {
760
parts.push(createSandboxLines(networkDomains).join('\n'));
761
}
763
>
parts.push(`
764
>
765
>
Output Management:
766
>
- Output is automatically truncated if longer than 60KB to prevent context overflow
767
>
- Use head, tail, grep, awk to filter and limit output size
768
>
- For pager commands, disable paging: git --no-pager or add | cat
769
>
- Use wc -l to count lines before displaying large outputs
770
>
771
>
Best Practices:
772
>
- Quote variables: "$var" instead of $var to handle spaces
773
>
- Use find with -exec or xargs for file operations
774
>
- Be specific with commands to avoid excessive output
775
>
- Avoid printing credentials unless absolutely required
776
>
- NEVER run sleep or similar wait commands in a terminal. You will be automatically notified on your next turn when async terminal commands or timed-out sync commands complete or need input. Do NOT poll for completion.
777
>
778
>
Interactive Input Handling:
779
>
- When a terminal command is waiting for interactive input, do NOT suggest alternatives or ask the user whether to proceed. Instead, use the ask_user tool to collect the needed values from the user, then send them.
780
>
- Send exactly one answer per prompt using write_${shellType}. Never send multiple answers in a single send.
781
>
- After each send, call read_${shellType} to read the next prompt before sending the next answer.
782
>
- Continue one prompt at a time until the command finishes.`);
783
>
784
>
return parts.join('');
785
>
}
786
787
function createBashModelDescription(isSandboxEnabled: boolean, networkDomains?: ITerminalSandboxResolvedNetworkDomains): string {