@zltquant/zlt-mcp 0.1.0-rc.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config.json +70 -309
- package/package.json +1 -1
- package/zlt-mcp-proxy.bundle.cjs +259 -75
package/config.json
CHANGED
|
@@ -167,7 +167,7 @@
|
|
|
167
167
|
]
|
|
168
168
|
},
|
|
169
169
|
{
|
|
170
|
-
"name": "mcp-create-tree",
|
|
170
|
+
"name": "mcp-create-strategy-tree",
|
|
171
171
|
"description": "创建策略分类。",
|
|
172
172
|
"inputSchema": {
|
|
173
173
|
"type": "object",
|
|
@@ -213,7 +213,7 @@
|
|
|
213
213
|
"timeoutParamKey": "timeout"
|
|
214
214
|
},
|
|
215
215
|
{
|
|
216
|
-
"name": "mcp-get-tree",
|
|
216
|
+
"name": "mcp-get-strategy-tree-list",
|
|
217
217
|
"description": "获取策略分类列表。treeType 为分类类型,strategy 表示默认策略树,research 表示策略研究树,默认 strategy;parentId 为父级分类 ID,可选,不传时仅按 treeType 查询。",
|
|
218
218
|
"inputSchema": {
|
|
219
219
|
"type": "object",
|
|
@@ -271,11 +271,11 @@
|
|
|
271
271
|
"properties": {
|
|
272
272
|
"exchange_id": {
|
|
273
273
|
"type": "string",
|
|
274
|
-
"description": "
|
|
274
|
+
"description": "市场标识,取值与构词见 mcp-download-data 同名参数(sh/sz/bj 股票;zj/zs/ds/sq/gq 期货)。财务(pr/co)和市场规则(mr)没有市场维度,省略本字段;ETF(etf)有市场维度,本工具必须显式传 exchange_id:实测省略时上游返回空 times,会被误读成本地没有数据。"
|
|
275
275
|
},
|
|
276
276
|
"data_type": {
|
|
277
277
|
"type": "string",
|
|
278
|
-
"description": "数据类型 token
|
|
278
|
+
"description": "数据类型 token,按不透明字符串原样使用,不要拆分。构词与全表见 mcp-download-data 同名参数;例如 dk1 日线·股票、mk5 分钟线·期货,非行情类别 pr、co、mr、etf。"
|
|
279
279
|
}
|
|
280
280
|
},
|
|
281
281
|
"required": [
|
|
@@ -364,7 +364,7 @@
|
|
|
364
364
|
"responseTransform": "downloadProgress"
|
|
365
365
|
},
|
|
366
366
|
{
|
|
367
|
-
"name": "mcp-
|
|
367
|
+
"name": "mcp-get-cloud-data-list",
|
|
368
368
|
"description": "查询云端可下载的数据范围,只读,不创建任务,不改本地缓存。用于回答「云端有没有这段历史」——本地 mcp-get-data-range 只说明已经下过什么,不代表上游只有这些。Data 内按序列返回 series(market、datatype、sectype、startDate、endDate、objectCount、totalBytes)、totalObjects、truncated 和 nextAction。totalBytes 是该序列云端对象的总字节数,可用来向用户说明下载量。truncated=true 表示上游还有更多对象未列出,不能当作完整范围。",
|
|
369
369
|
"inputSchema": {
|
|
370
370
|
"type": "object",
|
|
@@ -385,7 +385,7 @@
|
|
|
385
385
|
"properties": {
|
|
386
386
|
"exchange_id": {
|
|
387
387
|
"type": "string",
|
|
388
|
-
"description": "
|
|
388
|
+
"description": "市场标识,取值与构词见 mcp-download-data 同名参数。财务(pr/co)和市场规则(mr)没有市场维度,省略本字段;ETF(etf)有市场维度;本工具省略 exchange_id 时按全部市场展开。注意 mcp-get-data-range 不同,那边必须显式传。"
|
|
389
389
|
},
|
|
390
390
|
"data_type": {
|
|
391
391
|
"type": "string",
|
|
@@ -436,11 +436,11 @@
|
|
|
436
436
|
"properties": {
|
|
437
437
|
"exchange_id": {
|
|
438
438
|
"type": "string",
|
|
439
|
-
"description": "
|
|
439
|
+
"description": "市场标识,取值与构词见 mcp-download-data 同名参数。财务(pr/co)和市场规则(mr)没有市场维度,省略本字段;ETF(etf)有市场维度;本工具省略 exchange_id 时按全部市场展开。注意 mcp-get-data-range 不同,那边必须显式传。"
|
|
440
440
|
},
|
|
441
441
|
"data_type": {
|
|
442
442
|
"type": "string",
|
|
443
|
-
"description": "数据类型 token
|
|
443
|
+
"description": "数据类型 token,按不透明字符串原样使用,不要拆分。构词与全表见 mcp-download-data 同名参数;例如 dk1 日线·股票、mk5 分钟线·期货,非行情类别 pr、co、mr、etf。"
|
|
444
444
|
}
|
|
445
445
|
},
|
|
446
446
|
"required": [
|
|
@@ -529,7 +529,7 @@
|
|
|
529
529
|
},
|
|
530
530
|
"runParams": {
|
|
531
531
|
"type": "object",
|
|
532
|
-
"description": "
|
|
532
|
+
"description": "回测参数。普通日线回测可整体不传,MCP 按系统默认组装(含参数/费率模板与回测模式等服务端默认);要改哪项传哪项,日期字段按用户描述动态计算。",
|
|
533
533
|
"properties": {
|
|
534
534
|
"account_list": {
|
|
535
535
|
"type": "array",
|
|
@@ -568,7 +568,7 @@
|
|
|
568
568
|
7
|
|
569
569
|
],
|
|
570
570
|
"default": 1,
|
|
571
|
-
"description": "
|
|
571
|
+
"description": "账号类型:1 股票、2 期货、6 金融期货、7 融资融券,必须和 runParams.marketIds 的市场对得上。期货回测**实测取 2**(中金所股指期货 zjIF2403 用 account_type=2 通过校验,用 6 被判「帐号类型与合约编码类型不匹配」直接废单;6 适用面未实测,没把握就用 2)。卖空只有期货类账号支持。"
|
|
572
572
|
}
|
|
573
573
|
},
|
|
574
574
|
"required": [
|
|
@@ -605,237 +605,18 @@
|
|
|
605
605
|
"default": "day",
|
|
606
606
|
"description": "回测频率。day 表示日频,min 表示分钟,tick 表示逐笔。省略时默认 day。"
|
|
607
607
|
},
|
|
608
|
-
"btmode": {
|
|
609
|
-
"type": "integer",
|
|
610
|
-
"default": 3,
|
|
611
|
-
"description": "回测模式,默认 3。"
|
|
612
|
-
},
|
|
613
608
|
"kcount": {
|
|
614
609
|
"type": "integer",
|
|
615
610
|
"default": 400,
|
|
616
611
|
"description": "预加载 K 线条数,默认 400。"
|
|
617
612
|
},
|
|
618
|
-
"base_tpl_id": {
|
|
619
|
-
"type": "string",
|
|
620
|
-
"default": "defaultTpl",
|
|
621
|
-
"description": "参数模板 ID,默认 defaultTpl。"
|
|
622
|
-
},
|
|
623
|
-
"ratio_tpl_id": {
|
|
624
|
-
"type": "string",
|
|
625
|
-
"default": "defaultTpl",
|
|
626
|
-
"description": "费率模板 ID,默认 defaultTpl。"
|
|
627
|
-
},
|
|
628
613
|
"base_tpl_obj": {
|
|
629
614
|
"type": "object",
|
|
630
|
-
"description": "
|
|
631
|
-
"properties": {
|
|
632
|
-
"name": {
|
|
633
|
-
"type": "string",
|
|
634
|
-
"default": "defaultTpl",
|
|
635
|
-
"description": "模板名称。"
|
|
636
|
-
},
|
|
637
|
-
"zhCnName": {
|
|
638
|
-
"type": "string",
|
|
639
|
-
"default": "系统默认参数模板",
|
|
640
|
-
"description": "模板中文名称。"
|
|
641
|
-
},
|
|
642
|
-
"benchmark": {
|
|
643
|
-
"type": "string",
|
|
644
|
-
"default": "sz399300",
|
|
645
|
-
"description": "基准代码。"
|
|
646
|
-
},
|
|
647
|
-
"match_with_order_book": {
|
|
648
|
-
"type": "boolean",
|
|
649
|
-
"default": false,
|
|
650
|
-
"description": "是否按委托簿撮合。"
|
|
651
|
-
},
|
|
652
|
-
"matching_mode": {
|
|
653
|
-
"type": "string",
|
|
654
|
-
"default": "close",
|
|
655
|
-
"description": "撮合模式,默认 close。"
|
|
656
|
-
},
|
|
657
|
-
"avoid_future": {
|
|
658
|
-
"type": "boolean",
|
|
659
|
-
"default": true,
|
|
660
|
-
"description": "是否开启未来函数规避。"
|
|
661
|
-
},
|
|
662
|
-
"open_cache": {
|
|
663
|
-
"type": "boolean",
|
|
664
|
-
"default": true,
|
|
665
|
-
"description": "是否开启缓存。"
|
|
666
|
-
},
|
|
667
|
-
"jv_kuan_open_avg_cost_switch": {
|
|
668
|
-
"type": "string",
|
|
669
|
-
"default": "1",
|
|
670
|
-
"description": "开仓均价成本开关。"
|
|
671
|
-
},
|
|
672
|
-
"adjust_aqty_by_avail": {
|
|
673
|
-
"type": "string",
|
|
674
|
-
"default": "3",
|
|
675
|
-
"description": "按可用量调整委托数量配置。"
|
|
676
|
-
},
|
|
677
|
-
"take_fee_type": {
|
|
678
|
-
"type": "string",
|
|
679
|
-
"default": "1",
|
|
680
|
-
"description": "费用收取类型。"
|
|
681
|
-
},
|
|
682
|
-
"slippage": {
|
|
683
|
-
"type": "string",
|
|
684
|
-
"default": "0.00246",
|
|
685
|
-
"description": "滑点配置。"
|
|
686
|
-
},
|
|
687
|
-
"max_trade_ratio": {
|
|
688
|
-
"type": "string",
|
|
689
|
-
"default": "1.0",
|
|
690
|
-
"description": "最大交易比例。"
|
|
691
|
-
},
|
|
692
|
-
"order_volume_ratio": {
|
|
693
|
-
"type": "boolean",
|
|
694
|
-
"default": true,
|
|
695
|
-
"description": "是否按委托量比例处理。"
|
|
696
|
-
}
|
|
697
|
-
},
|
|
698
|
-
"additionalProperties": false
|
|
615
|
+
"description": "参数模板,整体可不传,MCP 按系统默认模板补齐;要改哪项传哪项,其余沿用默认。字段:benchmark(默认 sz399300,会被策略 set_benchmark 覆盖)、matching_mode、slippage(默认 0.00246)、avoid_future、open_cache、match_with_order_book、max_trade_ratio、order_volume_ratio、take_fee_type、adjust_aqty_by_avail、jv_kuan_open_avg_cost_switch。"
|
|
699
616
|
},
|
|
700
617
|
"ratio_tpl_obj": {
|
|
701
618
|
"type": "object",
|
|
702
|
-
"description": "
|
|
703
|
-
"properties": {
|
|
704
|
-
"name": {
|
|
705
|
-
"type": "string",
|
|
706
|
-
"default": "defaultTpl",
|
|
707
|
-
"description": "模板名称。"
|
|
708
|
-
},
|
|
709
|
-
"zhCnName": {
|
|
710
|
-
"type": "string",
|
|
711
|
-
"default": "系统默认费率模板",
|
|
712
|
-
"description": "模板中文名称。"
|
|
713
|
-
},
|
|
714
|
-
"stock": {
|
|
715
|
-
"type": "object",
|
|
716
|
-
"description": "股票费率配置。",
|
|
717
|
-
"properties": {
|
|
718
|
-
"open_commission": {
|
|
719
|
-
"type": "string",
|
|
720
|
-
"default": "3",
|
|
721
|
-
"description": "开仓佣金。"
|
|
722
|
-
},
|
|
723
|
-
"close_commission": {
|
|
724
|
-
"type": "string",
|
|
725
|
-
"default": "3",
|
|
726
|
-
"description": "平仓佣金。"
|
|
727
|
-
},
|
|
728
|
-
"min_commission": {
|
|
729
|
-
"type": "string",
|
|
730
|
-
"default": "5",
|
|
731
|
-
"description": "最低佣金。"
|
|
732
|
-
},
|
|
733
|
-
"open_tax": {
|
|
734
|
-
"type": "string",
|
|
735
|
-
"default": "0",
|
|
736
|
-
"description": "开仓税费。"
|
|
737
|
-
},
|
|
738
|
-
"close_tax": {
|
|
739
|
-
"type": "string",
|
|
740
|
-
"default": "1",
|
|
741
|
-
"description": "平仓税费。"
|
|
742
|
-
}
|
|
743
|
-
},
|
|
744
|
-
"additionalProperties": false
|
|
745
|
-
},
|
|
746
|
-
"future": {
|
|
747
|
-
"type": "object",
|
|
748
|
-
"description": "期货费率配置。",
|
|
749
|
-
"properties": {
|
|
750
|
-
"open_commission": {
|
|
751
|
-
"type": "string",
|
|
752
|
-
"default": "0.23",
|
|
753
|
-
"description": "开仓佣金。"
|
|
754
|
-
},
|
|
755
|
-
"close_commission": {
|
|
756
|
-
"type": "string",
|
|
757
|
-
"default": "0.23",
|
|
758
|
-
"description": "平仓佣金。"
|
|
759
|
-
},
|
|
760
|
-
"close_today_commission": {
|
|
761
|
-
"type": "string",
|
|
762
|
-
"default": "23",
|
|
763
|
-
"description": "平今佣金。"
|
|
764
|
-
},
|
|
765
|
-
"min_commission": {
|
|
766
|
-
"type": "string",
|
|
767
|
-
"default": "0",
|
|
768
|
-
"description": "最低佣金。"
|
|
769
|
-
},
|
|
770
|
-
"margin_ratio": {
|
|
771
|
-
"type": "string",
|
|
772
|
-
"default": "12",
|
|
773
|
-
"description": "保证金比例。"
|
|
774
|
-
}
|
|
775
|
-
},
|
|
776
|
-
"additionalProperties": false
|
|
777
|
-
},
|
|
778
|
-
"fund": {
|
|
779
|
-
"type": "object",
|
|
780
|
-
"description": "基金费率配置。",
|
|
781
|
-
"properties": {
|
|
782
|
-
"open_commission": {
|
|
783
|
-
"type": "string",
|
|
784
|
-
"default": "0.1",
|
|
785
|
-
"description": "申购佣金。"
|
|
786
|
-
},
|
|
787
|
-
"close_commission": {
|
|
788
|
-
"type": "string",
|
|
789
|
-
"default": "0.1",
|
|
790
|
-
"description": "赎回佣金。"
|
|
791
|
-
},
|
|
792
|
-
"min_commission": {
|
|
793
|
-
"type": "string",
|
|
794
|
-
"default": "5",
|
|
795
|
-
"description": "最低佣金。"
|
|
796
|
-
}
|
|
797
|
-
},
|
|
798
|
-
"additionalProperties": false
|
|
799
|
-
},
|
|
800
|
-
"bond": {
|
|
801
|
-
"type": "object",
|
|
802
|
-
"description": "债券费率配置。",
|
|
803
|
-
"properties": {
|
|
804
|
-
"open_commission": {
|
|
805
|
-
"type": "string",
|
|
806
|
-
"default": "0.3",
|
|
807
|
-
"description": "买入佣金。"
|
|
808
|
-
},
|
|
809
|
-
"close_commission": {
|
|
810
|
-
"type": "string",
|
|
811
|
-
"default": "0.3",
|
|
812
|
-
"description": "卖出佣金。"
|
|
813
|
-
},
|
|
814
|
-
"min_commission": {
|
|
815
|
-
"type": "string",
|
|
816
|
-
"default": "5",
|
|
817
|
-
"description": "最低佣金。"
|
|
818
|
-
}
|
|
819
|
-
},
|
|
820
|
-
"additionalProperties": false
|
|
821
|
-
}
|
|
822
|
-
},
|
|
823
|
-
"additionalProperties": false
|
|
824
|
-
},
|
|
825
|
-
"st_parmas": {
|
|
826
|
-
"type": "string",
|
|
827
|
-
"default": "[]",
|
|
828
|
-
"description": "策略参数 JSON 字符串,默认 []。"
|
|
829
|
-
},
|
|
830
|
-
"mode": {
|
|
831
|
-
"type": "string",
|
|
832
|
-
"default": "0",
|
|
833
|
-
"description": "运行模式,默认 0。"
|
|
834
|
-
},
|
|
835
|
-
"class_type": {
|
|
836
|
-
"type": "string",
|
|
837
|
-
"default": "1",
|
|
838
|
-
"description": "分类类型,默认 1。"
|
|
619
|
+
"description": "费率模板,整体可不传,MCP 按系统默认模板补齐;要改哪项传哪项。按资产类分节:stock/future/fund/bond 各含 open_commission、close_commission、min_commission;stock 另有 open_tax、close_tax;future 另有 close_today_commission、margin_ratio。期货费率在 future 节。"
|
|
839
620
|
},
|
|
840
621
|
"marketIds": {
|
|
841
622
|
"type": "array",
|
|
@@ -843,7 +624,7 @@
|
|
|
843
624
|
"sh",
|
|
844
625
|
"sz"
|
|
845
626
|
],
|
|
846
|
-
"description": "市场列表,决定策略引擎加载哪些市场的行情,默认 sh + sz
|
|
627
|
+
"description": "市场列表,决定策略引擎加载哪些市场的行情,默认 sh + sz(股票)。期货市场:zj 中金所、zs 郑商所、ds 大商所、sq 上期所、gq 广期所。**做期货回测必须把对应的期货交易所写进来**(只留 sh/sz 引擎取不到期货行情),且 account_list 要有 account_type=2 的期货账号、费率用 ratio_tpl_obj.future、数据前置(dk5/mk5 与 mr)见 mcp-download-data。期货与股票可同时列出做跨品种策略。",
|
|
847
628
|
"items": {
|
|
848
629
|
"type": "string",
|
|
849
630
|
"enum": [
|
|
@@ -876,6 +657,59 @@
|
|
|
876
657
|
],
|
|
877
658
|
"additionalProperties": false
|
|
878
659
|
},
|
|
660
|
+
"bodyDefaults": {
|
|
661
|
+
"runParams": {
|
|
662
|
+
"btmode": 3,
|
|
663
|
+
"base_tpl_id": "defaultTpl",
|
|
664
|
+
"ratio_tpl_id": "defaultTpl",
|
|
665
|
+
"st_parmas": "[]",
|
|
666
|
+
"mode": "0",
|
|
667
|
+
"class_type": "1",
|
|
668
|
+
"base_tpl_obj": {
|
|
669
|
+
"name": "defaultTpl",
|
|
670
|
+
"zhCnName": "系统默认参数模板",
|
|
671
|
+
"benchmark": "sz399300",
|
|
672
|
+
"match_with_order_book": false,
|
|
673
|
+
"matching_mode": "close",
|
|
674
|
+
"avoid_future": true,
|
|
675
|
+
"open_cache": true,
|
|
676
|
+
"jv_kuan_open_avg_cost_switch": "1",
|
|
677
|
+
"adjust_aqty_by_avail": "3",
|
|
678
|
+
"take_fee_type": "1",
|
|
679
|
+
"slippage": "0.00246",
|
|
680
|
+
"max_trade_ratio": "1.0",
|
|
681
|
+
"order_volume_ratio": true
|
|
682
|
+
},
|
|
683
|
+
"ratio_tpl_obj": {
|
|
684
|
+
"name": "defaultTpl",
|
|
685
|
+
"zhCnName": "系统默认费率模板",
|
|
686
|
+
"stock": {
|
|
687
|
+
"open_commission": "3",
|
|
688
|
+
"close_commission": "3",
|
|
689
|
+
"min_commission": "5",
|
|
690
|
+
"open_tax": "0",
|
|
691
|
+
"close_tax": "1"
|
|
692
|
+
},
|
|
693
|
+
"future": {
|
|
694
|
+
"open_commission": "0.23",
|
|
695
|
+
"close_commission": "0.23",
|
|
696
|
+
"close_today_commission": "23",
|
|
697
|
+
"min_commission": "0",
|
|
698
|
+
"margin_ratio": "12"
|
|
699
|
+
},
|
|
700
|
+
"fund": {
|
|
701
|
+
"open_commission": "0.1",
|
|
702
|
+
"close_commission": "0.1",
|
|
703
|
+
"min_commission": "5"
|
|
704
|
+
},
|
|
705
|
+
"bond": {
|
|
706
|
+
"open_commission": "0.3",
|
|
707
|
+
"close_commission": "0.3",
|
|
708
|
+
"min_commission": "5"
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
},
|
|
879
713
|
"ipcUri": "/zltaf_slave/v1/run/create",
|
|
880
714
|
"bodyFromParams": true,
|
|
881
715
|
"timeoutParamKey": "timeout",
|
|
@@ -933,83 +767,10 @@
|
|
|
933
767
|
},
|
|
934
768
|
"runParams": {
|
|
935
769
|
"type": "object",
|
|
936
|
-
"description": "
|
|
770
|
+
"description": "回测参数,与 mcp-create-and-run-backtest 的 runParams 同构,字段说明见该工具。默认沿用最近一次创建回测的条件,用户只需要说明想修改的字段,没传的字段(含基准、撮合模式、滑点、费率模板)都按上一次原样继承;MCP 重启会丢掉这份上下文,之后必须传完整参数,否则会以「缺少必填字段」失败。改用期货市场(marketIds 含 zj/zs/ds/sq/gq)时,account_list 的 account_type 要一并改为 2(期货)。",
|
|
937
771
|
"properties": {
|
|
938
|
-
"account_list": {
|
|
939
|
-
"type": "array",
|
|
940
|
-
"description": "回测账号列表。未传时沿用最近一次回测的账号配置。",
|
|
941
|
-
"items": {
|
|
942
|
-
"type": "object",
|
|
943
|
-
"properties": {
|
|
944
|
-
"pindex": {
|
|
945
|
-
"type": "integer",
|
|
946
|
-
"description": "账号数组下标,按 account_list 的数组 index 自动生成,无需用户设置。"
|
|
947
|
-
},
|
|
948
|
-
"account_id": {
|
|
949
|
-
"type": "string",
|
|
950
|
-
"description": "账号 ID,默认空字符串,无需用户设置。"
|
|
951
|
-
},
|
|
952
|
-
"cash": {
|
|
953
|
-
"type": "number",
|
|
954
|
-
"description": "账号初始资金,用户可修改。"
|
|
955
|
-
},
|
|
956
|
-
"account_type": {
|
|
957
|
-
"type": "integer",
|
|
958
|
-
"enum": [
|
|
959
|
-
1,
|
|
960
|
-
2,
|
|
961
|
-
6,
|
|
962
|
-
7
|
|
963
|
-
],
|
|
964
|
-
"description": "账号类型。1 表示股票,2 表示期货,6 表示金融期货,7 表示融资融券。"
|
|
965
|
-
}
|
|
966
|
-
},
|
|
967
|
-
"additionalProperties": false
|
|
968
|
-
}
|
|
969
|
-
},
|
|
970
|
-
"initial_capital": {
|
|
971
|
-
"type": "number",
|
|
972
|
-
"description": "初始资金。未传时沿用最近一次回测的配置。"
|
|
973
|
-
},
|
|
974
|
-
"start": {
|
|
975
|
-
"type": "string",
|
|
976
|
-
"format": "date",
|
|
977
|
-
"description": "回测开始日期(北京时区),格式 YYYY-MM-DD。未传时沿用最近一次回测的配置。"
|
|
978
|
-
},
|
|
979
|
-
"end": {
|
|
980
|
-
"type": "string",
|
|
981
|
-
"format": "date",
|
|
982
|
-
"description": "回测结束日期(北京时区),格式 YYYY-MM-DD。未传时沿用最近一次回测的配置。"
|
|
983
|
-
},
|
|
984
|
-
"freq": {
|
|
985
|
-
"type": "string",
|
|
986
|
-
"enum": [
|
|
987
|
-
"day",
|
|
988
|
-
"min",
|
|
989
|
-
"tick"
|
|
990
|
-
],
|
|
991
|
-
"description": "回测频率。day 表示日频,min 表示分钟,tick 表示逐笔。"
|
|
992
|
-
},
|
|
993
|
-
"trade_type": {
|
|
994
|
-
"type": "integer",
|
|
995
|
-
"enum": [
|
|
996
|
-
0,
|
|
997
|
-
1,
|
|
998
|
-
2
|
|
999
|
-
],
|
|
1000
|
-
"description": "撮合频率。0 表示分钟 min,1 表示 tick,2 表示日线 day。"
|
|
1001
|
-
},
|
|
1002
|
-
"btmode": {
|
|
1003
|
-
"type": "integer",
|
|
1004
|
-
"description": "回测模式。未传时沿用最近一次回测的配置。"
|
|
1005
|
-
},
|
|
1006
|
-
"kcount": {
|
|
1007
|
-
"type": "integer",
|
|
1008
|
-
"description": "预加载 K 线条数。未传时沿用最近一次回测的配置。"
|
|
1009
|
-
},
|
|
1010
772
|
"marketIds": {
|
|
1011
773
|
"type": "array",
|
|
1012
|
-
"description": "市场列表。未传时沿用最近一次回测的配置。股票市场 sh 上交所、sz 深交所;期货市场 zj 中金所、zs 郑商所、ds 大商所、sq 上期所、gq 广期所。改成期货市场时,account_list 的 account_type 也要一并改为 2(期货)。",
|
|
1013
774
|
"items": {
|
|
1014
775
|
"type": "string",
|
|
1015
776
|
"enum": [
|
|
@@ -1024,7 +785,7 @@
|
|
|
1024
785
|
}
|
|
1025
786
|
}
|
|
1026
787
|
},
|
|
1027
|
-
"additionalProperties":
|
|
788
|
+
"additionalProperties": true
|
|
1028
789
|
}
|
|
1029
790
|
},
|
|
1030
791
|
"required": [
|
|
@@ -1167,7 +928,7 @@
|
|
|
1167
928
|
"includeSeries": {
|
|
1168
929
|
"type": "boolean",
|
|
1169
930
|
"default": false,
|
|
1170
|
-
"description": "返回逐日序列(date / totalAsset / benchmarkPrice / positionRatePct / turnoverRatePct)。超过 250
|
|
931
|
+
"description": "返回逐日序列(date / totalAsset / benchmarkPrice / positionRatePct / turnoverRatePct)。超过 250 行会**等距抽样**到 250 点并标 seriesTruncated:首尾保留、跨度完整、逐点数值真实,只是变稀——多年回测画净值曲线够用,不会只拿到末段。要每一行时 notes 会给出该次产物 CSV 的列号,照它读。"
|
|
1171
932
|
}
|
|
1172
933
|
},
|
|
1173
934
|
"required": [
|
|
@@ -1233,7 +994,7 @@
|
|
|
1233
994
|
"timeoutParamKey": "timeout"
|
|
1234
995
|
},
|
|
1235
996
|
{
|
|
1236
|
-
"name": "mcp-get-
|
|
997
|
+
"name": "mcp-get-backtest-list",
|
|
1237
998
|
"description": "查询指定策略ID数组对应的回测列表,返回回测ID、名称、回测周期、回测状态与回测时间——**不要展示收益相关的信息**。pageSize 与 runType 是固定值,必须显式传入,不要依赖 default 自动补值。",
|
|
1238
999
|
"inputSchema": {
|
|
1239
1000
|
"type": "object",
|
package/package.json
CHANGED
package/zlt-mcp-proxy.bundle.cjs
CHANGED
|
@@ -10496,7 +10496,74 @@ var DEFAULT_BACKTEST_MODULE_INDICES = [TY_MODULE_INDEX];
|
|
|
10496
10496
|
var DEBUG_ASSISTANT_INSTALLER_URL = "https://beta.zltquant.com/download/setup-ZLTStudio-Dbg-mini-20260714.4.exe";
|
|
10497
10497
|
var PUBLIC_PYTHON_SDK_INDEX_URL = "https://pypip.zltquant.com/";
|
|
10498
10498
|
var ZLTAF_CONFIG_FILE_DEFAULT = "application-local.properties";
|
|
10499
|
-
var
|
|
10499
|
+
var OFFICIAL_MIRROR_ROOTS = {
|
|
10500
|
+
public: "https://zlt-data-house.oss-cn-wuhan-lr.aliyuncs.com/zltkj.site/down/v1/up/Zlt.Std.Official",
|
|
10501
|
+
internal: "http://192.168.1.243:9000/zlt-data-house/zltkj.site/down/v1/up/Zlt.Std.Official"
|
|
10502
|
+
};
|
|
10503
|
+
var OFFICIAL_INSTALLERS = {
|
|
10504
|
+
public: {
|
|
10505
|
+
// 公网 full 仍停在 2026.06.18.11:2026.08.26.2 / 2026.08.14.5 / 2026.08.12.3 在
|
|
10506
|
+
// 公网 OSS 一律 404(2026-08-27 实测 HEAD)。这个版本低于我们自己发布的
|
|
10507
|
+
// zlt_quant_version_index.json 里的 Client.min = 2026.08.12.3,所以公网通道上
|
|
10508
|
+
// 一台 full 装机会以 blockedByPlugin 收场 —— 解法是运维把件传上 OSS,之后
|
|
10509
|
+
// 只改本条的 version 与 sha256 两个字段,不是在代码里绕。
|
|
10510
|
+
full: {
|
|
10511
|
+
artifact: "zlt_client",
|
|
10512
|
+
version: "2026.06.18.11",
|
|
10513
|
+
sha256: "376D9C60A4BA7FF4745DF67A789BA252025EA72BB74DB6A963513FE1EFC10AE2"
|
|
10514
|
+
},
|
|
10515
|
+
// 2026-08-15 抬到 2026.08.14.5:公网 OSS 与内网镜像是同一份字节(ETag 113b3cff…、
|
|
10516
|
+
// 75,075,160 字节两边一致),本机下载实测 SHA256=9D40AE9A…D551,与 2026-08-14 覆盖
|
|
10517
|
+
// 安装时校验过的摘要一致,两条独立路径互证。这一版是投研模块下限(≥2026.08.11.2)
|
|
10518
|
+
// 之上的第一个已发布 mini:低于它,投研模块 upgrade/check 直接以「客户端版本过低」
|
|
10519
|
+
// 拒绝,且该下限只在模块服务端。version 取安装包自身 FileVersion 的点分四段(不是
|
|
10520
|
+
// 构建目录名的紧凑形 20260814.5):升级判定拿它和 InstallInfo.xml 的
|
|
10521
|
+
// InstallAppReleaseVer 比,写成紧凑形会让「有可用更新」永远消不掉。
|
|
10522
|
+
mini: {
|
|
10523
|
+
artifact: "zlt_plugin",
|
|
10524
|
+
version: "2026.08.14.5",
|
|
10525
|
+
sha256: "9D40AE9ABCA459CF60CD5377A24013FA4B14BF96DE2D82E04CDD268AE1FDD551"
|
|
10526
|
+
}
|
|
10527
|
+
},
|
|
10528
|
+
internal: {
|
|
10529
|
+
// 2026-08-28 抬到 2026.08.28.8,接替 2026.08.26.2。内网镜像下载核验:
|
|
10530
|
+
// 168,535,424 字节,SHA256=EF1F270A…B638,安装包 FileVersion 自报 2026.08.28.8
|
|
10531
|
+
// (版本取它,不取文件名)。它仍高于 Client.min = 2026.08.12.3,所以内测通道上
|
|
10532
|
+
// 一台 full 装机不会以 blockedByPlugin 收场。公网 OSS 无此件,public.full 不动。
|
|
10533
|
+
full: {
|
|
10534
|
+
artifact: "zlt_client",
|
|
10535
|
+
version: "2026.08.28.8",
|
|
10536
|
+
sha256: "EF1F270A9F2FEBEE6B3B101FA2FC7E23927FE64B340383DDAB66C0C79682B638"
|
|
10537
|
+
},
|
|
10538
|
+
// 2026-08-28 抬到 2026.08.28.7,接替同日的 2026.08.28.3。下载核验:79,587,656 字节,
|
|
10539
|
+
// SHA256=9A38670A…A943,FileVersion 自报 2026.08.28.7。
|
|
10540
|
+
// **换件理由只到「交付方给了新件」为止**:2026.08.28.3 的 ZLTHome 启动即崩
|
|
10541
|
+
// (TTaskFunc 持栈上 lambda 的悬垂引用,100% 复现),这一版是否修好了它,本次
|
|
10542
|
+
// 未活体验证 —— 装机跑一次再下结论,别拿版本号当证据。
|
|
10543
|
+
// .3 起把 zltaf 从投研模块的子模块集里去掉,修的是首装必炸的另一条权限死路:此前
|
|
10544
|
+
// 安装器与模块各发一份 zltaf,模块解压必须覆盖安装器以管理员身份写下的文件,而
|
|
10545
|
+
// ZLTBackService 跑在登录账户的 UAC 过滤令牌上。卷根 ACL 缺 Authenticated Users:(M)
|
|
10546
|
+
// 时(非系统盘的老式默认)覆盖必被拒,2 毫秒失败在第一个文件上,100% 复现。
|
|
10547
|
+
// 见 docs/reports/2026-08-28-zltaf-submodule-extract-access-denied.md。
|
|
10548
|
+
// 公网 OSS 尚无此件,所以 public.mini 仍停在 2026.08.14.5 —— 两张表自此不再同版本,
|
|
10549
|
+
// 这正是按镜像分表的理由。
|
|
10550
|
+
mini: {
|
|
10551
|
+
artifact: "zlt_plugin",
|
|
10552
|
+
version: "2026.08.28.7",
|
|
10553
|
+
sha256: "9A38670A83BDAAE2D9AF3178F05CECDFE95796F05BE9227F674A0DD232C6A943"
|
|
10554
|
+
}
|
|
10555
|
+
}
|
|
10556
|
+
};
|
|
10557
|
+
function resolveInstallerMirror() {
|
|
10558
|
+
return false ? "internal" : "public";
|
|
10559
|
+
}
|
|
10560
|
+
function officialInstallerUrl(slot, mirror = "public") {
|
|
10561
|
+
const spec = OFFICIAL_INSTALLERS[mirror][slot];
|
|
10562
|
+
return `${OFFICIAL_MIRROR_ROOTS[mirror]}/pkg/${spec.artifact}_${spec.version}.exe`;
|
|
10563
|
+
}
|
|
10564
|
+
function officialVersionIndexUrl(mirror = "public") {
|
|
10565
|
+
return `${OFFICIAL_MIRROR_ROOTS[mirror]}/VscodeMarketPlugin/zlt_quant_version_index.json`;
|
|
10566
|
+
}
|
|
10500
10567
|
var INTERNAL_PYTHON_SDK_INDEX_URL = "https://192.168.1.32:9100/pypi/simple/";
|
|
10501
10568
|
var INTERNAL_PYTHON_SDK_TRUSTED_HOST = "192.168.1.32";
|
|
10502
10569
|
var PYTHON_SDK_PACKAGES = ["zltquant", "zltsdk-plugin"];
|
|
@@ -10517,8 +10584,8 @@ var defaultAssistantRuntimeConfig = {
|
|
|
10517
10584
|
envMode: "OFFICIAL",
|
|
10518
10585
|
backserviceDownload: {
|
|
10519
10586
|
OFFICIAL: {
|
|
10520
|
-
full: "
|
|
10521
|
-
mini: "
|
|
10587
|
+
full: officialInstallerUrl("full"),
|
|
10588
|
+
mini: officialInstallerUrl("mini")
|
|
10522
10589
|
},
|
|
10523
10590
|
REL: {
|
|
10524
10591
|
full: "",
|
|
@@ -10531,10 +10598,13 @@ var defaultAssistantRuntimeConfig = {
|
|
|
10531
10598
|
},
|
|
10532
10599
|
// Exact artifact digests. A URL update requires a matching digest update in the
|
|
10533
10600
|
// same reviewed change; downloadRuntimeInstaller fails closed when it is absent.
|
|
10601
|
+
// OFFICIAL 的取值来自 OFFICIAL_INSTALLERS.public —— URL/版本/摘要三者同源,只有那一处可改。
|
|
10602
|
+
// 这里恒取公网表:模块级默认必须公网可达(runtime.test.ts 的 LAN 守卫钉的就是它),
|
|
10603
|
+
// 内网镜像那档由 applyEnvOverrides 按镜像轴整行换掉。
|
|
10534
10604
|
backserviceDownloadSha256: {
|
|
10535
10605
|
OFFICIAL: {
|
|
10536
|
-
full:
|
|
10537
|
-
mini:
|
|
10606
|
+
full: OFFICIAL_INSTALLERS.public.full.sha256,
|
|
10607
|
+
mini: OFFICIAL_INSTALLERS.public.mini.sha256
|
|
10538
10608
|
},
|
|
10539
10609
|
REL: { full: "", mini: "" },
|
|
10540
10610
|
DEBUG: {
|
|
@@ -10542,15 +10612,12 @@ var defaultAssistantRuntimeConfig = {
|
|
|
10542
10612
|
mini: "05C57A5D212684A801665774E9F0813EFC1AA4762D1540EC353BB41173712B07"
|
|
10543
10613
|
}
|
|
10544
10614
|
},
|
|
10545
|
-
//
|
|
10546
|
-
//
|
|
10615
|
+
// 本体升级判定拿它当「我们能立刻交付的版本下限」。OFFICIAL 与 URL 同源自
|
|
10616
|
+
// OFFICIAL_INSTALLERS,结构上不可能只改 URL 不改这里。
|
|
10547
10617
|
backserviceDownloadVersion: {
|
|
10548
10618
|
OFFICIAL: {
|
|
10549
|
-
full:
|
|
10550
|
-
|
|
10551
|
-
// InstallInfo.xml 的 InstallAppReleaseVer 比,那边是点分四段。写成紧凑形会让
|
|
10552
|
-
// 20260814 > 2026 恒成立,「有可用更新」永远消不掉。
|
|
10553
|
-
mini: "2026.08.14.5"
|
|
10619
|
+
full: OFFICIAL_INSTALLERS.public.full.version,
|
|
10620
|
+
mini: OFFICIAL_INSTALLERS.public.mini.version
|
|
10554
10621
|
},
|
|
10555
10622
|
REL: { full: "", mini: "" },
|
|
10556
10623
|
DEBUG: {
|
|
@@ -10567,8 +10634,10 @@ var defaultAssistantRuntimeConfig = {
|
|
|
10567
10634
|
//
|
|
10568
10635
|
// REL/DEBUG 没有对应发布面,留空即跳过远程判定。地址不可达或文件不存在同样 fail-open,
|
|
10569
10636
|
// 所以这条链路默认是关的,直到有人把文件传上去 —— 见 deploy/README.md。
|
|
10637
|
+
// 与安装包同源自 OFFICIAL_MIRROR_ROOTS:内测构建把安装包指到内网时,这条也必须跟着走,
|
|
10638
|
+
// 否则一个 -internal 产物会拿公网索引判闸门 —— 而索引取不到时闸门是 fail-open。
|
|
10570
10639
|
baseRequirementUrl: {
|
|
10571
|
-
OFFICIAL: "
|
|
10640
|
+
OFFICIAL: officialVersionIndexUrl("public"),
|
|
10572
10641
|
REL: "",
|
|
10573
10642
|
DEBUG: ""
|
|
10574
10643
|
},
|
|
@@ -10771,13 +10840,16 @@ function applyEnvOverrides(config2) {
|
|
|
10771
10840
|
const sdkTrustedHostOverride = process.env.ZLT_PYTHON_SDK_TRUSTED_HOST;
|
|
10772
10841
|
const baseRequirementUrlOverride = process.env.ZLT_BASE_REQUIREMENT_URL?.trim();
|
|
10773
10842
|
const installer = parseInstallerOverride(process.env.ZLT_ASSISTANT_INSTALLER_OVERRIDE);
|
|
10843
|
+
const mirror = resolveInstallerMirror();
|
|
10844
|
+
const mirrored = applyInstallerMirror(config2, mirror);
|
|
10845
|
+
const mirroredIndex = mirror === "public" ? config2.baseRequirementUrl : { ...config2.baseRequirementUrl, OFFICIAL: officialVersionIndexUrl(mirror) };
|
|
10774
10846
|
return {
|
|
10775
10847
|
...config2,
|
|
10776
10848
|
envMode,
|
|
10777
|
-
baseRequirementUrl: baseRequirementUrlOverride ? { ...
|
|
10778
|
-
backserviceDownload: applyInstallerOverride(
|
|
10779
|
-
backserviceDownloadSha256: applyInstallerOverride(
|
|
10780
|
-
backserviceDownloadVersion: applyInstallerOverride(
|
|
10849
|
+
baseRequirementUrl: baseRequirementUrlOverride ? { ...mirroredIndex, [envMode]: baseRequirementUrlOverride } : mirroredIndex,
|
|
10850
|
+
backserviceDownload: applyInstallerOverride(mirrored.backserviceDownload, envMode, installer, "url"),
|
|
10851
|
+
backserviceDownloadSha256: applyInstallerOverride(mirrored.backserviceDownloadSha256, envMode, installer, "sha256"),
|
|
10852
|
+
backserviceDownloadVersion: applyInstallerOverride(mirrored.backserviceDownloadVersion, envMode, installer, "version"),
|
|
10781
10853
|
pythonRuntimePackages: runtimePackages.length > 0 ? runtimePackages : config2.pythonRuntimePackages,
|
|
10782
10854
|
pythonRuntimeIndexUrl: process.env.ZLT_PYTHON_RUNTIME_INDEX_URL?.trim() || config2.pythonRuntimeIndexUrl,
|
|
10783
10855
|
pythonSdkPackages: packages.length > 0 ? packages : envModeChanged ? config2.pythonSdkPackagesByMode[envMode] : config2.pythonSdkPackages,
|
|
@@ -10787,6 +10859,25 @@ function applyEnvOverrides(config2) {
|
|
|
10787
10859
|
pythonPipWheelSha256: process.env.ZLT_PYTHON_PIP_WHEEL_SHA256?.trim() || config2.pythonPipWheelSha256
|
|
10788
10860
|
};
|
|
10789
10861
|
}
|
|
10862
|
+
function applyInstallerMirror(config2, mirror) {
|
|
10863
|
+
if (mirror === "public")
|
|
10864
|
+
return config2;
|
|
10865
|
+
const pins = OFFICIAL_INSTALLERS[mirror];
|
|
10866
|
+
return {
|
|
10867
|
+
backserviceDownload: {
|
|
10868
|
+
...config2.backserviceDownload,
|
|
10869
|
+
OFFICIAL: { full: officialInstallerUrl("full", mirror), mini: officialInstallerUrl("mini", mirror) }
|
|
10870
|
+
},
|
|
10871
|
+
backserviceDownloadSha256: {
|
|
10872
|
+
...config2.backserviceDownloadSha256,
|
|
10873
|
+
OFFICIAL: { full: pins.full.sha256, mini: pins.mini.sha256 }
|
|
10874
|
+
},
|
|
10875
|
+
backserviceDownloadVersion: {
|
|
10876
|
+
...config2.backserviceDownloadVersion,
|
|
10877
|
+
OFFICIAL: { full: pins.full.version, mini: pins.mini.version }
|
|
10878
|
+
}
|
|
10879
|
+
};
|
|
10880
|
+
}
|
|
10790
10881
|
function parseInstallerOverride(raw) {
|
|
10791
10882
|
const text = raw?.trim();
|
|
10792
10883
|
if (!text)
|
|
@@ -11038,7 +11129,34 @@ var AssistantMasterIpcClient = class {
|
|
|
11038
11129
|
}
|
|
11039
11130
|
}
|
|
11040
11131
|
}
|
|
11041
|
-
|
|
11132
|
+
/**
|
|
11133
|
+
* 安装/启动通道动手前,先把 VSCode PID 注册进智能管家的监控表。
|
|
11134
|
+
*
|
|
11135
|
+
* 智能管家侧(xzs)每 ~10 秒查一次 monitor/check_reg_empty,注册表持续为空约 30 秒
|
|
11136
|
+
* 就把整族进程自退回收 —— 2026-08-25 全新装机实测:TY 模块 202MB 下载到 88% 时
|
|
11137
|
+
* ZLTBackService 被回收,ZLTHome 随后退出,下载轮询以管道断开告终
|
|
11138
|
+
* (FAILURE-PATTERNS #77)。常规注册挂在 ZLTAF connected 边沿(vscode-ext 的
|
|
11139
|
+
* assistant-monitor),而首次安装期间 ZLTAF 尚不存在,那条边沿永远等不到;
|
|
11140
|
+
* claw-host 的安装通道在每次 IPC 连接后都上报 PID
|
|
11141
|
+
* (assistant-installer.ts:1132/:1442),此处对齐。重复注册幂等。
|
|
11142
|
+
* 仅检测通道(checkBacktestModuleUpdates)刻意不注册 —— 后台检查若注册会阻止
|
|
11143
|
+
* 空闲自退,把「已装但未运行」这个合法状态挡掉。
|
|
11144
|
+
*
|
|
11145
|
+
* 注册失败绝不拦安装:旧本体可能没有 monitor API,失败只降级为一行进度日志。
|
|
11146
|
+
*
|
|
11147
|
+
* @param config 运行时配置,取其 ipcConnectTimeout 作为请求超时
|
|
11148
|
+
* @param onProgress 可选进度回调,仅在注册失败时收到一行说明
|
|
11149
|
+
*/
|
|
11150
|
+
async reportInstallLanePid(config2, onProgress) {
|
|
11151
|
+
try {
|
|
11152
|
+
await this.reportVSCodePid(process.pid, config2);
|
|
11153
|
+
} catch (error2) {
|
|
11154
|
+
const message = error2 instanceof Error ? error2.message : String(error2);
|
|
11155
|
+
onProgress?.(`VSCode \u8FDB\u7A0B\u6CE8\u518C\u5931\u8D25\uFF08\u4E0D\u5F71\u54CD\u5B89\u88C5\u7EE7\u7EED\uFF09: ${message}`);
|
|
11156
|
+
}
|
|
11157
|
+
}
|
|
11158
|
+
async startDefaultServices(config2, onProgress) {
|
|
11159
|
+
await this.reportInstallLanePid(config2, onProgress);
|
|
11042
11160
|
for (const serviceIndex of config2.manualServiceIndices) {
|
|
11043
11161
|
await this.sendRequest("zltMClient", "CallInnerRpc", {
|
|
11044
11162
|
modeType: 0,
|
|
@@ -11092,6 +11210,7 @@ var AssistantMasterIpcClient = class {
|
|
|
11092
11210
|
}
|
|
11093
11211
|
}
|
|
11094
11212
|
async installBacktestModules(workRoot, config2, onProgress, hooks = {}) {
|
|
11213
|
+
await this.reportInstallLanePid(config2, onProgress);
|
|
11095
11214
|
const moduleIndices = [
|
|
11096
11215
|
CLIENT_PLUGIN_MODULE_INDEX,
|
|
11097
11216
|
...config2.backtestModuleIndices.filter((moduleIndex) => moduleIndex !== CLIENT_PLUGIN_MODULE_INDEX)
|
|
@@ -11514,17 +11633,26 @@ var AssistantMasterIpcClient = class {
|
|
|
11514
11633
|
throw new Error(formatModuleInstallError("\u6295\u7814\u6A21\u5757\u5305\u8986\u76D6\u5B89\u88C5\u72B6\u6001\u8F6E\u8BE2\u8D85\u65F6", moduleIndex, lastProgress ?? { status: 0, process: 0, phase: 0, response: null }));
|
|
11515
11634
|
}
|
|
11516
11635
|
};
|
|
11517
|
-
async function startManualServices(workRoot, zltContent, config2) {
|
|
11636
|
+
async function startManualServices(workRoot, zltContent, config2, onProgress) {
|
|
11518
11637
|
const client = new AssistantMasterIpcClient();
|
|
11519
11638
|
try {
|
|
11520
11639
|
await client.connect(zltContent, config2);
|
|
11521
|
-
await client.startDefaultServices(config2);
|
|
11640
|
+
await client.startDefaultServices(config2, onProgress);
|
|
11522
11641
|
await client.pollStartupServices(config2);
|
|
11523
11642
|
await waitForPipe(workRoot, "ZLTAF", config2.zltafPipeWait);
|
|
11524
11643
|
} finally {
|
|
11525
11644
|
await client.disconnect();
|
|
11526
11645
|
}
|
|
11527
11646
|
}
|
|
11647
|
+
async function unregisterRuntimeConsumerPid(zltContent, config2) {
|
|
11648
|
+
const client = new AssistantMasterIpcClient();
|
|
11649
|
+
try {
|
|
11650
|
+
await client.connect(zltContent, config2);
|
|
11651
|
+
await client.logoutVSCodePid(process.pid, config2);
|
|
11652
|
+
} finally {
|
|
11653
|
+
await client.disconnect();
|
|
11654
|
+
}
|
|
11655
|
+
}
|
|
11528
11656
|
async function installBacktestModules(workRoot, zltContent, config2, onProgress, hooks = {}) {
|
|
11529
11657
|
const client = new AssistantMasterIpcClient();
|
|
11530
11658
|
try {
|
|
@@ -12224,25 +12352,11 @@ async function acquireMcpRuntime(config2, explicitWorkRoot) {
|
|
|
12224
12352
|
const workRoot = explicitWorkRoot ?? await locateInstalledRuntime(config2);
|
|
12225
12353
|
return acquireRuntimeLease(workRoot, "starter", {
|
|
12226
12354
|
ensureRuntime: async () => {
|
|
12227
|
-
|
|
12228
|
-
|
|
12229
|
-
return null;
|
|
12230
|
-
const identity = await waitForProcessIdentity(launchedPid, config2.serviceStartupWait);
|
|
12231
|
-
if (!identity)
|
|
12232
|
-
throw new Error(`\u65E0\u6CD5\u786E\u8BA4 MCP \u542F\u52A8\u7684 ZLTAF \u8FDB\u7A0B\u8EAB\u4EFD: pid=${launchedPid}`);
|
|
12233
|
-
return identity;
|
|
12355
|
+
await startAssistantManagedRuntime(workRoot, config2);
|
|
12356
|
+
return null;
|
|
12234
12357
|
}
|
|
12235
12358
|
});
|
|
12236
12359
|
}
|
|
12237
|
-
async function startRuntimeAndServices(workRoot, config2) {
|
|
12238
|
-
ensureUsersProjectsDirectory(workRoot);
|
|
12239
|
-
const launchReady = validateRuntimeLaunchReady(workRoot, config2);
|
|
12240
|
-
if (!launchReady.complete) {
|
|
12241
|
-
throw new Error(launchReady.reason || "ZLTAF runtime \u542F\u52A8\u4F9D\u8D56\u4E0D\u5B8C\u6574");
|
|
12242
|
-
}
|
|
12243
|
-
await startAssistantBackServices(workRoot, config2);
|
|
12244
|
-
return waitForZltafPipe(workRoot, config2, { startIfMissing: true });
|
|
12245
|
-
}
|
|
12246
12360
|
var AssistantNotRunningError = class extends Error {
|
|
12247
12361
|
code = "ASSISTANT_NOT_RUNNING";
|
|
12248
12362
|
constructor(message = "\u667A\u80FD\u7BA1\u5BB6\u5F53\u524D\u672A\u8FD0\u884C\uFF1B\u5F53\u524D\u64CD\u4F5C\u4EC5\u68C0\u6D4B runtime\uFF0C\u4E0D\u4F1A\u542F\u52A8\u667A\u80FD\u7BA1\u5BB6") {
|
|
@@ -12267,7 +12381,7 @@ async function startAssistantBackServices(workRoot, config2, onProgress, options
|
|
|
12267
12381
|
return;
|
|
12268
12382
|
const zltContent = await ensureAssistantHostRunning(workRoot, config2, onProgress, options);
|
|
12269
12383
|
onProgress?.("\u542F\u52A8\u667A\u80FD\u7BA1\u5BB6\u540E\u53F0\u670D\u52A1");
|
|
12270
|
-
await startManualServices(workRoot, zltContent, config2);
|
|
12384
|
+
await startManualServices(workRoot, zltContent, config2, onProgress);
|
|
12271
12385
|
}
|
|
12272
12386
|
async function ensureAssistantHostRunning(workRoot, config2, onProgress, options = {}) {
|
|
12273
12387
|
const masterPipeExists = (suffix) => pipeExists(workRoot, `${config2.masterPipePrefix}_${suffix}`);
|
|
@@ -12291,11 +12405,13 @@ var ASSISTANT_UPGRADE_FINISH_LOCK = path6.join("Temporary", "upgradeFinsh.lock")
|
|
|
12291
12405
|
function launchAssistantHost(workRoot, config2, onProgress) {
|
|
12292
12406
|
const hostPath = path6.join(workRoot, config2.hostPath);
|
|
12293
12407
|
onProgress?.("\u542F\u52A8\u667A\u80FD\u7BA1\u5BB6");
|
|
12408
|
+
const { ELECTRON_RUN_AS_NODE: _dropped, ...env } = process.env;
|
|
12294
12409
|
const child = (0, import_child_process3.spawn)(hostPath, ["startwithplugin", "selfstart"], {
|
|
12295
12410
|
cwd: path6.dirname(hostPath),
|
|
12296
12411
|
detached: true,
|
|
12297
12412
|
stdio: "ignore",
|
|
12298
|
-
windowsHide: true
|
|
12413
|
+
windowsHide: true,
|
|
12414
|
+
env
|
|
12299
12415
|
});
|
|
12300
12416
|
if (!child.pid)
|
|
12301
12417
|
throw new Error(`\u667A\u80FD\u7BA1\u5BB6\u542F\u52A8\u540E\u672A\u8FD4\u56DE PID: ${hostPath}`);
|
|
@@ -12379,15 +12495,18 @@ async function installRuntime(options) {
|
|
|
12379
12495
|
const installDir = options.installDir || getDefaultInstallPath();
|
|
12380
12496
|
const installerPath = options.installerPath || await downloadRuntimeInstaller(options.config, options.onProgress, options.installType || "full");
|
|
12381
12497
|
fs6.mkdirSync(installDir, { recursive: true });
|
|
12498
|
+
const installerLogPath = path6.join(installDir, "Temporary", "logs", "install.log");
|
|
12499
|
+
fs6.mkdirSync(path6.dirname(installerLogPath), { recursive: true });
|
|
12382
12500
|
options.onProgress?.(`\u6267\u884C\u5B89\u88C5\u7A0B\u5E8F: ${installerPath}`);
|
|
12383
|
-
const exitCode = await executeInstallerProcess(installerPath, installDir);
|
|
12501
|
+
const exitCode = await executeInstallerProcess(installerPath, installDir, installerLogPath);
|
|
12384
12502
|
options.onProgress?.(`\u5B89\u88C5\u8FDB\u7A0B\u9000\u51FA\u7801: ${exitCode}`);
|
|
12385
12503
|
if (exitCode !== 0) {
|
|
12386
12504
|
const validateInstalled = options.installModules === false ? validateAssistantBaseComplete : validateWorkRootComplete;
|
|
12387
12505
|
const directValidation = validateInstalled(installDir, options.config);
|
|
12388
12506
|
const registryWorkRoot = options.installModules === false ? await readRegistryInstallLocationRaw(options.config) : await readRegistryInstallLocation(options.config);
|
|
12389
12507
|
if (!directValidation.complete && !registryWorkRoot) {
|
|
12390
|
-
|
|
12508
|
+
const cause = describeInstallerExitCode(exitCode);
|
|
12509
|
+
throw new Error(`\u5B89\u88C5\u7A0B\u5E8F\u6267\u884C\u5931\u8D25\uFF08\u9000\u51FA\u7801 ${exitCode}\uFF09` + (cause ? `\uFF1A${cause}` : "") + (directValidation.reason ? `\uFF08${directValidation.reason}\uFF09` : "") + `\u3002\u5B89\u88C5\u65E5\u5FD7: ${installerLogPath}`);
|
|
12391
12510
|
}
|
|
12392
12511
|
options.onProgress?.(`\u5B89\u88C5\u7A0B\u5E8F\u9000\u51FA\u7801\u975E 0\uFF0C\u4F46\u57FA\u7840 runtime \u6587\u4EF6\u5DF2\u5B58\u5728\uFF0C\u7EE7\u7EED\u521D\u59CB\u5316: ${exitCode}`);
|
|
12393
12512
|
}
|
|
@@ -12956,7 +13075,28 @@ async function downloadRuntimeInstaller(config2, onProgress, installType = "full
|
|
|
12956
13075
|
onProgress?.(`\u5B89\u88C5\u5305 SHA256 \u6821\u9A8C\u901A\u8FC7: ${sha256}`);
|
|
12957
13076
|
return destination;
|
|
12958
13077
|
}
|
|
12959
|
-
function
|
|
13078
|
+
function describeInstallerExitCode(exitCode) {
|
|
13079
|
+
switch (exitCode) {
|
|
13080
|
+
case 1:
|
|
13081
|
+
return "\u5B89\u88C5\u7A0B\u5E8F\u672A\u80FD\u5F00\u59CB\u5B89\u88C5\uFF0C\u6700\u5E38\u89C1\u539F\u56E0\u662F\u53E6\u4E00\u4E2A\u667A\u80FD\u7BA1\u5BB6\u5B89\u88C5\u6216\u5378\u8F7D\u7A0B\u5E8F\u6B63\u5728\u8FD0\u884C\uFF08\u7A97\u53E3\u53EF\u80FD\u88AB\u906E\u6321\uFF0C\u6216\u505C\u5728\u63D0\u6743\u786E\u8BA4\u4E0A\uFF09\u3002\u8BF7\u5173\u95ED\u6240\u6709\u5B89\u88C5/\u5378\u8F7D\u7A97\u53E3\u540E\u91CD\u8BD5";
|
|
13082
|
+
case 2:
|
|
13083
|
+
return "\u5B89\u88C5\u5728\u5F00\u59CB\u524D\u88AB\u7528\u6237\u53D6\u6D88";
|
|
13084
|
+
case 3:
|
|
13085
|
+
case 4:
|
|
13086
|
+
return "\u5B89\u88C5\u8FC7\u7A0B\u4E2D\u53D1\u751F\u81F4\u547D\u9519\u8BEF\uFF08\u5E38\u89C1\u539F\u56E0\uFF1A\u78C1\u76D8\u7A7A\u95F4\u4E0D\u8DB3\u3001\u76EE\u6807\u6587\u4EF6\u88AB\u5176\u4ED6\u7A0B\u5E8F\u5360\u7528\u3001\u6216\u88AB\u5B89\u5168\u8F6F\u4EF6\u62E6\u622A\uFF09";
|
|
13087
|
+
case 5:
|
|
13088
|
+
return "\u5B89\u88C5\u8FC7\u7A0B\u4E2D\u88AB\u7528\u6237\u53D6\u6D88";
|
|
13089
|
+
case 7:
|
|
13090
|
+
return "\u5B89\u88C5\u524D\u68C0\u67E5\u5224\u5B9A\u5F53\u524D\u73AF\u5883\u65E0\u6CD5\u7EE7\u7EED\u5B89\u88C5";
|
|
13091
|
+
case 8:
|
|
13092
|
+
return "\u4E0A\u4E00\u6B21\u5B89\u88C5\u5C1A\u672A\u5B8C\u6210\uFF0C\u9700\u8981\u91CD\u542F\u7CFB\u7EDF\u540E\u624D\u80FD\u7EE7\u7EED\u5B89\u88C5";
|
|
13093
|
+
case 1223:
|
|
13094
|
+
return "\u5B89\u88C5\u7A0B\u5E8F\u8BF7\u6C42\u7BA1\u7406\u5458\u6743\u9650\u65F6\u88AB\u62D2\u7EDD\uFF08UAC\uFF09";
|
|
13095
|
+
default:
|
|
13096
|
+
return void 0;
|
|
13097
|
+
}
|
|
13098
|
+
}
|
|
13099
|
+
function executeInstallerProcess(installerPath, installDir, logPath) {
|
|
12960
13100
|
return new Promise((resolve5, reject) => {
|
|
12961
13101
|
const child = (0, import_child_process3.spawn)(installerPath, [
|
|
12962
13102
|
"/VERYSILENT",
|
|
@@ -12966,7 +13106,7 @@ function executeInstallerProcess(installerPath, installDir) {
|
|
|
12966
13106
|
"/NO_ICONS",
|
|
12967
13107
|
"/MERGETASKS=!desktopicon",
|
|
12968
13108
|
`/DIR=${installDir}`,
|
|
12969
|
-
`/LOG=${
|
|
13109
|
+
`/LOG=${logPath}`,
|
|
12970
13110
|
"/m"
|
|
12971
13111
|
], {
|
|
12972
13112
|
shell: false,
|
|
@@ -12975,7 +13115,7 @@ function executeInstallerProcess(installerPath, installDir) {
|
|
|
12975
13115
|
});
|
|
12976
13116
|
child.on("close", (code) => {
|
|
12977
13117
|
if (code === 2) {
|
|
12978
|
-
reject(new Error(
|
|
13118
|
+
reject(new Error(`\u5B89\u88C5\u7A0B\u5E8F\u6267\u884C\u5931\u8D25\uFF08\u9000\u51FA\u7801 2\uFF09\uFF1A${describeInstallerExitCode(2)}`));
|
|
12979
13119
|
} else if (code === null) {
|
|
12980
13120
|
reject(new Error("\u5B89\u88C5\u7A0B\u5E8F\u6267\u884C\u5931\u8D25\uFF0C\u672A\u8FD4\u56DE\u9000\u51FA\u7801"));
|
|
12981
13121
|
} else {
|
|
@@ -13257,16 +13397,6 @@ async function waitForZltafPipe(workRoot, config2, options) {
|
|
|
13257
13397
|
}
|
|
13258
13398
|
throw new Error(`\u7B49\u5F85 ZLTAF \u7BA1\u9053\u8D85\u65F6: ${discoverPipePath(workRoot, "ZLTAF")}`);
|
|
13259
13399
|
}
|
|
13260
|
-
async function waitForProcessIdentity(pid, timeoutMs) {
|
|
13261
|
-
const deadline = Date.now() + Math.max(1e3, timeoutMs);
|
|
13262
|
-
while (Date.now() <= deadline) {
|
|
13263
|
-
const identity = inspectRuntimeProcess(pid);
|
|
13264
|
-
if (identity)
|
|
13265
|
-
return identity;
|
|
13266
|
-
await delay(100);
|
|
13267
|
-
}
|
|
13268
|
-
return null;
|
|
13269
|
-
}
|
|
13270
13400
|
|
|
13271
13401
|
// ../zlt-runtime-core/dist/auth.js
|
|
13272
13402
|
var fs7 = __toESM(require("fs"), 1);
|
|
@@ -20834,7 +20964,7 @@ var UNIVERSAL_AGENT_IPC_TOOL_NAMES = Object.freeze([
|
|
|
20834
20964
|
"mcp-get-strategy-list",
|
|
20835
20965
|
"mcp-create-and-run-backtest",
|
|
20836
20966
|
"mcp-re-backtest",
|
|
20837
|
-
"mcp-get-
|
|
20967
|
+
"mcp-get-backtest-list",
|
|
20838
20968
|
"mcp-stop-backtest",
|
|
20839
20969
|
"mcp-get-backtest-state",
|
|
20840
20970
|
"mcp-get-backtest-profit",
|
|
@@ -20860,12 +20990,12 @@ var NPM_PACKAGE_CONFIG_TOOL_NAMES = Object.freeze([
|
|
|
20860
20990
|
"mcp-strategy-get-template-list",
|
|
20861
20991
|
"mcp-create-strategy-with-template",
|
|
20862
20992
|
"mcp-create-strategy",
|
|
20863
|
-
"mcp-create-tree",
|
|
20864
|
-
"mcp-get-tree",
|
|
20993
|
+
"mcp-create-strategy-tree",
|
|
20994
|
+
"mcp-get-strategy-tree-list",
|
|
20865
20995
|
"mcp-get-data-range",
|
|
20866
20996
|
"mcp-download-data",
|
|
20867
20997
|
"mcp-get-download-progress",
|
|
20868
|
-
"mcp-
|
|
20998
|
+
"mcp-get-cloud-data-list",
|
|
20869
20999
|
"mcp-get-cache-diff",
|
|
20870
21000
|
"mcp-get-data-disk-space",
|
|
20871
21001
|
"mcp-stop-download",
|
|
@@ -20876,7 +21006,7 @@ var NPM_PACKAGE_CONFIG_TOOL_NAMES = Object.freeze([
|
|
|
20876
21006
|
"mcp-get-backtest-profit",
|
|
20877
21007
|
"mcp-get-backtest-entrust",
|
|
20878
21008
|
"mcp-get-strategy-list",
|
|
20879
|
-
"mcp-get-
|
|
21009
|
+
"mcp-get-backtest-list",
|
|
20880
21010
|
"mcp-delete-strategy",
|
|
20881
21011
|
"mcp-open-vscode",
|
|
20882
21012
|
"mcp-wait"
|
|
@@ -20885,6 +21015,15 @@ var NPM_PACKAGE_CONFIG_TOOL_NAMES = Object.freeze([
|
|
|
20885
21015
|
// src/tool-pipeline.ts
|
|
20886
21016
|
var fs11 = __toESM(require("node:fs"), 1);
|
|
20887
21017
|
var path11 = __toESM(require("node:path"), 1);
|
|
21018
|
+
|
|
21019
|
+
// src/feature-set.ts
|
|
21020
|
+
function resolveFeatureSet() {
|
|
21021
|
+
return false ? "core" : "full";
|
|
21022
|
+
}
|
|
21023
|
+
var MASKED_FACTOR_MESSAGE = "\u56E0\u5B50\u7814\u7A76\u529F\u80FD\u5728\u5F53\u524D\u7248\u672C\u672A\u5F00\u653E\u3002";
|
|
21024
|
+
var MASKED_FUTURES_MESSAGE = "\u671F\u8D27\u56DE\u6D4B\u5728\u5F53\u524D\u7248\u672C\u672A\u5F00\u653E\uFF1ArunParams.marketIds \u542B\u671F\u8D27\u4EA4\u6613\u6240\uFF08zj/zs/ds/sq/gq\uFF09\u6216 account_list \u7684 account_type \u4E3A\u671F\u8D27\u3002\u8BF7\u4F7F\u7528\u80A1\u7968\u5E02\u573A\uFF08sh/sz\uFF09\u4E0E account_type=1\u3002";
|
|
21025
|
+
|
|
21026
|
+
// src/tool-pipeline.ts
|
|
20888
21027
|
var FUTURES_MARKET_IDS = /* @__PURE__ */ new Set(["zj", "zs", "ds", "sq", "gq"]);
|
|
20889
21028
|
function isFuturesRun(marketIds) {
|
|
20890
21029
|
if (!marketIds) return false;
|
|
@@ -20895,7 +21034,26 @@ function prepareToolArgs(tool, args, contexts) {
|
|
|
20895
21034
|
const inherited = inheritReBacktestRunParams(tool, args, contexts);
|
|
20896
21035
|
const dated = applyBacktestDateDefaults(tool, inherited);
|
|
20897
21036
|
const named = normalizeBacktestRunName(tool, dated);
|
|
20898
|
-
|
|
21037
|
+
const prepared = stripEmptyLegacyUserId(tool, named);
|
|
21038
|
+
return refuseMaskedFuturesBacktest(tool, prepared) ?? prepared;
|
|
21039
|
+
}
|
|
21040
|
+
var FUTURES_GATED_TOOLS = /* @__PURE__ */ new Set(["mcp-create-and-run-backtest", "mcp-re-backtest"]);
|
|
21041
|
+
var FUTURES_ACCOUNT_TYPES = /* @__PURE__ */ new Set([2, 6]);
|
|
21042
|
+
function refuseMaskedFuturesBacktest(tool, args) {
|
|
21043
|
+
if (!FUTURES_GATED_TOOLS.has(tool.name) || resolveFeatureSet() !== "core") return null;
|
|
21044
|
+
const runParams = args.runParams ?? {};
|
|
21045
|
+
const marketIds = Array.isArray(runParams.marketIds) ? runParams.marketIds : [];
|
|
21046
|
+
const accounts = Array.isArray(runParams.account_list) ? runParams.account_list : [];
|
|
21047
|
+
const futuresAccount = accounts.some(
|
|
21048
|
+
(account) => !!account && typeof account === "object" && FUTURES_ACCOUNT_TYPES.has(Number(account.account_type))
|
|
21049
|
+
);
|
|
21050
|
+
if (!isFuturesRun(marketIds) && !futuresAccount) return null;
|
|
21051
|
+
return jsonToolResult(10057, MASKED_FUTURES_MESSAGE, {
|
|
21052
|
+
retryableByAgent: false,
|
|
21053
|
+
tool: tool.name,
|
|
21054
|
+
marketIds,
|
|
21055
|
+
userAction: "\u5F53\u524D\u7248\u672C\u4EC5\u652F\u6301\u80A1\u7968\u56DE\u6D4B\uFF08sh/sz\uFF09\uFF1B\u671F\u8D27\u56DE\u6D4B\u8BF7\u7B49\u5F85\u540E\u7EED\u7248\u672C\u5F00\u653E\u3002"
|
|
21056
|
+
}, true);
|
|
20899
21057
|
}
|
|
20900
21058
|
async function dispatchSpecialTool(tool, args, client, timeout, session, waitControl) {
|
|
20901
21059
|
if (tool.name === "mcp-factor-task-status") {
|
|
@@ -22098,6 +22256,12 @@ async function runWait(_tool, args, client, timeout, session, control) {
|
|
|
22098
22256
|
{ action: 'Pass kind="factor" with the executionId from a factor start tool, kind="backtest" with the runId from mcp-create-and-run-backtest, or kind="download" with the uuid from mcp-download-data.' }
|
|
22099
22257
|
);
|
|
22100
22258
|
}
|
|
22259
|
+
if (kind === "factor" && resolveFeatureSet() === "core") {
|
|
22260
|
+
return waitError(10057, MASKED_FACTOR_MESSAGE, {
|
|
22261
|
+
action: "Factor research is not available in this build; do not retry with other factor tools.",
|
|
22262
|
+
userAction: MASKED_FACTOR_MESSAGE
|
|
22263
|
+
});
|
|
22264
|
+
}
|
|
22101
22265
|
if (!id) {
|
|
22102
22266
|
if (kind === "factor") {
|
|
22103
22267
|
return waitError(
|
|
@@ -22476,6 +22640,25 @@ function applySchemaDefaults(schema, value) {
|
|
|
22476
22640
|
}
|
|
22477
22641
|
return result;
|
|
22478
22642
|
}
|
|
22643
|
+
function applyBodyDefaults(defaults, value) {
|
|
22644
|
+
if (!isRecord2(defaults)) return value;
|
|
22645
|
+
if (value === void 0) return cloneDefaultValue(defaults);
|
|
22646
|
+
if (!isRecord2(value)) return value;
|
|
22647
|
+
const result = { ...value };
|
|
22648
|
+
for (const [key, defaultValue] of Object.entries(defaults)) {
|
|
22649
|
+
const has = Object.prototype.hasOwnProperty.call(value, key) && value[key] !== void 0;
|
|
22650
|
+
if (!has) {
|
|
22651
|
+
result[key] = cloneDefaultValue(defaultValue);
|
|
22652
|
+
} else if (isRecord2(defaultValue) && isRecord2(value[key])) {
|
|
22653
|
+
result[key] = applyBodyDefaults(defaultValue, value[key]);
|
|
22654
|
+
}
|
|
22655
|
+
}
|
|
22656
|
+
return result;
|
|
22657
|
+
}
|
|
22658
|
+
function applyToolArgDefaults(tool, args) {
|
|
22659
|
+
const schemaDefaulted = applySchemaDefaults(tool.inputSchema, args);
|
|
22660
|
+
return applyBodyDefaults(tool.bodyDefaults, schemaDefaulted);
|
|
22661
|
+
}
|
|
22479
22662
|
function cloneDefaultValue(value) {
|
|
22480
22663
|
if (Array.isArray(value)) {
|
|
22481
22664
|
return value.map((item) => cloneDefaultValue(item));
|
|
@@ -23774,7 +23957,7 @@ function summarizeBacktestProfit(runDir, options = {}) {
|
|
|
23774
23957
|
function handleBacktestProfitTool(args, contexts) {
|
|
23775
23958
|
const backtestId = typeof args.backtestId === "string" ? args.backtestId.trim() : "";
|
|
23776
23959
|
if (!backtestId) {
|
|
23777
|
-
return toolText({ ErrNo:
|
|
23960
|
+
return toolText({ ErrNo: 10060, ErrMsg: "\u7F3A\u5C11 backtestId\uFF0C\u65E0\u6CD5\u5B9A\u4F4D\u56DE\u6D4B\u4EA7\u7269\u76EE\u5F55\u3002", Data: { retryableByAgent: true } }, true);
|
|
23778
23961
|
}
|
|
23779
23962
|
const explicit = typeof args.codePath === "string" ? args.codePath.trim() : "";
|
|
23780
23963
|
const runDir = explicit || contexts.get(backtestId)?.codePath || "";
|
|
@@ -23829,7 +24012,7 @@ var RUNTIME_TOOLS = [
|
|
|
23829
24012
|
},
|
|
23830
24013
|
{
|
|
23831
24014
|
name: "zlt-runtime-start",
|
|
23832
|
-
description: "\
|
|
24015
|
+
description: "\u542F\u52A8\u5DF2\u5B89\u88C5\u7684\u667A\u91CF\u901A\u672C\u5730\u56DE\u6D4B runtime\uFF1A\u7ECF\u667A\u80FD\u7BA1\u5BB6\uFF08ZLTHome selfstart\uFF09\u6258\u7BA1\u62C9\u8D77\u5E76\u7B49\u5F85\u5176\u521B\u5EFA\u7684 ZLTAF \u7BA1\u9053\uFF0C\u7EDD\u4E0D\u76F4\u63A5\u542F\u52A8 zltaf.exe\u3002\u672C\u5DE5\u5177\u4E0D\u4F1A\u542F\u52A8 Code.exe \u6216 jsservice\uFF0C\u4E5F\u4E0D\u8BFB\u53D6 backServiceRun.json\u3002\u5B89\u88C5\u5B8C\u6210\u540E\u5982\u679C backtestReady=false\uFF0C\u5E94\u8C03\u7528 zlt-runtime-install \u4FEE\u590D zltaf\u3001Python/Git \u6216 SDK\uFF1B\u4E0D\u8981\u624B\u52A8\u521B\u5EFA zltaf \u76EE\u5F55\u3002",
|
|
23833
24016
|
inputSchema: {
|
|
23834
24017
|
type: "object",
|
|
23835
24018
|
properties: {},
|
|
@@ -23839,7 +24022,7 @@ var RUNTIME_TOOLS = [
|
|
|
23839
24022
|
},
|
|
23840
24023
|
{
|
|
23841
24024
|
name: "zlt-runtime-install",
|
|
23842
|
-
description: "\u4E0B\u8F7D\u5E76\u5B89\u88C5\u667A\u91CF\u901A\u672C\u5730 ZLTAF runtime\uFF0C\u6821\u9A8C\u6295\u7814\u6A21\u5757\u4E0B\u53D1\u7684 Python/MinGit \u5DE5\u5177\u94FE\u4E0E zltquant/zltsdk\uFF0C\u5E76\
|
|
24025
|
+
description: "\u4E0B\u8F7D\u5E76\u5B89\u88C5\u667A\u91CF\u901A\u672C\u5730 ZLTAF runtime\uFF0C\u6821\u9A8C\u6295\u7814\u6A21\u5757\u4E0B\u53D1\u7684 Python/MinGit \u5DE5\u5177\u94FE\u4E0E zltquant/zltsdk\uFF0C\u5E76\u7ECF\u667A\u80FD\u7BA1\u5BB6\u6258\u7BA1\u542F\u52A8\u56DE\u6D4B\u670D\u52A1\u3002Python \u4E0E MinGit \u5F52\u6295\u7814\u6A21\u5757\u4E0B\u53D1\uFF0C\u672C\u5DE5\u5177\u53EA\u6821\u9A8C\u3001\u4E0D\u518D\u81EA\u884C\u4E0B\u8F7D\u6216\u4FEE\u590D\u5B83\u4EEC\uFF1A\u7F3A\u5931\u65F6\u4F1A\u660E\u786E\u62A5\u51FA\u300C\u8BF7\u5728\u667A\u80FD\u7BA1\u5BB6\u4E2D\u5B89\u88C5\u6216\u4FEE\u590D\u6295\u7814\u6A21\u5757\u300D\u3002\u8BE5\u64CD\u4F5C\u4F1A\u5199\u5165\u672C\u673A\u78C1\u76D8\u5E76\u53EF\u80FD\u89E6\u53D1 Windows \u5B89\u88C5/UAC\uFF0C\u8C03\u7528\u524D\u5FC5\u987B\u53D6\u5F97\u7528\u6237\u786E\u8BA4\uFF0C\u5E76\u4F20\u5165 confirm=true\u3002\u5B89\u88C5\u5305\u5FC5\u987B\u81EA\u5E26 zltaf\uFF1B\u672C\u5DE5\u5177\u4E0D\u4F1A\u901A\u8FC7 Assistant IPC\u3001ZLTHome \u6216 ZLTBackService \u8865\u88C5\u6A21\u5757\uFF0C\u4E5F\u4E0D\u4F1A\u542F\u52A8 Code.exe/jsservice\u3002",
|
|
23843
24026
|
inputSchema: {
|
|
23844
24027
|
type: "object",
|
|
23845
24028
|
properties: {
|
|
@@ -23873,14 +24056,7 @@ async function startMcpServer() {
|
|
|
23873
24056
|
...resolveListedRuntimeTools(RUNTIME_TOOLS, toolProfile),
|
|
23874
24057
|
...resolveListedIpcTools(config2.tools, toolProfile)
|
|
23875
24058
|
];
|
|
23876
|
-
const runtimeConfig =
|
|
23877
|
-
...loadAssistantRuntimeConfig(resolveDefaultRuntimeConfigPath()),
|
|
23878
|
-
zltafConfigFile: ZLTAF_CONFIG_FILE_DAY,
|
|
23879
|
-
// Trae/WorkBuddy owns a standalone direct-ZLTAF lane. 智能管家 and its
|
|
23880
|
-
// Assistant-managed services belong to the zlt-quant VSCode runtime.
|
|
23881
|
-
manualServiceIndices: [],
|
|
23882
|
-
startupCheckIndices: []
|
|
23883
|
-
};
|
|
24059
|
+
const runtimeConfig = loadAssistantRuntimeConfig(resolveDefaultRuntimeConfigPath());
|
|
23884
24060
|
let runtimeStartAttempted = false;
|
|
23885
24061
|
let runtimeLease;
|
|
23886
24062
|
let leaseStateUpdate = Promise.resolve();
|
|
@@ -23973,7 +24149,7 @@ async function startMcpServer() {
|
|
|
23973
24149
|
isError: true
|
|
23974
24150
|
};
|
|
23975
24151
|
}
|
|
23976
|
-
const defaultedToolArgs =
|
|
24152
|
+
const defaultedToolArgs = applyToolArgDefaults(tool, args ?? {});
|
|
23977
24153
|
const preparedArgs = prepareToolArgs(tool, defaultedToolArgs, backtestRunContexts);
|
|
23978
24154
|
if ("content" in preparedArgs) return preparedArgs;
|
|
23979
24155
|
const toolArgs = preparedArgs;
|
|
@@ -24099,6 +24275,14 @@ async function startMcpServer() {
|
|
|
24099
24275
|
if (runtimeLease) {
|
|
24100
24276
|
const lease = runtimeLease;
|
|
24101
24277
|
runtimeLease = void 0;
|
|
24278
|
+
try {
|
|
24279
|
+
const zltContent = await readZltContent(lease.workRoot, runtimeConfig.temporaryZltFile);
|
|
24280
|
+
if (zltContent) await unregisterRuntimeConsumerPid(zltContent, runtimeConfig);
|
|
24281
|
+
process.stderr.write("[zlt-mcp-proxy] runtime PID \u5DF2\u6CE8\u9500\n");
|
|
24282
|
+
} catch (error2) {
|
|
24283
|
+
process.stderr.write(`[zlt-mcp-proxy] runtime PID \u6CE8\u9500\u5931\u8D25\uFF08\u5FFD\u7565\uFF09: ${error2 instanceof Error ? error2.message : String(error2)}
|
|
24284
|
+
`);
|
|
24285
|
+
}
|
|
24102
24286
|
try {
|
|
24103
24287
|
const released = await releaseRuntimeLease(lease);
|
|
24104
24288
|
process.stderr.write(`[zlt-mcp-proxy] runtime lease released: ${released.reason}
|
|
@@ -24454,7 +24638,7 @@ function getRuntimeRecommendedAction(runtimeReady, backtestReady) {
|
|
|
24454
24638
|
return "call zlt-runtime-install with confirm=true to install the local backtest runtime";
|
|
24455
24639
|
}
|
|
24456
24640
|
if (!backtestReady) {
|
|
24457
|
-
return "if zltaf is missing, call zlt-runtime-install with confirm=true. Python/Git toolchain and SDK packages come from the \u6295\u7814 module: ask the user to install or repair it in \u667A\u80FD\u7BA1\u5BB6. Then start
|
|
24641
|
+
return "if zltaf is missing, call zlt-runtime-install with confirm=true. Python/Git toolchain and SDK packages come from the \u6295\u7814 module: ask the user to install or repair it in \u667A\u80FD\u7BA1\u5BB6. Then start the managed runtime.";
|
|
24458
24642
|
}
|
|
24459
24643
|
return "call zlt-runtime-start before backtest if the ZLTAF pipe is not running";
|
|
24460
24644
|
}
|
|
@@ -24466,10 +24650,10 @@ function getRuntimeStartUserAction(message) {
|
|
|
24466
24650
|
return "\u667A\u91CF\u901A\u672C\u5730 ZLTAF runtime \u4E0D\u5B8C\u6574\uFF0C\u672A\u627E\u5230 C:\\ZLTClient\\zltaf\\zltaf.exe\u3002\u8BF7\u53D6\u5F97\u7528\u6237\u786E\u8BA4\u540E\u8C03\u7528 zlt-runtime-install\uFF0C\u4F7F\u7528\u5305\u542B zltaf \u7684\u5B89\u88C5\u5305\u4FEE\u590D\uFF1B\u4E0D\u8981\u624B\u52A8\u521B\u5EFA zltaf \u76EE\u5F55\u3002";
|
|
24467
24651
|
}
|
|
24468
24652
|
if (/handshake/i.test(message)) {
|
|
24469
|
-
return "\u667A\u91CF\u901A
|
|
24653
|
+
return "\u667A\u91CF\u901A\u6258\u7BA1\u542F\u52A8\uFF08ZLTHome selfstart\uFF09\u63E1\u624B\u5931\u8D25\u3002\u8BF7\u628A ErrMsg \u548C doctor \u7ED3\u679C\u53CD\u9988\u7ED9\u5F00\u53D1\u8005\u6392\u67E5 ZLTAF \u7BA1\u9053\u534F\u8BAE\uFF1B\u4E0D\u8981\u624B\u52A8\u521B\u5EFA zltaf \u76EE\u5F55\uFF0C\u4E5F\u4E0D\u8981\u542F\u52A8 ZLTHome\u3001ZLTBackService\u3001Code.exe \u6216 jsservice\u3002";
|
|
24470
24654
|
}
|
|
24471
24655
|
if (/pipe|管道|ZLTAF/i.test(message)) {
|
|
24472
|
-
return "\u667A\u91CF\u901A ZLTAF \u7BA1\u9053\u4ECD\u4E0D\u53EF\u7528\u3002\u8BF7\u628A ErrMsg\u3001doctor \u7ED3\u679C\u548C zltaf \u65E5\u5FD7\u53CD\u9988\u7ED9\u5F00\u53D1\u8005\u6392\u67E5
|
|
24656
|
+
return "\u667A\u91CF\u901A ZLTAF \u7BA1\u9053\u4ECD\u4E0D\u53EF\u7528\u3002\u8BF7\u628A ErrMsg\u3001doctor \u7ED3\u679C\u548C zltaf \u65E5\u5FD7\u53CD\u9988\u7ED9\u5F00\u53D1\u8005\u6392\u67E5\u6258\u7BA1\u542F\u52A8\u94FE\u8DEF\uFF1B\u4E0D\u8981\u624B\u52A8\u521B\u5EFA zltaf \u76EE\u5F55\uFF0C\u4E5F\u4E0D\u8981\u542F\u52A8 ZLTHome\u3001ZLTBackService\u3001Code.exe \u6216 jsservice\u3002";
|
|
24473
24657
|
}
|
|
24474
24658
|
return "\u667A\u91CF\u901A ZLTAF runtime \u542F\u52A8\u5931\u8D25\u3002\u8BF7\u628A ErrMsg \u548C doctor \u7ED3\u679C\u53CD\u9988\u7ED9\u7528\u6237\u6216\u5F00\u53D1\u8005\u6392\u67E5\uFF1B\u4E0D\u8981\u624B\u52A8\u521B\u5EFA zltaf \u76EE\u5F55\u3001\u6740\u8FDB\u7A0B\u3001\u542F\u52A8 ZLTHome/ZLTBackService/Code.exe/jsservice \u6216\u91CD\u590D\u5B89\u88C5 runtime\u3002";
|
|
24475
24659
|
}
|
|
@@ -24483,7 +24667,7 @@ function getRuntimeInstallUserAction(message) {
|
|
|
24483
24667
|
if (/handshake|pipe|管道|ZLTAF/i.test(message)) {
|
|
24484
24668
|
return getRuntimeStartUserAction(message);
|
|
24485
24669
|
}
|
|
24486
|
-
return "\u667A\u91CF\u901A ZLTAF runtime \u5B89\u88C5/\u4FEE\u590D\u5931\u8D25\u3002\u8BF7\u628A ErrMsg \u548C doctor \u7ED3\u679C\u53CD\u9988\u7ED9\u5F00\u53D1\u8005\u6392\u67E5\u5B89\u88C5\u5668\u6216
|
|
24670
|
+
return "\u667A\u91CF\u901A ZLTAF runtime \u5B89\u88C5/\u4FEE\u590D\u5931\u8D25\u3002\u8BF7\u628A ErrMsg \u548C doctor \u7ED3\u679C\u53CD\u9988\u7ED9\u5F00\u53D1\u8005\u6392\u67E5\u5B89\u88C5\u5668\u6216\u6258\u7BA1\u542F\u52A8\u94FE\u8DEF\uFF1B\u4E0D\u8981\u624B\u52A8\u521B\u5EFA zltaf \u76EE\u5F55\u3001\u6740\u8FDB\u7A0B\u3001\u542F\u52A8 ZLTHome/ZLTBackService/Code.exe/jsservice \u6216\u91CD\u590D\u5B89\u88C5 runtime\u3002";
|
|
24487
24671
|
}
|
|
24488
24672
|
function runtimeRecoveryStopData(message, extra = {}, handler = "runtimeStart") {
|
|
24489
24673
|
return {
|