{"id":96516,"date":"2026-08-27T19:48:33","date_gmt":"2026-08-27T11:48:33","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/96516.html"},"modified":"2026-08-27T19:48:33","modified_gmt":"2026-08-27T11:48:33","slug":"deepseek-harness-%e6%ba%90%e7%a0%81%e7%ba%a7%e6%b7%b1%e5%ba%a6%e5%89%96%e6%9e%90%ef%bc%9a%e5%85%a8%e6%8f%92%e4%bb%b6%e6%9e%b6%e6%9e%84-agent-%e6%a1%86%e6%9e%b6%e4%bb%8e%e5%85%a5%e9%97%a8%e5%88%b0","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/96516.html","title":{"rendered":"DeepSeek Harness \u6e90\u7801\u7ea7\u6df1\u5ea6\u5256\u6790\uff1a\u5168\u63d2\u4ef6\u67b6\u6784 Agent \u6846\u67b6\u4ece\u5165\u95e8\u5230\u5b9e\u6218"},"content":{"rendered":"<h2>DeepSeek Harness \u6e90\u7801\u7ea7\u6df1\u5ea6\u5256\u6790\uff1a\u5168\u63d2\u4ef6\u67b6\u6784 Agent \u6846\u67b6\u4ece\u5165\u95e8\u5230\u5b9e\u6218<\/h2>\n<p>\u672c\u6587\u9002\u5408\u8c01\uff1a\u6b63\u5728\u6784\u5efa AI Agent \u7cfb\u7edf\u7684\u67b6\u6784\u5e08\u548c\u9ad8\u7ea7\u5f00\u53d1\u8005\uff1b\u5bf9\\&#8221;\u63d2\u4ef6\u5316\u67b6\u6784\\&#8221;\u611f\u5174\u8da3\u7684\u540e\u7aef\u5de5\u7a0b\u5e08\uff1b\u60f3\u8981\u6df1\u5ea6\u7406\u89e3 DeepSeek Harness\uff08dsh\uff09\u6e90\u7801\u7684 contributors\u3002<\/p>\n<p>\u4f60\u5c06\u83b7\u5f97\uff1adsh v0.1.0-rc.8 \u67b6\u6784\u6982\u8ff0\u4e0e 5 \u4e2a\u6838\u5fc3\u5305\uff08Session \/ Agent \/ Agent Loop \/ Tools \/ defineTool\uff09\u7684\u5173\u952e\u8bbe\u8ba1\u89e3\u6790\u3001Capability Seam \u8bbe\u8ba1\u6a21\u5f0f\u7684\u5b8c\u6574\u5256\u6790\u3001\u4e00\u4e2a\u53ef\u76f4\u63a5\u6295\u4ea7\u7684 Test Guardian \u6d4b\u8bd5\u5b88\u62a4\u63d2\u4ef6\uff08\u542b\u8de8\u6587\u4ef6\u4f9d\u8d56\u56fe\u3001\u963b\u65ad\u5f0f\u62e6\u622a\u3001\u6301\u4e45\u5316\u7f13\u5b58\u548c 46 \u4e2a\u6d4b\u8bd5\u7528\u4f8b\uff09\uff0c\u4ee5\u53ca 10 \u6761\u4ece\u67b6\u6784\u4e2d\u63d0\u70bc\u7684\u8bbe\u8ba1\u94c1\u5f8b\u3002<\/p>\n<p>\u8fd9\u7bc7\u6559\u7a0b\u503c\u5728\u54ea\u91cc\uff1f<\/p>\n<p>\u5982\u679c\u4f60\u6b63\u5728\u9009\u578b Agent \u6846\u67b6\u2014\u2014\u5e02\u9762\u4e0a\u7684 LangChain\u3001AutoGen\u3001CrewAI \u6587\u6863\u548c\u6559\u7a0b\u5df2\u7ecf\u6cdb\u6ee5\uff0c\u4f46 DeepSeek Harness \u662f\u552f\u4e00\u4e00\u4e2a\u628a\\&#8221;\u4e00\u5207\u7686\u63d2\u4ef6\\&#8221;\u8d2f\u5f7b\u5230 Agent \u5faa\u73af\u672c\u8eab\u7684\u8bbe\u8ba1\u3002\u7406\u89e3\u4e86 dsh \u7684 Capability Seam \u6a21\u5f0f\uff0c\u4f60\u5c31\u638c\u63e1\u4e86\u8bc4\u5224\u4efb\u4f55 Agent \u6846\u67b6\u53ef\u6269\u5c55\u6027\u7684\u5c3a\u5b50\u3002\u672c\u6587\u6982\u8ff0\u4e86 dsh 50+ \u5b50\u5305\u7684\u67b6\u6784\u5168\u8c8c\u5e76\u6df1\u5165\u89e3\u6790\u4e86 5 \u4e2a\u6838\u5fc3\u5305\u7684\u5173\u952e\u8bbe\u8ba1\uff0c\u5e2e\u4f60\u907f\u5f00\u9009\u578b\u7684\u8ba4\u77e5\u76f2\u533a\u3002<\/p>\n<p>\u5982\u679c\u4f60\u6b63\u5728\u6784\u5efa AI \u7f16\u7a0b\u5de5\u5177\u2014\u2014\u7b2c\u4e5d\u7ae0\u7684 Test Guardian \u63d2\u4ef6\u89e3\u51b3\u4e86\u4e00\u4e2a\u884c\u4e1a\u7ea7\u75db\u70b9\uff1aAgent \u5199\u5b8c\u4ee3\u7801\u540e\u6d4b\u8bd5\u81ea\u52a8\u8dd1\u3001\u8dd1\u4e0d\u8fc7\u5c31\u963b\u65ad\uff0c\u4e0d\u5141\u8bb8\u63d0\u4ea4\u534a\u6210\u54c1\u3002\u8fd9\u4e2a\u63d2\u4ef6\u5305\u542b\u5b8c\u6574\u7684\u8de8\u6587\u4ef6\u4f9d\u8d56\u56fe\uff08BFS \u4f20\u9012\u95ed\u5305\uff09\u3001\u963b\u65ad\u5f0f pre-execute \u62e6\u622a\u3001\u6301\u4e45\u5316\u7f13\u5b58\u548c\u4e09\u79cd\u8bed\u8a00\u9002\u914d\u5668\uff08Python\/TypeScript\/Go\uff09\uff0c\u5171 1658 \u884c\u4ee3\u7801\u300146 \u4e2a\u6d4b\u8bd5\u7528\u4f8b\uff0ctsc &#8211;noEmit \u96f6\u9519\u8bef\uff0c\u53ef\u76f4\u63a5 clone \u540e\u6295\u5165\u751f\u4ea7\u3002\u8fd9\u4e0d\u662f\u6559\u5b66\u793a\u4f8b\u2014\u2014\u8fd9\u662f\u4e00\u4e2a\u7ecf\u8fc7\u6d4b\u8bd5\u9a71\u52a8\u5f00\u53d1\uff08TDD\uff09\u9a8c\u8bc1\u7684\u3001\u53ef\u76f4\u63a5\u89e3\u51b3\u771f\u5b9e\u95ee\u9898\u7684\u5de5\u4e1a\u7ea7\u63d2\u4ef6\u3002<\/p>\n<p>\u5982\u679c\u4f60\u60f3\u5b66\u4e60\u63d2\u4ef6\u5316\u67b6\u6784\u8bbe\u8ba1\u2014\u2014dsh \u7684 Cordis \u6846\u67b6\u5b9e\u73b0\u4e86\\&#8221;\u65f6\u7a7a\u53ef\u7ec4\u5408\u6027\\&#8221;\uff1a\u63d2\u4ef6\u53ef\u4ee5\u8fd0\u884c\u65f6\u52a8\u6001\u52a0\u8f7d\/\u5378\u8f7d\uff0c\u5378\u8f7d\u65f6\u81ea\u52a8\u56de\u6eda\u6240\u6709\u526f\u4f5c\u7528\u3002\u8fd9\u79cd\u8bbe\u8ba1\u6a21\u5f0f\u4e0d\u4ec5\u9002\u7528\u4e8e Agent \u6846\u67b6\uff0c\u53ef\u4ee5\u8fc1\u79fb\u5230\u4efb\u4f55\u9700\u8981\\&#8221;\u70ed\u63d2\u62d4\\&#8221;\u80fd\u529b\u7684\u7cfb\u7edf\u4e2d\uff08IDE \u63d2\u4ef6\u3001CI\/CD pipeline\u3001\u5fae\u670d\u52a1\u7f51\u5173\uff09\u3002\u672c\u6587\u4ece\u67b6\u6784\u5c42\u9762\u63d0\u70bc\u4e86 10 \u6761\u8bbe\u8ba1\u94c1\u5f8b\uff0c\u6bcf\u4e00\u6761\u90fd\u9644\u5e26 dsh \u6e90\u7801\u4e2d\u7684\u8bbe\u8ba1\u4f9d\u636e\u3002<\/p>\n<p>\u6559\u7a0b\u7684\u7a00\u7f3a\u6027\u2014\u2014dsh \u76ee\u524d\u5904\u4e8e developer preview \u9636\u6bb5\uff0c\u5b98\u65b9\u6587\u6863\u4ee5 API reference \u4e3a\u4e3b\uff0c\u7f3a\u4e4f\u67b6\u6784\u7ea7\u89e3\u8bfb\u3002\u672c\u6587\u662f\u5bf9 dsh packages\/core\/ \u4e2d 5 \u4e2a\u6838\u5fc3\u5305\u8fdb\u884c\u67b6\u6784\u7ea7\u6df1\u5ea6\u89e3\u6790\u7684\u4e2d\u6587\u8d44\u6599\uff0c\u5e76\u5305\u542b\u4e00\u4e2a\u5b8c\u6574\u7684\u5b9e\u6218\u63d2\u4ef6\u5b9e\u73b0\u3002\u8bfb\u5b8c\u540e\uff0c\u4f60\u4e0d\u4ec5\u80fd\u6df1\u5ea6\u7406\u89e3 dsh \u7684\u67b6\u6784\u8bbe\u8ba1\uff0c\u8fd8\u80fd\u5c06 Capability Seam\u3001\u4e8b\u4ef6\u6eaf\u6e90\u4f1a\u8bdd\u3001waterfall \u7b56\u7565\u62e6\u622a\u7b49\u8bbe\u8ba1\u6a21\u5f0f\u8fc1\u79fb\u5230\u81ea\u5df1\u7684\u9879\u76ee\u4e2d\u3002<\/p>\n<p>\u9605\u8bfb\u5efa\u8bae\uff1a\u5168\u6587\u7ea6 25000 \u5b57\uff08\u542b\u4ee3\u7801\uff09\uff0c\u5efa\u8bae\u5206\u4e09\u6bb5\u9605\u8bfb\u2014\u2014\u7b2c\u4e00\u6bb5\uff08\u4e00\u81f3\u56db\u7ae0\uff09\u7406\u89e3\u6846\u67b6\u9aa8\u67b6\uff0c\u7b2c\u4e8c\u6bb5\uff08\u4e94\u81f3\u516b\u7ae0\uff09\u638c\u63e1\u8fd0\u884c\u65f6\u673a\u5236\uff0c\u7b2c\u4e09\u6bb5\uff08\u4e5d\u81f3\u5341\u4e09\u7ae0\uff09\u52a8\u624b\u5b9e\u6218\u3002<\/p>\n<hr>\n<h3>\u524d\u8a00\uff1a\u4e3a\u4ec0\u4e48\u503c\u5f97\u5173\u6ce8 DeepSeek Harness\uff1f<\/h3>\n<p>2025 \u5e74\uff0cAI Agent \u6846\u67b6\u8d5b\u9053\u5df2\u662f\u4e00\u7247\u7ea2\u6d77\u2014\u2014LangChain\u3001AutoGen\u3001CrewAI\u3001OpenAI Codex SDK\u2026\u2026\u6bcf\u4e2a\u90fd\u5728\u5c1d\u8bd5\u56de\u7b54\u540c\u4e00\u4e2a\u95ee\u9898\uff1a\u5982\u4f55\u8ba9 LLM \u5b89\u5168\u3001\u53ef\u63a7\u3001\u53ef\u6269\u5c55\u5730\u4f7f\u7528\u5de5\u5177\uff1f<\/p>\n<p>DeepSeek Harness\uff08\u7b80\u79f0 dsh\uff09\u7ed9\u51fa\u4e86\u4e00\u4e2a\u4e0e\u4f17\u4e0d\u540c\u7684\u7b54\u6848\uff1aEverything is a Plugin\uff08\u4e00\u5207\u7686\u63d2\u4ef6\uff09\u3002<\/p>\n<p>\u8fd9\u4e0d\u662f\u4e00\u53e5\u8425\u9500\u53e3\u53f7\u3002\u5728 dsh \u4e2d\uff0c\u6a21\u578b\u9002\u914d\u5668\u662f\u63d2\u4ef6\uff0c\u5de5\u5177\u6ce8\u518c\u8868\u662f\u63d2\u4ef6\uff0c\u4f1a\u8bdd\u65e5\u5fd7\u662f\u63d2\u4ef6\uff0c\u8fde Agent \u5faa\u73af\u672c\u8eab\u90fd\u662f\u63d2\u4ef6\u3002\u8fd9\u610f\u5473\u7740\u4f60\u53ef\u4ee5\u66ff\u6362 Agent \u7684\u6838\u5fc3\u9a71\u52a8\u903b\u8f91\uff0c\u800c\u4e0d\u9700\u8981 fork \u4efb\u4f55\u4ee3\u7801\u2014\u2014\u53ea\u9700\u5199\u4e00\u4e2a\u65b0\u63d2\u4ef6\u6ce8\u518c\u5230 ctx.agents\u3002<\/p>\n<p>\u8fd9\u4e2a\u67b6\u6784\u9009\u62e9\u5e26\u6765\u4e86\u4e00\u4e2a\u6df1\u8fdc\u7684\u597d\u5904\uff1a\u5f53\u4f60\u60f3\u8981\u6539\u53d8 Agent \u7684\u884c\u4e3a\u65f6\uff0c\u4f60\u4e0d\u662f\u5728\\&#8221;\u914d\u7f6e\\&#8221;\u4e00\u4e2a\u9ed1\u76d2\uff0c\u800c\u662f\u5728\\&#8221;\u7ec4\u5408\\&#8221;\u4e00\u7ec4\u900f\u660e\u7684\u3001\u7c7b\u578b\u5b89\u5168\u7684\u3001\u53ef\u9006\u7684\u670d\u52a1\u3002<\/p>\n<p>\u672c\u6587\u57fa\u4e8e v0.1.0-rc.8 \u7248\u672c\u6e90\u7801\uff0c\u91cd\u70b9\u89e3\u6790\u4e86 packages\/core\/ \u4e0b 5 \u4e2a\u6838\u5fc3\u5305\uff08Session \/ Agent \/ Agent Loop \/ Tools \/ defineTool\uff09\u7684\u5173\u952e\u8bbe\u8ba1\uff0c\u5e76\u6982\u8ff0\u4e86 50+ \u5b50\u5305\u7684\u67b6\u6784\u5168\u8c8c\u548c\u5b9e\u6218\u6307\u5357\u3002<\/p>\n<hr>\n<h3>\u4e00\u3001\u9879\u76ee\u5168\u8c8c<\/h3>\n<h4>1.1 \u4e00\u53e5\u8bdd\u5b9a\u4f4d<\/h4>\n<p>dsh \u662f\u4e00\u4e2a Agent \u8fd0\u884c\u65f6\u6846\u67b6\uff08agent harness\uff09\uff0c\u6838\u5fc3\u7406\u5ff5\u662f\\&#8221;\u4e00\u5207\u7686\u63d2\u4ef6\\&#8221;\u3002\u5b83\u57fa\u4e8e Cordis \u63d2\u4ef6\u6846\u67b6\uff08\u8bbe\u8ba1\u601d\u60f3\u6765\u81ea\u8bba\u6587 A Programming Paradigm for Spatiotemporal Composability\uff09\uff0c\u7528 TypeScript 6.0 strict \u6a21\u5f0f\u7f16\u5199\uff0c\u8fd0\u884c\u5728 Node.js \u2265 22.19 \u4e0a\u3002<\/p>\n<h4>1.2 \u6280\u672f\u6808\u4e00\u89c8<\/h4>\n<table>\n<tr>\n   \u5c42\u7ea7<br \/>\n   \u6280\u672f\u9009\u578b<br \/>\n   \u9009\u578b\u7406\u7531<br \/>\n  <\/tr>\n<tbody>\n<tr>\n<td>\u8fd0\u884c\u65f6<\/td>\n<td>Node.js \u2265 22.19\uff08ESM only\uff09<\/td>\n<td>\u539f\u751f ESM\u3001AsyncLocalStorage\u3001Fetch API<\/td>\n<\/tr>\n<tr>\n<td>\u8bed\u8a00<\/td>\n<td>TypeScript 6.0, strict: true<\/td>\n<td>\u7c7b\u578b\u5b89\u5168\u662f\u6846\u67b6\u7684\u57fa\u77f3\uff0c\u4e0d\u662f\u9526\u4e0a\u6dfb\u82b1<\/td>\n<\/tr>\n<tr>\n<td>\u5305\u7ba1\u7406<\/td>\n<td>pnpm 11.7 workspaces<\/td>\n<td>50+ \u5b50\u5305\u7684\u9ad8\u6548\u7ba1\u7406<\/td>\n<\/tr>\n<tr>\n<td>\u63d2\u4ef6\u6846\u67b6<\/td>\n<td>Cordis\uff08vendored, SHA pinned\uff09<\/td>\n<td>\u65f6\u7a7a\u53ef\u7ec4\u5408\u6027\uff0c\u6ce8\u518c\u5373\u526f\u4f5c\u7528<\/td>\n<\/tr>\n<tr>\n<td>\u914d\u7f6e\u9a8c\u8bc1<\/td>\n<td>Schemastery<\/td>\n<td>\u58f0\u660e\u5f0f schema + \u8fd0\u884c\u65f6\u9a8c\u8bc1<\/td>\n<\/tr>\n<tr>\n<td>\u6784\u5efa<\/td>\n<td>tsdown\uff08\u6253\u5305\uff09\/ tsc\uff08\u7c7b\u578b\uff09<\/td>\n<td>\u5206\u79bb\u6784\u5efa\u4e0e\u7c7b\u578b\u68c0\u67e5<\/td>\n<\/tr>\n<tr>\n<td>\u6d4b\u8bd5<\/td>\n<td>Vitest 4<\/td>\n<td>\u5355\u5143\/E2E\/snapshot\/web stress \u5168\u8986\u76d6<\/td>\n<\/tr>\n<tr>\n<td>\u6c99\u7bb1<\/td>\n<td>Landlock\uff08Linux C11 \u539f\u751f\u6a21\u5757\uff09<\/td>\n<td>\u5185\u6838\u7ea7\u6587\u4ef6\u7cfb\u7edf\u9694\u79bb<\/td>\n<\/tr>\n<tr>\n<td>\u6301\u4e45\u5316<\/td>\n<td>JSONL \/ SQLite<\/td>\n<td>\u4e8b\u4ef6\u6eaf\u6e90 + \u7d22\u5f15\u67e5\u8be2\u53cc\u901a\u9053<\/td>\n<\/tr>\n<tr>\n<td>\u6587\u6863<\/td>\n<td>VitePress<\/td>\n<td>\u4e2d\u82f1\u53cc\u8bed<\/td>\n<\/tr>\n<tr>\n<td>Python SDK<\/td>\n<td>Python 3.10+, Pydantic, JSON-RPC over stdio<\/td>\n<td>\u8de8\u8bed\u8a00\u4e92\u64cd\u4f5c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>1.3 \u4ed3\u5e93\u7ed3\u6784<\/h4>\n<p>vendor\/          # vendored Cordis \u6e90\u7801\uff08SHA pinned\uff0c\u4e0d\u53ef\u53d8\uff09<br \/>\npackages\/        # @deepseek-ai\/dsh-&lt;pkg&gt; \u5de5\u4f5c\u7a7a\u95f4<br \/>\n  core\/          # \u4ea7\u54c1\u6838\u5fc3\uff1asession, system-prompt, tools, agent, agent-loop<br \/>\n  llm\/           # LLM \u9002\u914d\uff1aDeepSeek \/ pi-ai \/ replay<br \/>\n  shell\/         # bash\/pwsh \u6267\u884c\u5668<br \/>\n  fs\/            # \u6587\u4ef6\u7cfb\u7edf\u64cd\u4f5c<br \/>\n  subprocess\/    # \u5b50\u8fdb\u7a0b\u7ba1\u7406<br \/>\n  terminal\/      # \u6301\u4e45\u7ec8\u7aef<br \/>\n  web\/           # Web \u641c\u7d22\/\u6293\u53d6<br \/>\n  sandbox\/       # \u8fdb\u7a0b\u6c99\u7bb1<br \/>\n  subagent\/      # \u5b50\u4ee3\u7406\uff086\u79cd provider\uff09<br \/>\n  compaction\/    # \u4e0a\u4e0b\u6587\u538b\u7f29<br \/>\n  session\/       # \u4f1a\u8bdd\u6301\u4e45\u5316<br \/>\n  &#8230;            # \u5171 50+ \u5b50\u5305<br \/>\napps\/            # \u4ea7\u54c1\u7ec4\u88c5\u5c42<br \/>\n  cli\/           # dsh CLI<br \/>\n  web\/           # Web UI<br \/>\nexamples\/        # \u53ef\u8fd0\u884c\u7684 cordis.yml \u793a\u4f8b<br \/>\nnative\/          # Landlock C11 \u539f\u751f\u6a21\u5757<br \/>\npython\/          # Python SDK + \u6253\u5305\u8fd0\u884c\u65f6<br \/>\ndocs\/            # \u67b6\u6784\u6587\u6863 + cookbook<\/p>\n<p>\u5173\u952e\u6d1e\u5bdf\uff1avendor\/ \u76ee\u5f55\u4e2d\u7684 Cordis \u6e90\u7801\u662f SHA pinned \u7684\u2014\u2014\u8fd9\u610f\u5473\u7740 dsh \u5bf9\u63d2\u4ef6\u6846\u67b6\u7684\u4f9d\u8d56\u662f\u53ef\u5ba1\u8ba1\u7684\u3001\u4e0d\u53ef\u53d8\u7684\u3002\u4e0d\u4f1a\u56e0\u4e3a\u4e0a\u6e38\u53d1\u7248\u800c\u5f15\u5165\u672a\u77e5\u53d8\u66f4\u3002\u8fd9\u662f\u4f01\u4e1a\u7ea7\u5b89\u5168\u7684\u57fa\u672c\u8981\u6c42\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/08\/20260827114831-6a90240fa27e7.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n<hr>\n<h3>\u4e8c\u3001Cordis \u63d2\u4ef6\u6846\u67b6\uff1a\u4e94\u5927\u6838\u5fc3\u7406\u5ff5<\/h3>\n<p>\u7406\u89e3 dsh \u7684\u524d\u63d0\u662f\u7406\u89e3 Cordis\u3002\u8fd9\u4e0d\u662f\u4e00\u4e2a\u666e\u901a\u7684\u4f9d\u8d56\u6ce8\u5165\u6846\u67b6\u2014\u2014\u5b83\u7684\u8bbe\u8ba1\u54f2\u5b66\u662f\u65f6\u7a7a\u53ef\u7ec4\u5408\u6027\uff1a\u63d2\u4ef6\u53ef\u4ee5\u5728\u8fd0\u884c\u65f6\u52a8\u6001\u52a0\u8f7d\/\u5378\u8f7d\uff0c\u4e14\u5378\u8f7d\u65f6\u81ea\u52a8\u56de\u6eda\u6240\u6709\u526f\u4f5c\u7528\u3002<\/p>\n<h4>2.1 \u63d2\u4ef6\u5373 Service<\/h4>\n<p>\u63d2\u4ef6\u662f\u4e00\u4e2a\u5b9e\u73b0\u4e86 Service \u63a5\u53e3\u7684\u5bf9\u8c61\u3002\u4e24\u79cd\u5199\u6cd5\u7b49\u4ef7\uff1a<\/p>\n<p><span class=\"token comment\">\/\/ \u5199\u6cd5 A\uff1a\u51fd\u6570\u5f0f\u63d2\u4ef6\uff08\u8f7b\u91cf\u573a\u666f\uff09<\/span><br \/>\n<span class=\"token keyword\">export<\/span> <span class=\"token keyword\">const<\/span> name <span class=\"token operator\">=<\/span> <span class=\"token string\">\\&#8217;my-plugin\\&#8217;<\/span><br \/>\n<span class=\"token keyword\">export<\/span> <span class=\"token keyword\">const<\/span> inject <span class=\"token operator\">=<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token string\">\\&#8217;tools\\&#8217;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">\\&#8217;llm\\&#8217;<\/span><span class=\"token punctuation\">]<\/span><br \/>\n<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\">{<\/p>\n<p>   <\/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>myTool<span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u5199\u6cd5 B\uff1aService \u5b50\u7c7b\uff08\u9700\u8981\u72b6\u6001\u7ba1\u7406\u7684\u573a\u666f\uff09<\/span><br \/>\n<span class=\"token keyword\">class<\/span> <span class=\"token class-name\">MyService<\/span> <span class=\"token keyword\">extends<\/span> <span class=\"token class-name\">Service<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span><br \/>\n  <span class=\"token keyword\">static<\/span> inject <span class=\"token operator\">=<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token string\">\\&#8217;tools\\&#8217;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">\\&#8217;llm\\&#8217;<\/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> config<span class=\"token operator\">:<\/span> Config<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span><br \/>\n    <span class=\"token keyword\">super<\/span><span class=\"token punctuation\">(<\/span>ctx<span class=\"token punctuation\">,<\/span> <span class=\"token string\">\\&#8217;myKey\\&#8217;<\/span><span class=\"token punctuation\">)<\/span>  <span class=\"token comment\">\/\/ \u6ce8\u518c\u4e3a ctx.myKey<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h4>2.2 Context \u662f\u670d\u52a1\u4ed3\u5e93<\/h4>\n<p>\u670d\u52a1\u901a\u8fc7 ctx.&lt;key&gt; \u66b4\u9732\u81ea\u5df1\u3002\u5176\u4ed6\u63d2\u4ef6\u901a\u8fc7 key \u67e5\u627e\u670d\u52a1\uff0c\u800c\u975e\u5bfc\u5165\u5177\u4f53\u5b9e\u73b0\uff1a<\/p>\n<p><span class=\"token comment\">\/\/ \u63d2\u4ef6 A \u6ce8\u518c\u670d\u52a1\uff08\u901a\u8fc7 ctx.plugin \u52a0\u8f7d Service \u5b50\u7c7b\uff09<\/span><br \/>\nctx<span class=\"token punctuation\">.<\/span><span class=\"token function\">plugin<\/span><span class=\"token punctuation\">(<\/span>MyService<span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u63d2\u4ef6 B \u6d88\u8d39\u670d\u52a1\uff08\u4e0d\u77e5\u9053\u5177\u4f53\u5b9e\u73b0\uff09<\/span><br \/>\nctx<span class=\"token punctuation\">.<\/span>myKey<span class=\"token punctuation\">.<\/span><span class=\"token function\">doSomething<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>\u8fd9\u5c31\u662f\u4f9d\u8d56\u5012\u7f6e\uff08DIP\uff09\u5728\u6846\u67b6\u7ea7\u522b\u7684\u5b9e\u73b0\uff1a\u6d88\u8d39\u8005\u4f9d\u8d56\u62bd\u8c61\u7684 key\uff0c\u4e0d\u4f9d\u8d56\u5177\u4f53\u7684 import\u3002<\/p>\n<h4>2.3 \u4f9d\u8d56\u58f0\u660e\u901a\u8fc7 inject<\/h4>\n<p><span class=\"token keyword\">export<\/span> <span class=\"token keyword\">const<\/span> inject <span class=\"token operator\">=<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token string\">\\&#8217;tools\\&#8217;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">\\&#8217;llm\\&#8217;<\/span><span class=\"token punctuation\">]<\/span><\/p>\n<p>Cordis \u7b49\u5f85 tools \u548c llm \u670d\u52a1\u5c31\u7eea\u540e\u624d\u6302\u8f7d\u8be5\u63d2\u4ef6\u3002\u52a0\u8f7d\u987a\u5e8f\u7531\u670d\u52a1\u4f9d\u8d56\u8868\u8fbe\uff0c\u65e0\u9700\u624b\u52a8\u7f16\u6392\u3002\u8fd9\u89e3\u51b3\u4e86\u5927\u578b\u63d2\u4ef6\u7cfb\u7edf\u4e2d\u5e38\u89c1\u7684\\&#8221;\u5faa\u73af\u4f9d\u8d56\\&#8221;\u548c\\&#8221;\u52a0\u8f7d\u987a\u5e8f\\&#8221;\u95ee\u9898\u3002<\/p>\n<h4>2.4 \u7c7b\u578b\u5316\u4e8b\u4ef6\u901a\u4fe1\uff08\u4e94\u79cd\u6a21\u5f0f\uff09<\/h4>\n<p>\u8fd9\u662f dsh \u6700\u7cbe\u5999\u7684\u8bbe\u8ba1\u4e4b\u4e00\u3002\u670d\u52a1\u901a\u8fc7 TypeScript declaration merging \u58f0\u660e\u4e8b\u4ef6\u540d\uff0c\u7136\u540e\u4ee5\u4e94\u79cd\u6a21\u5f0f\u5206\u53d1\uff08\u5bf9\u5e94 Cordis DispatchMode \u7c7b\u578b\uff1a\\&#8217;emit\\&#8217; | \\&#8217;parallel\\&#8217; | \\&#8217;serial\\&#8217; | \\&#8217;bail\\&#8217; | \\&#8217;waterfall\\&#8217;\uff09\uff1a<\/p>\n<table>\n<tr>\n   \u6a21\u5f0f<br \/>\n   \u662f\u5426 await<br \/>\n   \u5206\u53d1\u987a\u5e8f<br \/>\n   \u6709\u8fd4\u56de\u503c<br \/>\n   \u5178\u578b\u7528\u9014<br \/>\n  <\/tr>\n<tbody>\n<tr>\n<td>emit<\/td>\n<td>\u5426<\/td>\n<td>\u6ce8\u518c\u5e8f<\/td>\n<td>\u5426<\/td>\n<td>\u901a\u77e5\uff08tools\/result\uff09<\/td>\n<\/tr>\n<tr>\n<td>waterfall<\/td>\n<td>\u5426<\/td>\n<td>\u6ce8\u518c\u5e8f<\/td>\n<td>\u662f<\/td>\n<td>\u7b56\u7565\u62e6\u622a\uff08tools\/pre-execute\uff09\uff0caround-\u4e2d\u95f4\u4ef6\u6a21\u5f0f<\/td>\n<\/tr>\n<tr>\n<td>parallel<\/td>\n<td>\u662f<\/td>\n<td>\u5e76\u884c<\/td>\n<td>\u5426<\/td>\n<td>\u6279\u91cf\u901a\u77e5\uff08session\/event\uff09<\/td>\n<\/tr>\n<tr>\n<td>serial<\/td>\n<td>\u662f<\/td>\n<td>\u6ce8\u518c\u5e8f<\/td>\n<td>\u662f<\/td>\n<td>\u6709\u5e8f\u51b3\u7b56\uff08agent\/turn-stopping\uff09\uff0c\u8fd4\u56de\u503c\u4e32\u8054\u4f20\u9012<\/td>\n<\/tr>\n<tr>\n<td>bail<\/td>\n<td>\u5426<\/td>\n<td>\u6ce8\u518c\u5e8f<\/td>\n<td>\u662f<\/td>\n<td>\u5feb\u901f\u77ed\u8def\uff08\u7b2c\u4e00\u4e2a\u975e\u7a7a\u8fd4\u56de\u503c\u5373\u505c\u6b62\uff09<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5b9e\u6218\u8981\u70b9\uff1awaterfall \u662f dsh \u4e2d\u7b56\u7565\u62e6\u622a\u7684\u6838\u5fc3\u673a\u5236\u2014\u2014\u5b83\u5b9e\u73b0\u4e86 around-\u4e2d\u95f4\u4ef6\u6a21\u5f0f\u3002\u76d1\u542c\u5668\u6536\u5230 (&#8230;args, next)\uff0c\u8c03\u7528 next() \u59d4\u6258\u7ed9\u4e0b\u4e00\u4e2a\u76d1\u542c\u5668\uff0c\u4e0d\u8c03\u7528\u5219\u77ed\u8def\u3002agent\/pre-step\u3001agent\/request\u3001llm\/stream\u3001tools\/pre-execute\u3001tools\/execute\u3001tools\/post-execute \u5168\u90e8\u662f waterfall \u4e8b\u4ef6\u3002<\/p>\n<h4>2.5 \u6ce8\u518c\u5373\u53ef\u9006\u526f\u4f5c\u7528<\/h4>\n<p>\u6240\u6709\u6ce8\u518c\uff08prompt section\u3001tool schema\u3001adapter\u3001listener\uff09\u90fd\u901a\u8fc7 ctx.effect() \u6216 ctx.on() \u5b8c\u6210\uff1a<\/p>\n<p><span class=\"token comment\">\/\/ \u6ce8\u518c\u4e00\u4e2a\u5de5\u5177\u2014\u2014\u5378\u8f7d\u65f6\u81ea\u52a8\u6ce8\u9500<\/span><br \/>\n<span class=\"token keyword\">const<\/span> dispose <span class=\"token operator\">=<\/span> 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\">=&gt;<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/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>myTool<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\">=&gt;<\/span> ctx<span class=\"token punctuation\">.<\/span>tools<span class=\"token punctuation\">.<\/span><span class=\"token function\">unregister<\/span><span class=\"token punctuation\">(<\/span>myTool<span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u6216\u8005\u66f4\u7b80\u6d01\u7684\u5199\u6cd5<\/span><br \/>\nctx<span class=\"token punctuation\">.<\/span><span class=\"token function\">on<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">\\&#8217;tools\/pre-execute\\&#8217;<\/span><span class=\"token punctuation\">,<\/span> handler<span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token comment\">\/\/ \u5378\u8f7d\u65f6\u81ea\u52a8\u79fb\u9664 listener<\/span><\/p>\n<p>\u8fd9\u610f\u5473\u7740\u63d2\u4ef6\u53ef\u4ee5\u5728\u8fd0\u884c\u65f6\u88ab\u5b89\u5168\u5378\u8f7d\u2014\u2014\u6240\u6709\u526f\u4f5c\u7528\u9006\u5e8f\u56de\u6eda\uff0c\u4e0d\u4f1a\u7559\u4e0b\u50f5\u5c38\u6ce8\u518c\u3002<\/p>\n<hr>\n<h3>\u4e09\u3001\u6838\u5fc3\u5305\u6e90\u7801\u6df1\u5ea6\u89e3\u6790<\/h3>\n<h4>3.1 Session \u2014\u2014 \u4e8b\u4ef6\u6eaf\u6e90\u7684\u4f1a\u8bdd\u65e5\u5fd7<\/h4>\n<p>\u6e90\u7801\uff1apackages\/core\/session\/src\/index.ts<\/p>\n<p>Session \u662f\u6574\u4e2a\u7cfb\u7edf\u7684\u771f\u76f8\u6e90\uff08source of truth\uff09\u3002\u5b83\u91c7\u7528\u4e8b\u4ef6\u6eaf\u6e90\uff08Event Sourcing\uff09\u67b6\u6784\uff1a<\/p>\n<p><span class=\"token keyword\">export<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">Session<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span><br \/>\n  <span class=\"token keyword\">private<\/span> log<span class=\"token operator\">:<\/span> SessionEvent<span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token operator\">=<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><br \/>\n  <span class=\"token keyword\">private<\/span> <span class=\"token keyword\">readonly<\/span> surfaceManager <span class=\"token operator\">=<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">SurfaceManager<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>log<span class=\"token punctuation\">)<\/span><\/p>\n<p>  <span class=\"token comment\">\/\/ \u552f\u4e00\u5199\u5165\u8def\u5f84\uff1a\u8ffd\u52a0\u4e8b\u4ef6<\/span><br \/>\n  <span class=\"token generic-function\"><span class=\"token function\">append<\/span><span class=\"token generic class-name\"><span class=\"token operator\">&lt;<\/span><span class=\"token constant\">T<\/span> <span class=\"token keyword\">extends<\/span> SessionEventType<span class=\"token operator\">&gt;<\/span><\/span><\/span><span class=\"token punctuation\">(<\/span><br \/>\n    type<span class=\"token operator\">:<\/span> <span class=\"token constant\">T<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    data<span class=\"token operator\">:<\/span> SessionEventMap<span class=\"token punctuation\">[<\/span><span class=\"token constant\">T<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token operator\">&#8230;<\/span>opts<span class=\"token operator\">:<\/span> <span class=\"token constant\">T<\/span> <span class=\"token keyword\">extends<\/span> <span class=\"token class-name\">SurfaceEventType<\/span> <span class=\"token operator\">?<\/span> <span class=\"token punctuation\">[<\/span>opts<span class=\"token operator\">:<\/span> SurfaceIntent<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">:<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><br \/>\n  <span class=\"token punctuation\">)<\/span><span class=\"token operator\">:<\/span> SessionEvent<span class=\"token operator\">&lt;<\/span><span class=\"token constant\">T<\/span><span class=\"token operator\">&gt;<\/span><\/p>\n<p>  <span class=\"token comment\">\/\/ \u4ece\u4e8b\u4ef6\u65e5\u5fd7\u6d3e\u751f LLM \u6d88\u606f\u5386\u53f2<\/span><br \/>\n  <span class=\"token function\">deriveMessages<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">:<\/span> Message<span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><\/p>\n<p>  <span class=\"token comment\">\/\/ \u8bf7\u6c42\u5934\u6298\u53e0\uff08\u589e\u91cf\u7f13\u5b58\uff09<\/span><br \/>\n  <span class=\"token function\">requestHeader<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">:<\/span> EpochHeader <span class=\"token operator\">|<\/span> <span class=\"token keyword\">undefined<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u4e94\u4e2a\u5173\u952e\u8bbe\u8ba1\u51b3\u7b56\uff1a<\/p>\n<li>\n<p>\u8ffd\u52a0\u53ea\u5199\uff1a\u4e8b\u4ef6\u4e00\u65e6\u5165\u65e5\u5fd7\u5373\u4e0d\u53ef\u53d8\uff08deepFreeze\uff09\uff0cseq \u5355\u8c03\u9012\u589e\u4e14\u8fde\u7eed\uff08seq = log.length \u5951\u7ea6\uff09\u3002\u8fd9\u4fdd\u8bc1\u4e86\u4f1a\u8bdd\u7684\u53ef\u5ba1\u8ba1\u6027\u3002<\/p>\n<\/li>\n<li>\n<p>Lossless JSON\uff1a\u6240\u6709\u4e8b\u4ef6\u6570\u636e\u7ecf\u8fc7 snapshotJsonValue() \u9012\u5f52\u9a8c\u8bc1\uff0c\u786e\u4fdd\u53ef\u5e8f\u5217\u5316\u3002BigInt\u3001Symbol\u3001Map\/Set\/Date \u7b49\u5f02\u7c7b\u5bf9\u8c61\u5728\u5165\u53e3\u88ab\u62d2\u7edd\u3002\u5982\u679c\u4f60\u8bd5\u56fe\u628a\u4e00\u4e2a\u4e0d\u53ef\u5e8f\u5217\u5316\u7684\u503c\u585e\u8fdb\u4f1a\u8bdd\u65e5\u5fd7\uff0c\u5b83\u4f1a\u5728\u5165\u53e3\u5c31\u88ab\u62e6\u622a\uff0c\u800c\u4e0d\u662f\u5728\u6301\u4e45\u5316\u65f6\u624d\u62a5\u9519\u3002<\/p>\n<\/li>\n<li>\n<p>Surface \u673a\u5236\uff1a\u6d88\u606f\u4ea7\u751f\u4e8b\u4ef6\uff08user\/message\u3001assistant\/message\u3001tool\/result\uff09\u643a\u5e26 surfaceOp\uff08append \u6216 replace\uff09\u3002SurfaceManager \u7ef4\u62a4\u4e00\u4e2a\u6709\u5e8f\u8282\u70b9\u5217\u8868\uff0cderiveMessages() \u4ece\u4e2d\u6295\u5f71\u6d88\u606f\u5386\u53f2\u3002\u538b\u7f29\u64cd\u4f5c\u901a\u8fc7 replace \u66ff\u6362\u65e7\u8282\u70b9\u2014\u2014\u8fd9\u5c31\u662f\u4e0a\u4e0b\u6587\u538b\u7f29\u7684\u5b9e\u73b0\u65b9\u5f0f\u3002<\/p>\n<\/li>\n<li>\n<p>\u7248\u672c\u63a7\u5236\uff1aSESSION_FORMAT_VERSION = 0\uff08\u672a\u53d1\u5e03\u671f\uff0c\u65e0\u517c\u5bb9\u627f\u8bfa\uff09\u3002\u7ed3\u6784\u53d8\u66f4 bump\uff0c\u65b0\u589e\u4e8b\u4ef6\u7c7b\u578b\u4e0d bump\uff08\u9760 ignorable \u6807\u8bb0\uff09\u3002<\/p>\n<\/li>\n<li>\n<p>Fork\uff1actx.sessions.fork(source, boundary, childId) \u4ece\u6e90\u4f1a\u8bdd\u7684\u67d0\u4e2a\u4e8b\u4ef6\u5e8f\u53f7\u5207\u51fa\u4e00\u4e2a\u5b50\u4f1a\u8bdd\u3002seed \u662f\u6e90\u65e5\u5fd7\u7684\u8fde\u7eed\u524d\u7f00\uff0c\u4e0d\u5141\u8bb8\u5728\u5f00\u653e turn \u4e2d\u95f4\u5207\u5206\u2014\u2014\u8fd9\u4fdd\u8bc1\u4e86 fork \u7684\u4e00\u81f4\u6027\u3002<\/p>\n<\/li>\n<p>\u4e8b\u4ef6\u7c7b\u578b\u5b8c\u6574\u5206\u7c7b\uff1a<\/p>\n<p><span class=\"token comment\">\/\/ \u6301\u4e45\u4f1a\u8bdd\u4e8b\u4ef6\uff08durable\uff09\u2014\u2014\u5199\u5165\u65e5\u5fd7\uff0c\u53ef\u6062\u590d<\/span><br \/>\n<span class=\"token string\">\\&#8217;turn\/start\\&#8217;<\/span>          <span class=\"token comment\">\/\/ \u5f00\u542f\u4e00\u8f6e\u5bf9\u8bdd<\/span><br \/>\n<span class=\"token string\">\\&#8217;turn\/end\\&#8217;<\/span>            <span class=\"token comment\">\/\/ \u5173\u95ed\u4e00\u8f6e\uff08\u643a\u5e26 TurnEndReason\uff09<\/span><br \/>\n<span class=\"token string\">\\&#8217;step\/start\\&#8217;<\/span>          <span class=\"token comment\">\/\/ \u5f00\u542f\u4e00\u6b65\uff08\u4e00\u6b21\u6a21\u578b\u8bf7\u6c42\uff09<\/span><br \/>\n<span class=\"token string\">\\&#8217;step\/end\\&#8217;<\/span>            <span class=\"token comment\">\/\/ \u5173\u95ed\u4e00\u6b65<\/span><br \/>\n<span class=\"token string\">\\&#8217;user\/message\\&#8217;<\/span>        <span class=\"token comment\">\/\/ \u7528\u6237\u6d88\u606f\uff08\u542b\u6ce8\u5165\u7684\u4e0a\u4e0b\u6587\uff09<\/span><br \/>\n<span class=\"token string\">\\&#8217;assistant\/chunk\\&#8217;<\/span>     <span class=\"token comment\">\/\/ \u6d41\u5f0f Token<\/span><br \/>\n<span class=\"token string\">\\&#8217;assistant\/message\\&#8217;<\/span>   <span class=\"token comment\">\/\/ \u5b8c\u6574\u52a9\u624b\u6d88\u606f<\/span><br \/>\n<span class=\"token string\">\\&#8217;tool\/call\\&#8217;<\/span>           <span class=\"token comment\">\/\/ \u6a21\u578b\u8bf7\u6c42\u5de5\u5177\u8c03\u7528<\/span><br \/>\n<span class=\"token string\">\\&#8217;tool\/result\\&#8217;<\/span>         <span class=\"token comment\">\/\/ \u5de5\u5177\u6267\u884c\u7ed3\u679c<\/span><br \/>\n<span class=\"token string\">\\&#8217;request\/header\\&#8217;<\/span>      <span class=\"token comment\">\/\/ \u8bf7\u6c42\u914d\u7f6e\u5feb\u7167<\/span><br \/>\n<span class=\"token string\">\\&#8217;request\/context\\&#8217;<\/span>     <span class=\"token comment\">\/\/ \u8def\u7531\u5143\u6570\u636e<\/span><br \/>\n<span class=\"token string\">\\&#8217;session\/end-seed\\&#8217;<\/span>    <span class=\"token comment\">\/\/ \u79cd\u5b50\u7ed3\u675f\u6807\u8bb0<\/span><br \/>\n<span class=\"token string\">\\&#8217;todo\/write\\&#8217;<\/span>          <span class=\"token comment\">\/\/ \u5f85\u529e\u5217\u8868\u5feb\u7167<\/span><\/p>\n<p>\u67b6\u6784\u6d1e\u5bdf\uff1a\u533a\u5206\\&#8221;\u6301\u4e45\u4e8b\u4ef6\\&#8221;\u548c\\&#8221;\u5b9e\u65f6\u4e8b\u4ef6\\&#8221;\u662f dsh \u7684\u6838\u5fc3\u8bbe\u8ba1\u3002\u6301\u4e45\u4e8b\u4ef6\uff08turn\/*\u3001step\/*\u3001user\/message \u7b49\uff09\u5199\u5165\u65e5\u5fd7\uff0c\u53ef\u4ece\u65e5\u5fd7\u6062\u590d\u3002\u5b9e\u65f6\u4e8b\u4ef6\uff08agent\/*\u3001tools\/*\u3001llm\/stream \u7b49\uff09\u662f\u8fd0\u884c\u65f6\u901a\u77e5\uff0c\u4e0d\u6301\u4e45\u5316\u3002\u8fd9\u4fdd\u8bc1\u4e86\u4f1a\u8bdd\u6062\u590d\u65f6\u53ea\u91cd\u5efa\u6a21\u578b\u53ef\u89c1\u7684\u72b6\u6001\uff0c\u4e0d\u91cd\u653e\u8fd0\u884c\u65f6\u526f\u4f5c\u7528\u3002<\/p>\n<h4>3.2 Agent \u2014\u2014 \u4ee3\u7406\u6ce8\u518c\u8868\u4e0e\u53d1\u8d77\u8005\u4f20\u64ad<\/h4>\n<p>\u6e90\u7801\uff1apackages\/core\/agent\/src\/index.ts<\/p>\n<p>AgentRegistry\uff08ctx.agents\uff09\u7ba1\u7406\u6240\u6709\u6d3b\u8dc3 Agent \u7684\u751f\u547d\u5468\u671f\uff1a<\/p>\n<p><span class=\"token keyword\">export<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">AgentRegistry<\/span> <span class=\"token keyword\">extends<\/span> <span class=\"token class-name\">Service<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span><br \/>\n  <span class=\"token keyword\">private<\/span> store <span class=\"token operator\">=<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">Map<span class=\"token operator\">&lt;<\/span>SessionId<span class=\"token punctuation\">,<\/span> AgentEntry<span class=\"token operator\">&gt;<\/span><\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n  <span class=\"token keyword\">private<\/span> <span class=\"token keyword\">readonly<\/span> initiators <span class=\"token operator\">=<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">AsyncLocalStorage<span class=\"token operator\">&lt;<\/span>Agent <span class=\"token operator\">|<\/span> <span class=\"token keyword\">undefined<\/span><span class=\"token operator\">&gt;<\/span><\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>  <span class=\"token keyword\">async<\/span> <span class=\"token function\">create<\/span><span class=\"token punctuation\">(<\/span>options<span class=\"token operator\">:<\/span> CreateAgentOptions<span class=\"token punctuation\">)<\/span><span class=\"token operator\">:<\/span> <span class=\"token builtin\">Promise<\/span><span class=\"token operator\">&lt;<\/span>AgentHandle<span class=\"token operator\">&gt;<\/span><br \/>\n  <span class=\"token keyword\">async<\/span> <span class=\"token function\">resume<\/span><span class=\"token punctuation\">(<\/span>options<span class=\"token operator\">:<\/span> ResumeAgentOptions<span class=\"token punctuation\">)<\/span><span class=\"token operator\">:<\/span> <span class=\"token builtin\">Promise<\/span><span class=\"token operator\">&lt;<\/span>AgentHandle<span class=\"token operator\">&gt;<\/span><br \/>\n  <span class=\"token function\">register<\/span><span class=\"token punctuation\">(<\/span>agent<span class=\"token operator\">:<\/span> Agent<span class=\"token punctuation\">)<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">=&gt;<\/span> <span class=\"token keyword\">void<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u4e09\u4e2a\u5173\u952e\u8bbe\u8ba1\uff1a<\/p>\n<li>\n<p>\u5de5\u5382\u59d4\u6258\uff1aAgentRegistry \u4e0d\u76f4\u63a5\u521b\u5efa Agent\uff0c\u800c\u662f\u59d4\u6258\u7ed9 AgentFactory\uff08\u7531 dsh-agent-loop \u63d2\u4ef6\u63d0\u4f9b\uff09\u3002\u6d88\u8d39\u8005\u901a\u8fc7 ctx.agents \u7f16\u7a0b\uff0c\u4e0d\u4f9d\u8d56\u5177\u4f53\u5faa\u73af\u5305\u3002\u8fd9\u610f\u5473\u7740\u4f60\u53ef\u4ee5\u66ff\u6362 Agent \u7684\u9a71\u52a8\u903b\u8f91\u800c\u4e0d\u4fee\u6539\u6ce8\u518c\u8868\u4ee3\u7801\u3002<\/p>\n<\/li>\n<li>\n<p>Initiator \u4f20\u64ad\uff1awithInitiator(agent, operation) \u4f7f\u7528 AsyncLocalStorage \u5c06\u53d1\u8d77\u8005 Agent \u4f20\u64ad\u5230\u5f02\u6b65\u8c03\u7528\u94fe\u3002\u5b50 Agent \u521b\u5efa\u65f6\uff0c\u8bbe\u7f6e\u7a97\u53e3\u5185\u7684\u6ce8\u518c\u53ea\u5bf9\u8be5 Agent \u53ef\u89c1\u2014\u2014\u8fd9\u662f Agent \u9694\u79bb\u7684\u57fa\u7840\u3002<\/p>\n<\/li>\n<li>\n<p>Setup \u7a97\u53e3\u4e0e\u56de\u6eda\u5b89\u5168\uff1aCreateAgentOptions.setup \u662f\u521b\u5efa\u65f6\u7ec4\u5408 Agent scoped world \u7684\u56de\u8c03\u3002\u5de5\u5382\u5728 mint agentCtx \u540e\u3001\u53d1\u5e03\u524d await setup\u3002\u6240\u6709 scoped \u6ce8\u518c\u5728 agent\/created \u548c\u7b2c\u4e00\u4e2a prompt assembly \u524d\u5b8c\u6210\u3002\u5982\u679c setup throw\/rejection\uff0c\u6574\u4e2a scope \u56de\u6eda\uff0c\u4e0d\u53d1\u5e03 session \u6216 agent id\u2014\u2014\u4e0d\u4f1a\u7559\u4e0b\u534a\u521d\u59cb\u5316\u7684 Agent\u3002<\/p>\n<\/li>\n<h4>3.3 Agent Loop \u2014\u2014 \u9ed8\u8ba4\u9a71\u52a8\u5668<\/h4>\n<p>\u6e90\u7801\uff1apackages\/core\/agent-loop\/src\/agent.ts<\/p>\n<p>ReactLoopAgent \u662f Agent \u63a5\u53e3\u7684\u9ed8\u8ba4\u5b9e\u73b0\uff0c\u9a71\u52a8\u4f1a\u8bdd\u7a7f\u8d8a turn \u548c step \u8fb9\u754c\uff1a<\/p>\n<p><span class=\"token keyword\">export<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">ReactLoopAgent<\/span> <span class=\"token keyword\">implements<\/span> <span class=\"token class-name\">Agent<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span><br \/>\n  <span class=\"token keyword\">readonly<\/span> inbox<span class=\"token operator\">:<\/span> Inbox<br \/>\n  <span class=\"token keyword\">private<\/span> phase<span class=\"token operator\">:<\/span> Phase  <span class=\"token comment\">\/\/ \\&#8217;idle\\&#8217; | \\&#8217;maintenance\\&#8217; | \\&#8217;running\\&#8217;<\/span><br \/>\n  <span class=\"token keyword\">readonly<\/span> scope<span class=\"token operator\">:<\/span> Scope<br \/>\n  <span class=\"token keyword\">readonly<\/span> ctx<span class=\"token operator\">:<\/span> Context<\/p>\n<p>  <span class=\"token comment\">\/\/ \u4e09\u79cd\u8f93\u5165\u8def\u5f84<\/span><br \/>\n  <span class=\"token function\">followup<\/span><span class=\"token punctuation\">(<\/span>input<span class=\"token operator\">:<\/span> UserMessage<span class=\"token punctuation\">)<\/span><span class=\"token operator\">:<\/span> <span class=\"token keyword\">void<\/span>  <span class=\"token comment\">\/\/ next-turn, \u5524\u9192<\/span><br \/>\n  <span class=\"token function\">steer<\/span><span class=\"token punctuation\">(<\/span>input<span class=\"token operator\">:<\/span> UserMessage<span class=\"token punctuation\">)<\/span><span class=\"token operator\">:<\/span> <span class=\"token keyword\">void<\/span>     <span class=\"token comment\">\/\/ next-step, \u5524\u9192<\/span><br \/>\n  <span class=\"token function\">inject<\/span><span class=\"token punctuation\">(<\/span>input<span class=\"token operator\">:<\/span> UserMessage<span class=\"token punctuation\">)<\/span><span class=\"token operator\">:<\/span> <span class=\"token keyword\">void<\/span>     <span class=\"token comment\">\/\/ next-step, \u4e0d\u5524\u9192<\/span><\/p>\n<p>  <span class=\"token keyword\">private<\/span> <span class=\"token keyword\">async<\/span> <span class=\"token function\">turn<\/span><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><span class=\"token builtin\">boolean<\/span><span class=\"token operator\">&gt;<\/span>  <span class=\"token comment\">\/\/ \u4e00\u8f6e\u5bf9\u8bdd<\/span><br \/>\n  <span class=\"token keyword\">private<\/span> <span class=\"token keyword\">async<\/span> <span class=\"token function\">step<\/span><span class=\"token punctuation\">(<\/span>assembly<span class=\"token operator\">:<\/span> PromptAssembly<span class=\"token punctuation\">)<\/span><span class=\"token operator\">:<\/span> <span class=\"token builtin\">Promise<\/span><span class=\"token operator\">&lt;<\/span>StepEndReason <span class=\"token operator\">|<\/span> <span class=\"token keyword\">null<\/span><span class=\"token operator\">&gt;<\/span>  <span class=\"token comment\">\/\/ \u4e00\u6b65<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/08\/20260827114832-6a90241050708.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n<p>Turn\/Step \u6d41\u7a0b\u6df1\u5ea6\u89e3\u6790\uff1a<\/p>\n<li>\n<p>turn()\uff1a\u5f00\u542f turn\/start \u4e8b\u4ef6 \u2192 \u8fdb\u5165 step \u5faa\u73af \u2192 \u6bcf\u4e2a step \u8c03\u7528 preStep() \u2192 \u6267\u884c step() \u2192 \u5224\u65ad\u662f\u5426\u7ee7\u7eed \u2192 \u6700\u7ec8 turn\/end\u3002<\/p>\n<\/li>\n<li>\n<p>preStep()\uff1aclaim \u8f93\u5165\u6d88\u606f \u2192 assemble \u7cfb\u7edf\u63d0\u793a\u8bcd \u2192 \u8fd0\u884c agent\/pre-step waterfall\uff08\u53ef reject \u6216\u91cd\u5199\u6d88\u606f\uff09\u3002<\/p>\n<\/li>\n<li>\n<p>step()\uff1a\u7ec4\u88c5 LLM \u8bf7\u6c42 \u2192 \u8fd0\u884c agent\/request waterfall \u2192 llm\/stream waterfall \u2192 \u9010 chunk \u8ffd\u52a0 assistant\/chunk \u2192 \u7ec4\u88c5 assistant\/message \u2192 \u6267\u884c\u5de5\u5177\u8c03\u7528 \u2192 step\/end\u3002<\/p>\n<\/li>\n<li>\n<p>Inbox \u4e09\u901a\u9053\uff08\u8fd9\u662f dsh \u72ec\u7279\u7684\u8bbe\u8ba1\uff09\uff1a<\/p>\n<ul>\n<li>next-turn\uff1a\u6392\u961f\u5230\u4e0b\u4e00\u8f6e\uff08followup\uff09<\/li>\n<li>next-step\uff1a\u6392\u961f\u5230\u5f53\u524d\u8f6e\u7684\u4e0b\u4e00\u6b65\uff08steer\u3001inject\uff09<\/li>\n<li>inject \u4e0d\u5524\u9192 idle driver\uff0c\u53ea\u6709 followup\/steer \u5524\u9192<\/li>\n<\/ul>\n<p>\u5b9e\u6218\u610f\u4e49\uff1ainject \u5141\u8bb8\u4f60\u5728 Agent \u8fd0\u884c\u65f6\u9759\u9ed8\u6ce8\u5165\u4e0a\u4e0b\u6587\uff0c\u4e0d\u6253\u65ad\u5f53\u524d\u6d41\u7a0b\u3002\u8fd9\u5728\u591a Agent \u534f\u4f5c\u4e2d\u975e\u5e38\u6709\u7528\u2014\u2014\u7236 Agent \u53ef\u4ee5\u5411\u5b50 Agent inject \u4e0a\u4e0b\u6587\u800c\u4e0d\u7b49\u5f85\u3002<\/p>\n<\/li>\n<li>\n<p>Phase \u72b6\u6001\u673a\uff1a<\/p>\n<p> idle \u2192 (wake) \u2192 running \u2192 (turn done) \u2192 idle<br \/>\nidle \u2192 (maintenance) \u2192 maintenance \u2192 (done) \u2192 idle<br \/>\nrunning \u2192 (abort) \u2192 running (aborted) \u2192 idle (latch wake)\n <\/li>\n<li>\n<p>\u8bf7\u6c42\u5934\u6301\u4e45\u5316\uff1abuildRequest() \u5728\u6bcf\u4e2a step \u8bb0\u5f55 request\/header\uff08\u521d\u59cb\/resume\/\u53d8\u66f4\uff09\uff0c\u786e\u4fdd\u6a21\u578b\u53ef\u89c1\u7684\u4e00\u5207\u53ef\u4ece\u65e5\u5fd7\u91cd\u5efa\u3002<\/p>\n<\/li>\n<h4>3.4 Tools \u2014\u2014 \u5de5\u5177\u6ce8\u518c\u8868\u4e0e\u6267\u884c\u7ba1\u9053<\/h4>\n<p>\u6e90\u7801\uff1apackages\/core\/tools\/src\/index.ts<\/p>\n<p>ToolRuntime\uff08ctx.tools\uff09\u662f\u6574\u4e2a\u5de5\u5177\u7cfb\u7edf\u7684\u6838\u5fc3\u2014\u2014\u6ce8\u518c\u3001\u67e5\u627e\u3001\u6267\u884c\u3001\u7b56\u7565\u62e6\u622a\u7684\u7edf\u4e00\u5165\u53e3\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/08\/20260827114832-6a9024109faa8.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n<p>\u7ba1\u9053\u5341\u9636\u6bb5\uff08\u6709\u5e8f\u6267\u884c\uff0c\u6bcf\u4e2a\u9636\u6bb5\u90fd\u662f\u53ef\u62e6\u622a\u7684\uff09\uff1a<\/p>\n<table>\n<tr>\n   \u9636\u6bb5<br \/>\n   \u4e8b\u4ef6<br \/>\n   \u7c7b\u578b<br \/>\n   \u80fd\u529b<br \/>\n  <\/tr>\n<tbody>\n<tr>\n<td>1<\/td>\n<td>tool\/call<\/td>\n<td>\u65e5\u5fd7<\/td>\n<td>\u6a21\u578b\u8bf7\u6c42\u5de5\u5177\u8c03\u7528\uff0c\u8bb0\u5f55\u5230\u4f1a\u8bdd\u65e5\u5fd7<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>presentCall(args)<\/td>\n<td>\u7eaf\u51fd\u6570<\/td>\n<td>UI \u6e32\u67d3 pending \u5361\u7247\uff08\u53ef\u7528\u4e8e replay\uff09<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>tools\/pre-execute<\/td>\n<td>waterfall<\/td>\n<td>\u7b56\u7565\u5c42\uff1a\u8fd4\u56de allow\/deny\/ask<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>Monotonic Guards<\/td>\n<td>\u540c\u6b65\u68c0\u67e5<\/td>\n<td>\u4e0d\u53ef\u9006\u62d2\u7edd\u2014\u2014\u4e00\u65e6 deny\uff0c\u540e\u7eed\u65e0\u6cd5\u653e\u884c<\/td>\n<\/tr>\n<tr>\n<td>5<\/td>\n<td>tools\/execute<\/td>\n<td>waterfall<\/td>\n<td>\u53ef\u66ff\u6362 exec.signal\uff08\u65bd\u52a0\u8d85\u65f6\uff09\uff0c\u4fe1\u53f7\u878d\u5408<\/td>\n<\/tr>\n<tr>\n<td>6<\/td>\n<td>execute()<\/td>\n<td>\u5de5\u5177\u4e3b\u4f53<\/td>\n<td>\u8fd4\u56de canonical JSON value<\/td>\n<\/tr>\n<tr>\n<td>7<\/td>\n<td>tools\/post-execute<\/td>\n<td>waterfall<\/td>\n<td>accept\/block\/replace\/addContext<\/td>\n<\/tr>\n<tr>\n<td>8<\/td>\n<td>normalizeResult()<\/td>\n<td>\u4e0d\u53d8\u5f0f<\/td>\n<td>\u5feb\u7167 \u2192 JSON \u9a8c\u8bc1 \u2192 \u51bb\u7ed3<\/td>\n<\/tr>\n<tr>\n<td>9<\/td>\n<td>tools\/result<\/td>\n<td>emit<\/td>\n<td>\u51bb\u7ed3\u7684\u4e0d\u53ef\u53d8\u6700\u7ec8\u7ed3\u679c\u901a\u77e5<\/td>\n<\/tr>\n<tr>\n<td>10<\/td>\n<td>tool\/result<\/td>\n<td>\u65e5\u5fd7<\/td>\n<td>\u6301\u4e45\u5316\u5230\u4f1a\u8bdd\u65e5\u5fd7<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6838\u5fc3\u4ef7\u503c\u70b9\uff1a\u7406\u89e3\u8fd9\u5341\u4e2a\u9636\u6bb5\u662f\u5f00\u53d1 dsh \u63d2\u4ef6\u7684\u5173\u952e\u3002\u7279\u522b\u662f\u7b2c 3 \u9636\u6bb5\uff08pre-execute\uff09\u548c\u7b2c 7 \u9636\u6bb5\uff08post-execute\uff09\u2014\u2014\u5b83\u4eec\u662f\u81ea\u5b9a\u4e49\u5b89\u5168\u7b56\u7565\u548c\u7ed3\u679c\u589e\u5f3a\u7684\u6302\u8f7d\u70b9\u3002\u540e\u9762\u7684 Test Guardian \u63d2\u4ef6\u5c31\u662f\u5229\u7528\u7b2c 3 \u9636\u6bb5\u5b9e\u73b0\u963b\u65ad\u5f0f\u6d4b\u8bd5\u9a8c\u8bc1\u7684\u3002<\/p>\n<p>\u4e09\u4e2a\u9ad8\u7ea7\u8bbe\u8ba1\uff1a<\/p>\n<li>\n<p>Code Mode\uff1amode: \\&#8217;code\\&#8217; \u65f6\uff0c\u6a21\u578b\u53ea\u80fd\u76f4\u63a5\u8c03\u7528 run_code\uff0c\u5176\u4ed6\u5de5\u5177\u901a\u8fc7\u7a0b\u5e8f\u5185 await tools.xxx(args) \u8c03\u7528\u3002\u5b50\u8c03\u7528\u643a\u5e26 parent token\uff0c\u8bb0\u5f55 tool\/code-dispatch \u4e8b\u4ef6\uff0c\u9075\u5b88\u539f\u751f\u8c03\u5ea6\u5951\u7ea6\u3002\u8fd9\u8ba9 Agent \u53ef\u4ee5\u7f16\u5199\u7a0b\u5e8f\u5316\u7684\u5de5\u5177\u8c03\u7528\u903b\u8f91\uff0c\u800c\u4e0d\u662f\u4e00\u6b21\u4e00\u4e2a\u5de5\u5177\u8c03\u7528\u3002<\/p>\n<\/li>\n<li>\n<p>Scoped Shadowing\uff1a\u901a\u8fc7 agent.ctx \u6ce8\u518c\u7684\u5de5\u5177\u4f1a shadow \u540c\u540d\u5168\u5c40\u5de5\u5177\u3002restrict() \u53ef\u5bf9\u5168\u5c40\u5de5\u5177\u96c6\u505a allow\/deny \u8fc7\u6ee4\u3002\u4f60\u53ef\u4ee5\u4e3a\u6bcf\u4e2a Agent \u914d\u7f6e\u4e0d\u540c\u7684\u5de5\u5177\u96c6\u3002<\/p>\n<\/li>\n<li>\n<p>\u5e76\u53d1\u5b89\u5168\uff1a\u5de5\u5177\u58f0\u660e isConcurrencySafe(args) \u8fd4\u56de true \u65f6\uff0c\u53ef\u52a0\u5165 parallel group\u3002\u5426\u5219\u4e3a exclusive\uff08\u6392\u5e8f\u5c4f\u969c\uff09\u3002<\/p>\n<\/li>\n<h4>3.5 defineTool \u2014\u2014 \u7c7b\u578b\u5b89\u5168\u7684\u5de5\u5177\u5b9a\u4e49<\/h4>\n<p>\u6e90\u7801\uff1apackages\/core\/tools\/src\/schema.ts<\/p>\n<p>defineTool \u662f\u4e00\u7b49\u5de5\u5177\u7684\u63a8\u8350\u5b9a\u4e49\u65b9\u5f0f\uff1a<\/p>\n<p><span class=\"token keyword\">export<\/span> <span class=\"token keyword\">function<\/span> <span class=\"token generic-function\"><span class=\"token function\">defineTool<\/span><span class=\"token generic class-name\"><span class=\"token operator\">&lt;<\/span><span class=\"token keyword\">const<\/span> <span class=\"token constant\">S<\/span> <span class=\"token keyword\">extends<\/span> ParameterSchemaSpec<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">const<\/span> <span class=\"token constant\">O<\/span> <span class=\"token keyword\">extends<\/span> ValueSchemaSpec<span class=\"token operator\">&gt;<\/span><\/span><\/span><span class=\"token punctuation\">(<\/span><br \/>\n  options<span class=\"token operator\">:<\/span> DefineToolOptions<span class=\"token operator\">&lt;<\/span><span class=\"token constant\">S<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token constant\">O<\/span><span class=\"token operator\">&gt;<\/span><br \/>\n<span class=\"token punctuation\">)<\/span><span class=\"token operator\">:<\/span> ToolDefinition<\/p>\n<p>\u5b83\u505a\u4e86\u516d\u4ef6\u4e8b\uff1a<\/p>\n<li>\u5c06\u4f5c\u8005\u53cb\u597d\u7684 schema DSL \u7f16\u8bd1\u4e3a raw JSON Schema<\/li>\n<li>\u7f16\u8bd1\u8fc7\u7a0b\u6808\u5b89\u5168\uff08\u8fed\u4ee3\u5f0f\uff0c\u975e\u9012\u5f52\uff09\uff0c\u68c0\u6d4b\u5faa\u73af\u5f15\u7528<\/li>\n<li>InferArgs&lt;S&gt; \u4ece schema \u63a8\u65ad TypeScript \u53c2\u6570\u7c7b\u578b<\/li>\n<li>InferValue&lt;O&gt; \u4ece output schema \u63a8\u65ad\u8fd4\u56de\u503c\u7c7b\u578b<\/li>\n<li>execute \u7684\u53c2\u6570\u81ea\u52a8\u9a8c\u8bc1\uff08validateArgs \u5728 execute \u524d\u8c03\u7528\uff09<\/li>\n<li>presentCall\/presentResult \u8f6f\u9a8c\u8bc1\uff08replay \u65f6\u4e0d throw\uff0c\u56de\u9000\u5230 generic\uff09<\/li>\n<p>\u5b9e\u6218\u793a\u4f8b\uff1a<\/p>\n<p><span class=\"token keyword\">import<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span> readFile <span class=\"token punctuation\">}<\/span> <span class=\"token keyword\">from<\/span> <span class=\"token string\">\\&#8217;node:fs\/promises\\&#8217;<\/span><\/p>\n<p><span class=\"token keyword\">const<\/span> readFileTool <span class=\"token operator\">=<\/span> <span class=\"token function\">defineTool<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">{<\/p>\n<p>   <\/span><br \/>\n  name<span class=\"token operator\">:<\/span> <span class=\"token string\">\\&#8217;read_file\\&#8217;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  description<span class=\"token operator\">:<\/span> <span class=\"token string\">\\&#8217;\u8bfb\u53d6\u6587\u4ef6\u5185\u5bb9\\&#8217;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  parameters<span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span><br \/>\n    path<span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span> type<span class=\"token operator\">:<\/span> <span class=\"token string\">\\&#8217;string\\&#8217;<\/span><span class=\"token punctuation\">,<\/span> description<span class=\"token operator\">:<\/span> <span class=\"token string\">\\&#8217;\u6587\u4ef6\u8def\u5f84\\&#8217;<\/span><span class=\"token punctuation\">,<\/span> required<span class=\"token operator\">:<\/span> <span class=\"token boolean\">true<\/span> <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    encoding<span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span> type<span class=\"token operator\">:<\/span> <span class=\"token string\">\\&#8217;string\\&#8217;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">default<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">\\&#8217;utf-8\\&#8217;<\/span> <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  output<span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span><br \/>\n    type<span class=\"token operator\">:<\/span> <span class=\"token string\">\\&#8217;object\\&#8217;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    properties<span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span><br \/>\n      content<span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span> type<span class=\"token operator\">:<\/span> <span class=\"token string\">\\&#8217;string\\&#8217;<\/span> <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span><br \/>\n      size<span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span> type<span class=\"token operator\">:<\/span> <span class=\"token string\">\\&#8217;number\\&#8217;<\/span> <span class=\"token punctuation\">}<\/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><span class=\"token punctuation\">,<\/span><br \/>\n  <span class=\"token keyword\">async<\/span> <span class=\"token function\">execute<\/span><span class=\"token punctuation\">(<\/span>args<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span><br \/>\n    <span class=\"token comment\">\/\/ args \u7c7b\u578b\u7531 InferArgs \u81ea\u52a8\u63a8\u65ad<\/span><br \/>\n    <span class=\"token comment\">\/\/ args.path: string (required)<\/span><br \/>\n    <span class=\"token comment\">\/\/ args.encoding: string (default \\&#8217;utf-8\\&#8217;)<\/span><br \/>\n    <span class=\"token keyword\">const<\/span> content <span class=\"token operator\">=<\/span> <span class=\"token keyword\">await<\/span> <span class=\"token function\">readFile<\/span><span class=\"token punctuation\">(<\/span>args<span class=\"token punctuation\">.<\/span>path<span class=\"token punctuation\">,<\/span> args<span class=\"token punctuation\">.<\/span>encoding <span class=\"token keyword\">as<\/span> BufferEncoding<span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span> content<span class=\"token punctuation\">,<\/span> size<span class=\"token operator\">:<\/span> content<span class=\"token punctuation\">.<\/span>length <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>\u6ce8\u610f\uff1aargs.encoding \u7684\u7c7b\u578b\u662f string\uff0c\u800c readFile \u7684\u7b2c\u4e8c\u4e2a\u53c2\u6570\u7c7b\u578b\u662f BufferEncoding\uff08\\&#8217;utf-8\\&#8217; | \\&#8217;ascii\\&#8217; | &#8230;\uff09\u3002\u5728 strict \u6a21\u5f0f\u4e0b\u9700\u8981\u663e\u5f0f\u65ad\u8a00 as BufferEncoding\u3002\u8fd9\u662f TypeScript strict \u6a21\u5f0f\u4e0b\u7c7b\u578b\u5b89\u5168\u7684\u6b63\u786e\u505a\u6cd5\u2014\u2014\u4e0d\u5728\u6846\u67b6\u8fb9\u754c\u505a\u9690\u5f0f\u8f6c\u6362\u3002<\/p>\n<hr>\n<h3>\u56db\u3001Capability Seam \u8bbe\u8ba1\u6a21\u5f0f<\/h3>\n<p>\u8fd9\u662f dsh \u6700\u6838\u5fc3\u7684\u67b6\u6784\u6a21\u5f0f\uff0c\u4e5f\u662f\u5b83\u533a\u522b\u4e8e\u5176\u4ed6 Agent \u6846\u67b6\u7684\u5173\u952e\u3002<\/p>\n<h4>4.1 \u4e09\u89d2\u8272\u5206\u79bb<\/h4>\n<p>\u4e00\u4e2a Capability Seam \u7531\u4e09\u4e2a\u72ec\u7acb\u89d2\u8272\u7ec4\u6210\uff1a<\/p>\n<table>\n<tr>\n   \u89d2\u8272<br \/>\n   \u804c\u8d23<br \/>\n   \u793a\u4f8b<br \/>\n  <\/tr>\n<tbody>\n<tr>\n<td>Service Definition<\/td>\n<td>\u58f0\u660e\u63a5\u53e3\u548c ctx.&lt;key&gt;<\/td>\n<td>dsh-shell\uff08ShellExecutor \u62bd\u8c61\u7c7b\uff09<\/td>\n<\/tr>\n<tr>\n<td>Service Provider<\/td>\n<td>\u5b9e\u73b0\u63a5\u53e3<\/td>\n<td>dsh-bash-local \/ dsh-bash-sandbox<\/td>\n<\/tr>\n<tr>\n<td>Consumer<\/td>\n<td>\u4f7f\u7528\u670d\u52a1<\/td>\n<td>dsh-tool-bash\uff08\u6a21\u578b\u53ef\u89c1\u7684 bash \u5de5\u5177\uff09<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e3a\u4ec0\u4e48\u4e09\u89d2\u8272\u5206\u79bb\u662f\u5173\u952e\uff1a\u5f53\u4e00\u4e2a provider swap \u65f6\uff0c\u6574\u4e2a\u4ea7\u54c1\u884c\u4e3a\u6539\u53d8\u3002\u4f8b\u5982\uff0c\u5c06 ctx.fs \u4ece fs-local \u6362\u6210 fs-e2b\uff08\u8fdc\u7a0b\u6c99\u7bb1\uff09\uff0cBash\u3001PTY\u3001LSP \u90fd\u8ddf\u7740\u8fc1\u79fb\u5230\u8fdc\u7a0b Linux \u8fd0\u884c\u65f6\uff0c\u96f6 provider fork\u3002<\/p>\n<p>\u8fd9\u4e0d\u662f\u7406\u8bba\u2014\u2014\u8fd9\u662f dsh \u7684\u5b9e\u9645\u80fd\u529b\u3002\u4f60\u53ef\u4ee5\u7528\u540c\u4e00\u5957 Consumer \u4ee3\u7801\uff0c\u5728\u672c\u5730\u3001Docker \u6c99\u7bb1\u3001E2B \u8fdc\u7a0b\u6c99\u7bb1\u4e4b\u95f4\u65e0\u7f1d\u5207\u6362\u3002<\/p>\n<h4>4.2 \u5b8c\u6574\u7684 Capability Seam \u5217\u8868<\/h4>\n<table>\n<tr>\n   ctx key<br \/>\n   \u89d2\u8272<br \/>\n   \u5b9e\u73b0\u5305<br \/>\n  <\/tr>\n<tbody>\n<tr>\n<td>ctx.llm<\/td>\n<td>seam<\/td>\n<td>llm-deepseek \/ llm-pi-ai \/ llm-replay<\/td>\n<\/tr>\n<tr>\n<td>ctx.fs<\/td>\n<td>seam<\/td>\n<td>fs-local \/ fs-sandbox \/ fs-e2b<\/td>\n<\/tr>\n<tr>\n<td>ctx.shell<\/td>\n<td>seam<\/td>\n<td>bash-local \/ bash-sandbox \/ pwsh-local<\/td>\n<\/tr>\n<tr>\n<td>ctx.subprocess<\/td>\n<td>seam<\/td>\n<td>subprocess-local \/ subprocess-e2b<\/td>\n<\/tr>\n<tr>\n<td>ctx.terminals<\/td>\n<td>seam<\/td>\n<td>terminal-bash<\/td>\n<\/tr>\n<tr>\n<td>ctx.sandbox<\/td>\n<td>seam<\/td>\n<td>sandbox-local<\/td>\n<\/tr>\n<tr>\n<td>ctx.web<\/td>\n<td>seam<\/td>\n<td>web-search-exa \/ web-search-perplexity \/ web-search-deepseek \/ web-fetch-http<\/td>\n<\/tr>\n<tr>\n<td>ctx.compaction<\/td>\n<td>seam<\/td>\n<td>compaction-basic<\/td>\n<\/tr>\n<tr>\n<td>ctx.subagents<\/td>\n<td>seam<\/td>\n<td>spawn-in-process \/ fork-in-process \/ acp \/ codex \/ claude-code \/ dsh-sdk<\/td>\n<\/tr>\n<tr>\n<td>ctx.approval<\/td>\n<td>seam<\/td>\n<td>acp<\/td>\n<\/tr>\n<tr>\n<td>ctx.codeRuntime<\/td>\n<td>seam<\/td>\n<td>code-runtime-worker<\/td>\n<\/tr>\n<tr>\n<td>ctx.lsp<\/td>\n<td>seam<\/td>\n<td>lsp-local<\/td>\n<\/tr>\n<tr>\n<td>ctx.skills<\/td>\n<td>seam<\/td>\n<td>skill-badge \/ skill-filesystem<\/td>\n<\/tr>\n<tr>\n<td>ctx.jobs<\/td>\n<td>seam<\/td>\n<td>jobs-local<\/td>\n<\/tr>\n<tr>\n<td>ctx.sessionPersistence<\/td>\n<td>seam<\/td>\n<td>session-persistence-jsonl \/ session-persistence-sqlite<\/td>\n<\/tr>\n<tr>\n<td>ctx.storage<\/td>\n<td>seam<\/td>\n<td>storage-json \/ storage-sqlite<\/td>\n<\/tr>\n<tr>\n<td>ctx.workflowEngine<\/td>\n<td>seam<\/td>\n<td>workflow-worker-thread<\/td>\n<\/tr>\n<tr>\n<td>ctx.spillStore<\/td>\n<td>seam<\/td>\n<td>spill-local<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6838\u5fc3\u4ef7\u503c\u70b9\uff1a\u8fd9\u5f20\u8868\u662f dsh \u67b6\u6784\u7684\\&#8221;\u5730\u56fe\\&#8221;\u3002\u5f53\u4f60\u60f3\u8981\u6269\u5c55\u67d0\u4e2a\u80fd\u529b\u65f6\uff0c\u5148\u627e\u5230\u5bf9\u5e94\u7684 seam\uff0c\u7136\u540e\u5b9e\u73b0 Service Provider \u63a5\u53e3\u3002\u4e0d\u9700\u8981\u4fee\u6539 Consumer \u4ee3\u7801\u3002<\/p>\n<hr>\n<h3>\u4e94\u3001Profile \u548c Bundle \u7ec4\u5408\u673a\u5236<\/h3>\n<p>dsh \u7684\u8fd0\u884c\u65f6\u662f\u4e00\u4e2a\u4ece\u542f\u52a8\u65f6\u7ec4\u5408\u7684\u63d2\u4ef6\u6811\u3002<\/p>\n<ul>\n<li>Profile\uff1a\u5b58\u50a8\u5728 Harness home \u4e2d\u7684\u547d\u540d\u7ec4\u5408\u3002\u5217\u51fa\u5b83\u5806\u53e0\u7684 bundle\u3001\u6301\u6709\u7684 out-of-tree \u63d2\u4ef6\u3001\u7528\u6237\u7684 cordis.patch.yml\u3002web \u548c headless \u4f5c\u4e3a\u6a21\u677f\u968f\u4ea7\u54c1\u5206\u53d1\u3002<\/li>\n<li>Bundle\uff1aCordis \u914d\u7f6e\u884c\u548c\u5176\u6240\u6302\u8f7d\u4ee3\u7801\u7684\u5206\u53d1\u683c\u5f0f\u3002\u6bcf\u4e2a\u5728 package.json \u7684 dsh \u5b57\u6bb5\u58f0\u660e\u81ea\u5df1\u3002<\/li>\n<\/ul>\n<p>\u7ec4\u5408\u987a\u5e8f\uff08\u4ece\u7a7a\u5230\u6ee1\uff09\uff1a<\/p>\n<li>Profile \u4e2d\u5404 bundle \u7684\u58f0\u660e\u987a\u5e8f<\/li>\n<li>Profile \u7684 cordis.patch.yml<\/li>\n<li>Home \u7ea7 cordis.patch.yml<\/li>\n<li>&#8211;patch \u8986\u76d6<\/li>\n<p><span class=\"token comment\"># \u67e5\u770b\u5b9e\u9645\u542f\u52a8\u7684\u63d2\u4ef6\u6811<\/span><br \/>\ndsh <span class=\"token parameter variable\">&#8211;profile<\/span> web &#8211;dump-config<\/p>\n<p>dsh-base \u662f\u6bcf\u4e2a profile \u7684\u7b2c\u4e00\u5c42\uff1a\u6a21\u578b\u9002\u914d\u5668\u3001\u5de5\u5177\u3001\u6301\u4e45\u5316\u3001\u6c99\u7bb1\u548c\u6279\u51c6\u7b56\u7565\u3001\u8bbe\u7f6e\u3001\u51ed\u636e\u3001\u9065\u6d4b\u3002dsh-web-app \u6dfb\u52a0\u6d4f\u89c8\u5668\u5e94\u7528\uff1bdsh-headless \u6dfb\u52a0\u65e0\u670d\u52a1\u5668\u7684\u5355\u6b21\u8fd0\u884c\u5668\u3002<\/p>\n<p>\u5b9e\u6218\u6280\u5de7\uff1a\u5728\u5f00\u53d1\u81ea\u5b9a\u4e49\u63d2\u4ef6\u65f6\uff0c\u5148\u521b\u5efa\u4e00\u4e2a cordis.patch.yml \u6765\u8986\u76d6\u9ed8\u8ba4\u914d\u7f6e\uff0c\u800c\u4e0d\u662f\u4fee\u6539 bundle \u6e90\u7801\u3002\u8fd9\u6837\u4f60\u7684\u5b9a\u5236\u662f\u53ef\u9006\u7684\u3001\u53ef\u8ffd\u8e2a\u7684\u3002<\/p>\n<hr>\n<h3>\u516d\u3001\u6301\u4e45\u5316\u4e0e\u53ef\u6062\u590d\u6027<\/h3>\n<h4>6.1 JSONL \u6301\u4e45\u5316<\/h4>\n<p>dsh-session-persistence-jsonl \u5c06\u4f1a\u8bdd\u4e8b\u4ef6\u6d41\u5f0f\u5199\u5165 .jsonl \u6587\u4ef6\uff08\u6bcf\u884c\u4e00\u4e2a JSON \u4e8b\u4ef6\uff09\u3002\u652f\u6301 zstd \u538b\u7f29\u3002\u6587\u4ef6\u5b58\u50a8\u5728 root\uff08\u9ed8\u8ba4 .sessions\uff09\u76ee\u5f55\u4e0b\u3002<\/p>\n<p>\u9002\u7528\u573a\u666f\uff1a\u5f00\u53d1\u73af\u5883\u3001\u5c0f\u89c4\u6a21\u90e8\u7f72\u3002\u6bcf\u4e2a\u4f1a\u8bdd\u4e00\u4e2a\u6587\u4ef6\uff0c\u4fbf\u4e8e\u8c03\u8bd5\u548c\u67e5\u770b\u3002<\/p>\n<h4>6.2 SQLite \u6301\u4e45\u5316<\/h4>\n<p>dsh-session-persistence-sqlite \u4f7f\u7528 SQLite \u7684\u5355\u8c03 SCHEMA_VERSION \u6301\u4e45\u5316\u4f1a\u8bdd\u4e8b\u4ef6\u3002\u652f\u6301\u5168\u6587\u672c\u641c\u7d22\u548c\u8fc7\u6ee4\u3002<\/p>\n<p>\u9002\u7528\u573a\u666f\uff1a\u751f\u4ea7\u73af\u5883\u3002\u7d22\u5f15\u67e5\u8be2\u80fd\u529b\u5f3a\uff0c\u652f\u6301\u4f1a\u8bdd\u641c\u7d22\u548c\u6279\u91cf\u7ba1\u7406\u3002<\/p>\n<h4>6.3 \u6062\u590d\u6d41\u7a0b<\/h4>\n<p>AgentRegistry.resume(options)<br \/>\n  \u2192 ctx.sessionPersistence.prepare<br \/>\n    \u2192 \u52a0\u8f7d\u4e8b\u4ef6<br \/>\n    \u2192 \u6784\u9020 Session.fromRestore()<br \/>\n    \u2192 mint agentCtx<br \/>\n    \u2192 await setup<br \/>\n    \u2192 \u53d1\u5e03<br \/>\n    \u2192 \u542f\u52a8\u5faa\u73af<\/p>\n<p>\u6062\u590d\u662f\u5b8c\u6574\u7684\u2014\u2014\u4e0d\u4ec5\u6062\u590d\u4f1a\u8bdd\u65e5\u5fd7\uff0c\u8fd8\u91cd\u5efa Agent \u7684 scoped world\uff08\u5de5\u5177\u3001prompt section\u3001listener\uff09\u3002\u8fd9\u610f\u5473\u7740\u4e00\u4e2a\u88ab\u6062\u590d\u7684 Agent \u53ef\u4ee5\u7acb\u5373\u7ee7\u7eed\u5de5\u4f5c\uff0c\u884c\u4e3a\u4e0e\u88ab\u4e2d\u65ad\u524d\u5b8c\u5168\u4e00\u81f4\u3002<\/p>\n<hr>\n<h3>\u4e03\u3001Python SDK<\/h3>\n<p>dsh \u7684 Node.js \u4fa7\u901a\u8fc7 @deepseek-ai\/dsh-cordis-client-runner \u63d0\u4f9b JSON-RPC over stdio \u63a5\u53e3\u3002Python \u4fa7\u901a\u8fc7 deepseek-harness PyPI \u5305\u63d0\u4f9b\u534f\u8bae\u611f\u77e5\u7684 API \u5ba2\u6237\u7aef\u3002<\/p>\n<p>\u6ce8\u610f\uff1adeepseek-harness Python \u5305\uff08v0.2.0\uff09\u662f\u4e00\u4e2a DeepSeek V4 API \u5ba2\u6237\u7aef\u5c01\u88c5\uff0c\u63d0\u4f9b\u534f\u8bae\u5c42\u9762\u7684\u5b89\u5168\u9632\u62a4\uff08tool call salvage\u3001reasoning content \u4fdd\u7559\u3001cache \u5b57\u6bb5\u89c4\u8303\u5316\uff09\uff0c\u4e0d\u662f dsh Agent \u6846\u67b6\u7684 Python \u7ed1\u5b9a\u3002\u5982\u9700\u901a\u8fc7 Python \u8c03\u7528 dsh Agent \u529f\u80fd\uff0c\u9700\u8981\u76f4\u63a5\u4f7f\u7528 dsh &#8211;profile headless CLI \u5e76\u89e3\u6790\u8f93\u51fa\u3002<\/p>\n<h4>7.1 DeepSeekHarness \u2014 DeepSeek V4 \u534f\u8bae\u611f\u77e5\u5ba2\u6237\u7aef<\/h4>\n<p><span class=\"token keyword\">from<\/span> deepseek_harness <span class=\"token keyword\">import<\/span> DeepSeekHarness<\/p>\n<p><span class=\"token comment\"># DeepSeekHarness \u662f OpenAI SDK \u7684\u534f\u8bae\u5b89\u5168\u5c01\u88c5<\/span><br \/>\n<span class=\"token comment\"># \u6784\u9020\u51fd\u6570\u7b7e\u540d\uff1a(api_key, base_url, *, salvage_tool_calls, normalize_cache_fields, &#8230;)<\/span><br \/>\nharness <span class=\"token operator\">=<\/span> DeepSeekHarness<span class=\"token punctuation\">(<\/span><br \/>\n    api_key<span class=\"token operator\">=<\/span><span class=\"token string\">\\&#8221;your-key\\&#8221;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token comment\"># base_url \u9ed8\u8ba4 https:\/\/api.deepseek.com<\/span><br \/>\n    disable_thinking_by_default<span class=\"token operator\">=<\/span><span class=\"token boolean\">False<\/span><span class=\"token punctuation\">,<\/span>  <span class=\"token comment\"># \u6210\u672c\u654f\u611f\u90e8\u7f72\u53ef\u8bbe True<\/span><br \/>\n<span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token comment\"># \u63a5\u53e3\u4e0e OpenAI SDK \u5b8c\u5168\u4e00\u81f4\uff1a<\/span><br \/>\nresponse <span class=\"token operator\">=<\/span> harness<span class=\"token punctuation\">.<\/span>chat<span class=\"token punctuation\">.<\/span>completions<span class=\"token punctuation\">.<\/span>create<span class=\"token punctuation\">(<\/span><br \/>\n    model<span class=\"token operator\">=<\/span><span class=\"token string\">\\&#8221;deepseek-v4-flash\\&#8221;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    messages<span class=\"token operator\">=<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">{<\/p>\n<p>   <\/span><span class=\"token string\">\\&#8221;role\\&#8221;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token string\">\\&#8221;user\\&#8221;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">\\&#8221;content\\&#8221;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token string\">\\&#8221;\u89e3\u91ca\u8fd9\u6bb5\u4ee3\u7801\\&#8221;<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span><br \/>\n<span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span>response<span class=\"token punctuation\">.<\/span>choices<span class=\"token punctuation\">[<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">.<\/span>message<span class=\"token punctuation\">.<\/span>content<span class=\"token punctuation\">)<\/span><\/p>\n<p>DeepSeekHarness \u5728\u6bcf\u6b21\u8bf7\u6c42\u4e2d\u81ea\u52a8\u6267\u884c\u4e09\u5c42\u5b89\u5168\u9632\u62a4\uff1a<\/p>\n<ul>\n<li>from_deepseek_response\uff1a\u4fdd\u7559 reasoning_content \u5b57\u6bb5<\/li>\n<li>salvage_tool_calls_from_content\uff1a\u4fee\u590d\u7ea6 11% \u7684 tool call \u6cc4\u6f0f\uff08\u5de5\u5177\u8c03\u7528\u88ab\u9519\u8bef\u5730\u653e\u5728 content \u800c\u975e tool_calls \u4e2d\uff09<\/li>\n<li>normalize_usage\uff1a\u89c4\u8303\u5316\u4e24\u79cd cache-hit \u5b57\u6bb5\u683c\u5f0f\u5e76\u8865\u5145\u6210\u672c\u4f30\u7b97<\/li>\n<\/ul>\n<h4>7.2 \u9ad8\u7ea7\u529f\u80fd<\/h4>\n<p><span class=\"token keyword\">from<\/span> deepseek_harness <span class=\"token keyword\">import<\/span> <span class=\"token punctuation\">(<\/span><br \/>\n    DeepSeekHarness<span class=\"token punctuation\">,<\/span><br \/>\n    normalize_usage<span class=\"token punctuation\">,<\/span><br \/>\n    estimate_cache_hit<span class=\"token punctuation\">,<\/span><br \/>\n    ReasoningLifecycle<span class=\"token punctuation\">,<\/span><br \/>\n    salvage_tool_calls_from_content<span class=\"token punctuation\">,<\/span><br \/>\n<span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token comment\"># \u6d41\u5f0f\u8bf7\u6c42\u2014\u2014ReasoningLifecycle \u7ba1\u7406 thinking \u5757<\/span><br \/>\nharness <span class=\"token operator\">=<\/span> DeepSeekHarness<span class=\"token punctuation\">(<\/span>api_key<span class=\"token operator\">=<\/span><span class=\"token string\">\\&#8221;your-key\\&#8221;<\/span><span class=\"token punctuation\">)<\/span><br \/>\nstream <span class=\"token operator\">=<\/span> harness<span class=\"token punctuation\">.<\/span>chat<span class=\"token punctuation\">.<\/span>completions<span class=\"token punctuation\">.<\/span>create<span class=\"token punctuation\">(<\/span><br \/>\n    model<span class=\"token operator\">=<\/span><span class=\"token string\">\\&#8221;deepseek-v4-pro\\&#8221;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    messages<span class=\"token operator\">=<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">{<\/p>\n<p>   <\/span><span class=\"token string\">\\&#8221;role\\&#8221;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token string\">\\&#8221;user\\&#8221;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">\\&#8221;content\\&#8221;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token string\">\\&#8221;\u5206\u6790\u8fd9\u6bb5\u4ee3\u7801\\&#8221;<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    stream<span class=\"token operator\">=<\/span><span class=\"token boolean\">True<\/span><span class=\"token punctuation\">,<\/span><br \/>\n<span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">for<\/span> chunk <span class=\"token keyword\">in<\/span> stream<span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span>chunk<span class=\"token punctuation\">.<\/span>choices<span class=\"token punctuation\">[<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">.<\/span>delta<span class=\"token punctuation\">.<\/span>content<span class=\"token punctuation\">,<\/span> end<span class=\"token operator\">=<\/span><span class=\"token string\">\\&#8221;\\&#8221;<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>\u6838\u5fc3\u8bbe\u8ba1\uff1a<\/p>\n<ul>\n<li>\u534f\u8bae\u5b89\u5168\uff1a\u81ea\u52a8\u4fee\u590d DeepSeek V4 \u5df2\u77e5\u7684 11 \u79cd\u534f\u8bae\u5f02\u5e38\uff08tool call \u6cc4\u6f0f\u3001\u7a7a\u7ec8\u5757\u3001cache \u5b57\u6bb5\u4e0d\u4e00\u81f4\u7b49\uff09<\/li>\n<li>\u6210\u672c\u63a7\u5236\uff1adisable_thinking_by_default=True \u53ef\u5728\u7b80\u5355\u8bf7\u6c42\u4e2d\u7981\u7528 reasoning token\uff08\u9ed8\u8ba4 V4-Pro \u4f1a\u5bf9\u6bcf\u4e2a\u8bf7\u6c42\u4ea7\u751f\u7ea6 30 reasoning tokens \u7684\u8d39\u7528\uff09<\/li>\n<li>\u5f02\u5e38\u7c7b\u578b\uff1aHarnessError\u3001ReasoningContentMissingError\u3001ToolCallLeakageError\u3001StrictModeCorruptionError\u3001StreamShapeError<\/li>\n<\/ul>\n<hr>\n<h3>\u516b\u3001Landlock \u6c99\u7bb1<\/h3>\n<p>@deepseek-ai\/node-addon-landlock-run \u662f\u4e00\u4e2a Linux \u539f\u751f C11 \u7a0b\u5e8f\uff08\u7ea6 300 \u884c\uff09\uff0c\u4f7f\u7528 Landlock \u5185\u6838 UAPI \u5b9e\u73b0\u81ea\u9650\u5236\u540e\u6267\u884c\uff1a<\/p>\n<li>\u5728\u81ea\u8eab\u5b89\u88c5 Landlock ruleset<\/li>\n<li>execve \u88ab\u5305\u88c5\u7684\u547d\u4ee4<\/li>\n<li>ruleset \u8de8 execve \u7ee7\u627f\uff0c\u56e0\u6b64\u547d\u4ee4\u548c\u6240\u6709\u5b50\u8fdb\u7a0b\u90fd\u88ab\u9650\u5236<\/li>\n<li>\u8c03\u7528\u8fdb\u7a0b\u4e0d\u53d7\u9650\u5236<\/li>\n<li>Fail-closed\uff1a\u5185\u6838\u65e0\u6cd5\u6267\u884c\u65f6\uff0c\u4e0d\u8fd0\u884c\u547d\u4ee4\u76f4\u63a5\u9000\u51fa<\/li>\n<p><span class=\"token keyword\">import<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span> grantArgs<span class=\"token punctuation\">,<\/span> launcherPath<span class=\"token punctuation\">,<\/span> probe <span class=\"token punctuation\">}<\/span> <span class=\"token keyword\">from<\/span> <span class=\"token string\">\\&#8217;@deepseek-ai\/node-addon-landlock-run\\&#8217;<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token keyword\">const<\/span> launcher <span class=\"token operator\">=<\/span> <span class=\"token function\">launcherPath<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token function\">probe<\/span><span class=\"token punctuation\">(<\/span>launcher<span class=\"token punctuation\">)<\/span> <span class=\"token operator\">!==<\/span> <span class=\"token string\">\\&#8217;unusable\\&#8217;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span><br \/>\n  <span class=\"token keyword\">const<\/span> argv <span class=\"token operator\">=<\/span> <span class=\"token punctuation\">[<\/span><br \/>\n    launcher<span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token operator\">&#8230;<\/span><span class=\"token function\">grantArgs<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">{<\/p>\n<p>   <\/span> <span class=\"token literal-property property\">readOnly<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token string\">\\&#8217;\/\\&#8217;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token literal-property property\">readWrite<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token string\">\\&#8217;\/tmp\/work\\&#8217;<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token string\">\\&#8217;&#8211;\\&#8217;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">\\&#8217;bash\\&#8217;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">\\&#8217;-c\\&#8217;<\/span><span class=\"token punctuation\">,<\/span> command<br \/>\n  <span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span><br \/>\n  <span class=\"token comment\">\/\/ spawn argv<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u652f\u6301 linux-x64 \u548c linux-arm64\uff0c\u5185\u6838 5.13+\u3002\u5176\u4ed6\u5e73\u53f0\u4f7f\u7528\u4e0d\u540c\u7684\u9650\u5236\u540e\u7aef\uff08macOS \u7528 sandbox-exec\uff0cWindows \u7528 ACL restricted-token\uff09\u3002<\/p>\n<p>\u5b89\u5168\u6d1e\u5bdf\uff1aLandlock \u7684\u5173\u952e\u4f18\u52bf\u662f\u5b50\u8fdb\u7a0b\u7ee7\u627f\u9650\u5236\u3002\u5373\u4f7f Agent \u901a\u8fc7 shell \u542f\u52a8\u4e86\u4e00\u4e2a\u5b50\u8fdb\u7a0b\uff0c\u5b50\u8fdb\u7a0b\u4e5f\u53d7\u540c\u6837\u7684\u6587\u4ef6\u7cfb\u7edf\u9650\u5236\u3002\u8fd9\u6bd4\u5e94\u7528\u7ea7\u7684\u6743\u9650\u68c0\u67e5\u66f4\u53ef\u9760\u2014\u2014\u5b83\u662f\u5185\u6838\u7ea7\u7684\u3002<\/p>\n<hr>\n<h3>\u4e5d\u3001\u5b9e\u6218\uff1aTest Guardian \u6d4b\u8bd5\u5b88\u62a4 Agent<\/h3>\n<p>\u8fd9\u662f\u672c\u6587\u7684\u6838\u5fc3\u5b9e\u6218\u90e8\u5206\u3002\u6211\u4eec\u5c06\u7f16\u5199\u4e00\u4e2a\u9ad8\u4ef7\u503c\u63d2\u4ef6\uff0c\u89e3\u51b3 AI Agent \u7f16\u7a0b\u4e2d\u7684\u771f\u5b9e\u75db\u70b9\uff1aAgent \u4fee\u6539\u4ee3\u7801\u540e\uff0c\u5982\u4f55\u786e\u4fdd\u4e0d\u5f15\u5165\u56de\u5f52\uff1f<\/p>\n<p>\u4e3a\u4ec0\u4e48\u8fd9\u4e2a\u63d2\u4ef6\u503c\u94b1\uff1f \u5728 AI \u7f16\u7a0b\u5de5\u5177\uff08Cursor\u3001Copilot\u3001Devin\u3001dsh\uff09\u7684\u5b9e\u8df5\u4e2d\uff0cAgent \u751f\u6210\u7684\u4ee3\u7801\u7ea6 15-30% \u5b58\u5728\u9690\u6027\u56de\u5f52\u2014\u2014\u5355\u5143\u6d4b\u8bd5\u4e0d\u901a\u8fc7\u3001\u5bfc\u5165\u8def\u5f84\u65ad\u88c2\u3001\u63a5\u53e3\u7b7e\u540d\u4e0d\u5339\u914d\u3002\u73b0\u6709\u65b9\u6848\u4f9d\u8d56\u4eba\u5de5 review \u6216 post-hoc CI\uff0c\u53cd\u9988\u5468\u671f\u957f\u3001\u6210\u672c\u9ad8\u3002Test Guardian \u5c06\u6d4b\u8bd5\u9a8c\u8bc1\u524d\u7f6e\u5230\u4ee3\u7801\u5199\u5165\u7684\u77ac\u95f4\uff1aAgent \u5199\u4ee3\u7801 \u2192 \u81ea\u52a8\u8dd1\u53d7\u5f71\u54cd\u6d4b\u8bd5 \u2192 \u4e0d\u901a\u8fc7\u5c31\u963b\u65ad\uff0c\u4e0d\u5141\u8bb8\u574f\u4ee3\u7801\u843d\u76d8\u3002\u8fd9\u4e2a\u63d2\u4ef6\u53ef\u4ee5\u76f4\u63a5\u90e8\u7f72\u5230\u4efb\u4f55\u4f7f\u7528 dsh \u7684\u751f\u4ea7\u73af\u5883\u4e2d\uff0c\u5c06 AI \u7f16\u7a0b\u7684\u4ee3\u7801\u8d28\u91cf\u4ece\\&#8221;\u4e8b\u540e\u515c\u5e95\\&#8221;\u5347\u7ea7\u4e3a\\&#8221;\u4e8b\u524d\u62e6\u622a\\&#8221;\u3002<\/p>\n<h4>9.1 \u95ee\u9898\u5206\u6790\uff1a\u4e3a\u4ec0\u4e48\u4e0d\u662f\\&#8221;\u4ee3\u7801\u5ba1\u67e5\\&#8221;\uff1f<\/h4>\n<p>\u521d\u7248\u65b9\u6848\u662f\u4e00\u4e2a\u57fa\u4e8e tools\/result \u4e8b\u4ef6\u76d1\u542c\u7684\u4ee3\u7801\u5ba1\u67e5\u63d2\u4ef6\u3002\u5b83\u5b58\u5728\u56db\u4e2a\u6839\u672c\u5c40\u9650\uff1a<\/p>\n<table>\n<tr>\n   \u5c40\u9650<br \/>\n   \u539f\u56e0<br \/>\n   \u540e\u679c<br \/>\n  <\/tr>\n<tbody>\n<tr>\n<td>\u5355\u6587\u4ef6\u89c6\u89d2<\/td>\n<td>\u53ea\u5ba1\u67e5\u88ab\u4fee\u6539\u6587\u4ef6\u672c\u8eab\u7684 diff<\/td>\n<td>\u65e0\u6cd5\u53d1\u73b0\u8de8\u6587\u4ef6\u7684\u56de\u5f52<\/td>\n<\/tr>\n<tr>\n<td>\u975e\u963b\u65ad\u5f0f\u53cd\u9988<\/td>\n<td>\u4f7f\u7528 tools\/result\uff08emit \u4e8b\u4ef6\uff09\uff0c\u64cd\u4f5c\u5df2\u7ecf\u5b8c\u6210<\/td>\n<td>Agent \u53ef\u80fd\u5ffd\u7565\u53cd\u9988\u76f4\u63a5\u7ed3\u675f<\/td>\n<\/tr>\n<tr>\n<td>\u65e0\u7f13\u5b58<\/td>\n<td>\u6bcf\u6b21\u91cd\u65b0\u5206\u6790\u5168\u90e8\u6587\u4ef6<\/td>\n<td>\u91cd\u590d\u5de5\u4f5c\uff0c\u6027\u80fd\u6d6a\u8d39<\/td>\n<\/tr>\n<tr>\n<td>\u5ba1\u67e5\u4e3b\u89c2\u6027<\/td>\n<td>LLM \u5ba1\u67e5\u662f\u4e3b\u89c2\u5224\u65ad<\/td>\n<td>\\&#8221;\u5ba1\u67e5\u6df1\u5ea6\u4e0d\u591f\\&#8221;\u662f\u56fa\u6709\u95ee\u9898<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Test Guardian \u7684\u91cd\u65b0\u8bbe\u8ba1\uff1a<\/p>\n<table>\n<tr>\n   \u5c40\u9650<br \/>\n   \u89e3\u51b3\u65b9\u6848<br \/>\n   \u673a\u5236<br \/>\n  <\/tr>\n<tbody>\n<tr>\n<td>\u5355\u6587\u4ef6\u89c6\u89d2 \u2192 \u89e3\u51b3<\/td>\n<td>\u53cc\u5411 import \u4f9d\u8d56\u56fe + BFS \u4f20\u9012\u95ed\u5305<\/td>\n<td>DependencyGraphManager<\/td>\n<\/tr>\n<tr>\n<td>\u975e\u963b\u65ad\u5f0f \u2192 \u89e3\u51b3<\/td>\n<td>\u6539\u7528 tools\/pre-execute waterfall<\/td>\n<td>\u8fd4\u56de { verdict: \\&#8217;deny\\&#8217; } \u77ed\u8def<\/td>\n<\/tr>\n<tr>\n<td>\u65e0\u7f13\u5b58 \u2192 \u89e3\u51b3<\/td>\n<td>\u4f9d\u8d56\u56fe + \u6587\u4ef6\u54c8\u5e0c\u6301\u4e45\u5316\u5230 ctx.storage<\/td>\n<td>\u589e\u91cf\u66f4\u65b0\uff0c\u91cd\u542f\u6062\u590d<\/td>\n<\/tr>\n<tr>\n<td>\u5ba1\u67e5\u4e3b\u89c2\u6027 \u2192 \u89e3\u51b3<\/td>\n<td>\u6539\u4e3a\u6d4b\u8bd5\u9a8c\u8bc1\u800c\u975e\u4ee3\u7801\u5ba1\u67e5<\/td>\n<td>\u901a\u8fc7\/\u5931\u8d25\u662f\u5ba2\u89c2\u4e8c\u5143\u5224\u5b9a<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6838\u5fc3\u601d\u60f3\uff1a\u4e0d\u95ee\\&#8221;\u8fd9\u6bb5\u4ee3\u7801\u597d\u4e0d\u597d\\&#8221;\uff0c\u53ea\u95ee\\&#8221;\u8fd9\u6bb5\u4ee3\u7801\u7684\u6d4b\u8bd5\u901a\u8fc7\u4e86\u5417\\&#8221;\u2014\u2014\u4ece\u4e3b\u89c2\u5224\u65ad\u5347\u7ea7\u4e3a\u5ba2\u89c2\u9a8c\u8bc1\u3002<\/p>\n<h4>9.2 \u63d2\u4ef6\u7ed3\u6784<\/h4>\n<p>packages\/extensions\/test-guardian\/<br \/>\n  package.json<br \/>\n  tsconfig.json<br \/>\n  vitest.config.ts<br \/>\n  src\/<br \/>\n    index.ts              # \u63d2\u4ef6\u5165\u53e3\uff1a\u6ce8\u518c pre-execute \u62e6\u622a + result \u4f9d\u8d56\u66f4\u65b0<br \/>\n    types.ts              # \u7c7b\u578b\u5b9a\u4e49\uff1aPreExecuteVerdict \/ LanguageAdapter \/ TestResult \/ ToolExec \/ Config<br \/>\n    vendor.d.ts           # \u5916\u90e8\u4f9d\u8d56\u7c7b\u578b\u6869\uff1a@deepseek-ai\/cordis \/ schemastery\uff08\u65e0\u5b8c\u6574 dsh \u65f6\u7f16\u8bd1\u7528\uff09<br \/>\n    dependency-graph.ts   # \u4f9d\u8d56\u56fe\u7ba1\u7406\u5668\uff1a\u53cc\u5411\u90bb\u63a5\u8868 + BFS \u4f20\u9012\u95ed\u5305<br \/>\n    test-runner.ts        # \u6d4b\u8bd5\u8fd0\u884c\u5668\uff1a\u9632\u9012\u5f52 + \u591a\u8bed\u8a00\u6d4b\u8bd5\u6267\u884c<br \/>\n    sandbox.js            # \u52a8\u6001\u6c99\u7bb1\u517c\u5bb9\u7248\uff08\u7eaf JS\uff0c\u53ef\u76f4\u63a5\u7c98\u8d34\u8fdb cordis_define\uff09<br \/>\n    adapters\/<br \/>\n      python.ts           # Python \u9002\u914d\u5668\uff1apytest \/ from&#8230;import<br \/>\n      typescript.ts       # TS\/JS \u9002\u914d\u5668\uff1avitest \/ import&#8230;from<br \/>\n      go.ts               # Go \u9002\u914d\u5668\uff1ago test \/ import<br \/>\n  tests\/<br \/>\n    test-guardian.spec.ts # \u5b8c\u6574\u6d4b\u8bd5\u5957\u4ef6\uff1a46 \u7528\u4f8b<br \/>\n    e2e-verification.ts   # \u7aef\u5230\u7aef\u5b9e\u6218\u9a8c\u8bc1\u811a\u672c\uff1a6 \u573a\u666f<\/p>\n<h4>9.3 \u6838\u5fc3\u67b6\u6784<\/h4>\n<p> Agent \u8c03\u7528 write\/edit \u5de5\u5177<br \/>\n       \u2193<br \/>\n  tools\/pre-execute waterfall \u89e6\u53d1     \u2190 \u963b\u65ad\u5f0f\u62e6\u622a\u70b9<br \/>\n       \u2193<br \/>\n  TestGuardian \u68c0\u67e5\u6587\u4ef6\u7c7b\u578b<br \/>\n       \u2193<br \/>\n  \u66f4\u65b0\u4f9d\u8d56\u56fe\uff08\u589e\u91cf\uff0c\u57fa\u4e8e\u6587\u4ef6\u54c8\u5e0c\uff09<br \/>\n       \u2193<br \/>\n  \u67e5\u4f9d\u8d56\u56fe\uff1a\u54ea\u4e9b\u6587\u4ef6\u53d7\u5f71\u54cd\uff1f             \u2190 \u8de8\u6587\u4ef6\u5f71\u54cd\u5206\u6790<br \/>\n  \uff08BFS \u4f20\u9012\u95ed\u5305\uff1areverse \u56fe\u904d\u5386\uff09<br \/>\n       \u2193<br \/>\n  \u250c\u2500 \u6709\u6d4b\u8bd5\u6587\u4ef6 \u2500\u2192 \u8fd0\u884c\u6d4b\u8bd5 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n  \u2502   \uff08ctx.shell \u6267\u884c\uff0c\u9632\u9012\u5f52\u4fdd\u62a4\uff09       \u251c\u2500 \u901a\u8fc7 \u2192 allow\uff08\u653e\u884c\uff09<br \/>\n  \u2502                                       \u2514\u2500 \u5931\u8d25 \u2192 deny\uff08\u963b\u65ad\uff09+ inject \u53cd\u9988<br \/>\n  \u2514\u2500 \u65e0\u6d4b\u8bd5\u6587\u4ef6 \u2500\u2192 LLM \u751f\u6210\u6d4b\u8bd5\u9aa8\u67b6 \u2500\u2192 \u8fd0\u884c \u2500\u2510<br \/>\n                                              \u251c\u2500 \u901a\u8fc7 \u2192 allow<br \/>\n                                              \u2514\u2500 \u5931\u8d25 \u2192 deny + \u53cd\u9988<br \/>\n       \u2193<br \/>\n  tools\/result \u4e8b\u4ef6\u540c\u6b65\u4f9d\u8d56\u56fe              \u2190 \u6301\u7eed\u66f4\u65b0\u4f9d\u8d56\u56fe<br \/>\n  \uff08\u5373\u4f7f pre-execute \u88ab\u8df3\u8fc7\uff0c\u4e5f\u7ef4\u62a4\u56fe\uff09<\/p>\n<h4>9.4 \u7c7b\u578b\u5b9a\u4e49\uff08types.ts\uff09<\/h4>\n<p><span class=\"token comment\">\/**<br \/>\n * pre-execute waterfall \u7684\u8fd4\u56de\u503c\u3002<br \/>\n * dsh \u6e90\u7801\u4e2d\u5b9a\u4e49\u4e86\u4e09\u79cd\u88c1\u51b3\uff1a<br \/>\n * &#8211; \\&#8217;allow\\&#8217;\uff1a\u653e\u884c\uff0c\u7ee7\u7eed\u6267\u884c\u5de5\u5177<br \/>\n * &#8211; \\&#8217;deny\\&#8217;\uff1a\u77ed\u8def\uff0c\u62d2\u7edd\u6267\u884c\uff0creason \u8fd4\u7ed9\u6a21\u578b<br \/>\n * &#8211; \\&#8217;ask\\&#8217;\uff1a\u8bf7\u6c42\u4eba\u5de5\u6279\u51c6\uff08\u901a\u8fc7 ctx.approval\uff09<br \/>\n *\/<\/span><br \/>\n<span class=\"token keyword\">export<\/span> <span class=\"token keyword\">type<\/span> <span class=\"token class-name\">PreExecuteVerdict<\/span> <span class=\"token operator\">=<\/span><br \/>\n  <span class=\"token operator\">|<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span> verdict<span class=\"token operator\">:<\/span> <span class=\"token string\">\\&#8217;allow\\&#8217;<\/span> <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token operator\">|<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span> verdict<span class=\"token operator\">:<\/span> <span class=\"token string\">\\&#8217;deny\\&#8217;<\/span><span class=\"token punctuation\">;<\/span> reason<span class=\"token operator\">:<\/span> <span class=\"token builtin\">string<\/span> <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token operator\">|<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span> verdict<span class=\"token operator\">:<\/span> <span class=\"token string\">\\&#8217;ask\\&#8217;<\/span><span class=\"token punctuation\">;<\/span> reason<span class=\"token operator\">:<\/span> <span class=\"token builtin\">string<\/span> <span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\">\/**<br \/>\n * \u5de5\u5177\u6267\u884c\u8bf7\u6c42\uff08exec\uff09\u7684\u63cf\u8ff0\u3002<br \/>\n * \u8fd9\u662f\u5728 pre-execute waterfall \u4e2d\u63a5\u6536\u5230\u7684\u53c2\u6570\u3002<br \/>\n *\/<\/span><br \/>\n<span class=\"token keyword\">export<\/span> <span class=\"token keyword\">interface<\/span> <span class=\"token class-name\">ToolExec<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span><br \/>\n  <span class=\"token comment\">\/** \u5de5\u5177\u540d\u79f0\uff0c\u5982 \\&#8217;write\\&#8217;\u3001\\&#8217;edit\\&#8217;\u3001\\&#8217;bash\\&#8217; *\/<\/span><br \/>\n  name<span class=\"token operator\">:<\/span> <span class=\"token builtin\">string<\/span><br \/>\n  <span class=\"token comment\">\/** \u5de5\u5177\u53c2\u6570\uff08\u5df2\u7ecf\u8fc7 validateArgs \u9a8c\u8bc1\uff09 *\/<\/span><br \/>\n  args<span class=\"token operator\">:<\/span> Record<span class=\"token operator\">&lt;<\/span><span class=\"token builtin\">string<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token builtin\">unknown<\/span><span class=\"token operator\">&gt;<\/span><br \/>\n  <span class=\"token comment\">\/** \u53d1\u8d77\u6b64\u5de5\u5177\u8c03\u7528\u7684 Agent\uff08\u53ef\u80fd\u4e3a undefined\uff09 *\/<\/span><br \/>\n  agent<span class=\"token operator\">?<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span><br \/>\n    <span class=\"token function-variable function\">inject<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">(<\/span>message<span class=\"token operator\">:<\/span> <span class=\"token builtin\">unknown<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">=&gt;<\/span> <span class=\"token keyword\">void<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token comment\">\/** \u53d6\u6d88\u4fe1\u53f7 *\/<\/span><br \/>\n  signal<span class=\"token operator\">?<\/span><span class=\"token operator\">:<\/span> AbortSignal<br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\">\/**<br \/>\n * \u8bed\u8a00\u9002\u914d\u5668\u63a5\u53e3\uff08ISP \u539f\u5219\uff1a\u6d88\u8d39\u8005\u53ea\u4f9d\u8d56\u9700\u8981\u7684\u65b9\u6cd5\uff09\u3002<br \/>\n * \u6bcf\u79cd\u7f16\u7a0b\u8bed\u8a00\u5b9e\u73b0\u6b64\u63a5\u53e3\uff0c\u63d0\u4f9b\u6d4b\u8bd5\u53d1\u73b0\u3001import \u89e3\u6790\u3001\u6d4b\u8bd5\u6267\u884c\u80fd\u529b\u3002<br \/>\n *\/<\/span><br \/>\n<span class=\"token keyword\">export<\/span> <span class=\"token keyword\">interface<\/span> <span class=\"token class-name\">LanguageAdapter<\/span> <span class=\"token punctuation\">{<\/p>\n<p>   <\/span><br \/>\n  <span class=\"token keyword\">readonly<\/span> language<span class=\"token operator\">:<\/span> <span class=\"token builtin\">string<\/span><br \/>\n  <span class=\"token keyword\">readonly<\/span> extensions<span class=\"token operator\">:<\/span> <span class=\"token keyword\">readonly<\/span> <span class=\"token builtin\">string<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><br \/>\n  <span class=\"token function\">matches<\/span><span class=\"token punctuation\">(<\/span>filePath<span class=\"token operator\">:<\/span> <span class=\"token builtin\">string<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">:<\/span> <span class=\"token builtin\">boolean<\/span><br \/>\n  <span class=\"token function\">parseImports<\/span><span class=\"token punctuation\">(<\/span>content<span class=\"token operator\">:<\/span> <span class=\"token builtin\">string<\/span><span class=\"token punctuation\">,<\/span> ownPath<span class=\"token operator\">:<\/span> <span class=\"token builtin\">string<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">:<\/span> <span class=\"token builtin\">string<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><br \/>\n  <span class=\"token function\">findTestFile<\/span><span class=\"token punctuation\">(<\/span>sourcePath<span class=\"token operator\">:<\/span> <span class=\"token builtin\">string<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">:<\/span> <span class=\"token builtin\">string<\/span> <span class=\"token operator\">|<\/span> <span class=\"token keyword\">null<\/span><br \/>\n  <span class=\"token function\">buildTestCommand<\/span><span class=\"token punctuation\">(<\/span>testFiles<span class=\"token operator\">:<\/span> <span class=\"token builtin\">string<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span> projectRoot<span class=\"token operator\">:<\/span> <span class=\"token builtin\">string<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">:<\/span> <span class=\"token builtin\">string<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>DeepSeek Harness \u6e90\u7801\u7ea7\u6df1\u5ea6\u5256\u6790\uff1a\u5168\u63d2\u4ef6\u67b6\u6784 Agent \u6846\u67b6\u4ece\u5165\u95e8\u5230\u5b9e\u6218 \u672c\u6587\u9002\u5408\u8c01\uff1a\u6b63\u5728\u6784\u5efa AI Agent \u7cfb\u7edf\u7684\u67b6\u6784\u5e08\u548c\u9ad8\u7ea7\u5f00\u53d1\u8005\uff1b\u5bf9\\&#8221;\u63d2\u4ef6\u5316\u67b6\u6784\\&#8221;\u611f\u5174\u8da3\u7684\u540e\u7aef\u5de5\u7a0b\u5e08\uff1b\u60f3\u8981\u6df1\u5ea6\u7406\u89e3 DeepSeek Harness\uff08dsh\uff09\u6e90\u7801\u7684 contributors\u3002 \u4f60\u5c06\u83b7\u5f97\uff1adsh v0.1.0-rc.8 \u67b6\u6784\u6982\u8ff0\u4e0e 5 \u4e2a\u6838\u5fc3\u5305\uff08Session \/ Agent \/ Agent Loop \/ Tools \/ defineTool\uff09\u7684\u5173\u952e\u8bbe\u8ba1\u89e3\u6790\u3001Capab<\/p>\n","protected":false},"author":2,"featured_media":96513,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[50,188],"topic":[],"class_list":["post-96516","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-50","tag-188"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>DeepSeek Harness \u6e90\u7801\u7ea7\u6df1\u5ea6\u5256\u6790\uff1a\u5168\u63d2\u4ef6\u67b6\u6784 Agent \u6846\u67b6\u4ece\u5165\u95e8\u5230\u5b9e\u6218 - \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\/96516.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"DeepSeek Harness \u6e90\u7801\u7ea7\u6df1\u5ea6\u5256\u6790\uff1a\u5168\u63d2\u4ef6\u67b6\u6784 Agent \u6846\u67b6\u4ece\u5165\u95e8\u5230\u5b9e\u6218 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"DeepSeek Harness \u6e90\u7801\u7ea7\u6df1\u5ea6\u5256\u6790\uff1a\u5168\u63d2\u4ef6\u67b6\u6784 Agent \u6846\u67b6\u4ece\u5165\u95e8\u5230\u5b9e\u6218 \u672c\u6587\u9002\u5408\u8c01\uff1a\u6b63\u5728\u6784\u5efa AI Agent \u7cfb\u7edf\u7684\u67b6\u6784\u5e08\u548c\u9ad8\u7ea7\u5f00\u53d1\u8005\uff1b\u5bf9&quot;\u63d2\u4ef6\u5316\u67b6\u6784&quot;\u611f\u5174\u8da3\u7684\u540e\u7aef\u5de5\u7a0b\u5e08\uff1b\u60f3\u8981\u6df1\u5ea6\u7406\u89e3 DeepSeek Harness\uff08dsh\uff09\u6e90\u7801\u7684 contributors\u3002 \u4f60\u5c06\u83b7\u5f97\uff1adsh v0.1.0-rc.8 \u67b6\u6784\u6982\u8ff0\u4e0e 5 \u4e2a\u6838\u5fc3\u5305\uff08Session \/ Agent \/ Agent Loop \/ Tools \/ defineTool\uff09\u7684\u5173\u952e\u8bbe\u8ba1\u89e3\u6790\u3001Capab\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/96516.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-27T11:48:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/08\/20260827114831-6a90240fa27e7.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/96516.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/96516.html\",\"name\":\"DeepSeek Harness \u6e90\u7801\u7ea7\u6df1\u5ea6\u5256\u6790\uff1a\u5168\u63d2\u4ef6\u67b6\u6784 Agent \u6846\u67b6\u4ece\u5165\u95e8\u5230\u5b9e\u6218 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-08-27T11:48:33+00:00\",\"dateModified\":\"2026-08-27T11:48:33+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/96516.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/96516.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/96516.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DeepSeek Harness \u6e90\u7801\u7ea7\u6df1\u5ea6\u5256\u6790\uff1a\u5168\u63d2\u4ef6\u67b6\u6784 Agent \u6846\u67b6\u4ece\u5165\u95e8\u5230\u5b9e\u6218\"}]},{\"@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 \u6e90\u7801\u7ea7\u6df1\u5ea6\u5256\u6790\uff1a\u5168\u63d2\u4ef6\u67b6\u6784 Agent \u6846\u67b6\u4ece\u5165\u95e8\u5230\u5b9e\u6218 - \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\/96516.html","og_locale":"zh_CN","og_type":"article","og_title":"DeepSeek Harness \u6e90\u7801\u7ea7\u6df1\u5ea6\u5256\u6790\uff1a\u5168\u63d2\u4ef6\u67b6\u6784 Agent \u6846\u67b6\u4ece\u5165\u95e8\u5230\u5b9e\u6218 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"DeepSeek Harness \u6e90\u7801\u7ea7\u6df1\u5ea6\u5256\u6790\uff1a\u5168\u63d2\u4ef6\u67b6\u6784 Agent \u6846\u67b6\u4ece\u5165\u95e8\u5230\u5b9e\u6218 \u672c\u6587\u9002\u5408\u8c01\uff1a\u6b63\u5728\u6784\u5efa AI Agent \u7cfb\u7edf\u7684\u67b6\u6784\u5e08\u548c\u9ad8\u7ea7\u5f00\u53d1\u8005\uff1b\u5bf9\"\u63d2\u4ef6\u5316\u67b6\u6784\"\u611f\u5174\u8da3\u7684\u540e\u7aef\u5de5\u7a0b\u5e08\uff1b\u60f3\u8981\u6df1\u5ea6\u7406\u89e3 DeepSeek Harness\uff08dsh\uff09\u6e90\u7801\u7684 contributors\u3002 \u4f60\u5c06\u83b7\u5f97\uff1adsh v0.1.0-rc.8 \u67b6\u6784\u6982\u8ff0\u4e0e 5 \u4e2a\u6838\u5fc3\u5305\uff08Session \/ Agent \/ Agent Loop \/ Tools \/ defineTool\uff09\u7684\u5173\u952e\u8bbe\u8ba1\u89e3\u6790\u3001Capab","og_url":"https:\/\/www.wsisp.com\/helps\/96516.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-08-27T11:48:33+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/08\/20260827114831-6a90240fa27e7.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"8 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/96516.html","url":"https:\/\/www.wsisp.com\/helps\/96516.html","name":"DeepSeek Harness \u6e90\u7801\u7ea7\u6df1\u5ea6\u5256\u6790\uff1a\u5168\u63d2\u4ef6\u67b6\u6784 Agent \u6846\u67b6\u4ece\u5165\u95e8\u5230\u5b9e\u6218 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-08-27T11:48:33+00:00","dateModified":"2026-08-27T11:48:33+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/96516.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/96516.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/96516.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"DeepSeek Harness \u6e90\u7801\u7ea7\u6df1\u5ea6\u5256\u6790\uff1a\u5168\u63d2\u4ef6\u67b6\u6784 Agent \u6846\u67b6\u4ece\u5165\u95e8\u5230\u5b9e\u6218"}]},{"@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\/96516","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=96516"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/96516\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/96513"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=96516"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=96516"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=96516"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=96516"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}