Skip to main content

Don't know what to do while your agents work? The VS Code team has an answer. 不知道在代理工作时该做什么?VS Code 团队给出了答案。

Agents write most of my code these days. That leaves me with this question: what do I do with all this free time?如今,我的大部分代码都是由代理编写的。这让我产生了一个疑问:我该如何打发这些多出来的空闲时间?

I considered learning a new framework, but that sounds suspiciously like work. Luckily, the VS Code team has a better idea. They gave me something to take care of.我曾考虑学习一个新框架,但那听起来太像是在工作了。幸运的是,VS Code 团队有个更好的主意。他们给了我一个需要照顾的小家伙。

What is the VS Code pet?什么是 VS Code 宠物?

The pet is an interactive character that sits above the chat input box. It reacts to chat activity and to whatever you do to it.宠物是一个交互式角色,位于聊天输入框上方。它会对聊天活动以及你对它采取的任何操作做出反应。

So while the agent works, the pet watches. Before, I was the only one staring at the progress indicator while pretending to supervise. Now I have company.所以,当代理工作时,宠物就在一旁看着。以前,只有我一个人盯着进度条,假装在监督工作。现在我有伴了。


Remark: The pet is marked as experimental, so it might change or be removed. Don't get too attached. (I got attached within five minutes.)备注:该宠物被标记为实验性功能,因此可能会发生变化或被移除。别投入太多感情。(我五分钟内就陷进去了。)

Adopting your pet领养你的宠物

Type /vscode-pet in the chat input to show or hide it.在聊天输入框中输入 /vscode-pet 即可显示或隐藏它。

In the new-session view of the Agents window, you can also right-click outside the input box and select Pet (/vscode-pet).在代理窗口的新会话视图中,你也可以在输入框外右键点击,然后选择“宠物 (/vscode-pet)”。

Show or hide. That's the entire commitment. As far as I can tell, there is no feeding schedule, no vet, and no 3 AM walks. Compared to my Kubernetes cluster, it's remarkably low maintenance.显示或隐藏,这就是全部的承诺。据我所知,它不需要定时喂食、不需要看兽医,也不用在凌晨三点带它散步。与我的 Kubernetes 集群相比,它的维护成本低得惊人。

Spending quality time共度美好时光

My calendar is suddenly wide open, so let's see what we can do together:我的日程表突然空了出来,让我们看看能一起做些什么:

  • Select it to trigger a reaction. With the keyboard, press Tab to focus it, then Enter or Space. Yes, the pet is accessible. Your accessibility audit will be thrilled. 选中它可以触发反应。使用键盘时,按 Tab 键聚焦,然后按 Enter 或 Space 键。没错,宠物支持无障碍访问。你的无障碍审计人员会为此感到高兴的。
  • Drag it around the chat and drop it wherever you like. It's like rearranging the furniture, except the furniture has opinions. 在聊天界面中拖动它,并将其放置在你喜欢的任何位置。这就像重新摆放家具,只不过这些家具是有主见的。
  • Flick it to throw it. Don't worry, the pet comes back. 轻弹它即可将其扔出。别担心,宠物会回来的。
  • Hop it with the Left and Right arrow keys while it has focus. 在聚焦状态下,使用左箭头和右箭头键让它跳跃。
  • Throw it at a wall by holding Shift with an arrow key. 按住 Shift 键的同时按下箭头键,可以将它扔向墙壁。

That last one is officially documented. I'm not sure what it says about the creators, but I hope they are feeling well. 最后这一项是官方记录在案的。我不确定这说明了创作者什么,但我希望他们感觉良好。

Right-click the pet (or press Shift+F10 when it has focus) and you get a context menu where you can:右键点击宠物(或在聚焦时按 Shift+F10),会出现一个上下文菜单,你可以从中进行以下操作:

  • view its achievements 查看它的成就
  • send it on the run 让它跑起来
  • resize it 调整它的大小
  • switch between Stable and Insiders colors 在 Stable 和 Insiders 配色之间切换

