{"id":101411,"date":"2026-09-06T20:40:52","date_gmt":"2026-09-06T12:40:52","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/101411.html"},"modified":"2026-09-06T20:40:52","modified_gmt":"2026-09-06T12:40:52","slug":"deepseek-harness%ef%bc%88dsh%ef%bc%89%e6%ba%90%e7%a0%81%e7%b2%be%e8%af%bb-01%ef%bc%9adsh-%e6%98%af%e4%bb%80%e4%b9%88%ef%bc%8c%e4%bb%a5%e5%8f%8a%e5%ae%83%e5%87%ad%e4%bb%80%e4%b9%88%e3%80%8c%e4%b8%80","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/101411.html","title":{"rendered":"DeepSeek Harness\uff08DSH\uff09\u6e90\u7801\u7cbe\u8bfb 01\uff1aDSH \u662f\u4ec0\u4e48\uff0c\u4ee5\u53ca\u5b83\u51ed\u4ec0\u4e48\u300c\u4e00\u5207\u7686\u63d2\u4ef6\u300d"},"content":{"rendered":"<h2>DeepSeek Harness&#xff08;DSH&#xff09;\u6e90\u7801\u7cbe\u8bfb 01&#xff1a;DSH \u662f\u4ec0\u4e48&#xff0c;\u4ee5\u53ca\u5b83\u51ed\u4ec0\u4e48\u300c\u4e00\u5207\u7686\u63d2\u4ef6\u300d<\/h2>\n<p>\u672c\u6587\u662f\u300aDeepSeek Harness \u6e90\u7801\u7cbe\u8bfb\u300b\u7cfb\u5217\u7b2c 1 \u7bc7&#xff08;\u5171 9 \u7bc7&#xff09;\u3002<br \/>\n\u8bfb\u7684\u662f deepseek-harness&#xff08;DSH&#xff09;\u5b98\u65b9\u4ed3\u5e93\u6e90\u7801&#xff0c;\u542b vendored \u7684 Cordis \u6846\u67b6&#xff1b;\u6587\u4e2d\u8def\u5f84\u3001\u6807\u8bc6\u7b26\u4e0e\u884c\u53f7\u90fd\u53d6\u81ea\u5b9e\u9645\u6e90\u7801&#xff0c;\u53ef\u4ee5\u8fb9\u8bfb\u8fb9\u8df3\u8f6c\u3002<br \/>\n\u524d\u7f6e\u9605\u8bfb&#xff1a;\u65e0&#xff08;\u7cfb\u5217\u5f00\u7bc7&#xff0c;\u5efa\u8bae\u4ece\u8fd9\u91cc\u8bfb&#xff09;\u3002<\/p>\n<h3>\u672c\u7bc7\u5bfc\u8bfb<\/h3>\n<p>\u4ece\u300c\u6ca1\u6709\u7279\u6743\u5185\u6838\u300d\u8bb2\u8d77&#xff1a;DSH \u7684\u76ee\u5f55\u5730\u56fe\u3001\u4e00\u6761\u7528\u6237\u6d88\u606f\u8d70\u8fc7\u7684 15 \u6b65&#xff0c;\u4ee5\u53ca\u628a\u5b83\u6491\u8d77\u6765\u7684 Cordis \u6846\u67b6\u2014\u2014Context \u662f\u4e2a Proxy\u3001Service \u6784\u9020\u5373\u6ce8\u518c\u3001Fiber \u751f\u547d\u5468\u671f\u4e0e epoch \u9a71\u52a8\u7684\u81ea\u52a8\u91cd\u542f\u3001\u4e94\u79cd\u4e8b\u4ef6\u6d3e\u53d1\u3001\u53ef\u9006\u7684 effect \u6ce8\u518c\u3002<\/p>\n<p>\u672c\u7bc7\u7531\u539f\u7a3f\u7684\u4e24\u7ae0\u5408\u5e76\u800c\u6210&#xff1a;\u300a\u5168\u666f\u4e0e\u8bbe\u8ba1\u54f2\u5b66\u300b &#043; \u300aCordis \u63d2\u4ef6\u6846\u67b6\u300b\u3002\u4e24\u7ae0\u662f\u540c\u4e00\u6761\u7ebf\u7d22\u7684\u4e24\u6bb5&#xff0c;\u6240\u4ee5\u653e\u5728\u4e00\u8d77\u8bfb\u66f4\u987a\u3002<\/p>\n<h3>\u672c\u7cfb\u5217\u76ee\u5f55<\/h3>\n<table>\n<tr>\u7bc7\u4e3b\u9898\u8986\u76d6\u7684\u539f\u7a3f\u7ae0\u8282<\/tr>\n<tbody>\n<tr>\n<td>\u7b2c 1 \u7bc7<\/td>\n<td>DSH \u662f\u4ec0\u4e48&#xff0c;\u4ee5\u53ca\u5b83\u51ed\u4ec0\u4e48\u300c\u4e00\u5207\u7686\u63d2\u4ef6\u300d<\/td>\n<td>\u5168\u666f\u4e0e\u8bbe\u8ba1\u54f2\u5b66 &#043; Cordis \u63d2\u4ef6\u6846\u67b6<\/td>\n<\/tr>\n<tr>\n<td>\u7b2c 2 \u7bc7<\/td>\n<td>Agent \u5faa\u73af\u7684\u5fc3\u810f&#xff1a;turn\/step\u3001Inbox \u4e0e 18 \u884c preStep<\/td>\n<td>Agent \u5faa\u73af\u4e0e\u4e0a\u4e0b\u6587\u88c5\u914d<\/td>\n<\/tr>\n<tr>\n<td>\u7b2c 3 \u7bc7<\/td>\n<td>\u4e8b\u4ef6\u6eaf\u6e90\u65e5\u5fd7\u3001\u6a21\u578b\u53ef\u89c1\u9762\u4e0e JSONL \u7248\u672c\u8fc1\u79fb<\/td>\n<td>\u4f1a\u8bdd\u65e5\u5fd7\u4e0e\u6301\u4e45\u5316<\/td>\n<\/tr>\n<tr>\n<td>\u7b2c 4 \u7bc7<\/td>\n<td>\u5de5\u5177\u6267\u884c\u6d41\u6c34\u7ebf\u4e0e\u80fd\u529b\u7f1d&#xff1a;\u4e00\u6b21 write \u8d70\u8fc7\u7684 13 \u4e2a\u5173\u5361<\/td>\n<td>\u5de5\u5177\u7cfb\u7edf\u4e0e\u80fd\u529b\u7f1d<\/td>\n<\/tr>\n<tr>\n<td>\u7b2c 5 \u7bc7<\/td>\n<td>\u538b\u7f29\u3001token \u8ba1\u91cf\u3001\u7ed3\u679c\u6ea2\u51fa\u4e0e\u52a8\u6001\u4e0a\u4e0b\u6587\u5feb\u7167<\/td>\n<td>\u4e0a\u4e0b\u6587\u5de5\u7a0b<\/td>\n<\/tr>\n<tr>\n<td>\u7b2c 6 \u7bc7<\/td>\n<td>\u591a\u667a\u80fd\u4f53\u7f16\u6392&#xff08;subagent\/workflow\/goal&#xff09;\u4e0e\u56db\u4e2a\u72ec\u7acb\u6743\u9650\u65cb\u94ae<\/td>\n<td>\u7f16\u6392\u4e0e\u591a\u667a\u80fd\u4f53 &#043; \u5b89\u5168\u3001\u5ba1\u6279\u4e0e\u4ea4\u4e92<\/td>\n<\/tr>\n<tr>\n<td>\u7b2c 7 \u7bc7<\/td>\n<td>profile\/bundle \u7ec4\u5408\u3001Web GUI \u4f20\u8f93\u4e0e LLM \u4f1a\u8bdd\u8bcd\u6c47\u8868<\/td>\n<td>\u5e94\u7528\u5916\u58f3\u4e0e\u4f20\u8f93\u5c42 &#043; LLM \u63a5\u5165\u5c42<\/td>\n<\/tr>\n<tr>\n<td>\u7b2c 8 \u7bc7<\/td>\n<td>48 \u4e2a verify \u95e8\u7981\u3001\u65e0 key \u5f55\u5236\u91cd\u653e\u4e0e\u9632\u5fa1\u6027\u7f16\u7a0b\u89c4\u77e9<\/td>\n<td>\u5de5\u7a0b\u5316\u57fa\u5efa<\/td>\n<\/tr>\n<tr>\n<td>\u7b2c 9 \u7bc7<\/td>\n<td>\u6309\u76ee\u6807\u67e5\u6587\u4ef6\u7684\u5730\u56fe\u3001\u4e09\u4e2a\u52a8\u624b\u5b9e\u9a8c\u4e0e\u8e29\u5751\u6e05\u5355<\/td>\n<td>\u6e90\u7801\u5730\u56fe\u4e0e\u5b66\u4e60\u8def\u7ebf<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u7b2c\u4e00\u90e8\u5206 \u00b7 \u300a\u5168\u666f\u4e0e\u8bbe\u8ba1\u54f2\u5b66\u300b&#xff08;\u539f\u7a3f\u7b2c 01 \u7ae0&#xff09;<\/h2>\n<p>\u76ee\u6807&#xff1a;\u8bfb\u5b8c\u8fd9\u4e00\u7bc7&#xff0c;\u4f60\u80fd\u56de\u7b54\u4e09\u4e2a\u95ee\u9898\u2014\u2014DSH \u5230\u5e95\u662f\u4e2a\u4ec0\u4e48\u4e1c\u897f&#xff1f;\u4ee3\u7801\u653e\u5728\u54ea\u513f&#xff1f;\u4e00\u6761\u7528\u6237\u6d88\u606f\u8fdb\u6765\u4e4b\u540e&#xff0c;\u7cfb\u7edf\u91cc\u5230\u5e95\u53d1\u751f\u4e86\u4ec0\u4e48&#xff1f;<\/p>\n<hr \/>\n<h3>1. \u5b83\u662f\u4ec0\u4e48<\/h3>\n<p>dsh&#xff08;DeepSeek Harness&#xff09;\u662f\u4e00\u4e2a agent \u8fd0\u884c\u65f6&#xff08;agent harness&#xff09;\u3002<\/p>\n<p>\u5982\u679c\u628a&#034;\u7528\u4e00\u4e2a LLM \u81ea\u52a8\u5199\u4ee3\u7801\/\u67e5\u8d44\u6599\/\u8dd1\u547d\u4ee4&#034;\u8fd9\u4ef6\u4e8b\u62c6\u5f00&#xff0c;\u4f60\u4f1a\u5f97\u5230\u4e00\u5806\u5fc5\u987b\u89e3\u51b3\u7684\u5de5\u7a0b\u95ee\u9898&#xff1a;<\/p>\n<ul>\n<li>\u6a21\u578b\u7684\u4e0a\u4e0b\u6587&#xff08;\u90a3\u4e00\u5768 token&#xff09;\u4ece\u54ea\u513f\u6765\u3001\u653e\u5230\u54ea\u513f\u53bb&#xff1f;<\/li>\n<li>\u6a21\u578b\u8bf4&#034;\u6211\u8981\u6267\u884c rm -rf&#034;&#xff0c;\u8c01\u6279\u51c6&#xff1f;\u5728\u4ec0\u4e48\u7ea6\u675f\u4e0b\u6267\u884c&#xff1f;<\/li>\n<li>\u804a\u4e86 200 \u8f6e\u4e4b\u540e\u4e0a\u4e0b\u6587\u7206\u4e86&#xff0c;\u600e\u4e48\u538b\u7f29&#xff1f;<\/li>\n<li>\u8fdb\u7a0b\u5d29\u5728\u6a21\u578b\u56de\u590d\u7684\u4e00\u534a&#xff0c;\u91cd\u542f\u540e\u600e\u4e48\u63a5\u5f97\u4e0a&#xff1f;<\/li>\n<li>\u4e00\u4e2a\u6a21\u578b\u4e0d\u591f&#xff0c;\u80fd\u4e0d\u80fd\u6d3e\u5b50\u667a\u80fd\u4f53\u5e76\u884c\u5e72\u6d3b&#xff1f;<\/li>\n<li>\u60f3\u6362\u4e2a\u6a21\u578b\u3001\u6362\u4e2a\u6c99\u7bb1\u3001\u6362\u4e2a\u5b58\u50a8\u540e\u7aef&#xff0c;\u8981\u6539\u591a\u5c11\u4ee3\u7801&#xff1f;<\/li>\n<\/ul>\n<p>DSH \u628a\u8fd9\u4e9b\u95ee\u9898\u7684\u7b54\u6848\u5168\u90e8\u5b9e\u73b0\u6210\u63d2\u4ef6&#xff0c;\u800c\u4e0d\u662f\u5199\u6b7b\u5728\u4e00\u4e2a&#034;\u4e3b\u7a0b\u5e8f&#034;\u91cc\u3002\u5b83\u7684\u53e3\u53f7\u5f0f\u7684\u67b6\u6784\u63cf\u8ff0\u662f&#xff1a;<\/p>\n<p>\u4ea7\u54c1\u7684\u6bcf\u4e00\u90e8\u5206\u90fd\u662f\u63d2\u4ef6&#xff0c;\u5305\u62ec\u6a21\u578b\u9002\u914d\u5668\u3001\u5de5\u5177\u6ce8\u518c\u8868\u3001\u4f1a\u8bdd\u65e5\u5fd7&#xff0c;\u4ee5\u53ca agent loop \u672c\u8eab&#xff0c;\u56e0\u6b64\u6bcf\u4e2a\u90fd\u53ef\u4ee5\u4ece\u914d\u7f6e\u66ff\u6362\u3002<br \/>\n\u4e0d\u5b58\u5728\u9700\u8981\u6253\u8865\u4e01\u7684\u7279\u6743\u5185\u6838\u3002<br \/>\n\u2014\u2014 &lt;repo&gt;\/docs\/architecture.zh.md<\/p>\n<p>\u8fd9\u53e5\u8bdd\u662f\u7406\u89e3\u6574\u4e2a\u4ed3\u5e93\u7684\u94a5\u5319\u3002\u4f60\u770b\u4e0d\u5230 src\/main.ts \u91cc\u6709\u4e00\u4e2a&#034;agent \u7c7b&#034;\u5728\u8dd1\u5faa\u73af&#xff1b;\u4f60\u770b\u5230\u7684\u662f&#xff1a;\u4e00\u4e2a\u5faa\u73af\u63d2\u4ef6\u3001\u4e00\u4e2a\u65e5\u5fd7\u63d2\u4ef6\u3001\u4e00\u4e2a\u5de5\u5177\u6ce8\u518c\u8868\u63d2\u4ef6\u3001\u4e00\u4e2a\u6a21\u578b\u9002\u914d\u63d2\u4ef6\u2026\u2026\u5b83\u4eec\u4e92\u76f8\u901a\u8fc7&#034;\u670d\u52a1\u952e&#034;\u548c&#034;\u7c7b\u578b\u5316\u4e8b\u4ef6&#034;\u5bf9\u8bdd&#xff0c;\u7531\u4e00\u4e2a\u66f4\u5e95\u5c42\u7684\u6846\u67b6&#xff08;Cordis&#xff09;\u5728\u542f\u52a8\u65f6\u7ec4\u88c5\u6210\u4e00\u68f5\u6811\u3002<\/p>\n<p>\u7c7b\u6bd4&#xff1a;\u4f20\u7edf agent \u6846\u67b6\u50cf\u4e00\u8f86\u710a\u6b7b\u7684\u6c7d\u8f66&#xff0c;\u4f60\u80fd\u6539\u7684\u53ea\u662f\u5185\u9970&#xff1b;DSH \u66f4\u50cf\u6e2f\u53e3\u2014\u2014\u540a\u673a&#xff08;\u5de5\u5177&#xff09;\u3001\u8239&#xff08;\u6a21\u578b&#xff09;\u3001\u5806\u573a&#xff08;\u65e5\u5fd7&#xff09;\u3001\u6d77\u5173&#xff08;\u6c99\u7bb1\u4e0e\u5ba1\u6279&#xff09;\u662f\u5404\u81ea\u72ec\u7acb\u7684\u8bbe\u5907&#xff0c;\u901a\u8fc7\u6807\u51c6\u63a5\u53e3&#xff08;\u670d\u52a1\u952e &#043; \u4e8b\u4ef6&#xff09;\u534f\u4f5c&#xff0c;\u6362\u6389\u4efb\u4f55\u4e00\u53f0\u90fd\u4e0d\u7528\u91cd\u65b0\u8bbe\u8ba1\u6e2f\u53e3\u3002<\/p>\n<hr \/>\n<h3>2. \u76ee\u5f55\u5730\u56fe<\/h3>\n<p>&lt;repo&gt;\/<br \/>\n\u251c\u2500\u2500 AGENTS.md              \u7ed9 AI \u770b\u7684&#034;\u5382\u89c4&#034;&#xff08;\u4e5f\u7ed9\u4eba\u770b\u7684\u6700\u4f73\u5165\u95e8\u8bfb\u7269&#xff09;<br \/>\n\u251c\u2500\u2500 docs\/                  \u5b98\u65b9\u6587\u6863&#xff1a;\u67b6\u6784\u3001\u672f\u8bed\u3001\u5b50\u7cfb\u7edf\u53c2\u8003\u3001\u751f\u6210\u76ee\u5f55<br \/>\n\u2502   \u251c\u2500\u2500 architecture.zh.md         \u2605 \u67b6\u6784\u603b\u7eb2&#xff08;\u4e2d\u6587\u7248&#xff09;<br \/>\n\u2502   \u251c\u2500\u2500 cordis-primer.zh.md        \u2605 Cordis \u6846\u67b6\u4e94\u4e2a\u6982\u5ff5<br \/>\n\u2502   \u251c\u2500\u2500 subsystems\/*.zh.md         \u2605 \u6bcf\u4e2a\u5b50\u7cfb\u7edf\u4e00\u9875\u53c2\u8003&#xff08;\u7c7b\u578b\u5b9a\u4e49\u5728\u8fd9\u91cc&#xff09;<br \/>\n\u2502   \u251c\u2500\u2500 tool-catalog.md            \u81ea\u52a8\u751f\u6210\u7684\u5168\u90e8\u6a21\u578b\u53ef\u89c1\u5de5\u5177<br \/>\n\u2502   \u251c\u2500\u2500 config-catalog.md          \u81ea\u52a8\u751f\u6210\u7684\u5168\u90e8\u63d2\u4ef6 Config \u5b57\u6bb5<br \/>\n\u2502   \u2514\u2500\u2500 persistence-catalog.md     \u81ea\u52a8\u751f\u6210\u7684\u5168\u90e8\u4f1a\u8bdd\u4e8b\u4ef6<br \/>\n\u251c\u2500\u2500 vendor\/                \u5185\u8054\u7684\u4e0a\u6e38\u6846\u67b6\u6e90\u7801&#xff08;Cordis \u53ca\u5176\u4f9d\u8d56&#xff09;<br \/>\n\u2502   \u2514\u2500\u2500 cordis\/src\/        \u2605 \u6846\u67b6\u672c\u4f53&#xff1a;context \/ fiber \/ service \/ events<br \/>\n\u251c\u2500\u2500 packages\/              \u2605 \u4e3b\u4f53&#xff1a;80&#043; \u4e2a npm \u5305&#xff0c;\u6309&#034;\u80fd\u529b\u5bb6\u65cf&#034;\u5206\u7ec4<br \/>\n\u2502   \u251c\u2500\u2500 core\/              session \/ system-prompt \/ tools \/ agent \/ agent-loop \/ scope<br \/>\n\u2502   \u251c\u2500\u2500 llm\/               \u6a21\u578b\u8bcd\u6c47\u8868 &#043; DeepSeek provider &#043; \u91cd\u8bd5 &#043; token \u8ba1\u91cf<br \/>\n\u2502   \u251c\u2500\u2500 fs\/ shell\/ subprocess\/ terminal\/ sandbox\/ lsp\/ web\/ code-runtime\/<br \/>\n\u2502   \u251c\u2500\u2500 subagent\/ workflow\/ jobs\/ goal\/ plan\/ todo\/ guard\/ skill\/<br \/>\n\u2502   \u251c\u2500\u2500 session\/ settings\/ credentials\/ storage\/ workspace\/ context\/ compaction\/<br \/>\n\u2502   \u251c\u2500\u2500 interaction\/ hooks\/ mcp\/ preset\/ bundle\/ boot\/ sdk\/ api\/ typert\/ acp\/<br \/>\n\u2502   \u2514\u2500\u2500 client\/ host\/      Web GUI \u7684\u6d4f\u89c8\u5668\u534a\u533a\u4e0e\u540e\u7aef\u534a\u533a<br \/>\n\u251c\u2500\u2500 apps\/<br \/>\n\u2502   \u251c\u2500\u2500 cli\/               &#096;dsh&#096; \u547d\u4ee4\u884c\u5165\u53e3&#xff08;\u552f\u4e00\u53d7\u652f\u6301\u7684\u542f\u52a8\u65b9\u5f0f&#xff09;<br \/>\n\u2502   \u2514\u2500\u2500 web\/               Vite \u524d\u7aef\u58f3&#xff08;\u6d4f\u89c8\u5668\u91cc\u7684 GUI&#xff09;<br \/>\n\u251c\u2500\u2500 python\/                Python SDK &#043; \u6253\u5305\u6210\u5355\u6587\u4ef6 exe \u7684\u8fd0\u884c\u65f6<br \/>\n\u251c\u2500\u2500 native\/                landlock-run&#xff08;Linux Landlock \u542f\u52a8\u5668&#xff0c;C11&#xff09;<br \/>\n\u251c\u2500\u2500 scripts\/               \u2605 48 \u4e2a\u95e8\u7981\u811a\u672c&#xff08;verify-*&#xff09;&#043; 14 \u4e2a\u751f\u6210\u5668&#xff08;gen-*&#xff09;<br \/>\n\u251c\u2500\u2500 snapshots\/             \u5f55\u5236-\u91cd\u653e\u6d4b\u8bd5\u7684\u4f1a\u8bdd\u6837\u672c<br \/>\n\u2514\u2500\u2500 .agents\/               \u7ed9 agent \u7528\u7684 skill \u4e0e&#034;\u51b3\u7b56\u8bb0\u5f55&#034;&#xff08;Agent Note&#xff09;<\/p>\n<p>\u4e09\u6761\u7ecf\u9a8c\u89c4\u5f8b&#xff0c;\u5e2e\u4f60\u5feb\u901f\u5b9a\u4f4d\u4ee3\u7801&#xff1a;<\/p>\n<li>\u60f3\u77e5\u9053\u67d0\u4e2a\u80fd\u529b\u7684\u63a5\u53e3\u957f\u4ec0\u4e48\u6837 \u2192 \u53bb docs\/subsystems\/&lt;\u540d\u5b57&gt;.zh.md&#xff08;\u90a3\u91cc\u662f\u7c7b\u578b\u5b9a\u4e49\u7684\u6743\u5a01&#xff09;&#xff0c;\u6216\u76f4\u63a5\u641c packages\/&lt;\u7ec4&gt;\/&lt;\u5305&gt;\/src\/types.ts\u3002<\/li>\n<li>\u60f3\u77e5\u9053\u67d0\u4e2a\u884c\u4e3a\u4e3a\u4ec0\u4e48\u8fd9\u6837\u8bbe\u8ba1 \u2192 \u641c .agents\/notes\/&#xff0c;\u4ed3\u5e93\u8981\u6c42&#034;\u975e\u5e73\u51e1\u6539\u52a8\u5fc5\u987b\u9644\u51b3\u7b56\u8bb0\u5f55&#034;\u3002<\/li>\n<li>\u60f3\u77e5\u9053\u6a21\u578b\u80fd\u770b\u5230\u54ea\u4e9b\u5de5\u5177\u3001\u6709\u54ea\u4e9b\u4e8b\u4ef6\u3001\u6709\u54ea\u4e9b\u914d\u7f6e \u2192 \u770b docs\/ \u4e0b\u4e09\u4e2a\u81ea\u52a8\u751f\u6210\u7684\u76ee\u5f55\u6587\u4ef6&#xff0c;\u5b83\u4eec\u7531 scripts\/gen-*.ts \u4ece\u6e90\u7801\u626b\u63cf\u751f\u6210&#xff0c;\u5e76\u4e14\u6709\u95e8\u7981\u4fdd\u8bc1\u4e0d\u8150\u5316\u3002<\/li>\n<p>packages\/ \u4e0b\u7684\u7ec4\u522b\u6e05\u5355\u89c1 &lt;repo&gt;\/packages\/README.md&#xff08;\u4e00\u53e5\u8bdd\u804c\u8d23\u8868\u683c&#xff0c;\u503c\u5f97\u901a\u8bfb&#xff09;\u3002<\/p>\n<hr \/>\n<h3>3. \u4e00\u6b21\u771f\u5b9e\u8bf7\u6c42&#xff1a;\u4ece\u4e0a\u5230\u4e0b\u8d70\u4e00\u904d<\/h3>\n<p>\u5047\u8bbe\u4f60\u5728\u6d4f\u89c8\u5668\u91cc\u8f93\u5165&#034;\u8bfb\u4e00\u4e0b README.md \u7684\u7b2c\u4e00\u884c&#xff0c;\u5e76\u544a\u8bc9\u6211\u5b83\u8bf4\u4e86\u4ec0\u4e48&#034;\u3002\u4e0b\u9762\u662f\u8fd9\u6761\u6d88\u606f\u5728 DSH \u5185\u90e8\u7684\u5b8c\u6574\u65c5\u7a0b&#xff08;\u62ec\u53f7\u91cc\u662f\u8d1f\u8d23\u8fd9\u4ef6\u4e8b\u7684\u5305&#xff09;&#xff1a;<\/p>\n<table>\n<tr>#\u53d1\u751f\u4e86\u4ec0\u4e48\u4ee3\u7801\u4f4d\u7f6e<\/tr>\n<tbody>\n<tr>\n<td>1<\/td>\n<td>\u6d4f\u89c8\u5668\u628a\u8f93\u5165\u901a\u8fc7 HTTP\/WebSocket \u53d1\u7ed9\u672c\u673a host \u8fdb\u7a0b<\/td>\n<td>packages\/host\/\u3001apps\/web\/<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>host \u4fa7\u628a\u5b83\u53d8\u6210\u4e00\u4e2a Agent.followup() \u8c03\u7528&#xff0c;\u6d88\u606f\u8fdb\u5165\u6301\u4e45\u5316\u6536\u4ef6\u7bb1<\/td>\n<td>packages\/core\/agent-loop\/src\/agent.ts<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>\u9a71\u52a8\u673a\u5668\u88ab\u5524\u9192&#xff1a;\u72b6\u6001\u4ece idle \u53d8 running&#xff0c;\u8ffd\u52a0 turn\/start \u4e8b\u4ef6<\/td>\n<td>\u540c\u4e0a&#xff08;#run \/ #beginTurn&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>\u8ffd\u52a0 user\/message \u4e8b\u4ef6&#xff0c;\u628a\u6d88\u606f\u53d8\u6210\u6a21\u578b\u5386\u53f2\u7684\u4e00\u90e8\u5206<\/td>\n<td>packages\/core\/session\/<\/td>\n<\/tr>\n<tr>\n<td>5<\/td>\n<td>\u5411\u6240\u6709\u63d2\u4ef6\u6536\u96c6\u7cfb\u7edf\u63d0\u793a\u7247\u6bb5 &#043; \u52a8\u6001\u4e0a\u4e0b\u6587 &#043; \u5de5\u5177 schema&#xff0c;\u8d70\u4e00\u904d system-prompt\/assemble \u7011\u5e03\u4e8b\u4ef6<\/td>\n<td>packages\/core\/system-prompt\/<\/td>\n<\/tr>\n<tr>\n<td>6<\/td>\n<td>\u628a\u6e32\u67d3\u540e\u7684 system\/tools \u4f5c\u4e3a request\/header \u4e8b\u4ef6\u843d\u76d8&#xff08;\u201c\u6a21\u578b\u53ef\u89c1\u5373\u5df2\u8bb0\u5f55\u201d&#xff09;&#xff0c;\u518d\u7528 session.deriveMessages() \u4ece\u65e5\u5fd7\u6295\u5f71\u51fa\u5386\u53f2<\/td>\n<td>packages\/core\/agent-loop\/src\/agent.ts<\/td>\n<\/tr>\n<tr>\n<td>7<\/td>\n<td>\u51bb\u7ed3\u8bf7\u6c42\u5bf9\u8c61&#xff0c;\u4ea4\u7ed9 ctx.llm.stream()&#xff1b;\u91cd\u8bd5\/\u8d85\u65f6\/\u6307\u6807\u4f5c\u4e3a\u73af\u7ed5\u5f0f\u76d1\u542c\u5668\u5c42\u5c42\u5305\u4f4f\u5b83<\/td>\n<td>packages\/llm\/llm\/\u3001packages\/llm\/llm-retry\/<\/td>\n<\/tr>\n<tr>\n<td>8<\/td>\n<td>DeepSeek \u9002\u914d\u5668\u628a\u6d88\u606f\u7ffb\u8bd1\u6210 HTTP &#043; SSE&#xff0c;\u8fb9\u6536\u8fb9\u4ea7\u51fa StreamChunk<\/td>\n<td>packages\/llm\/llm-deepseek\/src\/{serialize,sse,translate}.ts<\/td>\n<\/tr>\n<tr>\n<td>9<\/td>\n<td>\u6bcf\u4e2a chunk \u53d8\u6210\u4e00\u6761\u4e34\u65f6\u7684 agent\/assistant-stream \u4e8b\u4ef6 \u2192 host \u63a8\u7ed9\u6d4f\u89c8\u5668\u6e32\u67d3\u6253\u5b57\u673a\u6548\u679c<\/td>\n<td>packages\/core\/agent-loop\/src\/assistant-stream.ts<\/td>\n<\/tr>\n<tr>\n<td>10<\/td>\n<td>\u6d41\u7ed3\u675f&#xff1a;\u5b8c\u6574\u7684 assistant\/message \u4e8b\u4ef6\u843d\u76d8&#xff08;v2 \u4e8b\u4ef6\u5185\u5d4c\u5e26\u65f6\u95f4\u6233\u7684\u7cbe\u786e\u6d41&#xff09;<\/td>\n<td>packages\/core\/session\/<\/td>\n<\/tr>\n<tr>\n<td>11<\/td>\n<td>\u6a21\u578b\u56de\u590d\u91cc\u542b tool-call: read \u2192 \u8ffd\u52a0 tool\/call \u4e8b\u4ef6&#xff0c;\u6309\u8c03\u7528\u5e8f pre \u2192 execute \u2192 post \u8d70\u5de5\u5177\u6d41\u6c34\u7ebf<\/td>\n<td>packages\/core\/agent-loop\/src\/tool-calls.ts\u3001packages\/core\/tools\/src\/index.ts<\/td>\n<\/tr>\n<tr>\n<td>12<\/td>\n<td>\u6587\u4ef6\u5de5\u5177\u53d7\u6c99\u7bb1\u4e0e&#034;\u8bfb\u540e\u624d\u53ef\u6539&#034;\u7b56\u7565\u7ea6\u675f&#xff0c;\u4ea7\u51fa\u89c4\u8303 JSON \u503c&#xff0c;output.render() \u53d8\u6210\u7ed9\u6a21\u578b\u7684\u6587\u672c<\/td>\n<td>packages\/fs\/tool-fs\/\u3001packages\/fs\/fs-sandbox\/<\/td>\n<\/tr>\n<tr>\n<td>13<\/td>\n<td>tool\/result \u4e8b\u4ef6\u843d\u76d8&#xff0c;UI \u5361\u7247\u7531\u53c2\u6570 &#043; \u7ed3\u679c &#043; presentationMeta \u6e32\u67d3&#xff08;diff \u7b49&#xff09;<\/td>\n<td>packages\/core\/tools\/src\/presentation.ts\u3001packages\/client\/<\/td>\n<\/tr>\n<tr>\n<td>14<\/td>\n<td>\u8fd8\u6709\u5de5\u5177\u6b20\u7740\u7ed3\u679c\u6216\u7ed3\u679c\u91cc\u6709\u7eed\u8dd1\u610f\u56fe \u2192 \u540c\u8f6e\u4e0b\u4e00\u6b65&#xff1b;\u5426\u5219 agent\/turn-stopping \u2192 turn\/end&#xff0c;\u72b6\u6001\u56de idle<\/td>\n<td>packages\/core\/agent-loop\/src\/agent.ts<\/td>\n<\/tr>\n<tr>\n<td>15<\/td>\n<td>\u6bcf\u4e00\u6b65\u4e4b\u524d\u90fd\u4f1a\u505a flush \u68c0\u67e5\u70b9&#xff0c;\u628a\u65e5\u5fd7\u771f\u6b63\u5199\u5230\u78c1\u76d8<\/td>\n<td>packages\/session\/session-checkpoint-policy\/<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u8fd9\u5f20\u8868\u5176\u5b9e\u5c31\u662f\u6574\u4e2a\u4ed3\u5e93\u7684\u76ee\u5f55&#xff1a;\u7b2c 4\/6\/10\/13\/15 \u6b65\u662f&#034;\u65e5\u5fd7\u6d3e&#034;&#xff0c;\u7b2c 5 \u6b65\u662f&#034;\u4e0a\u4e0b\u6587\u6d3e&#034;&#xff0c;\u7b2c 7\/8 \u6b65\u662f&#034;\u6a21\u578b\u6d3e&#034;&#xff0c;\u7b2c 11\/12 \u6b65\u662f&#034;\u5de5\u5177\u4e0e\u80fd\u529b\u6d3e&#034;&#xff0c;\u7b2c 3\/14 \u6b65\u662f&#034;\u5faa\u73af\u6d3e&#034;&#xff0c;\u7b2c 1\/2\/9 \u6b65\u662f&#034;\u5916\u58f3\u4e0e\u4f20\u8f93\u6d3e&#034;\u3002\u540e\u7eed\u5404\u7bc7\u6309\u8fd9\u4e2a\u5212\u5206\u5c55\u5f00\u3002<\/p>\n<h4>3.1 \u4e00\u4e2a\u5173\u952e\u6f84\u6e05&#xff1a;\u65e5\u5fd7\u624d\u662f&#034;\u771f\u76f8&#034;<\/h4>\n<p>\u5f88\u591a\u6846\u67b6\u628a&#034;\u5bf9\u8bdd\u5386\u53f2&#034;\u5b58\u5728\u4e00\u4e2a\u6570\u7ec4\u91cc&#xff0c;\u987a\u624b\u5f80\u91cc push\u3002DSH \u4e0d\u662f\u3002\u5b83\u628a\u4e00\u5207\u90fd\u5199\u6210\u7c7b\u578b\u5316\u4e8b\u4ef6&#xff0c;\u6a21\u578b\u7684\u4e0a\u4e0b\u6587\u662f\u4e8b\u4ef6\u7684\u6295\u5f71&#xff08;projection&#xff09;&#xff1a;<\/p>\n<p>                     \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u78c1\u76d8 JSONL&#xff08;\u6301\u4e45\u5316&#xff09;<br \/>\n\u4ec5\u8ffd\u52a0\u4e8b\u4ef6\u65e5\u5fd7 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n   (source of truth) \u2514\u2500\u2500 surface&#xff08;\u6a21\u578b\u53ef\u89c1\u9762&#xff09;\u2192 deriveMessages() \u2192 \u6a21\u578b\u8bf7\u6c42<br \/>\n                     \u250c\u2500\u2500 \u5404\u79cd projection&#xff1a;turnBoundary \/ permissions \/ title \/ tokenMeter \u2026<br \/>\n                     \u2514\u2500\u2500 session\/event \u5e7f\u64ad \u2192 UI\u3001\u9065\u6d4b\u3001\u6d4b\u8bd5\u91cd\u653e<\/p>\n<p>\u597d\u5904\u662f&#xff1a;\u4efb\u4f55\u65f6\u523b\u4f60\u90fd\u80fd\u4ece\u65e5\u5fd7\u91cd\u5efa\u51fa\u6a21\u578b\u4e0a\u4e00\u8f6e\u5230\u5e95\u770b\u5230\u4e86\u4ec0\u4e48&#xff0c;\u5305\u62ec fork\u3001resume\u3001\u8c03\u8bd5\u3001\u5f55\u5236\u56de\u653e\u3002\u4ee3\u4ef7\u662f\u6240\u6709\u4e1c\u897f\u90fd\u5fc5\u987b\u5148\u8bbe\u8ba1\u6210\u4e8b\u4ef6\u2014\u2014\u4e8e\u662f\u6709\u4e86\u4e0b\u9762\u7b2c\u4e00\u6761\u8bbe\u8ba1\u54f2\u5b66\u3002<\/p>\n<hr \/>\n<h3>4. \u4e09\u6761\u6700\u91cd\u8981\u7684\u8bbe\u8ba1\u51b3\u5b9a<\/h3>\n<h4>\u51b3\u5b9a\u4e00&#xff1a;Model-visible \u27fa logged&#xff08;\u6a21\u578b\u80fd\u770b\u5230\u7684&#xff0c;\u65e5\u5fd7\u91cc\u5fc5\u987b\u6709&#xff09;<\/h4>\n<p>\u8fd9\u6761\u88ab\u5199\u6210\u8fd0\u884c\u65f6\u4e0d\u53d8\u91cf&#xff08;packages\/core\/session\/src\/invariant.ts&#xff09;&#xff0c;\u89c4\u5b9a&#xff1a;<\/p>\n<p>\u4efb\u4f55\u62b5\u8fbe\u6a21\u578b\u8bf7\u6c42\u7684\u5185\u5bb9&#xff0c;\u90fd\u5fc5\u987b\u80fd\u4ece\u4f1a\u8bdd\u65e5\u5fd7\u4e2d\u91cd\u5efa\u3002\u65b0\u589e\u4e00\u9879\u6a21\u578b\u53ef\u89c1\u8f93\u5165&#xff0c;\u5c31\u5fc5\u987b\u65b0\u589e\u4e00\u4e2a\u4f1a\u8bdd\u4e8b\u4ef6\u3002<\/p>\n<p>\u5177\u4f53\u8868\u73b0&#xff1a;<\/p>\n<ul>\n<li>\u5de5\u5177\u7684 additionalContexts \u5fc5\u987b\u5305\u88c5\u6210 user\/message \u4e8b\u4ef6&#xff0c;\u4e0d\u80fd\u585e\u8fdb\u5de5\u5177\u7ed3\u679c\u5185\u90e8&#xff08;packages\/core\/tools\/src\/index.ts&#xff09;\u3002<\/li>\n<li>\u52a8\u6001\u8fd0\u884c\u65f6\u4e0a\u4e0b\u6587&#xff08;\u65f6\u95f4\u3001\u6c99\u7bb1\u6a21\u5f0f\u3001\u5de5\u4f5c\u533a\u6307\u4ee4&#xff09;\u88ab\u6295\u5f71\u6210 user-role \u7684\u5feb\u7167\u6d88\u606f\u843d\u76d8&#xff08;packages\/core\/agent-loop\/src\/runtime-context.ts&#xff09;\u3002<\/li>\n<li>\u8bf7\u6c42\u7528\u7684 system \u6587\u672c\u4e0e\u5de5\u5177\u6e05\u5355\u4ee5 request\/header \u4e8b\u4ef6\u951a\u5b9a\u5728\u8f6e\u6b21\u5f00\u5934&#xff08;packages\/core\/session\/src\/request-header.ts&#xff09;\u3002<\/li>\n<\/ul>\n<p>\u4e3a\u4ec0\u4e48\u503c\u5f97\u8fd9\u4e48\u505a&#xff1a;LLM \u5e94\u7528\u6700\u96be\u8c03\u8bd5\u7684\u4e00\u70b9\u662f&#034;\u6a21\u578b\u4e3a\u4ec0\u4e48\u8fd9\u4e48\u7b54&#034;\u3002\u6709\u4e86\u8fd9\u6761\u4e0d\u53d8\u91cf&#xff0c;\u4f60\u53ea\u8981\u62ff\u5230\u65e5\u5fd7\u6587\u4ef6&#xff0c;\u5c31\u80fd\u5b57\u8282\u7ea7\u590d\u523b\u51fa\u5f53\u65f6\u7684\u8bf7\u6c42\u3002DSH \u7684\u6d4b\u8bd5\u4f53\u7cfb&#xff08;\u89c1\u7b2c 8 \u7bc7&#xff09;\u6b63\u662f\u9760\u8fd9\u4e2a\u505a\u5230\u7684&#xff1a;\u5f55\u4e00\u6b21\u771f\u5b9e\u4f1a\u8bdd&#xff0c;\u4e4b\u540e\u65e0 API key \u91cd\u653e\u3002<\/p>\n<h4>\u51b3\u5b9a\u4e8c&#xff1a;\u6ce8\u518c\u662f\u53ef\u9006\u7684\u526f\u4f5c\u7528&#xff08;effect&#xff09;<\/h4>\n<p>Cordis \u8981\u6c42\u6bcf\u4e00\u6b21&#034;\u6211\u8d21\u732e\u70b9\u4e1c\u897f&#034;&#xff08;\u6ce8\u518c\u5de5\u5177\u3001\u52a0\u63d0\u793a\u7247\u6bb5\u3001\u76d1\u542c\u4e8b\u4ef6\u3001\u63d0\u4f9b\u5b9e\u73b0&#xff09;\u90fd\u901a\u8fc7 ctx.effect() \u6216 ctx.on()&#xff0c;\u5e76\u8fd4\u56de\u4e00\u4e2a\u64a4\u9500\u5668&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ &lt;repo&gt;\/packages\/core\/system-prompt\/src\/index.ts:375<\/span><br \/>\n<span class=\"token function\">section<\/span><span class=\"token punctuation\">(<\/span>section<span class=\"token operator\">:<\/span> PromptSection<span class=\"token punctuation\">)<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#061;&gt;<\/span> <span class=\"token keyword\">void<\/span>   <span class=\"token comment\">\/\/ \u8fd4\u56de\u503c\u5c31\u662f&#034;\u64a4\u9500\u8fd9\u4e2a\u6ce8\u518c&#034;<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u5178\u578b\u63d2\u4ef6\u5199\u6cd5&#xff08;docs\/cordis-primer.md&#xff09;<\/span><br \/>\nctx<span class=\"token punctuation\">.<\/span><span class=\"token function\">effect<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#061;&gt;<\/span> ctx<span class=\"token punctuation\">.<\/span>tools<span class=\"token punctuation\">.<\/span><span class=\"token function\">register<\/span><span class=\"token punctuation\">(<\/span>myTool<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span>   <span class=\"token comment\">\/\/ \u63d2\u4ef6\u5378\u8f7d \u2192 \u5de5\u5177\u81ea\u52a8\u6d88\u5931<\/span><\/p>\n<p>\u8fd9\u6761\u7eaa\u5f8b\u6362\u6765\u7684\u80fd\u529b\u662f\u70ed\u91cd\u8f7d\u4e0e\u4f5c\u7528\u57df\u9694\u79bb&#xff1a;\u4e00\u4e2a agent \u7684\u6574\u4e2a&#034;\u4e16\u754c&#034;\u5c31\u662f\u4e00\u4e2a\u4f5c\u7528\u57df&#xff0c;\u5b83\u7684\u6ce8\u518c\u5728 agent \u9500\u6bc1\u65f6\u7cbe\u786e\u56de\u6eda&#xff1b;\u6539\u4e00\u4e2a cordis.patch.yml \u6587\u4ef6&#xff0c;\u5bf9\u5e94\u63d2\u4ef6 fiber \u91cd\u542f&#xff0c;\u5b83\u7684\u65e7\u8d21\u732e\u6d88\u5931\u3001\u65b0\u8d21\u732e\u751f\u6548&#xff0c;\u800c\u522b\u7684\u63d2\u4ef6\u6beb\u65e0\u5bdf\u89c9\u3002<\/p>\n<h4>\u51b3\u5b9a\u4e09&#xff1a;\u80fd\u529b\u7f1d &#061; Service Definition &#043; Provider &#043; Consumer&#xff0c;\u4e09\u6bb5\u4e00\u8d77\u8bbe\u8ba1<\/h4>\n<p>DSH \u91cc\u8bf4&#034;seam&#xff08;\u80fd\u529b\u7f1d&#xff09;&#034;\u65f6&#xff0c;\u6307\u7684\u4e0d\u662f\u4e00\u4e2a\u63a5\u53e3&#xff0c;\u800c\u662f\u4e09\u4e2a\u89d2\u8272\u7684\u5b8c\u6574\u7ec4\u5408&#xff08;docs\/glossary.zh.md&#xff09;&#xff1a;<\/p>\n<table>\n<tr>\u89d2\u8272\u5e72\u4ec0\u4e48\u6587\u4ef6\u7cfb\u7edf\u80fd\u529b\u7684\u4f8b\u5b50<\/tr>\n<tbody>\n<tr>\n<td>Service Definition<\/td>\n<td>\u58f0\u660e ctx.&lt;key&gt;\u3001\u8bcd\u6c47\u7c7b\u578b\u3001\u62bd\u8c61\u57fa\u7c7b<\/td>\n<td>&#064;deepseek-ai\/dsh-fs&#xff08;ctx.fs&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>Service Provider<\/td>\n<td>\u63d0\u4f9b\u5177\u4f53\u5b9e\u73b0&#xff08;\u53ef\u591a\u4e2a\u3001\u53ef\u66ff\u6362&#xff09;<\/td>\n<td>dsh-fs-local\u3001dsh-fs-sandbox<\/td>\n<\/tr>\n<tr>\n<td>Consumer<\/td>\n<td>\u4f7f\u7528\u5b83&#xff0c;\u901a\u5e38\u662f\u6a21\u578b\u53ef\u89c1\u5de5\u5177<\/td>\n<td>dsh-tool-fs&#xff08;read\/write\/edit&#xff09;\u3001dsh-tool-fs-search&#xff08;glob\/grep&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e00\u4e2a\u5305\u53ef\u4ee5\u517c\u4efb\u591a\u4e2a\u89d2\u8272&#xff08;\u5f53\u5b83\u4eec\u672c\u6765\u5c31\u662f\u4e00\u4ef6\u4e8b\u65f6&#xff09;&#xff0c;\u4f46\u5355\u4e00\u89d2\u8272\u4e0d\u53eb\u7f1d\u3002\u52a0\u4e00\u4e2a\u80fd\u529b &#061; \u4e00\u6b21\u8bbe\u8ba1\u4e09\u4e2a\u89d2\u8272\u3002<\/p>\n<p>\u8fd9\u6761\u51b3\u5b9a\u89e3\u91ca\u4e86\u4e00\u4e2a\u73b0\u8c61&#xff1a;\u4e3a\u4ec0\u4e48 packages\/ \u4e0b\u6709 80 \u591a\u4e2a\u5c0f\u5305\u800c\u4e0d\u662f\u51e0\u4e2a\u5927\u6587\u4ef6\u3002\u56e0\u4e3a\u6bcf\u4e2a\u80fd\u529b\u90fd\u6309\u89d2\u8272\u5207\u5f00&#xff0c;\u5207\u70b9\u5373\u6f14\u8fdb\u70b9\u3002\u4e5f\u89e3\u91ca\u4e86\u4e3a\u4ec0\u4e48\u628a\u6c99\u7bb1 provider \u6362\u6210\u8fdc\u7a0b provider&#xff0c;\u5c31\u80fd\u628a Bash\u3001PTY\u3001LSP \u4e00\u8d77\u642c\u5230\u8fdc\u7aef\u2014\u2014\u5b83\u4eec\u5171\u4eab\u540c\u4e00\u4e2a&#034;\u6267\u884c\u4e16\u754c&#034;\u7684\u7f1d&#xff0c;\u800c\u4e0d\u662f\u5404\u81ea fork \u4e00\u4efd\u3002<\/p>\n<hr \/>\n<h3>5. \u503c\u5f97\u5b66\u4e60\u7684\u5de5\u7a0b\u53e3\u5473&#xff08;\u5148\u7ed9\u7ed3\u8bba&#xff0c;\u7b2c 8 \u7bc7\u5c55\u5f00&#xff09;<\/h3>\n<p>\u8bfb DSH \u6e90\u7801\u65f6&#xff0c;\u4f60\u4f1a\u53d1\u73b0\u4e00\u4e9b\u53cd\u590d\u51fa\u73b0\u7684&#034;\u6d01\u7656&#034;&#xff0c;\u5b83\u4eec\u4e0d\u662f\u98ce\u683c\u504f\u597d&#xff0c;\u800c\u662f\u8e29\u5751\u540e\u7684\u89c4\u5219&#xff08;docs\/defensive-patterns.md \u660e\u8bf4&#xff1a;\u201c\u6bcf\u6761\u90fd\u662f\u8fd9\u91cc\u771f\u5b9e\u53d1\u5e03\u8fc7\u6216\u5dee\u70b9\u53d1\u5e03\u7684\u7f3a\u9677\u7c7b\u201d&#xff09;&#xff1a;<\/p>\n<li>\u54c1\u724c\u7c7b\u578b&#xff08;branded types&#xff09;\u66ff\u4ee3\u88f8\u5b57\u7b26\u4e32&#xff1a;SessionId\u3001FsVersion\u3001ToolCallId \u90fd\u662f Branded&lt;&#039;&#8230;&#039;&gt;&#xff0c;\u8de8\u8fb9\u754c\u4e0d\u53ef\u80fd\u4f20\u9519&#xff08;packages\/util\/brand&#xff09;\u3002<\/li>\n<li>\u4e0d\u91cd\u590d\u9020\u8f6e\u5b50&#xff0c;\u4f46\u5185\u90e8\u6846\u67b6\u6574\u4f53 vendor&#xff1a;Cordis \u53ca\u4f9d\u8d56\u4ee5\u6e90\u7801\u5f62\u5f0f\u653e\u8fdb vendor\/&#xff0c;\u5e76\u9010\u6761\u8bb0\u5f55\u672c\u5730\u6539\u52a8\u4e0e\u4e0a\u6e38 SHA&#xff08;vendor\/README.md&#xff09;\u3002<\/li>\n<li>\u914d\u7f6e\u9519\u8bef\u5b81\u53ef\u4e0d\u542f\u52a8&#xff1a;\u8bef\u914d\u5728\u52a0\u8f7d\u65f6\u5927\u58f0\u5931\u8d25&#xff1b;\u4e0d\u9759\u9ed8\u8df3\u8fc7\u7f3a\u5931\u7684\u5f15\u7528\u76ee\u6807\u3002<\/li>\n<li>\u53ef\u66ff\u6362\u7684\u4e1c\u897f\u4e0d\u7559\u7279\u6743&#xff1a;\u5305\u62ec loop \u672c\u8eab\u3002\u6269\u5c55\u63d2\u4ef6\u53ea\u4f9d\u8d56 dsh-agent&#xff08;\u63a5\u53e3&#xff09;&#xff0c;\u6c38\u4e0d\u76f4\u63a5\u4f9d\u8d56 dsh-agent-loop&#xff08;\u5b9e\u73b0&#xff09;&#xff0c;\u6240\u4ee5\u5faa\u73af\u662f\u53ef\u6362\u7684\u3002<\/li>\n<li>\u95ed\u96c6\u7528 assertNever&#xff0c;\u53ef\u5408\u5e76\u6269\u5c55\u7684\u96c6\u5408\u7559\u5177\u540d default \u5206\u652f\u2014\u2014\u679a\u4e3e\u7684\u5c01\u95ed\u6027\u7531\u7f16\u8bd1\u5668\u5b88\u3002<\/li>\n<li>\u7981\u6b62\u5728\u914d\u7f6e\u91cc\u5185\u8054\u51ed\u636e\u6216\u7aef\u70b9\u73af\u5883\u53d8\u91cf&#xff0c;\u7531 verify-config-source-ownership \u95e8\u7981\u673a\u68b0\u68c0\u67e5\u3002<\/li>\n<h3>6. \u5c0f\u7ed3<\/h3>\n<ul>\n<li>DSH &#061; \u7528\u63d2\u4ef6\u6846\u67b6&#xff08;Cordis&#xff09;\u7ec4\u88c5\u51fa\u6765\u7684 agent \u8fd0\u884c\u65f6&#xff1b;\u6ca1\u6709\u7279\u6743\u5185\u6838&#xff0c;loop \u672c\u8eab\u4e5f\u662f\u63d2\u4ef6\u3002<\/li>\n<li>\u4e09\u6761\u652f\u67f1&#xff1a;\u4e8b\u4ef6\u6eaf\u6e90\u7684\u4f1a\u8bdd\u65e5\u5fd7&#xff08;\u771f\u76f8&#xff09;\u3001\u53ef\u9006\u7684\u6ce8\u518c\u526f\u4f5c\u7528&#xff08;\u9694\u79bb\u4e0e\u70ed\u66f4\u65b0&#xff09;\u3001\u4e09\u6bb5\u5f0f\u80fd\u529b\u7f1d&#xff08;\u53ef\u66ff\u6362&#xff09;\u3002<\/li>\n<li>\u60f3\u627e\u4ee3\u7801&#xff1a;\u63a5\u53e3\u770b docs\/subsystems\/&#xff0c;\u7406\u7531\u770b .agents\/notes\/&#xff0c;\u6e05\u5355\u770b docs\/*-catalog.md\u3002<\/li>\n<\/ul>\n<p>\u4e0b\u4e00\u7bc7\u6211\u4eec\u4e0b\u6c89\u4e00\u5c42&#xff0c;\u53bb\u770b\u90a3\u4e2a&#034;\u6ca1\u6709\u7279\u6743\u5185\u6838&#034;\u80cc\u540e\u7684\u6846\u67b6\u5230\u5e95\u600e\u4e48\u8fd0\u8f6c&#xff1a;\u672c\u6587\u7684\u300cCordis \u63d2\u4ef6\u6846\u67b6\u300d\u90e8\u5206\u3002<\/p>\n<hr \/>\n<h2>\u7b2c\u4e8c\u90e8\u5206 \u00b7 \u300aCordis \u63d2\u4ef6\u6846\u67b6\u300b&#xff08;\u539f\u7a3f\u7b2c 02 \u7ae0&#xff09;<\/h2>\n<p>Cordis \u662f DSH \u5e95\u4e0b\u90a3\u4e2a&#034;\u4e00\u5207\u7686\u63d2\u4ef6&#034;\u7684\u6846\u67b6&#xff0c;\u6e90\u7801\u4ee5 vendored \u5f62\u5f0f\u653e\u5728 &lt;repo&gt;\/vendor\/cordis&#xff08;\u4e0a\u6e38\u7248\u672c\u4e0e SHA \u8bb0\u5f55\u5728 vendor\/README.md&#xff0c;\u672c\u5730\u6539\u52a8\u9010\u6761\u5217\u5728\u8be5\u6587\u4ef6\u7684 \u201cLocal modifications\u201d&#xff09;\u3002<br \/>\n\u8fd9\u4e00\u7bc7\u4e0d\u8bb2 API \u6e05\u5355&#xff0c;\u8bb2\u5b83\u5230\u5e95\u89e3\u51b3\u4e86\u4ec0\u4e48\u95ee\u9898\u3001\u4ee3\u4ef7\u662f\u4ec0\u4e48\u3001DSH \u4e3a\u4ec0\u4e48\u975e\u5b83\u4e0d\u53ef\u3002<\/p>\n<hr \/>\n<h3>1. \u8981\u89e3\u51b3\u7684\u95ee\u9898&#xff1a;\u63d2\u4ef6\u4e4b\u95f4\u600e\u4e48\u8ba4\u8bc6\u5f7c\u6b64<\/h3>\n<p>\u4e00\u4e2a agent \u8fd0\u884c\u65f6\u91cc&#xff0c;\u6a21\u5757\u4e4b\u95f4\u662f\u5f3a\u4e92\u76f8\u4f9d\u8d56\u7684&#xff1a;\u5faa\u73af\u8981\u7528\u5de5\u5177\u6ce8\u518c\u8868&#xff0c;\u5de5\u5177\u8981\u7528\u6587\u4ef6\u7cfb\u7edf&#xff0c;\u6587\u4ef6\u7cfb\u7edf\u8981\u7528\u6c99\u7bb1&#xff0c;\u6c99\u7bb1\u8981\u7528\u4f1a\u8bdd\u2026\u2026\u5982\u679c\u7528 import \u76f4\u8fde&#xff0c;\u4f60\u5c31\u5f97\u5230\u4e00\u5f20\u6539\u4e0d\u52a8\u7684\u7f51&#xff0c;\u800c\u4e14\u6c38\u8fdc\u65e0\u6cd5\u66ff\u6362\u4efb\u4f55\u4e00\u4e2a\u73af\u8282\u3002<\/p>\n<p>Cordis \u7684\u89e3\u6cd5\u662f\u4e09\u6761\u89c4\u77e9&#xff1a;<\/p>\n<li>\u63d2\u4ef6\u4e0d import \u5f7c\u6b64&#xff0c;\u53ea\u6309\u540d\u5b57\u53d6\u670d\u52a1&#xff1a;ctx.tools\u3001ctx.fs\u3001ctx.llm\u3002\u540d\u5b57&#xff08;\u53eb service key&#xff09;\u662f\u552f\u4e00\u7684\u5bfb\u5740\u65b9\u5f0f\u3002<\/li>\n<li>\u9700\u8981\u54ea\u4e9b\u670d\u52a1\u7528 inject \u58f0\u660e\u51fa\u6765&#xff0c;\u6846\u67b6\u8d1f\u8d23&#034;\u7b49\u5b83\u4eec\u51fa\u73b0&#034;&#xff0c;\u4e8e\u662f\u52a0\u8f7d\u987a\u5e8f\u7531\u4f9d\u8d56\u56fe\u81ea\u52a8\u51b3\u5b9a&#xff0c;\u6ca1\u4eba\u5199\u542f\u52a8\u811a\u672c\u3002<\/li>\n<li>\u4e00\u5207\u6ce8\u518c\u90fd\u662f\u53ef\u64a4\u9500\u7684\u526f\u4f5c\u7528&#xff08;effect&#xff09;&#xff0c;\u63d2\u4ef6\u5378\u8f7d\u65f6\u81ea\u52a8\u5012\u5e8f\u56de\u6eda&#xff0c;\u4e8e\u662f\u70ed\u91cd\u8f7d\u4e0e\u9694\u79bb\u662f\u514d\u8d39\u5f97\u5230\u7684\u3002<\/li>\n<p>\u7c7b\u6bd4&#xff1a;Cordis \u50cf\u4e00\u4e2a&#034;\u6709\u670d\u52a1\u53d1\u73b0\u80fd\u529b\u7684\u5bb9\u5668&#034;\u3002\u4f60\u4e0d\u662f new FileService()&#xff0c;\u4f60\u8bf4&#034;\u6211\u8981 fs&#034;&#xff0c;\u5bb9\u5668\u8bf4&#034;\u73b0\u5728\u6ca1\u6709&#xff0c;\u7b49\u5b83\u51fa\u73b0\u6211\u53eb\u4f60&#034;&#xff1b;\u5b83\u51fa\u73b0\u65f6\u4f60\u81ea\u52a8\u6fc0\u6d3b&#xff0c;\u5b83\u88ab\u6362\u6389\u65f6\u4f60\u81ea\u52a8\u91cd\u542f\u3002<\/p>\n<hr \/>\n<h3>2. Context&#xff1a;\u4e00\u4e2a Proxy \u5305\u88f9\u7684\u670d\u52a1\u4ed3\u5e93<\/h3>\n<p>ctx \u4e0d\u662f\u666e\u901a\u5bf9\u8c61\u3002\u770b\u6784\u9020\u51fd\u6570&#xff08;vendor\/cordis\/src\/context.ts:71&#xff09;&#xff1a;<\/p>\n<p><span class=\"token function\">constructor<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">[<\/span>symbols<span class=\"token punctuation\">.<\/span>isolate<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> Object<span class=\"token punctuation\">.<\/span><span class=\"token function\">create<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">null<\/span><span class=\"token punctuation\">)<\/span><br \/>\n  <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">[<\/span>symbols<span class=\"token punctuation\">.<\/span>intercept<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> Object<span class=\"token punctuation\">.<\/span><span class=\"token function\">create<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">null<\/span><span class=\"token punctuation\">)<\/span><br \/>\n  <span class=\"token keyword\">const<\/span> self <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">Proxy<span class=\"token operator\">&lt;<\/span><span class=\"token keyword\">this<\/span><span class=\"token operator\">&gt;<\/span><\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">this<\/span><span class=\"token punctuation\">,<\/span> ReflectService<span class=\"token punctuation\">.<\/span>handler<span class=\"token punctuation\">)<\/span>   <span class=\"token comment\">\/\/ \u2605 \u4e00\u5207\u4ece\u8fd9\u91cc\u5f00\u59cb<\/span><br \/>\n  <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>root <span class=\"token operator\">&#061;<\/span> self<br \/>\n  <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>fiber <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">Fiber<\/span><span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span> Object<span class=\"token punctuation\">.<\/span><span class=\"token function\">create<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">null<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">null<\/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 punctuation\">]<\/span><span class=\"token punctuation\">)<\/span><br \/>\n  <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>reflect <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">ReflectService<\/span><span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">)<\/span><br \/>\n  <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>registry <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">RegistryService<\/span><span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">)<\/span><br \/>\n  <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>events <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">EventsService<\/span><span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">)<\/span><br \/>\n  <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>logger <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">LoggerService<\/span><span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">)<\/span><br \/>\n  <span class=\"token keyword\">return<\/span> self                                                   <span class=\"token comment\">\/\/ \u2605 \u6784\u9020\u8fd4\u56de\u7684\u662f\u4ee3\u7406<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>ReflectService.handler \u62e6\u622a\u5c5e\u6027\u8bfb\u5199&#xff0c;\u4e8e\u662f&#xff1a;<\/p>\n<p>ctx<span class=\"token punctuation\">.<\/span>tools          <span class=\"token comment\">\/\/ \u88ab\u62e6\u622a \u2192 \u67e5\u670d\u52a1\u8868 \u2192 \u8fd4\u56de\u5f53\u524d\u63d0\u4f9b tools \u7684\u90a3\u4e2a\u670d\u52a1\u5b9e\u4f8b<\/span><br \/>\nctx<span class=\"token punctuation\">.<\/span>tools <span class=\"token operator\">&#061;<\/span> x      <span class=\"token comment\">\/\/ \u88ab\u62e6\u622a \u2192 \u53ea\u6709&#034;\u5f53\u521d provide \u5b83\u7684 fiber&#034;\u624d\u5141\u8bb8\u5199<\/span><br \/>\nctx<span class=\"token punctuation\">.<\/span>someUndefined  <span class=\"token comment\">\/\/ \u88ab\u62e6\u622a \u2192 \u629b\u9519&#xff08;\u4e0d\u662f undefined&#xff01;&#xff09;<\/span><\/p>\n<p>\u6700\u540e\u4e00\u6761\u5f88\u91cd\u8981&#xff1a;DSH \u4f9d\u8d56&#034;\u58f0\u660e\u4e86 inject: [&#039;tools&#039;] \u624d\u80fd\u8bfb ctx.tools&#034;\u8fd9\u4e2a\u7ea6\u675f\u3002\u6ca1\u58f0\u660e\u5c31\u8bfb&#xff0c;\u4ee3\u7406\u4f1a\u629b\u9519&#xff08;\u9519\u8bef\u8fd8\u80fd\u88ab internal\/get \u8fd9\u4e2a waterfall \u4e8b\u4ef6\u62e6\u622a\u6539\u5199&#xff09;\u3002\u60f3&#034;\u6709\u5c31\u8bfb\u3001\u6ca1\u6709\u5c31\u7b97\u4e86&#034;&#xff0c;\u7528\u4e25\u683c\u7684 ctx.get(&#039;tools&#039;)\u2014\u2014\u5b83\u8fd4\u56de undefined \u800c\u4e0d\u629b\u9519\u3002\u8fd9\u6761\u533a\u522b\u5728 DSH \u7684\u89c4\u8303\u91cc\u88ab\u660e\u786e\u5199\u4e0b\u6765&#xff08;packages\/AGENTS.md&#xff09;&#xff1a;<\/p>\n<p>\u53ef\u9009\u670d\u52a1\u7528 ctx.get(name)\u3002ctx.&lt;name&gt; \u53ea\u7559\u7ed9\u58f0\u660e\u8fc7\u7684\u6ce8\u5165&#xff1b;\u5c5e\u6027\u4ee3\u7406\u5bf9\u62d3\u6251\u654f\u611f&#xff0c;\u800c\u4e25\u683c\u7684 ctx.get \u8bfb\u5168\u5c40\u670d\u52a1\u8868\u3002<\/p>\n<h4>2.1 \u4e09\u79cd\u6d3e\u751f&#xff1a;extend \/ isolate \/ intercept<\/h4>\n<p>ctx<span class=\"token punctuation\">.<\/span><span class=\"token function\">extend<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">{<\/span> foo<span class=\"token operator\">:<\/span> <span class=\"token number\">1<\/span> <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span>              <span class=\"token comment\">\/\/ \u539f\u578b\u7ee7\u627f\u51fa\u4e00\u4e2a\u5b50 ctx&#xff0c;\u53ea\u52a0\u5143\u6570\u636e<\/span><br \/>\nctx<span class=\"token punctuation\">.<\/span><span class=\"token function\">isolate<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;tools&#039;<\/span><span class=\"token punctuation\">,<\/span> label<span class=\"token punctuation\">)<\/span>         <span class=\"token comment\">\/\/ \u2605 \u6362\u6389\u67d0\u4e2a\u670d\u52a1\u7684&#034;\u4f5c\u7528\u57df\u6807\u7b7e&#034;<\/span><br \/>\nctx<span class=\"token punctuation\">.<\/span><span class=\"token function\">intercept<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;llm&#039;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token operator\">&#8230;<\/span> <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span>       <span class=\"token comment\">\/\/ \u2605 \u7ed9\u4e0b\u65b9\u52a0\u8f7d\u7684\u63d2\u4ef6\u8986\u76d6\u67d0\u4e2a\u670d\u52a1\u7684\u914d\u7f6e<\/span><\/p>\n<ul>\n<li>isolate \u662f&#034;\u540c\u4e00\u4e2a\u670d\u52a1\u540d&#xff0c;\u4e0d\u540c\u4e16\u754c&#034;\u3002\u670d\u52a1\u8868\u6309 name \u2192 label \u9694\u79bb&#xff08;context.ts:121&#xff09;&#xff0c;\u6807\u7b7e\u5199\u5728\u4e00\u4e2a\u539f\u578b\u94fe\u5bf9\u8c61\u91cc&#xff0c;\u6240\u4ee5\u53ea\u6709\u88ab\u70b9\u540d\u7684\u90a3\u4e2a\u670d\u52a1\u6362\u4e86\u547d\u540d\u7a7a\u95f4&#xff0c;\u5176\u5b83\u7167\u65e7\u3002DSH \u7528\u5b83\u5b9e\u73b0&#034;\u4e00\u4e2a agent \u4e00\u4e2a\u5de5\u5177\u4e16\u754c&#034;\u3002<\/li>\n<li>intercept \u662f&#034;\u914d\u7f6e\u6ce8\u5165&#034;\u3002\u5b50 ctx \u91cc\u5e26\u4e00\u5f20 intercept \u8868&#xff0c;\u63d2\u4ef6\u88ab\u88c5\u8f7d\u65f6\u628a\u5b83\u81ea\u5df1\u7684 inject \u4e5f\u5408\u5e76\u8fdb\u53bb&#xff08;fiber.ts:240&#xff09;&#xff0c;\u6700\u7ec8\u7531 Service[resolveConfig] \u6cbf\u539f\u578b\u94fe\u6536\u96c6\u6240\u6709\u5c42\u7684\u8986\u76d6\u9879\u5e76\u6309\u987a\u5e8f\u5408\u5e76&#xff08;service.ts:86&#xff09;\u3002DSH \u7684 preset \/ per-session \u8986\u76d6\u5c31\u9760\u8fd9\u4e2a\u3002<\/li>\n<\/ul>\n<hr \/>\n<h3>3. Service&#xff1a;\u5360\u636e\u4e00\u4e2a ctx.&lt;key&gt; \u7684\u5bf9\u8c61<\/h3>\n<p>vendor\/cordis\/src\/service.ts \u53ea\u6709 105 \u884c&#xff0c;\u4f46\u5b83\u662f\u6574\u4e2a\u6846\u67b6\u7684\u652f\u70b9&#xff1a;<\/p>\n<p><span class=\"token keyword\">export<\/span> <span class=\"token keyword\">abstract<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">Service<span class=\"token operator\">&lt;<\/span>out <span class=\"token constant\">T<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token builtin\">never<\/span><span class=\"token operator\">&gt;<\/span><\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token function\">constructor<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">protected<\/span> ctx<span class=\"token operator\">:<\/span> Context<span class=\"token punctuation\">,<\/span> name<span class=\"token operator\">:<\/span> <span class=\"token builtin\">string<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    name <span class=\"token operator\">??&#061;<\/span> <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>constructor<span class=\"token punctuation\">[<\/span><span class=\"token string\">&#039;provide&#039;<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token keyword\">as<\/span> <span class=\"token builtin\">string<\/span><br \/>\n    <span class=\"token keyword\">let<\/span> self <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">this<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">[<\/span>symbols<span class=\"token punctuation\">.<\/span>invoke<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span>                       <span class=\"token comment\">\/\/ \u652f\u6301&#034;\u670d\u52a1\u672c\u8eab\u53ef\u8c03\u7528&#034;&#xff0c;\u5982 ctx.logger(&#039;x&#039;)<\/span><br \/>\n      self <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">createCallable<\/span><span class=\"token punctuation\">(<\/span><span class=\"token operator\">&#8230;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n    self<span class=\"token punctuation\">.<\/span>ctx <span class=\"token operator\">&#061;<\/span> ctx<br \/>\n    self<span class=\"token punctuation\">.<\/span>name <span class=\"token operator\">&#061;<\/span> name<br \/>\n    self<span class=\"token punctuation\">.<\/span>ctx<span class=\"token punctuation\">.<\/span>reflect<span class=\"token punctuation\">.<\/span><span class=\"token function\">provide<\/span><span class=\"token punctuation\">(<\/span>name<span class=\"token punctuation\">,<\/span> self<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">[<\/span>symbols<span class=\"token punctuation\">.<\/span>check<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span>   <span class=\"token comment\">\/\/ \u2605 \u6ce8\u518c&#xff0c;\u968f fiber \u81ea\u52a8\u6ce8\u9500<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> self<br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token keyword\">protected<\/span> <span class=\"token punctuation\">[<\/span>symbols<span class=\"token punctuation\">.<\/span>filter<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">(<\/span>ctx<span class=\"token operator\">:<\/span> Context<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span>          <span class=\"token comment\">\/\/ \u2605 \u9694\u79bb\u8fc7\u6ee4&#xff1a;\u53ea\u770b\u540c label \u7684\u5b9e\u73b0<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> ctx<span class=\"token punctuation\">[<\/span>symbols<span class=\"token punctuation\">.<\/span>isolate<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">[<\/span><span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>name<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;&#061;&#061;<\/span> <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>ctx<span class=\"token punctuation\">[<\/span>symbols<span class=\"token punctuation\">.<\/span>isolate<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">[<\/span><span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>name<span class=\"token punctuation\">]<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u4e09\u4e2a\u7ec6\u8282\u503c\u5f97\u6ce8\u610f&#xff1a;<\/p>\n<li>\u6ce8\u518c\u53d1\u751f\u5728\u6784\u9020\u51fd\u6570\u91cc\u3002\u4f60 new FileSystem(ctx, &#039;fs&#039;) \u7684\u77ac\u95f4&#xff0c;ctx.fs \u5c31\u751f\u6548\u4e86&#xff1b;fiber \u5378\u8f7d\u65f6\u81ea\u52a8\u6ce8\u9500\u3002<\/li>\n<li>[Service.check] \u662f\u53ef\u7528\u6027\u8c13\u8bcd\u3002DSH \u7528\u5b83\u8868\u8fbe&#034;\u6211\u8fd9\u4e2a\u5b9e\u73b0\u53ea\u5728\u67d0\u4e9b\u6761\u4ef6\u4e0b\u7b97 ready&#034;&#xff08;\u6bd4\u5982 provider \u662f\u5426\u914d\u4e86 key&#xff09;\u3002<\/li>\n<li>[symbols.filter] \u5b9e\u73b0\u9694\u79bb\u3002DSH \u7684\u591a agent \u4e16\u754c\u9760\u5b83\u505a\u5230&#034;\u5b50 agent \u8bfb\u5230\u7684 ctx.fs \u662f\u81ea\u5df1\u7684\u90a3\u4efd&#034;\u3002<\/li>\n<p>\u540c\u4e00\u4e2a\u6587\u4ef6\u91cc\u8fd8\u6709\u4e24\u5904\u5bb9\u6613\u9519\u8fc7\u3001\u4f46\u5f88\u80fd\u4f53\u73b0\u6846\u67b6\u529f\u529b\u7684\u7ec6\u8282&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ service.ts:86 \u2014\u2014 \u914d\u7f6e\u5408\u5e76&#xff1a;\u6cbf\u539f\u578b\u94fe\u6536\u96c6\u5404\u5c42 intercept&#xff0c;&#034;\u79bb root \u8fd1\u7684\u5148\u751f\u6548&#034;<\/span><br \/>\n<span class=\"token punctuation\">[<\/span>symbols<span class=\"token punctuation\">.<\/span>resolveConfig<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">(<\/span>base<span class=\"token operator\">?<\/span><span class=\"token operator\">:<\/span> <span class=\"token constant\">T<\/span><span class=\"token punctuation\">,<\/span> head<span class=\"token operator\">?<\/span><span class=\"token operator\">:<\/span> <span class=\"token constant\">T<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">:<\/span> <span class=\"token constant\">T<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token keyword\">let<\/span> intercept <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>ctx<span class=\"token punctuation\">[<\/span>Context<span class=\"token punctuation\">.<\/span>intercept<span class=\"token punctuation\">]<\/span><br \/>\n  <span class=\"token keyword\">const<\/span> configs<span class=\"token operator\">:<\/span> <span class=\"token builtin\">any<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><br \/>\n  <span class=\"token keyword\">while<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>name <span class=\"token keyword\">in<\/span> intercept<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>Object<span class=\"token punctuation\">.<\/span><span class=\"token function\">hasOwn<\/span><span class=\"token punctuation\">(<\/span>intercept<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>name<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> configs<span class=\"token punctuation\">.<\/span><span class=\"token function\">unshift<\/span><span class=\"token punctuation\">(<\/span>intercept<span class=\"token punctuation\">[<\/span><span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>name<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    intercept <span class=\"token operator\">&#061;<\/span> Object<span class=\"token punctuation\">.<\/span><span class=\"token function\">getPrototypeOf<\/span><span class=\"token punctuation\">(<\/span>intercept<span class=\"token punctuation\">)<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>base<span class=\"token punctuation\">)<\/span> configs<span class=\"token punctuation\">.<\/span><span class=\"token function\">unshift<\/span><span class=\"token punctuation\">(<\/span>base<span class=\"token punctuation\">)<\/span><br \/>\n  <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>head<span class=\"token punctuation\">)<\/span> configs<span class=\"token punctuation\">.<\/span><span class=\"token function\">push<\/span><span class=\"token punctuation\">(<\/span>head<span class=\"token punctuation\">)<\/span><br \/>\n  <span class=\"token keyword\">return<\/span> <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">[<\/span><span class=\"token string\">&#039;Config&#039;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token operator\">?.<\/span>merge <span class=\"token operator\">?<\/span> <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">[<\/span><span class=\"token string\">&#039;Config&#039;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">merge<\/span><span class=\"token punctuation\">(<\/span><span class=\"token operator\">&#8230;<\/span>configs<span class=\"token punctuation\">)<\/span> <span class=\"token operator\">:<\/span> Object<span class=\"token punctuation\">.<\/span><span class=\"token function\">assign<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">{<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token operator\">&#8230;<\/span>configs<span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\">\/\/ service.ts:104 \u2014\u2014 instanceof \u88ab\u91cd\u5199&#xff0c;\u56e0\u4e3a\u4ece ctx \u53d6\u51fa\u7684\u5b9e\u73b0\u53ef\u80fd\u662f Proxy<\/span><br \/>\n<span class=\"token keyword\">static<\/span> <span class=\"token punctuation\">[<\/span>Symbol<span class=\"token punctuation\">.<\/span>hasInstance<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">(<\/span>instance<span class=\"token operator\">:<\/span> <span class=\"token builtin\">any<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token keyword\">let<\/span> constructor <span class=\"token operator\">&#061;<\/span> instance<span class=\"token punctuation\">.<\/span>constructor<br \/>\n  <span class=\"token keyword\">while<\/span> <span class=\"token punctuation\">(<\/span>constructor<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    constructor <span class=\"token operator\">&#061;<\/span> constructor<span class=\"token punctuation\">.<\/span>prototype<span class=\"token operator\">?.<\/span>constructor   <span class=\"token comment\">\/\/ constructor may be a proxy<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>constructor <span class=\"token operator\">&#061;&#061;&#061;<\/span> <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">return<\/span> <span class=\"token boolean\">true<\/span><br \/>\n    constructor <span class=\"token operator\">&amp;&amp;&#061;<\/span> Object<span class=\"token punctuation\">.<\/span><span class=\"token function\">getPrototypeOf<\/span><span class=\"token punctuation\">(<\/span>constructor<span class=\"token punctuation\">)<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token keyword\">return<\/span> <span class=\"token boolean\">false<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u7b2c\u4e00\u6761\u662f intercept \u80fd\u5c42\u5c42\u8986\u76d6\u7684\u5b9e\u73b0\u57fa\u7840&#xff1b;\u7b2c\u4e8c\u6761\u662f&#034;\u6846\u67b6\u66ff\u4f60\u625b\u6389\u7684\u4e00\u4e2a\u5751&#034;\u2014\u2014\u4f60\u5199 ctx.fs instanceof FileSystem \u4e4b\u6240\u4ee5\u80fd\u6210\u7acb&#xff0c;\u5c31\u662f\u56e0\u4e3a\u5b83\u3002<\/p>\n<p>DSH \u91cc Service Definition \u957f\u8fd9\u6837&#xff08;packages\/fs\/fs\/src\/index.ts&#xff0c;\u8282\u9009&#xff09;&#xff1a;<\/p>\n<p><span class=\"token keyword\">export<\/span> <span class=\"token keyword\">abstract<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">FileSystem<\/span> <span class=\"token keyword\">extends<\/span> <span class=\"token class-name\">Service<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token function\">constructor<\/span><span class=\"token punctuation\">(<\/span>ctx<span class=\"token operator\">:<\/span> Context<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token keyword\">super<\/span><span class=\"token punctuation\">(<\/span>ctx<span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#039;fs&#039;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token keyword\">abstract<\/span> <span class=\"token function\">resolve<\/span><span class=\"token punctuation\">(<\/span>path<span class=\"token operator\">:<\/span> <span class=\"token builtin\">string<\/span><span class=\"token punctuation\">,<\/span> opts<span class=\"token operator\">?<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span> cwd<span class=\"token operator\">?<\/span><span class=\"token operator\">:<\/span> <span class=\"token builtin\">string<\/span><span class=\"token punctuation\">;<\/span> signal<span class=\"token operator\">?<\/span><span class=\"token operator\">:<\/span> AbortSignal <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">:<\/span> <span class=\"token builtin\">Promise<\/span><span class=\"token operator\">&lt;<\/span>FsTarget<span class=\"token operator\">&gt;<\/span><br \/>\n  <span class=\"token keyword\">abstract<\/span> <span class=\"token function\">stat<\/span><span class=\"token punctuation\">(<\/span>target<span class=\"token operator\">:<\/span> FsTarget<span class=\"token punctuation\">,<\/span> signal<span class=\"token operator\">?<\/span><span class=\"token operator\">:<\/span> AbortSignal<span class=\"token punctuation\">)<\/span><span class=\"token operator\">:<\/span> <span class=\"token builtin\">Promise<\/span><span class=\"token operator\">&lt;<\/span>FsInfo <span class=\"token operator\">|<\/span> <span class=\"token keyword\">undefined<\/span><span class=\"token operator\">&gt;<\/span><br \/>\n  <span class=\"token keyword\">abstract<\/span> <span class=\"token function\">writeText<\/span><span class=\"token punctuation\">(<\/span>target<span class=\"token punctuation\">,<\/span> content<span class=\"token punctuation\">,<\/span> expected<span class=\"token operator\">?<\/span><span class=\"token punctuation\">,<\/span> signal<span class=\"token operator\">?<\/span><span class=\"token punctuation\">,<\/span> sandboxPolicy<span class=\"token operator\">?<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">:<\/span> <span class=\"token builtin\">Promise<\/span><span class=\"token operator\">&lt;<\/span>FsWriteOutcome<span class=\"token operator\">&gt;<\/span><br \/>\n  <span class=\"token comment\">\/\/ \u2026\u5171 13 \u4e2a\u539f\u8bed<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token keyword\">declare<\/span> <span class=\"token keyword\">module<\/span> <span class=\"token string\">&#039;&#064;deepseek-ai\/cordis&#039;<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token keyword\">interface<\/span> <span class=\"token class-name\">Context<\/span> <span class=\"token punctuation\">{<\/span> fs<span class=\"token operator\">:<\/span> FileSystem <span class=\"token punctuation\">}<\/span> <span class=\"token punctuation\">}<\/span><\/p>\n<p>\u6ce8\u610f\u5b83\u662f abstract class \u800c\u4e0d\u662f interface\u2014\u2014\u56e0\u4e3a interface \u4e0d\u80fd\u5360\u636e ctx.fs \u8fd9\u4e2a\u8fd0\u884c\u65f6\u952e\u3002DSH \u7684\u672f\u8bed\u8868\u628a\u8fd9\u70b9\u5199\u5f97\u5f88\u6e05\u695a&#xff1a;Service Definition \u662f&#034;\u62e5\u6709 ctx.&lt;key&gt; \u548c\u8bcd\u6c47\u7c7b\u578b\u7684 Cordis Service&#xff0c;\u62bd\u8c61\u7c7b\u6216\u5177\u4f53\u6ce8\u518c\u8868&#xff0c;\u7edd\u4e0d\u662f TypeScript interface&#034;\u3002<\/p>\n<hr \/>\n<h3>4. \u63d2\u4ef6\u7684\u4e09\u79cd\u5f62\u72b6\u4e0e Fiber \u751f\u547d\u5468\u671f<\/h3>\n<h4>4.1 \u4e09\u79cd\u5f62\u72b6&#xff08;registry.ts:92&#xff09;<\/h4>\n<p><span class=\"token keyword\">type<\/span> <span class=\"token class-name\">Plugin<span class=\"token operator\">&lt;<\/span><span class=\"token constant\">T<\/span><span class=\"token operator\">&gt;<\/span><\/span> <span class=\"token operator\">&#061;<\/span> Plugin<span class=\"token punctuation\">.<\/span><span class=\"token builtin\">Function<\/span><span class=\"token operator\">&lt;<\/span><span class=\"token constant\">T<\/span><span class=\"token operator\">&gt;<\/span> <span class=\"token operator\">|<\/span> Plugin<span class=\"token punctuation\">.<\/span>Constructor<span class=\"token operator\">&lt;<\/span><span class=\"token constant\">T<\/span><span class=\"token operator\">&gt;<\/span> <span class=\"token operator\">|<\/span> Plugin<span class=\"token punctuation\">.<\/span>Object<span class=\"token operator\">&lt;<\/span><span class=\"token constant\">T<\/span><span class=\"token operator\">&gt;<\/span><br \/>\n<span class=\"token comment\">\/\/ \u51fd\u6570&#xff1a;(ctx, config) &#061;&gt; any      \u53ef\u5e26\u9759\u6001\u5b57\u6bb5<\/span><br \/>\n<span class=\"token comment\">\/\/ \u7c7b&#xff1a;  new (ctx, config)         \u901a\u5e38\u662f Service \u5b50\u7c7b<\/span><br \/>\n<span class=\"token comment\">\/\/ \u5bf9\u8c61&#xff1a;{ apply(ctx, config) }<\/span><br \/>\n<span class=\"token comment\">\/\/ \u4e94\u79cd\u5f62\u72b6\u5171\u7528\u7684\u5143\u6570\u636e&#xff08;Plugin.Base&#xff0c;registry.ts:100&#xff09;&#xff1a;<\/span><br \/>\n<span class=\"token comment\">\/\/   name?     \u8bca\u65ad\u4e0e logger \u7528\u7684\u663e\u793a\u540d<\/span><br \/>\n<span class=\"token comment\">\/\/   Config?   standard-schema \u6821\u9a8c\u5668&#xff08;\u88c5\u8f7d\u524d\u5148\u6821\u9a8c&#xff0c;\u4e0d\u5408\u6cd5\u5c31\u4e0d\u88c5\u8f7d&#xff09;<\/span><br \/>\n<span class=\"token comment\">\/\/   inject?   \u4f9d\u8d56\u7684\u670d\u52a1&#xff1b;\u5168\u90e8\u53ef\u7528\u624d\u52a0\u8f7d<\/span><br \/>\n<span class=\"token comment\">\/\/   provide?  \u672c\u63d2\u4ef6\u63d0\u4f9b\u54ea\u4e2a&#xff08;\u4e9b&#xff09;\u670d\u52a1\u540d \u2014\u2014 Loader \u4e0e\u5de5\u5177\u94fe\u8bfb\u5b83<\/span><br \/>\n<span class=\"token comment\">\/\/   intercept?\u58f0\u660e\u6d88\u8d39\u54ea\u4e9b\u670d\u52a1\u7684 intercept \u914d\u7f6e \u2014\u2014 Loader \u636e\u6b64\u63a8\u5bfc\u4f9d\u8d56<\/span><\/p>\n<p>DSH \u91cc\u6700\u5e38\u89c1\u7684\u5199\u6cd5&#xff08;docs\/cookbook\/adding-a-tool.md&#xff09;&#xff1a;<\/p>\n<p><span class=\"token keyword\">export<\/span> <span class=\"token keyword\">const<\/span> name <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#039;my-tool&#039;<\/span><br \/>\n<span class=\"token keyword\">export<\/span> <span class=\"token keyword\">const<\/span> inject <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token string\">&#039;tools&#039;<\/span><span class=\"token punctuation\">]<\/span>              <span class=\"token comment\">\/\/ \u58f0\u660e\u4f9d\u8d56 \u2192 \u52a0\u8f7d\u987a\u5e8f\u81ea\u52a8\u63a8\u5bfc<\/span><\/p>\n<p><span class=\"token keyword\">export<\/span> <span class=\"token keyword\">function<\/span> <span class=\"token function\">apply<\/span><span class=\"token punctuation\">(<\/span>ctx<span class=\"token operator\">:<\/span> Context<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  ctx<span class=\"token punctuation\">.<\/span>tools<span class=\"token punctuation\">.<\/span><span class=\"token function\">register<\/span><span class=\"token punctuation\">(<\/span><span class=\"token function\">defineTool<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">{<\/span> <span class=\"token comment\">\/* \u2026 *\/<\/span> <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span>  <span class=\"token comment\">\/\/ \u6ce8\u518c\u5373 effect&#xff0c;\u81ea\u52a8\u53ef\u64a4\u9500<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u26a0\ufe0f DSH \u8e29\u8fc7\u7684\u5751&#xff08;postmortem 0001&#xff09;&#xff1a;\u4e00\u4e2a\u5305\u8981\u4e48\u7528&#034;\u7c7b &#043; default export&#034;&#xff0c;\u8981\u4e48\u7528&#034;\u51fd\u6570 &#043; \u5177\u540d inject\/apply&#034;&#xff0c;\u4e0d\u80fd\u6df7\u3002\u6df7\u4e86\u4e4b\u540e Loader \u4f1a\u4e22\u6389\u51fd\u6570\u63d2\u4ef6\u7684 inject&#xff0c;\u4e8e\u662f\u5b83\u4ee5\u4e3a\u81ea\u5df1\u4e0d\u4f9d\u8d56\u4efb\u4f55\u670d\u52a1&#xff0c;\u63d0\u524d\u6fc0\u6d3b\u3001\u5d29\u5728\u534a\u8def&#xff0c;\u73b0\u573a\u6781\u96be\u8bca\u65ad\u3002\u89c4\u8303\u5199\u5728 packages\/AGENTS.md \u7b2c\u4e00\u884c\u3002<\/p>\n<h4>4.2 Fiber&#xff1a;\u4e00\u6b21\u88c5\u8f7d\u7684\u751f\u547d\u5468\u671f<\/h4>\n<p>ctx.plugin(P, config) \u8fd4\u56de\u4e00\u4e2a Fiber&#xff08;\u540c\u65f6\u662f thenable&#xff0c;await \u5b83\u7b49\u4e8e\u7b49\u88c5\u8f7d\u5b8c\u6210&#xff0c;\u4e14\u4f1a\u628a\u542f\u52a8\u671f\u9519\u8bef\u91cd\u65b0\u629b\u51fa&#xff09;\u3002\u72b6\u6001\u673a\u5728 fiber.ts:147&#xff0c;\u662f\u4e2a const enum&#xff1a;<\/p>\n<p><span class=\"token keyword\">export<\/span> <span class=\"token keyword\">const<\/span> <span class=\"token keyword\">enum<\/span> FiberState <span class=\"token punctuation\">{<\/span> <span class=\"token constant\">PENDING<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token constant\">LOADING<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token constant\">ACTIVE<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token constant\">FAILED<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token constant\">DISPOSED<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token constant\">UNLOADING<\/span> <span class=\"token punctuation\">}<\/span><\/p>\n<table>\n<tr>\u72b6\u6001\u542b\u4e49&#xff08;\u5168\u90e8\u51fa\u81ea\u6e90\u7801 JSDoc&#xff09;<\/tr>\n<tbody>\n<tr>\n<td>PENDING<\/td>\n<td>\u7b49 inject \u58f0\u660e\u7684\u670d\u52a1\u51fa\u73b0<\/td>\n<\/tr>\n<tr>\n<td>LOADING<\/td>\n<td>\u63d2\u4ef6\u56de\u8c03\u6b63\u5728\u6267\u884c<\/td>\n<\/tr>\n<tr>\n<td>ACTIVE<\/td>\n<td>\u5df2\u88c5\u8f7d\u3001\u6b63\u5728\u63d0\u4f9b\/\u6d88\u8d39\u670d\u52a1<\/td>\n<\/tr>\n<tr>\n<td>FAILED<\/td>\n<td>\u56de\u8c03\u6216\u914d\u7f6e\u6821\u9a8c\u629b\u9519<\/td>\n<\/tr>\n<tr>\n<td>UNLOADING<\/td>\n<td>\u64a4\u9500\u5668\u6b63\u5728\u6267\u884c<\/td>\n<\/tr>\n<tr>\n<td>DISPOSED<\/td>\n<td>\u5df2\u79fb\u9664&#xff0c;\u4e0d\u80fd\u91cd\u542f<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5173\u952e\u5185\u90e8\u5b57\u6bb5&#xff08;fiber.ts:185 \u8d77&#xff0c;\u9010\u4e2a\u90fd\u6709 JSDoc&#xff09;&#xff1a;<\/p>\n<table>\n<tr>\u5b57\u6bb5\u4f5c\u7528<\/tr>\n<tbody>\n<tr>\n<td>uid<\/td>\n<td>registry \u5185\u552f\u4e00 id&#xff1b;root fiber \u662f 0&#xff0c;dispose \u540e\u7f6e null<\/td>\n<\/tr>\n<tr>\n<td>store<\/td>\n<td>\u88c5\u8f7d\u671f\u95f4\u7684\u670d\u52a1\u5b9e\u73b0\u5feb\u7167&#xff1b;\u672a\u88c5\u8f7d\u65f6 undefined<\/td>\n<\/tr>\n<tr>\n<td>inertia<\/td>\n<td>\u6b63\u5728\u8fdb\u884c\u4e2d\u7684\u88c5\u8f7d\/\u5378\u8f7d\u8fc7\u6e21&#xff1b;\u7528\u6765\u907f\u514d\u5e76\u53d1\u91cd\u5165<\/td>\n<\/tr>\n<tr>\n<td>_hooks \/ _disposables<\/td>\n<td>\u672c fiber \u7684\u4e8b\u4ef6\u94a9\u5b50\u4e0e\u64a4\u9500\u5668\u5217\u8868<\/td>\n<\/tr>\n<tr>\n<td>_config \/ config<\/td>\n<td>\u539f\u59cb\u914d\u7f6e&#xff08;\u6bcf\u6b21\u6fc0\u6d3b\u524d\u91cd\u89e3\u6790&#xff09;\/ \u5df2\u89e3\u6790\u914d\u7f6e<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&#034;\u4f9d\u8d56\u53d8\u4e86\u81ea\u52a8\u91cd\u542f&#034;\u4e0d\u662f\u9b54\u6cd5&#xff0c;\u800c\u662f\u4e00\u6b21 _unload() \u4e4b\u540e\u518d _reload()&#xff1a;fiber \u8bb0\u4f4f\u5b83\u5f53\u65f6\u62ff\u5230\u7684\u6bcf\u4e2a\u670d\u52a1\u5b9e\u73b0\u7684\u8eab\u4efd&#xff1b;\u67d0\u4e2a\u4e0a\u6e38 provide() \u4e86\u65b0\u5b9e\u73b0&#xff08;\u4f8b\u5982\u70ed\u91cd\u8f7d\u4e86 ctx.fs \u7684 provider&#xff09;&#xff0c;\u6240\u6709\u4f9d\u8d56\u5b83\u7684 fiber \u4f1a\u5148\u5012\u5e8f\u64a4\u9500\u81ea\u5df1\u7684 effect\u3001\u518d\u7528\u65b0\u4f9d\u8d56\u91cd\u65b0\u6fc0\u6d3b\u3002DSH \u7684 dsh web \u80fd\u6539\u4e00\u884c cordis.patch.yml \u5c31\u8ba9\u67d0\u4e2a\u63d2\u4ef6\u6362\u8840\u800c\u6574\u4e2a\u4f1a\u8bdd\u4e0d\u4e2d\u65ad&#xff0c;\u9760\u7684\u5c31\u662f\u8fd9\u4e2a\u3002<\/p>\n<p>\u62c6\u9664\u987a\u5e8f\u91cc\u6709\u4e2a\u8bda\u5b9e\u7684\u8bbe\u8ba1\u503c\u5f97\u6ce8\u610f&#xff08;fiber.ts:287 \u6ce8\u91ca&#xff09;&#xff1a;inertia \u81ea\u8eab\u6c38\u4e0d reject\u2014\u2014_reload \u4e0e _unload \u90fd\u7528\u81ea\u5df1\u7684 ctx.logger.error \u541e\u6389\u5de5\u4f5c\u9519\u8bef&#xff1b;\u5982\u679c\u5b83\u771f reject \u4e86&#xff0c;\u552f\u4e00\u53ef\u80fd\u5c31\u662f logger \u672c\u8eab\u574f\u4e86&#xff0c;\u6b64\u65f6\u4ee3\u7801\u9009\u62e9\u8ba9 rejection \u4f20\u64ad\u51fa\u53bb\u3001\u8fdb\u7a0b\u5d29\u6389&#xff0c;\u6ce8\u91ca\u539f\u8bdd\u662f \u201cprocess-level crash is the honest outcome\u201d\u3002\u8fd9\u4e0e DSH \u7684 abortOnUnhandledRejection&#xff08;packages\/core\/agent-loop\/src\/index.ts&#xff09;\u662f\u540c\u4e00\u79cd\u4e16\u754c\u89c2\u3002<\/p>\n<h4>4.3 effect&#xff1a;\u6ce8\u518c\u5fc5\u987b\u662f\u53ef\u9006\u7684<\/h4>\n<p>ctx<span class=\"token punctuation\">.<\/span><span class=\"token function\">effect<\/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 keyword\">const<\/span> off <span class=\"token operator\">&#061;<\/span> something<span class=\"token punctuation\">.<\/span><span class=\"token function\">subscribe<\/span><span class=\"token punctuation\">(<\/span>handler<span class=\"token punctuation\">)<\/span><br \/>\n  <span class=\"token keyword\">return<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#061;&gt;<\/span> <span class=\"token function\">off<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span>          <span class=\"token comment\">\/\/ \u8fd4\u56de\u64a4\u9500\u5668<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#039;label&#039;<\/span><span class=\"token punctuation\">)<\/span>                   <span class=\"token comment\">\/\/ label \u8fdb\u8bca\u65ad\u6811<\/span><\/p>\n<p>effect() \u80fd\u63a5\u53d7&#xff1a;\u5355\u4e2a\u64a4\u9500\u5668\u3001Promise&lt;\u64a4\u9500\u5668&gt;\u3001\u540c\u6b65\/\u5f02\u6b65\u53ef\u8fed\u4ee3&#xff08;\u6bcf\u6b21 yield \u4e00\u4e2a\u64a4\u9500\u5668&#xff0c;\u8fb9\u4ea7\u8fb9\u767b\u8bb0&#xff09;\u3002\u64a4\u9500\u5668\u5012\u5e8f\u6267\u884c&#xff08;fiber.ts:431 \u7684 disposables.splice(0).reverse()&#xff09;&#xff0c;\u4e14\u5d4c\u5957 effect \u4f1a\u5f62\u6210\u8bca\u65ad\u6811&#xff08;EffectMeta &#061; { label, children }&#xff09;&#xff0c;\u6240\u4ee5\u5378\u8f7d\u73b0\u573a\u80fd\u6253\u5370\u51fa&#034;\u662f\u54ea\u4e00\u6b21\u6ce8\u518c\u7559\u4e0b\u7684&#034;\u3002<\/p>\n<p>\u8fd4\u56de\u7684 wrapper \u8fd8\u662f\u4e2a AsyncDisposable&#xff0c;\u6240\u4ee5 using x &#061; ctx.effect(&#8230;) \u4e5f\u6210\u7acb\u3002\u91cc\u9762\u6709\u4e00\u6bb5\u7279\u522b\u786c\u6838\u7684\u6ce8\u91ca\u503c\u5f97\u770b&#xff08;fiber.ts:517&#xff09;&#xff1a;effect \u5728 execute() \u8dd1\u4efb\u4f55\u63d2\u4ef6\u4ee3\u7801\u4e4b\u524d\u5c31\u88ab\u63a8\u8fdb _disposables&#xff0c;\u8fd9\u6837&#034;\u63d2\u4ef6\u4ee3\u7801\u8fd0\u884c\u4e2d\u89e6\u53d1\u7684\u53ef\u91cd\u5165 owner unload&#034;\u4e5f\u80fd\u770b\u89c1\u5b83\u2014\u2014\u8fd9\u79cd\u65f6\u5e8f\u7ec6\u8282\u662f&#034;\u6ce8\u518c\u5373 effect&#034;\u8fd9\u53e5\u8bdd\u771f\u6b63\u7684\u6210\u672c\u3002<\/p>\n<p>\u6846\u67b6\u5185\u90e8\u540c\u6837\u9075\u5b88\u8fd9\u6761\u89c4\u77e9&#xff1a;ctx.on(&#8230;) \u672c\u8eab\u5c31\u662f effect&#xff08;events.ts:245 \u6ce8\u91ca&#xff1a;\u201cStore a listener record as an effect on the current fiber\u201d&#xff09;\u3002\u6240\u4ee5\u76d1\u542c\u5668\u4e00\u5b9a\u4f1a\u968f fiber \u6d88\u5931&#xff0c;DSH \u91cc\u4f60\u4ece\u6765\u770b\u4e0d\u5230&#034;\u5fd8\u8bb0 removeListener&#034;\u8fd9\u7c7b bug \u7684\u5bb9\u9519\u4ee3\u7801\u2014\u2014\u7ed3\u6784\u4e0a\u4e0d\u53ef\u80fd\u3002<\/p>\n<p>DSH \u56e0\u6b64\u5f97\u5230\u4e00\u6761\u786c\u89c4\u5219&#xff08;packages\/AGENTS.md&#xff09;&#xff1a;\u6bcf\u4e2a registry \u8d21\u732e\u90fd\u5fc5\u987b\u8bc1\u660e\u53ef\u64a4\u9500&#xff0c;\u6d4b\u8bd5\u8981\u6c42&#034;dispose fiber \u7136\u540e\u89c2\u5bdf\u5b83\u6d88\u5931\u4e86&#034;&#xff08;HMR-safety \u6d4b\u8bd5&#xff09;\u3002<\/p>\n<h4>4.4 epoch&#xff1a;\u4f9d\u8d56\u53d8\u5316\u81ea\u52a8\u91cd\u542f\u662f\u600e\u4e48\u7b97\u51fa\u6765\u7684<\/h4>\n<p>\u4e0a\u9762&#034;\u4e0a\u6e38\u6362\u4e86\u5b9e\u73b0\u3001\u4e0b\u6e38\u81ea\u52a8\u91cd\u542f&#034;\u4e0d\u662f\u9b54\u6cd5&#xff0c;\u53ea\u6709 12 \u884c&#xff08;fiber.ts:611&#xff09;&#xff1a;<\/p>\n<p><span class=\"token function\">_refresh<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token keyword\">let<\/span> epoch<span class=\"token operator\">:<\/span> <span class=\"token builtin\">string<\/span> <span class=\"token operator\">|<\/span> <span class=\"token builtin\">boolean<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#039;&#039;<\/span><br \/>\n  <span class=\"token keyword\">for<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">const<\/span> name <span class=\"token keyword\">of<\/span> Object<span class=\"token punctuation\">.<\/span><span class=\"token function\">keys<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>inject<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">const<\/span> impl <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>_store<span class=\"token punctuation\">[<\/span>name<span class=\"token punctuation\">]<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token operator\">!<\/span>impl<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span> epoch <span class=\"token operator\">&#061;<\/span> <span class=\"token constant\">INACTIVE<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token keyword\">break<\/span> <span class=\"token punctuation\">}<\/span>      <span class=\"token comment\">\/\/ \u2605 \u4f9d\u8d56\u6ca1\u4e86 \u2192 \u76f4\u63a5\u4e0d\u6fc0\u6d3b<\/span><br \/>\n    epoch <span class=\"token operator\">&#043;&#061;<\/span> <span class=\"token string\">&#039;:&#039;<\/span> <span class=\"token operator\">&#043;<\/span> impl<span class=\"token punctuation\">.<\/span>fiber<span class=\"token punctuation\">.<\/span>uid               <span class=\"token comment\">\/\/ \u2605 \u4f9d\u8d56\u8eab\u4efd &#061; \u63d0\u4f9b\u5b83\u7684 fiber \u7684 uid<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">_setEpoch<\/span><span class=\"token punctuation\">(<\/span>epoch<span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token keyword\">private<\/span> <span class=\"token function\">_setEpoch<\/span><span class=\"token punctuation\">(<\/span>epoch<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token keyword\">const<\/span> oldEpoch <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>_runner<span class=\"token punctuation\">.<\/span>epoch<br \/>\n  <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>epoch <span class=\"token operator\">&#061;&#061;&#061;<\/span> oldEpoch<span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">return<\/span>                <span class=\"token comment\">\/\/ \u6ca1\u53d8&#xff0c;\u4ec0\u4e48\u90fd\u4e0d\u505a<\/span><br \/>\n  <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>_runner<span class=\"token punctuation\">.<\/span>epoch <span class=\"token operator\">&#061;<\/span> epoch<br \/>\n  <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>inertia<span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">return<\/span>                      <span class=\"token comment\">\/\/ \u6b63\u5728\u8fc7\u6e21\u4e2d&#xff0c;\u4ea4\u7ed9\u90a3\u6b21\u8fc7\u6e21<\/span><br \/>\n  <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">_updateState<\/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 keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>epoch <span class=\"token operator\">!&#061;&#061;<\/span> <span class=\"token constant\">INACTIVE<\/span> <span class=\"token operator\">&amp;&amp;<\/span> oldEpoch <span class=\"token operator\">&#061;&#061;&#061;<\/span> <span class=\"token constant\">INACTIVE<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>inertia <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">_reload<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token keyword\">return<\/span> FiberState<span class=\"token punctuation\">.<\/span><span class=\"token constant\">LOADING<\/span> <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token keyword\">else<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>inertia <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">_unload<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token keyword\">return<\/span> FiberState<span class=\"token punctuation\">.<\/span><span class=\"token constant\">UNLOADING<\/span> <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>_unload() \u8dd1\u5b8c\u6240\u6709\u64a4\u9500\u5668\u540e&#xff0c;\u5982\u679c epoch \u4ecd\u7136\u4e0d\u662f INACTIVE&#xff0c;\u5b83\u4f1a\u63a5\u7740\u8c03 _reload()&#xff08;fiber.ts:688&#xff09;\u2014\u2014&#034;\u5148\u64a4\u9500\u4e00\u5207\u3001\u518d\u7528\u65b0\u4f9d\u8d56\u91cd\u65b0\u6fc0\u6d3b&#034;\u5c31\u662f\u8fd9\u4e48\u6765\u7684\u3002_reload() \u91cc\u8fd8\u6709\u4e00\u9053 stale \u5b88\u536b&#xff1a;await Promise.resolve() \u4e4b\u540e\u5148\u6bd4\u5bf9 epoch&#xff0c;\u82e5\u5df2\u88ab\u522b\u4eba\u6539\u8fc7&#xff0c;\u5c31\u4e0d\u8dd1\u63d2\u4ef6\u4ee3\u7801&#xff08;:651 \u6ce8\u91ca\u4e13\u95e8\u89e3\u91ca\u4e86\u8fd9\u4e00\u70b9&#xff09;\u3002<\/p>\n<p>\u4e09\u4e2a\u53ef\u8bfb\u6027\u6536\u76ca&#xff1a;<\/p>\n<ul>\n<li>\u5224\u5b9a&#034;\u53d8\u6ca1\u53d8&#034;\u662f\u7eaf\u5b57\u7b26\u4e32\u6bd4\u8f83&#xff0c;\u4ee3\u4ef7\u6781\u4f4e&#xff0c;\u4e14\u4e0d\u9700\u8981\u4efb\u4f55\u8ba2\u9605\u673a\u5236\u3002<\/li>\n<li>_store[name] \u662f\u88c5\u8f7d\u65f6\u6293\u7684\u5b9e\u73b0\u5feb\u7167&#xff0c;\u800c _checkImpl&#xff08;:597&#xff09;\u4f1a\u7528 impl.check&#xff08;\u5373 [Service.check]&#xff09;\u518d\u95ee\u4e00\u6b21&#034;\u8fd9\u4e2a\u5b9e\u73b0\u73b0\u5728\u7b97 ready \u5417&#034;&#xff0c;check \u81ea\u5df1\u629b\u9519\u4e5f\u53ea\u662f\u5f53\u4f5c&#034;\u4e0d ready&#034;\u5e76\u8bb0\u65e5\u5fd7\u3002<\/li>\n<li>this.store \u53ea\u5728 _reload \u65f6\u5feb\u7167\u53d1\u5e03&#xff08;:647&#xff09;&#xff0c;\u6240\u4ee5\u5916\u90e8\u6c38\u8fdc\u770b\u4e0d\u5230\u534a\u88c5\u914d\u72b6\u6001\u3002<\/li>\n<\/ul>\n<hr \/>\n<h3>5. \u7c7b\u578b\u5316\u4e8b\u4ef6&#xff1a;\u4e94\u79cd\u6d3e\u53d1\u6a21\u5f0f&#xff0c;\u5176\u4e2d waterfall \u662f\u7075\u9b42<\/h3>\n<p>\u4e8b\u4ef6\u8868 Events \u662f\u4e00\u4e2a\u7a7a interface&#xff0c;\u6240\u6709\u63d2\u4ef6\u901a\u8fc7 declaration merging \u5f80\u91cc\u52a0\u65b9\u6cd5&#xff08;events.ts:320 \u7684 SessionEventMap\u3001tools\/*\u3001agent\/* \u90fd\u662f\u8fd9\u4e48\u6765\u7684&#xff09;\u3002\u6d3e\u53d1\u6709\u4e94\u79cd&#xff1a;<\/p>\n<table>\n<tr>\u6a21\u5f0f\u662f\u5426 await\u987a\u5e8f\u6709\u8fd4\u56de\u503c\u5178\u578b\u7528\u9014<\/tr>\n<tbody>\n<tr>\n<td>emit<\/td>\n<td>\u5426<\/td>\n<td>\u6ce8\u518c\u5e8f<\/td>\n<td>\u65e0<\/td>\n<td>\u901a\u77e5&#xff08;session\/event\u3001tools\/start&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>waterfall<\/td>\n<td>\u5426<\/td>\n<td>\u73af\u7ed5\u5f0f<\/td>\n<td>\u6709<\/td>\n<td>\u62e6\u622a\/\u6539\u5199&#xff08;tools\/execute\u3001agent\/request\u3001approval\/request&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>parallel<\/td>\n<td>\u662f<\/td>\n<td>\u5e76\u53d1<\/td>\n<td>\u65e0<\/td>\n<td>\u5e7f\u64ad\u7ed9\u591a\u4e2a\u89c2\u5bdf\u8005&#xff0c;\u7b49\u5b83\u4eec\u90fd\u5b8c<\/td>\n<\/tr>\n<tr>\n<td>serial<\/td>\n<td>\u662f<\/td>\n<td>\u6ce8\u518c\u5e8f&#xff0c;\u9047 bail \u505c<\/td>\n<td>\u6709<\/td>\n<td>\u4f9d\u6b21\u5f81\u8be2&#xff08;agent\/turn-stopping&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>bail<\/td>\n<td>\u5426<\/td>\n<td>\u6ce8\u518c\u5e8f&#xff0c;\u9047 bail \u505c<\/td>\n<td>\u6709<\/td>\n<td>\u5feb\u901f\u5426\u51b3<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>bail \u503c\u5b9a\u4e49\u5f97\u5f88\u6734\u7d20&#xff08;events.ts:13&#xff09;&#xff1a;\u975e null\/false\/undefined \u5373\u7b97&#034;\u62e6\u4e0b\u4e86&#034;\u3002<\/p>\n<h4>5.1 waterfall \u5c31\u662f around \u4e2d\u95f4\u4ef6<\/h4>\n<p><span class=\"token function\">waterfall<\/span><span class=\"token punctuation\">(<\/span><span class=\"token operator\">&#8230;<\/span>args<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token keyword\">const<\/span> cbs <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">dispatch<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;waterfall&#039;<\/span><span class=\"token punctuation\">,<\/span> args<span class=\"token punctuation\">)<\/span><br \/>\n  <span class=\"token keyword\">const<\/span> inner <span class=\"token operator\">&#061;<\/span> args<span class=\"token punctuation\">.<\/span><span class=\"token function\">pop<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span>                    <span class=\"token comment\">\/\/ \u6700\u540e\u4e00\u4e2a\u53c2\u6570\u662f&#034;\u6700\u5185\u5c42 next&#034;<\/span><br \/>\n  <span class=\"token keyword\">const<\/span> <span class=\"token function-variable function\">next<\/span> <span class=\"token operator\">&#061;<\/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 keyword\">const<\/span> cb <span class=\"token operator\">&#061;<\/span> cbs<span class=\"token punctuation\">.<\/span><span class=\"token function\">shift<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">??<\/span> inner<span class=\"token punctuation\">;<\/span> <span class=\"token keyword\">return<\/span> <span class=\"token function\">cb<\/span><span class=\"token punctuation\">(<\/span><span class=\"token operator\">&#8230;<\/span>args<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">}<\/span><br \/>\n  args<span class=\"token punctuation\">.<\/span><span class=\"token function\">push<\/span><span class=\"token punctuation\">(<\/span>next<span class=\"token punctuation\">)<\/span><br \/>\n  <span class=\"token keyword\">return<\/span> <span class=\"token function\">next<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u76d1\u542c\u5668\u7b7e\u540d\u662f (&#8230;args, next)\u3002\u4e0d\u8c03 next() \u5c31\u7b49\u4e8e\u77ed\u8def\u63a5\u7ba1&#xff1b;\u8c03\u4e86\u5c31\u628a&#xff08;\u53ef\u80fd\u88ab\u6539\u8fc7\u7684&#xff09;\u7ed3\u679c\u4ea4\u4e0b\u53bb\u3002DSH \u7684\u89c4\u8303\u56e0\u6b64\u6709\u4e00\u6761\u94c1\u5f8b&#xff08;AGENTS.md&#xff09;&#xff1a;<\/p>\n<p>waterfall \u76d1\u542c\u5668\u5fc5\u987b\u8c03 next() \u6765\u59d4\u6258&#xff1b;\u4e0d\u8c03\u5c31\u77ed\u8def\u6574\u6761\u94fe\u3002<\/p>\n<p>\u800c\u6709\u4e9b\u4e8b\u4ef6\u7684\u8bbe\u8ba1\u610f\u56fe\u5c31\u662f\u8ba9\u4f60\u77ed\u8def&#xff0c;DSH \u4f1a\u628a\u8fd9\u70b9\u5199\u5728\u6ce8\u91ca\u91cc\u3002\u4f8b\u5b50&#xff1a;fs\/write-intent \u662f&#034;\u5355\u69fd\u51b3\u7b56&#034;\u4e8b\u4ef6&#xff0c;fs-observation-policy \u5360\u4f4f\u5b83\u5e76\u4e14\u6545\u610f\u4e0d\u8c03 next()&#xff0c;\u4ece\u800c\u4fdd\u8bc1&#034;\u6539\u4e00\u4e2a\u6211\u6ca1\u8bfb\u8fc7\u7684\u6587\u4ef6&#034;\u5fc5\u7136\u5931\u8d25\u3002<\/p>\n<h4>5.2 \u4e8b\u4ef6\u53ef\u4ee5\u5e26 this&#xff1a;\u4f5c\u7528\u57df\u8fc7\u6ee4\u7684\u5165\u53e3<\/h4>\n<p><span class=\"token keyword\">export<\/span> <span class=\"token keyword\">interface<\/span> <span class=\"token class-name\">Events<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token string\">&#039;agent\/pre-step&#039;<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">this<\/span><span class=\"token operator\">:<\/span> Scoped<span class=\"token operator\">&lt;<\/span>Agent<span class=\"token operator\">&gt;<\/span><span class=\"token punctuation\">,<\/span> decision<span class=\"token punctuation\">,<\/span> next<span class=\"token punctuation\">)<\/span><span class=\"token operator\">:<\/span> <span class=\"token builtin\">Promise<\/span><span class=\"token operator\">&lt;<\/span>PreStepDecision<span class=\"token operator\">&gt;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u6d3e\u53d1\u65f6\u628a agent \u7684 scope carrier \u5f53 thisArg \u4f20\u8fdb\u53bb&#xff0c;EventsService.dispatch \u4f1a\u8bfb thisArg[Context.filter] \u6765\u7b5b\u76d1\u542c\u5668&#xff08;events.ts:171&#xff09;&#xff1a;<\/p>\n<p><span class=\"token keyword\">const<\/span> filter <span class=\"token operator\">&#061;<\/span> thisArg<span class=\"token operator\">?.<\/span><span class=\"token punctuation\">[<\/span>Context<span class=\"token punctuation\">.<\/span>filter<span class=\"token punctuation\">]<\/span><br \/>\n<span class=\"token keyword\">return<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>_hooks<span class=\"token punctuation\">[<\/span>name<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">||<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">filter<\/span><span class=\"token punctuation\">(<\/span>hook <span class=\"token operator\">&#061;&gt;<\/span> hook<span class=\"token punctuation\">.<\/span>global <span class=\"token operator\">||<\/span> <span class=\"token operator\">!<\/span>filter <span class=\"token operator\">||<\/span> <span class=\"token function\">filter<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">call<\/span><span class=\"token punctuation\">(<\/span>thisArg<span class=\"token punctuation\">,<\/span> hook<span class=\"token punctuation\">.<\/span>ctx<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>\u4e8e\u662f&#034;\u5173\u4e8e A \u7684\u4e8b\u4ef6\u4e0d\u4f1a\u6253\u6270 B&#034;\u8fd9\u4ef6\u4e8b&#xff0c;\u5728\u6846\u67b6\u5c42\u5c31\u89e3\u51b3\u4e86&#xff0c;\u4e0d\u9700\u8981\u6bcf\u4e2a\u63d2\u4ef6\u81ea\u5df1\u5224\u65ad\u3002{ global: true } \u9009\u9879\u53ef\u4ee5\u663e\u5f0f\u7ed5\u8fc7\u8fc7\u6ee4\u3002<\/p>\n<p>dispatch \u8fd8\u6709\u4e00\u4e2a\u7ec6\u8282&#xff1a;\u975e internal\/* \u4e8b\u4ef6\u90fd\u4f1a\u5148 emit(&#039;internal\/dispatch&#039;, \u2026)\u2014\u2014DSH \u7684\u6d4b\u8bd5\u4e0e\u8bca\u65ad\u5c42\u6b63\u662f\u6302\u5728\u8fd9\u91cc&#xff0c;\u628a\u6bcf\u4e00\u6b21\u6d3e\u53d1\u90fd\u8bb0\u4e0b\u6765&#xff08;docs\/cordis-api\/context.md#internaldispatch&#xff09;\u3002<\/p>\n<hr \/>\n<h3>6. Loader \u4e0e\u914d\u7f6e\u5c42&#xff1a;cordis.yml \u600e\u4e48\u53d8\u6210\u63d2\u4ef6\u6811<\/h3>\n<p>vendor\/loader &#043; vendor\/include &#043; vendor\/group \u63d0\u4f9b\u58f0\u660e\u5f0f\u88c5\u8f7d\u3002DSH \u7684\u7ec4\u5408\u8bed\u6cd5&#xff08;\u8be6\u89c1\u7b2c 7 \u7bc7&#xff09;\u843d\u5728\u4e09\u4ef6\u4e8b\u4e0a&#xff1a;<\/p>\n<li>\u6761\u76ee&#xff08;entry&#xff09;&#xff1a;{ id, name: \u5305\u540d, config, disabled }\u3002id \u662f patch \u7684\u9776\u5b50&#xff0c;name \u662f\u89e3\u6790\u51fa\u7684\u6a21\u5757&#xff0c;config \u4f1a\u88ab\u8be5\u63d2\u4ef6\u58f0\u660e\u7684 Config schema&#xff08;schemastery\/zod&#xff0c;standard-schema&#xff09;\u6821\u9a8c\u540e\u518d\u4f20\u8fdb\u53bb\u3002<\/li>\n<li>!!js \u8868\u8fbe\u5f0f&#xff1a;\u53ea\u6709 config \u4e0e disabled \u4e24\u4e2a\u4f4d\u7f6e\u652f\u6301&#xff08;vendor\/include\/src\/index.ts&#xff09;&#xff0c;\u6c42\u503c\u53d1\u751f\u5728\u8be5\u6761\u76ee\u6ce8\u5165\u670d\u52a1\u6fc0\u6d3b\u4e4b\u540e\u3001\u4ee5\u8be5\u63d2\u4ef6\u81ea\u5df1\u7684 ctx \u4e3a\u4f5c\u7528\u57df\u3002\u6240\u4ee5\u4f60\u80fd\u5728 patch \u91cc\u5199 disabled: !!js process.platform &#061;&#061;&#061; &#039;win32&#039;\u3002\u6ce8\u610f !!js \u800c\u4e0d\u662f !js\u3002<\/li>\n<li>patch \u5c42&#xff1a;\u6309 id \u66ff\u6362\u6574\u6761 config&#xff08;\u4e0d\u5408\u5e76&#xff01;&#xff09;\u6216 insert \u65b0\u884c\u3002\u8fd9\u6761&#034;\u6574\u6bb5\u66ff\u6362&#034;\u7684\u89c4\u77e9\u89e3\u91ca\u4e86\u4e3a\u4ec0\u4e48 dsh-base \u7684 patch \u91cc&#xff0c;\u6a21\u5f0f\u76f8\u5173\u7684\u884c\u90fd\u5b8c\u6574\u91cd\u8ff0\u4e00\u904d\u3002<\/li>\n<p>\u914d\u7f6e\u6821\u9a8c\u5931\u8d25\u4f1a\u629b ValidationError&#xff08;fiber.ts:19&#xff09;&#xff0c;message \u9010\u6761\u5217\u51fa issue \u4e0e\u8def\u5f84\u3002DSH \u7684\u6001\u5ea6\u662f&#034;\u8bef\u914d\u5b81\u53ef\u4e0d\u542f\u52a8&#034;&#xff0c;\u7edd\u4e0d\u5728\u8fd0\u884c\u65f6\u9759\u9ed8\u515c\u5e95\u3002<\/p>\n<hr \/>\n<h3>7. DSH \u5728\u6846\u67b6\u4e4b\u4e0a\u8865\u7684\u4e09\u5757<\/h3>\n<p>Cordis \u6545\u610f\u53ea\u7ba1&#034;\u5bb9\u5668 &#043; \u4e8b\u4ef6&#034;&#xff0c;DSH \u8865\u7684\u662f agent \u573a\u666f\u7279\u6709\u7684\u4e09\u4ef6\u4e8b&#xff1a;<\/p>\n<table>\n<tr>\u8865\u4e01\u4f4d\u7f6e\u89e3\u51b3\u4ec0\u4e48<\/tr>\n<tbody>\n<tr>\n<td>scope&#xff08;\u4f5c\u7528\u57df\u6ce8\u518c&#xff09;<\/td>\n<td>packages\/core\/scope<\/td>\n<td>\u4e00\u4e2a\u8fdb\u7a0b\u91cc 20 \u4e2a agent&#xff0c;\u5de5\u5177\/\u63d0\u793a\u7247\u6bb5\/\u76d1\u542c\u5668\u8981\u6309 agent \u5212\u5206&#xff0c;\u4e14\u5b50 agent \u4e0d\u7ee7\u627f\u7236\u7684\u79c1\u6709\u6ce8\u518c<\/td>\n<\/tr>\n<tr>\n<td>typert&#xff08;\u7c7b\u578b\u8fdc\u7a0b\u5c42&#xff09;<\/td>\n<td>packages\/typert\/*<\/td>\n<td>\u628a &#064;Remote() \u670d\u52a1\u65b9\u6cd5\u7684 TS \u7c7b\u578b\u7f16\u8bd1\u6210\u53ef\u5728\u6d4f\u89c8\u5668\u7aef\u8c03\u7528\u7684 RPC \u5951\u7ea6 &#043; \u53cc\u5411 zod \u6821\u9a8c<\/td>\n<\/tr>\n<tr>\n<td>invariant&#xff08;\u8fd0\u884c\u65f6\u4e0d\u53d8\u91cf&#xff09;<\/td>\n<td>packages\/core\/*\/src\/invariant.ts<\/td>\n<td>\u628a&#034;\u4e24\u4e2a\u72ec\u7acb\u89c2\u6d4b\u503c\u4e0d\u8be5\u5206\u53c9&#034;\u7684\u65ad\u8a00\u7edf\u4e00\u6ce8\u518c\u3001\u5728\u6d4b\u8bd5\u542f\u52a8\u65f6\u5168\u91cf\u6821\u9a8c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5176\u4e2d scope \u503c\u5f97\u591a\u8bf4\u4e00\u53e5&#xff0c;\u5b83\u662f Cordis isolate \u7684 agent \u5316\u5c01\u88c5&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ packages\/core\/agent-loop\/src\/index.ts:601 \u8d77&#xff0c;\u521b\u5efa agent \u65f6<\/span><br \/>\n<span class=\"token keyword\">const<\/span> scopeCtx <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">createScope<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>runtime<span class=\"token punctuation\">.<\/span>ctx<span class=\"token punctuation\">,<\/span> agent<span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">{<\/span> label<span class=\"token operator\">:<\/span> <span class=\"token template-string\"><span class=\"token template-punctuation string\">&#096;<\/span><span class=\"token string\">agent (<\/span><span class=\"token interpolation\"><span class=\"token interpolation-punctuation punctuation\">${<\/span>agent<span class=\"token punctuation\">.<\/span>id<span class=\"token interpolation-punctuation punctuation\">}<\/span><\/span><span class=\"token string\">)<\/span><span class=\"token template-punctuation string\">&#096;<\/span><\/span> <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token comment\">\/\/ scopeCtx \u7684\u6ce8\u518c\u5e26 agent \u6807\u7b7e&#xff1b;agent \u9500\u6bc1\u65f6\u6574\u4e2a scope \u4e00\u6b21\u6027\u5378\u8f7d<\/span><\/p>\n<p>createScope \u9020\u4e00\u4e2a\u5e26 Context.filter \u7684\u5b50 ctx&#xff08;\u6240\u4ee5\u76d1\u542c\u5668\u81ea\u52a8\u8fc7\u6ee4&#xff09;&#xff0c;\u5e76\u7ed9\u5b83\u4e00\u4e2a ScopeKey&#xff08;DSH \u7684\u7ea6\u5b9a&#xff1a;\u6d3b\u7740\u7684 agent \u5bf9\u8c61\u5c31\u662f\u81ea\u5df1 scope \u7684 key&#xff09;\u3002\u6ce8\u518c\u8868\u7528 ScopedLayers&#xff08;packages\/core\/scope\/src\/store.ts&#xff09;\u5b9e\u73b0&#034;\u5168\u5c40\u5c42 &#043; \u5404 scope \u5c42&#xff0c;scoped \u906e\u853d global&#034;\u3002<\/p>\n<p>DSH \u660e\u786e\u89c4\u5b9a\u53ea\u6709\u4e24\u7ea7&#xff0c;\u4e14\u4f5c\u7528\u57df\u4e0d\u5411\u4e0b\u7ee7\u627f&#xff08;docs\/architecture.zh.md&#xff09;&#xff1a;<\/p>\n<p>\u6bcf\u4e2a agent \u53ea\u6709\u4e00\u4e2a\u4f5c\u7528\u57df\u952e&#xff0c;\u5c31\u662f\u5b83\u81ea\u5df1&#xff1b;\u4e24\u7ea7\u3001\u6241\u5e73&#xff1a;agent \u4f5c\u7528\u57df\u7684\u6ce8\u518c\u4e0d\u4f1a\u88ab\u5b50 agent \u7ee7\u627f\u3002<\/p>\n<p>\u5b50 agent \u60f3\u8981\u7236\u7684\u4e1c\u897f\u600e\u4e48\u529e&#xff1f;\u663e\u5f0f\u590d\u5236\u3002subagent-fork-in-process \u91cc\u5c31\u6709\u628a\u7236\u4f5c\u7528\u57df\u642c\u8fc7\u53bb\u7684\u52a8\u4f5c&#xff08;packages\/subagent\/subagent-fork-in-process\/src\/index.ts&#xff09;\u3002\u8fd9\u6761&#034;\u4e0d\u9690\u5f0f\u7ee7\u627f&#034;\u7684\u89c4\u77e9\u907f\u514d\u4e86&#034;\u5b50 agent \u610f\u5916\u62ff\u5230\u7236 agent \u7684\u79c1\u6709\u5de5\u5177&#034;\u8fd9\u7c7b\u6781\u96be\u6392\u67e5\u7684\u95ee\u9898\u3002<\/p>\n<hr \/>\n<h3>8. \u4e00\u56fe\u603b\u7ed3<\/h3>\n<p>                     new Context()  \u2192  Proxy(ReflectService.handler)<br \/>\n                            \u2502<br \/>\n        \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n        \u2502                   \u2502                    \u2502                  \u2502<br \/>\n   RegistryService     EventsService        LoggerService      ReflectService<br \/>\n   ctx.plugin()        emit\/parallel\/       ctx.logger()       get\/provide\/set<br \/>\n   ctx.inject()        serial\/bail\/waterfall                    accessor\/mixin<br \/>\n        \u2502                   \u2502<br \/>\n        \u25bc                   \u25bc<br \/>\n      Fiber \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 effect() \u6808&#xff08;\u5012\u5e8f\u64a4\u9500&#xff09;<br \/>\n   PENDING\u2192LOADING\u2192ACTIVE\u2192UNLOADING\u2192DISPOSED<br \/>\n        \u2502<br \/>\n        \u2502 \u63d2\u4ef6\u5728 ACTIVE \u671f\u95f4\u8d21\u732e&#xff1a;<br \/>\n        \u25bc<br \/>\n  \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n  \u2502 provide \u670d\u52a1  \u00b7  \u6ce8\u518c\u5de5\u5177\/\u63d0\u793a\u7247\u6bb5  \u00b7  \u76d1\u542c\u4e8b\u4ef6  \u00b7  \u6d3e\u751f scope \u2502<br \/>\n  \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<br \/>\n        \u25b2 \u4e0a\u6e38\u670d\u52a1\u88ab\u91cd\u65b0 provide \u2192 \u4f9d\u8d56\u8005\u81ea\u52a8 restart<\/p>\n<h3>9. \u5c0f\u7ed3\u4e0e\u601d\u8003\u9898<\/h3>\n<ul>\n<li>Cordis \u628a&#034;\u6a21\u5757\u8026\u5408&#034;\u6362\u6210&#034;\u540d\u5b57 &#043; \u4f9d\u8d56\u58f0\u660e &#043; \u53ef\u64a4\u9500\u6ce8\u518c&#034;&#xff0c;\u4ece\u800c\u8ba9\u66ff\u6362\u3001\u70ed\u91cd\u8f7d\u3001\u9694\u79bb\u6210\u4e3a\u67b6\u6784\u5c5e\u6027\u800c\u4e0d\u662f\u8865\u4e01\u3002<\/li>\n<li>\u4f60\u8981\u63a5\u53d7\u7684\u6210\u672c&#xff1a;ctx \u662f Proxy&#xff08;\u8c03\u8bd5\u65f6\u8981\u6e05\u9192&#xff09;\u3001\u670d\u52a1\u53ef\u7528\u6027\u662f\u52a8\u6001\u7684&#xff08;fiber \u4f1a\u5728\u4f9d\u8d56\u53d8\u5316\u65f6\u91cd\u542f&#xff09;\u3001waterfall \u5fd8\u8c03 next() \u4f1a\u9759\u9ed8\u77ed\u8def\u3002<\/li>\n<li>DSH \u7684\u4e00\u5207\u4e0a\u5c42\u8bbe\u8ba1\u2014\u2014\u4f1a\u8bdd\u65e5\u5fd7\u3001\u5de5\u5177\u6d41\u6c34\u7ebf\u3001\u5ba1\u6279\u94fe\u3001\u5b50 agent\u2014\u2014\u90fd\u662f\u5728\u8fd9\u4e94\u6761\u89c4\u77e9\u5185\u5199\u51fa\u6765\u7684\u3002<\/li>\n<\/ul>\n<p>\u601d\u8003\u9898&#xff08;\u7b54\u6848\u90fd\u5728\u540e\u9762\u7684\u7ae0\u8282&#xff09;&#xff1a;<\/p>\n<li>\u4e3a\u4ec0\u4e48 DSH \u8981\u6c42&#034;\u6bcf\u4e2a registry \u8d21\u732e\u5fc5\u987b\u6709 HMR-safety \u6d4b\u8bd5&#034;&#xff1f;&#xff08;\u2192 \u64a4\u9500\u5668\u6f0f\u767b\u8bb0\u4f1a\u600e\u6837&#xff09;<\/li>\n<li>tools\/execute \u4e3a\u4ec0\u4e48\u662f waterfall \u800c\u4e0d\u662f emit&#xff1f;&#xff08;\u2192 \u8d85\u65f6\u3001\u91cd\u8bd5\u3001\u6307\u6807\u90fd\u8981\u73af\u7ed5&#xff09;<\/li>\n<li>\u5b50 agent \u4e0d\u7ee7\u627f\u7236 scope&#xff0c;\u90a3 subagent_fork \u7684&#034;\u7ee7\u627f\u5bf9\u8bdd&#034;\u662f\u600e\u4e48\u505a\u5230\u7684&#xff1f;&#xff08;\u2192 seed \u4e8b\u4ef6&#xff0c;\u89c1\u7b2c 3\u30016 \u7bc7&#xff09;<\/li>\n<p>\u4e0b\u4e00\u7bc7\u8fdb\u5165 DSH \u7684\u5fc3\u810f&#xff1a;\u7b2c 2 \u7bc7\u300aAgent \u5faa\u73af\u4e0e\u4e0a\u4e0b\u6587\u88c5\u914d\u300b\u3002<\/p>\n<hr \/>\n<h3>\u5173\u4e8e\u672c\u7cfb\u5217<\/h3>\n<ul>\n<li>\u5bf9\u8c61&#xff1a;deepseek-harness&#xff08;DSH&#xff09;\u6e90\u7801&#xff0c;pnpm monorepo&#xff0c;Node ^22.19 || &gt;&#061;24&#xff0c;TypeScript ESM\u3002\u6846\u67b6\u5c42 Cordis \u4ee5 vendored \u5f62\u5f0f\u4f4d\u4e8e vendor\/cordis&#xff0c;\u4e0a\u6e38 SHA \u4e0e\u672c\u5730\u6539\u52a8\u8bb0\u5f55\u5728 vendor\/README.md\u3002<\/li>\n<li>\u65b9\u6cd5&#xff1a;\u5148\u8bfb\u4ed3\u5e93\u81ea\u5e26\u6587\u6863&#xff08;docs\/architecture.zh.md\u3001docs\/subsystems\/*\u3001\u751f\u6210\u7684 docs\/capability-seams.zh.md\u3001docs\/persistence-catalog.md \u7b49&#xff09;&#xff0c;\u518d\u9010\u5305\u8bfb src\/ \u4e0e README \u7684 Known Limitations&#xff1b;\u6587\u6863\u4e0e\u6e90\u7801\u4e0d\u7b26\u65f6\u4ee5\u6e90\u7801\u4e3a\u51c6\u3002<\/li>\n<li>\u8bda\u5b9e\u58f0\u660e&#xff1a;\u8fd9\u662f\u7b2c\u4e09\u65b9\u6e90\u7801\u5b66\u4e60\u7b14\u8bb0&#xff0c;\u4e0d\u662f\u5b98\u65b9\u6587\u6863&#xff0c;\u4e5f\u4e0d\u4ee3\u8868\u9879\u76ee\u65b9\u7acb\u573a\u3002DSH \u7684\u516c\u5171 API \u6807\u6ce8\u4e3a pre-stable&#xff0c;\u4f1a\u968f\u7248\u672c\u6f02\u79fb&#xff1b;\u82e5\u672c\u6587\u67d0\u5904\u4e0e\u65b0\u7248\u6e90\u7801\u4e0d\u7b26&#xff0c;\u8bf7\u4ee5\u6e90\u7801\u4e3a\u51c6\u3002\u6587\u4e2d\u5f15\u7528\u7684\u4ee3\u7801\u7247\u6bb5\u5747\u4e3a\u5b66\u4e60\u76ee\u7684\u7684\u8282\u9009\u4e0e\u5220\u8282&#xff08;\u7528 \/\/ \u2026 \u6807\u6ce8&#xff09;&#xff0c;\u7248\u6743\u5f52 deepseek-ai \u6240\u6709\u3002<\/li>\n<li>\u672f\u8bed\u7ea6\u5b9a&#xff1a;capability seam \u8bd1\u300c\u80fd\u529b\u7f1d\u300d&#xff1b;turn\/step \u8bd1\u300c\u8f6e\u6b21\/\u6b65\u9aa4\u300d&#xff1b;surface \u8bd1\u300c\u6a21\u578b\u53ef\u89c1\u9762\u300d&#xff1b;effect \u8bd1\u300c\u526f\u4f5c\u7528&#xff08;\u53ef\u9006\u6ce8\u518c&#xff09;\u300d&#xff1b;scope \u8bd1\u300c\u4f5c\u7528\u57df\u300d&#xff1b;fail closed \u8bd1\u300c\u9ed8\u8ba4\u62d2\u7edd\u300d\u3002<\/li>\n<\/ul>\n<p>\u5199\u4f5c\u98ce\u683c\u4e0a\u6211\u5c3d\u91cf\u505a\u5230&#xff1a;\u5148\u8bb2\u4eba\u8bdd&#xff0c;\u518d\u8bb2\u4ee3\u7801&#xff1b;\u6bcf\u4e2a\u5224\u65ad\u7ed9\u6587\u4ef6\u8def\u5f84&#xff1b;\u5751\u548c\u9650\u5236\u7167\u6284\u5b98\u65b9 README \u7684\u539f\u8bdd&#xff0c;\u4e0d\u66ff\u5b83\u7f8e\u5316\u3002\u89c9\u5f97\u6709\u7528\u7684\u8bdd\u6b22\u8fce\u6536\u85cf &#043; \u5173\u6ce8&#xff0c;\u672c\u7cfb\u5217\u4f1a\u968f\u7248\u672c\u66f4\u65b0\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>DeepSeek Harness&#xff08;DSH&#xff09;\u6e90\u7801\u7cbe\u8bfb 01&#xff1a;DSH \u662f\u4ec0\u4e48&#xff0c;\u4ee5\u53ca\u5b83\u51ed\u4ec0\u4e48\u300c\u4e00\u5207\u7686\u63d2\u4ef6\u300d\u672c\u6587\u662f\u300aDeepSeek Harness \u6e90\u7801\u7cbe\u8bfb\u300b\u7cfb\u5217\u7b2c 1 \u7bc7&#xff08;\u5171 9 \u7bc7&#xff09;\u3002<br \/>\n\u8bfb\u7684\u662f deepseek-harness&#xff08;DSH&#xff09;\u5b98\u65b9\u4ed3\u5e93\u6e90\u7801&#xff0c;\u542b vendored \u7684 Cordis \u6846\u67b6&#xff1b;\u6587\u4e2d\u8def\u5f84\u3001\u6807\u8bc6\u7b26\u4e0e\u884c\u53f7\u90fd\u53d6\u81ea\u5b9e\u9645\u6e90\u7801&amp;#xff<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[66,50],"topic":[],"class_list":["post-101411","post","type-post","status-publish","format-standard","hentry","category-server","tag-ai","tag-50"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>DeepSeek Harness\uff08DSH\uff09\u6e90\u7801\u7cbe\u8bfb 01\uff1aDSH \u662f\u4ec0\u4e48\uff0c\u4ee5\u53ca\u5b83\u51ed\u4ec0\u4e48\u300c\u4e00\u5207\u7686\u63d2\u4ef6\u300d - \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\/101411.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"DeepSeek Harness\uff08DSH\uff09\u6e90\u7801\u7cbe\u8bfb 01\uff1aDSH \u662f\u4ec0\u4e48\uff0c\u4ee5\u53ca\u5b83\u51ed\u4ec0\u4e48\u300c\u4e00\u5207\u7686\u63d2\u4ef6\u300d - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"DeepSeek Harness&#xff08;DSH&#xff09;\u6e90\u7801\u7cbe\u8bfb 01&#xff1a;DSH \u662f\u4ec0\u4e48&#xff0c;\u4ee5\u53ca\u5b83\u51ed\u4ec0\u4e48\u300c\u4e00\u5207\u7686\u63d2\u4ef6\u300d\u672c\u6587\u662f\u300aDeepSeek Harness \u6e90\u7801\u7cbe\u8bfb\u300b\u7cfb\u5217\u7b2c 1 \u7bc7&#xff08;\u5171 9 \u7bc7&#xff09;\u3002 \u8bfb\u7684\u662f deepseek-harness&#xff08;DSH&#xff09;\u5b98\u65b9\u4ed3\u5e93\u6e90\u7801&#xff0c;\u542b vendored \u7684 Cordis \u6846\u67b6&#xff1b;\u6587\u4e2d\u8def\u5f84\u3001\u6807\u8bc6\u7b26\u4e0e\u884c\u53f7\u90fd\u53d6\u81ea\u5b9e\u9645\u6e90\u7801&amp;#xff\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/101411.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-06T12:40:52+00:00\" \/>\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=\"14 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/101411.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/101411.html\",\"name\":\"DeepSeek Harness\uff08DSH\uff09\u6e90\u7801\u7cbe\u8bfb 01\uff1aDSH \u662f\u4ec0\u4e48\uff0c\u4ee5\u53ca\u5b83\u51ed\u4ec0\u4e48\u300c\u4e00\u5207\u7686\u63d2\u4ef6\u300d - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-06T12:40:52+00:00\",\"dateModified\":\"2026-09-06T12:40:52+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/101411.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/101411.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/101411.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DeepSeek Harness\uff08DSH\uff09\u6e90\u7801\u7cbe\u8bfb 01\uff1aDSH \u662f\u4ec0\u4e48\uff0c\u4ee5\u53ca\u5b83\u51ed\u4ec0\u4e48\u300c\u4e00\u5207\u7686\u63d2\u4ef6\u300d\"}]},{\"@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":"DeepSeek Harness\uff08DSH\uff09\u6e90\u7801\u7cbe\u8bfb 01\uff1aDSH \u662f\u4ec0\u4e48\uff0c\u4ee5\u53ca\u5b83\u51ed\u4ec0\u4e48\u300c\u4e00\u5207\u7686\u63d2\u4ef6\u300d - \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\/101411.html","og_locale":"zh_CN","og_type":"article","og_title":"DeepSeek Harness\uff08DSH\uff09\u6e90\u7801\u7cbe\u8bfb 01\uff1aDSH \u662f\u4ec0\u4e48\uff0c\u4ee5\u53ca\u5b83\u51ed\u4ec0\u4e48\u300c\u4e00\u5207\u7686\u63d2\u4ef6\u300d - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"DeepSeek Harness&#xff08;DSH&#xff09;\u6e90\u7801\u7cbe\u8bfb 01&#xff1a;DSH \u662f\u4ec0\u4e48&#xff0c;\u4ee5\u53ca\u5b83\u51ed\u4ec0\u4e48\u300c\u4e00\u5207\u7686\u63d2\u4ef6\u300d\u672c\u6587\u662f\u300aDeepSeek Harness \u6e90\u7801\u7cbe\u8bfb\u300b\u7cfb\u5217\u7b2c 1 \u7bc7&#xff08;\u5171 9 \u7bc7&#xff09;\u3002 \u8bfb\u7684\u662f deepseek-harness&#xff08;DSH&#xff09;\u5b98\u65b9\u4ed3\u5e93\u6e90\u7801&#xff0c;\u542b vendored \u7684 Cordis \u6846\u67b6&#xff1b;\u6587\u4e2d\u8def\u5f84\u3001\u6807\u8bc6\u7b26\u4e0e\u884c\u53f7\u90fd\u53d6\u81ea\u5b9e\u9645\u6e90\u7801&amp;#xff","og_url":"https:\/\/www.wsisp.com\/helps\/101411.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-06T12:40:52+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"14 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/101411.html","url":"https:\/\/www.wsisp.com\/helps\/101411.html","name":"DeepSeek Harness\uff08DSH\uff09\u6e90\u7801\u7cbe\u8bfb 01\uff1aDSH \u662f\u4ec0\u4e48\uff0c\u4ee5\u53ca\u5b83\u51ed\u4ec0\u4e48\u300c\u4e00\u5207\u7686\u63d2\u4ef6\u300d - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-06T12:40:52+00:00","dateModified":"2026-09-06T12:40:52+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/101411.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/101411.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/101411.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"DeepSeek Harness\uff08DSH\uff09\u6e90\u7801\u7cbe\u8bfb 01\uff1aDSH \u662f\u4ec0\u4e48\uff0c\u4ee5\u53ca\u5b83\u51ed\u4ec0\u4e48\u300c\u4e00\u5207\u7686\u63d2\u4ef6\u300d"}]},{"@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\/101411","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=101411"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/101411\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=101411"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=101411"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=101411"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=101411"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}