@v587d/capital-generation 2.8.0 → 2.8.2

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/lib/time/tools.js CHANGED
@@ -67,6 +67,30 @@ const DATA_TIME_CONTRACTS = {
67
67
  maxDays: TEN_YEAR_DAYS,
68
68
  warning: '分钟档(m1/m5/m15/m30)区间上限 10 天,超出会在参数层被拒;adjust=qfq 时 end_date 不得晚于当日(afdate 由本能力锁成当日)',
69
69
  },
70
+ // FTShare 免费档那三条日度资金流:实测窗口只有最近约 45 个交易日(按真实交易日二分,T-45 有数、T-46 起 total=0)。
71
+ // ⛔ 这里刻意**不设 maxDays**:maxDays 会在参数层抛错,而这个窗口是每天都在往前滚的观测值,
72
+ // 写成天数常量等于造一个会腐烂的闸门(窗口变宽就误拒合法请求)。只给 warning 提示模型别循环重试。
73
+ ftshare_stock_daily_flow: { kind: 'date_range', fields: ['start_date', 'end_date'], warning: '上游只保留最近约 45 个交易日:早于窗口的日期返回 total=0,是合法空结果、不是取数失败,不要换日期循环重试' },
74
+ ftshare_industry_daily_flow: { kind: 'date_range', fields: ['start_date', 'end_date'], warning: '上游只保留最近约 45 个交易日:早于窗口的日期返回 total=0,是合法空结果、不是取数失败' },
75
+ ftshare_concept_daily_flow: { kind: 'date_range', fields: ['start_date', 'end_date'], warning: '上游只保留最近约 45 个交易日:早于窗口的日期返回 total=0,是合法空结果、不是取数失败' },
76
+ ftshare_main_capital_flow: { kind: 'date', fields: ['date'], warning: 'date 必须是交易日;省略时取上游最新切片(实测为当日 15:30 那一次)' },
77
+ ftshare_daily_kline_snapshot: { kind: 'date', fields: ['trade_date'], warning: 'trade_date 必须是**交易日**:非交易日会在参数层响亮失败(实测上游 400「trade_date 不是交易日」),未来交易日返回 total=0;当日截面收盘后即可取(实测 2026-10-15 15:51 打 20261015 已回 5565 行)' },
78
+ ftshare_prev_close: { kind: 'date_range', fields: ['start_date', 'end_date'], warning: '历史窗口起点实测在 2022-04(2016 / 2018 / 2020 / 2021 全年区间都回空数组、不报错);早年请用 history 或 tencent_kline' },
79
+ ftshare_trading_calendar: { kind: 'date_range', fields: ['start_date', 'end_date'] },
80
+ ftshare_block_trades: { kind: 'date', fields: ['date'], warning: 'date 必须是交易日;省略 = 上游最新有数的一天,**当日入库时刻不固定**(实测 2026-10-15 19:32 打 date=当天 total=0,同一晚 20:03 重打已有 80 行)——傍晚拿到当天为空先按「还没入库」理解,不是取数失败、不要循环重试。历史不连续:实测 2016-01-04(交易日历确认是交易日)整天为 0' },
81
+ ftshare_sw_industry_overview: { kind: 'date', fields: ['date'], warning: 'date 必填且必须是交易日(非交易日与未来日期回 total=0,合法空)。⛔ 窗口实测只到最近约 94 个交易日:2026-10-15 实测最早有数的是 2026-05-28,更早的交易日全部 total=0——那是窗口外,不要换日期重试;更早序列请用 ftshare_sw_industry_metrics' },
82
+ ftshare_sw_industry_metrics: { kind: 'date_range', fields: ['start_date', 'end_date'], warning: '最早一天实测 2021-05-31(更早区间回 total=0、不报错);start_date 晚于 end_date 也是静默空,本层已在参数层拒。⛔ 聚合列有断供:amount / total_mv / constituent_count / close_price / below_net_asset_count 与多数 *_quantile 实测自 2026-08-26 起为 null(2026-10-14 仍为 null,但 PE/PB/股息率有值),三级行业的 amount / index_close / 拥挤度恒为 null——null 不是 0,别补值也别循环重试' },
83
+ // 批次 D(2026-10-16 真报文)。⛔ `fields` 的顺序是有主的:resolve_data_time_range 把 period 写成
84
+ // fields[0] / fields[1],所以 date_range 必须是 [start, end],多出来的日期参数只能排在后面。
85
+ ftshare_limit_price: { kind: 'date_range', fields: ['start_date', 'end_date', 'date'], warning: '单票区间模式:start_date / end_date 必须与 code 一起给(实测只给区间不给标的 → 400「start_date/end_date 需配合 symbol 使用」),跨度不超过 3 年(实测 2020..2026 → 400)。全市场模式用 date(单日)。⛔ 混用 date 与区间上游 400;非交易日、未来日期与早于窗口的日期都只回 total=0、不报错(实测 600519.SH 2009 全年空、2010-01-04 起有数)' },
86
+ ftshare_dragon_tiger_seats: { kind: 'date', fields: ['date'], warning: 'date 必填且必须是交易日:上游本来允许省略(回"最新快照"),但响应行里**没有日期列**,所以这颗能力要求显式日期来写时间轴。实测非交易日 / 未来日期 / 早于窗口都回 data:null(合法空、不是失败);窗口起点实测在 2022-01-04(2021-12-31 及更早为空),分不清是滚动还是固定起点' },
87
+ ftshare_index_weight: { kind: 'date', fields: ['date'], warning: 'date 是**权重采集期**且必须精确命中:实测 2026-06-15 / 2026-09-30 各回该期,而 2026-10-01 / 2026-01-01 这种没有采集的日期 total=0(**不会**回退到最近一期);省略时取最新一期。请按数据里出现过的 collect_date 挑期,别按自然日猜' },
88
+ ftshare_convertible_bond_kline: { kind: 'date_range', fields: ['start_date', 'end_date'], warning: '⛔ 跨度上限是 12 个自然月,本层不换算成天数闸门(换算规则未核出):实测 364 天的区间正常、365 天被上游 400「日 K 及以上周期查询范围不能超过 12 个自然月」。start_date 晚于 end_date 在参数层拒(上游同样 400)。要更长序列请分段取,注意周/月/年档是按请求区间内日 K 聚合的,窗口没盖满周期那根不完整' },
89
+ // 批次 E(2026-10-16 真报文):利率族与财经日历。⛔ LPR 那颗**没有日期参数**(上游会静默忽略多发参数),所以不挂契约。
90
+ ftshare_chinabond_yield: { kind: 'date_range', fields: ['start_date', 'end_date'], warning: 'start_date / end_date 必填。⛔ 三条曲线各自起点不同(实测同一 2002-2010 窗口内:国债 2006-03-01、中短期票据 2006-12-25、商业银行普通债 2009-12-24),早于某条曲线起点只是那一行缺席,是合法空、不是失败、不要按年份重试;起点是滚动还是固定未核出' },
91
+ ftshare_shibor: { kind: 'date_range', fields: ['start_date', 'end_date'], warning: 'start_date / end_date 必填。历史起点实测在 2006-10-08(2006 全年 63 行、首行就是它;2006-01-01..06-30、07-01..09-30、1999 与 2004 全年都 0 行);周末、节假日与未发布日没有行,上游不插值也不前值填充,所以序列天然不连续' },
92
+ ftshare_hibor: { kind: 'date_range', fields: ['start_date', 'end_date'], warning: 'start_date / end_date 必填。实测 2010 全年 249 行(首行 2010-01-04)、2000-01-01..2001-12-31 两年 0 行,起点是否滚动未核出;香港假日与未发布日没有行。⛔ m4 / m5 / m7..m11 七档实测整列为 null(HIBOR 只公布部分期限),null 不是 0,别补值' },
93
+ ftshare_financial_calendar: { kind: 'date_range', fields: ['start_date', 'end_date'], warning: '⛔ 单次窗上限是 3 天差(实测 4 天就 400「时间范围不能超过3天」,本层在参数层拒)——要更长区间请分段请求,本层不循环取。覆盖是**滚动窗**:实测 2026-08-03 / 09-01 / 09-15 / 10-05 / 10-12 / 10-19 / 10-26 各日都有事件(40 / 59 / 45 / 37 / 21 / 25 / 10 行),2026-11-02 与 11-16 / 12-01 / 2026-01-05 回空数组(total=0),2020 / 2023 / 2024 / 2025 里的整天直接回 data:null——边界随日期前移;两种空都是合法空,不要换日期重试' },
70
94
  };
