@v587d/capital-generation 2.8.2 → 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 +87 -1
- package/README.md +41 -20
- 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 -31
- package/lib/sources/ftshare-rest.js +1194 -225
- 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 +39 -64
- 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,63 +1,36 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Shared watchlist type and holding rules for host and browser.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* 两处各抄一份的结局是"菜单里能点、宿主说 invalid_query"或反过来"菜单没得点、直接打路由却写进去了",
|
|
8
|
-
* 而两种都是不报错的错(AGENTS.md §9.7:同一知识只许有一份实现)。
|
|
9
|
-
* `client.src.cjs` 用 `require()` 引它,esbuild 在构建期把本文件内联进 `client.js`;
|
|
10
|
-
* `index.js` 用 `import` 引它。⛔ 本文件必须列进 `package.json` 的 `files`——
|
|
11
|
-
* 漏了的表现是装出去的插件 `ERR_MODULE_NOT_FOUND`、整条 `/capital-watchlist/*` 起不来,
|
|
12
|
-
* 而本机测试全绿(文件就在磁盘上)。闸门:`test/packaging.test.mjs`。
|
|
4
|
+
* One implementation prevents the panel and host from disagreeing silently.
|
|
5
|
+
* ⛔ Listed in package.json `files`; packaging.test.mjs pins that because local
|
|
6
|
+
* tests pass even when the installed plugin cannot resolve this module.
|
|
13
7
|
*/
|
|
14
8
|
export const ASSET_TYPES = ['a-share', 'a-share-index', 'fund-etf', 'hk-stock', 'hk-index', 'us-stock', 'us-index']
|
|
15
9
|
|
|
16
|
-
/**
|
|
17
|
-
* 可以是一个**仓位**的类型:个股与场内基金。三种指数不在表上——指数不是一个可持有、
|
|
18
|
-
* 可配比率的标的(它是市场读数,不是券),所以它没有"持仓比例"这件事可言。
|
|
19
|
-
*
|
|
20
|
-
* ⛔ 这是**白名单**而不是"排除 `*-index`":未知或缺失的 `asset_type` 一律不可标。
|
|
21
|
-
* 判据写成反选时,将来往 `ASSET_TYPES` 里加任何一档都会自动获得持仓入口,
|
|
22
|
-
* 而那一步没人复核过;写成正选,新档默认没有这个入口,要给它就得改这一行——改这一行会红。
|
|
23
|
-
*/
|
|
10
|
+
/** Holdable is an allow-list, not "exclude indices"; future asset types gain no entry until added here. */
|
|
24
11
|
export const HOLDABLE_ASSET_TYPES = ['a-share', 'fund-etf', 'hk-stock', 'us-stock']
|
|
25
12
|
|
|
26
|
-
/**
|
|
13
|
+
/** Type-only eligibility; unmarking an existing holding follows a separate path. */
|
|
27
14
|
export const isHoldable = (row) => HOLDABLE_ASSET_TYPES.includes(row?.asset_type)
|
|
28
15
|
|
|
29
|
-
/**
|
|
16
|
+
/** Per-symbol cap in percentage points. */
|
|
30
17
|
export const MAX_ROW_WEIGHT_PCT = 100
|
|
31
18
|
|
|
32
|
-
/**
|
|
33
|
-
* 全组合的占比合计上限:**只做多、不算 put**,所以留出 20 个百分点的余地给"用户自报的数
|
|
34
|
-
* 本来就凑不满 100%"与保证金敞口,再往上就不是一个说得出口的组合了(2026-10-09 用户点名:
|
|
35
|
-
* 面板原来允许两只各 100%,那明显不合理)。
|
|
36
|
-
*
|
|
37
|
-
* ⚠️ 这句话在四处得是同一条口径:这一行、`markHolding` 的拒绝、步进器的 `+` 置灰与
|
|
38
|
-
* `get_watchlist` 的 `description`。宿主是权威,面板只是提前把没额度这件事画出来。
|
|
39
|
-
*/
|
|
19
|
+
/** Portfolio cap: 120 pp for long-only reporting. Host, row gate, stepper and tool text share this rule. */
|
|
40
20
|
export const MAX_TOTAL_WEIGHT_PCT = 120
|
|
41
21
|
|
|
42
|
-
/**
|
|
43
|
-
* 这一条占掉的权重(百分点)。**未填比例的持仓算 0**:勾上但没说数字,就没有任何敞口,
|
|
44
|
-
* 它与"这个数是零"在面板上仍是两句话(读数是 `0~上限` 而不是 `0%`),但在合计里都是 0。
|
|
45
|
-
* ⛔ `?? 0` 之前必须先判 `holding` 这一格在不在——`weight_pct: null` 与没有 `holding` 是两种状态。
|
|
46
|
-
*/
|
|
22
|
+
/** Held without a weight contributes 0 but remains visually distinct from an explicit zero. */
|
|
47
23
|
export const holdingWeight = (row) => (
|
|
48
24
|
row?.holding === null || row?.holding === undefined ? 0 : (row?.holding?.weight_pct ?? 0)
|
|
49
25
|
)
|
|
50
26
|
|
|
51
|
-
/**
|
|
27
|
+
/** Remaining-portfolio subtraction shared by panel and host. */
|
|
52
28
|
export const otherHeldWeightPct = (rows, thscode) => rows.reduce(
|
|
53
29
|
(total, row) => (row?.thscode === thscode ? total : total + holdingWeight(row)),
|
|
54
30
|
0,
|
|
55
31
|
)
|
|
56
32
|
|
|
57
|
-
/**
|
|
58
|
-
* 这一条最多能填到多少:单只上限与"总额度减去其余持仓"取小的,往下托到 0。
|
|
59
|
-
* 步进器用它决定 `+` 置灰与 `0~N` 这句提示;宿主用同一条减法拒绝写入。
|
|
60
|
-
*/
|
|
33
|
+
/** Ceiling used by the stepper and host validator: min(per-row cap, remaining portfolio). */
|
|
61
34
|
export const weightCeiling = (rows, thscode) => Math.max(
|
|
62
35
|
0,
|
|
63
36
|
Math.min(MAX_ROW_WEIGHT_PCT, MAX_TOTAL_WEIGHT_PCT - otherHeldWeightPct(rows, thscode)),
|