Copilot Continue

2025/5/16 13:00:33

当前为 2025-06-05 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Copilot Continue
  3. // @namespace https://snomiao.com
  4. // @match *://*/*
  5. // @grant none
  6. // @version 1.0
  7. // @author -
  8. // @description 2025/5/16 13:00:33
  9. // ==/UserScript==
  10.  
  11. // webhook...update = fetch(globalThis.GM_info.script.downloadURL)
  12.  
  13. const enable = !!document.querySelector("meta#vscode-workbench-auth-session");
  14.  
  15. if (enable) main()
  16.  
  17. function main() {
  18. const clear = useInterval(() => clickContinue, 1e3);
  19. return () => clear();
  20. }
  21.  
  22. function clickContinue() {
  23. const stucked = $$("div.rendered-markdown")
  24. .map((e) => e.innerText)
  25. .flatMap((e) => (e ? [e] : [])) // empty filter
  26. .findLast(
  27. (s) =>
  28. false ||
  29. s.match(/Copilot has been working on this problem for a while/) ||
  30. s.match(/Run command in the terminal/) ||
  31. s.match(/Allow task run\?/)
  32. );
  33. if (!stucked) return;
  34. const btn = $$("a.monaco-button").findLast(
  35. (e) => e.textContent === "Continue"
  36. );
  37. if (!btn) return;
  38. btn.click();
  39. return true;
  40. }
  41.  
  42. function $$(sel) {
  43. return [...document.querySelectorAll(sel)];
  44. }
  45.  
  46. function useInterval(...args) {
  47. const id = setInterval(...args);
  48. return () => clearInterval(id);
  49. }