@tachu/extensions 1.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +119 -0
- package/LICENSE +201 -0
- package/README.md +1104 -0
- package/README_ZH.md +1082 -0
- package/dist/backends/file.d.ts +18 -0
- package/dist/backends/file.d.ts.map +1 -0
- package/dist/backends/file.js +85 -0
- package/dist/backends/file.js.map +1 -0
- package/dist/backends/index.d.ts +4 -0
- package/dist/backends/index.d.ts.map +1 -0
- package/dist/backends/index.js +4 -0
- package/dist/backends/index.js.map +1 -0
- package/dist/backends/terminal.d.ts +18 -0
- package/dist/backends/terminal.d.ts.map +1 -0
- package/dist/backends/terminal.js +81 -0
- package/dist/backends/terminal.js.map +1 -0
- package/dist/backends/web.d.ts +18 -0
- package/dist/backends/web.d.ts.map +1 -0
- package/dist/backends/web.js +55 -0
- package/dist/backends/web.js.map +1 -0
- package/dist/common/net.d.ts +39 -0
- package/dist/common/net.d.ts.map +1 -0
- package/dist/common/net.js +177 -0
- package/dist/common/net.js.map +1 -0
- package/dist/common/path.d.ts +51 -0
- package/dist/common/path.d.ts.map +1 -0
- package/dist/common/path.js +76 -0
- package/dist/common/path.js.map +1 -0
- package/dist/common/process.d.ts +19 -0
- package/dist/common/process.d.ts.map +1 -0
- package/dist/common/process.js +67 -0
- package/dist/common/process.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/index.d.ts +3 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +3 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/sse-adapter.d.ts +82 -0
- package/dist/mcp/sse-adapter.d.ts.map +1 -0
- package/dist/mcp/sse-adapter.js +201 -0
- package/dist/mcp/sse-adapter.js.map +1 -0
- package/dist/mcp/stdio-adapter.d.ts +85 -0
- package/dist/mcp/stdio-adapter.d.ts.map +1 -0
- package/dist/mcp/stdio-adapter.js +203 -0
- package/dist/mcp/stdio-adapter.js.map +1 -0
- package/dist/memory/fs-memory-system.d.ts +147 -0
- package/dist/memory/fs-memory-system.d.ts.map +1 -0
- package/dist/memory/fs-memory-system.js +266 -0
- package/dist/memory/fs-memory-system.js.map +1 -0
- package/dist/memory/index.d.ts +2 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +2 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/observability/index.d.ts +3 -0
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/index.js +3 -0
- package/dist/observability/index.js.map +1 -0
- package/dist/observability/jsonl-emitter.d.ts +58 -0
- package/dist/observability/jsonl-emitter.d.ts.map +1 -0
- package/dist/observability/jsonl-emitter.js +96 -0
- package/dist/observability/jsonl-emitter.js.map +1 -0
- package/dist/observability/otel-emitter.d.ts +52 -0
- package/dist/observability/otel-emitter.d.ts.map +1 -0
- package/dist/observability/otel-emitter.js +143 -0
- package/dist/observability/otel-emitter.js.map +1 -0
- package/dist/providers/anthropic.d.ts +73 -0
- package/dist/providers/anthropic.d.ts.map +1 -0
- package/dist/providers/anthropic.js +521 -0
- package/dist/providers/anthropic.js.map +1 -0
- package/dist/providers/index.d.ts +5 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +5 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/mock.d.ts +81 -0
- package/dist/providers/mock.d.ts.map +1 -0
- package/dist/providers/mock.js +160 -0
- package/dist/providers/mock.js.map +1 -0
- package/dist/providers/openai.d.ts +95 -0
- package/dist/providers/openai.d.ts.map +1 -0
- package/dist/providers/openai.js +529 -0
- package/dist/providers/openai.js.map +1 -0
- package/dist/providers/qwen.d.ts +145 -0
- package/dist/providers/qwen.d.ts.map +1 -0
- package/dist/providers/qwen.js +669 -0
- package/dist/providers/qwen.js.map +1 -0
- package/dist/rules/index.d.ts +9 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +15 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/rules/no-hallucination.md +11 -0
- package/dist/rules/no-sensitive-output.md +11 -0
- package/dist/rules/prefer-concise-response.md +11 -0
- package/dist/rules/require-tool-verification.md +11 -0
- package/dist/safety/default-gate.d.ts +112 -0
- package/dist/safety/default-gate.d.ts.map +1 -0
- package/dist/safety/default-gate.js +188 -0
- package/dist/safety/default-gate.js.map +1 -0
- package/dist/safety/index.d.ts +2 -0
- package/dist/safety/index.d.ts.map +1 -0
- package/dist/safety/index.js +2 -0
- package/dist/safety/index.js.map +1 -0
- package/dist/tools/_shared/web-client.d.ts +18 -0
- package/dist/tools/_shared/web-client.d.ts.map +1 -0
- package/dist/tools/_shared/web-client.js +46 -0
- package/dist/tools/_shared/web-client.js.map +1 -0
- package/dist/tools/apply-patch/descriptor.md +27 -0
- package/dist/tools/apply-patch/executor.d.ts +19 -0
- package/dist/tools/apply-patch/executor.d.ts.map +1 -0
- package/dist/tools/apply-patch/executor.js +193 -0
- package/dist/tools/apply-patch/executor.js.map +1 -0
- package/dist/tools/fetch-url/descriptor.md +44 -0
- package/dist/tools/fetch-url/executor.d.ts +28 -0
- package/dist/tools/fetch-url/executor.d.ts.map +1 -0
- package/dist/tools/fetch-url/executor.js +115 -0
- package/dist/tools/fetch-url/executor.js.map +1 -0
- package/dist/tools/index.d.ts +12 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +286 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/list-dir/descriptor.md +29 -0
- package/dist/tools/list-dir/executor.d.ts +22 -0
- package/dist/tools/list-dir/executor.d.ts.map +1 -0
- package/dist/tools/list-dir/executor.js +48 -0
- package/dist/tools/list-dir/executor.js.map +1 -0
- package/dist/tools/read-file/descriptor.md +28 -0
- package/dist/tools/read-file/executor.d.ts +15 -0
- package/dist/tools/read-file/executor.d.ts.map +1 -0
- package/dist/tools/read-file/executor.js +22 -0
- package/dist/tools/read-file/executor.js.map +1 -0
- package/dist/tools/run-shell/descriptor.md +39 -0
- package/dist/tools/run-shell/executor.d.ts +20 -0
- package/dist/tools/run-shell/executor.d.ts.map +1 -0
- package/dist/tools/run-shell/executor.js +76 -0
- package/dist/tools/run-shell/executor.js.map +1 -0
- package/dist/tools/search-code/descriptor.md +31 -0
- package/dist/tools/search-code/executor.d.ts +23 -0
- package/dist/tools/search-code/executor.d.ts.map +1 -0
- package/dist/tools/search-code/executor.js +122 -0
- package/dist/tools/search-code/executor.js.map +1 -0
- package/dist/tools/shared.d.ts +47 -0
- package/dist/tools/shared.d.ts.map +1 -0
- package/dist/tools/shared.js +27 -0
- package/dist/tools/shared.js.map +1 -0
- package/dist/tools/web-fetch/descriptor.md +198 -0
- package/dist/tools/web-fetch/errors.d.ts +32 -0
- package/dist/tools/web-fetch/errors.d.ts.map +1 -0
- package/dist/tools/web-fetch/errors.js +91 -0
- package/dist/tools/web-fetch/errors.js.map +1 -0
- package/dist/tools/web-fetch/executor.d.ts +10 -0
- package/dist/tools/web-fetch/executor.d.ts.map +1 -0
- package/dist/tools/web-fetch/executor.js +191 -0
- package/dist/tools/web-fetch/executor.js.map +1 -0
- package/dist/tools/web-fetch/index.d.ts +4 -0
- package/dist/tools/web-fetch/index.d.ts.map +1 -0
- package/dist/tools/web-fetch/index.js +3 -0
- package/dist/tools/web-fetch/index.js.map +1 -0
- package/dist/tools/web-fetch/types.d.ts +157 -0
- package/dist/tools/web-fetch/types.d.ts.map +1 -0
- package/dist/tools/web-fetch/types.js +7 -0
- package/dist/tools/web-fetch/types.js.map +1 -0
- package/dist/tools/web-search/descriptor.md +89 -0
- package/dist/tools/web-search/errors.d.ts +33 -0
- package/dist/tools/web-search/errors.d.ts.map +1 -0
- package/dist/tools/web-search/errors.js +45 -0
- package/dist/tools/web-search/errors.js.map +1 -0
- package/dist/tools/web-search/executor.d.ts +10 -0
- package/dist/tools/web-search/executor.d.ts.map +1 -0
- package/dist/tools/web-search/executor.js +185 -0
- package/dist/tools/web-search/executor.js.map +1 -0
- package/dist/tools/web-search/index.d.ts +4 -0
- package/dist/tools/web-search/index.d.ts.map +1 -0
- package/dist/tools/web-search/index.js +3 -0
- package/dist/tools/web-search/index.js.map +1 -0
- package/dist/tools/web-search/types.d.ts +86 -0
- package/dist/tools/web-search/types.d.ts.map +1 -0
- package/dist/tools/web-search/types.js +7 -0
- package/dist/tools/web-search/types.js.map +1 -0
- package/dist/tools/write-file/descriptor.md +30 -0
- package/dist/tools/write-file/executor.d.ts +16 -0
- package/dist/tools/write-file/executor.d.ts.map +1 -0
- package/dist/tools/write-file/executor.js +18 -0
- package/dist/tools/write-file/executor.js.map +1 -0
- package/dist/transformers/document-to-text.d.ts +23 -0
- package/dist/transformers/document-to-text.d.ts.map +1 -0
- package/dist/transformers/document-to-text.js +69 -0
- package/dist/transformers/document-to-text.js.map +1 -0
- package/dist/transformers/image-to-text.d.ts +38 -0
- package/dist/transformers/image-to-text.d.ts.map +1 -0
- package/dist/transformers/image-to-text.js +82 -0
- package/dist/transformers/image-to-text.js.map +1 -0
- package/dist/transformers/index.d.ts +3 -0
- package/dist/transformers/index.d.ts.map +1 -0
- package/dist/transformers/index.js +3 -0
- package/dist/transformers/index.js.map +1 -0
- package/dist/vector/index.d.ts +3 -0
- package/dist/vector/index.d.ts.map +1 -0
- package/dist/vector/index.js +3 -0
- package/dist/vector/index.js.map +1 -0
- package/dist/vector/local-fs.d.ts +76 -0
- package/dist/vector/local-fs.d.ts.map +1 -0
- package/dist/vector/local-fs.js +153 -0
- package/dist/vector/local-fs.js.map +1 -0
- package/dist/vector/qdrant.d.ts +85 -0
- package/dist/vector/qdrant.d.ts.map +1 -0
- package/dist/vector/qdrant.js +208 -0
- package/dist/vector/qdrant.js.map +1 -0
- package/package.json +74 -0
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { readFileExecutor } from "./read-file/executor";
|
|
2
|
+
import { writeFileExecutor } from "./write-file/executor";
|
|
3
|
+
import { listDirExecutor } from "./list-dir/executor";
|
|
4
|
+
import { searchCodeExecutor } from "./search-code/executor";
|
|
5
|
+
import { fetchUrlExecutor } from "./fetch-url/executor";
|
|
6
|
+
import { runShellExecutor } from "./run-shell/executor";
|
|
7
|
+
import { applyPatchExecutor } from "./apply-patch/executor";
|
|
8
|
+
import { executeWebFetch } from "./web-fetch";
|
|
9
|
+
import { executeWebSearch } from "./web-search";
|
|
10
|
+
/**
|
|
11
|
+
* 内置工具描述符列表。
|
|
12
|
+
*/
|
|
13
|
+
export const toolDescriptors = [
|
|
14
|
+
{
|
|
15
|
+
kind: "tool",
|
|
16
|
+
name: "read-file",
|
|
17
|
+
description: "读取工作区内的文件内容",
|
|
18
|
+
sideEffect: "readonly",
|
|
19
|
+
idempotent: true,
|
|
20
|
+
requiresApproval: false,
|
|
21
|
+
timeout: 5000,
|
|
22
|
+
inputSchema: {
|
|
23
|
+
type: "object",
|
|
24
|
+
properties: {
|
|
25
|
+
path: { type: "string" },
|
|
26
|
+
encoding: { type: "string", enum: ["utf-8", "base64"] },
|
|
27
|
+
},
|
|
28
|
+
required: ["path"],
|
|
29
|
+
},
|
|
30
|
+
outputSchema: {
|
|
31
|
+
type: "object",
|
|
32
|
+
properties: { content: { type: "string" }, bytes: { type: "number" } },
|
|
33
|
+
},
|
|
34
|
+
execute: "read-file",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
kind: "tool",
|
|
38
|
+
name: "write-file",
|
|
39
|
+
description: "写入工作区内文件内容",
|
|
40
|
+
sideEffect: "write",
|
|
41
|
+
idempotent: false,
|
|
42
|
+
requiresApproval: true,
|
|
43
|
+
timeout: 5000,
|
|
44
|
+
inputSchema: {
|
|
45
|
+
type: "object",
|
|
46
|
+
properties: {
|
|
47
|
+
path: { type: "string" },
|
|
48
|
+
content: { type: "string" },
|
|
49
|
+
encoding: { type: "string", enum: ["utf-8", "base64"] },
|
|
50
|
+
createDirs: { type: "boolean" },
|
|
51
|
+
},
|
|
52
|
+
required: ["path", "content"],
|
|
53
|
+
},
|
|
54
|
+
outputSchema: {
|
|
55
|
+
type: "object",
|
|
56
|
+
properties: { bytesWritten: { type: "number" } },
|
|
57
|
+
},
|
|
58
|
+
execute: "write-file",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
kind: "tool",
|
|
62
|
+
name: "list-dir",
|
|
63
|
+
description: "列出工作区目录内容",
|
|
64
|
+
sideEffect: "readonly",
|
|
65
|
+
idempotent: true,
|
|
66
|
+
requiresApproval: false,
|
|
67
|
+
timeout: 3000,
|
|
68
|
+
inputSchema: {
|
|
69
|
+
type: "object",
|
|
70
|
+
properties: {
|
|
71
|
+
path: { type: "string" },
|
|
72
|
+
recursive: { type: "boolean" },
|
|
73
|
+
maxEntries: { type: "number" },
|
|
74
|
+
pattern: { type: "string" },
|
|
75
|
+
},
|
|
76
|
+
required: ["path"],
|
|
77
|
+
},
|
|
78
|
+
outputSchema: { type: "object", properties: { entries: { type: "array" } } },
|
|
79
|
+
execute: "list-dir",
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
kind: "tool",
|
|
83
|
+
name: "search-code",
|
|
84
|
+
description: "在工作区内按模式搜索代码",
|
|
85
|
+
sideEffect: "readonly",
|
|
86
|
+
idempotent: true,
|
|
87
|
+
requiresApproval: false,
|
|
88
|
+
timeout: 10000,
|
|
89
|
+
inputSchema: {
|
|
90
|
+
type: "object",
|
|
91
|
+
properties: {
|
|
92
|
+
pattern: { type: "string" },
|
|
93
|
+
path: { type: "string" },
|
|
94
|
+
fileGlob: { type: "string" },
|
|
95
|
+
maxResults: { type: "number" },
|
|
96
|
+
caseSensitive: { type: "boolean" },
|
|
97
|
+
},
|
|
98
|
+
required: ["pattern"],
|
|
99
|
+
},
|
|
100
|
+
outputSchema: { type: "object", properties: { matches: { type: "array" } } },
|
|
101
|
+
execute: "search-code",
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
kind: "tool",
|
|
105
|
+
name: "fetch-url",
|
|
106
|
+
description: "发送单次 HTTP 请求并返回原始响应体。优先级低于 web-fetch——抓取网页正文请优先用 web-fetch(可触发浏览器渲染与结构化抽取)。",
|
|
107
|
+
sideEffect: "readonly",
|
|
108
|
+
idempotent: false,
|
|
109
|
+
requiresApproval: false,
|
|
110
|
+
timeout: 15000,
|
|
111
|
+
inputSchema: {
|
|
112
|
+
type: "object",
|
|
113
|
+
properties: {
|
|
114
|
+
url: { type: "string" },
|
|
115
|
+
method: { type: "string", enum: ["GET", "POST"] },
|
|
116
|
+
headers: { type: "object" },
|
|
117
|
+
body: { type: "string" },
|
|
118
|
+
timeoutMs: { type: "number" },
|
|
119
|
+
},
|
|
120
|
+
required: ["url"],
|
|
121
|
+
},
|
|
122
|
+
outputSchema: { type: "object", properties: { status: { type: "number" } } },
|
|
123
|
+
execute: "fetch-url",
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
kind: "tool",
|
|
127
|
+
name: "web-fetch",
|
|
128
|
+
description: "通过 @tachu/web-fetch-server 远程渲染并结构化抓取 URL:服务端走 Bun.fetch(静态)或 Playwright(浏览器)拉取页面,经 Readability/Turndown 输出标题、正文(markdown/text/html/structured 之一)、可选链接/图片/JSON-LD。renderMode=auto 时可在静态不足时自动升级到浏览器。抓取内容文章、文档、JS 渲染页面请用本工具,而非 fetch-url。",
|
|
129
|
+
sideEffect: "readonly",
|
|
130
|
+
idempotent: false,
|
|
131
|
+
requiresApproval: false,
|
|
132
|
+
timeout: 120000,
|
|
133
|
+
inputSchema: {
|
|
134
|
+
type: "object",
|
|
135
|
+
properties: {
|
|
136
|
+
url: { type: "string", description: "目标 http(s) URL" },
|
|
137
|
+
renderMode: {
|
|
138
|
+
type: "string",
|
|
139
|
+
enum: ["static", "browser", "auto"],
|
|
140
|
+
description: "渲染模式;默认 auto(静态不足时浏览器重试一次)",
|
|
141
|
+
},
|
|
142
|
+
outputFormat: {
|
|
143
|
+
type: "string",
|
|
144
|
+
enum: ["markdown", "text", "html", "structured"],
|
|
145
|
+
description: "正文形态;默认 markdown",
|
|
146
|
+
},
|
|
147
|
+
includeLinks: { type: "boolean" },
|
|
148
|
+
includeImages: { type: "boolean" },
|
|
149
|
+
includeStructured: { type: "boolean", description: "是否包含 JSON-LD 结构化字段" },
|
|
150
|
+
maxBodyChars: { type: "number", description: "body 字符上限;默认 32768" },
|
|
151
|
+
waitFor: {
|
|
152
|
+
description: "仅 browser:load | domcontentloaded | networkidle | {selector} | {timeMs}",
|
|
153
|
+
},
|
|
154
|
+
waitTimeoutMs: { type: "number", description: "渲染等待超时;默认 15000" },
|
|
155
|
+
userAgent: { type: "string" },
|
|
156
|
+
extraHeaders: { type: "object", additionalProperties: { type: "string" } },
|
|
157
|
+
},
|
|
158
|
+
required: ["url"],
|
|
159
|
+
},
|
|
160
|
+
outputSchema: {
|
|
161
|
+
type: "object",
|
|
162
|
+
properties: {
|
|
163
|
+
url: { type: "string" },
|
|
164
|
+
finalUrl: { type: "string" },
|
|
165
|
+
status: { type: "number" },
|
|
166
|
+
renderedWith: { type: "string", enum: ["static", "browser"] },
|
|
167
|
+
title: { type: "string" },
|
|
168
|
+
description: { type: "string" },
|
|
169
|
+
body: { type: "string" },
|
|
170
|
+
wordCount: { type: "number" },
|
|
171
|
+
truncated: { type: "boolean" },
|
|
172
|
+
links: { type: "array" },
|
|
173
|
+
images: { type: "array" },
|
|
174
|
+
structured: { type: "object" },
|
|
175
|
+
warnings: { type: "array", items: { type: "string" } },
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
execute: "web-fetch",
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
kind: "tool",
|
|
182
|
+
name: "web-search",
|
|
183
|
+
description: "通过 @tachu/web-fetch-server 调用 /v1/search:服务端编排搜索 provider 与可选 top-N 抽取。v0.1 默认 provider 为 stub,未配置真实 provider 时返回 503 PROVIDER_NOT_CONFIGURED。",
|
|
184
|
+
sideEffect: "readonly",
|
|
185
|
+
idempotent: false,
|
|
186
|
+
requiresApproval: false,
|
|
187
|
+
timeout: 120000,
|
|
188
|
+
inputSchema: {
|
|
189
|
+
type: "object",
|
|
190
|
+
properties: {
|
|
191
|
+
query: { type: "string", description: "搜索查询词(必填)" },
|
|
192
|
+
maxResults: { type: "number", description: "返回条数;默认 10,上限 30" },
|
|
193
|
+
language: { type: "string" },
|
|
194
|
+
region: { type: "string" },
|
|
195
|
+
timeRange: { type: "string", enum: ["day", "week", "month", "year"] },
|
|
196
|
+
safeSearch: { type: "string", enum: ["off", "moderate", "strict"] },
|
|
197
|
+
includeDomains: { type: "array", items: { type: "string" } },
|
|
198
|
+
excludeDomains: { type: "array", items: { type: "string" } },
|
|
199
|
+
fetchTopN: { type: "number", description: "对前 N 条结果执行抽取;0 表示不抽取;上限 5" },
|
|
200
|
+
fetchOptions: { type: "object", additionalProperties: true },
|
|
201
|
+
},
|
|
202
|
+
required: ["query"],
|
|
203
|
+
},
|
|
204
|
+
outputSchema: {
|
|
205
|
+
type: "object",
|
|
206
|
+
properties: {
|
|
207
|
+
query: { type: "string" },
|
|
208
|
+
provider: { type: "string" },
|
|
209
|
+
results: { type: "array" },
|
|
210
|
+
totalResults: { type: "number" },
|
|
211
|
+
warnings: { type: "array", items: { type: "string" } },
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
execute: "web-search",
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
kind: "tool",
|
|
218
|
+
name: "run-shell",
|
|
219
|
+
description: "在受控环境中执行 shell 命令",
|
|
220
|
+
sideEffect: "irreversible",
|
|
221
|
+
idempotent: false,
|
|
222
|
+
requiresApproval: true,
|
|
223
|
+
timeout: 30000,
|
|
224
|
+
inputSchema: {
|
|
225
|
+
type: "object",
|
|
226
|
+
properties: {
|
|
227
|
+
command: { type: "string" },
|
|
228
|
+
args: { type: "array", items: { type: "string" } },
|
|
229
|
+
cwd: { type: "string" },
|
|
230
|
+
env: { type: "object" },
|
|
231
|
+
timeoutMs: { type: "number" },
|
|
232
|
+
},
|
|
233
|
+
required: ["command"],
|
|
234
|
+
},
|
|
235
|
+
outputSchema: {
|
|
236
|
+
type: "object",
|
|
237
|
+
properties: {
|
|
238
|
+
stdout: { type: "string" },
|
|
239
|
+
stderr: { type: "string" },
|
|
240
|
+
exitCode: { type: "number" },
|
|
241
|
+
durationMs: { type: "number" },
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
execute: "run-shell",
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
kind: "tool",
|
|
248
|
+
name: "apply-patch",
|
|
249
|
+
description: "应用 unified diff 补丁并支持失败回滚",
|
|
250
|
+
sideEffect: "write",
|
|
251
|
+
idempotent: false,
|
|
252
|
+
requiresApproval: true,
|
|
253
|
+
timeout: 10000,
|
|
254
|
+
inputSchema: {
|
|
255
|
+
type: "object",
|
|
256
|
+
properties: {
|
|
257
|
+
patch: { type: "string" },
|
|
258
|
+
basePath: { type: "string" },
|
|
259
|
+
},
|
|
260
|
+
required: ["patch"],
|
|
261
|
+
},
|
|
262
|
+
outputSchema: {
|
|
263
|
+
type: "object",
|
|
264
|
+
properties: {
|
|
265
|
+
applied: { type: "array" },
|
|
266
|
+
success: { type: "boolean" },
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
execute: "apply-patch",
|
|
270
|
+
},
|
|
271
|
+
];
|
|
272
|
+
/**
|
|
273
|
+
* 工具执行函数注册表。
|
|
274
|
+
*/
|
|
275
|
+
export const toolExecutors = {
|
|
276
|
+
"read-file": readFileExecutor,
|
|
277
|
+
"write-file": writeFileExecutor,
|
|
278
|
+
"list-dir": listDirExecutor,
|
|
279
|
+
"search-code": searchCodeExecutor,
|
|
280
|
+
"fetch-url": fetchUrlExecutor,
|
|
281
|
+
"web-fetch": executeWebFetch,
|
|
282
|
+
"web-search": executeWebSearch,
|
|
283
|
+
"run-shell": runShellExecutor,
|
|
284
|
+
"apply-patch": applyPatchExecutor,
|
|
285
|
+
};
|
|
286
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@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AAE,KAAK;QACd,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACzB,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;aAC7B;YACD,QAAQ,EAAE,CAAC,OAAO,CAAC;SACpB;QACD,YAAY,EAAE;YACZ,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;gBAC1B,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;aAC7B;SACF;QACD,OAAO,EAAE,aAAa;KACvB;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAiC;IACzD,WAAW,EAAE,gBAAgC;IAC7C,YAAY,EAAE,iBAAiC;IAC/C,UAAU,EAAE,eAA+B;IAC3C,aAAa,EAAE,kBAAkC;IACjD,WAAW,EAAE,gBAAgC;IAC7C,WAAW,EAAE,eAA+B;IAC5C,YAAY,EAAE,gBAAgC;IAC9C,WAAW,EAAE,gBAAgC;IAC7C,aAAa,EAAE,kBAAkC;CAClD,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
kind: tool
|
|
3
|
+
name: list-dir
|
|
4
|
+
description: 列出工作区目录内容
|
|
5
|
+
sideEffect: readonly
|
|
6
|
+
idempotent: true
|
|
7
|
+
requiresApproval: false
|
|
8
|
+
timeout: 3000
|
|
9
|
+
inputSchema:
|
|
10
|
+
type: object
|
|
11
|
+
properties:
|
|
12
|
+
path:
|
|
13
|
+
type: string
|
|
14
|
+
recursive:
|
|
15
|
+
type: boolean
|
|
16
|
+
maxEntries:
|
|
17
|
+
type: number
|
|
18
|
+
pattern:
|
|
19
|
+
type: string
|
|
20
|
+
required: [path]
|
|
21
|
+
outputSchema:
|
|
22
|
+
type: object
|
|
23
|
+
properties:
|
|
24
|
+
entries:
|
|
25
|
+
type: array
|
|
26
|
+
execute: list-dir
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
列出目录下文件和子目录,支持递归和结果数量限制。
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ToolExecutor } from "../shared";
|
|
2
|
+
interface ListDirInput {
|
|
3
|
+
path: string;
|
|
4
|
+
recursive?: boolean;
|
|
5
|
+
maxEntries?: number;
|
|
6
|
+
pattern?: string;
|
|
7
|
+
}
|
|
8
|
+
interface ListDirEntry {
|
|
9
|
+
name: string;
|
|
10
|
+
type: "file" | "directory";
|
|
11
|
+
size?: number;
|
|
12
|
+
}
|
|
13
|
+
interface ListDirOutput {
|
|
14
|
+
entries: ListDirEntry[];
|
|
15
|
+
truncated: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 列目录 Tool 执行器。
|
|
19
|
+
*/
|
|
20
|
+
export declare const listDirExecutor: ToolExecutor<ListDirInput, ListDirOutput>;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/tools/list-dir/executor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAG9C,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,UAAU,aAAa;IACrB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,YAAY,CAAC,YAAY,EAAE,aAAa,CA2CrE,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { readdir, stat } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { resolveAllowedPath, toWorkspaceRelativePath } from "../../common/path";
|
|
4
|
+
import { assertNotAborted, resolveSandboxPolicy } from "../shared";
|
|
5
|
+
/**
|
|
6
|
+
* 列目录 Tool 执行器。
|
|
7
|
+
*/
|
|
8
|
+
export const listDirExecutor = async (input, context) => {
|
|
9
|
+
const recursive = input.recursive ?? false;
|
|
10
|
+
const maxEntries = input.maxEntries ?? 1000;
|
|
11
|
+
const matcher = input.pattern ? new RegExp(input.pattern) : undefined;
|
|
12
|
+
const root = resolveAllowedPath(input.path, resolveSandboxPolicy(context));
|
|
13
|
+
const entries = [];
|
|
14
|
+
let truncated = false;
|
|
15
|
+
const walk = async (dir) => {
|
|
16
|
+
assertNotAborted(context.abortSignal);
|
|
17
|
+
const children = await readdir(dir, { withFileTypes: true });
|
|
18
|
+
for (const child of children) {
|
|
19
|
+
// D1-LOW-10:长循环中周期性检查 AbortSignal,保证取消能及时生效。
|
|
20
|
+
assertNotAborted(context.abortSignal);
|
|
21
|
+
if (entries.length >= maxEntries) {
|
|
22
|
+
truncated = true;
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const absolute = join(dir, child.name);
|
|
26
|
+
const relative = toWorkspaceRelativePath(context.workspaceRoot, absolute);
|
|
27
|
+
if (matcher && !matcher.test(relative)) {
|
|
28
|
+
if (recursive && child.isDirectory()) {
|
|
29
|
+
await walk(absolute);
|
|
30
|
+
}
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (child.isDirectory()) {
|
|
34
|
+
entries.push({ name: relative, type: "directory" });
|
|
35
|
+
if (recursive) {
|
|
36
|
+
await walk(absolute);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else if (child.isFile()) {
|
|
40
|
+
const fileStat = await stat(absolute);
|
|
41
|
+
entries.push({ name: relative, type: "file", size: fileStat.size });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
await walk(root);
|
|
46
|
+
return { entries, truncated };
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../src/tools/list-dir/executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEhF,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAoBnE;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAA8C,KAAK,EAC7E,KAAK,EACL,OAAO,EACP,EAAE;IACF,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC;IAC3C,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC;IAC5C,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACtE,MAAM,IAAI,GAAG,kBAAkB,CAAC,KAAK,CAAC,IAAI,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3E,MAAM,OAAO,GAAmB,EAAE,CAAC;IACnC,IAAI,SAAS,GAAG,KAAK,CAAC;IAEtB,MAAM,IAAI,GAAG,KAAK,EAAE,GAAW,EAAiB,EAAE;QAChD,gBAAgB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QACtC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE,EAAE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AAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;AAChC,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
kind: tool
|
|
3
|
+
name: read-file
|
|
4
|
+
description: 读取工作区内的文件内容
|
|
5
|
+
sideEffect: readonly
|
|
6
|
+
idempotent: true
|
|
7
|
+
requiresApproval: false
|
|
8
|
+
timeout: 5000
|
|
9
|
+
inputSchema:
|
|
10
|
+
type: object
|
|
11
|
+
properties:
|
|
12
|
+
path:
|
|
13
|
+
type: string
|
|
14
|
+
encoding:
|
|
15
|
+
type: string
|
|
16
|
+
enum: [utf-8, base64]
|
|
17
|
+
required: [path]
|
|
18
|
+
outputSchema:
|
|
19
|
+
type: object
|
|
20
|
+
properties:
|
|
21
|
+
content:
|
|
22
|
+
type: string
|
|
23
|
+
bytes:
|
|
24
|
+
type: number
|
|
25
|
+
execute: read-file
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
读取工作区内文件内容。默认返回 UTF-8 文本,可选返回 base64。
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ToolExecutor } from "../shared";
|
|
2
|
+
interface ReadFileInput {
|
|
3
|
+
path: string;
|
|
4
|
+
encoding?: "utf-8" | "base64";
|
|
5
|
+
}
|
|
6
|
+
interface ReadFileOutput {
|
|
7
|
+
content: string;
|
|
8
|
+
bytes: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 读取文件 Tool 执行器。
|
|
12
|
+
*/
|
|
13
|
+
export declare const readFileExecutor: ToolExecutor<ReadFileInput, ReadFileOutput>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/tools/read-file/executor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAK9C,UAAU,aAAa;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC/B;AAED,UAAU,cAAc;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,YAAY,CAAC,aAAa,EAAE,cAAc,CAoBxE,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { stat, readFile } from "node:fs/promises";
|
|
2
|
+
import { ValidationError } from "@tachu/core";
|
|
3
|
+
import { resolveAllowedPath } from "../../common/path";
|
|
4
|
+
import { assertNotAborted, resolveSandboxPolicy } from "../shared";
|
|
5
|
+
const MAX_FILE_BYTES = 10 * 1024 * 1024;
|
|
6
|
+
/**
|
|
7
|
+
* 读取文件 Tool 执行器。
|
|
8
|
+
*/
|
|
9
|
+
export const readFileExecutor = async (input, context) => {
|
|
10
|
+
assertNotAborted(context.abortSignal);
|
|
11
|
+
const target = resolveAllowedPath(input.path, resolveSandboxPolicy(context));
|
|
12
|
+
const fileStat = await stat(target);
|
|
13
|
+
if (fileStat.size > MAX_FILE_BYTES) {
|
|
14
|
+
throw new ValidationError("VALIDATION_FILE_TOO_LARGE", `文件超过限制: ${fileStat.size} bytes > ${MAX_FILE_BYTES} bytes`, { context: { path: input.path, size: fileStat.size, max: MAX_FILE_BYTES } });
|
|
15
|
+
}
|
|
16
|
+
const bytes = await readFile(target);
|
|
17
|
+
return {
|
|
18
|
+
content: input.encoding === "base64" ? Buffer.from(bytes).toString("base64") : bytes.toString(),
|
|
19
|
+
bytes: bytes.byteLength,
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../src/tools/read-file/executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ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
|
2
|
+
kind: tool
|
|
3
|
+
name: run-shell
|
|
4
|
+
description: 在受控环境中执行 shell 命令
|
|
5
|
+
sideEffect: irreversible
|
|
6
|
+
idempotent: false
|
|
7
|
+
requiresApproval: true
|
|
8
|
+
timeout: 30000
|
|
9
|
+
inputSchema:
|
|
10
|
+
type: object
|
|
11
|
+
properties:
|
|
12
|
+
command:
|
|
13
|
+
type: string
|
|
14
|
+
args:
|
|
15
|
+
type: array
|
|
16
|
+
items:
|
|
17
|
+
type: string
|
|
18
|
+
cwd:
|
|
19
|
+
type: string
|
|
20
|
+
env:
|
|
21
|
+
type: object
|
|
22
|
+
timeoutMs:
|
|
23
|
+
type: number
|
|
24
|
+
required: [command]
|
|
25
|
+
outputSchema:
|
|
26
|
+
type: object
|
|
27
|
+
properties:
|
|
28
|
+
stdout:
|
|
29
|
+
type: string
|
|
30
|
+
stderr:
|
|
31
|
+
type: string
|
|
32
|
+
exitCode:
|
|
33
|
+
type: number
|
|
34
|
+
durationMs:
|
|
35
|
+
type: number
|
|
36
|
+
execute: run-shell
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
执行 shell 命令并返回 stdout/stderr,默认只继承 PATH/HOME/LANG 环境变量。
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ToolExecutor } from "../shared";
|
|
2
|
+
interface RunShellInput {
|
|
3
|
+
command: string;
|
|
4
|
+
args?: string[];
|
|
5
|
+
cwd?: string;
|
|
6
|
+
env?: Record<string, string>;
|
|
7
|
+
timeoutMs?: number;
|
|
8
|
+
}
|
|
9
|
+
interface RunShellOutput {
|
|
10
|
+
stdout: string;
|
|
11
|
+
stderr: string;
|
|
12
|
+
exitCode: number;
|
|
13
|
+
durationMs: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 执行 shell Tool 执行器。
|
|
17
|
+
*/
|
|
18
|
+
export declare const runShellExecutor: ToolExecutor<RunShellInput, RunShellOutput>;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/tools/run-shell/executor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAG9C,UAAU,aAAa;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,cAAc;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAoBD;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,YAAY,CAAC,aAAa,EAAE,cAAc,CA0DxE,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { ValidationError } from "@tachu/core";
|
|
2
|
+
import { resolveAllowedPath } from "../../common/path";
|
|
3
|
+
import { readStreamWithLimit, terminateProcess } from "../../common/process";
|
|
4
|
+
import { assertNotAborted, resolveSandboxPolicy } from "../shared";
|
|
5
|
+
const DEFAULT_TIMEOUT_MS = 30_000;
|
|
6
|
+
const STREAM_LIMIT_BYTES = 1024 * 1024;
|
|
7
|
+
const DEFAULT_ENV_ALLOWLIST = ["PATH", "HOME", "LANG"];
|
|
8
|
+
const buildSandboxedEnv = (extra) => {
|
|
9
|
+
const env = {};
|
|
10
|
+
for (const key of DEFAULT_ENV_ALLOWLIST) {
|
|
11
|
+
const value = process.env[key];
|
|
12
|
+
if (typeof value === "string") {
|
|
13
|
+
env[key] = value;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
for (const [key, value] of Object.entries(extra ?? {})) {
|
|
17
|
+
env[key] = value;
|
|
18
|
+
}
|
|
19
|
+
return env;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* 执行 shell Tool 执行器。
|
|
23
|
+
*/
|
|
24
|
+
export const runShellExecutor = async (input, context) => {
|
|
25
|
+
assertNotAborted(context.abortSignal);
|
|
26
|
+
if (!input.command || input.command.trim().length === 0) {
|
|
27
|
+
throw new ValidationError("VALIDATION_EMPTY_COMMAND", "command 不能为空");
|
|
28
|
+
}
|
|
29
|
+
const cwd = input.cwd
|
|
30
|
+
? resolveAllowedPath(input.cwd, resolveSandboxPolicy(context))
|
|
31
|
+
: context.workspaceRoot;
|
|
32
|
+
const timeoutMs = input.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
33
|
+
const startedAt = Date.now();
|
|
34
|
+
const processRef = Bun.spawn({
|
|
35
|
+
cmd: [input.command, ...(input.args ?? [])],
|
|
36
|
+
cwd,
|
|
37
|
+
env: buildSandboxedEnv(input.env),
|
|
38
|
+
stdout: "pipe",
|
|
39
|
+
stderr: "pipe",
|
|
40
|
+
});
|
|
41
|
+
const onAbort = () => {
|
|
42
|
+
if (processRef.pid) {
|
|
43
|
+
void terminateProcess(processRef.pid);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
context.abortSignal.addEventListener("abort", onAbort, { once: true });
|
|
47
|
+
const timeout = setTimeout(() => {
|
|
48
|
+
if (processRef.pid) {
|
|
49
|
+
void terminateProcess(processRef.pid);
|
|
50
|
+
}
|
|
51
|
+
}, timeoutMs);
|
|
52
|
+
try {
|
|
53
|
+
const [stdoutResult, stderrResult, exitCode] = await Promise.all([
|
|
54
|
+
readStreamWithLimit(processRef.stdout, STREAM_LIMIT_BYTES),
|
|
55
|
+
readStreamWithLimit(processRef.stderr, STREAM_LIMIT_BYTES),
|
|
56
|
+
processRef.exited,
|
|
57
|
+
]);
|
|
58
|
+
const stdout = stdoutResult.truncated
|
|
59
|
+
? `${stdoutResult.text}\n[truncated:${STREAM_LIMIT_BYTES}]`
|
|
60
|
+
: stdoutResult.text;
|
|
61
|
+
const stderr = stderrResult.truncated
|
|
62
|
+
? `${stderrResult.text}\n[truncated:${STREAM_LIMIT_BYTES}]`
|
|
63
|
+
: stderrResult.text;
|
|
64
|
+
return {
|
|
65
|
+
stdout,
|
|
66
|
+
stderr,
|
|
67
|
+
exitCode,
|
|
68
|
+
durationMs: Date.now() - startedAt,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
finally {
|
|
72
|
+
clearTimeout(timeout);
|
|
73
|
+
context.abortSignal.removeEventListener("abort", onAbort);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../src/tools/run-shell/executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7E,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAiBnE,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAClC,MAAM,kBAAkB,GAAG,IAAI,GAAG,IAAI,CAAC;AACvC,MAAM,qBAAqB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC;AAEhE,MAAM,iBAAiB,GAAG,CAAC,KAA8B,EAA0B,EAAE;IACnF,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,KAAK,MAAM,GAAG,IAAI,qBAAqB,EAAE,CAAC;QACxC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,GAAG,CAAC,GAA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