dsh-stock-analysis 0.2.6 → 0.2.7

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/dist/index.js CHANGED
@@ -1,25 +1,151 @@
1
+ // scripts/json-input.mjs
2
+ import { mkdtemp, writeFile, rm } from "node:fs/promises";
3
+ import { tmpdir } from "node:os";
4
+ import { join } from "node:path";
5
+ async function withJsonInput(input, execute) {
6
+ let directory;
7
+ let result;
8
+ try {
9
+ directory = await mkdtemp(join(tmpdir(), "stock-analysis-"));
10
+ const path = join(directory, "input.json");
11
+ await writeFile(path, JSON.stringify(input), { encoding: "utf8", mode: 384 });
12
+ result = await execute(path);
13
+ } catch {
14
+ result = JSON.stringify({ error: "Analysis command failed; check input and interpreter/dependencies" });
15
+ } finally {
16
+ if (directory) {
17
+ try {
18
+ await rm(directory, { recursive: true, force: true });
19
+ } catch {
20
+ result = JSON.stringify({ error: "Could not remove temporary analysis input" });
21
+ }
22
+ }
23
+ }
24
+ return result;
25
+ }
26
+
27
+ // tools/cli_budgets.json
28
+ var cli_budgets_default = {
29
+ default: 120,
30
+ "stock_data.py:market_snapshot": 240,
31
+ "screener.py:screen": 390,
32
+ "sec_edgar.py:holdings": 300,
33
+ "technical.py:analyze": 150,
34
+ "market_regime.py:detect": 270,
35
+ "backtest.py:run": 270,
36
+ "risk_screening.py:screen": 450,
37
+ "signal_tracker.py:evaluate": 300,
38
+ "stock_data.py:market_stats": 240,
39
+ "market_review.py:review": 300,
40
+ "anomaly_detect.py:detect": 390,
41
+ "position_context.py:analyze": 300,
42
+ "alert_rules.py:check": 480,
43
+ "technical.py:calculate_ma": 150,
44
+ "value_data.py:dividends": 300,
45
+ "value_data.py:etf_details": 450,
46
+ "watchlist.py:analyze": 30,
47
+ "watchlist_context.py:build": 30,
48
+ l2_batch: 360,
49
+ l2_workers: 6,
50
+ watchlist_item: 480,
51
+ "stateless_analysis.py:event_study": 300,
52
+ "stateless_analysis.py:robustness": 660
53
+ };
54
+
55
+ // scripts/cli-timeout.mjs
56
+ import { basename } from "node:path";
57
+ function commandTimeout(script, args) {
58
+ const key = `${basename(script)}:${args[0] ?? ""}`;
59
+ let budget = cli_budgets_default[key] ?? cli_budgets_default.default;
60
+ const option = (name2, fallback) => args.includes(name2) ? args[args.indexOf(name2) + 1] ?? fallback : fallback;
61
+ const positiveInt = (value, fallback) => /^\d+$/.test(String(value)) && Number(value) > 0 ? Number(value) : fallback;
62
+ if (key === "screener.py:screen") {
63
+ budget += Math.ceil(positiveInt(option("--top", 20), 20) / cli_budgets_default.l2_workers) * cli_budgets_default.l2_batch;
64
+ } else if (key === "watchlist.py:analyze" || key === "watchlist_context.py:build") {
65
+ const count = String(args[1] ?? "").split(",").filter((s) => s.trim()).length;
66
+ const workers = positiveInt(option("--workers", 3), 3);
67
+ budget += Math.ceil(count / workers) * cli_budgets_default.watchlist_item;
68
+ if (key === "watchlist_context.py:build") {
69
+ budget += Math.ceil(count / Math.min(workers * 2, 6)) * cli_budgets_default["anomaly_detect.py:detect"];
70
+ if (args.includes("--include-market-review")) budget += 3 * cli_budgets_default["market_review.py:review"] + 30;
71
+ }
72
+ } else if (key === "market_review.py:review" && option("--market", "A") === "all") {
73
+ budget = 3 * budget + 30;
74
+ } else if (key === "technical.py:analyze" && args.includes("--periods")) {
75
+ const periods = String(option("--periods", "daily")).split(",").map((p) => p.trim()).filter(Boolean);
76
+ budget *= (/* @__PURE__ */ new Set([option("--period", "daily"), ...periods])).size;
77
+ }
78
+ return budget * 1e3 + 3e4;
79
+ }
80
+
1
81
  // dsh/index.ts
2
82
  import { existsSync, readdirSync, readFileSync } from "node:fs";
3
83
  import * as cp from "node:child_process";
4
84
  import { promisify } from "node:util";
5
- import { dirname, join as join2 } from "node:path";
85
+ import { dirname, join as join3 } from "node:path";
6
86
  import { fileURLToPath } from "node:url";
7
87
  import {
8
- defineTool
88
+ defineTool as defineTool2
9
89
  } from "@deepseek-ai/dsh-tools";
10
90
 
11
91
  // scripts/venv-python.mjs
12
- import { join } from "node:path";
92
+ import { join as join2 } from "node:path";
13
93
  var isWin = process.platform === "win32";
14
94
  function venvPythonPath(rootDir) {
15
- return join(rootDir, ".venv", isWin ? "Scripts" : "bin", isWin ? "python.exe" : "python3");
95
+ return join2(rootDir, ".venv", isWin ? "Scripts" : "bin", isWin ? "python.exe" : "python3");
96
+ }
97
+
98
+ // dsh/discovery.ts
99
+ import { defineTool } from "@deepseek-ai/dsh-tools";
100
+ var SEARCH = "stock_tool_search";
101
+ function registerToolDiscovery(ctx, names) {
102
+ if (typeof ctx.on !== "function" || typeof ctx.tools.get !== "function" || typeof ctx.tools.presentAs !== "function" || names.size === 0 || ctx.tools.get(SEARCH)) return;
103
+ const states = /* @__PURE__ */ new WeakMap();
104
+ ctx.tools.register(defineTool({
105
+ name: SEARCH,
106
+ description: "\u641C\u7D22\u5E76\u52A0\u8F7D\u80A1\u7968\u5206\u6790\u5DE5\u5177\uFF1B\u652F\u6301\u4E2D\u6587\u3001\u82F1\u6587\u5173\u952E\u8BCD\u6216\u786E\u5207\u5DE5\u5177\u540D\uFF0C\u5982\u8D22\u52A1\u3001get_quote\u3001run_backtest\u3002\u5339\u914D\u5DE5\u5177\u5C06\u5728\u4E0B\u4E00\u6B21\u6A21\u578B\u8BF7\u6C42\u63D0\u4F9B\u5B8C\u6574\u53C2\u6570\uFF0C\u53EF\u6309\u539F\u540D\u76F4\u63A5\u8C03\u7528\u3002\u4E0D\u4F1A\u6267\u884C\u5206\u6790\u6216\u6269\u5927\u6743\u9650\u3002",
107
+ parameters: {
108
+ query: { type: "string", required: true, description: "\u5DE5\u5177\u540D\u79F0\u6216\u529F\u80FD\u5173\u952E\u8BCD" },
109
+ limit: { type: "integer", description: "\u6700\u591A\u52A0\u8F7D\u6570\u91CF\uFF0C\u9ED8\u8BA45\uFF0C\u8303\u56F41\u523020" }
110
+ },
111
+ output: { schema: { type: "string" }, render: (_args, value) => [{ type: "text", text: value }] },
112
+ async execute({ query, limit = 5 }, exec) {
113
+ const needle = query.trim().toLowerCase();
114
+ const terms = [...new Set(needle.match(/[a-z0-9_]+|\p{Script=Han}/gu) ?? [])];
115
+ if (!terms.length || !Number.isInteger(limit) || limit < 1 || limit > 20) {
116
+ return JSON.stringify({ error: "query must contain searchable text and limit must be an integer from 1 to 20" });
117
+ }
118
+ const state = exec.agent && states.get(exec.agent);
119
+ if (!state) return JSON.stringify({ error: "Tool discovery is unavailable for this agent; use its directly exposed tools" });
120
+ const candidates = state.catalog.filter((tool) => ctx.tools.get(tool.name, exec.agent)).map((tool) => ({ tool, text: `${tool.name} ${tool.description}`.toLowerCase() }));
121
+ const weights = terms.map((term) => 1 / (1 + candidates.filter(({ text }) => text.includes(term)).length));
122
+ const matches = candidates.map(({ tool, text }) => {
123
+ const score = (tool.name === needle ? 1e3 : 0) + (text.includes(needle) ? 10 : 0) + terms.reduce((sum, term, index) => sum + weights[index] * (tool.name.includes(term) ? 3 : text.includes(term) ? 1 : 0), 0);
124
+ return { tool, score };
125
+ }).filter((match) => match.score > 0).sort((a, b) => b.score - a.score || a.tool.name.localeCompare(b.tool.name)).slice(0, limit);
126
+ for (const { tool } of matches) state.loaded.add(tool.name);
127
+ return JSON.stringify({ loaded: matches.map(({ tool }) => ({ name: tool.name, description: tool.description })) });
128
+ }
129
+ }));
130
+ ctx.on("system-prompt/assemble", async (_assembly, context, next) => {
131
+ const result = await next();
132
+ if (!context.scope) return result;
133
+ if (!result.tools.some((tool) => tool.name === SEARCH) || result.tools.some((tool) => tool.name === "run_code")) {
134
+ states.delete(context.scope);
135
+ return result;
136
+ }
137
+ const state = states.get(context.scope) ?? { catalog: [], loaded: /* @__PURE__ */ new Set() };
138
+ state.catalog = result.tools.filter((tool) => names.has(tool.name));
139
+ states.set(context.scope, state);
140
+ return { ...result, tools: result.tools.filter((tool) => !names.has(tool.name) || state.loaded.has(tool.name)) };
141
+ });
16
142
  }
