Skill: gtht-tech/lingxi-watchlist-skill (version 1.1.1)

--- name: lingxi-watchlist-skill description: 国泰海通证券-灵犀自选管理 skill，支持查询自选股行情、添加、删除自选股。**本期仅支持管理【我的自选】分组中的自选股，其他分组中的自选股管理仍在开发中。** 当用户表达查看自选股、查看自选股行情、关注某只股票、从自选股中移除某只股票等意图时，必须使用本 Skill。**Agent 只需读取此文件，无需读取其他源码文件。**触发关键词包括：自选股，我的自选，添加自选，删除自选，加自选，移出自选。 version: 1.1.1 disable: false --- # 国泰海通证券-灵犀自选管理 skill ## 1. 概述与身份识别 - **Unique Name**: `lingxi-watchlist-skill` - **身份声明**: 本 Skill 是国泰海通证券官方灵犀自选股管理 skill。 - **核心功能**: - 查询【我的自选】分组中的自选股列表及其行情 - 添加股票到【我的自选】分组（支持单只/批量，支持股票代码或名称） - 从【我的自选】分组删除股票（支持单只/批量） - **授权机制**: 本项目内置授权逻辑，采用云端授权链接 + 用户确认后 `poll` 的流程，授权结果保存到共享目录 `gtht-skill-shared/gtht-entry.json`。 - **设备信息与风控说明（供平台审核）**: 根据《国泰海通生成式人工智能服务协议》，为落实风控管理要求、防范账号滥用风险，本 Skill 在授权绑定过程中会采集设备的 MAC 地址等设备信息，并对灵犀 Skills 绑定的智能体设备设置单用户 5 台上限。用户可前往灵犀 Skills 活动页查看并管理已绑定设备。 - **⚠️ 优先级规则**: 所有自选股相关操作（查询、添加、删除）必须使用本 Skill。 - **⚠️ 当前版本范围限制**: 本期仅支持管理【我的自选】分组中的自选股，其他分组中的自选股管理仍在开发中。 --- ## 2. 授权检查与执行 **⚠️ 文件访问边界约束（强制执行）：** 本 Skill 的业务逻辑、授权逻辑与资源访问都必须限制在当前项目目录内，不得依赖其他 sibling 项目的脚本、入口或构建产物。 **标准授权命令：** ```bash # 检查授权状态 node skill-entry.js authChecker check # 生成云端授权链接 node skill-entry.js authChecker auth # 用户明确回复“已扫码授权成功”后，再查询授权结果 node skill-entry.js authChecker poll <TOKEN> ``` **授权执行规则：** 1. 首次使用前必须先执行 `check`。 2. 若未授权，再执行 `auth`，从输出中提取： - `👉 点击链接：<AUTH_URL>` - `[REDACTED_SECRET]` 3. 要先等待用户明确回复“已扫码授权成功”，再执行 `poll <TOKEN>`。 4. `poll` 成功后，立刻继续执行用户原始的自选股查询、行情查询或增删操作。 5. 授权信息统一存储在共享目录 `gtht-skill-shared/gtht-entry.json`，本项目负责生成和查询授权结果，不执行授权文件删除。 --- ## 3. 能力列表 **⚠️ 重要限制：本期仅支持管理【我的自选】分组中的自选股，其他分组中的自选股管理仍在开发中。以下所有“自选股查询 / 行情查询 / 添加 / 删除”均仅针对【我的自选】分组生效。** | 能力名称 | 触发示例 | 说明 | |--------|-------------------------------------|----------------------------------------| | 自选股查询 | "帮我查询下我的自选股？" | 调用 `editWatchlist listQuote`，输出【我的自选】分组中的完整自选股列表 | | 自选股行情查询 | "我自选股现在整体表现如何？" / "查一下自选股行情" | 调用 `editWatchlist listQuote`，仅查询【我的自选】分组并以表格展示 | | 添加单只自选股 | "把贵州茅台加入我的自选股" | 调用 `editWatchlist add`，将股票加入【我的自选】分组，支持名称自动转代码 | | 批量添加自选股 | "帮我把宁德时代、比亚迪、隆基绿能都加入自选" | 调用 `editWatchlist add`，将股票批量加入【我的自选】分组 | | 删除自选股 | "把中国石油从我的自选里删掉" | ⚠️ **必须二次确认**：列出待删除股票，确认后从【我的自选】分组执行 `editWatchlist remove` | | 批量删除自选股 | "帮我把自选股里跌了超过 10% 的都删掉" | ⚠️ **必须二次确认**：列出待删除股票及原因，确认后从【我的自选】分组批量执行 | --- ## 4. 命令详解 ### 4.1 自选股行情查询（listQuote） - **功能**: 获取用户【我的自选】分组中的自选股列表，批量调用 `market/marketdata-tool` 查询行情，以表格形式输出 - **命令**: ```bash node skill-entry.js editWatchlist listQuote ``` - **内部执行流程**: 1. 调用 `get_optionalStock` 获取用户自选股列表 2. 仅保留【我的自选】分组中的股票，忽略其他分组 3. 解析股票代码（拼装标准格式如 `SZ000001`、`SH600519`） 4. 一次性批量调用 `market/marketdata-tool`，将所有代码传入 `codes` 参数 5. 结合 `stock_map` 补全股票名称 6. 输出 Markdown 表格 - **参数说明**: 无需任何参数，脚本自动获取【我的自选】分组中的全部自选股并查询行情 - **输出示例**: ``` 📊 自选股行情查询（共 3 只） ============================================================ | 名称 | 代码 | 最新价 | 涨跌幅 | 当日资金净流入(元) | |---|---|---|---|---| | 国泰海通 | SH601211 | 15.32 | +1.25% | 12,345,678.00 | | 中芯国际 | SH688981 | 98.50 | -0.56% | -5,432,100.00 | | 宁德时代 | SZ300750 | 210.80 | +3.12% | 89,123,456.00 | ``` - **字段来源**: | 展示字段 | marketdata-tool 返回字段（按优先级匹配） | |--------|----------------------------------| | 最新价 | `CLOSE` / `close` / `price` / `latestPrice` | | 涨跌幅 | `CHANGE_PERCENT` / `changePercent` / `CHANGE_PCT` / `pctChg` | | 当日资金净流入 | `netInflow` / `NET_INFLOW` / `netInFlow` | > **注意**: 若 `marketdata-tool` 返回的字段名不在上述列表中，对应列会显示 `--`。Agent 可根据实际返回数据做字段名映射。 ### 4.2 自选股添加/删除（editWatchlist） - **功能**: 批量添加或删除【我的自选】分组中的自选股，支持股票代码或名称混合传入 - **命令格式**: ``` node skill-entry.js editWatchlist <操作> <股票代码或名称...> ``` - **参数说明**: | 参数 | 说明 | 值说明 | |--------|---------------------|---------------| | `key` | 由脚本自动注入 | 无需手动传入 | | `type` | 操作类型 | `"20"`=添加, `"11"`=删除 | | `codes`| 股票代码数组 | 例如: `["SH601211", "SH688981"]` | - **操作类型**: | 操作 | 说明 | |-----------------|--------| | `add`（默认） | 添加自选股 | | `remove` / `-d` | 删除自选股 | - **输入格式**: - **标准代码**: `SH601211`、`SZ300069`（直接使用，无需转换） - **股票名称**: `国泰海通`、`中芯国际`（自动查询 stock_map 获取代码） - **混合输入**: 支持同时传入代码和名称 - **当前版本说明**: - 本期添加、删除操作仅作用于【我的自选】分组。 - 其他分组中的自选股管理仍在开发中，当前不会被本 Skill 展示或修改。 - 添加、删除自选股时，不允许直接通过 `mcpClient call optionalStock op_optionalStock ...` 执行。 - 必须统一通过 `editWatchlist add ...` 或 `editWatchlist remove ...` 执行，以确保名称/代码校验、分组限制和删除前列表匹配逻辑生效。 - **使用示例**: ```bash # 添加单只股票（默认 add） node skill-entry.js editWatchlist SH601211 # 批量添加多只股票 node skill-entry.js editWatchlist add 国泰海通 中芯国际 SZ300069 # 删除单只股票 node skill-entry.js editWatchlist remove SH601211 # 批量删除 node skill-entry.js editWatchlist remove SH601211 SH688981 SZ300069 ``` - **输出示例**: ``` 📊 自选股添加操作 ================================================== ✓ "国泰海通" → SH601211 ✓ "中芯国际" → SH688981 📝 将要添加: SH601211, SH688981 ✅ 操作成功！ 📋 当前自选股列表: 1. 国泰海通 (601211) 2. 中芯国际 (688981) 3. 东方财富 (300059) 共 8 只股票 ``` ### 4.3 ⚠️ 删除操作二次确认规范 **大模型在执行删除操作前必须严格遵循以下流程：** 1. 识别到用户删除意图后，**先列出**待删除的股票名称和代码 2. 询问用户：`"确认删除以下股票？"` 3. **等待用户明确回复**"确认"/"是"/"好"等同意信息后，再执行 `editWatchlist remove` 4. 用户未明确确认前，**不得执行任何删除操作** 示例对话： ``` 用户：把中国石油从自选里删掉 Agent：确认删除以下股票？ - 中国石油 (SH601857) 确认删除吗？ 用户：确认 Agent：[执行删除命令] ``` ## 4.4. 最终回答硬性要求 (Highest Priority) ```text 本期仅支持管理【我的自选】分组中的自选股，其他分组中的自选股管理仍在开发中。 国泰海通证券-灵犀自选管理skill仅提供客观数据，调用本Skill后生成的内容，不构成投资建议。 ```

