@dshtrading/connector-longbridge 0.1.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/LICENSE +75 -0
- package/README.md +34 -0
- package/lib/dataplane.d.ts +7 -0
- package/lib/dataplane.js +33 -0
- package/lib/index.d.ts +48 -0
- package/lib/index.js +278 -0
- package/lib/rest.d.ts +45 -0
- package/lib/rest.js +217 -0
- package/package.json +39 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
Copyright (c) 2026 zhu1090093659 (dsh-trading)
|
|
2
|
+
|
|
3
|
+
# PolyForm Noncommercial License 1.0.0
|
|
4
|
+
|
|
5
|
+
<https://polyformproject.org/licenses/noncommercial/1.0.0>
|
|
6
|
+
|
|
7
|
+
## Acceptance
|
|
8
|
+
|
|
9
|
+
In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
|
|
10
|
+
|
|
11
|
+
## Copyright License
|
|
12
|
+
|
|
13
|
+
The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor's copyright in it for any permitted purpose. However, you may only distribute the software according to [Distribution License](#distribution-license) and make changes or new works based on the software according to [Changes and New Works License](#changes-and-new-works-license).
|
|
14
|
+
|
|
15
|
+
## Distribution License
|
|
16
|
+
|
|
17
|
+
The licensor grants you an additional copyright license to distribute copies of the software. Your license to distribute covers distributing the software with changes and new works permitted by [Changes and New Works License](#changes-and-new-works-license).
|
|
18
|
+
|
|
19
|
+
## Notices
|
|
20
|
+
|
|
21
|
+
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms or the URL for them above, as well as copies of any plain-text lines beginning with `Required Notice:` that the licensor provided with the software. For example:
|
|
22
|
+
|
|
23
|
+
> Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
|
|
24
|
+
|
|
25
|
+
## Changes and New Works License
|
|
26
|
+
|
|
27
|
+
The licensor grants you an additional copyright license to make changes and new works based on the software for any permitted purpose.
|
|
28
|
+
|
|
29
|
+
## Patent License
|
|
30
|
+
|
|
31
|
+
The licensor grants you a patent license for the software that covers patent claims the licensor can license, or becomes able to license, that you would infringe by using the software.
|
|
32
|
+
|
|
33
|
+
## Noncommercial Purposes
|
|
34
|
+
|
|
35
|
+
Any noncommercial purpose is a permitted purpose.
|
|
36
|
+
|
|
37
|
+
## Personal Uses
|
|
38
|
+
|
|
39
|
+
Personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, amateur pursuits, or religious observance, without any anticipated commercial application, is use for a permitted purpose.
|
|
40
|
+
|
|
41
|
+
## Noncommercial Organizations
|
|
42
|
+
|
|
43
|
+
Use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization, or government institution is use for a permitted purpose regardless of the source of funding or obligations resulting from the funding.
|
|
44
|
+
|
|
45
|
+
## Fair Use
|
|
46
|
+
|
|
47
|
+
You may have "fair use" rights for the software under the law. These terms do not limit them.
|
|
48
|
+
|
|
49
|
+
## No Other Rights
|
|
50
|
+
|
|
51
|
+
These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the licensor from granting licenses to anyone else. These terms do not imply any other licenses.
|
|
52
|
+
|
|
53
|
+
## Patent Defense
|
|
54
|
+
|
|
55
|
+
If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
|
|
56
|
+
|
|
57
|
+
## Violations
|
|
58
|
+
|
|
59
|
+
The first time you are notified in writing that you have violated any of these terms, or done anything with the software not covered by your licenses, your licenses can nonetheless continue if you come into full compliance with these terms, and take practical steps to correct past violations, within 32 days of receiving notice. Otherwise, all your licenses end immediately.
|
|
60
|
+
|
|
61
|
+
## No Liability
|
|
62
|
+
|
|
63
|
+
***As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.***
|
|
64
|
+
|
|
65
|
+
## Definitions
|
|
66
|
+
|
|
67
|
+
The **licensor** is the individual or entity offering these terms, and the **software** is the software the licensor makes available under these terms.
|
|
68
|
+
|
|
69
|
+
**You** refers to the individual or entity agreeing to these terms.
|
|
70
|
+
|
|
71
|
+
**Your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. **Control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
|
72
|
+
|
|
73
|
+
**Your licenses** are all the licenses granted to you for the software under these terms.
|
|
74
|
+
|
|
75
|
+
**Use** means anything you do with the software requiring one of your licenses.
|
package/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# @dshtrading/connector-template
|
|
2
|
+
|
|
3
|
+
**本包是脚手架源,不是可安装的连接器**:不入任何 bundle 依赖,仅在 `pnpm -r build/test`
|
|
4
|
+
基线内保证可编译、冒烟测试绿。真实接入用生成器:
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
node scripts/new-connector.mjs --slug bybit --title Bybit --market crypto
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
生成后按 [docs/connector-playbook.md](../../docs/connector-playbook.md) 的填写顺序
|
|
11
|
+
(src/rest.ts 头部清单 7 项)实现 TODO。每个 TODO 的参照段都在 connector-okx
|
|
12
|
+
(packages/connector-okx/),它是本仓第一个真实 TradeService 连接器。
|
|
13
|
+
|
|
14
|
+
## 结构
|
|
15
|
+
|
|
16
|
+
- `src/rest.ts` —— 错误载体(TradingServiceError)+ 通用请求管线(超时/错误映射/
|
|
17
|
+
模拟盘头/注入 fetch)直接可用;签名与端点 TODO。
|
|
18
|
+
- `src/index.ts` —— Config(enabled/env/dryRun/liveTrading + 三 ref 凭证组)、
|
|
19
|
+
闸门三态判定、凭证解析(BYOK + 环境变量回落)、MarketDataService/TradeService 骨架、
|
|
20
|
+
7 个市场前缀工具注册(duplicate-safe)、apply(enabled=false 静默退出)。
|
|
21
|
+
- `test/template.test.ts` —— 结构冒烟 7 用例。
|
|
22
|
+
|
|
23
|
+
## Token
|
|
24
|
+
|
|
25
|
+
`longbridge`(slug)/ `Longbridge`(title)/ `LONGBRIDGE`(ref 前缀)/
|
|
26
|
+
`hk`(工具前缀)/ `Hk`(服务键 infix)。token 未展开也可编译;
|
|
27
|
+
生成器保证全部替换。
|
|
28
|
+
|
|
29
|
+
## 注意(勿改的坑)
|
|
30
|
+
|
|
31
|
+
- 服务类用 TS 编译期 `private`(禁 ECMAScript `#`,realm 代理会炸)。
|
|
32
|
+
- 工具名 = 市场前缀 + 语义词(不带交易所名)——base 闸门正则只认市场前缀。
|
|
33
|
+
- 行 id = `dsh-trading-<market>-connector-<slug>`,全仓唯一(insert-only 铁律 #1)。
|
|
34
|
+
- 凭证只进 ref,绝不内置/落日志(铁律 #3/#5)。
|
package/lib/dataplane.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { LongbridgeMarketDataService, TRADING_HK_MARKET_DATA_KEY } from "./index.js";
|
|
2
|
+
//#region src/dataplane.ts
|
|
3
|
+
const inject = [];
|
|
4
|
+
function resolveMarketDataRegistry(ctx) {
|
|
5
|
+
const candidate = ctx.get?.("tradingMarketDataRegistry", false);
|
|
6
|
+
return candidate !== void 0 ? candidate : void 0;
|
|
7
|
+
}
|
|
8
|
+
const ROUTER_PROVIDER = "longbridge";
|
|
9
|
+
const MARKET = "hk";
|
|
10
|
+
function apply(ctx, config) {
|
|
11
|
+
if (!config.enabled) return;
|
|
12
|
+
const appKey = process.env[config.appKeyRef];
|
|
13
|
+
const appSecret = process.env[config.appSecretRef];
|
|
14
|
+
const accessToken = process.env[config.accessTokenRef];
|
|
15
|
+
const registry = resolveMarketDataRegistry(ctx);
|
|
16
|
+
if (registry === void 0) {
|
|
17
|
+
new LongbridgeMarketDataService(ctx, {
|
|
18
|
+
appKey,
|
|
19
|
+
appSecret,
|
|
20
|
+
accessToken
|
|
21
|
+
});
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const inner = ctx.isolate(TRADING_HK_MARKET_DATA_KEY);
|
|
25
|
+
const service = new LongbridgeMarketDataService(inner, {
|
|
26
|
+
appKey,
|
|
27
|
+
appSecret,
|
|
28
|
+
accessToken
|
|
29
|
+
});
|
|
30
|
+
ctx.effect(() => registry.register(MARKET, ROUTER_PROVIDER, service));
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { apply, inject };
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { AccountBalance, INTERVAL_VOCABULARY, Interval, Kline, LongbridgeRestClient, LongbridgeRestOptions, Order, Position, Ticker, TradingServiceError, generateLongbridgeSignature, parseIntervalMs, toLongbridgePeriod, toLongbridgeSymbol } from "./rest.js";
|
|
2
|
+
import { Context, Service } from "@deepseek-ai/cordis";
|
|
3
|
+
import Schema from "@deepseek-ai/schemastery";
|
|
4
|
+
import { AccountBalance as AccountBalance$1, Disposable, Interval as Interval$1, Kline as Kline$1, MarketDataService, Order as Order$1, OrderRequest, Position as Position$1, Ticker as Ticker$1, TradeService } from "@dshtrading/api";
|
|
5
|
+
//#region src/index.d.ts
|
|
6
|
+
declare const name = "dsh-trading-hk-connector-longbridge";
|
|
7
|
+
interface Config {
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
env: 'demo' | 'live';
|
|
10
|
+
dryRun: boolean;
|
|
11
|
+
liveTrading: boolean;
|
|
12
|
+
appKeyRef: string;
|
|
13
|
+
appSecretRef: string;
|
|
14
|
+
accessTokenRef: string;
|
|
15
|
+
}
|
|
16
|
+
declare const Config: Schema<Config>;
|
|
17
|
+
declare const TRADING_HK_MARKET_DATA_KEY = "tradingHkMarketData";
|
|
18
|
+
declare const TRADING_HK_TRADE_KEY = "tradingHkTrade";
|
|
19
|
+
declare class LongbridgeMarketDataService extends Service implements MarketDataService {
|
|
20
|
+
private readonly client;
|
|
21
|
+
constructor(ctx: Context, options?: LongbridgeRestOptions, serviceName?: string);
|
|
22
|
+
getTicker(symbol: string): Promise<Ticker$1>;
|
|
23
|
+
getKlines(symbol: string, interval?: Interval$1, limit?: number): Promise<Kline$1[]>;
|
|
24
|
+
subscribeTicker(symbol: string, cb: (ticker: Ticker$1) => void, options?: {
|
|
25
|
+
intervalMs?: number;
|
|
26
|
+
}): Disposable;
|
|
27
|
+
}
|
|
28
|
+
declare class LongbridgeTradeService extends Service implements TradeService {
|
|
29
|
+
private readonly client;
|
|
30
|
+
/** 插件配置(服务缝闸门 P0:dryRun 强制模拟 / liveTrading 总闸门)。 */
|
|
31
|
+
private readonly config;
|
|
32
|
+
constructor(ctx: Context, options: LongbridgeRestOptions & {
|
|
33
|
+
config: Config;
|
|
34
|
+
}, serviceName?: string);
|
|
35
|
+
getBalance(): Promise<AccountBalance$1>;
|
|
36
|
+
placeOrder(order: OrderRequest): Promise<Order$1>;
|
|
37
|
+
cancelOrder(orderId: string): Promise<{
|
|
38
|
+
orderId: string;
|
|
39
|
+
status: 'canceled';
|
|
40
|
+
}>;
|
|
41
|
+
getPositions(): Promise<Position$1[]>;
|
|
42
|
+
getOrders(): Promise<Order$1[]>;
|
|
43
|
+
}
|
|
44
|
+
declare const ROUTER_PROVIDER = "longbridge";
|
|
45
|
+
declare function routeAllows(ctx: Context, config: Config, market: string): boolean;
|
|
46
|
+
declare function apply(ctx: Context, config: Config): void;
|
|
47
|
+
//#endregion
|
|
48
|
+
export { type AccountBalance, Config, INTERVAL_VOCABULARY, type Interval, type Kline, LongbridgeMarketDataService, LongbridgeRestClient, LongbridgeRestOptions, LongbridgeTradeService, type Order, type Position, ROUTER_PROVIDER, TRADING_HK_MARKET_DATA_KEY, TRADING_HK_TRADE_KEY, type Ticker, TradingServiceError, apply, generateLongbridgeSignature, name, parseIntervalMs, routeAllows, toLongbridgePeriod, toLongbridgeSymbol };
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { INTERVAL_VOCABULARY, LongbridgeRestClient, TradingServiceError, generateLongbridgeSignature, parseIntervalMs, toLongbridgePeriod, toLongbridgeSymbol as toLongbridgeSymbol$1 } from "./rest.js";
|
|
2
|
+
import { Service } from "@deepseek-ai/cordis";
|
|
3
|
+
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
4
|
+
import Schema from "@deepseek-ai/schemastery";
|
|
5
|
+
//#region src/index.ts
|
|
6
|
+
const name = "dsh-trading-hk-connector-longbridge";
|
|
7
|
+
const Config = Schema.object({
|
|
8
|
+
enabled: Schema.boolean().default(true).description("是否激活 Longbridge 连接器"),
|
|
9
|
+
env: Schema.union(["demo", "live"]).default("demo").description("运行环境"),
|
|
10
|
+
dryRun: Schema.boolean().default(true).description("默认模拟下单"),
|
|
11
|
+
liveTrading: Schema.boolean().default(false).description("是否允许实盘交易"),
|
|
12
|
+
appKeyRef: Schema.string().default("LONGBRIDGE_APP_KEY").description("Longbridge App Key 环境变量名 (BYOK)"),
|
|
13
|
+
appSecretRef: Schema.string().default("LONGBRIDGE_APP_SECRET").description("Longbridge App Secret 环境变量名"),
|
|
14
|
+
accessTokenRef: Schema.string().default("LONGBRIDGE_ACCESS_TOKEN").description("Longbridge Access Token 环境变量名")
|
|
15
|
+
});
|
|
16
|
+
const TRADING_HK_MARKET_DATA_KEY = "tradingHkMarketData";
|
|
17
|
+
const TRADING_HK_TRADE_KEY = "tradingHkTrade";
|
|
18
|
+
var LongbridgeMarketDataService = class extends Service {
|
|
19
|
+
client;
|
|
20
|
+
constructor(ctx, options = {}, serviceName = TRADING_HK_MARKET_DATA_KEY) {
|
|
21
|
+
super(ctx, serviceName);
|
|
22
|
+
this.client = new LongbridgeRestClient(options);
|
|
23
|
+
}
|
|
24
|
+
async getTicker(symbol) {
|
|
25
|
+
return this.client.getTicker(symbol);
|
|
26
|
+
}
|
|
27
|
+
async getKlines(symbol, interval = "1d", limit = 100) {
|
|
28
|
+
return this.client.getKlines(symbol, interval, limit);
|
|
29
|
+
}
|
|
30
|
+
subscribeTicker(symbol, cb, options) {
|
|
31
|
+
const ms = Math.max(options?.intervalMs ?? 5e3, 1e3);
|
|
32
|
+
const tick = () => {
|
|
33
|
+
this.getTicker(symbol).then(cb, () => {});
|
|
34
|
+
};
|
|
35
|
+
tick();
|
|
36
|
+
const timer = setInterval(tick, ms);
|
|
37
|
+
return { dispose: () => clearInterval(timer) };
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
var LongbridgeTradeService = class extends Service {
|
|
41
|
+
client;
|
|
42
|
+
/** 插件配置(服务缝闸门 P0:dryRun 强制模拟 / liveTrading 总闸门)。 */
|
|
43
|
+
config;
|
|
44
|
+
constructor(ctx, options, serviceName = TRADING_HK_TRADE_KEY) {
|
|
45
|
+
super(ctx, serviceName);
|
|
46
|
+
this.client = new LongbridgeRestClient(options);
|
|
47
|
+
this.config = options.config;
|
|
48
|
+
}
|
|
49
|
+
async getBalance() {
|
|
50
|
+
return this.client.getBalance();
|
|
51
|
+
}
|
|
52
|
+
async placeOrder(order) {
|
|
53
|
+
const requestedDryRun = order.dryRun ?? true;
|
|
54
|
+
if (!requestedDryRun && !this.config.liveTrading) throw new TradingServiceError("TRADING_LIVE_TRADING_DISABLED", `Longbridge TradeService.placeOrder rejected: the request asks for real execution (dryRun=${String(order.dryRun)}) but liveTrading=false — enable liveTrading explicitly or keep dryRun=true for a simulated fill.`);
|
|
55
|
+
if (requestedDryRun || this.config.dryRun) return {
|
|
56
|
+
id: `dry-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
57
|
+
symbol: order.symbol,
|
|
58
|
+
side: order.side,
|
|
59
|
+
type: order.type,
|
|
60
|
+
status: "filled",
|
|
61
|
+
...order.price !== void 0 ? { price: order.price } : {},
|
|
62
|
+
quantity: order.quantity,
|
|
63
|
+
dryRun: true,
|
|
64
|
+
timestamp: Date.now()
|
|
65
|
+
};
|
|
66
|
+
return this.client.placeOrder(void 0, order);
|
|
67
|
+
}
|
|
68
|
+
async cancelOrder(orderId) {
|
|
69
|
+
if (!this.config.liveTrading || this.config.dryRun) throw new TradingServiceError("TRADING_LIVE_TRADING_DISABLED", "Longbridge TradeService.cancelOrder rejected at the service seam: cancel is a live action and requires liveTrading=true with dryRun=false.");
|
|
70
|
+
return this.client.cancelOrder(void 0, orderId);
|
|
71
|
+
}
|
|
72
|
+
async getPositions() {
|
|
73
|
+
return this.client.getPositions();
|
|
74
|
+
}
|
|
75
|
+
async getOrders() {
|
|
76
|
+
return [];
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const ROUTER_PROVIDER = "longbridge";
|
|
80
|
+
function routeAllows(ctx, config, market) {
|
|
81
|
+
if (!config.enabled) return false;
|
|
82
|
+
const router = ctx.get?.("tradingMarketRouter", false);
|
|
83
|
+
if (router === void 0) return true;
|
|
84
|
+
return router.activeProvider(market) === ROUTER_PROVIDER;
|
|
85
|
+
}
|
|
86
|
+
function apply(ctx, config) {
|
|
87
|
+
if (!config.enabled) return;
|
|
88
|
+
if (!routeAllows(ctx, config, "hk")) return;
|
|
89
|
+
const appKey = process.env[config.appKeyRef];
|
|
90
|
+
const appSecret = process.env[config.appSecretRef];
|
|
91
|
+
const accessToken = process.env[config.accessTokenRef];
|
|
92
|
+
const marketData = new LongbridgeMarketDataService(ctx, {
|
|
93
|
+
appKey,
|
|
94
|
+
appSecret,
|
|
95
|
+
accessToken
|
|
96
|
+
});
|
|
97
|
+
const trade = new LongbridgeTradeService(ctx, {
|
|
98
|
+
appKey,
|
|
99
|
+
appSecret,
|
|
100
|
+
accessToken,
|
|
101
|
+
config
|
|
102
|
+
});
|
|
103
|
+
ctx.inject(["tools"], (ctx) => {
|
|
104
|
+
const tools = ctx.tools;
|
|
105
|
+
const register = (t) => {
|
|
106
|
+
if (tools.get(t.name) === void 0) tools.register(t);
|
|
107
|
+
};
|
|
108
|
+
register(defineTool({
|
|
109
|
+
name: "hk_get_ticker",
|
|
110
|
+
description: "Get the latest trade price and quote for a HK stock via Longbridge API.",
|
|
111
|
+
parameters: { symbol: {
|
|
112
|
+
type: "string",
|
|
113
|
+
required: true,
|
|
114
|
+
description: "HK stock symbol, e.g. 00700.HK"
|
|
115
|
+
} },
|
|
116
|
+
output: {
|
|
117
|
+
schema: { type: "string" },
|
|
118
|
+
render: (_a, v) => [{
|
|
119
|
+
type: "text",
|
|
120
|
+
text: v
|
|
121
|
+
}]
|
|
122
|
+
},
|
|
123
|
+
async execute(args) {
|
|
124
|
+
return JSON.stringify(await marketData.getTicker(args.symbol));
|
|
125
|
+
}
|
|
126
|
+
}));
|
|
127
|
+
register(defineTool({
|
|
128
|
+
name: "hk_get_klines",
|
|
129
|
+
description: "Get recent public klines for a HK stock via Longbridge API. Supports 1m/5m/15m/30m/1h/1d/1w/1M.",
|
|
130
|
+
parameters: {
|
|
131
|
+
symbol: {
|
|
132
|
+
type: "string",
|
|
133
|
+
required: true,
|
|
134
|
+
description: "HK stock symbol, e.g. 00700.HK"
|
|
135
|
+
},
|
|
136
|
+
interval: {
|
|
137
|
+
type: "string",
|
|
138
|
+
enum: INTERVAL_VOCABULARY,
|
|
139
|
+
default: "1d",
|
|
140
|
+
description: "Interval"
|
|
141
|
+
},
|
|
142
|
+
limit: {
|
|
143
|
+
type: "integer",
|
|
144
|
+
default: 100,
|
|
145
|
+
description: "Limit"
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
output: {
|
|
149
|
+
schema: { type: "string" },
|
|
150
|
+
render: (_a, v) => [{
|
|
151
|
+
type: "text",
|
|
152
|
+
text: v
|
|
153
|
+
}]
|
|
154
|
+
},
|
|
155
|
+
async execute(args) {
|
|
156
|
+
const klines = await marketData.getKlines(args.symbol, args.interval ?? "1d", args.limit);
|
|
157
|
+
return JSON.stringify(klines);
|
|
158
|
+
}
|
|
159
|
+
}));
|
|
160
|
+
register(defineTool({
|
|
161
|
+
name: "hk_place_order",
|
|
162
|
+
description: "Place or simulate a HK stock order via Longbridge.",
|
|
163
|
+
parameters: {
|
|
164
|
+
symbol: {
|
|
165
|
+
type: "string",
|
|
166
|
+
required: true,
|
|
167
|
+
description: "HK symbol, e.g. 00700.HK"
|
|
168
|
+
},
|
|
169
|
+
side: {
|
|
170
|
+
type: "string",
|
|
171
|
+
enum: ["buy", "sell"],
|
|
172
|
+
required: true,
|
|
173
|
+
description: "Side"
|
|
174
|
+
},
|
|
175
|
+
type: {
|
|
176
|
+
type: "string",
|
|
177
|
+
enum: ["market", "limit"],
|
|
178
|
+
required: true,
|
|
179
|
+
description: "Type"
|
|
180
|
+
},
|
|
181
|
+
quantity: {
|
|
182
|
+
type: "number",
|
|
183
|
+
required: true,
|
|
184
|
+
description: "Quantity (shares)"
|
|
185
|
+
},
|
|
186
|
+
price: {
|
|
187
|
+
type: "number",
|
|
188
|
+
description: "Limit price"
|
|
189
|
+
},
|
|
190
|
+
dryRun: {
|
|
191
|
+
type: "boolean",
|
|
192
|
+
default: true,
|
|
193
|
+
description: "Dry run"
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
output: {
|
|
197
|
+
schema: { type: "string" },
|
|
198
|
+
render: (_a, v) => [{
|
|
199
|
+
type: "text",
|
|
200
|
+
text: v
|
|
201
|
+
}]
|
|
202
|
+
},
|
|
203
|
+
async execute(args) {
|
|
204
|
+
if (args.dryRun !== false) {
|
|
205
|
+
let refPrice = args.price;
|
|
206
|
+
if (!refPrice || refPrice <= 0) try {
|
|
207
|
+
refPrice = (await marketData.getTicker(args.symbol)).price;
|
|
208
|
+
} catch {
|
|
209
|
+
refPrice = 0;
|
|
210
|
+
}
|
|
211
|
+
return JSON.stringify({
|
|
212
|
+
id: `sim-lb-${Date.now()}`,
|
|
213
|
+
symbol: toLongbridgeSymbol(args.symbol).canonical,
|
|
214
|
+
side: args.side,
|
|
215
|
+
type: args.type,
|
|
216
|
+
status: "filled",
|
|
217
|
+
quantity: args.quantity,
|
|
218
|
+
price: refPrice ?? 0,
|
|
219
|
+
dryRun: true,
|
|
220
|
+
timestamp: Date.now()
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
if (!config.liveTrading) return JSON.stringify({
|
|
224
|
+
status: "rejected",
|
|
225
|
+
code: "TRADING_LIVE_TRADING_DISABLED",
|
|
226
|
+
message: "Live trading is disabled on Longbridge plugin."
|
|
227
|
+
});
|
|
228
|
+
const order = await trade.placeOrder({
|
|
229
|
+
symbol: args.symbol,
|
|
230
|
+
side: args.side,
|
|
231
|
+
type: args.type,
|
|
232
|
+
quantity: args.quantity,
|
|
233
|
+
price: args.price,
|
|
234
|
+
dryRun: false
|
|
235
|
+
});
|
|
236
|
+
return JSON.stringify(order);
|
|
237
|
+
}
|
|
238
|
+
}));
|
|
239
|
+
register(defineTool({
|
|
240
|
+
name: "hk_cancel_order",
|
|
241
|
+
description: "Cancel a HK stock order on Longbridge by order ID.",
|
|
242
|
+
parameters: { ordId: {
|
|
243
|
+
type: "string",
|
|
244
|
+
required: true,
|
|
245
|
+
description: "Order ID"
|
|
246
|
+
} },
|
|
247
|
+
output: {
|
|
248
|
+
schema: { type: "string" },
|
|
249
|
+
render: (_a, v) => [{
|
|
250
|
+
type: "text",
|
|
251
|
+
text: v
|
|
252
|
+
}]
|
|
253
|
+
},
|
|
254
|
+
async execute(args) {
|
|
255
|
+
const res = await trade.cancelOrder(args.ordId);
|
|
256
|
+
return JSON.stringify(res);
|
|
257
|
+
}
|
|
258
|
+
}));
|
|
259
|
+
register(defineTool({
|
|
260
|
+
name: "hk_get_balance",
|
|
261
|
+
description: "Get HK account balance via Longbridge.",
|
|
262
|
+
parameters: {},
|
|
263
|
+
output: {
|
|
264
|
+
schema: { type: "string" },
|
|
265
|
+
render: (_a, v) => [{
|
|
266
|
+
type: "text",
|
|
267
|
+
text: v
|
|
268
|
+
}]
|
|
269
|
+
},
|
|
270
|
+
async execute() {
|
|
271
|
+
const bal = await trade.getBalance();
|
|
272
|
+
return JSON.stringify(bal);
|
|
273
|
+
}
|
|
274
|
+
}));
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
//#endregion
|
|
278
|
+
export { Config, INTERVAL_VOCABULARY, LongbridgeMarketDataService, LongbridgeRestClient, LongbridgeTradeService, ROUTER_PROVIDER, TRADING_HK_MARKET_DATA_KEY, TRADING_HK_TRADE_KEY, TradingServiceError, apply, generateLongbridgeSignature, name, parseIntervalMs, routeAllows, toLongbridgePeriod, toLongbridgeSymbol$1 as toLongbridgeSymbol };
|
package/lib/rest.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { AccountBalance as AccountBalance$1, Interval as Interval$1, Kline as Kline$1, Order as Order$1, OrderRequest, Position as Position$1, Ticker as Ticker$1, TradingErrorCode } from "@dshtrading/api";
|
|
2
|
+
//#region src/rest.d.ts
|
|
3
|
+
declare class TradingServiceError extends Error {
|
|
4
|
+
readonly code: TradingErrorCode;
|
|
5
|
+
constructor(code: TradingErrorCode, message: string, cause?: unknown);
|
|
6
|
+
}
|
|
7
|
+
declare const INTERVAL_VOCABULARY: readonly ["1m", "5m", "15m", "30m", "1h", "1d", "1w", "1M"];
|
|
8
|
+
declare function toLongbridgePeriod(interval: Interval$1): string;
|
|
9
|
+
declare function parseIntervalMs(interval: Interval$1): number;
|
|
10
|
+
declare function toLongbridgeSymbol(raw: string): {
|
|
11
|
+
symbol: string;
|
|
12
|
+
canonical: string;
|
|
13
|
+
};
|
|
14
|
+
declare function generateLongbridgeSignature(appSecret: string, method: string, pathWithQuery: string, headers: {
|
|
15
|
+
authorization: string;
|
|
16
|
+
'x-api-key': string;
|
|
17
|
+
'x-timestamp': string | number;
|
|
18
|
+
}, body?: string): string;
|
|
19
|
+
interface LongbridgeRestOptions {
|
|
20
|
+
baseUrl?: string;
|
|
21
|
+
appKey?: string;
|
|
22
|
+
appSecret?: string;
|
|
23
|
+
accessToken?: string;
|
|
24
|
+
fetchImpl?: typeof fetch;
|
|
25
|
+
}
|
|
26
|
+
declare class LongbridgeRestClient {
|
|
27
|
+
readonly baseUrl: string;
|
|
28
|
+
readonly appKey?: string;
|
|
29
|
+
readonly appSecret?: string;
|
|
30
|
+
readonly accessToken?: string;
|
|
31
|
+
private readonly fetchImpl;
|
|
32
|
+
constructor(options?: LongbridgeRestOptions);
|
|
33
|
+
private requestJson;
|
|
34
|
+
getTicker(symbol: string): Promise<Ticker$1>;
|
|
35
|
+
getKlines(symbol: string, interval?: Interval$1, limit?: number): Promise<Kline$1[]>;
|
|
36
|
+
getBalance(): Promise<AccountBalance$1>;
|
|
37
|
+
getPositions(): Promise<Position$1[]>;
|
|
38
|
+
placeOrder(_creds: unknown, req: OrderRequest): Promise<Order$1>;
|
|
39
|
+
cancelOrder(_creds: unknown, orderId: string): Promise<{
|
|
40
|
+
orderId: string;
|
|
41
|
+
status: 'canceled';
|
|
42
|
+
}>;
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { type AccountBalance$1 as AccountBalance, INTERVAL_VOCABULARY, type Interval$1 as Interval, type Kline$1 as Kline, LongbridgeRestClient, LongbridgeRestOptions, type Order$1 as Order, type Position$1 as Position, type Ticker$1 as Ticker, TradingServiceError, generateLongbridgeSignature, parseIntervalMs, toLongbridgePeriod, toLongbridgeSymbol };
|
package/lib/rest.js
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import * as crypto from "node:crypto";
|
|
2
|
+
//#region src/rest.ts
|
|
3
|
+
var TradingServiceError = class extends Error {
|
|
4
|
+
code;
|
|
5
|
+
constructor(code, message, cause) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = "TradingServiceError";
|
|
8
|
+
this.code = code;
|
|
9
|
+
if (cause !== void 0) this.cause = cause;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
const INTERVAL_VOCABULARY = [
|
|
13
|
+
"1m",
|
|
14
|
+
"5m",
|
|
15
|
+
"15m",
|
|
16
|
+
"30m",
|
|
17
|
+
"1h",
|
|
18
|
+
"1d",
|
|
19
|
+
"1w",
|
|
20
|
+
"1M"
|
|
21
|
+
];
|
|
22
|
+
function toLongbridgePeriod(interval) {
|
|
23
|
+
switch (interval) {
|
|
24
|
+
case "1m": return "1m";
|
|
25
|
+
case "5m": return "5m";
|
|
26
|
+
case "15m": return "15m";
|
|
27
|
+
case "30m": return "30m";
|
|
28
|
+
case "1h": return "60m";
|
|
29
|
+
case "1d": return "day";
|
|
30
|
+
case "1w": return "week";
|
|
31
|
+
case "1M": return "month";
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function parseIntervalMs(interval) {
|
|
35
|
+
switch (interval) {
|
|
36
|
+
case "1m": return 6e4;
|
|
37
|
+
case "5m": return 3e5;
|
|
38
|
+
case "15m": return 9e5;
|
|
39
|
+
case "30m": return 18e5;
|
|
40
|
+
case "1h": return 36e5;
|
|
41
|
+
case "1d": return 864e5;
|
|
42
|
+
case "1w": return 6048e5;
|
|
43
|
+
case "1M": return 2592e6;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function toLongbridgeSymbol(raw) {
|
|
47
|
+
const clean = raw.trim().toUpperCase();
|
|
48
|
+
if (clean.endsWith(".HK")) {
|
|
49
|
+
const num = clean.replace(".HK", "").padStart(5, "0");
|
|
50
|
+
return {
|
|
51
|
+
symbol: `${num}.HK`,
|
|
52
|
+
canonical: `${num}.HK`
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
if (/^\d{1,5}$/.test(clean)) {
|
|
56
|
+
const num = clean.padStart(5, "0");
|
|
57
|
+
return {
|
|
58
|
+
symbol: `${num}.HK`,
|
|
59
|
+
canonical: `${num}.HK`
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
symbol: clean,
|
|
64
|
+
canonical: clean
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function generateLongbridgeSignature(appSecret, method, pathWithQuery, headers, body = "") {
|
|
68
|
+
const methodUpper = method.toUpperCase();
|
|
69
|
+
const path = pathWithQuery.startsWith("/") ? pathWithQuery : `/${pathWithQuery}`;
|
|
70
|
+
const authVal = headers.authorization;
|
|
71
|
+
const apiKeyVal = headers["x-api-key"];
|
|
72
|
+
const tsVal = String(headers["x-timestamp"]);
|
|
73
|
+
const signedHeaders = "authorization;x-api-key;x-timestamp";
|
|
74
|
+
const canonicalRequest = `${methodUpper}\n${path}\n${`authorization:${authVal}\nx-api-key:${apiKeyVal}\nx-timestamp:${tsVal}\n`}\n${signedHeaders}\n${crypto.createHash("sha256").update(body, "utf8").digest("hex")}`;
|
|
75
|
+
return `HMAC-SHA256 SignedHeaders=${signedHeaders}, Signature=${crypto.createHmac("sha256", appSecret).update(canonicalRequest, "utf8").digest("hex")}`;
|
|
76
|
+
}
|
|
77
|
+
var LongbridgeRestClient = class {
|
|
78
|
+
baseUrl;
|
|
79
|
+
appKey;
|
|
80
|
+
appSecret;
|
|
81
|
+
accessToken;
|
|
82
|
+
fetchImpl;
|
|
83
|
+
constructor(options = {}) {
|
|
84
|
+
this.baseUrl = options.baseUrl ?? (process.env.LONGBRIDGE_API_URL || "https://openapi.longportapp.com");
|
|
85
|
+
this.appKey = options.appKey ?? process.env.LONGBRIDGE_APP_KEY;
|
|
86
|
+
this.appSecret = options.appSecret ?? process.env.LONGBRIDGE_APP_SECRET;
|
|
87
|
+
this.accessToken = options.accessToken ?? process.env.LONGBRIDGE_ACCESS_TOKEN;
|
|
88
|
+
this.fetchImpl = options.fetchImpl ?? globalThis.fetch;
|
|
89
|
+
}
|
|
90
|
+
async requestJson(path, options = {}) {
|
|
91
|
+
const method = (options.method ?? "GET").toUpperCase();
|
|
92
|
+
const url = `${this.baseUrl}${path}`;
|
|
93
|
+
const timestamp = Date.now().toString();
|
|
94
|
+
const bodyStr = options.body ? String(options.body) : "";
|
|
95
|
+
const headers = {
|
|
96
|
+
"Accept": "application/json",
|
|
97
|
+
"Content-Type": "application/json",
|
|
98
|
+
...options.headers
|
|
99
|
+
};
|
|
100
|
+
if (this.accessToken) headers["authorization"] = this.accessToken.startsWith("Bearer ") ? this.accessToken : `Bearer ${this.accessToken}`;
|
|
101
|
+
if (this.appKey) {
|
|
102
|
+
headers["x-api-key"] = this.appKey;
|
|
103
|
+
headers["x-timestamp"] = timestamp;
|
|
104
|
+
if (this.appSecret && headers["authorization"]) headers["x-api-signature"] = generateLongbridgeSignature(this.appSecret, method, path, {
|
|
105
|
+
authorization: headers["authorization"],
|
|
106
|
+
"x-api-key": this.appKey,
|
|
107
|
+
"x-timestamp": timestamp
|
|
108
|
+
}, bodyStr);
|
|
109
|
+
}
|
|
110
|
+
try {
|
|
111
|
+
const res = await this.fetchImpl(url, {
|
|
112
|
+
...options,
|
|
113
|
+
headers
|
|
114
|
+
});
|
|
115
|
+
if (!res.ok) throw new TradingServiceError("TRADING_UPSTREAM_ERROR", `Longbridge HTTP ${res.status}: ${res.statusText}`);
|
|
116
|
+
return await res.json();
|
|
117
|
+
} catch (err) {
|
|
118
|
+
if (err instanceof TradingServiceError) throw err;
|
|
119
|
+
throw new TradingServiceError("TRADING_NETWORK", `Longbridge network error: ${err instanceof Error ? err.message : String(err)}`, err);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
async getTicker(symbol) {
|
|
123
|
+
const { symbol: lbSymbol, canonical } = toLongbridgeSymbol(symbol);
|
|
124
|
+
const data = await this.requestJson(`/v1/quote/realtime?symbol=${encodeURIComponent(lbSymbol)}`);
|
|
125
|
+
if (data.code !== 0 || !data.data || data.data.length === 0) throw new TradingServiceError("TRADING_SYMBOL_NOT_FOUND", `Longbridge quote not found for ${symbol}`);
|
|
126
|
+
const row = data.data[0];
|
|
127
|
+
return {
|
|
128
|
+
symbol: canonical,
|
|
129
|
+
price: parseFloat(row.last_done || "0"),
|
|
130
|
+
volume: parseFloat(row.volume || "0"),
|
|
131
|
+
timestamp: row.timestamp ? row.timestamp * 1e3 : Date.now()
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
async getKlines(symbol, interval = "1d", limit = 100) {
|
|
135
|
+
const { symbol: lbSymbol } = toLongbridgeSymbol(symbol);
|
|
136
|
+
const period = toLongbridgePeriod(interval);
|
|
137
|
+
const stepMs = parseIntervalMs(interval);
|
|
138
|
+
const data = await this.requestJson(`/v1/quote/candlesticks?symbol=${encodeURIComponent(lbSymbol)}&period=${period}&count=${limit}`);
|
|
139
|
+
if (data.code !== 0 || !data.data?.candlesticks) return [];
|
|
140
|
+
return data.data.candlesticks.map((c) => {
|
|
141
|
+
const openTime = c.timestamp * 1e3;
|
|
142
|
+
return {
|
|
143
|
+
openTime,
|
|
144
|
+
open: parseFloat(c.open),
|
|
145
|
+
high: parseFloat(c.high),
|
|
146
|
+
low: parseFloat(c.low),
|
|
147
|
+
close: parseFloat(c.close),
|
|
148
|
+
volume: parseFloat(c.volume),
|
|
149
|
+
closeTime: openTime + stepMs - 1
|
|
150
|
+
};
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
async getBalance() {
|
|
154
|
+
if (!this.appKey || !this.accessToken) throw new TradingServiceError("TRADING_AUTH_FAILED", "Longbridge: appKey and accessToken are required for getBalance");
|
|
155
|
+
const res = await this.requestJson("/v1/asset/account");
|
|
156
|
+
if (res.code !== 0 || !res.data?.list || res.data.list.length === 0) throw new TradingServiceError("TRADING_EXCHANGE_ERROR", `Longbridge getBalance failed: ${res.message ?? `code ${res.code}`}`);
|
|
157
|
+
const first = res.data.list[0];
|
|
158
|
+
const available = parseFloat(first.total_cash || "0");
|
|
159
|
+
const total = parseFloat(first.net_assets || first.total_cash || "0");
|
|
160
|
+
return {
|
|
161
|
+
currency: first.currency ?? "HKD",
|
|
162
|
+
available,
|
|
163
|
+
total
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
async getPositions() {
|
|
167
|
+
if (!this.appKey || !this.accessToken) throw new TradingServiceError("TRADING_AUTH_FAILED", "Longbridge: appKey and accessToken are required for getPositions");
|
|
168
|
+
const res = await this.requestJson("/v1/trade/stock/position");
|
|
169
|
+
if (res.code !== 0 || !Array.isArray(res.data?.channels)) return [];
|
|
170
|
+
const positions = [];
|
|
171
|
+
for (const channel of res.data.channels) if (Array.isArray(channel.positions)) for (const p of channel.positions) positions.push({
|
|
172
|
+
symbol: toLongbridgeSymbol(p.symbol).canonical,
|
|
173
|
+
quantity: parseFloat(p.quantity || "0"),
|
|
174
|
+
entryPrice: parseFloat(p.cost_price || "0"),
|
|
175
|
+
unrealizedPnl: parseFloat(p.unrealized_pnl || "0")
|
|
176
|
+
});
|
|
177
|
+
return positions;
|
|
178
|
+
}
|
|
179
|
+
async placeOrder(_creds, req) {
|
|
180
|
+
if (!this.appKey || !this.accessToken) throw new TradingServiceError("TRADING_AUTH_FAILED", "Longbridge: appKey and accessToken are required for placeOrder");
|
|
181
|
+
const { symbol: lbSymbol, canonical } = toLongbridgeSymbol(req.symbol);
|
|
182
|
+
const res = await this.requestJson("/v1/trade/order", {
|
|
183
|
+
method: "POST",
|
|
184
|
+
body: JSON.stringify({
|
|
185
|
+
symbol: lbSymbol,
|
|
186
|
+
order_type: req.type === "market" ? "MO" : "LO",
|
|
187
|
+
side: req.side === "buy" ? "Buy" : "Sell",
|
|
188
|
+
submitted_quantity: String(req.quantity),
|
|
189
|
+
submitted_price: req.price ? String(req.price) : void 0,
|
|
190
|
+
time_in_force: "Day"
|
|
191
|
+
})
|
|
192
|
+
});
|
|
193
|
+
if (res.code !== 0 || !res.data?.order_id) throw new TradingServiceError("TRADING_EXCHANGE_ERROR", `Longbridge placeOrder failed: ${res.message ?? `code ${res.code}`}`);
|
|
194
|
+
return {
|
|
195
|
+
id: res.data.order_id,
|
|
196
|
+
symbol: canonical,
|
|
197
|
+
side: req.side,
|
|
198
|
+
type: req.type,
|
|
199
|
+
status: "new",
|
|
200
|
+
quantity: req.quantity,
|
|
201
|
+
price: req.price ?? 0,
|
|
202
|
+
dryRun: false,
|
|
203
|
+
timestamp: Date.now()
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
async cancelOrder(_creds, orderId) {
|
|
207
|
+
if (!this.appKey || !this.accessToken) throw new TradingServiceError("TRADING_AUTH_FAILED", "Longbridge: appKey and accessToken are required for cancelOrder");
|
|
208
|
+
const res = await this.requestJson(`/v1/trade/order?order_id=${encodeURIComponent(orderId)}`, { method: "DELETE" });
|
|
209
|
+
if (res.code !== 0) throw new TradingServiceError("TRADING_EXCHANGE_ERROR", `Longbridge cancelOrder failed: ${res.message ?? `code ${res.code}`}`);
|
|
210
|
+
return {
|
|
211
|
+
orderId,
|
|
212
|
+
status: "canceled"
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
//#endregion
|
|
217
|
+
export { INTERVAL_VOCABULARY, LongbridgeRestClient, TradingServiceError, generateLongbridgeSignature, parseIntervalMs, toLongbridgePeriod, toLongbridgeSymbol };
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dshtrading/connector-longbridge",
|
|
3
|
+
"description": "【模板】交易所连接器插件脚手架:Longbridge(longbridge)v2 插件骨架 —— 市场数据服务 + 交易服务 + 三态闸门 + BYOK 凭证 ref。生成器:node scripts/new-connector.mjs --slug <exchange>",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"types": "./lib/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./lib/index.d.ts",
|
|
11
|
+
"default": "./lib/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./dataplane": {
|
|
14
|
+
"types": "./lib/dataplane.d.ts",
|
|
15
|
+
"default": "./lib/dataplane.js"
|
|
16
|
+
},
|
|
17
|
+
"./package.json": "./package.json"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"lib"
|
|
21
|
+
],
|
|
22
|
+
"license": "PolyForm-Noncommercial-1.0.0",
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@dshtrading/api": "^0.1.0"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"@deepseek-ai/cordis": ">=4.0.0",
|
|
28
|
+
"@deepseek-ai/dsh-tools": ">=0.1.2-alpha.1",
|
|
29
|
+
"@deepseek-ai/schemastery": ">=3.18.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"tsdown": "^0.22.0",
|
|
33
|
+
"vitest": "^3.0.0"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsdown",
|
|
37
|
+
"test": "vitest run"
|
|
38
|
+
}
|
|
39
|
+
}
|