71
95
  export function getDataTimeContract(capability) {
72
96
  const contract = DATA_TIME_CONTRACTS[capability];
@@ -6,7 +6,7 @@
6
6
  * between validation and connect. Closing that window would require a custom
7
7
  * dispatcher; this module keeps the same explicit trade-off as dsh-search-first.
8
8
  */
9
- export declare const LOCAL_FETCH_CLIENT_VERSION = "2.8.0";
9
+ export declare const LOCAL_FETCH_CLIENT_VERSION = "2.8.2";
10
10
  export declare const LOCAL_FETCH_MAX_URL_LENGTH = 2048;
11
11
  export type LocalFetchErrorCode = 'ABORTED' | 'TIMEOUT' | 'INVALID_URL' | 'BLOCKED_URL' | 'DNS' | 'REDIRECT' | 'HTTP' | 'TOO_LARGE' | 'UNSUPPORTED_CONTENT_TYPE';
12
12
  export declare class LocalFetchError extends Error {
@@ -7,7 +7,7 @@
7
7
  * dispatcher; this module keeps the same explicit trade-off as dsh-search-first.
8
8
  */
9
9
  import { htmlToMarkdown, stripInvisibleText } from './html-markdown.js';
10
- export const LOCAL_FETCH_CLIENT_VERSION = '2.8.0';
10
+ export const LOCAL_FETCH_CLIENT_VERSION = '2.8.2';
11
11
  export const LOCAL_FETCH_MAX_URL_LENGTH = 2048;
12
12
  export class LocalFetchError extends Error {
13
13
  code;
@@ -52,7 +52,7 @@ export interface WindCallResult {
52
52
  * `test/chart-composition.test.mjs` 守着(会因漂移而失败),这里原本是写死的第二处,
53
53
  * 一次发版就得记得改两遍。所以本常量由测试一并核对(见 `test/wind-client.test.mjs`)。
54
54
  */
55
- export declare const WIND_CLIENT_VERSION = "2.8.0";
55
+ export declare const WIND_CLIENT_VERSION = "2.8.2";
56
56
  export interface WindClient {
57
57
  callTool(toolName: string, args: Record<string, unknown>, signal?: AbortSignal): Promise<WindCallResult>;
58
58
  }
@@ -35,7 +35,7 @@ export const WIND_SERVER_ENDPOINTS = {
35
35
  * `test/chart-composition.test.mjs` 守着(会因漂移而失败),这里原本是写死的第二处,
36
36
  * 一次发版就得记得改两遍。所以本常量由测试一并核对(见 `test/wind-client.test.mjs`)。
37
37
  */
38
- export const WIND_CLIENT_VERSION = '2.8.0';
38
+ export const WIND_CLIENT_VERSION = '2.8.2';
39
39
  function errorText(error) {
40
40
  return error instanceof Error ? error.message : String(error);
41
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@v587d/capital-generation",
3
- "version": "2.8.0",
3
+ "version": "2.8.2",
4
4
  "description": "Capital Generation:面向中国散户的 AI 投资助手插件(Capital mode Agent Preset)",
5
5
  "icon": "assets/cg-icon.png",
6
6
  "author": "v587d",
@@ -59,7 +59,7 @@ description: Use when composing or reading a Capital data message — data_reque
59
59
  | 步 | 工具 | 得到什么 | 调用纪律 |
60
60
  |----|------|----------|----------|
61
61
  | ① | `list_capabilities()` | 纯文本能力目录:**一行一条** `capability\|summary\|paginated`(1=分页、0=不分页) | **一个任务只调一次**;目录已在本 session 历史里,重复调用只会白占上下文 |
62
- | ② | `describe_capability({ capability })` | 该能力的完整 `description` / `input_schema` / `output_fields`(逐行字段字典) | 一次只传**一个**名字、**不传逗号**;同一个能力描述一次即可;要几个能力就分别调用几次 |
62
+ | ② | `describe_capability({ capability })` | 该能力的完整 `description` / `input_schema` / `output_fields`(逐行字段字典) | 一次只传**一个**名字、**不传逗号**;同一个能力描述一次即可;要几个能力就在**同一条消息里一次发出多个调用**(纯读、可并发),不要一份一份等 |
63
63
 
64
64
  - 读目录时**按行切**:一行就是一条能力,取第一个 `|` 前面的部分当 `capability` 原样复制;摘要里出现的
65
65
  `\|`、`\n` 是转义字符,不是分隔符。
@@ -69,6 +69,9 @@ description: Use when composing or reading a Capital data message — data_reque
69
69
  - 目录刻意不含参数与输出结构:全量 schema 约 23KB,会被工具结果剪枝器(阈值 8192)截断中间
70
70
  部分,导致排在中间的能力在发现阶段不可见。目录只负责"选哪个",详情负责"怎么填"。
71
71
  - **一个任务只调一次 `list_capabilities`**;**同一个能力只描述一次**,重复调用只会白占上下文。
72
+ - `list_capabilities` 与 `describe_capability` 都是**纯读**:本轮要看几个能力,就在**同一条消息里一次发出
73
+ 这几个 `describe_capability` 调用**,它们在框架并发池里并行执行、在同一个下一步一起返回;一份一份等
74
+ 等于把一次往返付成 N 次。这不改变上一条"每个能力只描述一次",也不改变"一次只传一个名字"。
72
75
  - 不查 `input_schema` 就填 `params` 属于违规;`params` 的取值与约束一律以 `describe_capability` 为准。
73
76
 
74
77
  `describe_capability` 的错误按 code 处置,不要盲目重试:
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@v587d/watchlist",
3
- "version": "2.8.0",
3
+ "version": "2.8.2",
4
4
  "description": "Capital 模式的用户自选股(宿主级清单 + Fuyao 报价快照 + /capital-watchlist 路由 + 输入框菜单弹窗):由 @v587d/capital-generation 随包携带并作为 host 平面行挂载。",
5
5
  "license": "MIT",
6
6
  "type": "module",