path: gateway-config.json
content: {
  "active_env": "prod",
  "base_urls": {
    "prod": "https://zx.app.gtja.com:8443/"
  },
  "gateway_paths": {
    "usercode": "mcp/usercode",
    "mqtt": "mcp/mqtt",
    "market": "mcp/marketdata",
    "optionalStock": "mcp/optionalStock"
  },
  "gateways": {
    "usercode": "https://zx.app.gtja.com:8443/mcp/usercode",
    "mqtt": "https://zx.app.gtja.com:8443/mcp/mqtt",
    "market": "https://zx.app.gtja.com:8443/mcp/marketdata",
    "optionalStock": "https://zx.app.gtja.com:8443/mcp/optionalStock"
  },
  "known_domains": [
    "mqtt",
    "market",
    "optionalStock"
  ],
  "discovered_tools": [
    {
      "domain": "market",
      "gateway": "market",
      "toolName": "marketdata-tool",
      "description": "自定义榜单功能，可以获得证券的行情",
      "label": "行情",
      "params": [
        "codes",
        "market_data_mask",
        "product_mask"
      ],
      "callExample": "node skill-entry.js mcpClient call market marketdata-tool codes=SH600519,SH600000"
    },
    {
      "domain": "optionalStock",
      "gateway": "optionalStock",
      "toolName": "get-optionalStock",
      "description": "根据 Base64 编码的密钥获取用户的自选股数据",
      "label": "自选股查询",
      "params": [
        "PAGE_SIZE",
        "PAGE_NO",
        "ACCT_TYPE"
      ],
      "callExample": "node skill-entry.js call optionalStock get-optionalStock PAGE_SIZE=50 PAGE_NO=1 ACCT_TYPE=\"6\""
    },
    {
      "domain": "optionalStock",
      "gateway": "optionalStock",
      "toolName": "op_optionalStock",
      "description": "添加、删除用户自选股",
      "label": "自选股操作",
      "params": [],
      "callExample": "node skill-entry.js call optionalStock op_optionalStock STOCK_CODE=SH600000 OP_TYPE=add"
    }
  ]
}