17
143
 
18
144
  // dsh/index.ts
19
145
  var defaultExecutor = async (bin, argv) => {
20
146
  const exec = promisify(cp.execFile);
21
147
  try {
22
- const { stdout } = await exec(bin, argv, { maxBuffer: 32 * 1024 * 1024 });
148
+ const { stdout } = await exec(bin, argv, { maxBuffer: 32 * 1024 * 1024, timeout: commandTimeout(argv[0], argv.slice(1)) });
23
149
  return stdout;
24
150
  } catch (error) {
25
151
  const stdout = error.stdout;
@@ -28,7 +154,7 @@ var defaultExecutor = async (bin, argv) => {
28
154
  if (data && typeof data.error === "string") return stdout;
29
155
  } catch {
30
156
  }
31
- return JSON.stringify({ error: "Python command failed; check interpreter/dependencies" });
157
+ return JSON.stringify({ error: error.killed ? "Python command timed out" : "Python command failed; check interpreter/dependencies" });
32
158
  }
33
159
  };
34
160
  var executor = defaultExecutor;
@@ -36,21 +162,21 @@ function __setExecutor(fn) {
36
162
  executor = fn;
37
163
  }
38
164
  var here = dirname(fileURLToPath(import.meta.url));
39
- var toolsDir = join2(here, "..", "tools");
165
+ var toolsDir = join3(here, "..", "tools");
40
166
  var pkgRoot = dirname(toolsDir);
41
167
  var isWin2 = process.platform === "win32";
