{"id":99232,"date":"2026-09-02T07:25:40","date_gmt":"2026-09-01T23:25:40","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/99232.html"},"modified":"2026-09-02T07:25:40","modified_gmt":"2026-09-01T23:25:40","slug":"201%e3%80%81%e3%80%90agent%e3%80%91%e3%80%90opencode%e3%80%91js-%e8%af%ad%e6%b3%95%ef%bc%9asettimeout-%e4%b8%83%e7%a7%8d%e5%b8%b8%e7%94%a8%e5%bd%a2%e5%bc%8f","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/99232.html","title":{"rendered":"201\u3001\u3010Agent\u3011\u3010OpenCode\u3011JS \u8bed\u6cd5\uff1asetTimeout \u4e03\u79cd\u5e38\u7528\u5f62\u5f0f"},"content":{"rendered":"<p>\u3010\u58f0\u660e\u3011\u672c\u535a\u5ba2\u6240\u6709\u5185\u5bb9\u5747\u4e3a\u4e2a\u4eba\u4e1a\u4f59\u65f6\u95f4\u521b\u4f5c&#xff0c;\u6240\u8ff0\u6280\u672f\u6848\u4f8b\u5747\u6765\u81ea\u516c\u5f00\u5f00\u6e90\u9879\u76ee&#xff08;\u5982Github&#xff0c;Apache\u57fa\u91d1\u4f1a&#xff09;&#xff0c;\u4e0d\u6d89\u53ca\u4efb\u4f55\u4f01\u4e1a\u673a\u5bc6\u6216\u672a\u516c\u5f00\u6280\u672f&#xff0c;\u5982\u6709\u4fb5\u6743\u8bf7\u8054\u7cfb\u5220\u9664<\/p>\n<h2>\u6807\u9898<\/h2>\n<p>201\u3001\u3010Agent\u3011\u3010OpenCode\u3011JS \u8bed\u6cd5&#xff1a;setTimeout \u4e03\u79cd\u5e38\u7528\u5f62\u5f0f<\/p>\n<h2>\u80cc\u666f<\/h2>\n<p>\u4e0a\u7bc7 blog \u3010Agent\u3011\u3010OpenCode\u3011TuiThreadCommand handler&#xff1a;checkUpgrade \u7684\u5ef6\u8fdf\u4e0e unref \u62c6\u4e86 thread.ts:197-199 \u90a3\u884c\u5ef6\u8fdf\u5347\u7ea7\u68c0\u6d4b\u7684\u56db\u4e2a\u7ec6\u8282&#xff1a;setTimeout \u662f\u8fd0\u884c\u65f6\u5168\u5c40\u5185\u7f6e\u5b9a\u65f6\u5668&#xff08;\u8fd4\u56de\u5e26 unref \u7684 Timeout \u5bf9\u8c61&#xff09;&#xff1b;\u56de\u8c03\u5199\u6210\u65e0\u53c2\u7bad\u5934\u51fd\u6570\u3001\u9760\u95ed\u5305\u6355\u83b7 client\/cwd&#xff1b;client.call(&#034;checkUpgrade&#034;) \u662f TUI \u53d1\u5f80 worker \u7684 RPC \u8bf7\u6c42&#xff08;\u5931\u8d25 .catch \u9759\u9ed8&#xff09;&#xff1b;unref \u8ba9\u5b9a\u65f6\u5668\u4e0d\u963b\u6321\u8fdb\u7a0b\u9000\u51fa\u3001?. \u9632\u5fa1&#034;\u8fd4\u56de\u5bf9\u8c61\u6ca1\u6709 unref&#034;\u7684\u73af\u5883\u3002200 \u91cc setTimeout \u7684\u56de\u8c03\u7528\u4e86&#034;\u5185\u8054\u7bad\u5934 &#043; \u95ed\u5305&#034;\u8fd9\u4e00\u79cd\u5f62\u5f0f&#xff0c;\u4f46 setTimeout \u7684\u5199\u6cd5\u8fdc\u4e0d\u6b62\u8fd9\u4e00\u79cd\u2014\u2014\u672c\u7bc7\u5f00\u542f\u65b0\u7cfb\u5217 \u201cJS \u8bed\u6cd5\u201d&#xff08;\u901a\u7528 JS \u8bed\u6cd5\u70b9\u7edf\u4e00\u5f52\u5165&#xff09;&#xff0c;\u5148\u76d8\u70b9 setTimeout \u7684\u4e03\u79cd\u5e38\u7528\u5f62\u5f0f<\/p>\n<h2>OpenCode<\/h2>\n<p>200 \u7bc7\u90a3\u884c\u4ee3\u7801\u957f\u8fd9\u6837&#xff1a;<\/p>\n<p><span class=\"token function\">setTimeout<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#061;&gt;<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token function\">client<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">call<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;checkUpgrade&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">{<\/span> directory<span class=\"token operator\">:<\/span> cwd <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">1000<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>\u8fd9\u7528\u7684\u662f&#034;\u5185\u8054\u7bad\u5934 &#043; \u95ed\u5305&#034;\u3002\u4f46 setTimeout(fn, delay, &#8230;args) \u7684\u5b8c\u6574\u7b7e\u540d\u91cc&#xff0c;\u7b2c\u4e00\u4e2a\u53c2\u6570\u53ef\u4ee5\u4f20\u7bad\u5934\u51fd\u6570\u3001\u53ef\u4ee5\u4f20\u51fd\u6570\u5f15\u7528&#xff0c;delay \u4e4b\u540e\u8fd8\u80fd\u5e26\u53c2\u6570\u3002\u4e03\u79cd\u5f62\u5f0f\u5148\u4e00\u5e76\u5217\u51fa&#xff1a;<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260901232539-6a975ef3c21c6.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<hr \/>\n<p>&#x1f9e9; \u4e03\u79cd\u5f62\u5f0f\u4e00\u89c8<\/p>\n<p><span class=\"token comment\">\/\/ \u2460 \u5185\u8054\u7bad\u5934 &#043; \u95ed\u5305\u6355\u83b7&#xff08;\u6700\u5e38\u89c1&#xff0c;opencode \u7528\u6cd5&#xff09;<\/span><br \/>\n<span class=\"token function\">setTimeout<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#061;&gt;<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token function\">client<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">call<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;checkUpgrade&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">{<\/span> directory<span class=\"token operator\">:<\/span> cwd <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">1000<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u2461 \u51fd\u6570\u5f15\u7528 &#043; \u7b2c\u4e09\u53c2\u6570\u4f20\u503c&#xff08;\u53c2\u6570\u6ce8\u518c\u65f6\u56fa\u5316&#xff09;<\/span><br \/>\n<span class=\"token function\">setTimeout<\/span><span class=\"token punctuation\">(<\/span><span class=\"token builtin\">console<\/span><span class=\"token punctuation\">.<\/span>log<span class=\"token punctuation\">,<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">,<\/span> i<span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u2462 \u51fd\u6570\u5f15\u7528&#xff08;\u65e0\u53c2&#xff09;\u2014\u2014\u4f20\u540d\u5b57\u4e0d\u52a0\u62ec\u53f7<\/span><br \/>\n<span class=\"token function\">setTimeout<\/span><span class=\"token punctuation\">(<\/span>doSomething<span class=\"token punctuation\">,<\/span> <span class=\"token number\">1000<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u2463 \u5b57\u7b26\u4e32&#xff08;\u5df2\u5f03\u7528&#xff0c;eval \u98ce\u9669&#xff09;<\/span><br \/>\n<span class=\"token function\">setTimeout<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;console.log(&#039;hi&#039;)&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">1000<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u2464 \u9012\u5f52\u4ee3\u66ff setInterval&#xff08;\u4efb\u52a1\u7ed3\u675f\u518d\u6392\u4e0b\u4e00\u4e2a&#xff0c;\u9632\u5806\u79ef&#xff09;<\/span><br \/>\n<span class=\"token keyword\">function<\/span> <span class=\"token function\">tick<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token comment\">\/* &#8230; *\/<\/span> <span class=\"token function\">setTimeout<\/span><span class=\"token punctuation\">(<\/span>tick<span class=\"token punctuation\">,<\/span> <span class=\"token number\">1000<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u2465 \u5ef6\u8fdf 0 \u6392\u961f&#xff08;\u4e0b\u4e00\u6b21\u5b8f\u4efb\u52a1&#xff09;<\/span><br \/>\n<span class=\"token function\">setTimeout<\/span><span class=\"token punctuation\">(<\/span>fn<span class=\"token punctuation\">,<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u2466 \u751f\u547d\u5468\u671f\u7ba1\u7406&#xff08;\u53d6\u6d88 \/ \u4e0d\u963b\u6321\u9000\u51fa&#xff09;<\/span><br \/>\n<span class=\"token keyword\">const<\/span> t <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">setTimeout<\/span><span class=\"token punctuation\">(<\/span>fn<span class=\"token punctuation\">,<\/span> <span class=\"token number\">1000<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token function\">clearTimeout<\/span><span class=\"token punctuation\">(<\/span>t<span class=\"token punctuation\">)<\/span><br \/>\nt<span class=\"token punctuation\">.<\/span><span class=\"token function\">unref<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<hr \/>\n<p>&#x1f9e9; \u9010\u4e2a\u62c6\u89e3<\/p>\n<p>\u5f62\u5f0f\u2460 \u5185\u8054\u7bad\u5934 &#043; \u95ed\u5305&#xff1a;\u7bad\u5934\u51fd\u6570\u5185\u8054\u5b9a\u4e49&#xff0c;\u8981\u7528\u7684\u53d8\u91cf&#xff08;client\/cwd&#xff09;\u4ece\u5916\u5c42\u95ed\u5305\u6355\u83b7\u3002\u8fd9\u662f opencode \u91cc\u7684\u5199\u6cd5&#xff0c;\u4e5f\u662f\u65e5\u5e38\u6700\u5e38\u89c1\u3002<\/p>\n<p>\u5f62\u5f0f\u2461 \u51fd\u6570\u5f15\u7528 &#043; \u7b2c\u4e09\u53c2\u6570&#xff1a;setTimeout(console.log, 0, i) \u7b2c\u4e00\u53c2\u6570\u4f20 console.log \u8fd9\u4e2a\u51fd\u6570\u5f15\u7528&#xff08;\u6ca1\u6709\u62ec\u53f7&#xff09;&#xff0c;\u7b2c\u4e09\u53c2\u6570 i \u5728\u5b9a\u65f6\u5668\u89e6\u53d1\u65f6\u4f5c\u4e3a\u5b9e\u53c2\u4f20\u7ed9\u56de\u8c03&#xff0c;\u5728\u6ce8\u518c\u90a3\u4e00\u523b\u88ab\u56fa\u5316&#xff08;\u5feb\u7167&#xff09;\u3002\u7b49\u4ef7\u4e8e setTimeout((&#8230;args) &#061;&gt; console.log(&#8230;args), 0, i)\u3002<\/p>\n<p>\u5f62\u5f0f\u2462 \u51fd\u6570\u5f15\u7528&#xff08;\u65e0\u53c2&#xff09;&#xff1a;setTimeout(doSomething, 1000) \u4f20\u51fd\u6570\u540d\u5b57&#xff08;\u4e0d\u52a0\u62ec\u53f7&#xff09;\u3002\u6ce8\u610f\u4e0e setTimeout(doSomething(), 1000) \u7684\u533a\u522b\u2014\u2014\u540e\u8005\u662f\u7acb\u5373\u8c03\u7528\u5e76\u4f20\u8fd4\u56de\u503c&#xff0c;\u51e0\u4e4e\u603b\u662f bug\u3002<\/p>\n<p>\u5f62\u5f0f\u2463 \u5b57\u7b26\u4e32&#xff08;\u5f03\u7528&#xff09;&#xff1a;\u65e9\u671f\u5141\u8bb8\u4f20\u5b57\u7b26\u4e32&#xff0c;\u5185\u90e8 eval \u6267\u884c&#xff0c;\u6709\u5b89\u5168\u4e0e\u6027\u80fd\u95ee\u9898&#xff0c;\u73b0\u4ee3\u4ee3\u7801\u4e0d\u5e94\u4f7f\u7528&#xff0c;\u4e86\u89e3\u5373\u53ef\u3002<\/p>\n<p>\u5f62\u5f0f\u2464 \u9012\u5f52\u4ee3\u66ff setInterval&#xff1a;setInterval \u56fa\u5b9a\u95f4\u9694\u53ef\u80fd\u5728\u524d\u4e00\u6b21\u4efb\u52a1\u6ca1\u8dd1\u5b8c\u65f6\u5c31\u89e6\u53d1&#xff08;\u5806\u79ef&#xff09;&#xff1b;\u9012\u5f52\u7248\u6bcf\u6b21\u4efb\u52a1\u7ed3\u675f\u540e\u624d\u6392\u4e0b\u4e00\u4e2a&#xff0c;\u5929\u7136\u9632\u5806\u79ef\u3001\u53ef\u63a7\u3002<\/p>\n<p>\u5f62\u5f0f\u2465 \u5ef6\u8fdf 0 \u6392\u961f&#xff1a;setTimeout(fn, 0) \u4e0d\u662f\u7acb\u523b\u6267\u884c&#xff0c;\u800c\u662f\u628a fn \u6392\u5230\u5f53\u524d\u4efb\u52a1\u6808\u6e05\u7a7a\u540e\u7684\u4e0b\u4e00\u6b21\u5b8f\u4efb\u52a1&#xff0c;\u7528\u4e8e&#034;\u5148\u8ba9\u5f53\u524d\u4ee3\u7801\u8dd1\u5b8c&#xff0c;\u518d\u5f02\u6b65\u8865\u9f50&#034;\u3002<\/p>\n<p>\u5f62\u5f0f\u2466 \u751f\u547d\u5468\u671f\u7ba1\u7406&#xff1a;setTimeout \u8fd4\u56de\u5b9a\u65f6\u5668\u5bf9\u8c61\u2014\u2014clearTimeout \u53d6\u6d88&#xff1b;unref \u628a\u5b83\u6807\u8bb0\u4e3a\u6b21\u8981\u4efb\u52a1&#xff0c;\u4e8b\u4ef6\u5faa\u73af\u6ca1\u6709\u522b\u7684\u4e8b\u65f6\u8fdb\u7a0b\u53ef\u76f4\u63a5\u9000\u51fa&#xff08;Node\/Bun&#xff09;\u3002<\/p>\n<hr \/>\n<p>&#x1f4ca; \u4e03\u79cd\u5f62\u5f0f\u5bf9\u7167<\/p>\n<table>\n<tr>\u5f62\u5f0f\u5199\u6cd5\u6570\u636e\u6ce8\u5165\u9002\u7528<\/tr>\n<tbody>\n<tr>\n<td align=\"left\">\u2460 \u5185\u8054\u7bad\u5934 &#043; \u95ed\u5305<\/td>\n<td align=\"left\">setTimeout(() &#061;&gt; fn(), d)<\/td>\n<td align=\"left\">\u95ed\u5305&#xff08;\u5b9e\u65f6\u5f15\u7528&#xff09;<\/td>\n<td align=\"left\">\u6700\u5e38\u89c1&#xff0c;\u4f5c\u7528\u57df\u5185\u53d6\u503c<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">\u2461 \u51fd\u6570\u5f15\u7528 &#043; \u7b2c\u4e09\u53c2\u6570<\/td>\n<td align=\"left\">setTimeout(fn, d, arg)<\/td>\n<td align=\"left\">\u53c2\u6570&#xff08;\u6ce8\u518c\u65f6\u5feb\u7167&#xff09;<\/td>\n<td align=\"left\">\u590d\u7528\u51fd\u6570\u3001\u8981\u5feb\u7167\u503c<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">\u2462 \u51fd\u6570\u5f15\u7528&#xff08;\u65e0\u53c2&#xff09;<\/td>\n<td align=\"left\">setTimeout(fn, d)<\/td>\n<td align=\"left\">\u65e0<\/td>\n<td align=\"left\">\u56de\u8c03\u81ea\u8db3\u3001\u65e0\u53c2<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">\u2463 \u5b57\u7b26\u4e32<\/td>\n<td align=\"left\">setTimeout(&#034;code&#034;, d)<\/td>\n<td align=\"left\">\u65e0<\/td>\n<td align=\"left\">\u5f03\u7528&#xff08;eval \u98ce\u9669&#xff09;<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">\u2464 \u9012\u5f52\u4ee3\u66ff interval<\/td>\n<td align=\"left\">function t(){&#8230;;setTimeout(t,d)}<\/td>\n<td align=\"left\">\u95ed\u5305<\/td>\n<td align=\"left\">\u9632\u4efb\u52a1\u5806\u79ef<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">\u2465 \u5ef6\u8fdf 0<\/td>\n<td align=\"left\">setTimeout(fn, 0)<\/td>\n<td align=\"left\">\u95ed\u5305<\/td>\n<td align=\"left\">\u4e0b\u4e00\u6b21\u5b8f\u4efb\u52a1\u6392\u961f<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">\u2466 \u751f\u547d\u5468\u671f<\/td>\n<td align=\"left\">t&#061;setTimeout(&#8230;);clearTimeout(t);t.unref()<\/td>\n<td align=\"left\">\u2014<\/td>\n<td align=\"left\">\u53d6\u6d88 \/ \u4e0d\u6321\u9000\u51fa<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6700\u5bb9\u6613\u8e29\u7684\u5751&#xff1a;setTimeout(fn, 0)&#xff08;\u4f20\u5f15\u7528&#xff09;vs setTimeout(fn(), 0)&#xff08;\u7acb\u5373\u8c03\u7528&#xff0c;\u4f20\u8fd4\u56de\u503c&#xff09;\u2014\u2014\u540e\u8005\u51e0\u4e4e\u603b\u662f\u9519\u8bef\u3002<\/p>\n<hr \/>\n<p>&#x1f4cc; \u4e00\u53e5\u8bdd\u8bb0\u5fc6<\/p>\n<p>setTimeout \u4e03\u79cd\u5f62\u5f0f\u672c\u8d28\u662f\u4e09\u4e2a\u81ea\u7531\u5ea6\u7684\u7ec4\u5408&#xff1a;\u56de\u8c03\u600e\u4e48\u5199&#xff08;\u7bad\u5934\u5185\u8054 \/ \u51fd\u6570\u5f15\u7528 \/ \u9012\u5f52&#xff09;\u3001\u6570\u636e\u600e\u4e48\u7ed9&#xff08;\u95ed\u5305\u6355\u83b7 \/ \u7b2c\u4e09\u53c2\u6570\u5feb\u7167 \/ \u4e0d\u5582&#xff09;\u3001\u751f\u547d\u5468\u671f\u600e\u4e48\u7ba1&#xff08;clearTimeout \/ unref \/ \u5ef6\u8fdf 0 \u6392\u961f&#xff09;\u3002200 \u7bc7\u7528\u7684\u662f&#034;\u2460\u7bad\u5934&#043;\u95ed\u5305&#034;&#xff0c;\u4e0b\u4e00\u7bc7\u8bb2\u5b83\u7684\u5bf9\u7acb\u9762&#034;\u2461\u51fd\u6570\u5f15\u7528&#043;\u53c2\u6570&#034;\u5230\u5e95\u4f55\u65f6\u7528\u3002<\/p>\n<hr \/>\n<p>OK&#xff0c;\u672c\u7bc7\u5148\u5230\u8fd9\u91cc&#xff0c;\u5982\u6709\u7591\u95ee&#xff0c;\u6b22\u8fce\u8bc4\u8bba\u533a\u7559\u8a00\u8ba8\u8bba&#xff0c;\u795d\u5404\u4f4d\u529f\u529b\u5927\u6da8&#xff0c;\u6280\u672f\u66f4\u4e0a\u4e00\u5c42\u697c&#xff01;&#xff01;&#xff01;\u66f4\u591a\u5185\u5bb9\u89c1\u4e0b\u7bc7 blog \u3010Agent\u3011\u3010OpenCode\u3011JS \u8bed\u6cd5&#xff1a;\u95ed\u5305\u6355\u83b7\u8fd8\u662f\u53c2\u6570\u4f20\u9012<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3010\u58f0\u660e\u3011\u672c\u535a\u5ba2\u6240\u6709\u5185\u5bb9\u5747\u4e3a\u4e2a\u4eba\u4e1a\u4f59\u65f6\u95f4\u521b\u4f5c&#xff0c;\u6240\u8ff0\u6280\u672f\u6848\u4f8b\u5747\u6765\u81ea\u516c\u5f00\u5f00\u6e90\u9879\u76ee&#xff08;\u5982Github&#xff0c;Apache\u57fa\u91d1\u4f1a&#xff09;&#xff0c;\u4e0d\u6d89\u53ca\u4efb\u4f55\u4f01\u4e1a\u673a\u5bc6\u6216\u672a\u516c\u5f00\u6280\u672f&#xff0c;\u5982\u6709\u4fb5\u6743\u8bf7\u8054\u7cfb\u5220\u9664 \u6807\u9898<br \/>\n201\u3001\u3010Agent\u3011\u3010OpenCode\u3011JS \u8bed\u6cd5&#xff1a;setTimeout \u4e03\u79cd\u5e38\u7528\u5f62\u5f0f<br \/>\n\u80cc\u666f<br \/>\n\u4e0a\u7bc7 blog \u3010Agent\u3011\u3010OpenCode\u3011TuiThreadCommand handler&amp;#xff<\/p>\n","protected":false},"author":2,"featured_media":99231,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[7616,74,50],"topic":[],"class_list":["post-99232","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-opencode","tag-agent","tag-50"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>201\u3001\u3010Agent\u3011\u3010OpenCode\u3011JS \u8bed\u6cd5\uff1asetTimeout \u4e03\u79cd\u5e38\u7528\u5f62\u5f0f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/99232.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"201\u3001\u3010Agent\u3011\u3010OpenCode\u3011JS \u8bed\u6cd5\uff1asetTimeout \u4e03\u79cd\u5e38\u7528\u5f62\u5f0f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u3010\u58f0\u660e\u3011\u672c\u535a\u5ba2\u6240\u6709\u5185\u5bb9\u5747\u4e3a\u4e2a\u4eba\u4e1a\u4f59\u65f6\u95f4\u521b\u4f5c&#xff0c;\u6240\u8ff0\u6280\u672f\u6848\u4f8b\u5747\u6765\u81ea\u516c\u5f00\u5f00\u6e90\u9879\u76ee&#xff08;\u5982Github&#xff0c;Apache\u57fa\u91d1\u4f1a&#xff09;&#xff0c;\u4e0d\u6d89\u53ca\u4efb\u4f55\u4f01\u4e1a\u673a\u5bc6\u6216\u672a\u516c\u5f00\u6280\u672f&#xff0c;\u5982\u6709\u4fb5\u6743\u8bf7\u8054\u7cfb\u5220\u9664 \u6807\u9898 201\u3001\u3010Agent\u3011\u3010OpenCode\u3011JS \u8bed\u6cd5&#xff1a;setTimeout \u4e03\u79cd\u5e38\u7528\u5f62\u5f0f \u80cc\u666f \u4e0a\u7bc7 blog \u3010Agent\u3011\u3010OpenCode\u3011TuiThreadCommand handler&amp;#xff\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/99232.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-01T23:25:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260901232539-6a975ef3c21c6.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/99232.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/99232.html\",\"name\":\"201\u3001\u3010Agent\u3011\u3010OpenCode\u3011JS \u8bed\u6cd5\uff1asetTimeout \u4e03\u79cd\u5e38\u7528\u5f62\u5f0f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-01T23:25:40+00:00\",\"dateModified\":\"2026-09-01T23:25:40+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/99232.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/99232.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/99232.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"201\u3001\u3010Agent\u3011\u3010OpenCode\u3011JS \u8bed\u6cd5\uff1asetTimeout \u4e03\u79cd\u5e38\u7528\u5f62\u5f0f\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"201\u3001\u3010Agent\u3011\u3010OpenCode\u3011JS \u8bed\u6cd5\uff1asetTimeout \u4e03\u79cd\u5e38\u7528\u5f62\u5f0f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/99232.html","og_locale":"zh_CN","og_type":"article","og_title":"201\u3001\u3010Agent\u3011\u3010OpenCode\u3011JS \u8bed\u6cd5\uff1asetTimeout \u4e03\u79cd\u5e38\u7528\u5f62\u5f0f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u3010\u58f0\u660e\u3011\u672c\u535a\u5ba2\u6240\u6709\u5185\u5bb9\u5747\u4e3a\u4e2a\u4eba\u4e1a\u4f59\u65f6\u95f4\u521b\u4f5c&#xff0c;\u6240\u8ff0\u6280\u672f\u6848\u4f8b\u5747\u6765\u81ea\u516c\u5f00\u5f00\u6e90\u9879\u76ee&#xff08;\u5982Github&#xff0c;Apache\u57fa\u91d1\u4f1a&#xff09;&#xff0c;\u4e0d\u6d89\u53ca\u4efb\u4f55\u4f01\u4e1a\u673a\u5bc6\u6216\u672a\u516c\u5f00\u6280\u672f&#xff0c;\u5982\u6709\u4fb5\u6743\u8bf7\u8054\u7cfb\u5220\u9664 \u6807\u9898 201\u3001\u3010Agent\u3011\u3010OpenCode\u3011JS \u8bed\u6cd5&#xff1a;setTimeout \u4e03\u79cd\u5e38\u7528\u5f62\u5f0f \u80cc\u666f \u4e0a\u7bc7 blog \u3010Agent\u3011\u3010OpenCode\u3011TuiThreadCommand handler&amp;#xff","og_url":"https:\/\/www.wsisp.com\/helps\/99232.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-01T23:25:40+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260901232539-6a975ef3c21c6.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/99232.html","url":"https:\/\/www.wsisp.com\/helps\/99232.html","name":"201\u3001\u3010Agent\u3011\u3010OpenCode\u3011JS \u8bed\u6cd5\uff1asetTimeout \u4e03\u79cd\u5e38\u7528\u5f62\u5f0f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-01T23:25:40+00:00","dateModified":"2026-09-01T23:25:40+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/99232.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/99232.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/99232.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"201\u3001\u3010Agent\u3011\u3010OpenCode\u3011JS \u8bed\u6cd5\uff1asetTimeout \u4e03\u79cd\u5e38\u7528\u5f62\u5f0f"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/99232","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=99232"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/99232\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/99231"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=99232"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=99232"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=99232"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=99232"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}