path: skill-entry.js
content: // build-version: 1.1.1+build.20260512092716
var M=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var F=M((An,Dt)=>{var P=require("fs"),A=require("path");function it(){let t=A.basename(__dirname)==="dist"?A.resolve(__dirname,".."):A.resolve(__dirname,"..",".."),e=A.dirname(t),o=A.dirname(e),n=A.dirname(o),r=A.join(t,"gtht-skill-shared","gtht-entry.json"),s=A.join(e,"gtht-skill-shared","gtht-entry.json"),i=A.join(o,"gtht-skill-shared","gtht-entry.json"),c=A.join(n,"gtht-skill-shared","gtht-entry.json"),a=[...new Set([s,i,c,r])],l=a.slice(0,3).find(h=>P.existsSync(h));if(l)return P.mkdirSync(A.dirname(l),{recursive:!0}),l;let p=a[3],d=a.find(h=>P.existsSync(A.dirname(h)))||a[0];if(p&&P.existsSync(p))return P.mkdirSync(A.dirname(p),{recursive:!0}),p;let m=a.find(h=>P.existsSync(h))||d;return P.mkdirSync(A.dirname(m),{recursive:!0}),m}function no(t){try{let e=it();P.writeFileSync(e,JSON.stringify({apiKey:t,updatedAt:new Date().toISOString()},null,2)),console.log(`\u2713 API Key \u5DF2\u4FDD\u5B58\u5230\u914D\u7F6E\u6587\u4EF6: ${e}`)}catch(e){throw console.error("\u4FDD\u5B58\u914D\u7F6E\u6587\u4EF6\u5931\u8D25:",e.message),e}}function Tt(){try{let t=it();if(!P.existsSync(t))return null;let e=P.readFileSync(t,"utf8"),o=JSON.parse(e),n=o?.apiKey??o?.["api-key"]??o?.apikey;return n&&String(n).trim()?String(n).trim():null}catch(t){return console.error("\u8BFB\u53D6 API Key \u5931\u8D25:",t.message),null}}function ro(){let t=Tt();if(!t)return"";let e=String(t).trim();if(e.startsWith("{")&&e.endsWith("}"))try{let r=JSON.parse(e);e=String(r["api-key"]||r.apiKey||r.jwtToken||"").trim()}catch{}if(!e)return"";let o=e.indexOf("||"),n=o>=0?e.slice(o+2).trim():e;return n.length>16?n.slice(16):""}function so(t){try{if(!t)return"";let e=t.split(".");if(e.length<2)return"";let o=e[1].replace(/-/g,"+").replace(/_/g,"/"),n=o+"=".repeat((4-o.length%4)%4),r=Buffer.from(n,"base64").toString("utf8"),s=JSON.parse(r);return String(s.userCode||"")}catch{return""}}function co(t){let e=String(t||"").trim();if(!e)return null;function o(i){try{return JSON.parse(i)}catch{let a=i.replace(/([}\]"0-9eE.+-])\s*(?="[^"]+"\s*:)/g,"$1,");try{return JSON.parse(a)}catch{return null}}}let n=o(e);if(n!==null)return n;let r=e.indexOf("{"),s=e.lastIndexOf("}");return r>=0&&s>r?o(e.slice(r,s+1)):null}function at(t){if(typeof t=="number")return Number.isFinite(t);if(typeof t!="string")return!1;let e=t.trim();return e?/^-?\d+(\.\d+)?$/.test(e):!1}function io(t,e){let o=Number(t),n=Number(e);if(!Number.isFinite(o)||!Number.isFinite(n))return t;if(n<=0)return o;let r=o/10**n;return Number(r.toFixed(Math.min(n,8)))}function nt(t){if(Array.isArray(t))return t.map(nt);if(!t||typeof t!="object")return t;let e={};return Object.keys(t).forEach(o=>{e[o]=nt(t[o])}),Object.prototype.hasOwnProperty.call(e,"value")&&Object.prototype.hasOwnProperty.call(e,"exp")&&at(e.value)&&(e.value=io(e.value,e.exp)),e}function Mt(t){return t==null||typeof t=="string"&&t.trim()===""}function xt(t,e){if(t!=="capital_flow")return!1;if(typeof e=="number")return Number.isFinite(e)&&e===0;if(typeof e=="string"){let o=e.trim();return at(o)&&Number(o)===0}return e&&typeof e=="object"&&!Array.isArray(e)&&Object.prototype.hasOwnProperty.call(e,"value")?xt(t,e.value):!1}function ao(t,e){return Mt(e)||xt(t,e)}function It(t,e){return t==="market"&&e==="marketdata-tool"}function lo(t,e){return t==="optionalStock"&&e==="get_optionalStock"}var uo=["code","name","last_price","open_price","high_price","low_price","change_rate","osc_rate","relative_volume_ratio","price_change","total_volume","total_amount","total_market_capital","turnover_rate","capital_flow"];function rt(t){if(Array.isArray(t))return t.map(rt);if(Mt(t))return"--";if(!t||typeof t!="object")return t;let e={};return Object.keys(t).forEach(o=>{e[o]=rt(t[o])}),ct(e)&&uo.forEach(o=>{(!Object.prototype.hasOwnProperty.call(e,o)||ao(o,e[o]))&&(e[o]="--")}),e}function Rt(t){let e=String(t||"").trim();if(!e)return"";let o=e.split(/\|(?=\d+,[^|:,]+,\d+:)/).map(n=>n.trim()).filter(Boolean);for(let n of o){let r=n.indexOf(":");if(r<0)continue;let s=n.slice(0,r).split(",");if(String(s[1]||"").trim()==="\u6211\u7684\u81EA\u9009")return n}return""}function st(t){if(Array.isArray(t))return t.map(st);if(!t||typeof t!="object")return t;let e={};return Object.keys(t).forEach(o=>{if(o==="STK_CONTENT"&&typeof t[o]=="string"){e[o]=Rt(t[o]);return}e[o]=st(t[o])}),e}function vt(t,e,o){return It(t,e)?rt(nt(o)):lo(t,e)?st(o):o}function j(t){if(typeof t=="number")return Number.isFinite(t)?t:null;if(typeof t=="string"&&at(t)){let e=Number(t);return Number.isFinite(e)?e:null}return null}function O(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"value")?j(t.value):j(t)}function Ft(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"value")?j(t.value):j(t)}function Ot(t,e=2,o=""){return Number.isFinite(t)?`${t>0?"+":""}${t.toFixed(e)}${o}`:"--"}function _(t,e=2){return Number.isFinite(t)?new Intl.NumberFormat("zh-CN",{minimumFractionDigits:e,maximumFractionDigits:e}).format(t):"--"}function $t(t,e,o){if(!t||typeof t!="object")return o;let n=O(t[e]);if(Number.isFinite(n)&&n>=0)return Math.min(Math.floor(n),12);let r=j(t[e]);return Number.isFinite(r)&&r>=0?Math.min(Math.floor(r),12):o}function po(t,e,o){let n=O(t[e])??j(t[e]);return Number.isFinite(n)&&n>0?n:o}function Lt(t){let e=$t(t,"price_decimal_places",2),o=$t(t,"ratio_decimal_places",2),n=po(t,"min_order_unit",100),r=10**e,s=10**o,i=Math.min(Math.max(e,0),8)||2,c=Math.min(Math.max(o,0),6)||2;return{priceDivisor:r,ratioDivisor:s,minOrderUnit:n,priceDigits:i,ratioDisplayDigits:c}}function H(t,e){return!Number.isFinite(t)||!Number.isFinite(e)||e<=0?null:t/e*100}function $(t,e){return!Number.isFinite(t)||!Number.isFinite(e)||e<=0?null:t/e}function fo(t){return/^HK/i.test(String(t||"").trim())}function mo(t){return Number.isFinite(t)?Math.abs(t)>=1e8?`${_(t/1e8,2)}\u4EBF\u80A1`:Math.abs(t)>=1e4?`${_(t/1e4,2)}\u4E07\u80A1`:`${_(t,2)}\u80A1`:"--"}function ho(t,e=100){if(!Number.isFinite(t))return"--";let o=Number.isFinite(e)&&e>0?e:100,n=t/o;return Math.abs(n)>=1e4?`${_(n/1e4,2)}\u4E07\u624B`:`${_(n,2)}\u624B`}function Pt(t,e=100){let o=$(t,e);return Number.isFinite(o)?Math.abs(o)>=1e8?`${_(o/1e8,2)}\u4EBF`:Math.abs(o)>=1e4?`${_(o/1e4,2)}\u4E07`:`${_(o,2)}\u5143`:"--"}function go(t,e=100){let o=$(t,e);return Number.isFinite(o)?Math.abs(o)>=1e5?`${_(o/1e4,2)}\u4E07\u5143`:`${_(o,2)}\u5143`:"--"}function yo(t,e,o){let n=$(t,e);if(!Number.isFinite(n))return"--";let r=n>0?"+":"",s=Number.isFinite(o)&&o>=0?Math.min(o,8):2;return`${r}${_(n,s)} \u5143`}function ct(t){return!t||typeof t!="object"||Array.isArray(t)?!1:!!(t.code||t.name||Object.prototype.hasOwnProperty.call(t,"last_price")||Object.prototype.hasOwnProperty.call(t,"change_rate")||Object.prototype.hasOwnProperty.call(t,"total_amount")||Object.prototype.hasOwnProperty.call(t,"total_volume")||Object.prototype.hasOwnProperty.call(t,"open_price")||Object.prototype.hasOwnProperty.call(t,"high_price")||Object.prototype.hasOwnProperty.call(t,"low_price"))}function jt(t){if(!t||typeof t!="object"||Array.isArray(t))return null;for(let e of Object.values(t))if(Array.isArray(e)&&e.length>0&&typeof e[0]=="object")return e;return null}function Kt(t){if(Array.isArray(t))return t;if(!t||typeof t!="object")return[];if(Array.isArray(t.data))return t.data;if(Array.isArray(t.list))return t.list;if(Array.isArray(t.items))return t.items;if(Array.isArray(t.rows))return t.rows;if(Array.isArray(t.records))return t.records;if(t.data&&Array.isArray(t.data.list))return t.data.list;if(t.data&&Array.isArray(t.data.items))return t.data.items;if(t.data&&Array.isArray(t.data.rows))return t.data.rows;if(t.data&&Array.isArray(t.data.records))return t.data.records;if(ct(t.data))return[t.data];if(ct(t))return[t];let e=jt(t.data)||jt(t);return e||[]}function wo(t){let e=t.code||"--",o=t.name||"--",{priceDivisor:n,ratioDivisor:r,minOrderUnit:s,priceDigits:i,ratioDisplayDigits:c}=Lt(t),a=O(t.last_price),l=O(t.open_price),p=O(t.high_price),d=O(t.low_price),m=j(t.change_rate),h=j(t.osc_rate),y=j(t.relative_volume_ratio),k=O(t.price_change),N=Ft(t.total_volume),u=O(t.total_amount),f=O(t.total_market_capital),S=j(t.turnover_rate),w=O(t.capital_flow),C=$(a,n),E=$(l,n),T=$(p,n),g=$(d,n),b=H(m,r),ot=H(h,r),v=$(y,r),B=H(S,r),bt=$(w,n),Et=$(f,n),to=Number.isFinite(bt)&&Math.abs(bt)<=1e-9,eo=Number.isFinite(Et)&&Math.abs(Et)<=1e-9,oo=Number.isFinite(B)&&parseFloat(B.toFixed(c))===0,U=[`\u3010${o} (${e})\u3011`,"",`\u6700\u65B0\u4EF7\uFF1A${Number.isFinite(C)?_(C,3):"--"} \u5143`,`\u5F00\u76D8\u4EF7\uFF1A${Number.isFinite(E)?_(E,i):"--"} \u5143`,`\u6700\u9AD8\u4EF7\uFF1A${Number.isFinite(T)?_(T,i):"--"} \u5143`,`\u6700\u4F4E\u4EF7\uFF1A${Number.isFinite(g)?_(g,i):"--"} \u5143`,`\u6DA8\u8DCC\u5E45\uFF1A${Number.isFinite(b)?Ot(b,c,"%"):"--"}`,`\u6DA8\u8DCC\u989D\uFF1A${yo(k,n,i)}`,`\u632F\u5E45\uFF1A${Number.isFinite(ot)?Ot(ot,c,"%"):"--"}`,`\u91CF\u6BD4\uFF1A${Number.isFinite(v)?_(v,c):"--"}`,`\u6210\u4EA4\u91CF\uFF1A${fo(e)?mo(N):ho(N,s)}`,`\u6210\u4EA4\u989D\uFF1A${Pt(u,n)}`];return oo||U.push(`\u6362\u624B\u7387\uFF1A${Number.isFinite(B)?`${B.toFixed(c)}%`:"--"}`),to||U.push(`\u5F53\u65E5\u8D44\u91D1\u51C0\u6D41\u5165\uFF1A${go(w,n)}`),eo||U.push(`\u603B\u5E02\u503C\uFF1A${Pt(f,n)}`),U.join(`
`)}function _o(t,e,o){if(!It(t,e))return null;let n=Kt(o);return n.length?n.map(wo).join(`

`):null}function ko(t,e,o){let n=vt(t,e,o),r=_o(t,e,n);return r||JSON.stringify(n,null,2)}Dt.exports={resolveAuthConfigFile:it,saveApiKey:no,getApiKey:Tt,getJwtTokenFromApiKey:ro,parseUserCodeFromJwt:so,parseJsonTextSafely:co,formatNumber:_,readNumericField:O,readVolumeBaseValue:Ft,getMarketItemScales:Lt,ratioScaledToDisplayPercent:H,scaleRaw:$,extractMarketItems:Kt,formatToolResult:vt,formatCliOutput:ko,filterStkContentToMyWatchlist:Rt}});var L=M((Cn,Jt)=>{var G=require("fs"),J=require("path"),W=[process.env.GTHT_GATEWAY_CONFIG,J.join(__dirname,"gateway-config.json"),J.join(process.cwd(),"min","gateway-config.json"),J.join(process.cwd(),"gateway-config.json"),J.join(__dirname,"..","gateway-config.json")].filter(Boolean);function lt(){for(let t of W)if(G.existsSync(t))return t;return W[W.length-1]}var qt=!0,So="",Ao="https://zx.app.gtja.com:8443/",x={active_env:qt?"prod":"test",base_urls:{...qt?{}:{test:So},prod:Ao},gateway_paths:{market:"mcp/marketdata",info:"mcp/hotrank",yaowen:"mcp/yaowen",watchlist:"mcp/watchlist",hotTopic:"mcp/hotTopic",mqtt:"mcp/mqtt",optionalStock:"mcp/optionalStock"}};function Bt(t,e={}){let o=t.endsWith("/")?t:`${t}/`;return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,new URL(r,o).toString()]))}function z(t={}){let e=t.active_env||x.active_env,o={...x.base_urls,...t.base_urls||{}},n={...x.gateway_paths,...t.gateway_paths||{}};return{...t,...x,active_env:e,base_urls:o,gateway_paths:n,gateways:Bt(o[e]||x.base_urls[x.active_env],n),known_domains:Array.from(new Set([...Array.isArray(t.known_domains)?t.known_domains:[],...Object.keys(n)]))}}function Ut(){let t=lt();try{if(G.existsSync(t))return z(JSON.parse(G.readFileSync(t,"utf8")))}catch(e){console.error("\u52A0\u8F7D\u7F51\u5173\u914D\u7F6E\u5931\u8D25:",e.message)}return z()}function Co(t){let e=lt(),o=z(t),{gateways:n,...r}=o,s={...r,last_updated:new Date().toISOString()};G.writeFileSync(e,JSON.stringify(s,null,2))}function Ht(){return Ut().gateways}function No(t){return Ht()[t]}Jt.exports={CONFIG_CANDIDATES:W,resolveConfigFile:lt,DEFAULT_CONFIG:x,buildGateways:Bt,createGatewayConfig:z,loadGatewayConfig:Ut,saveGatewayConfig:Co,loadGateways:Ht,getGateway:No}});var ut=M((Nn,Wt)=>{var bo=require("crypto"),Eo=require("os"),Oo={host:"180.163.111.207",port:8899,path:"/openclaw/query-key",timeout:3e4,contentType:"application/gm+json"},$o="lingxi-watchlist-skill",Po="openclaw",jo="Xclow_skills",To="1.1.1",R="";function Mo(){if(R)return R;let t=Eo.networkInterfaces();for(let e of Object.values(t))for(let o of e||[])if(!o.internal&&o.mac&&o.mac!=="00:00:00:00:00:00")return R=o.mac.replace(/:/g,"").toUpperCase(),R;return R=bo.randomBytes(6).toString("hex").toUpperCase(),R}Wt.exports={CLAW_QUERY_SERVER:Oo,getMacAddress:Mo,SKILL_CHANNEL:Po,SKILL_NAME:$o,SKILL_PLATFORM:jo,SKILL_VERSION:To}});var ae=M((bn,dt)=>{var xo=require("http"),Io=require("https"),Ro=require("crypto"),vo=require("path"),{resolveAuthConfigFile:zt,saveApiKey:V,getApiKey:Fo}=F(),{loadGateways:Lo}=L(),{SKILL_CHANNEL:Vt,SKILL_NAME:Qt,SKILL_PLATFORM:Yt,SKILL_VERSION:Zt,getMacAddress:Xt}=ut(),Ko="https://apicdn2.app.gtht.com/web2/jh-static-QRCode/",pt=10,te=Xt(),K={host:"localhost",port:9999,path:"/check_auth",checkInterval:3e3,timeout:12e4};function ee(t){return new Promise(e=>setTimeout(e,t))}function I(){return Fo()}function oe(){return I()!==null}function ne(){let t=zt();if(t){console.log(`\u2713 \u5DF2\u7981\u7528\u6E05\u9664\u6388\u6743\uFF0C\u4E0D\u4F1A\u5220\u9664\u6388\u6743\u6587\u4EF6: ${t}`);return}console.log("\u2713 \u5DF2\u7981\u7528\u6E05\u9664\u6388\u6743\uFF0C\u4E0D\u4F1A\u5220\u9664\u6388\u6743\u6587\u4EF6")}function re(){let t=I();return t!==null&&String(t).trim()!==""}function Do(){return vo.basename(process.argv[1]||"index.js")}function qo(t,e,o={},n={}){let r=I()||"",s=JSON.stringify({jsonrpc:"2.0",id:2,method:e,params:o}),i=new URL(t),c={"Content-Type":"application/json","Content-Length":Buffer.byteLength(s),channel:Vt,platform:Yt,"api-key":n.apiKey||r,"jwt-assertion":n.jwtAssertion||"",usercode:n.usercode||"",...n.headers||{},"device-info":te,"skill-name":Qt,version:Zt};return new Promise((a,l)=>{let p=Io.request({hostname:i.hostname,port:i.port||443,path:i.pathname,method:"POST",headers:c,rejectUnauthorized:!0},d=>{let m="";d.on("data",h=>{m+=h}),d.on("end",()=>{try{a(JSON.parse(m))}catch{l(new Error(`\u89E3\u6790\u54CD\u5E94\u5931\u8D25: ${m}`))}})});p.on("error",l),p.write(s),p.end()})}function Bo(t){let e=String(t||"").trim();if(!e)return null;try{return JSON.parse(e)}catch{let n=e.replace(/"bgStatus"\s*:\s*,/g,'"bgStatus": null,');return JSON.parse(n)}}function Uo(t,e){let o=String(t||"").trim(),n=String(e||"").trim();return!o||!n?"":`${o}||${n}`}function Gt(t){if(!t||typeof t!="object")return"";let e=[t?.data?.tokenList?.[0],t?.data,t?.result?.data?.tokenList?.[0],t?.result?.data,t?.tokenList?.[0],t];for(let o of e){let n=Uo(o?.tokenSerialNo,o?.userToken);if(n)return n}return""}function Ho(t){let e=Gt(t);if(e)return e;let o=Array.isArray(t?.result?.content)?t.result.content:[];for(let n of o){let r=Bo(n?.text),s=Gt(r);if(s)return s}throw new Error(`get-token \u672A\u8FD4\u56DE tokenSerialNo/userToken: ${JSON.stringify(t)}`)}async function ft(t){try{let e=Lo().mqtt;if(!e)throw new Error("\u672A\u914D\u7F6E mqtt \u7F51\u5173");let n=await qo(e,"tools/call",{name:"get-token",arguments:{openDeviceId:t||"",pageNo:"1",pageSize:"1",mobileUserCode:"0",accountNo:"",accType:""}});return Ho(n)}catch(e){throw new Error(`\u67E5\u8BE2key\u5931\u8D25: ${e.message}`)}}function Jo(){let t="";for(let e=0;e<5;e+=1)t+=[REDACTED_SECRET].charAt(Math.floor(Math.random()*36));return t}function Wo(){let t=String(Math.floor(Date.now()/1e3));if(t.length>pt)throw new Error(`\u65F6\u95F4\u6233\u957F\u5EA6\u8D85\u51FA ${pt} \u4F4D\uFF0C\u65E0\u6CD5\u751F\u6210\u56FA\u5B9A\u957F\u5EA6 deviceId`);return t.padStart(pt,"0")}function Go(){let t=Xt(),e=Wo(),o=Jo(),n=`${t}${e}${o}`,r=`gthtclaw://qrbody:${n}`,s=Ro.createHash("md5").update(r).digest("hex");return{qrbody:r,sessionId:s,deviceId:n,macAddress:t,timestamp:e,randomChars:o}}function zo(t){let e=new URLSearchParams;return e.set("token",t),`${Ko}?${e.toString()}`}function Vo(){console.log("\u65B9\u5F0F\u4E8C\uFF1AAPI Key \u6388\u6743"),console.log("\u8FDB\u5165\u7075\u7280 Skills \u9886\u53D6\u6D3B\u52A8\u9875(\u7075\u7280APP\u5206\u4EAB\u9875\uFF1Ahttps://apicdn.app.gtht.com/web2/jh-news-skill/?fullscreen=1#/?share=1&sourceApp=lingxi&webEnv=web2&islingxishare=1\uFF0C\u541B\u5F18APP\u5206\u4EAB\u9875\uFF1Ahttps://apicdn.app.gtht.com/web2/jh-news-skill/?fullscreen=1#/?share=1&sourceApp=junhong&webEnv=web2&isyyzshare=1) \u2192 API KEY \u7BA1\u7406 \u2192 \u65B0\u5EFA\u6216\u590D\u5236\u751F\u6548\u4E2D\u7684 API KEY\uFF0C\u53D1\u9001\u7ED9\u6211\u5B8C\u6210\u6388\u6743\u3002"),console.log("\u7075\u7280APP\u5206\u4EAB\u9875\uFF1Ahttps://apicdn.app.gtht.com/web2/jh-news-skill/?fullscreen=1#/?share=1&sourceApp=lingxi&webEnv=web2&islingxishare=1"),console.log("\u541B\u5F18APP\u5206\u4EAB\u9875\uFF1Ahttps://apicdn.app.gtht.com/web2/jh-news-skill/?fullscreen=1#/?share=1&sourceApp=junhong&webEnv=web2&isyyzshare=1")}function Qo(t){console.log(`
\u4E91\u7AEF\u6388\u6743\u9875\u5DF2\u751F\u6210\u3002\u8BF7\u5148\u626B\u7801\u6388\u6743\uFF1A
`),console.log("\u65B9\u5F0F\u4E00\uFF1A\u626B\u7801\u6388\u6743"),console.log(`\u{1F449} \u70B9\u51FB\u94FE\u63A5\uFF1A${t}`),console.log(""),Vo(),console.log(""),console.log("\u626B\u7801\u5B8C\u6210\u540E\uFF0C\u8BF7\u7B49\u5F85\u7528\u6237\u660E\u786E\u56DE\u590D\u201C\u5DF2\u626B\u7801\u6388\u6743\u6210\u529F\u201D\uFF0C\u518D\u6267\u884C\u6388\u6743\u7ED3\u679C\u786E\u8BA4\u3002")}function Yo(t=process.argv.slice(2)){return{argv:t,hasLegacyLocalRenderFlags:t.includes("--ascii")||t.includes("--image")||process.env.QR_RENDER==="ascii"||process.env.QR_RENDER==="image"||process.env.CHANNEL_MODE==="true",isPollMode:t.includes("--poll"),pollDeviceId:(()=>{let e=t.indexOf("--device-id");return e!==-1&&t[e+1]?t[e+1]:""})(),forceReauth:t.includes("--reauth")}}async function Zo(t,e={}){let{maxAttempts:o=100,intervalMs:n=3e3,statusLabel:r="\u7B49\u5F85\u626B\u7801"}=e;for(let s=1;s<=o;s+=1){let i=Math.floor(n/1e3)*s;process.stdout.write(`\r\u25B6 [${s}/${o}] ${r} (${i}\u79D2)   `);try{let c=await ft(t);return V(c),process.stdout.write(`

`),console.log([REDACTED_SECRET]),console.log("  \u2713 \u6388\u6743\u6210\u529F\uFF01API Key \u5DF2\u4FDD\u5B58"),console.log("========================================"),console.log(`
\u53EF\u4EE5\u5F00\u59CB\u4F7F\u7528\u8BC1\u5238\u5DE5\u5177\u4E86\uFF01`),c}catch(c){String(c.message||"").includes("\u67E5\u8BE2key\u5931\u8D25")||(process.stdout.write(`
`),console.error(`\u274C \u6388\u6743\u7ED3\u679C\u5904\u7406\u5931\u8D25: ${c.message}`)),s<o&&await ee(n)}}throw new Error("\u6388\u6743\u8D85\u65F6\uFF085\u5206\u949F\uFF09")}async function se(t=process.argv.slice(2)){let e=Yo(t);if(e.hasLegacyLocalRenderFlags&&console.log("\u63D0\u793A: \u672C\u7248\u672C\u5DF2\u79FB\u9664\u672C\u5730\u6388\u6743\u5C55\u793A\uFF0C\u7EDF\u4E00\u4F7F\u7528\u4E91\u7AEF\u6388\u6743\u94FE\u63A5\u5B8C\u6210\u626B\u7801\u3002"),!e.isPollMode&&!e.forceReauth&&oe()){let r=zt();return console.log(`
\u2713 \u5DF2\u5728\u6388\u6743\u6587\u4EF6\u4E2D\u68C0\u6D4B\u5230\u5DF2\u4FDD\u5B58\u7684 API Key\uFF0C\u65E0\u9700\u91CD\u590D\u626B\u7801\u6388\u6743\u3002`),console.log(`  \u6587\u4EF6\u8DEF\u5F84: ${r}`),console.log(`  \u5982\u9700\u5F3A\u5236\u91CD\u65B0\u6388\u6743\uFF0C\u8BF7\u8FFD\u52A0\u53C2\u6570: --reauth
`),{apiKey:I(),reused:!0}}if(e.isPollMode){if(!e.pollDeviceId)throw new Error("\u7F3A\u5C11 --device-id \u53C2\u6570");return console.log(`
========================================`),console.log("  \u72EC\u7ACB\u8F6E\u8BE2\u6A21\u5F0F"),console.log("========================================"),console.log(`Device ID: ${e.pollDeviceId}`),console.log(`
\u23F3 \u8F6E\u8BE2\u5DF2\u542F\u52A8\uFF085\u5206\u949F\u8D85\u65F6\uFF09`),{apiKey:await Zo(e.pollDeviceId,{statusLabel:"\u7B49\u5F85\u6388\u6743\u786E\u8BA4"}),deviceId:e.pollDeviceId,mode:"poll"}}let o=Go();console.log(`
--- \u4E8C\u7EF4\u7801\u5185\u5BB9\u4FE1\u606F ---`),console.log(`MAC \u5730\u5740:    ${o.macAddress}`),console.log(`UTC \u65F6\u95F4\u6233:  ${o.timestamp}`),console.log(`5\u4F4D\u968F\u673A\u5B57\u7B26: ${o.randomChars}`),console.log(`\u5B8C\u6574\u5185\u5BB9:    ${o.qrbody}`),console.log(`Device ID:   ${o.deviceId}`),console.log(`
========================================`),console.log("  \u4E91\u7AEF\u6388\u6743\u9875\u751F\u6210\u4E2D...  "),console.log(`========================================
`);let n=zo(o.deviceId);return Qo(n),console.log(`[REDACTED_SECRET]`),console.log(`\u7528\u6237\u56DE\u590D\u201C\u5DF2\u626B\u7801\u6388\u6743\u6210\u529F\u201D\u540E\uFF0C\u8BF7\u6267\u884C\uFF1Anode ${Do()} authChecker poll ${o.deviceId}`),{mode:"awaiting-confirmation",deviceId:o.deviceId,authPageUrl:n}}function ce(t,e,o){let n=e||K.host,r=o||K.port,s=I()||"";return new Promise((i,c)=>{let a=xo.request({hostname:n,port:r,path:`${K.path}?session_id=${t}`,method:"GET",timeout:5e3,headers:{channel:Vt,platform:Yt,"api-key":s,"jwt-assertion":"",usercode:"","device-info":te,"skill-name":Qt,version:Zt}},l=>{let p="";l.on("data",d=>{p+=d}),l.on("end",()=>{try{i(JSON.parse(p))}catch{c(new Error(`\u89E3\u6790\u54CD\u5E94\u5931\u8D25: ${p}`))}})});a.on("error",l=>c(new Error(`\u8BF7\u6C42\u5931\u8D25: ${l.message}`))),a.on("timeout",()=>{a.destroy(),c(new Error("\u8BF7\u6C42\u8D85\u65F6"))}),a.end()})}async function Xo(t,e={}){let o=e.interval||K.checkInterval,n=e.timeout||K.timeout,r=e.onProgress||(()=>{}),s=Date.now(),i=0;for(;Date.now()-s<n;){i+=1;try{let c=await ce(t,e.customHost,e.customPort),a=c?.["api-key"]||c?.api_key||c?.result?.["api-key"]||c?.result?.api_key;if(a&&String(a).trim()){let l=String(a).trim();return V(l),console.log(`
\u2713 \u6388\u6743\u6210\u529F\uFF01\u5DF2\u83B7\u53D6 API Key`),console.log("\u539F\u59CB\u54CD\u5E94:",JSON.stringify(c)),l}if(c?.status==="failed"||c?.error||c?.result?.status==="failed")throw new Error(c.error||c?.result?.error||"\u6388\u6743\u5931\u8D25")}catch(c){if(c.message==="\u6388\u6743\u5931\u8D25"||c.message.includes("\u6388\u6743")&&!c.message.includes("expired"))throw c}r(i),await ee(o)}throw new Error(`\u6388\u6743\u8D85\u65F6: \u5728 ${n/1e3} \u79D2\u5185\u672A\u6536\u5230\u6388\u6743\u54CD\u5E94`)}async function ie(){let t=process.argv[2];if(!t||t==="help"||t==="--help"||t==="-h"){console.log(`
\u6388\u6743\u68C0\u67E5\u6A21\u5757
============

\u7528\u6CD5:
  node auth-checker.js check                # \u68C0\u67E5\u6388\u6743\u72B6\u6001
  node auth-checker.js poll <token>         # \u7528\u6237\u786E\u8BA4\u626B\u7801\u6210\u529F\u540E\uFF0C\u4F7F\u7528 token \u67E5\u8BE2\u6388\u6743\u7ED3\u679C
  node auth-checker.js auth                 # \u751F\u6210\u4E91\u7AEF\u6388\u6743\u94FE\u63A5\u5E76\u7B49\u5F85\u7528\u6237\u786E\u8BA4
  node auth-checker.js clear                # \u5DF2\u7981\u7528\uFF0C\u4E0D\u5220\u9664\u6388\u6743\u6587\u4EF6
  node auth-checker.js help                 # \u663E\u793A\u5E2E\u52A9\u4FE1\u606F
`);return}if(t==="check"){if(re()){let e=I();console.log("\u2713 \u5DF2\u6388\u6743"),console.log(`API Key: ${e.substring(0,8)}...${e.substring(e.length-8)}`)}else console.log("\u2717 \u672A\u6388\u6743"),process.exit(1);return}if(t==="poll"){let e=process.argv[3];e||(console.error("\u9519\u8BEF: \u8BF7\u63D0\u4F9B url\u540E\u9762\u7684token"),process.exit(1));try{V(await ft(e)),console.log(`
\u2713 \u6388\u6743\u6210\u529F\uFF01`)}catch(o){console.error(`
\u2717 ${o.message}`),process.exit(1)}return}if(t==="auth")try{if((await se(process.argv.slice(3)))?.mode==="awaiting-confirmation"){console.log(`
\u2713 \u5DF2\u751F\u6210\u4E91\u7AEF\u6388\u6743\u94FE\u63A5\uFF0C\u8BF7\u5728\u7528\u6237\u786E\u8BA4\u201C\u5DF2\u626B\u7801\u6388\u6743\u6210\u529F\u201D\u540E\u518D\u6267\u884C poll\u3002`);return}console.log(`
\u2713 \u6388\u6743\u6D41\u7A0B\u5B8C\u6210\uFF01`);return}catch(e){console.error(`
\u2717 \u6388\u6743\u5931\u8D25: ${e.message}`),process.exit(1)}if(t==="clear"){ne();return}console.error(`\u672A\u77E5\u547D\u4EE4: ${t}`),process.exit(1)}dt.exports={checkAuthStatus:ce,clearAuth:ne,hasStoredApiKey:oe,isAuthorized:re,loadApiKey:I,main:ie,performAuthFlow:se,pollAuthServer:Xo,queryKeyFromClawServer:ft,saveApiKey:V};require.main===dt&&ie().catch(t=>{console.error("\u9519\u8BEF:",t.message),process.exit(1)})});var ue=M((En,le)=>{var tn={deviceId:"",mobile:"",userCode:""};le.exports=tn});var gt=M((On,we)=>{var pe=require("https"),{getApiKey:mt,getJwtTokenFromApiKey:fe,parseUserCodeFromJwt:ht}=F(),{loadGateways:en}=L(),{SKILL_CHANNEL:de,SKILL_NAME:me,SKILL_PLATFORM:he,SKILL_VERSION:ge,getMacAddress:on}=ut(),D=ue(),ye=on();async function nn(){let t=mt()||"",e=fe(),o=ht(e),r=en().usercode,i=JSON.stringify({jsonrpc:"2.0",id:2,method:"tools/call",params:{name:"get-usercode",arguments:{mobileUserCode:o}}}),c=new URL(r),l=(await new Promise((p,d)=>{let m=pe.request({hostname:c.hostname,port:c.port||443,path:c.pathname,method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(i),channel:de,platform:he,"api-key":t,"jwt-assertion":e,usercode:o,"device-info":ye,"skill-name":me,version:ge},rejectUnauthorized:!0},h=>{let y="";h.on("data",k=>{y+=k}),h.on("end",()=>{try{p(JSON.parse(y))}catch{d(new Error(`\u89E3\u6790\u5931\u8D25: ${y}`))}})});m.on("error",d),m.write(i),m.end()}))?.result?.content?.[0]?.text;if(l){let p=JSON.parse(l);D.mobile=p?.data?.mobile||"",D.userCode=p?.data?.userCode||""}}async function rn(t,e,o={},n={}){let r=mt()||"",s=fe(),i=t.includes("optionalStock"),c=o;if(i){await nn();let l=mt(),p=l?l.split("||"):[],d=p[0]||"",m=p[1]||"",h=D.mobile||"",y=h,k=D.userCode||ht(s)||"";o?.name==="get_optionalStock"?c=Object.assign({},o,{arguments:Object.assign({PAGE_SIZE:"1000",PAGE_NO:"1",ACCT_TYPE:"6"},o?.arguments||{},{key:s,mobileNo:h,mobileUserCode:k,socketPwd:"",userToken:m,gtIwmId:d,ACCT_CODE:y})}):o?.name==="op_optionalStock"?c=Object.assign({},o,{arguments:Object.assign({ACCT_TYPE:"6",GROUP_NO:"0"},o?.arguments||{},{key:s,mobileNo:h,mobileUserCode:k,socketPwd:"",userToken:m,gtIwmId:d,ACCT_CODE:y})}):c=Object.assign({},o,{arguments:Object.assign({},o?.arguments||{},{key:s,mobileNo:h,mobileUserCode:k,socketPwd:"",userToken:m,gtIwmId:d,ACCT_CODE:y})})}else c=Object.assign({},o,{arguments:Object.assign({},o?.arguments||{},{key:s})});let a=D.userCode||ht(s)||"";return new Promise((l,p)=>{let d=JSON.stringify({jsonrpc:"2.0",id:2,method:e,params:c}),m=new URL(t),h={hostname:m.hostname,port:m.port||443,path:m.pathname,method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(d),channel:de,platform:he,"api-key":Object.prototype.hasOwnProperty.call(n,"api-key")?n["api-key"]:r,"jwt-assertion":s,usercode:a,...n,"device-info":ye,"skill-name":me,version:ge},rejectUnauthorized:!0},y=pe.request(h,k=>{let N="";k.on("data",u=>{N+=u}),k.on("end",()=>{try{l(JSON.parse(N))}catch{p(new Error(`\u89E3\u6790\u54CD\u5E94\u5931\u8D25: ${N}`))}})});y.on("error",p),y.write(d),y.end()})}we.exports={sendJsonRpcRequest:rn}});var _t=M(($n,wt)=>{var{getApiKey:_e,formatCliOutput:sn,parseJsonTextSafely:cn}=F(),{loadGateways:an}=L(),{sendJsonRpcRequest:ln}=gt(),ke="\u8BF7\u5148\u6267\u884C\u672C\u9879\u76EE\u6388\u6743\uFF0C\u4F8B\u5982: node index.js authChecker auth";function Se(t){if(t.error)return{error:t.error.message};if(t.result?.content){let e=t.result.content.find(o=>o.type==="text");if(e){let o=cn(e.text);return o!==null?o:{text:e.text}}}return t.result||t}function yt(t){return{...t,market_data_mask:{mask:{M_64_0:549755813887}},product_mask:{mask:{M_64_0:111111}}}}function q(t){return Array.isArray(t)?t.map(e=>yt(e&&typeof e=="object"?e:{code:String(e).trim()})).filter(e=>e.code):typeof t=="string"?t.split(",").map(e=>e.trim()).filter(e=>e!=="").map(e=>yt({code:e})):[]}function Ae(t){let e={},o=new Set(["stocks","symbols","reduced_codes"]);return t.forEach(n=>{let r="",s="",i=n.indexOf("=");if(i>0)r=n.substring(0,i),s=n.substring(i+1);else if(n.startsWith("reduced_codes:")){let a=n.indexOf(":");r=n.substring(0,a),s=n.substring(a+1)}if(!r)return;if(r==="reduced_codes"){let a=s.trim();if(a.startsWith("[")||a.startsWith("{"))try{e[r]=q(JSON.parse(a));return}catch{}}if(s.startsWith("[")||s.startsWith("{"))try{let a=JSON.parse(s);e[r]=a,r==="reduced_codes"&&(e[r]=q(e[r]));return}catch{}let c=s.includes(",")?s.split(",").map(a=>a.trim()).filter(a=>a!==""):[s];if(Object.prototype.hasOwnProperty.call(e,r)){let a=Array.isArray(e[r])?e[r]:[e[r]];e[r]=a.concat(c)}else e[r]=c.length===1?c[0]:c;o.has(r)&&!Array.isArray(e[r])&&(e[r]=[e[r]]),r==="reduced_codes"&&(e[r]=q(e[r]))}),e}function un(t,e,o={}){if(t!=="market"||e!=="marketdata-tool")return o;let n={...o};if(Object.prototype.hasOwnProperty.call(n,"reduced_codes"))return n.reduced_codes=q(n.reduced_codes),n;let r=[n.code,n.codes,n.stocks,n.symbols].filter(i=>i!==void 0);if(!r.length)return n;delete n.code,delete n.codes,delete n.stocks,delete n.symbols;let s=r.flatMap(i=>Array.isArray(i)?i:[i]);return n.reduced_codes=q(s),n}function Ce(t,e){if(t==="optionalStock"&&e==="op_optionalStock")throw new Error("\u81EA\u9009\u80A1\u589E\u5220\u64CD\u4F5C\u4E0D\u5141\u8BB8\u76F4\u63A5\u901A\u8FC7 mcpClient call \u65B9\u5F0F\u6267\u884C\uFF0C\u8BF7\u4F7F\u7528 node index.js editWatchlist add/remove ...")}async function Ne(t,e,o={}){Ce(t,e);let n=an(),r=n[t];if(!r)throw new Error(`\u672A\u77E5\u7F51\u5173: ${t}\uFF0C\u53EF\u7528\u7F51\u5173: ${Object.keys(n).join(", ")}`);try{let l=_e();if(!l||l.trim()==="")throw new Error(`\u672A\u6388\u6743: ${ke}`)}catch(l){throw new Error(`\u6388\u6743\u68C0\u67E5\u5931\u8D25: ${l.message}`)}let s=un(t,e,o),i={"api-key":_e()},a=await ln(r,"tools/call",{name:e,arguments:s},i);if(a.error)throw new Error(`\u5DE5\u5177\u8C03\u7528\u5931\u8D25: ${a.error.message}`);return Se(a)}function pn(){console.log(`
MCP \u5DE5\u5177\u8C03\u7528\u811A\u672C
=================

\u7528\u6CD5:
  node mcp-client.js call <gateway> <toolName> [key=value ...]

\u793A\u4F8B:
  node mcp-client.js call market marketdata-tool reduced_codes=SH600000
  node mcp-client.js call info get_hotRank

\u6388\u6743:
  \u8BF7\u4F7F\u7528 authChecker \u5B8C\u6210\u6388\u6743
`)}async function be(){let t=process.argv.slice(2),e=t[0];if(!e||e==="help"){pn();return}if(["auth","auth-qr","auth-info","poll","check","clear"].includes(e)){console.error(ke),process.exit(1);return}if(e==="call"){try{let o=String(t[1]||"").trim(),n=String(t[2]||"").trim();if(!o||!n)throw new Error("\u7528\u6CD5: node mcp-client.js call <gateway> <toolName> [key=value ...]");let r=Ae(t.slice(3)),s=await Ne(o,n,r);console.log(sn(o,n,s))}catch(o){console.error(JSON.stringify({error:o.message})),process.exit(1)}return}console.error(`\u672A\u77E5\u547D\u4EE4: ${e}\uFF0C\u8BF7\u4F7F\u7528 help \u67E5\u770B\u5E2E\u52A9`),process.exit(1)}wt.exports={parseResponse:Se,parseKvArgs:Ae,assertAllowedToolInvocation:Ce,callTool:Ne,main:be};require.main===wt&&be().catch(t=>{console.error(JSON.stringify({error:t.message})),process.exit(1)})});var St=M((Pn,kt)=>{var Ee=require("fs"),Oe=require("path");function $e(){let e=[Oe.join(__dirname,"stock_code_name.json"),Oe.join(__dirname,"..","stock_code_name.json")].find(i=>Ee.existsSync(i));if(!e)throw new Error("\u672A\u627E\u5230 stock_code_name.json");let o=Ee.readFileSync(e,"utf8"),n=JSON.parse(o);if(!Array.isArray(n))throw new Error("stock_code_name.json \u5E94\u4E3A { code, name }[] \u6570\u7EC4");let r={},s={};for(let i=0;i<n.length;i+=1){let c=n[i];if(!c||typeof c!="object")continue;let a=String(c.code??"").trim(),l=String(c.name??"").trim();a&&l&&(r[l]=a,s[a]=l)}return{nameToCode:r,codeToName:s}}function Pe(t,e){return e.nameToCode[t]||null}function je(t,e){return e.codeToName[t]||null}kt.exports={loadStockMapping:$e,findCodeByName:Pe,findNameByCode:je};if(require.main===kt){let t=$e();console.log("\u6620\u5C04\u8868\u52A0\u8F7D\u6210\u529F\uFF0C\u5171",Object.keys(t.codeToName).length,"\u6761\u8BB0\u5F55");let e=["\u56FD\u6CF0\u6D77\u901A","\u5E73\u5B89\u94F6\u884C","\u8D35\u5DDE\u8305\u53F0","\u6D66\u53D1\u94F6\u884C"];console.log(`
\u540D\u79F0\u67E5\u8BE2\u6D4B\u8BD5:`),e.forEach(n=>{let r=Pe(n,t);console.log(`  ${n} -> ${r||"\u672A\u627E\u5230"}`)});let o=["SH601211","SZ000001","SH600519"];console.log(`
\u4EE3\u7801\u67E5\u8BE2\u6D4B\u8BD5:`),o.forEach(n=>{let r=je(n,t);console.log(`  ${n} -> ${r||"\u672A\u627E\u5230"}`)})}});var Ge=M((jn,Nt)=>{var{callTool:Me}=_t(),{extractMarketItems:xe,formatNumber:Q,formatToolResult:Ie,getApiKey:Re,getMarketItemScales:fn,parseJsonTextSafely:dn,ratioScaledToDisplayPercent:mn,readNumericField:At,scaleRaw:Te}=F(),{loadGateways:ve}=L(),{sendJsonRpcRequest:Fe}=gt(),Le="\u8BF7\u5148\u6267\u884C\u672C\u9879\u76EE\u6388\u6743\uFF0C\u4F8B\u5982: node index.js authChecker auth";function Ke(){return St()}function De(t){let e=String(t||"").trim();if(!e)throw new Error("\u80A1\u7968\u4EE3\u7801\u6216\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A");let o=Ke(),n=o.loadStockMapping();if(/^(SH|SZ|HK|US|UK|SX|BJ)\d+$/i.test(e)){let s=e.toUpperCase(),i=o.findNameByCode(s,n);if(!i)throw new Error(`\u80A1\u7968\u4EE3\u7801\u4E0D\u5B58\u5728\u4E8E stock_code_name.json: ${s}`);return console.log(`  \u2713 "${e}" \u2192 ${s} (${i})`),s}let r=o.findCodeByName(e,n);if(r)return console.log(`  \u2713 "${e}" \u2192 ${r}`),r;throw new Error(`\u80A1\u7968\u540D\u79F0\u4E0D\u5B58\u5728\u4E8E stock_code_name.json: ${e}`)}function qe(t=[]){return t.map(e=>{let o=String(e||"").split(","),n=String(o[0]||"").trim(),r=String(o[1]||"").trim().toUpperCase();return{code:n,market:r,fullCode:`${r}${n}`}}).filter(e=>e.code&&e.market)}async function hn(){let e=(await Y())?.result?.content?.[0]?.text||"",o=Ct(e),n=qe(o);if(n.length===0)return[];let r={};try{let s=await Me("market","marketdata-tool",{reduced_codes:n.map(a=>a.fullCode)}),i=Ie("market","marketdata-tool",s),c=xe(i);for(let a of c){let l=String(a.code||"").trim(),p=String(a.name||"").trim();l&&p&&(r[l]=p)}}catch{}return n.map(s=>({...s,name:r[s.fullCode]||r[s.code]||""}))}function gn(t,e){let o=String(t||"").trim();if(!o)throw new Error("\u5220\u9664\u65F6\u4F20\u5165\u4E86\u7A7A\u7684\u80A1\u7968\u6807\u8BC6");let n=o.toUpperCase();if(/^(SH|SZ|HK|US|UK|SX|BJ)\d+$/i.test(o)){let s=e.find(i=>i.fullCode===n);if(!s)throw new Error(`\u672A\u5728\u3010\u6211\u7684\u81EA\u9009\u3011\u5206\u7EC4\u4E2D\u627E\u5230\u80A1\u7968: ${o}`);return s.fullCode}if(/^\d+$/.test(o)){let s=e.filter(i=>i.code===o);if(s.length===1)return console.log(`  \u2713 "${o}" \u2192 ${s[0].fullCode}`),s[0].fullCode;if(s.length>1)throw new Error(`\u3010\u6211\u7684\u81EA\u9009\u3011\u5206\u7EC4\u4E2D\u5B58\u5728\u591A\u4E2A\u4EE3\u7801\u4E3A ${o} \u7684\u80A1\u7968\uFF0C\u8BF7\u4F7F\u7528\u5B8C\u6574\u5E02\u573A\u4EE3\u7801\u5220\u9664`)}let r=e.filter(s=>s.name===o);if(r.length===1)return console.log(`  \u2713 "${o}" \u2192 ${r[0].fullCode}`),r[0].fullCode;throw r.length>1?new Error(`\u3010\u6211\u7684\u81EA\u9009\u3011\u5206\u7EC4\u4E2D\u5B58\u5728\u591A\u4E2A\u540D\u79F0\u4E3A ${o} \u7684\u80A1\u7968\uFF0C\u8BF7\u4F7F\u7528\u80A1\u7968\u4EE3\u7801\u5220\u9664`):new Error(`\u672A\u5728\u3010\u6211\u7684\u81EA\u9009\u3011\u5206\u7EC4\u4E2D\u627E\u5230\u80A1\u7968: ${o}`)}async function Be(t,e){if(!Re())throw new Error(`\u672A\u6388\u6743\uFF0C${Le}`);let n=ve().optionalStock;if(!n)throw new Error("\u672A\u914D\u7F6E optionalStock \u7F51\u5173");let r=e==="remove"?"11":"10",s=t.map(a=>({STOCK_CODE:a.substring(2),MARKET_CODE:a.substring(0,2),GROUP_NO:"0"}));return await Fe(n,"tools/call",{name:"op_optionalStock",arguments:{ACTION_FLAG:r,BATCH_DATA:s}})}async function Ue(t,e={}){if(!Re())throw new Error(`\u672A\u6388\u6743\uFF0C${Le}`);let n=ve().optionalStock;if(!n)throw new Error("\u672A\u914D\u7F6E optionalStock \u7F51\u5173");return Fe(n,"tools/call",{name:t,arguments:e})}async function Y(){return Ue("get_optionalStock")}function Ct(t){let e=String(t||"").trim();if(!e)return[];function o(i){let c=String(i||"").trim();if(!c)return null;let a=c.split(/\|(?=\d+,[^|:,]+,\d+:)/).map(l=>l.trim()).filter(Boolean);for(let l of a){let p=l.indexOf(":");if(p<0)continue;let d=l.slice(0,p).split(",");if(String(d[1]||"").trim()==="\u6211\u7684\u81EA\u9009")return l.slice(p+1).split(";").map(h=>h.trim()).filter(Boolean)}return null}function n(i,c){if(Array.isArray(i)){i.forEach(a=>n(a,c));return}!i||typeof i!="object"||(typeof i.STK_CONTENT=="string"&&c.push(i.STK_CONTENT),Object.values(i).forEach(a=>n(a,c)))}let r=dn(e),s=[];r!==null&&n(r,s),s.length===0&&(e.match(/"STK_CONTENT"\s*:\s*"([^"]+)"/g)||[]).forEach(c=>{let a=c.match(/"STK_CONTENT"\s*:\s*"([^"]+)"/);a&&a[1]&&s.push(a[1])});for(let i of s){let c=o(i);if(c)return c}return[]}async function He(){let e=(await Y())?.result?.content?.[0]?.text||"",o=Ct(e);if(o.length===0){console.log(`
\u{1F4CB} \u81EA\u9009\u80A1\u5217\u8868\u4E3A\u7A7A
`);return}let n=qe(o),r=n.map(u=>u.fullCode);console.log(`
\u{1F4CA} \u81EA\u9009\u80A1\u884C\u60C5\u67E5\u8BE2`),console.log("=".repeat(62));let s={};try{let u=await Me("market","marketdata-tool",{reduced_codes:r}),f=Ie("market","marketdata-tool",u),S=xe(f);for(let w of S){let C=String(w.code||"").trim();if(!C)continue;let{priceDivisor:E,ratioDivisor:T}=fn(w),g=Object.prototype.hasOwnProperty.call(w,"last_price"),b=Object.prototype.hasOwnProperty.call(w,"change_rate"),v=Object.prototype.hasOwnProperty.call(w,"capital_flow")?Te(At(w.capital_flow),E):null;s[C]={code:C,name:String(w.name||"").trim(),last_price:g?Te(At(w.last_price),E):null,change_rate:b?mn(At(w.change_rate),T):null,capital_flow:v===0?null:v}}}catch(u){console.error(`
\u274C \u884C\u60C5\u67E5\u8BE2\u5931\u8D25: ${u.message}`)}function i(u){return u==null||typeof u=="string"&&u.trim()===""}function c(u){if(i(u))return"--";let f=Number(u);return isNaN(f)?"--":Q(f,3)}function a(u){if(i(u))return"--";let f=Number(u);return isNaN(f)?"--":`${f>=0?"+":""}${f.toFixed(2)}%`}function l(u){if(i(u))return"--";let f=Number(u);return isNaN(f)||f===0?"--":Math.abs(f)>=1e8?`${Q(f/1e8,2)}\u4EBF`:Math.abs(f)>=1e4?`${Q(f/1e4,2)}\u4E07`:Q(f,2)}let p=["\u540D\u79F0","\u4EE3\u7801","\u6700\u65B0\u4EF7","\u6DA8\u8DCC\u5E45","\u5F53\u65E5\u8D44\u91D1\u51C0\u6D41\u5165"],d=[1,1,1,1,1],m=p.map(u=>[...u].reduce((f,S)=>f+(S.charCodeAt(0)>255?2:1),0));for(let u of n){let f=s[u.fullCode]||s[u.code]||{},S=f.name||"--",w=c(f.last_price),C=a(f.change_rate),E=l(f.capital_flow),T=[[...String(S)].reduce((g,b)=>g+(b.charCodeAt(0)>255?2:1),0),u.fullCode.length,[...String(w)].reduce((g,b)=>g+(b.charCodeAt(0)>255?2:1),0),[...String(C)].reduce((g,b)=>g+(b.charCodeAt(0)>255?2:1),0),[...String(E)].reduce((g,b)=>g+(b.charCodeAt(0)>255?2:1),0)];for(let g=0;g<5;g++)T[g]>m[g]&&(m[g]=T[g])}function h(u,f){let S=[...String(u)].reduce((T,g)=>T+(g.charCodeAt(0)>255?2:1),0),w=m[f],C=Math.floor((w-S)/2),E=w-S-C;return" ".repeat(d[f]+C)+u+" ".repeat(d[f]+E)}function y(){return"+"+m.map((u,f)=>"-".repeat(u+d[f]*2)).join("+")+"+"}function k(u){return"|"+u.map((f,S)=>h(f,S)).join("|")+"|"}if(n.every(u=>!(s[u.fullCode]||s[u.code]||{}).code)){console.log("\uFF08\u884C\u60C5\u6570\u636E\u83B7\u53D6\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u6216\u6388\u6743\u72B6\u6001\uFF09"),console.log("");return}console.log(""),console.log(y()),console.log(k(p)),console.log(y());for(let u of n){let f=s[u.fullCode]||s[u.code]||{},S=f.name||"--",w=c(f.last_price),C=a(f.change_rate),E=l(f.capital_flow);console.log(k([S,u.fullCode,w,C,E]))}console.log(y()),console.log("")}function Je(){let t=process.argv.slice(2);if(t.length===0&&(console.log(__filename+" <listQuote|add|remove> <\u80A1\u7968\u4EE3\u7801\u6216\u540D\u79F0...>"),console.log("\u793A\u4F8B: node skill-entry.js editWatchlist listQuote              # \u67E5\u8BE2\u81EA\u9009\u80A1\u884C\u60C5"),console.log("      node skill-entry.js editWatchlist add SH601211 SZ300069  # \u6DFB\u52A0\u81EA\u9009\u80A1"),console.log("      node skill-entry.js editWatchlist remove SH601211         # \u5220\u9664\u81EA\u9009\u80A1"),process.exit(1)),t[0]==="listQuote")return{operation:"listQuote",stocks:[]};let e="add";if(t[0]==="add"||t[0]==="remove"?(e=t[0],t.shift()):(t[0]==="-d"||t[0]==="--delete"||t[0]==="delete")&&(e="remove",t.shift()),t.length===0)throw new Error("\u8BF7\u63D0\u4F9B\u8981\u64CD\u4F5C\u7684\u80A1\u7968\u4EE3\u7801\u6216\u540D\u79F0");return{operation:e,stocks:t}}async function We(){try{let{operation:t,stocks:e}=Je();if(t==="listQuote"){await He();return}console.log(`
\u{1F4CA} \u81EA\u9009\u80A1${t==="remove"?"\u5220\u9664":"\u6DFB\u52A0"}\u64CD\u4F5C`),console.log("=".repeat(50));let o=[];if(t==="remove"){let l=await hn();if(l.length===0)throw new Error("\u3010\u6211\u7684\u81EA\u9009\u3011\u5206\u7EC4\u4E3A\u7A7A\uFF0C\u65E0\u6CD5\u5220\u9664");for(let p of e)try{let d=gn(p,l);o.push(d)}catch(d){console.error(`  \u2717 ${d.message}`)}}else for(let l of e)try{let p=De(l);o.push(p)}catch{throw new Error("\u6DFB\u52A0\u81EA\u9009\u80A1\u5931\u8D25")}if(o.length===0)throw new Error("\u6CA1\u6709\u6709\u6548\u7684\u80A1\u7968\u4EE3\u7801");console.log(`
\u{1F4DD} \u5C06\u8981${t==="remove"?"\u5220\u9664":"\u6DFB\u52A0"}: ${o.join(", ")}
`);let n=await Be(o,t),s=(n?.result?.content?.[0]?.text||"").match(/"TOTAL_NUM"\s*:\s*"(\d+)"/);if(s){let l=s[1];console.log(`\u2705 \u64CD\u4F5C\u6210\u529F\uFF01\u5F53\u524D\u81EA\u9009\u80A1\u6570\u91CF: ${l}`)}else{if(n?.error)throw new Error(n.error.message||n.error);console.log("\u2705 \u64CD\u4F5C\u5B8C\u6210")}console.log("\u2139\uFE0F \u6DFB\u52A0\u3001\u5220\u9664\u81EA\u9009\u80A1\u4E4B\u540E\uFF0C\u5982\u9700\u5728APP\u786E\u8BA4\uFF0C\u8BF7\u91CD\u542FAPP\u540E\u9A8C\u8BC1\u3002");let c=(await Y())?.result?.content?.[0]?.text||"",a=Ct(c);if(a.length>0){let l=null,p=null;try{l=Ke(),p=l.loadStockMapping()}catch{console.log("\u26A0\uFE0F \u80A1\u7968\u540D\u79F0\u6620\u5C04\u52A0\u8F7D\u5931\u8D25\uFF0C\u5DF2\u8DF3\u8FC7\uFF08\u4EC5\u663E\u793A\u4EE3\u7801\uFF09")}let d=a.map((m,h)=>{let[y,k]=m.split(","),N=`${(k||"").toUpperCase()}${y}`,u=l&&p&&l.findNameByCode(N,p)||N;return`${h+1}. ${u} (${N})`});console.log(d.join(`
`)),console.log(`
\u5171 ${a.length} \u53EA\u80A1\u7968`)}}catch(t){console.error(`
\u274C \u9519\u8BEF: ${t.message}`),process.exit(1)}}Nt.exports={resolveStockCode:De,editWatchlist:Be,callWatchlistTool:Ue,listWatchlist:Y,listWatchlistWithQuote:He,parseArgs:Je,main:We};require.main===Nt&&We().catch(t=>{console.error(`
\u274C \u9519\u8BEF: ${t.message}`),process.exit(1)})});var Z=ae(),X=_t(),tt=Ge(),et=St();function Ve(){let e=String(process.argv[1]||"index.js").split(/[\\/]/);return e[e.length-1]||"index.js"}var Qe={isAuthorized:Z.isAuthorized,checkAuthStatus:Z.checkAuthStatus,loadApiKey:Z.loadApiKey,main:Z.main},Ye={callTool:X.callTool,parseKvArgs:X.parseKvArgs,parseResponse:X.parseResponse,main:X.main},Ze={listWatchlist:tt.listWatchlist,listWatchlistWithQuote:tt.listWatchlistWithQuote,callWatchlistTool:tt.callWatchlistTool,main:tt.main};function yn(){let t=Ve();console.log(`
stockMap \u7528\u6CD5:
  node ${t} stockMap codeByName <\u80A1\u7968\u540D\u79F0>
  node ${t} stockMap nameByCode <\u80A1\u7968\u4EE3\u7801>
  node ${t} stockMap stats

\u793A\u4F8B:
  node ${t} stockMap codeByName \u8D35\u5DDE\u8305\u53F0
  node ${t} stockMap nameByCode SH600519
  node ${t} stockMap stats
`)}async function ze(t=[]){let e=t[0];if(!e||e==="help"||e==="--help"||e==="-h"){yn();return}let o=et.loadStockMapping();if(e==="codeByName"){let n=t.slice(1).join(" ").trim();if(!n)throw new Error("\u7528\u6CD5: node index.js stockMap codeByName <\u80A1\u7968\u540D\u79F0>");console.log(et.findCodeByName(n,o)||"\u672A\u627E\u5230");return}if(e==="nameByCode"){let n=String(t[1]||"").trim();if(!n)throw new Error("\u7528\u6CD5: node index.js stockMap nameByCode <\u80A1\u7968\u4EE3\u7801>");console.log(et.findNameByCode(n,o)||"\u672A\u627E\u5230");return}if(e==="stats"){console.log(Object.keys(o.codeToName).length);return}throw new Error(`\u672A\u77E5 stockMap \u547D\u4EE4: ${e}`)}var wn={authChecker:Qe.main,mcpClient:Ye.main,editWatchlist:Ze.main,stockMap:ze,stock_map:ze};function _n(){let t=Ve();console.log(`
\u7528\u6CD5:
  node ${t} <\u6A21\u5757\u540D> [\u53C2\u6570...]

\u53EF\u9009\u6A21\u5757:
  authChecker   \u6388\u6743\u7BA1\u7406\uFF08auth/check/poll/clear\uFF09
  mcpClient     MCP \u5DE5\u5177\u8C03\u7528\uFF08call optionalStock <toolName> [key=value...]\uFF09
  editWatchlist \u81EA\u9009\u80A1\u7BA1\u7406\uFF08add/remove <\u80A1\u7968\u4EE3\u7801\u6216\u540D\u79F0...>\uFF09
  stockMap      \u80A1\u7968\u540D\u79F0/\u4EE3\u7801\u6620\u5C04\u67E5\u8BE2

\u6388\u6743:
  node ${t} authChecker auth
`)}async function Xe(t=process.argv.slice(2)){let e=t[0],o=t.slice(1);if(!e||e==="help"||e==="--help"||e==="-h"){_n();return}let n=wn[e];if(typeof n!="function")throw new Error(`\u672A\u77E5\u6A21\u5757: ${e}`);let r=process.argv;process.argv=[r[0],r[1],...o];try{await n(o)}finally{process.argv=r}}module.exports={authChecker:Qe,mcpClient:Ye,editWatchlist:Ze,stockMap:et,runCli:Xe};require.main===module&&Xe().catch(t=>{console.error(`\u9519\u8BEF: ${t.message}`),process.exit(1)});


Security scan verdicts — ClawScan: suspicious | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (MEDIUM)