@dshtrading/kit-hk 0.1.4 → 0.1.5
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/lib/index.d.ts +6 -2
- package/lib/index.js +21 -5
- package/package.json +4 -4
package/lib/index.d.ts
CHANGED
|
@@ -8,14 +8,18 @@ declare const provider: SkillProvider;
|
|
|
8
8
|
interface Config {
|
|
9
9
|
dryRun: boolean;
|
|
10
10
|
liveTrading: boolean;
|
|
11
|
+
/** 角色预设按需收窄技能面;缺省保持全量捆绑目录。 */
|
|
12
|
+
skills?: string[];
|
|
11
13
|
}
|
|
12
14
|
declare const Config: Schema<Config>;
|
|
13
15
|
declare const inject: string[];
|
|
14
16
|
declare const name = "dsh-trading-hk-kit";
|
|
15
|
-
|
|
17
|
+
/** 白名单视图:未知名 fail-fast 不静默缩面;白名单外的 get 拒绝分发。 */
|
|
18
|
+
declare function providerForSkills(allowed?: readonly string[]): SkillProvider;
|
|
19
|
+
declare function apply(ctx: Context, config: Config): void;
|
|
16
20
|
declare function createGetNewsTool(): import("@deepseek-ai/dsh-tools").ToolDefinition;
|
|
17
21
|
declare function createGetFundamentalsTool(options?: {
|
|
18
22
|
fetch?: typeof globalThis.fetch;
|
|
19
23
|
}): import("@deepseek-ai/dsh-tools").ToolDefinition;
|
|
20
24
|
//#endregion
|
|
21
|
-
export { AggregateNewsOptions, AggregateNewsResult, Config, HkFundamentalsOptions, HkFundamentalsResult, NewsItem, NewsSource, aggregateNews, apply, createGetFundamentalsTool, createGetNewsTool, fetchHkFinancialMatrix, fetchHkFundamentals, fetchHkFundamentalsPackage, formatHkReportPeriod, inject, isHkRelevant, name, normalizeHkSymbol, parseHkShowTime, parseHkexDateTime, provider, renderHkFundamentals, resetHkexAnnouncementMemo };
|
|
25
|
+
export { AggregateNewsOptions, AggregateNewsResult, Config, HkFundamentalsOptions, HkFundamentalsResult, NewsItem, NewsSource, aggregateNews, apply, createGetFundamentalsTool, createGetNewsTool, fetchHkFinancialMatrix, fetchHkFundamentals, fetchHkFundamentalsPackage, formatHkReportPeriod, inject, isHkRelevant, name, normalizeHkSymbol, parseHkShowTime, parseHkexDateTime, provider, providerForSkills, renderHkFundamentals, resetHkexAnnouncementMemo };
|
package/lib/index.js
CHANGED
|
@@ -99,7 +99,7 @@ const SKILL_CANDIDATES = [
|
|
|
99
99
|
const provider = {
|
|
100
100
|
name: PROVIDER_NAME,
|
|
101
101
|
list: () => Promise.resolve(SKILL_CANDIDATES),
|
|
102
|
-
async get(candidate) {
|
|
102
|
+
async get(candidate, _options) {
|
|
103
103
|
const target = SKILL_CANDIDATES.find((c) => c.name === candidate.name) ?? CANDIDATE;
|
|
104
104
|
return {
|
|
105
105
|
name: target.name,
|
|
@@ -114,12 +114,28 @@ const provider = {
|
|
|
114
114
|
};
|
|
115
115
|
const Config = Schema.object({
|
|
116
116
|
dryRun: Schema.boolean().default(true),
|
|
117
|
-
liveTrading: Schema.boolean().default(false)
|
|
117
|
+
liveTrading: Schema.boolean().default(false),
|
|
118
|
+
skills: Schema.array(Schema.string())
|
|
118
119
|
});
|
|
119
120
|
const inject = ["skills", "tools"];
|
|
120
121
|
const name = "dsh-trading-hk-kit";
|
|
121
|
-
|
|
122
|
-
|
|
122
|
+
/** 白名单视图:未知名 fail-fast 不静默缩面;白名单外的 get 拒绝分发。 */
|
|
123
|
+
function providerForSkills(allowed) {
|
|
124
|
+
if (!allowed) return provider;
|
|
125
|
+
const unknown = allowed.filter((name) => !SKILL_CANDIDATES.some((c) => c.name === name));
|
|
126
|
+
if (unknown.length > 0) throw new Error(`[${PROVIDER_NAME}] unknown skills in whitelist: ${unknown.join(", ")}`);
|
|
127
|
+
const active = SKILL_CANDIDATES.filter((c) => allowed.includes(c.name));
|
|
128
|
+
return {
|
|
129
|
+
name: provider.name,
|
|
130
|
+
list: () => Promise.resolve(active),
|
|
131
|
+
async get(candidate, options) {
|
|
132
|
+
if (!active.some((c) => c.name === candidate.name)) throw new Error(`[${PROVIDER_NAME}] skill not in whitelist: ${candidate.name}`);
|
|
133
|
+
return provider.get(candidate, options);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function apply(ctx, config) {
|
|
138
|
+
ctx.skills.registerProvider(() => providerForSkills(config.skills));
|
|
123
139
|
const newsTool = createGetNewsTool();
|
|
124
140
|
const fundamentalsTool = createGetFundamentalsTool();
|
|
125
141
|
const tools = ctx.tools;
|
|
@@ -221,4 +237,4 @@ function createGetFundamentalsTool(options = {}) {
|
|
|
221
237
|
});
|
|
222
238
|
}
|
|
223
239
|
//#endregion
|
|
224
|
-
export { Config, aggregateNews, apply, createGetFundamentalsTool, createGetNewsTool, fetchHkFinancialMatrix, fetchHkFundamentals, fetchHkFundamentalsPackage, formatHkReportPeriod, inject, isHkRelevant, name, normalizeHkSymbol, parseHkShowTime, parseHkexDateTime, provider, renderHkFundamentals, resetHkexAnnouncementMemo };
|
|
240
|
+
export { Config, aggregateNews, apply, createGetFundamentalsTool, createGetNewsTool, fetchHkFinancialMatrix, fetchHkFundamentals, fetchHkFundamentalsPackage, formatHkReportPeriod, inject, isHkRelevant, name, normalizeHkSymbol, parseHkShowTime, parseHkexDateTime, provider, providerForSkills, renderHkFundamentals, resetHkexAnnouncementMemo };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dshtrading/kit-hk",
|
|
3
3
|
"description": "Hong Kong market toolkit plugin for dsh-trading: HK risk checklist skill provider and HK fast-news (degraded) / fundamentals tools; runs as an hk-trader preset row (session-scoped)",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "./lib/index.d.ts",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
],
|
|
19
19
|
"license": "PolyForm-Noncommercial-1.0.0",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dshtrading/indicators": "0.1.
|
|
22
|
-
"@dshtrading/knowledge": "0.1.
|
|
21
|
+
"@dshtrading/indicators": "0.1.5",
|
|
22
|
+
"@dshtrading/knowledge": "0.1.5"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@deepseek-ai/cordis": ">=4.0.0",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"tsdown": "^0.22.0",
|
|
32
32
|
"vitest": "^3.0.0",
|
|
33
|
-
"@dshtrading/api": "0.1.
|
|
33
|
+
"@dshtrading/api": "0.1.5"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "tsdown",
|