@v587d/capital-generation 2.7.8 → 2.7.10
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 +93 -0
- package/README.md +6 -5
- package/THIRD_PARTY_NOTICES.md +12 -2
- package/capital-config/client.js +8 -3
- package/capital-config/client.src.cjs +47 -11
- package/capital-config/package.json +1 -1
- package/capital-watchlist/client.js +3 -3
- package/capital-watchlist/client.src.cjs +4 -4
- package/capital-watchlist/package.json +1 -1
- package/chart-ui/package.json +1 -1
- package/lib/agents/selected-skills-provider.d.ts +10 -0
- package/lib/agents/selected-skills-provider.js +179 -14
- package/lib/chart/source-token.js +18 -3
- package/lib/data-collector/dataset-tools.js +4 -2
- package/lib/data-collector/describe.d.ts +4 -0
- package/lib/data-collector/describe.js +11 -1
- package/lib/index.d.ts +17 -0
- package/lib/index.js +50 -18
- package/lib/web-retriever/local-fetch.d.ts +1 -1
- package/lib/web-retriever/local-fetch.js +1 -1
- package/lib/web-retriever/wind-client.d.ts +1 -1
- package/lib/web-retriever/wind-client.js +1 -1
- package/package.json +2 -1
- package/preset/capital-generation/agent.patch.yml +1 -0
- package/preset/capital-generation/skills/capital-data-protocol/SKILL.md +4 -0
- package/preset/capital-generation/skills/capital-equity-research/SKILL.md +1 -1
- package/preset/capital-generation/skills/capital-orchestration/SKILL.md +5 -0
- package/preset/capital-generation/skills/capital-visualization-protocol/SKILL.md +7 -7
- package/preset/capital-generation/skills/capital-web-protocol/SKILL.md +10 -3
- package/selected-skills/catalog.js +164 -54
- package/selected-skills/quant-agent-skills/LICENSE +21 -0
- package/selected-skills/quant-agent-skills/UPSTREAM.md +111 -0
- package/selected-skills/quant-agent-skills/skills/cross-market-listing-choice/SKILL.md +105 -0
- package/selected-skills/quant-agent-skills/skills/cross-market-listing-choice/references/adr-hk-overlay.md +45 -0
- package/selected-skills/quant-agent-skills/skills/cross-market-listing-choice/references/ah-overlay.md +44 -0
|
@@ -9,8 +9,9 @@ const {
|
|
|
9
9
|
Modal,
|
|
10
10
|
writeClipboard,
|
|
11
11
|
IconRightUpOutlineRegular,
|
|
12
|
+
IconWarningTriangleOutlineRegular,
|
|
12
13
|
} = require('@deepseek-ai/dsh-client-ui-primitives')
|
|
13
|
-
const { SELECTED_SKILL_CATALOG, SELECTED_SKILL_TAG_LABELS } = require('../selected-skills/catalog.js')
|
|
14
|
+
const { SELECTED_SKILL_CATALOG, SELECTED_SKILL_TAG_LABELS, SELECTED_SKILLS_MAX_ENABLED } = require('../selected-skills/catalog.js')
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* 卡片读的是**配置条目 id**,坐的是**组合包自己的页面**——两个不同的字符串,各自钉在不同地方:
|
|
@@ -107,6 +108,11 @@ const zh = {
|
|
|
107
108
|
selectedSkillsTitle: '精选 Skills',
|
|
108
109
|
selectedSkillsFilterLabel: '按能力筛选',
|
|
109
110
|
selectedSkillsEmpty: '没有匹配这个标签的 Skill。',
|
|
111
|
+
// 上限只挡"再勾一个",不挡"已经勾上的生效":老配置多于上限时照常全部生效,只提示收敛
|
|
112
|
+
// (运行期 provider 不按这个数截断,否则就是"卡片上开着 10 个、会话里只剩 6 个"的静默砍功能)。
|
|
113
|
+
// 被挡住的原因只活在**开关左侧那枚三角警示图标**上(悬停 title / 读屏 aria-label 同一串):
|
|
114
|
+
// {count} 是计数占位("6/6"),由代码拼,字典不存数字。
|
|
115
|
+
selectedSkillsCapTooltip: 'Skill已达上限 ({count})。',
|
|
110
116
|
selectedSkillsCopyName: '复制技能名',
|
|
111
117
|
selectedSkillsCopied: '已复制',
|
|
112
118
|
selectedSkillsDetail: '详情',
|
|
@@ -146,6 +152,7 @@ const en = {
|
|
|
146
152
|
selectedSkillsTitle: 'Selected Skills',
|
|
147
153
|
selectedSkillsFilterLabel: 'Filter by capability',
|
|
148
154
|
selectedSkillsEmpty: 'No skills match this tag.',
|
|
155
|
+
selectedSkillsCapTooltip: 'Skill limit reached ({count}).',
|
|
149
156
|
selectedSkillsCopyName: 'Copy skill name',
|
|
150
157
|
selectedSkillsCopied: 'Copied',
|
|
151
158
|
selectedSkillsDetail: 'Details',
|
|
@@ -253,7 +260,12 @@ function installStyles() {
|
|
|
253
260
|
.capital-config-switch-text { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
|
|
254
261
|
.capital-config-switch-label { color: var(--dsw-alias-label-primary); font-size: 13px; font-weight: 500; line-height: 20px; }
|
|
255
262
|
.capital-config-hint { margin: 0; color: var(--dsw-alias-label-tertiary); font-size: 12px; line-height: 18px; }
|
|
256
|
-
|
|
263
|
+
/* ⚠️ 语义色只用主题真实定义的 --dsw-alias-state-*:--dsw-alias-label-error 主题里**没定义**,
|
|
264
|
+
var() 判败回继承色 ⇒ light 黑 / dark 白(这枚图标与"保存失败"行实机就是这么错的)。
|
|
265
|
+
warn 色用 --dsw-alias-state-warn-primary(StateDot / Tag 的 warning 同款)。cursor:help 让
|
|
266
|
+
"它有话要说"看得出来;padding 2px + 负 margin 只放大悬停命中区、不占布局(14px 的图标当悬停靶子太小)。 */
|
|
267
|
+
.capital-config-skill-cap-icon { display: inline-flex; align-items: center; flex: none; padding: 2px; margin: -2px; color: var(--dsw-alias-state-warn-primary); cursor: help; }
|
|
268
|
+
.capital-config-write-failed { margin: 0; color: var(--dsw-alias-state-error-primary); font-size: 12px; line-height: 18px; }
|
|
257
269
|
/* 标题右侧的两枚外链:官方那一格是 flex-wrap + gap:8px,整组自己收成一个 inline-flex 项,
|
|
258
270
|
免得标题变长时被换行拆成两截。颜色只走 --dsw-* 变量,明暗两套都跟着宿主。 */
|
|
259
271
|
.capital-config-plugin-links { flex: none; align-items: center; gap: 2px; display: inline-flex; }
|
|
@@ -570,7 +582,7 @@ function loadSkillDoc(name) {
|
|
|
570
582
|
/** 「已复制」亮多久:要够读完,又不能亮到让人以为它是个状态开关。 */
|
|
571
583
|
const COPIED_FLASH_MS = 1600
|
|
572
584
|
|
|
573
|
-
function SelectedSkillRow({ entry, state, disabled, onChange, t }) {
|
|
585
|
+
function SelectedSkillRow({ entry, state, disabled, capReached = false, capTooltip, onChange, t }) {
|
|
574
586
|
const locale = skillLocale()
|
|
575
587
|
const label = entry.label[locale]
|
|
576
588
|
const repositoryUrl = `https://github.com/${entry.owner}/${entry.repository}`
|
|
@@ -667,10 +679,22 @@ function SelectedSkillRow({ entry, state, disabled, onChange, t }) {
|
|
|
667
679
|
h('div', { className: 'capital-config-skill-tags' }, entry.tags.map((tag) =>
|
|
668
680
|
h('span', { key: tag, className: 'capital-config-skill-tag' }, SELECTED_SKILL_TAG_LABELS[locale][tag] ?? tag))),
|
|
669
681
|
),
|
|
682
|
+
// 被上限挡住的行(到上限 + 没勾):开关**左边**一枚三角警示图标,原因挂在图标的
|
|
683
|
+
// title / aria-label 上(同一串,悬停才见)——开关上不挂 title,列表顶上也没有整行提示。
|
|
684
|
+
// 图标组件不吃自定义 props(artwork 只解构 size/className/strokeWidth),所以 title /
|
|
685
|
+
// aria 挂在包着它的 span 上;`role=img` 让读屏在开关之前先听到"为什么它拨不动"。
|
|
686
|
+
capReached && state?.on !== true ? h('span', {
|
|
687
|
+
className: 'capital-config-skill-cap-icon',
|
|
688
|
+
title: capTooltip,
|
|
689
|
+
role: 'img',
|
|
690
|
+
'aria-label': capTooltip,
|
|
691
|
+
}, h(IconWarningTriangleOutlineRegular, { size: 14 })) : null,
|
|
670
692
|
h(Switch, {
|
|
671
693
|
label,
|
|
672
694
|
checked: state?.on === true,
|
|
673
|
-
|
|
695
|
+
// 上限只挡"再勾一个":**已勾上的行永远关得掉**——把用户关进一个既不能再选、也不能取消的
|
|
696
|
+
// 格子里,比不给上限糟得多。被挡住的原因由左边那枚警示图标回答(控件不许对自己的状态说谎)。
|
|
697
|
+
disabled: disabled || state?.writing === true || (capReached && state?.on !== true),
|
|
674
698
|
onChange,
|
|
675
699
|
}),
|
|
676
700
|
),
|
|
@@ -774,19 +798,29 @@ function CapitalCard(props) {
|
|
|
774
798
|
onClick: () => setTagFilter(tag),
|
|
775
799
|
}, tagLabels[tag] ?? tag, h('span', { className: 'capital-config-selected-filter-count' }, String(tagCounts.get(tag))))),
|
|
776
800
|
)
|
|
801
|
+
// 已选数按开关现算(tab 上那个 n/68 也用它)。上限**只在编辑期**生效:它挡"再勾一个",
|
|
802
|
+
// 不挡"已经勾上的生效"——老配置超过上限时运行期照常全部加载,这里只提示收敛。
|
|
803
|
+
const enabledSkills = SELECTED_SKILL_CATALOG.filter(
|
|
804
|
+
(entry) => state.selectedSkills?.[entry.key]?.on === true,
|
|
805
|
+
).length
|
|
806
|
+
const capReached = enabledSkills >= SELECTED_SKILLS_MAX_ENABLED
|
|
807
|
+
// 被挡住的行共用同一串悬停文案(含计数),拼一次传下去:62 行各自重拼,漂移就是两处对不齐。
|
|
808
|
+
const capTooltip = t('selectedSkillsCapTooltip')
|
|
809
|
+
.replace('{count}', `${enabledSkills}/${SELECTED_SKILLS_MAX_ENABLED}`)
|
|
777
810
|
const skillRows = visibleSkills.length > 0
|
|
778
811
|
? visibleSkills.map((entry) => h(SelectedSkillRow, {
|
|
779
812
|
key: entry.key,
|
|
780
813
|
entry,
|
|
781
814
|
state: state.selectedSkills?.[entry.key],
|
|
782
815
|
disabled: disabled || state.saving,
|
|
816
|
+
capReached,
|
|
817
|
+
capTooltip,
|
|
783
818
|
onChange: (value) => props.toggleSelectedSkill(entry.key, value),
|
|
784
819
|
t,
|
|
785
820
|
}))
|
|
786
821
|
: [h('p', { key: 'empty', className: 'capital-config-hint' }, t('selectedSkillsEmpty'))]
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
).length
|
|
822
|
+
// 到上限的提示不再占一整行:原因逐行挂在被挡住的开关左侧那枚三角警示图标上(SelectedSkillRow),
|
|
823
|
+
// 这里不画任何汇总提示——一行红字 + 62 个灰开关是两套说法,只留图标一套。
|
|
790
824
|
// 行数取不到就**只留标题**:把"还不知道"画成 `0` 是控件对自己的状态说谎(数字缺席本身就是信号)。
|
|
791
825
|
const withCount = (label, count) => (Number.isInteger(count) ? `${label} ${count}` : label)
|
|
792
826
|
const options = [
|
|
@@ -821,10 +855,12 @@ function CapitalCard(props) {
|
|
|
821
855
|
},
|
|
822
856
|
}),
|
|
823
857
|
panel('sources', [form, localFetchSection]),
|
|
824
|
-
panel('skills', [
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
858
|
+
panel('skills', [
|
|
859
|
+
h('div', { className: 'capital-config-selected-layout' },
|
|
860
|
+
skillsFilter,
|
|
861
|
+
h('div', { className: 'capital-config-selected-list' }, ...skillRows),
|
|
862
|
+
),
|
|
863
|
+
]),
|
|
828
864
|
// 第三块的内容是宿主自己画的那段清单(切过来才在下方显形)。画面上不再写那句"清单在下方"——
|
|
829
865
|
// 用户点这一格看到的就是清单,多余的一行字只是噪音。但 `aria-controls` 指的这块面板不许是空的
|
|
830
866
|
// (空面板不报错,只有读屏用户付账),所以那句话改挂在 sr-only 上:零布局贡献、读得到。
|
|
@@ -5,7 +5,7 @@ window.__ModuleLoader__.load({
|
|
|
5
5
|
var module = { exports: {} }
|
|
6
6
|
var exports = module.exports
|
|
7
7
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' })
|
|
8
|
-
"use strict";var S=Object.defineProperty;var st=Object.getOwnPropertyDescriptor;var nt=Object.getOwnPropertyNames;var ot=Object.prototype.hasOwnProperty;var ct=(e,a,t)=>()=>{if(t)throw t[0];try{return e&&(a=e(e=0)),a}catch(s){throw t=[s],s}};var dt=(e,a)=>{for(var t in a)S(e,t,{get:a[t],enumerable:!0})},pt=(e,a,t,s)=>{if(a&&typeof a=="object"||typeof a=="function")for(let i of nt(a))!ot.call(e,i)&&i!==t&&S(e,i,{get:()=>a[i],enumerable:!(s=st(a,i))||s.enumerable});return e};var ht=e=>pt(S({},"__esModule",{value:!0}),e);var H={};dt(H,{ASSET_TYPES:()=>ut,HOLDABLE_ASSET_TYPES:()=>P,MAX_ROW_WEIGHT_PCT:()=>wt,MAX_TOTAL_WEIGHT_PCT:()=>ft,holdingWeight:()=>I,isHoldable:()=>mt,otherHeldWeightPct:()=>R,weightCeiling:()=>gt});var ut,P,mt,wt,ft,I,R,gt,z=ct(()=>{"use strict";ut=["a-share","a-share-index","fund-etf","hk-stock","hk-index","us-stock","us-index"],P=["a-share","fund-etf","hk-stock","us-stock"],mt=e=>P.includes(e?.asset_type),wt=100,ft=120,I=e=>e?.holding===null||e?.holding===void 0?0:e?.holding?.weight_pct??0,R=(e,a)=>e.reduce((t,s)=>s?.thscode===a?t:t+I(s),0),gt=(e,a)=>Math.max(0,Math.min(100,120-R(e,a)))});var{createElement:l,useEffect:bt,useState:M}=require("react"),{createSnapshotStore:xt}=require("@deepseek-ai/dsh-client-store"),{IconChecklistOutlineRegular:yt,IconCloseOutlineRegular:O,IconDatabaseOutlineRegular:vt,IconEllipsisOutlineRegular:kt,IconGoalOutlineRegular:Nt,IconListPenOutlineRegular:St,IconPinOutlineRegular:_t,IconRefreshOutlineRegular:Ct,IconSearchOutlineRegular:Et,IconTrashOutlineRegular:Tt,Menu:At,MenuItemButton:$t,Modal:Pt,Switch:It}=require("@deepseek-ai/dsh-client-ui-primitives"),{isHoldable:F,weightCeiling:W}=(z(),ht(H)),f="capital-watchlist",_="capital.watchlist",L="conversation.input.overlay",j="/capital-watchlist",Rt="capital-generation",Ht=300,C=10,D="capital-watchlist-css",zt={"command.label":"\u81EA\u9009\u80A1","command.description":"\u6DFB\u52A0 / \u67E5\u770B / \u5220\u9664\u81EA\u9009\u80A1",title:"\u81EA\u9009\u80A1",close:"\u5173\u95ED",searchPlaceholder:"\u8F93\u5165\u8BC1\u5238\u4EE3\u7801\u6216\u540D\u79F0\uFF0C\u652F\u6301A\u80A1/\u6E2F\u80A1/\u7F8E\u80A1",add:"\u6DFB\u52A0",added:"\u5DF2\u6DFB\u52A0",refreshing:"\u5237\u65B0\u4E2D\u2026",refresh:"\u5237\u65B0\u62A5\u4EF7",loading:"\u6B63\u5728\u8BFB\u53D6\u6E05\u5355\u2026",empty:"\u8FD8\u6CA1\u6709\u81EA\u9009\u80A1\uFF0C\u7528\u4E0A\u9762\u7684\u8F93\u5165\u6846\u6DFB\u52A0\u3002",colName:"\u540D\u79F0",colQuote:"\u6700\u65B0\u4EF7 / \u6DA8\u8DCC\u5E45",colAction:"\u64CD\u4F5C",updated:"\u66F4\u65B0\u65F6\u95F4",notRefreshed:"\u672A\u5237\u65B0",stale:"\u4E0A\u4E00\u6B21\u5FEB\u7167",exchangeTime:"\u4EA4\u6613\u6240\u65F6\u95F4",noChangePct:"\u6682\u65E0\u6DA8\u8DCC\u6570\u636E",typeAShare:"A\u80A1",typeHkStock:"\u6E2F\u80A1",typeUsStock:"\u7F8E\u80A1",typeAIndex:"A\u6307",typeHkIndex:"\u6E2F\u6307",typeUsIndex:"\u7F8E\u6307",kindStock:"\u80A1\u7968",kindIndex:"\u6307\u6570",kindEtf:"ETF",remove:"\u79FB\u9664",more:"\u66F4\u591A",pin:"\u7F6E\u9876",holdingWeightLabel:"\u6301\u4ED3\u6BD4\u4F8B",holdingStepper:"\u6301\u4ED3\u6BD4\u4F8B\uFF08\u6BCF\u6863 10 \u4E2A\u767E\u5206\u70B9\uFF09",holdingStepUp:"\u589E\u52A0\u6301\u4ED3\u6BD4\u4F8B",holdingStepDown:"\u51CF\u5C11\u6301\u4ED3\u6BD4\u4F8B",holdingName:"\u6301\u4ED3",predict:"\u9884\u6D4B",predictTip:"AI\u9884\u6D4B\u8BE5\u8BC1\u5238\u6807\u7684",review:"\u590D\u76D8",reviewTip:"AI\u590D\u76D8\u8BE5\u8BC1\u5238\u6807\u7684",predictPromptPrefix:"\u8BF7\u9884\u6D4B ",predictPromptSuffix:"\uFF1A\u672A\u6765 5 \u4E2A\u4EA4\u6613\u65E5\u7684\u8D70\u52BF\u4E0E\u5173\u952E\u70B9\u4F4D\uFF0C\u8BF4\u660E\u4F9D\u636E\uFF0C\u5E76\u7ED9\u51FA\u5224\u65AD\u7684\u4E0D\u786E\u5B9A\u6027\u3002",reviewPromptPrefix:"\u8BF7\u590D\u76D8 ",reviewPromptSuffix:"\uFF1A\u4ECA\u65E5\u8D70\u52BF\u4E0E\u91CF\u4EF7\u3001\u8FD1 20 \u65E5\u8D8B\u52BF\u3001\u57FA\u7840\u9762\u3001\u6D88\u606F\u9762\uFF0C\u7ED9\u51FA\u7ED3\u8BBA\u548C\u5FC5\u8981\u98CE\u9669\u8BC4\u4F30\u3002",searching:"\u641C\u7D22\u4E2D\u2026",composingHint:"\u8F93\u5165\u5B8C\u6210\u540E\u81EA\u52A8\u641C\u7D22",clearInput:"\u6E05\u7A7A\u8F93\u5165",confirmTitle:"\u786E\u8BA4\u79FB\u9664\uFF1F",confirmDescPrefix:"\u786E\u5B9A\u5C06 ",confirmDescSuffix:" \u4ECE\u81EA\u9009\u4E2D\u79FB\u9664\u5417\uFF1F",confirmCancel:"\u53D6\u6D88",confirmOk:"\u786E\u8BA4\u79FB\u9664",truncated:"\u6CA1\u6709\u66F4\u591A\uFF0C\u8BF7\u8F93\u5165\u51C6\u786E\u7684\u8BC1\u5238\u4EE3\u7801\u6216\u540D\u79F0\u3002",filterAll:"\u5168\u90E8",filterLabel:"\u6309\u5E02\u573A\u7B5B\u9009\u5019\u9009",filterNoHit:"\u8FD9\u4E2A\u5E02\u573A\u4E0B\u6CA1\u6709\u5339\u914D\u7684\u6807\u7684\u3002",noHit:"\u6CA1\u6709\u5339\u914D\u7684\u6807\u7684\uFF08A\u80A1 / \u6E2F\u80A1 / \u7F8E\u80A1\uFF0C\u542B\u6307\u6570\u4E0E\u573A\u5185\u57FA\u91D1\uFF09\u3002","error.invalid_query":"\u8F93\u5165\u4E0D\u88AB\u63A5\u53D7","error.not_found":"\u6CA1\u6709\u627E\u5230\u8BE5\u6807\u7684","error.ambiguous":"\u547D\u4E2D\u591A\u6761\uFF0C\u8BF7\u4ECE\u5019\u9009\u91CC\u9009\u4E00\u6761","error.list_full":"\u81EA\u9009\u80A1\u6700\u591A {max} \u6761\uFF0C\u5148\u5220\u4E00\u6761\u518D\u52A0","error.list_full_noMax":"\u81EA\u9009\u80A1\u5DF2\u8FBE\u4E0A\u9650\uFF0C\u5148\u5220\u4E00\u6761\u518D\u52A0","error.credential_missing":"\u672A\u914D\u7F6E Fuyao \u5BC6\u94A5\uFF1A\u5728\u300C\u63D2\u4EF6\u300D\u9875\u7684 Capital \u6A21\u5F0F\u5361\u7247\u91CC\u586B API Key\uFF08\u53EA\u5F71\u54CD A \u80A1\u90A3\u4E00\u8DEF\uFF0C\u6E2F\u7F8E\u80A1\u7167\u5E38\u7528\uFF09","error.rate_limited":"\u884C\u60C5\u670D\u52A1\u9650\u6D41\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5","error.fuyao_unavailable":"A \u80A1\u884C\u60C5\u6682\u65F6\u53D6\u4E0D\u5230\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5","error.tencent_unavailable":"\u6E2F\u7F8E\u80A1\u884C\u60C5\u6682\u65F6\u53D6\u4E0D\u5230\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5","error.quote_unavailable":"\u8BE5\u6807\u7684\u6CA1\u6709\u53EF\u7528\u62A5\u4EF7","error.refresh_timeout":"\u5237\u65B0\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5","error.store_unavailable":"\u81EA\u9009\u80A1\u5B58\u50A8\u4E0D\u53EF\u7528","error.unauthorized":"\u767B\u5F55\u72B6\u6001\u5DF2\u5931\u6548\uFF1A\u8BF7\u5148\u56DE\u5230\u5BBF\u4E3B\u7A97\u53E3\u91CD\u65B0\u767B\u5F55",errorSuffix:"\uFF08\u5176\u4ED6\u6807\u7684\u4ECD\u662F\u4E0A\u4E00\u6B21\u6210\u529F\u5FEB\u7167\uFF09","partial.a-share":"A \u80A1\u68C0\u7D22\u4E0D\u53EF\u7528\uFF1A","partial.hk":"\u6E2F\u80A1\u68C0\u7D22\u4E0D\u53EF\u7528\uFF1A","partial.us":"\u7F8E\u80A1\u68C0\u7D22\u4E0D\u53EF\u7528\uFF1A"},Mt={"command.label":"Watchlist","command.description":"Add / view / remove watched symbols",title:"Watchlist",close:"Close",searchPlaceholder:"Symbol code or name \u2014 A-share / HK / US",add:"Add",added:"Added",refreshing:"Refreshing\u2026",refresh:"Refresh quotes",loading:"Loading list\u2026",empty:"No symbols yet \u2014 use the input above to add one.",colName:"Symbol",colQuote:"Last / change",colAction:"Actions",updated:"Updated",notRefreshed:"Not refreshed",stale:"last snapshot",exchangeTime:"exchange time",noChangePct:"No change data yet",typeAShare:"A-Share",typeHkStock:"HK",typeUsStock:"US",typeAIndex:"A-Index",typeHkIndex:"HK-Index",typeUsIndex:"US-Index",kindStock:"stock",kindIndex:"index",kindEtf:"ETF",remove:"Remove",more:"More",pin:"Pin to top",holdingWeightLabel:"Holding weight",holdingStepper:"Holding weight, in steps of 10 percentage points",holdingStepUp:"Increase holding weight",holdingStepDown:"Decrease holding weight",holdingName:"Holding",predict:"Predict",predictTip:"AI prediction for this symbol",review:"Review",reviewTip:"AI review of this symbol",predictPromptPrefix:"Predict ",predictPromptSuffix:" over the next 5 sessions: the likely path and key levels, the evidence behind the call, and how uncertain it is.",reviewPromptPrefix:"Review ",reviewPromptSuffix:" with today's trend and volume, the last 20 sessions, fundamental, news, then a conclusion and the necessary risks analysis.",searching:"Searching\u2026",composingHint:"Search runs when you finish typing",clearInput:"Clear input",confirmTitle:"Remove this symbol?",confirmDescPrefix:"Remove ",confirmDescSuffix:" from your watchlist?",confirmCancel:"Cancel",confirmOk:"Remove",truncated:"No more candidates \u2014 enter an accurate code or name.",filterAll:"All",filterLabel:"Filter candidates by market",filterNoHit:"No matching symbol in this market.",noHit:"No matching symbol (A-share / HK / US, including indices and listed funds).","error.invalid_query":"Input not accepted","error.not_found":"Symbol not found","error.ambiguous":"Multiple hits \u2014 pick one candidate","error.list_full":"Watchlist holds at most {max} symbols \u2014 remove one first","error.list_full_noMax":"Watchlist is full \u2014 remove one first","error.credential_missing":"No Fuyao API key: set it on the Capital card in the Plugins page (A-share quotes only \u2014 HK and US keep working)","error.rate_limited":"Quote service is rate limited \u2014 try again later","error.fuyao_unavailable":"A-share quotes unavailable \u2014 try again later","error.tencent_unavailable":"HK / US quotes unavailable \u2014 try again later","error.quote_unavailable":"No quote for this symbol","error.refresh_timeout":"Refresh timed out \u2014 try again later","error.store_unavailable":"Watchlist storage unavailable","error.unauthorized":"Session expired \u2014 sign back in to the host first",errorSuffix:" (other symbols still show their last good snapshot)","partial.a-share":"A-share search unavailable: ","partial.hk":"HK search unavailable: ","partial.us":"US search unavailable: "},Ot={"a-share":"typeAShare","hk-stock":"typeHkStock","us-stock":"typeUsStock","a-share-index":"typeAIndex","hk-index":"typeHkIndex","us-index":"typeUsIndex","fund-etf":"typeAShare"},Ft={"a-share":"kindStock","hk-stock":"kindStock","us-stock":"kindStock","a-share-index":"kindIndex","hk-index":"kindIndex","us-index":"kindIndex","fund-etf":"kindEtf"};function Lt(e,a){let t=Ot[e];return t===void 0?String(e??""):a(t)}function jt(e,a){let t=Ft[e];return t===void 0?String(e??""):a(t)}var Dt=/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F\u00AD\u200B-\u200F\u2028\u2029\u202A-\u202E\u2060-\u2064\u2066-\u2069\uFEFF]/gu;function T(e){return String(e??"").replace(Dt,"")}function y(e){return Array.isArray(e)?e.map(a=>a===null||typeof a!="object"?a:{...a,name:T(a.name)}):e}var Ut={"a-share":"capital-watchlist-tag-cn","a-share-index":"capital-watchlist-tag-cn","fund-etf":"capital-watchlist-tag-cn","hk-stock":"capital-watchlist-tag-hk","hk-index":"capital-watchlist-tag-hk","us-stock":"capital-watchlist-tag-us","us-index":"capital-watchlist-tag-us"},B=[{id:"all"},{id:"cn",label:"CN"},{id:"hk",label:"HK"},{id:"us",label:"US"}],U=e=>e.exchange==="HK"?"hk":e.exchange==="US"?"us":"cn",qt=`
|
|
8
|
+
"use strict";var S=Object.defineProperty;var st=Object.getOwnPropertyDescriptor;var nt=Object.getOwnPropertyNames;var ot=Object.prototype.hasOwnProperty;var ct=(e,a,t)=>()=>{if(t)throw t[0];try{return e&&(a=e(e=0)),a}catch(s){throw t=[s],s}};var dt=(e,a)=>{for(var t in a)S(e,t,{get:a[t],enumerable:!0})},pt=(e,a,t,s)=>{if(a&&typeof a=="object"||typeof a=="function")for(let i of nt(a))!ot.call(e,i)&&i!==t&&S(e,i,{get:()=>a[i],enumerable:!(s=st(a,i))||s.enumerable});return e};var ht=e=>pt(S({},"__esModule",{value:!0}),e);var H={};dt(H,{ASSET_TYPES:()=>ut,HOLDABLE_ASSET_TYPES:()=>P,MAX_ROW_WEIGHT_PCT:()=>wt,MAX_TOTAL_WEIGHT_PCT:()=>ft,holdingWeight:()=>I,isHoldable:()=>mt,otherHeldWeightPct:()=>R,weightCeiling:()=>gt});var ut,P,mt,wt,ft,I,R,gt,z=ct(()=>{"use strict";ut=["a-share","a-share-index","fund-etf","hk-stock","hk-index","us-stock","us-index"],P=["a-share","fund-etf","hk-stock","us-stock"],mt=e=>P.includes(e?.asset_type),wt=100,ft=120,I=e=>e?.holding===null||e?.holding===void 0?0:e?.holding?.weight_pct??0,R=(e,a)=>e.reduce((t,s)=>s?.thscode===a?t:t+I(s),0),gt=(e,a)=>Math.max(0,Math.min(100,120-R(e,a)))});var{createElement:l,useEffect:bt,useState:M}=require("react"),{createSnapshotStore:xt}=require("@deepseek-ai/dsh-client-store"),{IconChecklistOutlineRegular:vt,IconCloseOutlineRegular:O,IconDatabaseOutlineRegular:yt,IconEllipsisOutlineRegular:kt,IconGoalOutlineRegular:Nt,IconListPenOutlineRegular:St,IconPinOutlineRegular:_t,IconRefreshOutlineRegular:Ct,IconSearchOutlineRegular:Et,IconTrashOutlineRegular:Tt,Menu:At,MenuItemButton:$t,Modal:Pt,Switch:It}=require("@deepseek-ai/dsh-client-ui-primitives"),{isHoldable:F,weightCeiling:W}=(z(),ht(H)),f="capital-watchlist",_="capital.watchlist",L="conversation.input.overlay",j="/capital-watchlist",Rt="capital-generation",Ht=300,C=10,D="capital-watchlist-css",zt={"command.label":"\u81EA\u9009\u80A1","command.description":"\u6DFB\u52A0 / \u67E5\u770B / \u5220\u9664\u81EA\u9009\u80A1",title:"\u81EA\u9009\u80A1",close:"\u5173\u95ED",searchPlaceholder:"\u8F93\u5165\u8BC1\u5238\u4EE3\u7801\u6216\u540D\u79F0\uFF0C\u652F\u6301A\u80A1/\u6E2F\u80A1/\u7F8E\u80A1",add:"\u6DFB\u52A0",added:"\u5DF2\u6DFB\u52A0",refreshing:"\u5237\u65B0\u4E2D\u2026",refresh:"\u5237\u65B0\u62A5\u4EF7",loading:"\u6B63\u5728\u8BFB\u53D6\u6E05\u5355\u2026",empty:"\u8FD8\u6CA1\u6709\u81EA\u9009\u80A1\uFF0C\u7528\u4E0A\u9762\u7684\u8F93\u5165\u6846\u6DFB\u52A0\u3002",colName:"\u540D\u79F0",colQuote:"\u6700\u65B0\u4EF7 / \u6DA8\u8DCC\u5E45",colAction:"\u64CD\u4F5C",updated:"\u66F4\u65B0\u65F6\u95F4",notRefreshed:"\u672A\u5237\u65B0",stale:"\u4E0A\u4E00\u6B21\u5FEB\u7167",exchangeTime:"\u4EA4\u6613\u6240\u65F6\u95F4",noChangePct:"\u6682\u65E0\u6DA8\u8DCC\u6570\u636E",typeAShare:"A\u80A1",typeHkStock:"\u6E2F\u80A1",typeUsStock:"\u7F8E\u80A1",typeAIndex:"A\u6307",typeHkIndex:"\u6E2F\u6307",typeUsIndex:"\u7F8E\u6307",kindStock:"\u80A1\u7968",kindIndex:"\u6307\u6570",kindEtf:"ETF",remove:"\u79FB\u9664",more:"\u66F4\u591A",pin:"\u7F6E\u9876",holdingWeightLabel:"\u6301\u4ED3\u6BD4\u4F8B",holdingStepper:"\u6301\u4ED3\u6BD4\u4F8B\uFF08\u6BCF\u6863 10 \u4E2A\u767E\u5206\u70B9\uFF09",holdingStepUp:"\u589E\u52A0\u6301\u4ED3\u6BD4\u4F8B",holdingStepDown:"\u51CF\u5C11\u6301\u4ED3\u6BD4\u4F8B",holdingName:"\u6301\u4ED3",predict:"\u9884\u6D4B",predictTip:"AI\u9884\u6D4B",review:"\u590D\u76D8",reviewTip:"AI\u590D\u76D8",predictPromptPrefix:"\u8BF7\u9884\u6D4B ",predictPromptSuffix:"\uFF1A\u672A\u6765 5 \u4E2A\u4EA4\u6613\u65E5\u7684\u8D70\u52BF\u4E0E\u5173\u952E\u70B9\u4F4D\uFF0C\u8BF4\u660E\u4F9D\u636E\uFF0C\u5E76\u7ED9\u51FA\u5224\u65AD\u7684\u4E0D\u786E\u5B9A\u6027\u3002",reviewPromptPrefix:"\u8BF7\u590D\u76D8 ",reviewPromptSuffix:"\uFF1A\u4ECA\u65E5\u8D70\u52BF\u4E0E\u91CF\u4EF7\u3001\u8FD1 20 \u65E5\u8D8B\u52BF\u3001\u57FA\u7840\u9762\u3001\u6D88\u606F\u9762\uFF0C\u7ED9\u51FA\u7ED3\u8BBA\u548C\u5FC5\u8981\u98CE\u9669\u8BC4\u4F30\u3002",searching:"\u641C\u7D22\u4E2D\u2026",composingHint:"\u8F93\u5165\u5B8C\u6210\u540E\u81EA\u52A8\u641C\u7D22",clearInput:"\u6E05\u7A7A\u8F93\u5165",confirmTitle:"\u786E\u8BA4\u79FB\u9664\uFF1F",confirmDescPrefix:"\u786E\u5B9A\u5C06 ",confirmDescSuffix:" \u4ECE\u81EA\u9009\u4E2D\u79FB\u9664\u5417\uFF1F",confirmCancel:"\u53D6\u6D88",confirmOk:"\u786E\u8BA4\u79FB\u9664",truncated:"\u6CA1\u6709\u66F4\u591A\uFF0C\u8BF7\u8F93\u5165\u51C6\u786E\u7684\u8BC1\u5238\u4EE3\u7801\u6216\u540D\u79F0\u3002",filterAll:"\u5168\u90E8",filterLabel:"\u6309\u5E02\u573A\u7B5B\u9009\u5019\u9009",filterNoHit:"\u8FD9\u4E2A\u5E02\u573A\u4E0B\u6CA1\u6709\u5339\u914D\u7684\u6807\u7684\u3002",noHit:"\u6CA1\u6709\u5339\u914D\u7684\u6807\u7684\uFF08A\u80A1 / \u6E2F\u80A1 / \u7F8E\u80A1\uFF0C\u542B\u6307\u6570\u4E0E\u573A\u5185\u57FA\u91D1\uFF09\u3002","error.invalid_query":"\u8F93\u5165\u4E0D\u88AB\u63A5\u53D7","error.not_found":"\u6CA1\u6709\u627E\u5230\u8BE5\u6807\u7684","error.ambiguous":"\u547D\u4E2D\u591A\u6761\uFF0C\u8BF7\u4ECE\u5019\u9009\u91CC\u9009\u4E00\u6761","error.list_full":"\u81EA\u9009\u80A1\u6700\u591A {max} \u6761\uFF0C\u5148\u5220\u4E00\u6761\u518D\u52A0","error.list_full_noMax":"\u81EA\u9009\u80A1\u5DF2\u8FBE\u4E0A\u9650\uFF0C\u5148\u5220\u4E00\u6761\u518D\u52A0","error.credential_missing":"\u672A\u914D\u7F6E Fuyao \u5BC6\u94A5\uFF1A\u5728\u300C\u63D2\u4EF6\u300D\u9875\u7684 Capital \u6A21\u5F0F\u5361\u7247\u91CC\u586B API Key\uFF08\u53EA\u5F71\u54CD A \u80A1\u90A3\u4E00\u8DEF\uFF0C\u6E2F\u7F8E\u80A1\u7167\u5E38\u7528\uFF09","error.rate_limited":"\u884C\u60C5\u670D\u52A1\u9650\u6D41\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5","error.fuyao_unavailable":"A \u80A1\u884C\u60C5\u6682\u65F6\u53D6\u4E0D\u5230\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5","error.tencent_unavailable":"\u6E2F\u7F8E\u80A1\u884C\u60C5\u6682\u65F6\u53D6\u4E0D\u5230\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5","error.quote_unavailable":"\u8BE5\u6807\u7684\u6CA1\u6709\u53EF\u7528\u62A5\u4EF7","error.refresh_timeout":"\u5237\u65B0\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5","error.store_unavailable":"\u81EA\u9009\u80A1\u5B58\u50A8\u4E0D\u53EF\u7528","error.unauthorized":"\u767B\u5F55\u72B6\u6001\u5DF2\u5931\u6548\uFF1A\u8BF7\u5148\u56DE\u5230\u5BBF\u4E3B\u7A97\u53E3\u91CD\u65B0\u767B\u5F55",errorSuffix:"\uFF08\u5176\u4ED6\u6807\u7684\u4ECD\u662F\u4E0A\u4E00\u6B21\u6210\u529F\u5FEB\u7167\uFF09","partial.a-share":"A \u80A1\u68C0\u7D22\u4E0D\u53EF\u7528\uFF1A","partial.hk":"\u6E2F\u80A1\u68C0\u7D22\u4E0D\u53EF\u7528\uFF1A","partial.us":"\u7F8E\u80A1\u68C0\u7D22\u4E0D\u53EF\u7528\uFF1A"},Mt={"command.label":"Watchlist","command.description":"Add / view / remove watched symbols",title:"Watchlist",close:"Close",searchPlaceholder:"Symbol code or name \u2014 A-share / HK / US",add:"Add",added:"Added",refreshing:"Refreshing\u2026",refresh:"Refresh quotes",loading:"Loading list\u2026",empty:"No symbols yet \u2014 use the input above to add one.",colName:"Symbol",colQuote:"Last / change",colAction:"Actions",updated:"Updated",notRefreshed:"Not refreshed",stale:"last snapshot",exchangeTime:"exchange time",noChangePct:"No change data yet",typeAShare:"A-Share",typeHkStock:"HK",typeUsStock:"US",typeAIndex:"A-Index",typeHkIndex:"HK-Index",typeUsIndex:"US-Index",kindStock:"stock",kindIndex:"index",kindEtf:"ETF",remove:"Remove",more:"More",pin:"Pin to top",holdingWeightLabel:"Holding weight",holdingStepper:"Holding weight, in steps of 10 percentage points",holdingStepUp:"Increase holding weight",holdingStepDown:"Decrease holding weight",holdingName:"Holding",predict:"Predict",predictTip:"AI prediction",review:"Review",reviewTip:"AI review",predictPromptPrefix:"Predict ",predictPromptSuffix:" over the next 5 sessions: the likely path and key levels, the evidence behind the call, and how uncertain it is.",reviewPromptPrefix:"Review ",reviewPromptSuffix:" with today's trend and volume, the last 20 sessions, fundamental, news, then a conclusion and the necessary risks analysis.",searching:"Searching\u2026",composingHint:"Search runs when you finish typing",clearInput:"Clear input",confirmTitle:"Remove this symbol?",confirmDescPrefix:"Remove ",confirmDescSuffix:" from your watchlist?",confirmCancel:"Cancel",confirmOk:"Remove",truncated:"No more candidates \u2014 enter an accurate code or name.",filterAll:"All",filterLabel:"Filter candidates by market",filterNoHit:"No matching symbol in this market.",noHit:"No matching symbol (A-share / HK / US, including indices and listed funds).","error.invalid_query":"Input not accepted","error.not_found":"Symbol not found","error.ambiguous":"Multiple hits \u2014 pick one candidate","error.list_full":"Watchlist holds at most {max} symbols \u2014 remove one first","error.list_full_noMax":"Watchlist is full \u2014 remove one first","error.credential_missing":"No Fuyao API key: set it on the Capital card in the Plugins page (A-share quotes only \u2014 HK and US keep working)","error.rate_limited":"Quote service is rate limited \u2014 try again later","error.fuyao_unavailable":"A-share quotes unavailable \u2014 try again later","error.tencent_unavailable":"HK / US quotes unavailable \u2014 try again later","error.quote_unavailable":"No quote for this symbol","error.refresh_timeout":"Refresh timed out \u2014 try again later","error.store_unavailable":"Watchlist storage unavailable","error.unauthorized":"Session expired \u2014 sign back in to the host first",errorSuffix:" (other symbols still show their last good snapshot)","partial.a-share":"A-share search unavailable: ","partial.hk":"HK search unavailable: ","partial.us":"US search unavailable: "},Ot={"a-share":"typeAShare","hk-stock":"typeHkStock","us-stock":"typeUsStock","a-share-index":"typeAIndex","hk-index":"typeHkIndex","us-index":"typeUsIndex","fund-etf":"typeAShare"},Ft={"a-share":"kindStock","hk-stock":"kindStock","us-stock":"kindStock","a-share-index":"kindIndex","hk-index":"kindIndex","us-index":"kindIndex","fund-etf":"kindEtf"};function Lt(e,a){let t=Ot[e];return t===void 0?String(e??""):a(t)}function jt(e,a){let t=Ft[e];return t===void 0?String(e??""):a(t)}var Dt=/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F\u00AD\u200B-\u200F\u2028\u2029\u202A-\u202E\u2060-\u2064\u2066-\u2069\uFEFF]/gu;function T(e){return String(e??"").replace(Dt,"")}function v(e){return Array.isArray(e)?e.map(a=>a===null||typeof a!="object"?a:{...a,name:T(a.name)}):e}var Ut={"a-share":"capital-watchlist-tag-cn","a-share-index":"capital-watchlist-tag-cn","fund-etf":"capital-watchlist-tag-cn","hk-stock":"capital-watchlist-tag-hk","hk-index":"capital-watchlist-tag-hk","us-stock":"capital-watchlist-tag-us","us-index":"capital-watchlist-tag-us"},B=[{id:"all"},{id:"cn",label:"CN"},{id:"hk",label:"HK"},{id:"us",label:"US"}],U=e=>e.exchange==="HK"?"hk":e.exchange==="US"?"us":"cn",qt=`
|
|
9
9
|
/* \u5BBD 420 / \u5706\u89D2 18 / \u65E0\u5185\u8FB9\u8DDD\uFF08\u5185\u8FB9\u8DDD\u4F4F\u5728\u5404\u6BB5\u81EA\u5DF1\u5934\u4E0A\uFF0C\u597D\u8BA9\u8868\u5934\u4E0E\u5206\u9694\u7EBF\u5BF9\u9F50\uFF09\u3002
|
|
10
10
|
\u9650\u9AD8\u6309\u5B98\u65B9\u53E3\u5F84\u8D70 max-height: 100%\uFF08\u5BF9 .root \u7684 padding box\uFF09\uFF0C\u4E0D\u81EA\u5DF1\u7B97 vh\u3002 */
|
|
11
11
|
.capital-watchlist-dialog.capital-watchlist-dialog { width: min(420px, 92vw); max-height: 100%; padding: 0; gap: 0; border-radius: 18px; }
|
|
@@ -259,8 +259,8 @@ window.__ModuleLoader__.load({
|
|
|
259
259
|
\u6BD4\u5217\u8868\u5185\u5BB9\u76D2\u5BBD 16px\u2014\u2014\u90A3 16px \u5C31\u662F\u4E0A\u9762\u90A3\u6761\u6A2A\u5411\u6EDA\u52A8\u6761\u7684\u53E6\u4E00\u534A\u3002
|
|
260
260
|
\u9009\u62E9\u5668\u6839\u5728\u6211\u4EEC\u81EA\u5DF1\u6302\u5728 portal \u5217\u8868\u4E0A\u7684\u7C7B\uFF0C\u6240\u4EE5\u591F\u5F97\u7740\uFF08\u540E\u4EE3\u94FE\u6CA1\u6709\u79BB\u5F00\u8FD9\u5F20\u5217\u8868\uFF09\u3002 */
|
|
261
261
|
.capital-watchlist-rows button { box-sizing: border-box; }
|
|
262
|
-
`;function Qt(){let e=globalThis.document;if(!e||typeof e.createElement!="function"||e.querySelector(`style[data-${D}]`))return;let a=e.createElement("style");a.setAttribute(`data-${D}`,""),a.textContent=qt;let t=e.head??e.body;if(!(t===void 0||typeof t.appendChild!="function"))return t.appendChild(a),()=>a.remove()}async function w(e,{query:a,body:t,signal:s}={}){let i=a!==void 0?`${j}${e}?${a}`:`${j}${e}`,d=t===void 0?{method:"GET",cache:"no-store",credentials:"same-origin",signal:s}:{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t),credentials:"same-origin",signal:s},n=await fetch(i,d),c=await n.text(),o={};try{o=c.length>0?JSON.parse(c):{}}catch{o={}}if(n.ok===!0&&o.ok===!0)return o;let p=typeof o.code=="string"&&o.code.length>0?o.code:n.status===401||n.status===403?"unauthorized":"fuyao_unavailable",h=new Error(p);throw h.code=p,h.candidates=o.candidates,h.limit=o.limit,h}var q=()=>({open:!1,loading:!1,refreshing:!1,searching:!1,items:[],candidates:[],truncated:!1,marketFilter:"all",query:"",dropdownOpen:!1,rowMenu:null,pendingRemove:null,refreshed_at:null,error:null,searchError:null,searchPartial:null,addError:null,loadError:null,failures:{},composing:!1,pendingSearch:!1}),E=class{constructor(){this.store=xt(q()),this.searchController=null,this.timer=null,this.pending=null,this.lastQuery=null,this.holdingOps=new Map}get state(){return this.store}get snapshot(){return this.store.getSnapshot()}patch(a){this.store.update(t=>Object.assign(t,a))}open(){this.patch({...q(),open:!0,loading:!0}),this.load().then(()=>this.refresh(),()=>this.patch({loading:!1}))}close(){this.timer!==null&&clearTimeout(this.timer),this.searchController!==null&&this.searchController.abort(),this.lastQuery=null,this.patch({open:!1,rowMenu:null,composing:!1,pendingSearch:!1}),this.holdingOps.clear()}async load(){try{let a=await w("/list");this.holdingOps.clear(),this.patch({items:
|
|
263
|
-
`);return await navigator.clipboard.writeText(a),a}dispose(){this.timer!==null&&clearTimeout(this.timer),this.searchController!==null&&this.searchController.abort()}};function K(e){if(typeof e!="number"||!Number.isFinite(e))return"";let a=new Date(e),t=s=>String(s).padStart(2,"0");return`${t(a.getMonth()+1)}-${t(a.getDate())} ${t(a.getHours())}:${t(a.getMinutes())}`}function Q({assetType:e,t:a}){return l("span",{className:`capital-watchlist-tag ${Ut[e]??"capital-watchlist-tag-cn"}`},Lt(e,a))}function Wt(e,a,t){let s=T(e.name);return`${a(`${t}PromptPrefix`)}${s} (${e.thscode} \xB7 ${jt(e.asset_type,a)})${a(`${t}PromptSuffix`)}`}function Bt({quote:e,failureCode:a,refreshing:t,t:s}){let i=a!==void 0;if(e==null)return t===!0?l("div",{className:"capital-watchlist-quote"},l("span",{className:"capital-watchlist-skeleton capital-watchlist-skeleton-price"}),l("span",{className:"capital-watchlist-skeleton capital-watchlist-skeleton-change"})):i?l("div",{className:"capital-watchlist-quote",title:s(`error.${a}`)},l("div",{className:"capital-watchlist-price capital-watchlist-quotefailed"},"\u2014")):l("div",{className:"capital-watchlist-quote"},l("div",{className:"capital-watchlist-price"},s("notRefreshed")));let d=typeof e.change_pct=="number"&&Number.isFinite(e.change_pct),n=d?`${e.change_pct>0?"+":""}${e.change_pct.toFixed(2)}%`:"\u2014",c=i?"capital-watchlist-stale":d?e.change_pct>0?"capital-watchlist-up":e.change_pct<0?"capital-watchlist-down":"capital-watchlist-flat":"capital-watchlist-nodata",o=typeof e.source_time=="string"&&e.source_time.length>0?`${s("exchangeTime")} ${e.source_time}`:"",p=[];return i?p.push(`${s(`error.${a}`)} \xB7 ${s("stale")} ${K(e.captured_at)}`):d||p.push(s("noChangePct")),o.length>0&&p.push(o),l("div",{className:"capital-watchlist-quote",title:p.length===0?void 0:p.join(" \xB7 ")},l("div",{className:i?"capital-watchlist-price capital-watchlist-stale":"capital-watchlist-price"},e.price.toFixed(2)),l("div",{className:`capital-watchlist-change ${c}`},n))}function Kt(e,a){if(a.code!=="list_full")return e(`error.${a.code}`);let t=a.limit;return typeof t!="number"||!Number.isFinite(t)?e("error.list_full_noMax"):e("error.list_full").replace("{max}",String(t))}function Yt(e,a){let t=e?.weight_pct;return t==null?a("holdingName"):`${a("holdingName")} ${t}%`}function Gt(e,a){let t=`${e.name} ${e.ticker}`;return e.holding===null||e.holding===void 0?t:`${t} \xB7 ${Yt(e.holding,a)}`}function Xt({useDialog:e,surface:a,t,inputActions:s}){let i=e(r=>r),[d,n]=M(!1),[c,o]=M(null),p=i.pendingRemove??null;if(bt(()=>()=>a.dispose(),[a]),!i.open)return null;let h=i.dropdownOpen===!0,g=p!==null,Y=r=>{if(r.key==="Escape"){if(g){r.stopPropagation(),a.setPendingRemove(null);return}h&&(r.stopPropagation(),a.hideDropdown())}},G=r=>{if(!h)return;let m=r.relatedTarget;m!=null&&r.currentTarget?.contains?.(m)===!0||a.hideDropdown()},b=i.error,X=b==null?null:l("p",{className:"capital-watchlist-notice",role:"alert","data-code":b.code},`${t(`error.${b.code}`)}${b.partial===!0?t("errorSuffix"):""}`),A=(r,m)=>{s.insertText(Wt(r,t,m),s.captureInsertion())===!0&&a.close()},v=i.marketFilter==="all"?i.candidates:i.candidates.filter(r=>U(r)===i.marketFilter),$={all:i.candidates.length,cn:0,hk:0,us:0};for(let r of i.candidates)$[U(r)]+=1;let J=i.candidates.length===0?null:l("div",{className:"capital-watchlist-filter",role:"group","aria-label":t("filterLabel")},B.map(r=>l("button",{key:r.id,type:"button",className:"capital-watchlist-filterbtn","aria-pressed":i.marketFilter===r.id,onClick:()=>a.setMarketFilter(r.id)},l("span",{className:"capital-watchlist-filterlabel"},r.id==="all"?t("filterAll"):r.label),l("span",{className:"capital-watchlist-filtercount"},String($[r.id]))))),V=h?l("div",{className:"capital-watchlist-dropdown","aria-label":t("title"),"data-menu-material":"translucent"},J,l("div",{className:"capital-watchlist-options",role:"listbox","aria-label":t("title")},v.map(r=>l("button",{key:r.thscode,type:"button",role:"option",className:"capital-watchlist-option",title:r.name,"aria-disabled":r.in_list===!0||c===r.thscode,onClick:()=>{r.in_list===!0||c===r.thscode||(n(!0),o(r.thscode),a.add(r).finally(()=>{n(!1),o(null)}))}},l("span",{className:"capital-watchlist-optionmain"},l("span",{className:"capital-watchlist-optionname"},r.name),l("span",{className:"capital-watchlist-codeline"},l("span",{className:"capital-watchlist-optioncode"},r.thscode),l(Q,{assetType:r.asset_type,t}))),l("span",{className:"capital-watchlist-addbtn","data-state":r.in_list===!0?"added":"idle"},r.in_list===!0?t("added"):t("add")))),i.truncated===!0&&v.length>0?l("div",{className:"capital-watchlist-hint capital-watchlist-endhint"},t("truncated")):null),i.composing===!0?l("div",{className:"capital-watchlist-hint"},t("composingHint")):i.searching===!0||i.pendingSearch===!0?l("div",{className:"capital-watchlist-hint"},t("searching")):i.searchError!==null&&i.searchError!==void 0?l("div",{className:"capital-watchlist-hint capital-watchlist-searcherror",role:"alert","data-code":i.searchError.code},t(`error.${i.searchError.code}`)):i.candidates.length===0?l("div",{className:"capital-watchlist-hint"},t("noHit")):v.length===0?l("div",{className:"capital-watchlist-hint","data-filter":i.marketFilter},t("filterNoHit")):null,...(i.searchPartial??[]).map(r=>l("div",{key:`partial-${r.market}`,className:"capital-watchlist-hint capital-watchlist-searcherror",role:"status","data-market":r.market,"data-code":r.code},`${t(`partial.${r.market}`)}${t(`error.${r.code}`)}`))):null,Z=i.items.length===0?null:l("div",{className:"capital-watchlist-grid capital-watchlist-head"},l("span",null,t("colName")),l("span",{className:"capital-watchlist-quote"},t("colQuote")),l("span",{className:"capital-watchlist-headaction"},t("colAction"))),tt=i.loadError!==null&&i.loadError!==void 0?l("p",{className:"capital-watchlist-empty capital-watchlist-loaderror",role:"alert","data-code":i.loadError.code},t(`error.${i.loadError.code}`)):l("p",{className:"capital-watchlist-empty"},t("empty")),at=i.loading?l("p",{className:"capital-watchlist-empty"},t("loading")):i.items.length===0?tt:l("div",{className:h?"capital-watchlist-list capital-watchlist-list-open":"capital-watchlist-list"},i.items.map((r,m)=>{let x=r.holding!==null&&r.holding!==void 0,u=r.holding?.weight_pct,it=F(r)||x,k=W(i.items,r.thscode),lt=!x||u===null||u===void 0||u<=0,rt=(typeof u=="number"?u:0)+C>k;return l("div",{key:r.thscode,className:"capital-watchlist-grid capital-watchlist-row","data-thscode":r.thscode},l("span",{className:"capital-watchlist-namewrap"},l("span",{className:x?"capital-watchlist-name capital-watchlist-name-held":"capital-watchlist-name",title:Gt(r,t)},r.name),l("span",{className:"capital-watchlist-codeline"},l("span",{className:"capital-watchlist-code"},r.ticker),l(Q,{assetType:r.asset_type,t}))),l(Bt,{quote:r.quote,failureCode:i.failures[r.thscode],refreshing:i.refreshing,t}),l("span",{className:"capital-watchlist-rowactions"},l("button",{type:"button",className:"capital-watchlist-predict",disabled:d,title:t("predictTip"),"aria-label":`${t("predict")} ${r.name}`,onClick:()=>A(r,"predict")},l(Nt,{size:14})),l("button",{type:"button",className:"capital-watchlist-review",disabled:d,title:t("reviewTip"),"aria-label":`${t("review")} ${r.name}`,onClick:()=>A(r,"review")},l(St,{size:14})),l(At,{open:i.rowMenu===r.thscode,anchor:l("button",{type:"button",className:"capital-watchlist-more",disabled:d,title:t("more"),"aria-label":`${t("more")} ${r.name}`,"aria-haspopup":"menu","aria-expanded":i.rowMenu===r.thscode,onClick:()=>a.toggleRowMenu(r.thscode)},l(kt,{size:14})),items:[{id:"pin",label:t("pin"),icon:l(_t,{size:14}),disabled:m===0}],children:[...it?[l("div",{key:"holding-check",role:"group","aria-label":t("holdingName"),className:"capital-watchlist-checkrow"},l("span",{className:"capital-watchlist-checkicon","aria-hidden":"true"},l(vt,{size:14})),l("span",{className:"capital-watchlist-checklabel"},t("holdingName")),l(It,{checked:x,disabled:d,label:t("holdingName"),onChange:N=>N?a.markHolding(r.thscode,null):a.clearHolding(r.thscode)}))]:[],...x&&F(r)?[l("div",{key:"holding-step",className:"capital-watchlist-stepper",role:"group","aria-label":t("holdingStepper")},l("span",{className:"capital-watchlist-stepperlabel"},t("holdingWeightLabel")),l("span",{className:"capital-watchlist-stepperline"},l("button",{type:"button",className:"capital-watchlist-stepperbtn","aria-label":t("holdingStepDown"),disabled:lt,onClick:()=>a.stepHolding(r.thscode,-C)},"\u2212"),l("span",{className:typeof u=="number"?"capital-watchlist-stepperreadout":"capital-watchlist-stepperreadout capital-watchlist-stepperplaceholder",role:"status"},typeof u=="number"?`${u}%`:`0~${k}`),l("button",{type:"button",className:"capital-watchlist-stepperbtn","aria-label":t("holdingStepUp"),title:`0~${k}`,disabled:rt,onClick:()=>a.stepHolding(r.thscode,C)},"+")))]:[],l($t,{key:"remove",danger:!0,separatorBefore:!0,icon:l(Tt,{size:14}),onSelect:()=>{a.closeRowMenu(),a.setPendingRemove(r)}},t("remove"))],onSelect:N=>{N==="pin"&&(a.closeRowMenu(),a.pin(r.thscode))},onClose:()=>a.closeRowMenu(),align:"end",portal:!0,listClassName:"capital-watchlist-rows",className:"capital-watchlist-actions"})))})),et=l("div",{className:g?"capital-watchlist-confirm capital-watchlist-confirm-open":"capital-watchlist-confirm","aria-hidden":g?void 0:"true"},l("div",{className:"capital-watchlist-confirmbox",role:g?"alertdialog":void 0,"aria-label":t("confirmTitle")},l("div",{className:"capital-watchlist-confirmtitle"},t("confirmTitle")),g?l("p",{className:"capital-watchlist-confirmdesc"},t("confirmDescPrefix"),l("strong",null,`${p.name} \xB7 ${p.ticker}`),t("confirmDescSuffix")):null,l("div",{className:"capital-watchlist-confirmactions"},l("button",{type:"button",className:"capital-watchlist-confirmbtn",onClick:()=>a.setPendingRemove(null)},t("confirmCancel")),l("button",{type:"button",className:"capital-watchlist-confirmbtn capital-watchlist-confirmdanger",onClick:()=>{let r=p;a.setPendingRemove(null),r!==null&&a.remove(r.thscode)}},t("confirmOk")))));return l(Pt,{open:!0,onClose:()=>a.close(),title:t("title"),headless:!0,shortcutModal:"watchlist",className:"capital-watchlist-dialog"},l("div",{className:"capital-watchlist-card",onKeyDown:Y},l("div",{className:"capital-watchlist-header"},l("h2",{className:"capital-watchlist-title"},t("title")),l("button",{type:"button",className:"capital-watchlist-close","aria-label":t("close"),onClick:()=>a.close()},l(O,{size:14}))),l("div",{className:"capital-watchlist-search",onBlur:G},l("div",{className:"capital-watchlist-field"},l("span",{className:"capital-watchlist-searchicon"},l(Et,{size:16})),l("input",{className:"capital-watchlist-input","data-modal-autofocus":!0,value:i.query,placeholder:t("searchPlaceholder"),onChange:r=>a.onQueryChange(r.target.value,r.isComposing),onCompositionStart:()=>a.beginComposition(),onCompositionEnd:r=>a.endComposition(r.target.value)}),i.query.length>0?l("button",{type:"button",className:"capital-watchlist-clear",title:t("clearInput"),"aria-label":t("clearInput"),onMouseDown:r=>r.preventDefault(),onClick:()=>a.onQueryChange("",!1)},l(O,{size:12})):null),V),i.addError!==null&&i.addError!==void 0?l("p",{className:"capital-watchlist-adderror",role:"status","data-code":i.addError.code},Kt(t,i.addError)):null,Z,at,l("div",{className:"capital-watchlist-footer"},l("div",{className:"capital-watchlist-footcol"},l("button",{type:"button",className:"capital-watchlist-refresh",disabled:i.refreshing||d,onClick:()=>{a.refresh()}},l(Ct,{size:14}),i.refreshing?t("refreshing"):t("refresh")),X),l("span",{className:"capital-watchlist-updated"},`${t("updated")} ${i.refreshed_at===null||i.refreshed_at===void 0?t("notRefreshed"):K(i.refreshed_at)}`)),et))}function Jt(e){e.effect(Qt,`${f}: styles`),e.effect(()=>e.locale.register(_,{zh:zt,en:Mt}),`${f}: dictionaries`);let a=new Map,t=n=>{let c=a.get(n);return c===void 0&&(c=new E,a.set(n,c)),c};e.effect(()=>()=>{for(let n of a.values())n.dispose();a.clear()},`${f}: per-session surfaces`);let s=n=>{let o=e.sessions?.list?.getSnapshot?.().byId?.[n]?.projectionValues?.agentPreset;return typeof o=="string"?o:void 0},i=new Set,d=n=>{let c=s(n);return c!==void 0?c===Rt:(i.has(n)||(i.add(n),Promise.resolve(e.sessions?.refreshProjections?.(n)).catch(()=>{})),!1)};e.slots.inject(L,()=>e.slots.register({name:L,id:"capital-watchlist-dialog",order:3,locale:_,inject:n=>{let c=t(n);return{hooks:{dialog:c.state},surface:c}}},Xt)),e.inject(["commandUi"],n=>{let c=e.locale.bind(_);n.effect(()=>n.commandUi.register({name:"watchlist",label:()=>c("command.label"),description:()=>c("command.description"),icon:yt,available:o=>d(o.sessionId),ui:{kind:"action",run:o=>{t(o.sessionId).open()}}}),`${f}: /watchlist contribution`)}),e.logger?.info?.(`${f}: \u5BA2\u6237\u7AEF\u534A\u8FB9\u5DF2\u6302\u8F7D\uFF08/watchlist \u83DC\u5355\u884C + \u81EA\u9009\u80A1\u5F39\u7A97\uFF09`)}exports.name=f;exports.inject=["slots","locale","commandUi","sessions"];exports.apply=Jt;
|
|
262
|
+
`;function Qt(){let e=globalThis.document;if(!e||typeof e.createElement!="function"||e.querySelector(`style[data-${D}]`))return;let a=e.createElement("style");a.setAttribute(`data-${D}`,""),a.textContent=qt;let t=e.head??e.body;if(!(t===void 0||typeof t.appendChild!="function"))return t.appendChild(a),()=>a.remove()}async function w(e,{query:a,body:t,signal:s}={}){let i=a!==void 0?`${j}${e}?${a}`:`${j}${e}`,d=t===void 0?{method:"GET",cache:"no-store",credentials:"same-origin",signal:s}:{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t),credentials:"same-origin",signal:s},n=await fetch(i,d),c=await n.text(),o={};try{o=c.length>0?JSON.parse(c):{}}catch{o={}}if(n.ok===!0&&o.ok===!0)return o;let p=typeof o.code=="string"&&o.code.length>0?o.code:n.status===401||n.status===403?"unauthorized":"fuyao_unavailable",h=new Error(p);throw h.code=p,h.candidates=o.candidates,h.limit=o.limit,h}var q=()=>({open:!1,loading:!1,refreshing:!1,searching:!1,items:[],candidates:[],truncated:!1,marketFilter:"all",query:"",dropdownOpen:!1,rowMenu:null,pendingRemove:null,refreshed_at:null,error:null,searchError:null,searchPartial:null,addError:null,loadError:null,failures:{},composing:!1,pendingSearch:!1}),E=class{constructor(){this.store=xt(q()),this.searchController=null,this.timer=null,this.pending=null,this.lastQuery=null,this.holdingOps=new Map}get state(){return this.store}get snapshot(){return this.store.getSnapshot()}patch(a){this.store.update(t=>Object.assign(t,a))}open(){this.patch({...q(),open:!0,loading:!0}),this.load().then(()=>this.refresh(),()=>this.patch({loading:!1}))}close(){this.timer!==null&&clearTimeout(this.timer),this.searchController!==null&&this.searchController.abort(),this.lastQuery=null,this.patch({open:!1,rowMenu:null,composing:!1,pendingSearch:!1}),this.holdingOps.clear()}async load(){try{let a=await w("/list");this.holdingOps.clear(),this.patch({items:v(a.items)??[],seeded_at:a.seeded_at,loading:!1,loadError:null})}catch(a){throw this.patch({loading:!1,loadError:{code:a.code??"fuyao_unavailable"}}),a}}refresh(){if(this.pending!==null)return this.pending;this.patch({refreshing:!0});let a=w("/refresh",{body:{}}).then(t=>{let s={};for(let n of t.failures??[])s[n.thscode]=n.code;let i=v(t.items),d=i??this.snapshot.items;i!==null&&this.holdingOps.clear(),this.patch({items:d,refreshed_at:t.refreshed_at??this.snapshot.refreshed_at,failures:s,error:t.error?{code:t.error.code,partial:d.length>0&&d.some(n=>s[n.thscode]===void 0)}:null})}).catch(t=>{this.patch({error:{code:t.code??"fuyao_unavailable",partial:this.snapshot.items.some(s=>s.quote!==null)}})}).finally(()=>{this.patch({refreshing:!1}),this.pending=null});return this.pending=a,a}onQueryChange(a,t){let s=a.trim(),i=t===void 0?this.snapshot.composing===!0:t===!0;if(this.patch({query:a,searchError:null,composing:i,dropdownOpen:s.length>0}),this.timer!==null&&clearTimeout(this.timer),s.length===0){this.searchController!==null&&this.searchController.abort(),this.lastQuery=null,this.patch({candidates:[],truncated:!1,searching:!1,pendingSearch:!1});return}s===this.lastQuery&&this.snapshot.pendingSearch===!1||(this.patch({candidates:[],truncated:!1,pendingSearch:!i}),i!==!0&&(this.timer=setTimeout(()=>this.search(s),Ht)))}beginComposition(){this.timer!==null&&clearTimeout(this.timer),this.patch({composing:!0})}endComposition(a){this.onQueryChange(a,!1)}hideDropdown(){this.patch({dropdownOpen:!1})}setMarketFilter(a){B.some(t=>t.id===a)&&this.patch({marketFilter:a})}toggleRowMenu(a){this.patch({rowMenu:this.snapshot.rowMenu===a?null:a})}closeRowMenu(){this.snapshot.rowMenu!==null&&this.patch({rowMenu:null})}setPendingRemove(a){this.patch({pendingRemove:a??null})}replaceRow(a){let[t]=v([a]);t===void 0||typeof t?.thscode!="string"||this.patch({items:this.snapshot.items.map(s=>s.thscode===t.thscode?t:s)})}async search(a){this.lastQuery=a,this.searchController!==null&&this.searchController.abort();let t=new AbortController;this.searchController=t,this.patch({searching:!0,searchError:null,searchPartial:null});let s=()=>this.snapshot.query.trim()===a;try{let i=await w("/search",{query:`q=${encodeURIComponent(a)}`,signal:t.signal});if(!s()){this.patch({searching:!1});return}this.patch({candidates:v(i.items)??[],truncated:i.truncated===!0,searching:!1,pendingSearch:!1,searchPartial:Array.isArray(i.partial)&&i.partial.length>0?i.partial:null})}catch(i){if(i.name==="AbortError"||(this.lastQuery===a&&(this.lastQuery=null),!s()))return;this.patch({candidates:[],truncated:!1,searching:!1,pendingSearch:!1,searchError:{code:i.code??"fuyao_unavailable"},searchPartial:null})}}async add(a){try{await w("/add",{body:{thscode:a.thscode}})}catch(s){this.patch({addError:{code:s.code??"fuyao_unavailable",candidates:s.candidates,limit:s.limit}}),s.candidates!==void 0&&this.patch({candidates:s.candidates,truncated:!1});return}this.patch({addError:null,candidates:this.snapshot.candidates.map(s=>s.thscode===a.thscode?{...s,in_list:!0}:s)}),await this.load().catch(()=>{}),await this.refresh();let t=this.snapshot.items.find(s=>s.thscode===a.thscode);t!==void 0&&t.quote===null&&this.snapshot.failures[a.thscode]===void 0&&await this.refresh()}async remove(a){let t=this.snapshot.items;this.patch({items:t.filter(s=>s.thscode!==a),rowMenu:null});try{await w("/remove",{body:{thscode:a}}),this.snapshot.addError?.code==="list_full"&&this.patch({addError:null})}catch{this.patch({items:t})}}async pin(a){let t=this.snapshot.items,s=t.find(i=>i.thscode===a);if(s!==void 0){this.patch({items:[s,...t.filter(i=>i.thscode!==a)],rowMenu:null});try{let i=await w("/pin",{body:{thscode:a}});Array.isArray(i.items)&&this.patch({items:v(i.items)})}catch{let i=this.snapshot.items,d=t.map(c=>i.find(o=>o.thscode===c.thscode)).filter(Boolean),n=new Set(d.map(c=>c.thscode));this.patch({items:[...d,...i.filter(c=>!n.has(c.thscode))]})}}}async writeHolding(a,t,s){let i=this.snapshot.items.find(o=>o.thscode===a);if(i===void 0)return;let d=this.holdingOps.get(a)??{seq:0,baseline:i};this.holdingOps.set(a,d);let n=++d.seq;this.patch({items:this.snapshot.items.map(o=>o.thscode===a?s(o):o)});let c=()=>this.holdingOps.get(a)!==d||d.seq!==n;try{let o=await w("/holding",{body:t});if(c())return;this.replaceRow(o.item),d.baseline=o.item??s(i),this.holdingOps.delete(a)}catch{if(c())return;this.replaceRow(d.baseline),this.holdingOps.delete(a)}}markHolding(a,t){return this.writeHolding(a,{thscode:a,weight_pct:t},s=>({...s,holding:{weight_pct:t,marked_at:Date.now()}}))}clearHolding(a){return this.writeHolding(a,{thscode:a,clear:!0},t=>{let s={...t};return delete s.holding,s})}stepHolding(a,t){let s=this.snapshot.items,i=s.find(n=>n.thscode===a)?.holding?.weight_pct;if(typeof i!="number"&&t<0)return;let d=Math.min(W(s,a),Math.max(0,(typeof i=="number"?i:0)+t));if(d!==i)return this.markHolding(a,d)}async copyToClipboard(){let a=this.snapshot.items.map(t=>[t.thscode,T(t.name),t.asset_type,t.quote?.price??"",t.quote?.change_pct??"",t.quote?.captured_at??""].join(" ")).join(`
|
|
263
|
+
`);return await navigator.clipboard.writeText(a),a}dispose(){this.timer!==null&&clearTimeout(this.timer),this.searchController!==null&&this.searchController.abort()}};function K(e){if(typeof e!="number"||!Number.isFinite(e))return"";let a=new Date(e),t=s=>String(s).padStart(2,"0");return`${t(a.getMonth()+1)}-${t(a.getDate())} ${t(a.getHours())}:${t(a.getMinutes())}`}function Q({assetType:e,t:a}){return l("span",{className:`capital-watchlist-tag ${Ut[e]??"capital-watchlist-tag-cn"}`},Lt(e,a))}function Wt(e,a,t){let s=T(e.name);return`${a(`${t}PromptPrefix`)}${s} (${e.thscode} \xB7 ${jt(e.asset_type,a)})${a(`${t}PromptSuffix`)}`}function Bt({quote:e,failureCode:a,refreshing:t,t:s}){let i=a!==void 0;if(e==null)return t===!0?l("div",{className:"capital-watchlist-quote"},l("span",{className:"capital-watchlist-skeleton capital-watchlist-skeleton-price"}),l("span",{className:"capital-watchlist-skeleton capital-watchlist-skeleton-change"})):i?l("div",{className:"capital-watchlist-quote",title:s(`error.${a}`)},l("div",{className:"capital-watchlist-price capital-watchlist-quotefailed"},"\u2014")):l("div",{className:"capital-watchlist-quote"},l("div",{className:"capital-watchlist-price"},s("notRefreshed")));let d=typeof e.change_pct=="number"&&Number.isFinite(e.change_pct),n=d?`${e.change_pct>0?"+":""}${e.change_pct.toFixed(2)}%`:"\u2014",c=i?"capital-watchlist-stale":d?e.change_pct>0?"capital-watchlist-up":e.change_pct<0?"capital-watchlist-down":"capital-watchlist-flat":"capital-watchlist-nodata",o=typeof e.source_time=="string"&&e.source_time.length>0?`${s("exchangeTime")} ${e.source_time}`:"",p=[];return i?p.push(`${s(`error.${a}`)} \xB7 ${s("stale")} ${K(e.captured_at)}`):d||p.push(s("noChangePct")),o.length>0&&p.push(o),l("div",{className:"capital-watchlist-quote",title:p.length===0?void 0:p.join(" \xB7 ")},l("div",{className:i?"capital-watchlist-price capital-watchlist-stale":"capital-watchlist-price"},e.price.toFixed(2)),l("div",{className:`capital-watchlist-change ${c}`},n))}function Kt(e,a){if(a.code!=="list_full")return e(`error.${a.code}`);let t=a.limit;return typeof t!="number"||!Number.isFinite(t)?e("error.list_full_noMax"):e("error.list_full").replace("{max}",String(t))}function Yt(e,a){let t=e?.weight_pct;return t==null?a("holdingName"):`${a("holdingName")} ${t}%`}function Gt(e,a){let t=`${e.name} ${e.ticker}`;return e.holding===null||e.holding===void 0?t:`${t} \xB7 ${Yt(e.holding,a)}`}function Xt({useDialog:e,surface:a,t,inputActions:s}){let i=e(r=>r),[d,n]=M(!1),[c,o]=M(null),p=i.pendingRemove??null;if(bt(()=>()=>a.dispose(),[a]),!i.open)return null;let h=i.dropdownOpen===!0,g=p!==null,Y=r=>{if(r.key==="Escape"){if(g){r.stopPropagation(),a.setPendingRemove(null);return}h&&(r.stopPropagation(),a.hideDropdown())}},G=r=>{if(!h)return;let m=r.relatedTarget;m!=null&&r.currentTarget?.contains?.(m)===!0||a.hideDropdown()},b=i.error,X=b==null?null:l("p",{className:"capital-watchlist-notice",role:"alert","data-code":b.code},`${t(`error.${b.code}`)}${b.partial===!0?t("errorSuffix"):""}`),A=(r,m)=>{s.insertText(Wt(r,t,m),s.captureInsertion())===!0&&a.close()},y=i.marketFilter==="all"?i.candidates:i.candidates.filter(r=>U(r)===i.marketFilter),$={all:i.candidates.length,cn:0,hk:0,us:0};for(let r of i.candidates)$[U(r)]+=1;let J=i.candidates.length===0?null:l("div",{className:"capital-watchlist-filter",role:"group","aria-label":t("filterLabel")},B.map(r=>l("button",{key:r.id,type:"button",className:"capital-watchlist-filterbtn","aria-pressed":i.marketFilter===r.id,onClick:()=>a.setMarketFilter(r.id)},l("span",{className:"capital-watchlist-filterlabel"},r.id==="all"?t("filterAll"):r.label),l("span",{className:"capital-watchlist-filtercount"},String($[r.id]))))),V=h?l("div",{className:"capital-watchlist-dropdown","aria-label":t("title"),"data-menu-material":"translucent"},J,l("div",{className:"capital-watchlist-options",role:"listbox","aria-label":t("title")},y.map(r=>l("button",{key:r.thscode,type:"button",role:"option",className:"capital-watchlist-option",title:r.name,"aria-disabled":r.in_list===!0||c===r.thscode,onClick:()=>{r.in_list===!0||c===r.thscode||(n(!0),o(r.thscode),a.add(r).finally(()=>{n(!1),o(null)}))}},l("span",{className:"capital-watchlist-optionmain"},l("span",{className:"capital-watchlist-optionname"},r.name),l("span",{className:"capital-watchlist-codeline"},l("span",{className:"capital-watchlist-optioncode"},r.thscode),l(Q,{assetType:r.asset_type,t}))),l("span",{className:"capital-watchlist-addbtn","data-state":r.in_list===!0?"added":"idle"},r.in_list===!0?t("added"):t("add")))),i.truncated===!0&&y.length>0?l("div",{className:"capital-watchlist-hint capital-watchlist-endhint"},t("truncated")):null),i.composing===!0?l("div",{className:"capital-watchlist-hint"},t("composingHint")):i.searching===!0||i.pendingSearch===!0?l("div",{className:"capital-watchlist-hint"},t("searching")):i.searchError!==null&&i.searchError!==void 0?l("div",{className:"capital-watchlist-hint capital-watchlist-searcherror",role:"alert","data-code":i.searchError.code},t(`error.${i.searchError.code}`)):i.candidates.length===0?l("div",{className:"capital-watchlist-hint"},t("noHit")):y.length===0?l("div",{className:"capital-watchlist-hint","data-filter":i.marketFilter},t("filterNoHit")):null,...(i.searchPartial??[]).map(r=>l("div",{key:`partial-${r.market}`,className:"capital-watchlist-hint capital-watchlist-searcherror",role:"status","data-market":r.market,"data-code":r.code},`${t(`partial.${r.market}`)}${t(`error.${r.code}`)}`))):null,Z=i.items.length===0?null:l("div",{className:"capital-watchlist-grid capital-watchlist-head"},l("span",null,t("colName")),l("span",{className:"capital-watchlist-quote"},t("colQuote")),l("span",{className:"capital-watchlist-headaction"},t("colAction"))),tt=i.loadError!==null&&i.loadError!==void 0?l("p",{className:"capital-watchlist-empty capital-watchlist-loaderror",role:"alert","data-code":i.loadError.code},t(`error.${i.loadError.code}`)):l("p",{className:"capital-watchlist-empty"},t("empty")),at=i.loading?l("p",{className:"capital-watchlist-empty"},t("loading")):i.items.length===0?tt:l("div",{className:h?"capital-watchlist-list capital-watchlist-list-open":"capital-watchlist-list"},i.items.map((r,m)=>{let x=r.holding!==null&&r.holding!==void 0,u=r.holding?.weight_pct,it=F(r)||x,k=W(i.items,r.thscode),lt=!x||u===null||u===void 0||u<=0,rt=(typeof u=="number"?u:0)+C>k;return l("div",{key:r.thscode,className:"capital-watchlist-grid capital-watchlist-row","data-thscode":r.thscode},l("span",{className:"capital-watchlist-namewrap"},l("span",{className:x?"capital-watchlist-name capital-watchlist-name-held":"capital-watchlist-name",title:Gt(r,t)},r.name),l("span",{className:"capital-watchlist-codeline"},l("span",{className:"capital-watchlist-code"},r.ticker),l(Q,{assetType:r.asset_type,t}))),l(Bt,{quote:r.quote,failureCode:i.failures[r.thscode],refreshing:i.refreshing,t}),l("span",{className:"capital-watchlist-rowactions"},l("button",{type:"button",className:"capital-watchlist-predict",disabled:d,title:t("predictTip"),"aria-label":`${t("predict")} ${r.name}`,onClick:()=>A(r,"predict")},l(Nt,{size:14})),l("button",{type:"button",className:"capital-watchlist-review",disabled:d,title:t("reviewTip"),"aria-label":`${t("review")} ${r.name}`,onClick:()=>A(r,"review")},l(St,{size:14})),l(At,{open:i.rowMenu===r.thscode,anchor:l("button",{type:"button",className:"capital-watchlist-more",disabled:d,title:t("more"),"aria-label":`${t("more")} ${r.name}`,"aria-haspopup":"menu","aria-expanded":i.rowMenu===r.thscode,onClick:()=>a.toggleRowMenu(r.thscode)},l(kt,{size:14})),items:[{id:"pin",label:t("pin"),icon:l(_t,{size:14}),disabled:m===0}],children:[...it?[l("div",{key:"holding-check",role:"group","aria-label":t("holdingName"),className:"capital-watchlist-checkrow"},l("span",{className:"capital-watchlist-checkicon","aria-hidden":"true"},l(yt,{size:14})),l("span",{className:"capital-watchlist-checklabel"},t("holdingName")),l(It,{checked:x,disabled:d,label:t("holdingName"),onChange:N=>N?a.markHolding(r.thscode,null):a.clearHolding(r.thscode)}))]:[],...x&&F(r)?[l("div",{key:"holding-step",className:"capital-watchlist-stepper",role:"group","aria-label":t("holdingStepper")},l("span",{className:"capital-watchlist-stepperlabel"},t("holdingWeightLabel")),l("span",{className:"capital-watchlist-stepperline"},l("button",{type:"button",className:"capital-watchlist-stepperbtn","aria-label":t("holdingStepDown"),disabled:lt,onClick:()=>a.stepHolding(r.thscode,-C)},"\u2212"),l("span",{className:typeof u=="number"?"capital-watchlist-stepperreadout":"capital-watchlist-stepperreadout capital-watchlist-stepperplaceholder",role:"status"},typeof u=="number"?`${u}%`:`0~${k}`),l("button",{type:"button",className:"capital-watchlist-stepperbtn","aria-label":t("holdingStepUp"),title:`0~${k}`,disabled:rt,onClick:()=>a.stepHolding(r.thscode,C)},"+")))]:[],l($t,{key:"remove",danger:!0,separatorBefore:!0,icon:l(Tt,{size:14}),onSelect:()=>{a.closeRowMenu(),a.setPendingRemove(r)}},t("remove"))],onSelect:N=>{N==="pin"&&(a.closeRowMenu(),a.pin(r.thscode))},onClose:()=>a.closeRowMenu(),align:"end",portal:!0,listClassName:"capital-watchlist-rows",className:"capital-watchlist-actions"})))})),et=l("div",{className:g?"capital-watchlist-confirm capital-watchlist-confirm-open":"capital-watchlist-confirm","aria-hidden":g?void 0:"true"},l("div",{className:"capital-watchlist-confirmbox",role:g?"alertdialog":void 0,"aria-label":t("confirmTitle")},l("div",{className:"capital-watchlist-confirmtitle"},t("confirmTitle")),g?l("p",{className:"capital-watchlist-confirmdesc"},t("confirmDescPrefix"),l("strong",null,`${p.name} \xB7 ${p.ticker}`),t("confirmDescSuffix")):null,l("div",{className:"capital-watchlist-confirmactions"},l("button",{type:"button",className:"capital-watchlist-confirmbtn",onClick:()=>a.setPendingRemove(null)},t("confirmCancel")),l("button",{type:"button",className:"capital-watchlist-confirmbtn capital-watchlist-confirmdanger",onClick:()=>{let r=p;a.setPendingRemove(null),r!==null&&a.remove(r.thscode)}},t("confirmOk")))));return l(Pt,{open:!0,onClose:()=>a.close(),title:t("title"),headless:!0,shortcutModal:"watchlist",className:"capital-watchlist-dialog"},l("div",{className:"capital-watchlist-card",onKeyDown:Y},l("div",{className:"capital-watchlist-header"},l("h2",{className:"capital-watchlist-title"},t("title")),l("button",{type:"button",className:"capital-watchlist-close","aria-label":t("close"),onClick:()=>a.close()},l(O,{size:14}))),l("div",{className:"capital-watchlist-search",onBlur:G},l("div",{className:"capital-watchlist-field"},l("span",{className:"capital-watchlist-searchicon"},l(Et,{size:16})),l("input",{className:"capital-watchlist-input","data-modal-autofocus":!0,value:i.query,placeholder:t("searchPlaceholder"),onChange:r=>a.onQueryChange(r.target.value,r.isComposing),onCompositionStart:()=>a.beginComposition(),onCompositionEnd:r=>a.endComposition(r.target.value)}),i.query.length>0?l("button",{type:"button",className:"capital-watchlist-clear",title:t("clearInput"),"aria-label":t("clearInput"),onMouseDown:r=>r.preventDefault(),onClick:()=>a.onQueryChange("",!1)},l(O,{size:12})):null),V),i.addError!==null&&i.addError!==void 0?l("p",{className:"capital-watchlist-adderror",role:"status","data-code":i.addError.code},Kt(t,i.addError)):null,Z,at,l("div",{className:"capital-watchlist-footer"},l("div",{className:"capital-watchlist-footcol"},l("button",{type:"button",className:"capital-watchlist-refresh",disabled:i.refreshing||d,onClick:()=>{a.refresh()}},l(Ct,{size:14}),i.refreshing?t("refreshing"):t("refresh")),X),l("span",{className:"capital-watchlist-updated"},`${t("updated")} ${i.refreshed_at===null||i.refreshed_at===void 0?t("notRefreshed"):K(i.refreshed_at)}`)),et))}function Jt(e){e.effect(Qt,`${f}: styles`),e.effect(()=>e.locale.register(_,{zh:zt,en:Mt}),`${f}: dictionaries`);let a=new Map,t=n=>{let c=a.get(n);return c===void 0&&(c=new E,a.set(n,c)),c};e.effect(()=>()=>{for(let n of a.values())n.dispose();a.clear()},`${f}: per-session surfaces`);let s=n=>{let o=e.sessions?.list?.getSnapshot?.().byId?.[n]?.projectionValues?.agentPreset;return typeof o=="string"?o:void 0},i=new Set,d=n=>{let c=s(n);return c!==void 0?c===Rt:(i.has(n)||(i.add(n),Promise.resolve(e.sessions?.refreshProjections?.(n)).catch(()=>{})),!1)};e.slots.inject(L,()=>e.slots.register({name:L,id:"capital-watchlist-dialog",order:3,locale:_,inject:n=>{let c=t(n);return{hooks:{dialog:c.state},surface:c}}},Xt)),e.inject(["commandUi"],n=>{let c=e.locale.bind(_);n.effect(()=>n.commandUi.register({name:"watchlist",label:()=>c("command.label"),description:()=>c("command.description"),icon:vt,available:o=>d(o.sessionId),ui:{kind:"action",run:o=>{t(o.sessionId).open()}}}),`${f}: /watchlist contribution`)}),e.logger?.info?.(`${f}: \u5BA2\u6237\u7AEF\u534A\u8FB9\u5DF2\u6302\u8F7D\uFF08/watchlist \u83DC\u5355\u884C + \u81EA\u9009\u80A1\u5F39\u7A97\uFF09`)}exports.name=f;exports.inject=["slots","locale","commandUi","sessions"];exports.apply=Jt;
|
|
264
264
|
return module.exports
|
|
265
265
|
},
|
|
266
266
|
})
|
|
@@ -150,9 +150,9 @@ const zh = {
|
|
|
150
150
|
/** 行标签、开关的 aria-label,以及名称标红之外那句非颜色通道(红名与"红涨"同色)共用这一个词。 */
|
|
151
151
|
holdingName: '持仓',
|
|
152
152
|
predict: '预测',
|
|
153
|
-
predictTip: 'AI
|
|
153
|
+
predictTip: 'AI预测',
|
|
154
154
|
review: '复盘',
|
|
155
|
-
reviewTip: 'AI
|
|
155
|
+
reviewTip: 'AI复盘',
|
|
156
156
|
/**
|
|
157
157
|
* ⚠️「预测」与「复盘」写进输入框的那句话**只改这四行**(zh / en 各两处,两套语言必须同时改)。
|
|
158
158
|
* 中间的 `名称 (thscode · 类型)` 是结构不是措辞,不住在这里:Agent 靠 thscode 认标的、
|
|
@@ -257,9 +257,9 @@ const en = {
|
|
|
257
257
|
/** ⚠️ 这两条标签受**格宽预算**约束:动作列是定值 52px(见 CSS 里 grid 那一处),
|
|
258
258
|
* 12px/500 下八个字符就顶到边。要改名先量长度,别让它溢出描边。 */
|
|
259
259
|
predict: 'Predict',
|
|
260
|
-
predictTip: 'AI prediction
|
|
260
|
+
predictTip: 'AI prediction',
|
|
261
261
|
review: 'Review',
|
|
262
|
-
reviewTip: 'AI review
|
|
262
|
+
reviewTip: 'AI review',
|
|
263
263
|
predictPromptPrefix: 'Predict ',
|
|
264
264
|
predictPromptSuffix: ' over the next 5 sessions: the likely path and key levels, the evidence behind the call, and how uncertain it is.',
|
|
265
265
|
reviewPromptPrefix: 'Review ',
|
package/chart-ui/package.json
CHANGED
|
@@ -13,6 +13,16 @@ export declare const SELECTED_SKILL_CATALOG: readonly SelectedSkillCatalogEntry[
|
|
|
13
13
|
export type SelectedSkillKey = typeof SELECTED_SKILL_CATALOG[number]['key'];
|
|
14
14
|
export type SelectedSkillSelection = Partial<Record<SelectedSkillKey, boolean>>;
|
|
15
15
|
export type SelectedSkillSelectionSource = SelectedSkillSelection | (() => SelectedSkillSelection);
|
|
16
|
+
type RuntimeSummary = {
|
|
17
|
+
name: string;
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* 索引块正文。**唯一实现**:条目集合来自 catalog 的 `selectedSkillsForTask`(与目录、闸门同源),
|
|
22
|
+
* 描述用**运行时那一份**(上游 frontmatter,也就是会话目录里模型看到的那句话),不是设置卡片里
|
|
23
|
+
* 策展过的中文摘要——同一个 skill 在同一段上下文里出现两种描述,只会让模型两处对照。
|
|
24
|
+
*/
|
|
25
|
+
export declare function renderTaskSkillIndex(taskId: string, summaries: readonly RuntimeSummary[]): string | undefined;
|
|
16
26
|
type FileSystemSkillConfig = {
|
|
17
27
|
providerName: string;
|
|
18
28
|
includeDefaultRoots: false;
|