42
168
  function pythonBin() {
43
- for (const root of [pkgRoot, join2(pkgRoot, "..")]) {
169
+ for (const root of [pkgRoot, join3(pkgRoot, "..")]) {
44
170
  const candidate = venvPythonPath(root);
45
171
  if (existsSync(candidate)) return candidate;
46
172
  }
47
173
  return isWin2 ? "python" : "python3";
48
174
  }
49
175
  async function runPy(script, args) {
50
- return executor(pythonBin(), [join2(toolsDir, script), ...args]);
176
+ return executor(pythonBin(), [join3(toolsDir, script), ...args]);
51
177
  }
52
178
  function pyTool(opts) {
53
- return defineTool({
179
+ return defineTool2({
54
180
  name: opts.name,
55
181
  description: opts.description,
56
182
  parameters: opts.parameters,
@@ -63,7 +189,7 @@ function pyTool(opts) {
63
189
  }
64
190
  });
65
191
  }
66
- var skillsDir = join2(here, "..", "skills");
192
+ var skillsDir = join3(here, "..", "skills");
67
193
  function frontmatterValue(raw, key) {
68
194
  const block = raw.match(/^---\r?\n([\s\S]*?)\r?\n---/);
69
195
  const line = block?.[1].match(new RegExp(`^${key}:\\s*(.+)$`, "m"));
@@ -73,7 +199,7 @@ function registerSkills(ctx) {
73
199
  if (!existsSync(skillsDir)) return;
74
200
  for (const child of readdirSync(skillsDir, { withFileTypes: true })) {
75
201
  if (!child.isDirectory()) continue;
76
- const skillFile = join2(skillsDir, child.name, "SKILL.md");
202
+ const skillFile = join3(skillsDir, child.name, "SKILL.md");
77
203
  if (!existsSync(skillFile)) continue;
78
204
  const raw = readFileSync(skillFile, "utf-8");
79
205
  ctx.skills.register({
@@ -84,13 +210,17 @@ function registerSkills(ctx) {
84
210
  content: raw.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/, "").trimStart(),
85
211
  source: "bundled",
86
212
  path: skillFile,
87
- resourceBase: { kind: "directory", path: join2(skillsDir, child.name) }
213
+ resourceBase: { kind: "directory", path: join3(skillsDir, child.name) }
88
214
  });
89
215
  }
90
216
  }
91
217
  var name = "stock-analysis";
92
218
  var inject = ["tools", "skills"];
93
- function apply(ctx) {
219
+ function apply(ctx, config = {}) {
220
+ if (config.toolDiscovery !== void 0 && typeof config.toolDiscovery !== "boolean") {
221
+ throw new TypeError("toolDiscovery must be a boolean");
222
+ }
223
+ const previousTools = new Set(ctx.tools.schemas?.().map((tool) => tool.name));
94
224
  ctx.tools.register(
95
225
  pyTool({
96
226
  name: "get_announcements",
@@ -315,7 +445,7 @@ function apply(ctx) {
315
445
  ctx.tools.register(
316
446
  pyTool({
317
447
  name: "get_kline",
318
- description: "\u83B7\u53D6\u80A1\u7968K\u7EBF\u6570\u636E\uFF08OHLCV\uFF09\u3002\u652F\u6301A\u80A1\uFF08\u5982600519\uFF09\u3001\u6E2F\u80A1\uFF08\u598200700.HK\uFF09\u3001\u7F8E\u80A1\uFF08\u5982AAPL\uFF09\u3001\u65E5\u80A1\uFF08\u59827203.T\uFF09\u3001\u97E9\u80A1\uFF08\u5982005930.KS\uFF09\u3001\u53F0\u80A1\uFF08\u59822330.TW\uFF09\u53CAA\u80A1ETF\u3002A\u80A1\u80A1\u7968/ETF\u8FD4\u56DE\u524D\u590D\u6743\u4EF7\u683C\uFF0C\u6BCF\u6761\u8BB0\u5F55 adjusted=qfq\uFF1Bsh000xxx/sz399xxx \u6307\u6570\u8FD4\u56DE\u539F\u59CB\u70B9\u4F4D\uFF0Cadjusted=none\u3002\u9700\u8981\u5386\u53F2\u4EF7\u683C\u81EA\u884C\u8BA1\u7B97\u6216\u753B\u56FE\u65F6\u7528\uFF1B\u53EA\u95EE\u6307\u6807\u7528 get_technical_analysis\uFF0C\u53EA\u95EE\u73B0\u4EF7\u7528 get_quote",
448
+ description: "\u83B7\u53D6\u80A1\u7968K\u7EBF\u6570\u636E\uFF08OHLCV\uFF09\u3002\u652F\u6301A\u80A1\uFF08\u5982600519\uFF09\u3001\u6E2F\u80A1\uFF08\u598200700.HK\uFF09\u3001\u7F8E\u80A1\uFF08\u5982AAPL\uFF09\u3001\u65E5\u80A1\uFF08\u59827203.T\uFF09\u3001\u97E9\u80A1\uFF08\u5982005930.KS\uFF09\u3001\u53F0\u80A1\uFF08\u59822330.TW\uFF09\u53CAA\u80A1ETF\u3002A\u80A1\u80A1\u7968/ETF\u8FD4\u56DE\u524D\u590D\u6743\u4EF7\u683C\uFF0C\u6BCF\u6761\u8BB0\u5F55 adjusted=qfq\uFF1Bsh000xxx/sz399xxx \u6307\u6570\u8FD4\u56DE\u539F\u59CB\u70B9\u4F4D\uFF0Cadjusted=none\u3002\u9700\u8981\u5386\u53F2\u4EF7\u683C\u81EA\u884C\u8BA1\u7B97\u6216\u753B\u56FE\u65F6\u7528\uFF1B\u53EA\u95EE\u6307\u6807\u7528 get_technical_analysis\uFF0C\u53EA\u95EE\u73B0\u4EF7\u7528 get_quote\u3002\u6BCF\u6761\u8BB0\u5F55\u9644 source\u3001UTC fetched_at\u3001data_as_of \u548C adjusted\uFF1B\u975EA\u80A1\u590D\u6743\u53E3\u5F84\u53EF\u80FD\u4E3Atotal_return/qfq/unknown\uFF0C\u672A\u77E5\u4E0D\u80FD\u5047\u5B9A\u5DF2\u590D\u6743\u3002\u90E8\u5206\u6765\u6E90\u9644 adjustment_factor\uFF08\u590D\u6743\u4EF7\u683C/\u539F\u59CB\u4EF7\u683C\uFF09\uFF1B\u7F3A\u5931\u4E0D\u80FD\u731C\u6D4B\u6362\u7B97\u7CFB\u6570\u3002",
319
449
  parameters: {
320
450
  symbol: {
321
451
  type: "string",
@@ -343,7 +473,7 @@ function apply(ctx) {
343
473
  ctx.tools.register(
344
474
  pyTool({
345
475
  name: "get_quote",
346
- description: "\u83B7\u53D6\u80A1\u7968\u5B9E\u65F6\u884C\u60C5\u62A5\u4EF7\uFF08\u73B0\u4EF7\u3001\u6DA8\u8DCC\u5E45\u3001\u91CF\u6BD4\u7B49\uFF09\u3002\u652F\u6301A\u80A1\u3001\u6E2F\u80A1\u3001\u7F8E\u80A1\u3001\u65E5\u80A1\u3001\u97E9\u80A1\u3001\u53F0\u80A1\uFF1B\u975E\u4EA4\u6613\u65F6\u6BB5\u8FD4\u56DE\u6700\u8FD1\u4EA4\u6613\u65E5\u6536\u76D8\u4EF7\u5E76\u4EE5 as_of/stale \u6807\u6CE8\uFF1BETF \u7684 premium_discount_rate \u4E3A\u6B63=\u6EA2\u4EF7\u3001\u8D1F=\u6298\u4EF7",
476
+ description: "\u83B7\u53D6\u80A1\u7968\u5B9E\u65F6\u884C\u60C5\u62A5\u4EF7\uFF08\u73B0\u4EF7\u3001\u6DA8\u8DCC\u5E45\u3001\u91CF\u6BD4\u7B49\uFF09\u3002\u652F\u6301A\u80A1\u3001\u6E2F\u80A1\u3001\u7F8E\u80A1\u3001\u65E5\u80A1\u3001\u97E9\u80A1\u3001\u53F0\u80A1\uFF1B\u975E\u4EA4\u6613\u65F6\u6BB5\u8FD4\u56DE\u6700\u8FD1\u4EA4\u6613\u65E5\u6536\u76D8\u4EF7\u5E76\u4EE5 as_of/stale \u6807\u6CE8\uFF1BETF \u7684 premium_discount_rate \u4E3A\u6B63=\u6EA2\u4EF7\u3001\u8D1F=\u6298\u4EF7\u3002\u8FD4\u56DE source\u3001UTC fetched_at \u548C\u63D0\u4F9B\u65B9 data_as_of\uFF08\u672A\u77E5\u4E3Anull\uFF09\uFF1Bas_of_basis\u533A\u5206\u63D0\u4F9B\u65B9\u65F6\u95F4\u4E0E\u4EA4\u6613\u65E5\u5386\u63A8\u65AD\uFF0C\u91C7\u96C6\u65F6\u95F4\u4E0D\u7B49\u4E8E\u884C\u60C5\u65F6\u95F4\u3002",
347
477
  parameters: {
348
478
  symbol: { type: "string", required: true, description: "\u80A1\u7968\u4EE3\u7801\uFF08A\u80A1\u5982600519\uFF0C\u7F8E\u80A1\u5982AAPL\uFF0C\u6E2F\u80A1\u598200700.HK\uFF09" }
349
479
  },
@@ -667,7 +797,7 @@ function apply(ctx) {
667
797
  ctx.tools.register(
668
798
  pyTool({
669
799
  name: "screen_stocks",
670
- description: "\u5168\u5E02\u573A\u80A1\u7968\u7B5B\u9009\uFF08AlphaSift L1 \u591A\u56E0\u5B50\u786C\u7B5B + \u5E02\u573A\u60C5\u7EEA\u8C03\u8282\uFF09\u3002\u6309PE/PB/\u5E02\u503C/\u6362\u624B\u7387/\u6DA8\u8DCC\u5E45/\u91CF\u6BD4\u7B49\u56E0\u5B50\u8FC7\u6EE4\u548C\u8BC4\u5206\uFF0C\u53EF\u7528 l2 \u5F00\u542F\u8D28\u91CF/\u6210\u957F/\u52A8\u91CF/\u6CE2\u52A8\u7387/\u8D44\u91D1\u6D41\u589E\u5F3A\u3002\u663E\u5F0F\u7B5B\u9009\u6761\u4EF6\u7F3A\u5C11\u6570\u636E\u65F6\u62A5error\uFF0Cfilters_applied\u53EA\u5217\u5B9E\u9645\u6267\u884C\u7684\u6761\u4EF6",
800
+ description: "\u5168\u5E02\u573A\u80A1\u7968\u7B5B\u9009\uFF08AlphaSift L1 \u591A\u56E0\u5B50\u786C\u7B5B + \u5E02\u573A\u60C5\u7EEA\u8C03\u8282\uFF09\u3002\u6309PE/PB/\u5E02\u503C/\u6362\u624B\u7387/\u6DA8\u8DCC\u5E45/\u91CF\u6BD4\u7B49\u56E0\u5B50\u8FC7\u6EE4\u548C\u8BC4\u5206\uFF0C\u53EF\u7528 l2 \u5F00\u542F\u8D28\u91CF/\u6210\u957F/\u52A8\u91CF/\u6CE2\u52A8\u7387/\u8D44\u91D1\u6D41\u589E\u5F3A\u3002\u663E\u5F0F\u7B5B\u9009\u6761\u4EF6\u7F3A\u5C11\u6570\u636E\u65F6\u62A5error\uFF0Cfilters_applied\u53EA\u5217\u5B9E\u9645\u6267\u884C\u7684\u6761\u4EF6\u3002\u5019\u9009factor_coverage\u5217\u51FA\u53EF\u7528/\u7F3A\u5931\u56E0\u5B50\u3001\u52A0\u6743\u8986\u76D6\u7387\u548Ceffective_weights\uFF1BL1\u4E0EL2\u5747\u6309\u53EF\u7528\u56E0\u5B50\u5F52\u4E00\u5316\u540E\u6392\u5E8F\uFF0C\u7F3A\u5931/\u975E\u6709\u9650\u503C\u4E0D\u6309\u96F6\u5206\u8BA1\uFF1BL2\u53E6\u8FD4\u56DEeffective_scores\u4F9B\u7ED3\u5408\u5E02\u573A\u7CFB\u6570\u590D\u7B97final\uFF0C\u6309\u53EF\u7528\u56E0\u5B50\u91CD\u5F52\u4E00\u5316\uFF0C\u9AD8\u5206\u4E0D\u4EE3\u8868\u6570\u636E\u5B8C\u6574\u3002\u9009\u80A1\u9884\u7B97\u6309\u5019\u9009\u6570\u91CF\u53CA\u91C7\u96C6\u6279\u6B21\u8BA1\u7B97\uFF0Ctop\u987B\u4E3A\u6B63\u6574\u6570\u3002",
671
801
  parameters: {
672
802
  market: {
673
803
  type: "string",
@@ -690,7 +820,7 @@ function apply(ctx) {
690
820
  ctx.tools.register(
691
821
  pyTool({
692
822
  name: "run_backtest",
693
- description: "\u7B56\u7565\u56DE\u6D4B\uFF08AlphaEvo\uFF09\u3002\u8BFB\u53D6YAML\u7B56\u7565\u5B9A\u4E49\uFF0C\u5728\u5386\u53F2\u6570\u636E\u4E0A\u6A21\u62DF\u4EA4\u6613\uFF0C\u8F93\u51FA\u6536\u76CA\u7387/\u56DE\u64A4/\u80DC\u7387\u7B49\u6307\u6807\u3002\u53EA\u60F3\u77E5\u9053\u5355\u4E2A\u6280\u672F\u4FE1\u53F7\u7684\u5386\u53F2\u80DC\u7387\u7528\u66F4\u8F7B\u91CF\u7684 evaluate_signal\u3002period\u4E3A\u5B9E\u9645\u6570\u636E\u671F\u95F4\uFF0Crequested_period\u4FDD\u7559\u8BF7\u6C42\u671F\u95F4\uFF0Cwarnings\u63D0\u793A\u8986\u76D6\u5DEE\u5F02\uFF1B\u5E74\u5316\u6309\u5B9E\u9645\u671F\u95F4\u8BA1\u7B97",
823
+ description: "\u7B56\u7565\u56DE\u6D4B\uFF08AlphaEvo\uFF09\u3002\u8BFB\u53D6YAML\u7B56\u7565\u5B9A\u4E49\uFF0C\u5728\u5386\u53F2\u6570\u636E\u4E0A\u6A21\u62DF\u4EA4\u6613\uFF0C\u8F93\u51FA\u6536\u76CA\u7387/\u56DE\u64A4/\u80DC\u7387\u7B49\u6307\u6807\u3002\u53EA\u60F3\u77E5\u9053\u5355\u4E2A\u6280\u672F\u4FE1\u53F7\u7684\u5386\u53F2\u80DC\u7387\u7528\u66F4\u8F7B\u91CF\u7684 evaluate_signal\u3002period\u4E3A\u5B9E\u9645\u6570\u636E\u671F\u95F4\uFF0Crequested_period\u4FDD\u7559\u8BF7\u6C42\u671F\u95F4\uFF0Cwarnings\u63D0\u793A\u8986\u76D6\u5DEE\u5F02\uFF1B\u5E74\u5316\u6309\u5B9E\u9645\u671F\u95F4\u8BA1\u7B97\u3002\u9ED8\u8BA4\u524D\u65E5\u6536\u76D8\u4FE1\u53F7\u3001\u6B21\u65E5\u5F00\u76D8\u6210\u4EA4\uFF1BYAML simulation.execution=same_close\u53EF\u590D\u73B0\u65E7\u5047\u8BBE\u3002execution\u8FD4\u56DE\u6A21\u578B\u3001\u963B\u6B62\u6210\u4EA4\u6B21\u6570\u548C\u672A\u6A21\u62DF\u7EA6\u675F\uFF1B\u96F6\u6210\u4EA4\u91CF\u53CA\u5E26\u5386\u53F2\u9650\u4EF7\u7684\u4E00\u5B57\u677F\u4E0D\u6210\u4EA4\u3002",
694
824
  parameters: {
695
825
  strategy: { type: "string", required: true, description: "\u7B56\u7565YAML\u6587\u4EF6\u8DEF\u5F84" },
696
826
  symbol: { type: "string", required: true, description: "\u80A1\u7968\u4EE3\u7801\uFF08A\u80A1\u5982600519\uFF0C\u7F8E\u80A1\u5982AAPL\uFF0C\u6E2F\u80A1\u598200700.HK\uFF09" },
@@ -978,7 +1108,7 @@ function apply(ctx) {
978
1108
  ctx.tools.register(
979
1109
  pyTool({
980
1110
  name: "get_market_review",
981
- description: "\u5927\u76D8\u590D\u76D8 \u2014 \u83B7\u53D6\u5E02\u573A\u65E5\u5EA6\u590D\u76D8\u6570\u636E\uFF0C\u5305\u542B\u6307\u6570\u3001\u6DA8\u8DCC\u7EDF\u8BA1\u3001\u677F\u5757\u6392\u540D\u3001\u65B0\u95FB\u3001\u5E02\u573A\u6E29\u5EA6\u4E0E\u7B56\u7565\u5EFA\u8BAE\u3002\u590D\u76D8\u7C7B\u9700\u6C42\u7684\u9996\u9009\uFF0C\u65E0\u9700\u518D\u5206\u522B\u8C03\u6307\u6570/\u7EDF\u8BA1/\u677F\u5757\u5DE5\u5177",
1111
+ description: "\u5927\u76D8\u590D\u76D8 \u2014 \u83B7\u53D6\u5E02\u573A\u65E5\u5EA6\u590D\u76D8\u6570\u636E\uFF0C\u5305\u542B\u6307\u6570\u3001\u6DA8\u8DCC\u7EDF\u8BA1\u3001\u677F\u5757\u6392\u540D\u3001\u65B0\u95FB\u3001\u5E02\u573A\u6E29\u5EA6\u4E0E\u7B56\u7565\u5EFA\u8BAE\u3002\u590D\u76D8\u7C7B\u9700\u6C42\u7684\u9996\u9009\uFF0C\u65E0\u9700\u518D\u5206\u522B\u8C03\u6307\u6570/\u7EDF\u8BA1/\u677F\u5757\u5DE5\u5177\u3002\u6570\u636E\u4E0D\u8DB3\u65F6\u6E29\u5EA6score\u53CAstrategy_stance\u4E3Anull\uFF0C\u4FE1\u53F7unknown\uFF1Bwarnings/data_quality\u8BF4\u660E\u9650\u5236",
982
1112
  parameters: {
983
1113
  market: {
984
1114
  type: "string",
@@ -1058,7 +1188,7 @@ function apply(ctx) {
1058
1188
  ctx.tools.register(
1059
1189
  pyTool({
1060
1190
  name: "render_stock_report",
1061
- description: "\u80A1\u7968\u5206\u6790\u62A5\u544A\u6E32\u67D3 \u2014 \u5C06\u7ED3\u6784\u5316\u62A5\u544A JSON \u901A\u8FC7 j2 \u6A21\u677F\u6E32\u67D3\u4E3A Markdown\u3002report \u5B57\u6BB5\u4EE5 skill \u63D0\u4F9B\u7684 report_schema \u4E3A\u51C6\uFF0C\u4E0D\u8981\u81EA\u9020\u5B57\u6BB5\u3002template: brief|full\u3002\u5168\u90E8\u5206\u6790\u5B8C\u6210\u540E\u7684\u6700\u540E\u4E00\u6B65\u8C03\u7528\u3002\u4EC5\u6E32\u67D3\uFF0C\u4E0D\u4FDD\u5B58\u4E0D\u63A8\u9001",
1191
+ description: "\u80A1\u7968\u5206\u6790\u62A5\u544A\u6E32\u67D3 \u2014 \u5C06\u7ED3\u6784\u5316\u62A5\u544A JSON \u901A\u8FC7 j2 \u6A21\u677F\u6E32\u67D3\u4E3A Markdown\u3002report \u5B57\u6BB5\u4EE5 skill \u63D0\u4F9B\u7684 report_schema \u4E3A\u51C6\uFF0C\u4E0D\u8981\u81EA\u9020\u5B57\u6BB5\u3002template: brief|full\u3002\u5168\u90E8\u5206\u6790\u5B8C\u6210\u540E\u7684\u6700\u540E\u4E00\u6B65\u8C03\u7528\u3002\u4EC5\u6E32\u67D3\uFF0C\u4E0D\u4FDD\u5B58\u4E0D\u63A8\u9001\u3002report\u53EF\u5305\u542Bevidence\uFF08path/label/value/source/as_of\uFF09\u4E0Edata_quality\uFF08flags/limitations\uFF09\uFF0Cbrief/full\u5747\u5C55\u793A\u8BC1\u636E\u548C\u9650\u5236\u3002",
1062
1192
  parameters: {
1063
1193
  report: {
1064
1194
  type: "object",
@@ -1118,7 +1248,7 @@ function apply(ctx) {
1118
1248
  ctx.tools.register(
1119
1249
  pyTool({
1120
1250
  name: "build_watchlist_context",
1121
- description: "\u81EA\u9009\u80A1\u4E0A\u4E0B\u6587\u5305 \u2014 \u5BF9\u591A\u53EA\u80A1\u7968\u8F93\u51FA\u8BC4\u5206/\u8D8B\u52BF/\u5F02\u5E38/\u98CE\u9669/\u5EFA\u8BAE next_tools \u7684 agent \u53CB\u597D\u6458\u8981\u3002\u5BBF\u4E3B agent \u51B3\u5B9A\u5982\u4F55\u5199\u65E5\u62A5\u6216\u6DF1\u5165\u5206\u6790",
1251
+ description: "\u81EA\u9009\u80A1\u4E0A\u4E0B\u6587\u5305 \u2014 \u5BF9\u591A\u53EA\u80A1\u7968\u8F93\u51FA\u8BC4\u5206/\u8D8B\u52BF/\u5F02\u5E38/\u98CE\u9669/\u5EFA\u8BAE next_tools \u7684 agent \u53CB\u597D\u6458\u8981\u3002\u5BBF\u4E3B agent \u51B3\u5B9A\u5982\u4F55\u5199\u65E5\u62A5\u6216\u6DF1\u5165\u5206\u6790\u3002\u5F02\u52A8\u68C0\u67E5\u5931\u8D25\u65F6anomaly_status=unavailable\u3001anomaly_count=null\uFF0C\u4FDD\u7559anomaly_error/warnings\uFF1B\u6C47\u603B\u8BA1\u5165partial",
1122
1252
  parameters: {
1123
1253
  symbols: { type: "string", required: true, description: "\u9017\u53F7\u5206\u9694\u7684\u80A1\u7968\u4EE3\u7801\u5217\u8868" },
1124
1254
  include_market_review: {
@@ -1223,7 +1353,7 @@ function apply(ctx) {
1223
1353
  ctx.tools.register(
1224
1354
  pyTool({
1225
1355
  name: "evaluate_signals",
1226
- description: "\u8BC4\u4F30\u5230\u671F\u4FE1\u53F7\uFF1A\u62C9\u53D6\u8BB0\u5F55\u65E5\u4E4B\u540E\u7684\u65E5K\uFF0C\u5224\u5B9A target_hit/stop_hit/timeout \u5E76\u8BA1\u7B97\u6536\u76CA\uFF0C\u56DE\u5199\u5B58\u50A8\u3002\u8BB0\u5F55\u5EFA\u8BAE\u7528 record_signal\uFF0C\u80DC\u7387\u590D\u76D8\u7528 get_signal_summary\u3002\u5386\u53F2K\u7EBF\u672A\u8986\u76D6\u8BB0\u5F55\u65E5\u65F6skipped_no_data\u5E76\u4FDD\u6301\u672A\u7ED3\u7B97\uFF0C\u4E0D\u80FD\u7528\u8F83\u65B0\u884C\u60C5\u4EE3\u66FF",
1356
+ description: "\u8BC4\u4F30\u5230\u671F\u4FE1\u53F7\uFF1A\u62C9\u53D6\u8BB0\u5F55\u65E5\u4E4B\u540E\u7684\u65E5K\uFF0C\u5224\u5B9A target_hit/stop_hit/timeout \u5E76\u8BA1\u7B97\u6536\u76CA\uFF0C\u56DE\u5199\u5B58\u50A8\u3002\u8BB0\u5F55\u5EFA\u8BAE\u7528 record_signal\uFF0C\u80DC\u7387\u590D\u76D8\u7528 get_signal_summary\u3002\u5386\u53F2K\u7EBF\u672A\u8986\u76D6\u8BB0\u5F55\u65E5\u65F6skipped_no_data\u5E76\u4FDD\u6301\u672A\u7ED3\u7B97\uFF0C\u4E0D\u80FD\u7528\u8F83\u65B0\u884C\u60C5\u4EE3\u66FF\u3002\u539F\u59CB\u4FE1\u53F7\u4EF7\u4E0E\u590D\u6743K\u7EBF\u987B\u6709\u53EF\u6838\u5B9E\u7684adjustment_factor\uFF0C\u7F3A\u5931\u5219skipped_price_basis\u4FDD\u6301\u672A\u7ED3\u7B97\u3002CLI\u9884\u7B97300\u79D2\uFF0C\u622A\u6B62\u524D\u8FD4\u56DE\u5E76\u4FDD\u5B58\u5DF2\u5B8C\u6210\u7ED3\u679C\uFF1Bcomplete/deferred/warnings\u8BF4\u660E\u672A\u5904\u7406\u8BB0\u5F55\uFF0C\u4E0B\u6B21\u53EF\u91CD\u8BD5",
1227
1357
  parameters: {
1228
1358
  symbol: { type: "string", description: "\u80A1\u7968\u4EE3\u7801\uFF08\u53EF\u9009\uFF0C\u53EA\u8BC4\u4F30\u8BE5\u80A1\u7684\u4FE1\u53F7\uFF09" }
1229
1359
  },
@@ -1238,7 +1368,7 @@ function apply(ctx) {
1238
1368
  ctx.tools.register(
1239
1369
  pyTool({
1240
1370
  name: "get_signal_summary",
1241
- description: "\u4FE1\u53F7\u80DC\u7387\u6C47\u603B\uFF08\u53EF\u6309 source/symbol/status \u8FC7\u6EE4\uFF09\uFF1A\u80DC\u7387\u3001\u5E73\u5747\u6536\u76CA\u3001\u7ED3\u679C\u5206\u5E03\u4E0E\u660E\u7EC6",
1371
+ description: "\u4FE1\u53F7\u80DC\u7387\u6C47\u603B\uFF08\u53EF\u6309 source/symbol/status \u8FC7\u6EE4\uFF09\uFF1A\u80DC\u7387\u3001\u5E73\u5747\u6536\u76CA\u3001\u7ED3\u679C\u5206\u5E03\u4E0E\u660E\u7EC6\u3002by_source\u9644avg_return_pct\u3001return_samples\u548Csample_warning\uFF1B\u4EC5\u89C2\u5BDF\u6027\u590D\u76D8\uFF0C\u6837\u672C\u5C11\u4E0D\u80FD\u8BA4\u5B9A\u7B56\u7565\u6709\u6548\u3002",
1242
1372
  parameters: {
1243
1373
  source: { type: "string", description: "\u6309\u4FE1\u53F7\u6765\u6E90\u8FC7\u6EE4\uFF08\u53EF\u9009\uFF09" },
1244
1374
  symbol: { type: "string", description: "\u6309\u80A1\u7968\u4EE3\u7801\u8FC7\u6EE4\uFF08\u53EF\u9009\uFF09" },
@@ -1272,7 +1402,632 @@ function apply(ctx) {
1272
1402
  }
1273
1403
  })
1274
1404
  );
1405
+ ctx.tools.register(defineTool2({
1406
+ name: "compare_stocks",
1407
+ description: "\u65E0\u72B6\u6001\u540C\u884C\u6307\u6807\u6BD4\u8F83\uFF1A\u5148\u7528\u73B0\u6709\u8D22\u52A1/\u884C\u60C5\u5DE5\u5177\u53D6\u6570\uFF0C\u518D\u4F20companies\uFF1B\u4EC5\u76F8\u540Cunit/basis/period\u53EF\u6392\u5E8F\uFF0C\u7F3A\u5931\u4E0D\u586B\u96F6\uFF0C\u4E0D\u751F\u6210\u4E70\u5356\u7EFC\u5408\u5206\u3002",
1408
+ parameters: {
1409
+ "companies": {
1410
+ "type": "array",
1411
+ "items": {
1412
+ "type": "object",
1413
+ "properties": {
1414
+ "symbol": {
1415
+ "type": "string",
1416
+ "description": "\u552F\u4E00\u80A1\u7968\u4EE3\u7801",
1417
+ "required": true
1418
+ },
1419
+ "period": {
1420
+ "type": "string",
1421
+ "description": "\u7EDF\u4E00\u53EF\u6BD4\u671F\u95F4\uFF1B\u8D22\u52A1\u7528\u62A5\u544A\u671F\uFF0C\u4F30\u503C\u7528\u4F30\u503C\u65E5",
1422
+ "required": true
1423
+ },
1424
+ "metrics": {
1425
+ "type": "array",
1426
+ "items": {
1427
+ "type": "object",
1428
+ "properties": {
1429
+ "name": {
1430
+ "type": "string",
1431
+ "description": "\u6307\u6807\u540D\uFF0C\u5982pe/roe/net_income",
1432
+ "required": true
1433
+ },
1434
+ "value": {
1435
+ "oneOf": [
1436
+ {
1437
+ "type": "number"
1438
+ },
1439
+ {
1440
+ "type": "null"
1441
+ }
1442
+ ],
1443
+ "description": "\u6709\u9650\u6570\u503C\uFF1B\u7F3A\u5931\u4E3Anull",
1444
+ "required": true
1445
+ },
1446
+ "unit": {
1447
+ "type": "string",
1448
+ "description": "\u7CBE\u786E\u5355\u4F4D\uFF0C\u5982multiple/percent/fraction/CNY/USD",
1449
+ "required": true
1450
+ },
1451
+ "basis": {
1452
+ "type": "string",
1453
+ "description": "\u53E3\u5F84\uFF0C\u5982TTM/annual/consolidated\uFF1B\u533A\u5206\u7D2F\u8BA1\u4E0E\u5355\u5B63",
1454
+ "required": true
1455
+ },
1456
+ "source": {
1457
+ "type": "string",
1458
+ "description": "\u539F\u59CB\u8BC1\u636EURL\u6216\u5B57\u6BB5\u8DEF\u5F84"
1459
+ }
1460
+ },
1461
+ "additionalProperties": false
1462
+ },
1463
+ "description": "\u7ED3\u6784\u5316\u6307\u6807\uFF0C\u5355\u4F4D\u3001\u53E3\u5F84\u660E\u786E\uFF0C\u7F3A\u5931\u4E0D\u586B\u96F6",
1464
+ "required": true
1465
+ }
1466
+ },
1467
+ "additionalProperties": false
1468
+ },
1469
+ "description": "2..30\u5BB6\u516C\u53F8\uFF0C\u8C03\u7528\u65B9\u786E\u8BA4\u53EF\u6BD4\u6027",
1470
+ "required": true
1471
+ }
1472
+ },
1473
+ output: { schema: { type: "string" }, render: (_args, value) => [{ type: "text", text: value }] },
1474
+ async execute(params) {
1475
+ return withJsonInput(params, (path) => runPy("stateless_analysis.py", ["peers", "--input", path]));
1476
+ }
1477
+ }));
1478
+ ctx.tools.register(defineTool2({
1479
+ name: "analyze_disclosure_changes",
1480
+ description: "\u65E0\u72B6\u6001\u516C\u544A\u8D22\u62A5\u6BD4\u8F83\uFF1A\u4F20\u65B0\u65E7\u6B63\u6587\u53CA\u6307\u6807\uFF0C\u8FD4\u56DE\u53D8\u66F4\u884C\u53F7\u3001\u6765\u6E90\u4E0E\u8D22\u52A1\u53D8\u5316\uFF1B\u8D1F/\u96F6\u57FA\u6570\u589E\u957F\u7387\u4E3Anull\u3002\u4E0D\u4E0B\u8F7DPDF\u3001\u4E0D\u4EE3\u66FF\u7ECF\u6D4E\u89E3\u8BFB\u3002",
1481
+ parameters: {
1482
+ "previous": {
1483
+ "type": "object",
1484
+ "properties": {
1485
+ "text": {
1486
+ "type": "string",
1487
+ "description": "\u5DF2\u6838\u5B9E\u6B63\u6587\uFF0C\u6700\u591A200000\u5B57\u7B26\uFF1B\u4FDD\u7559\u6362\u884C\uFF0CPDF\u9700\u5BBF\u4E3B\u63D0\u53D6",
1488
+ "required": true
1489
+ },
1490
+ "source": {
1491
+ "type": "string",
1492
+ "description": "\u539F\u6587URL\u6216\u6587\u6863\u6807\u8BC6",
1493
+ "required": true
1494
+ },
1495
+ "period": {
1496
+ "type": "string",
1497
+ "description": "\u62A5\u544A\u671F\uFF0C\u59822025\u5E74\u5EA6",
1498
+ "required": true
1499
+ },
1500
+ "metrics": {
1501
+ "type": "array",
1502
+ "items": {
1503
+ "type": "object",
1504
+ "properties": {
1505
+ "name": {
1506
+ "type": "string",
1507
+ "description": "\u6307\u6807\u540D\uFF0C\u5982pe/roe/net_income",
1508
+ "required": true
1509
+ },
1510
+ "value": {
1511
+ "oneOf": [
1512
+ {
1513
+ "type": "number"
1514
+ },
1515
+ {
1516
+ "type": "null"
1517
+ }
1518
+ ],
1519
+ "description": "\u6709\u9650\u6570\u503C\uFF1B\u7F3A\u5931\u4E3Anull",
1520
+ "required": true
1521
+ },
1522
+ "unit": {
1523
+ "type": "string",
1524
+ "description": "\u7CBE\u786E\u5355\u4F4D\uFF0C\u5982multiple/percent/fraction/CNY/USD",
1525
+ "required": true
1526
+ },
1527
+ "basis": {
1528
+ "type": "string",
1529
+ "description": "\u53E3\u5F84\uFF0C\u5982TTM/annual/consolidated\uFF1B\u533A\u5206\u7D2F\u8BA1\u4E0E\u5355\u5B63",
1530
+ "required": true
1531
+ },
1532
+ "source": {
1533
+ "type": "string",
1534
+ "description": "\u539F\u59CB\u8BC1\u636EURL\u6216\u5B57\u6BB5\u8DEF\u5F84"
1535
+ }
1536
+ },
1537
+ "additionalProperties": false
1538
+ },
1539
+ "description": "\u7ED3\u6784\u5316\u6307\u6807\uFF0C\u5355\u4F4D\u3001\u53E3\u5F84\u660E\u786E\uFF0C\u7F3A\u5931\u4E0D\u586B\u96F6",
1540
+ "required": true
1541
+ }
1542
+ },
1543
+ "additionalProperties": false,
1544
+ "required": true
1545
+ },
1546
+ "current": {
1547
+ "type": "object",
1548
+ "properties": {
1549
+ "text": {
1550
+ "type": "string",
1551
+ "description": "\u5DF2\u6838\u5B9E\u6B63\u6587\uFF0C\u6700\u591A200000\u5B57\u7B26\uFF1B\u4FDD\u7559\u6362\u884C\uFF0CPDF\u9700\u5BBF\u4E3B\u63D0\u53D6",
1552
+ "required": true
1553
+ },
1554
+ "source": {
1555
+ "type": "string",
1556
+ "description": "\u539F\u6587URL\u6216\u6587\u6863\u6807\u8BC6",
1557
+ "required": true
1558
+ },
1559
+ "period": {
1560
+ "type": "string",
1561
+ "description": "\u62A5\u544A\u671F\uFF0C\u59822025\u5E74\u5EA6",
1562
+ "required": true
1563
+ },
1564
+ "metrics": {
1565
+ "type": "array",
1566
+ "items": {
1567
+ "type": "object",
1568
+ "properties": {
1569
+ "name": {
1570
+ "type": "string",
1571
+ "description": "\u6307\u6807\u540D\uFF0C\u5982pe/roe/net_income",
1572
+ "required": true
1573
+ },
1574
+ "value": {
1575
+ "oneOf": [
1576
+ {
1577
+ "type": "number"
1578
+ },
1579
+ {
1580
+ "type": "null"
1581
+ }
1582
+ ],
1583
+ "description": "\u6709\u9650\u6570\u503C\uFF1B\u7F3A\u5931\u4E3Anull",
1584
+ "required": true
1585
+ },
1586
+ "unit": {
1587
+ "type": "string",
1588
+ "description": "\u7CBE\u786E\u5355\u4F4D\uFF0C\u5982multiple/percent/fraction/CNY/USD",
1589
+ "required": true
1590
+ },
1591
+ "basis": {
1592
+ "type": "string",
1593
+ "description": "\u53E3\u5F84\uFF0C\u5982TTM/annual/consolidated\uFF1B\u533A\u5206\u7D2F\u8BA1\u4E0E\u5355\u5B63",
1594
+ "required": true
1595
+ },
1596
+ "source": {
1597
+ "type": "string",
1598
+ "description": "\u539F\u59CB\u8BC1\u636EURL\u6216\u5B57\u6BB5\u8DEF\u5F84"
1599
+ }
1600
+ },
1601
+ "additionalProperties": false
1602
+ },
1603
+ "description": "\u7ED3\u6784\u5316\u6307\u6807\uFF0C\u5355\u4F4D\u3001\u53E3\u5F84\u660E\u786E\uFF0C\u7F3A\u5931\u4E0D\u586B\u96F6",
1604
+ "required": true
1605
+ }
1606
+ },
1607
+ "additionalProperties": false,
1608
+ "required": true
1609
+ },
1610
+ "max_changes": {
1611
+ "type": "number",
1612
+ "description": "\u53D8\u5316\u4E0A\u96501..100\uFF0C\u9ED8\u8BA430"
1613
+ }
1614
+ },
1615
+ output: { schema: { type: "string" }, render: (_args, value) => [{ type: "text", text: value }] },
1616
+ async execute(params) {
1617
+ return withJsonInput(params, (path) => runPy("stateless_analysis.py", ["disclosure", "--input", path]));
1618
+ }
1619
+ }));
1620
+ ctx.tools.register(defineTool2({
1621
+ name: "analyze_portfolio_risk",
1622
+ description: "\u65E0\u72B6\u6001\u73B0\u8D27\u591A\u5934\u7EC4\u5408\u98CE\u9669\uFF1A\u8F93\u5165\u6301\u4ED3\u3001\u57FA\u51C6\u5E01\u79CD\u73B0\u91D1\u4E0E\u6C47\u7387\uFF0C\u8FD4\u56DE\u96C6\u4E2D\u5EA6\u3001\u5E01\u79CD/\u884C\u4E1A\u655E\u53E3\u3001\u4EF7\u683C\u76C8\u4E8F\u548C\u6B62\u635F\u60C5\u666F\u3002\u7F3A\u6C47\u7387\u62A5\u9519\uFF1B\u4E0D\u4FDD\u5B58\u8D26\u6237\u3002",
1623
+ parameters: {
1624
+ "positions": {
1625
+ "type": "array",
1626
+ "items": {
1627
+ "type": "object",
1628
+ "properties": {
1629
+ "symbol": {
1630
+ "type": "string",
1631
+ "description": "\u552F\u4E00\u4EE3\u7801\uFF0C\u91CD\u590D\u6301\u4ED3\u5148\u6C47\u603B",
1632
+ "required": true
1633
+ },
1634
+ "quantity": {
1635
+ "type": "number",
1636
+ "description": "\u6B63\u6301\u4ED3\u6570\u91CF",
1637
+ "required": true
1638
+ },
1639
+ "price": {
1640
+ "type": "number",
1641
+ "description": "\u6B63\u73B0\u4EF7",
1642
+ "required": true
1643
+ },
1644
+ "currency": {
1645
+ "type": "string",
1646
+ "description": "\u6301\u4ED3\u5E01\u79CD\uFF0C\u5982CNY/USD/HKD",
1647
+ "required": true
1648
+ },
1649
+ "cost": {
1650
+ "type": "number",
1651
+ "description": "\u540C\u5E01\u79CD\u6B63\u6210\u672C\u4EF7\uFF0C\u53EF\u9009"
1652
+ },
1653
+ "stop_price": {
1654
+ "type": "number",
1655
+ "description": "\u540C\u5E01\u79CD\u6B63\u6B62\u635F\u4EF7\uFF0C\u53EF\u9009"
1656
+ },
1657
+ "sector": {
1658
+ "type": "string",
1659
+ "description": "\u7EDF\u4E00\u884C\u4E1A\u5206\u7C7B\uFF0C\u53EF\u9009"
1660
+ },
1661
+ "as_of": {
1662
+ "type": "string",
1663
+ "description": "\u5B9E\u9645\u4F30\u503C\u65F6\u70B9\uFF0C\u5EFA\u8BAEISO8601"
1664
+ }
1665
+ },
1666
+ "additionalProperties": false
1667
+ },
1668
+ "description": "1..100\u4E2A\u73B0\u8D27\u591A\u5934\u6301\u4ED3",
1669
+ "required": true
1670
+ },
1671
+ "base_currency": {
1672
+ "type": "string",
1673
+ "description": "\u57FA\u51C6\u5E01\u79CD",
1674
+ "required": true
1675
+ },
1676
+ "cash": {
1677
+ "type": "number",
1678
+ "description": "\u57FA\u51C6\u5E01\u79CD\u73B0\u91D1\uFF0C\u975E\u8D1F",
1679
+ "required": true
1680
+ },
1681
+ "fx_rates": {
1682
+ "type": "array",
1683
+ "items": {
1684
+ "type": "object",
1685
+ "properties": {
1686
+ "currency": {
1687
+ "type": "string",
1688
+ "description": "\u552F\u4E00\u975E\u57FA\u51C6\u5E01\u79CD",
1689
+ "required": true
1690
+ },
1691
+ "rate": {
1692
+ "type": "number",
1693
+ "description": "\u4E00\u5355\u4F4D\u8BE5\u5E01\u79CD\u5BF9\u5E94\u591A\u5C11\u57FA\u51C6\u5E01\u79CD\uFF0C\u6B63\u6570",
1694
+ "required": true
1695
+ }
1696
+ },
1697
+ "additionalProperties": false
1698
+ },
1699
+ "description": "\u663E\u5F0F\u73B0\u4EF7\u6C47\u7387\uFF1B\u57FA\u51C6\u5E01\u79CD\u9690\u542B1\uFF0C\u4E0D\u5F97\u91CD\u590D"
1700
+ },
1701
+ "histories": {
1702
+ "type": "array",
1703
+ "items": {
1704
+ "type": "object",
1705
+ "properties": {
1706
+ "symbol": {
1707
+ "type": "string",
1708
+ "description": "\u5BF9\u5E94\u552F\u4E00\u6301\u4ED3\u80A1\u7968",
1709
+ "required": true
1710
+ },
1711
+ "prices": {
1712
+ "type": "array",
1713
+ "items": {
1714
+ "type": "object",
1715
+ "properties": {
1716
+ "date": {
1717
+ "type": "string",
1718
+ "description": "YYYY-MM-DD\uFF0C\u552F\u4E00\u65E5\u671F",
1719
+ "required": true
1720
+ },
1721
+ "close": {
1722
+ "type": "number",
1723
+ "description": "\u6B63\u6709\u9650\u6536\u76D8\u4EF7",
1724
+ "required": true
1725
+ }
1726
+ },
1727
+ "additionalProperties": false
1728
+ },
1729
+ "description": "\u5B8C\u6574\u65E5K\u6536\u76D8\u5E8F\u5217\uFF0C2..20000\u6761\uFF0C\u4E0D\u5F97\u8DE8\u80A1\u7968\u6216\u6DF7\u7528\u590D\u6743\u53E3\u5F84",
1730
+ "required": true
1731
+ }
1732
+ },
1733
+ "additionalProperties": false
1734
+ },
1735
+ "description": "\u53EF\u9009\u5386\u53F2\uFF0C\u5171\u540C\u65E5\u671F\u672C\u5E01\u4EF7\u683C\u6536\u76CA\u76F8\u5173\u6027\uFF0C\u4E0D\u8BA1\u6C47\u7387"
1736
+ }
1737
+ },
1738
+ output: { schema: { type: "string" }, render: (_args, value) => [{ type: "text", text: value }] },
1739
+ async execute(params) {
1740
+ return withJsonInput(params, (path) => runPy("stateless_analysis.py", ["portfolio", "--input", path]));
1741
+ }
1742
+ }));
1743
+ ctx.tools.register(defineTool2({
1744
+ name: "calculate_position_size",
1745
+ description: "\u65E0\u72B6\u6001\u591A\u5934\u4ED3\u4F4D\u9884\u7B97\uFF1A\u540C\u5E01\u79CD\u91D1\u989D\uFF0C\u6309\u73B0\u91D1/\u98CE\u9669\u9884\u7B97/\u6700\u5927\u4ED3\u4F4D/\u4EA4\u6613\u5355\u4F4D\u53D6\u6700\u5C0F\u6570\u91CF\uFF0C\u53CC\u8FB9\u8D39\u7528\u548C\u6ED1\u70B9\u53C2\u4E0E\u6B62\u635F\u60C5\u666F\uFF1B\u4E0D\u6267\u884C\u4EA4\u6613\u3002",
1746
+ parameters: {
1747
+ "equity": {
1748
+ "type": "number",
1749
+ "description": "\u603B\u6743\u76CA\uFF0C\u6B63\u6570",
1750
+ "required": true
1751
+ },
1752
+ "cash": {
1753
+ "type": "number",
1754
+ "description": "\u53EF\u7528\u73B0\u91D1\uFF0C0..equity",
1755
+ "required": true
1756
+ },
1757
+ "entry_price": {
1758
+ "type": "number",
1759
+ "description": "\u8BA1\u5212\u5165\u573A\u4EF7\uFF0C\u6B63\u6570",
1760
+ "required": true
1761
+ },
1762
+ "stop_price": {
1763
+ "type": "number",
1764
+ "description": "\u6B63\u6B62\u635F\u4EF7\uFF0C\u4F4E\u4E8E\u5165\u573A\u4EF7",
1765
+ "required": true
1766
+ },
1767
+ "risk_fraction": {
1768
+ "type": "number",
1769
+ "description": "\u5355\u7B14\u98CE\u9669\u5360\u6743\u76CA\u6BD4\u4F8B0..1\uFF0C\u59820.01",
1770
+ "required": true
1771
+ },
1772
+ "lot_size": {
1773
+ "type": "number",
1774
+ "description": "\u6B63\u6574\u6570\u4EA4\u6613\u5355\u4F4D\uFF0C\u7528\u6237\u786E\u8BA4\uFF0C\u4E0D\u731C\u6E2F\u80A1\u6BCF\u624B\u6570\u91CF",
1775
+ "required": true
1776
+ },
1777
+ "max_position_fraction": {
1778
+ "type": "number",
1779
+ "description": "\u672C\u6B21\u4E70\u5165\u6700\u5927\u8D44\u91D1\u5360\u6BD40..1\uFF0C\u9ED8\u8BA41\uFF1B\u5DF2\u6709\u540C\u80A1\u6301\u4ED3\u5148\u6263\u51CF\u989D\u5EA6"
1780
+ },
1781
+ "fee_rate": {
1782
+ "type": "number",
1783
+ "description": "\u6BCF\u8FB9\u6BD4\u4F8B\u8D39\u75280..0.1\uFF0C\u9ED8\u8BA40\uFF1B\u4E0D\u542B\u672A\u63D0\u4F9B\u7A0E\u8D39/\u6700\u4F4E\u6536\u8D39"
1784
+ },
1785
+ "slippage_rate": {
1786
+ "type": "number",
1787
+ "description": "\u6BCF\u8FB9\u6ED1\u70B90..0.1\uFF0C\u9ED8\u8BA40"
1788
+ }
1789
+ },
1790
+ output: { schema: { type: "string" }, render: (_args, value) => [{ type: "text", text: value }] },
1791
+ async execute(params) {
1792
+ return withJsonInput(params, (path) => runPy("stateless_analysis.py", ["position_size", "--input", path]));
1793
+ }
1794
+ }));
1795
+ ctx.tools.register(defineTool2({
1796
+ name: "analyze_event_study",
1797
+ description: "\u65E0\u72B6\u6001\u4E8B\u4EF6\u7814\u7A76\uFF1A\u63D0\u4F9B\u540C\u5E02\u573A\u80A1\u7968\u53CA\u57FA\u51C6\u5B8C\u6574\u4EF7\u683C\u3001\u4E8B\u4EF6\u65E5\u671F\uFF1B\u4E8B\u4EF6\u524D\u4E00\u4EA4\u6613\u65E5\u6536\u76D8\u4E3A\u57FA\u70B9\uFF0C\u8BA1\u7B97\u4EA4\u6613\u65E5\u7A97\u53E3\u6536\u76CA\u5DEE\u3002\u7F3A\u7A97\u53E3/\u57FA\u51C6\u4E3Anull\uFF0C\u6807\u6CE8\u91CD\u53E0\uFF0C\u4E0D\u63A8\u65AD\u56E0\u679C\u3002",
1798
+ parameters: {
1799
+ "prices": {
1800
+ "type": "array",
1801
+ "items": {
1802
+ "type": "object",
1803
+ "properties": {
1804
+ "date": {
1805
+ "type": "string",
1806
+ "description": "YYYY-MM-DD\uFF0C\u552F\u4E00\u65E5\u671F",
1807
+ "required": true
1808
+ },
1809
+ "close": {
1810
+ "type": "number",
1811
+ "description": "\u6B63\u6709\u9650\u6536\u76D8\u4EF7",
1812
+ "required": true
1813
+ }
1814
+ },
1815
+ "additionalProperties": false
1816
+ },
1817
+ "description": "\u5B8C\u6574\u65E5K\u6536\u76D8\u5E8F\u5217\uFF0C2..20000\u6761\uFF0C\u4E0D\u5F97\u8DE8\u80A1\u7968\u6216\u6DF7\u7528\u590D\u6743\u53E3\u5F84"
1818
+ },
1819
+ "benchmark_prices": {
1820
+ "type": "array",
1821
+ "items": {
1822
+ "type": "object",
1823
+ "properties": {
1824
+ "date": {
1825
+ "type": "string",
1826
+ "description": "YYYY-MM-DD\uFF0C\u552F\u4E00\u65E5\u671F",
1827
+ "required": true
1828
+ },
1829
+ "close": {
1830
+ "type": "number",
1831
+ "description": "\u6B63\u6709\u9650\u6536\u76D8\u4EF7",
1832
+ "required": true
1833
+ }
1834
+ },
1835
+ "additionalProperties": false
1836
+ },
1837
+ "description": "\u5B8C\u6574\u65E5K\u6536\u76D8\u5E8F\u5217\uFF0C2..20000\u6761\uFF0C\u4E0D\u5F97\u8DE8\u80A1\u7968\u6216\u6DF7\u7528\u590D\u6743\u53E3\u5F84"
1838
+ },
1839
+ "event_dates": {
1840
+ "type": "array",
1841
+ "items": {
1842
+ "type": "string",
1843
+ "description": "YYYY-MM-DD\uFF0C\u76D8\u540E\u516C\u544A\u4F20\u4E0B\u4E00\u4EA4\u6613\u65E5"
1844
+ },
1845
+ "description": "1..100\u4E2A\u552F\u4E00\u4E8B\u4EF6\u65E5",
1846
+ "required": true
1847
+ },
1848
+ "price_basis": {
1849
+ "type": "string",
1850
+ "description": "\u4EC5\u663E\u5F0Fprices\u6A21\u5F0F\u5FC5\u9700\uFF1B\u4EE3\u7801\u6A21\u5F0F\u62A5\u544A\u5B9E\u9645\u63D0\u4F9B\u65B9\u6807\u8BB0\uFF0C\u7F3A\u5931\u4E3Aunknown\uFF0C\u987B\u6838\u5B9E"
1851
+ },
1852
+ "horizons": {
1853
+ "type": "array",
1854
+ "items": {
1855
+ "type": "number",
1856
+ "description": "0=\u4E8B\u4EF6\u65E5\uFF0C1=\u4E0B\u4E00\u4EA4\u6613\u65E5\uFF1B\u6574\u65700..250"
1857
+ },
1858
+ "description": "1..20\u4E2A\u7A97\u53E3\uFF0C\u9ED8\u8BA40/1/5/10/20"
1859
+ },
1860
+ "start_date": {
1861
+ "type": "string",
1862
+ "description": "\u4EE3\u7801\u6A21\u5F0F\u5FC5\u9700\uFF0CYYYY-MM-DD\uFF0C\u5305\u542B\u4E8B\u4EF6\u524D\u57FA\u51C6\u65E5\u6216\u8BAD\u7EC3\u7A97\u53E3"
1863
+ },
1864
+ "end_date": {
1865
+ "type": "string",
1866
+ "description": "\u4EE3\u7801\u6A21\u5F0F\u5FC5\u9700\uFF0CYYYY-MM-DD\uFF0C\u665A\u4E8Estart_date"
1867
+ },
1868
+ "symbol": {
1869
+ "type": "string",
1870
+ "description": "\u80A1\u7968\u4EE3\u7801\uFF1B\u4E0Ebenchmark/start_date/end_date\u4E00\u8D77\u76F4\u63A5\u53D6\u6570\uFF0C\u548Cprices\u6A21\u5F0F\u4E92\u65A5"
1871
+ },
1872
+ "benchmark": {
1873
+ "type": "string",
1874
+ "description": "\u540C\u5E02\u573A\u57FA\u51C6\u4EE3\u7801\uFF1B\u4E0Esymbol\u4E00\u8D77\u4F7F\u7528"
1875
+ }
1876
+ },
1877
+ output: { schema: { type: "string" }, render: (_args, value) => [{ type: "text", text: value }] },
1878
+ async execute(params) {
1879
+ return withJsonInput(params, (path) => runPy("stateless_analysis.py", ["event_study", "--input", path]));
1880
+ }
1881
+ }));
1882
+ ctx.tools.register(defineTool2({
1883
+ name: "validate_backtest",
1884
+ description: "\u65E0\u72B6\u6001\u56DE\u6D4B\u7A33\u5065\u6027\uFF1A\u8F93\u5165\u5386\u53F2OHLCV\u548C\u5B8C\u6574\u5019\u9009DSL\uFF1B\u6EDA\u52A8\u8BAD\u7EC3\u9009\u53C2\u6570\u3001\u540E\u7EED\u4E0D\u91CD\u53E0\u7A97\u53E3\u9A8C\u8BC1\uFF0C\u5217\u51FA\u5168\u90E8\u6837\u672C\u5185\u654F\u611F\u6027\u53CA\u8DE8\u6807\u7684\u7ED3\u679C\u3002\u4EC5next_open\uFF0C\u4E0D\u81EA\u52A8\u4F18\u5316\u6216\u4FDD\u5B58\u3002",
1885
+ parameters: {
1886
+ "datasets": {
1887
+ "type": "array",
1888
+ "items": {
1889
+ "type": "object",
1890
+ "properties": {
1891
+ "symbol": {
1892
+ "type": "string",
1893
+ "description": "\u552F\u4E00\u80A1\u7968\u4EE3\u7801",
1894
+ "required": true
1895
+ },
1896
+ "price_basis": {
1897
+ "type": "string",
1898
+ "description": "\u5DF2\u6838\u5B9E\u590D\u6743/\u539F\u59CB\u4EF7\u683C\u53E3\u5F84",
1899
+ "required": true
1900
+ },
1901
+ "bars": {
1902
+ "type": "array",
1903
+ "items": {
1904
+ "type": "object",
1905
+ "properties": {
1906
+ "date": {
1907
+ "type": "string",
1908
+ "description": "YYYY-MM-DD",
1909
+ "required": true
1910
+ },
1911
+ "open": {
1912
+ "type": "number",
1913
+ "description": "\u6709\u9650OHLCV\uFF1B\u4EF7\u683C\u4E3A\u6B63\u3001volume\u975E\u8D1F",
1914
+ "required": true
1915
+ },
1916
+ "high": {
1917
+ "type": "number",
1918
+ "description": "\u6709\u9650OHLCV\uFF1B\u4EF7\u683C\u4E3A\u6B63\u3001volume\u975E\u8D1F",
1919
+ "required": true
1920
+ },
1921
+ "low": {
1922
+ "type": "number",
1923
+ "description": "\u6709\u9650OHLCV\uFF1B\u4EF7\u683C\u4E3A\u6B63\u3001volume\u975E\u8D1F",
1924
+ "required": true
1925
+ },
1926
+ "close": {
1927
+ "type": "number",
1928
+ "description": "\u6709\u9650OHLCV\uFF1B\u4EF7\u683C\u4E3A\u6B63\u3001volume\u975E\u8D1F",
1929
+ "required": true
1930
+ },
1931
+ "volume": {
1932
+ "type": "number",
1933
+ "description": "\u6709\u9650OHLCV\uFF1B\u4EF7\u683C\u4E3A\u6B63\u3001volume\u975E\u8D1F",
1934
+ "required": true
1935
+ }
1936
+ },
1937
+ "additionalProperties": false
1938
+ },
1939
+ "description": "\u65E5\u671F\u9012\u589E\u5B8C\u6574OHLCV\uFF0C\u6BCF\u7EC4\u6700\u591A2000\u6761\uFF0C\u81F3\u5C11train_bars+test_bars",
1940
+ "required": true
1941
+ }
1942
+ },
1943
+ "additionalProperties": false
1944
+ },
1945
+ "description": "1..5\u4E2A\u6807\u7684\uFF0C\u590D\u7528get_kline\u53D6\u6570"
1946
+ },
1947
+ "strategies": {
1948
+ "type": "array",
1949
+ "items": {
1950
+ "type": "object",
1951
+ "properties": {
1952
+ "name": {
1953
+ "type": "string",
1954
+ "description": "\u552F\u4E00\u5019\u9009\u540D",
1955
+ "required": true
1956
+ },
1957
+ "strategy": {
1958
+ "type": "object",
1959
+ "additionalProperties": true,
1960
+ "description": "\u5B8C\u6574\u65E2\u6709YAML DSL\u5BF9\u5E94JSON\uFF0C\u5141\u8BB8parameters\u5F15\u7528\uFF1B\u4EC5next_open",
1961
+ "properties": {},
1962
+ "required": true
1963
+ }
1964
+ },
1965
+ "additionalProperties": false
1966
+ },
1967
+ "description": "1..5\u4E2A\u9884\u5148\u786E\u5B9A\u7684\u5019\u9009\uFF0C\u7981\u6B62\u6D4B\u8BD5\u7ED3\u679C\u56DE\u8C03\u53C2\u6570",
1968
+ "required": true
1969
+ },
1970
+ "train_bars": {
1971
+ "type": "number",
1972
+ "description": "\u8BAD\u7EC3\u4EA4\u6613\u65E5\u657030..1000\uFF0C\u9ED8\u8BA4126"
1973
+ },
1974
+ "test_bars": {
1975
+ "type": "number",
1976
+ "description": "\u6D4B\u8BD5\u4EA4\u6613\u65E5\u657030..1000\uFF0C\u9ED8\u8BA463"
1977
+ },
1978
+ "capital": {
1979
+ "type": "number",
1980
+ "description": "\u6BCF\u7A97\u53E3\u521D\u59CB\u8D44\u91D1\uFF0C\u9ED8\u8BA41000000"
1981
+ },
1982
+ "start_date": {
1983
+ "type": "string",
1984
+ "description": "\u4EE3\u7801\u6A21\u5F0F\u5FC5\u9700\uFF0CYYYY-MM-DD\uFF0C\u5305\u542B\u4E8B\u4EF6\u524D\u57FA\u51C6\u65E5\u6216\u8BAD\u7EC3\u7A97\u53E3"
1985
+ },
1986
+ "end_date": {
1987
+ "type": "string",
1988
+ "description": "\u4EE3\u7801\u6A21\u5F0F\u5FC5\u9700\uFF0CYYYY-MM-DD\uFF0C\u665A\u4E8Estart_date"
1989
+ },
1990
+ "symbols": {
1991
+ "type": "array",
1992
+ "items": {
1993
+ "type": "string"
1994
+ },
1995
+ "description": "1..5\u4E2A\u552F\u4E00\u80A1\u7968\u4EE3\u7801\uFF0C\u914D\u5408start_date/end_date\u76F4\u63A5\u53D6\u6570\uFF1B\u548Cdatasets\u4E92\u65A5"
1996
+ }
1997
+ },
1998
+ output: { schema: { type: "string" }, render: (_args, value) => [{ type: "text", text: value }] },
1999
+ async execute(params) {
2000
+ return withJsonInput(params, (path) => runPy("stateless_analysis.py", ["robustness", "--input", path]));
2001
+ }
2002
+ }));
2003
+ ctx.tools.register(defineTool2({
2004
+ name: "compare_analysis_snapshots",
2005
+ description: "\u65E0\u72B6\u6001\u5FEB\u7167\u6BD4\u8F83\uFF1A\u4F20\u65B0\u65E7JSON\uFF0C\u8FD4\u56DEJSON Pointer\u53CA\u65B0\u589E/\u5220\u9664/\u53D8\u5316/\u5931\u6548/\u6062\u590D\uFF1B\u4E0D\u4FDD\u5B58\u5FEB\u7167\u3002\u6570\u7EC4\u6574\u4F53\u6BD4\u8F83\uFF0C\u8C03\u7528\u524D\u6309symbol\u5BF9\u9F50\u3002",
2006
+ parameters: {
2007
+ "previous": {
2008
+ "type": "object",
2009
+ "additionalProperties": true,
2010
+ "description": "JSON\u5BF9\u8C61\uFF0C\u8BE6\u89C1\u5171\u4EABSkill\u4E0EREADME",
2011
+ "properties": {},
2012
+ "required": true
2013
+ },
2014
+ "current": {
2015
+ "type": "object",
2016
+ "additionalProperties": true,
2017
+ "description": "JSON\u5BF9\u8C61\uFF0C\u8BE6\u89C1\u5171\u4EABSkill\u4E0EREADME",
2018
+ "properties": {},
2019
+ "required": true
2020
+ }
2021
+ },
2022
+ output: { schema: { type: "string" }, render: (_args, value) => [{ type: "text", text: value }] },
2023
+ async execute(params) {
2024
+ return withJsonInput(params, (path) => runPy("stateless_analysis.py", ["snapshot", "--input", path]));
2025
+ }
2026
+ }));
1275
2027
  registerSkills(ctx);
2028
+ if (config.toolDiscovery !== false) {
2029
+ registerToolDiscovery(ctx, new Set(ctx.tools.schemas?.().filter((tool) => !previousTools.has(tool.name)).map((tool) => tool.name)));
2030
+ }
1276
2031
  }
1277
2032
  export {
1278
2033
  __setExecutor,