@v587d/capital-generation 2.8.3 → 2.9.0
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 +54 -1
- package/README.md +40 -19
- package/chart-ui/README.md +1 -1
- package/chart-ui/client.src.cjs +7 -16
- package/chart-ui/index.js +12 -33
- package/chart-ui/package.json +2 -2
- package/config/client.js +18 -39
- package/config/client.src.cjs +79 -217
- package/config/index.js +22 -72
- package/config/package.json +2 -2
- package/cordis.patch.yml +46 -51
- package/lib/agents/bash-guard.d.ts +9 -55
- package/lib/agents/bash-guard.js +27 -67
- package/lib/agents/preset-roster.d.ts +22 -0
- package/lib/agents/preset-roster.js +87 -0
- package/lib/agents/role-tool-policy.d.ts +46 -0
- package/lib/agents/role-tool-policy.js +205 -0
- package/lib/agents/root-tool-policy.d.ts +28 -124
- package/lib/agents/root-tool-policy.js +164 -237
- package/lib/agents/selected-skills-provider.d.ts +2 -6
- package/lib/agents/selected-skills-provider.js +27 -84
- package/lib/capital-settings.d.ts +27 -0
- package/lib/capital-settings.js +23 -0
- package/lib/chart/artifact-ref.d.ts +3 -8
- package/lib/chart/artifact-ref.js +3 -8
- package/lib/chart/downsample.d.ts +2 -5
- package/lib/chart/downsample.js +3 -8
- package/lib/chart/errors.d.ts +3 -7
- package/lib/chart/errors.js +1 -2
- package/lib/chart/event-context.d.ts +8 -0
- package/lib/chart/event-context.js +39 -0
- package/lib/chart/events.d.ts +21 -78
- package/lib/chart/events.js +40 -189
- package/lib/chart/html.d.ts +2 -5
- package/lib/chart/html.js +8 -15
- package/lib/chart/runtime.d.ts +5 -18
- package/lib/chart/runtime.js +14 -34
- package/lib/chart/series.d.ts +10 -17
- package/lib/chart/series.js +22 -47
- package/lib/chart/source-token.d.ts +5 -13
- package/lib/chart/source-token.js +18 -17
- package/lib/chart/spec.d.ts +6 -12
- package/lib/chart/spec.js +7 -31
- package/lib/chart/tool.d.ts +6 -29
- package/lib/chart/tool.js +9 -23
- package/lib/chart-render-entry.d.ts +9 -0
- package/lib/chart-render-entry.js +17 -0
- package/lib/chart-source-entry.d.ts +13 -0
- package/lib/chart-source-entry.js +20 -0
- package/lib/collect-entry.d.ts +9 -0
- package/lib/collect-entry.js +10 -0
- package/lib/collector-runtime.d.ts +22 -0
- package/lib/collector-runtime.js +97 -0
- package/lib/data-collector/args.d.ts +6 -24
- package/lib/data-collector/args.js +6 -24
- package/lib/data-collector/dataset-tools.d.ts +7 -1
- package/lib/data-collector/dataset-tools.js +27 -56
- package/lib/data-collector/describe.d.ts +8 -33
- package/lib/data-collector/describe.js +17 -70
- package/lib/data-collector/hub.d.ts +27 -85
- package/lib/data-collector/hub.js +19 -85
- package/lib/data-collector/query-time.d.ts +7 -26
- package/lib/data-collector/query-time.js +8 -27
- package/lib/data-collector/store.d.ts +40 -117
- package/lib/data-collector/store.js +32 -111
- package/lib/data-collector/time-axis.d.ts +16 -76
- package/lib/data-collector/time-axis.js +25 -111
- package/lib/data-collector/tools.d.ts +6 -6
- package/lib/data-collector/tools.js +34 -43
- package/lib/dataset-read-entry.d.ts +9 -0
- package/lib/dataset-read-entry.js +7 -0
- package/lib/index.d.ts +7 -117
- package/lib/index.js +43 -422
- package/lib/net/eastmoney-client.d.ts +13 -65
- package/lib/net/eastmoney-client.js +12 -53
- package/lib/net/throttle.d.ts +2 -13
- package/lib/net/throttle.js +3 -14
- package/lib/ocr/client.d.ts +12 -21
- package/lib/ocr/client.js +23 -40
- package/lib/ocr/markdown.d.ts +20 -26
- package/lib/ocr/markdown.js +23 -36
- package/lib/ocr/store.d.ts +14 -47
- package/lib/ocr/store.js +15 -45
- package/lib/ocr-entry.d.ts +9 -0
- package/lib/ocr-entry.js +10 -0
- package/lib/policy-entry.d.ts +17 -0
- package/lib/policy-entry.js +22 -0
- package/lib/preset-claim.d.ts +22 -0
- package/lib/preset-claim.js +24 -0
- package/lib/preset-ids.d.ts +38 -0
- package/lib/preset-ids.js +46 -0
- package/lib/retriever-config.d.ts +37 -0
- package/lib/retriever-config.js +36 -0
- package/lib/retriever-runtime.d.ts +31 -0
- package/lib/retriever-runtime.js +82 -0
- package/lib/root-extras-entry.d.ts +17 -0
- package/lib/root-extras-entry.js +25 -0
- package/lib/runtime-entry.d.ts +15 -0
- package/lib/runtime-entry.js +5 -0
- package/lib/runtime.d.ts +21 -0
- package/lib/runtime.js +33 -0
- package/lib/search-entry.d.ts +9 -0
- package/lib/search-entry.js +9 -0
- package/lib/sources/eastmoney-http.js +20 -68
- package/lib/sources/ftshare-rest.d.ts +6 -34
- package/lib/sources/ftshare-rest.js +84 -292
- package/lib/sources/fuyao-core.d.ts +8 -18
- package/lib/sources/fuyao-core.js +10 -21
- package/lib/sources/fuyao-rest.d.ts +2 -6
- package/lib/sources/fuyao-rest.js +23 -102
- package/lib/sources/security-code.d.ts +6 -12
- package/lib/sources/security-code.js +6 -12
- package/lib/sources/security-identity.d.ts +1 -4
- package/lib/sources/security-identity.js +3 -8
- package/lib/sources/tencent-http.js +14 -28
- package/lib/sources/tencent-public-core.d.ts +8 -60
- package/lib/sources/tencent-public-core.js +12 -77
- package/lib/sources/wind-mcp.d.ts +0 -5
- package/lib/sources/wind-mcp.js +23 -78
- package/lib/sources-entry.d.ts +9 -0
- package/lib/sources-entry.js +9 -0
- package/lib/time/tools.d.ts +8 -31
- package/lib/time/tools.js +30 -66
- package/lib/time-entry.d.ts +9 -0
- package/lib/time-entry.js +7 -0
- package/lib/tool-exec.d.ts +45 -11
- package/lib/tool-exec.js +59 -6
- package/lib/user-customization.d.ts +14 -0
- package/lib/user-customization.js +47 -0
- package/lib/watchlist/tools.d.ts +3 -13
- package/lib/watchlist/tools.js +10 -30
- package/lib/watchlist-entry.d.ts +9 -0
- package/lib/watchlist-entry.js +6 -0
- package/lib/web-retriever/engines.d.ts +6 -11
- package/lib/web-retriever/engines.js +9 -14
- package/lib/web-retriever/html-markdown.d.ts +14 -34
- package/lib/web-retriever/html-markdown.js +39 -75
- package/lib/web-retriever/local-fetch.d.ts +22 -58
- package/lib/web-retriever/local-fetch.js +33 -77
- package/lib/web-retriever/retriever.d.ts +6 -18
- package/lib/web-retriever/retriever.js +7 -7
- package/lib/web-retriever/sources.d.ts +37 -124
- package/lib/web-retriever/sources.js +64 -196
- package/lib/web-retriever/tools.d.ts +43 -27
- package/lib/web-retriever/tools.js +99 -137
- package/lib/web-retriever/wind-client.d.ts +14 -31
- package/lib/web-retriever/wind-client.js +16 -32
- package/locale/zh.json +1 -1
- package/package.json +67 -7
- package/preset/capital-generation/README.md +87 -53
- package/preset/capital-generation/agent.patch.yml +526 -337
- package/preset/capital-generation/skills/capital-data-profile/SKILL.md +2 -2
- package/preset/capital-generation/skills/capital-data-protocol/SKILL.md +1 -1
- package/preset/capital-generation/skills/capital-equity-research/SKILL.md +1 -1
- package/preset/capital-generation/skills/capital-event-impact/SKILL.md +1 -1
- package/preset/capital-generation/skills/capital-orchestration/SKILL.md +15 -19
- package/preset/capital-generation/skills/capital-portfolio-review/SKILL.md +1 -1
- package/preset/capital-generation/skills/capital-visualization-protocol/SKILL.md +9 -12
- package/preset/capital-generation/skills/capital-web-evidence/SKILL.md +1 -1
- package/watchlist/client.js +15 -148
- package/watchlist/client.src.cjs +148 -662
- package/watchlist/holding-rules.js +11 -38
- package/watchlist/index.js +127 -397
- package/watchlist/package.json +2 -2
|
@@ -1,26 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* 这里是"一个具名来源 + 业务参数 → 确定、有序、可翻页、同参可复现的结果集"的**查询**工作面。
|
|
6
|
-
* 判据不是"返回 JSON 还是 HTML"(`SearchHit` 本来就带 `content?`,形状无法区分),
|
|
7
|
-
* 而是结果集是否确定、是否可复现、以及"这次调用承诺了什么"——见
|
|
8
|
-
* `docs/design/web-retriever-source-expansion.md` §2.2。
|
|
9
|
-
*
|
|
10
|
-
* 七条来源各自是一次具体实现,**不做配方注册表 / 通用适配层**:只有这样,
|
|
11
|
-
* 每个来源的端点、签名、字段语义才能就地写清楚,不引入一层只为"统一"而存在的间接。
|
|
12
|
-
* 出口校验(URL 合法性 + DNS 公网 IP 闸门 + 重定向重校验 + 大小/超时上限)统一复用
|
|
13
|
-
* `createHttpRequester`,本文件不自建网络路径(AGENTS.md §9.7)。
|
|
2
|
+
* Named sources: source + business params -> ordered, pageable, reproducible rows.
|
|
3
|
+
* Each stays a concrete implementation (no recipe registry); all egress goes
|
|
4
|
+
* through `createHttpRequester` (SSRF/DNS/redirect/size guards, AGENTS.md §9.7).
|
|
14
5
|
*/
|
|
15
6
|
import { createHttpRequester } from './local-fetch.js';
|
|
16
7
|
import type { EastmoneyClient, EastmoneyTransport } from '../net/eastmoney-client.js';
|
|
17
8
|
import type { LocalFetchOptions } from './local-fetch.js';
|
|
18
|
-
/**
|
|
9
|
+
/** Upstream name used in error envelopes and as the `provider_tally` key. */
|
|
19
10
|
export type SourceId = 'cls' | 'wscn' | 'cninfo_irm' | 'sseinfo' | 'eastmoney' | 'ths' | 'sina';
|
|
20
11
|
export declare const SOURCE_IDS: readonly SourceId[];
|
|
21
|
-
/**
|
|
12
|
+
/** Per-item text cap; item count is capped separately by each tool's limit. */
|
|
22
13
|
export declare const MAX_ITEM_CHARS = 1200;
|
|
23
|
-
/**
|
|
14
|
+
/** Max items per output (must match the tool schema maximum). */
|
|
24
15
|
export declare const MAX_ITEMS = 50;
|
|
25
16
|
export interface SourceItem {
|
|
26
17
|
[key: string]: string | number | null;
|
|
@@ -29,9 +20,9 @@ export interface SourceOutcome {
|
|
|
29
20
|
source: SourceId;
|
|
30
21
|
operation: string;
|
|
31
22
|
items: SourceItem[];
|
|
32
|
-
/**
|
|
23
|
+
/** Upstream cursor for the next page; absent when there is none. */
|
|
33
24
|
next_cursor?: string;
|
|
34
|
-
/**
|
|
25
|
+
/** Record upstream scope / known gaps so an empty result is not read as fact. */
|
|
35
26
|
note?: string;
|
|
36
27
|
}
|
|
37
28
|
export declare class SourceError extends Error {
|
|
@@ -40,25 +31,14 @@ export declare class SourceError extends Error {
|
|
|
40
31
|
constructor(source: SourceId, code: string, message: string);
|
|
41
32
|
}
|
|
42
33
|
type Requester = ReturnType<typeof createHttpRequester>;
|
|
43
|
-
/**
|
|
34
|
+
/** Built per source-tool call; lazy transport, configured timeout. */
|
|
44
35
|
export declare function createSourceTransport(options: LocalFetchOptions): Requester;
|
|
45
36
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* 裸 `fetch`(AGENTS.md §9.7)。节流器不在这里——仍由进程级共享的东财节流器提供
|
|
49
|
-
* (`sharedEastmoneyThrottle()`),本适配只替换"怎么发出去"。
|
|
50
|
-
*
|
|
51
|
-
* 带分类 `code` 的 `LocalFetchError` 原样穿过(`createEastmoneyClient` 见 code 即不包裹),
|
|
52
|
-
* 取消因此保持 `ABORTED` 语义、不被降级成网络失败(docs/dev/web-retriever.md §4.2)。
|
|
37
|
+
* Eastmoney shares the other sources' egress gate; throttling stays process-wide.
|
|
38
|
+
* Coded `LocalFetchError`s pass through unwrapped so ABORTED is not downgraded.
|
|
53
39
|
*/
|
|
54
40
|
export declare function createGatedEastmoneyTransport(requester: Requester): EastmoneyTransport;
|
|
55
|
-
/**
|
|
56
|
-
* 财联社 v1 接口的本地签名:`sign = md5(sha1(按 key 字典序拼接的 query 串))`。
|
|
57
|
-
*
|
|
58
|
-
* 旧 `nodeapi/telegraphList` 于 2026-05 下线,现接口强制校验 sign,但**纯本地计算、无需任何 key**
|
|
59
|
-
* (外部实践文献 5.2 节,2026-07 复活;2026-09-24 本仓按此式复现,`errno=0` 正常返回)。
|
|
60
|
-
* 签名必须由代码在请求前算出——这正是"模型只给参数、不给 URL"的原因。
|
|
61
|
-
*/
|
|
41
|
+
/** Local sign `md5(sha1(query sorted by key))`; no API key, so the model passes params, never URLs. */
|
|
62
42
|
export declare function clsSign(params: Record<string, string>): string;
|
|
63
43
|
export declare function clsTelegraph(transport: Requester, input: {
|
|
64
44
|
limit: number;
|
|
@@ -71,12 +51,8 @@ export declare function wscnLives(transport: Requester, input: {
|
|
|
71
51
|
signal?: AbortSignal;
|
|
72
52
|
}): Promise<SourceOutcome>;
|
|
73
53
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* ⚠️ 实测坑(2026-09-24 本仓):第二步**必须 POST**(参数放 query 串)——
|
|
77
|
-
* 同一 URL 用 GET 会得到 **HTTP 405**。外部文献只写了"参数放 query string",
|
|
78
|
-
* 没写这一条,而少了 POST 就是 405。
|
|
79
|
-
* 覆盖范围:只覆盖深市;沪市实测返回 0 条(走 `sseinfo_qa`);北交所两个平台都没有。
|
|
54
|
+
* Two steps: `keyWord=code` -> `secid` (orgId) -> questions; step two must be POST
|
|
55
|
+
* (GET on the same URL returns 405). Shenzhen only; SSE questions via `sseinfo_qa`.
|
|
80
56
|
*/
|
|
81
57
|
export declare function cninfoIrm(transport: Requester, input: {
|
|
82
58
|
code: string;
|
|
@@ -85,17 +61,9 @@ export declare function cninfoIrm(transport: Requester, input: {
|
|
|
85
61
|
signal?: AbortSignal;
|
|
86
62
|
}): Promise<SourceOutcome>;
|
|
87
63
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
* 先用 `/<a\b(?:(?!<\/a>)[\s\S])*?<\/a>/g` 切出每个 `<a>` 元素,再在**单个元素内**找 uid 与
|
|
92
|
-
* `company/<6位>.png`。逐元素解析的另一个好处是**跨条目错配在结构上不可能发生**。
|
|
93
|
-
*
|
|
94
|
-
* 为什么不能用"一次正则 + 限制间隔长度"(本函数第一版就是这么写的,被测试当场抓住):
|
|
95
|
-
* 真实页面在 `</a>` 与 `<img>` 之间有一个 `<br/>`,而 A 条目的 `<br/>` 之后紧跟 B 条目,
|
|
96
|
-
* 于是任何形如 `uid=…[\s\S]{0,N}?…png` 的写法在 **N 足够大**时都会跨到下一个条目上——
|
|
97
|
-
* 实测把 `600369` 配到了前一条的 `uid=65`。窗口小则匹配 0 条(外部文献的 `[^>]*>` 就是这个下场),
|
|
98
|
-
* 窗口大则错配;**只有按元素切分才是对的**。
|
|
64
|
+
* Company list page: 32 companies, ascending by code. uid and code come from the same
|
|
65
|
+
* `<a>` element, so cross-item mispairing is structurally impossible (a windowed regex
|
|
66
|
+
* either misses rows or pairs across them).
|
|
99
67
|
*/
|
|
100
68
|
export declare function parseCompanyList(content: string): Array<{
|
|
101
69
|
code: string;
|
|
@@ -103,41 +71,20 @@ export declare function parseCompanyList(content: string): Array<{
|
|
|
103
71
|
}>;
|
|
104
72
|
export declare function resetSseCachesForTest(): void;
|
|
105
73
|
/**
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
* 不能拿"整轮对话还剩多少"来兜一个内部元数据查询。`sseinfoQa` 的 `uidLocateBudgetMs`
|
|
109
|
-
* 仅供测试注入缩短(与 `wind-client.ts` 的 `retryDelaysMs` 同一约定)。
|
|
74
|
+
* One uid lookup = 10-13 serial requests, so no per-request timeout can bound it;
|
|
75
|
+
* `uidLocateBudgetMs` exists only so tests can shorten this.
|
|
110
76
|
*/
|
|
111
77
|
export declare const SSE_UID_LOCATE_TIMEOUT_MS = 60000;
|
|
112
78
|
/**
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
* ⚠️ 缓存层次是本函数最容易写错的地方(2026-09-24 实测踩坑,症状很绕):
|
|
116
|
-
* - `ssePageCache` 缓存**页**,供二分复用,不参与"这个代码是谁"的判定;
|
|
117
|
-
* - `sseUidCache` 只缓存**已解析出的那个代码**,绝不在扫描页面时把整页代码灌进去。
|
|
118
|
-
*
|
|
119
|
-
* 为什么后者是硬约束:二分一次会扫过 ~10–13 页、每页 32 家。若把扫描到的**全部**代码都写进
|
|
120
|
-
* uid 缓存,一次解析就能塞进 200+ 条,把容量占满并**淘汰掉正在解析的那个代码**——表现为
|
|
121
|
-
* "单次解析成功、稍后再查同一个代码却报 NOT_FOUND",而且只在特定调用序列下复现。
|
|
122
|
-
* 因此 uid 只从"已确认命中"的那一页里取,取不到就按升序自检后的页范围继续二分。
|
|
79
|
+
* Cache layering: pages feed the binary search, the uid cache holds only the resolved
|
|
80
|
+
* code — caching scanned pages there would evict it and turn success into NOT_FOUND.
|
|
123
81
|
*/
|
|
124
82
|
export declare function resolveSseCompanyUid(transport: Requester, code: string, signal?: AbortSignal): Promise<string>;
|
|
125
|
-
/**
|
|
126
|
-
* 解析问答列表页。以回复块 `class="m_feed_detail m_qa"` 为界切问题段与回复段——
|
|
127
|
-
* 不靠 id 区分("最新回复"与"最新提问"两种列表的标记不同)。
|
|
128
|
-
*/
|
|
83
|
+
/** Split Q/A on the reply block class; per-item id markers differ between the two list kinds. */
|
|
129
84
|
export declare function parseSseFeed(text: string): SourceItem[];
|
|
130
85
|
/**
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
* 实测(2026-09-24 全量抽样 150 条)非绝对写法**只有三类**,必须全部支持:
|
|
134
|
-
* - 相对当天:`2分钟前` / `57分钟前` / `1小时前` / `2小时前`;
|
|
135
|
-
* - 相对昨天:`昨天 18:16`;
|
|
136
|
-
* - 绝对:`2026年09月24日 09:30`。
|
|
137
|
-
*
|
|
138
|
-
* 少支持任何一类,"最新提问"列表就会因某一条认不出而**整次失败**(本仓真机冒烟两次都栽在
|
|
139
|
-
* 这里:先是 `昨天 18:16`,再是 `2分钟前`)。相对写法按**北京时间**换算——host 本地时区不可依赖
|
|
140
|
-
* (本仓跑在 UTC 主机上),所以先取"北京当下"再回推。
|
|
86
|
+
* Normalize to Beijing "YYYY-MM-DD HH:MM" (never host local time). All three observed
|
|
87
|
+
* forms (X分钟前 / 昨天 HH:MM / absolute) must parse or one row fails the page.
|
|
141
88
|
*/
|
|
142
89
|
export declare function sseTime(text: string, now?: Date): string | undefined;
|
|
143
90
|
export declare function sseinfoQa(transport: Requester, input: {
|
|
@@ -149,24 +96,16 @@ export declare function sseinfoQa(transport: Requester, input: {
|
|
|
149
96
|
uidLocateBudgetMs?: number;
|
|
150
97
|
}): Promise<SourceOutcome>;
|
|
151
98
|
/**
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
* 实测(2026-09-24):GET + JSON,`code` 为**字符串** `"1"` 表示成功;条目含 `title` /
|
|
156
|
-
* `showTime`(已是北京时间字符串)/ `summary`。服务端会把它聚合到的财联社内容一并返回,
|
|
157
|
-
* 所以同一事件可能与其他来源重复——**去重由调用方按标题判断**,本工具不猜。
|
|
99
|
+
* Independent CLS/WSCN backup; success `code` is the string "1". The server aggregates
|
|
100
|
+
* CLS content, so title dedupe is the caller's job.
|
|
158
101
|
*/
|
|
159
102
|
export declare function eastmoneyFastNews(client: EastmoneyClient, input: {
|
|
160
103
|
limit: number;
|
|
161
104
|
signal?: AbortSignal;
|
|
162
105
|
}): Promise<SourceOutcome>;
|
|
163
106
|
/**
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
* ⚠️ 必须区分两种"没结果"(参考实践记为 #18,本仓 2026-09-24 实测为正常返回):
|
|
167
|
-
* 上游对部分 IP 间歇风控时只返回 `passportWeb`(股民资料)而**没有** `cmsArticleWebOld` 键——
|
|
168
|
-
* 这与"该股确实没有新闻"(键在、数组为空)是**两件事**。本函数按**键是否存在**判定,
|
|
169
|
-
* 缺键时报 `UPSTREAM`,绝不静默返回空表。
|
|
107
|
+
* A missing `cmsArticleWebOld` key is intermittent upstream throttling, not "no news"
|
|
108
|
+
* (which is a present-but-empty array); report UPSTREAM on the missing key.
|
|
170
109
|
*/
|
|
171
110
|
export declare function eastmoneyStockNews(client: EastmoneyClient, input: {
|
|
172
111
|
code: string;
|
|
@@ -174,17 +113,8 @@ export declare function eastmoneyStockNews(client: EastmoneyClient, input: {
|
|
|
174
113
|
signal?: AbortSignal;
|
|
175
114
|
}): Promise<SourceOutcome>;
|
|
176
115
|
/**
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
* ⚠️ **没有摘要可给**(2026-09-24 实测该接口 51 个字段):列表只有标题 / 机构 / 研究员 /
|
|
180
|
-
* 日期 / 评级。正文在那份 PDF 里——本机直连只处理文本(`application/pdf` 会被
|
|
181
|
-
* `web_retriever_fetch` 拒),要走 `ocr` 解析(§4.3)。所以本函数把**每条的 PDF 直链**交出去
|
|
182
|
-
* (`pdf_url`),通路才是完整的:没有它,模型手上没有任何稳定 `.pdf` URL,而人设又禁止编链接。
|
|
183
|
-
*
|
|
184
|
-
* 有用的派生信息:每篇研报自带分析师预测 EPS(`predictThisYearEps` / `predictNextYearEps` /
|
|
185
|
-
* `predictNextTwoYearEps`)与对应 PE,以及评级与评级变动(`emRatingName` / `ratingChange`)。
|
|
186
|
-
*
|
|
187
|
-
* ⚠️ 该接口只认**纯 6 位代码**:带 `SH` 前缀会返回 `hits=0`,看起来像"这只票没研报"。
|
|
116
|
+
* No abstract in the list; the per-item PDF link is the only path to the text (via `ocr`).
|
|
117
|
+
* Only bare 6-digit codes work (a prefixed code returns hits=0); EPS fields are strings.
|
|
188
118
|
*/
|
|
189
119
|
export declare function eastmoneyReports(client: EastmoneyClient, input: {
|
|
190
120
|
code: string;
|
|
@@ -193,15 +123,8 @@ export declare function eastmoneyReports(client: EastmoneyClient, input: {
|
|
|
193
123
|
signal?: AbortSignal;
|
|
194
124
|
}): Promise<SourceOutcome>;
|
|
195
125
|
/**
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
* ⚠️ 两条**与参考实践不同的实测结论**(2026-09-24,本仓复核):
|
|
199
|
-
* 1. 参考实践说"两次请求间隔 <1 秒会返回假的『没有找到相关内容』空页,必须 6 秒"。
|
|
200
|
-
* 本仓实测**连续 4 次无间隔全部成功**(分别为 40/39/39/38 条带序号行)——那个"限流"是误判。
|
|
201
|
-
* 2. 真正会让**个股**查询返回假空页的是**缺交易所前缀**:`688017` 纯 6 位 → 假空页;
|
|
202
|
-
* `sh688017` / `sz000001` → 正常。而 `600519` 纯 6 位恰好也能用(前缀可推断),
|
|
203
|
-
* 所以"纯 6 位能用"的样本会误导人。本函数**一律补前缀**。
|
|
204
|
-
* ⚠️ 空页 HTTP 200 且与"真的没有研报"长得一样,因此本函数按"带序号行数"与空页提示语双重判定。
|
|
126
|
+
* Always add the exchange prefix: bare codes get a fake empty page for STAR/ChiNext.
|
|
127
|
+
* That page is HTTP 200 and looks like "no reports", so also verify the numbered row count.
|
|
205
128
|
*/
|
|
206
129
|
export declare function sinaReports(transport: Requester, input: {
|
|
207
130
|
code?: string;
|
|
@@ -209,24 +132,14 @@ export declare function sinaReports(transport: Requester, input: {
|
|
|
209
132
|
signal?: AbortSignal;
|
|
210
133
|
}): Promise<SourceOutcome>;
|
|
211
134
|
/**
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
* ⚠️ 顺序要紧:`92xxxx`(北交所**新号段**,如 832982→920982)以 9 开头,若先判 `9 → sh`
|
|
215
|
-
* 就会被发到上交所并拿到假空页。所以北交所号段(43/83/87/920)必须先判,
|
|
216
|
-
* 只有 `900xxx`(沪市 B 股)才归 sh。
|
|
135
|
+
* Always prefix the exchange; order matters: BJ segments (43/83/87/920) start with 9/4
|
|
136
|
+
* and must be tested before `9 => sh`; only 900xxx is Shanghai B.
|
|
217
137
|
*/
|
|
218
138
|
export declare function sinaSymbol(code: string): string;
|
|
219
139
|
/**
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
* 1. 该站声明 `content-type: text/html`(**不带 charset**)而正文是 GBK:
|
|
224
|
-
* 按 UTF-8 解会得到 11,800 个替换字符,中文与正则全部失效。因此本请求显式声明 `encoding: 'gbk'`
|
|
225
|
-
* (`HttpRequest.encoding` 只允许来源实现填写,不暴露给模型)。
|
|
226
|
-
* 2. 页面里有 **32 个 `<table>`**,只需认"含『每股收益』表头"的那一张(行结构固定为
|
|
227
|
-
* 年度 / 预测机构数 / 最小值 / 均值 / 最大值 / 行业平均数)。**均值即机构一致预期 EPS**。
|
|
228
|
-
*
|
|
229
|
-
* 另附页面摘要块里的"预测机构数 + 同比增速"(与表格同源,作为交叉印证)。
|
|
140
|
+
* The page declares text/html without charset but is GBK, so decode explicitly
|
|
141
|
+
* (`encoding` is source-only, never a model input). Of its 32 tables, pick the one
|
|
142
|
+
* with 每股收益/均值 headers; the mean is the consensus EPS.
|
|
230
143
|
*/
|
|
231
144
|
export declare function thsEpsForecast(transport: Requester, input: {
|
|
232
145
|
code: string;
|