Achievements are the interesting part. For the first time, there is a way to measure how well I'm doing as a pet owner. Finally, a metric I can bring to my next performance review. "Delivered 14 microservices" doesn't land like "Unlocked all pet achievements."成就是最有趣的部分。这是我第一次有办法衡量自己作为宠物主人的表现如何。终于,我可以在下一次绩效评估中带上这个指标了。“交付了 14 个微服务”听起来可没有“解锁了所有宠物成就”那么有分量。

One pet, many sessions一只宠物,多个会话

Only one pet appears at a time in the active chat surface. Its position and size are shared across chats and windows, and they persist after you restart VS Code.在活动的聊天界面中,一次只会显示一只宠物。它的位置和大小在不同聊天和窗口间共享,并且在重启 VS Code 后依然保持不变。

So, the pet remembers where you left it. That's more than I can say for most of my agents, who forget everything the moment the context window fills up. 😁所以,宠物会记得你把它留在了哪里。这一点比我的大多数代理强多了,它们在上下文窗口填满的那一刻就会忘掉一切。😁

Remark: VS Code supports running multiple agent sessions in parallel. Parallel pets are not supported. I think the priorities are clear.备注:VS Code 支持并行运行多个代理会话。但不支持并行显示多只宠物。我想优先级很明确。

So, what now?那么,现在做什么?

Does this mean I should spend my newly found free time playing with a pet in my editor? Probably not.这是否意味着我应该把我新发现的空闲时间花在编辑器里玩宠物上?大概不是。

But right now, my agent is refactoring a legacy module, my pet is hopping around, and I'm drinking coffee. One of us is being productive, and I have a strong suspicion it's not me.但就在此刻,我的代理正在重构一个遗留模块,我的宠物在跳来跳去,而我正在喝咖啡。我们之中有一个人在高效工作,但我强烈怀疑那个人不是我。

That's it. Back to work. Or at least back to the pet.就这样。回去工作吧。或者至少,回去陪宠物。

More information更多信息

Popular posts from this blog

Podman– Command execution failed with exit code 125

After updating WSL on one of the developer machines, Podman failed to work. When we took a look through Podman Desktop, we noticed that Podman had stopped running and returned the following error message: Error: Command execution failed with exit code 125 Here are the steps we tried to fix the issue: We started by running podman info to get some extra details on what could be wrong: >podman info OS: windows/amd64 provider: wsl version: 5.3.1 Cannot connect to Podman. Please verify your connection to the Linux system using `podman system connection list`, or try `podman machine init` and `podman machine start` to manage a new Linux VM Error: unable to connect to Podman socket: failed to connect: dial tcp 127.0.0.1:2655: connectex: No connection could be made because the target machine actively refused it. That makes sense as the podman VM was not running. Let’s check the VM: >podman machine list NAME         ...

Cache stampede: when our cache turned against us

While investigating some performance issues, we ran into an ASP.NET Core API that cached a fairly expensive aggregation query for 60 seconds. Under normal load, that was fine: one request rebuilds the cache, everyone else reads from it. Under peak load, dozens of requests would arrive in that same expiry window, all see a cache miss, and all fire the same expensive query in parallel. The database didn't like that. That was the moment when our caching layer stopped helping and started hurting. A burst of requests comes in at the same time, all miss the cache, and all go hammer the database or the downstream API at once. That's a cache stampede . The cache was supposed to protect our backend, and for a few hundred milliseconds it did the opposite. Why this happens IMemoryCache.GetOrCreate (and its async sibling) looks like it protects you, but it doesn't add any locking on its own. Look at the naive version: public async Task<Report> GetReportAsync(string key) ...

VS Code Planning mode

After the introduction of Plan mode in Visual Studio , it now also found its way into VS Code. Planning mode, or as I like to call it 'Hannibal mode', extends GitHub Copilot's Agent Mode capabilities to handle larger, multi-step coding tasks with a structured approach. Instead of jumping straight into code generation, Planning mode creates a detailed execution plan. If you want more details, have a look at my previous post . Putting plan mode into action VS Code takes a different approach compared to Visual Studio when using plan mode. Instead of a configuration setting that you can activate but have limited control over, planning is available as a separate chat mode/agent: I like this approach better than how Visual Studio does it as you have explicit control when plan mode is activated. Instead of immediately diving into execution, the plan agent creates a plan and asks some follow up questions: You can further edit the plan by clicking on ‘Open in Editor’: ...