@dshtrading/kit-global 0.6.1 → 0.6.2

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 CHANGED
@@ -1,19 +1,15 @@
1
- import Schema from "@deepseek-ai/schemastery";
2
1
  import { SkillProvider } from "@deepseek-ai/dsh-skill";
2
+ import { KitConfig } from "@dshtrading/base/role-skills";
3
3
  import { Context } from "@deepseek-ai/cordis";
4
+ import Schema from "@deepseek-ai/schemastery";
4
5
  //#region src/index.d.ts
5
6
  declare const provider: SkillProvider;
6
- interface Config {
7
- dryRun: boolean;
8
- liveTrading: boolean;
9
- /** 角色预设按需收窄技能面;字段缺席保持全量捆绑目录,显式空数组才表示不下发任何技能。 */
10
- skills?: string[] | null;
11
- }
7
+ type Config = KitConfig;
12
8
  declare const Config: Schema<Config>;
13
9
  declare const inject: string[];
14
10
  declare const name = "dsh-trading-global-kit";
15
- /** 白名单视图:未知名 fail-fast 不静默缩面;白名单外的 get 拒绝分发。 */
16
- declare function providerForSkills(allowed?: readonly string[] | null): SkillProvider;
11
+ /** 白名单视图(三态语义与注册骨架见 @dshtrading/base/role-skills)。 */
12
+ declare const providerForSkills: (allowed?: readonly string[] | null) => SkillProvider;
17
13
  declare function apply(ctx: Context, config: Config): void;
18
14
  //#endregion
19
15
  export { Config, apply, inject, name, provider, providerForSkills };
package/lib/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { readFile } from "node:fs/promises";
2
2
  import { fileURLToPath } from "node:url";
3
- import Schema from "@deepseek-ai/schemastery";
4
3
  import { BUNDLED_SKILL_RANK } from "@deepseek-ai/dsh-skill";
4
+ import { kitConfigSchema, kitSkillMessages, registerSkillProvider, skillWhitelistView } from "@dshtrading/base/role-skills";
5
5
  //#region src/index.ts
6
6
  /**
7
7
  * 全球品种工具箱插件(dsh-trading global 切片,market-group 平权)。
@@ -110,30 +110,13 @@ const provider = {
110
110
  };
111
111
  }
112
112
  };
113
- const Config = Schema.object({
114
- dryRun: Schema.boolean().default(true),
115
- liveTrading: Schema.boolean().default(false),
116
- skills: Schema.union([Schema.array(Schema.string()), Schema.const(null)]).default(null)
117
- });
113
+ const Config = kitConfigSchema();
118
114
  const inject = ["skills"];
119
115
  const name = "dsh-trading-global-kit";
120
- /** 白名单视图:未知名 fail-fast 不静默缩面;白名单外的 get 拒绝分发。 */
121
- function providerForSkills(allowed) {
122
- if (!allowed) return provider;
123
- const unknown = allowed.filter((name) => !SKILL_CANDIDATES.some((c) => c.name === name));
124
- if (unknown.length > 0) throw new Error(`[${PROVIDER_NAME}] unknown skills in whitelist: ${unknown.join(", ")}`);
125
- const active = SKILL_CANDIDATES.filter((c) => allowed.includes(c.name));
126
- return {
127
- name: provider.name,
128
- list: () => Promise.resolve(active),
129
- async get(candidate, options) {
130
- if (!active.some((c) => c.name === candidate.name)) throw new Error(`[${PROVIDER_NAME}] skill not in whitelist: ${candidate.name}`);
131
- return provider.get(candidate, options);
132
- }
133
- };
134
- }
116
+ /** 白名单视图(三态语义与注册骨架见 @dshtrading/base/role-skills)。 */
117
+ const providerForSkills = skillWhitelistView(provider, SKILL_CANDIDATES, kitSkillMessages(PROVIDER_NAME));
135
118
  function apply(ctx, config) {
136
- ctx.skills.registerProvider(() => providerForSkills(config.skills));
119
+ registerSkillProvider(ctx, config, providerForSkills);
137
120
  }
138
121
  //#endregion
139
122
  export { Config, apply, inject, name, provider, providerForSkills };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dshtrading/kit-global",
3
3
  "description": "Global instruments toolkit plugin for dsh-trading: global risk checklist skill provider (leverage/swap/overnight-gap/event-driven-volatility/USD-denomination for spot metals, oil, FX and global indices); runs as a global-trader preset row (session-scoped)",
4
- "version": "0.6.1",
4
+ "version": "0.6.2",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "types": "./lib/index.d.ts",
@@ -18,12 +18,12 @@
18
18
  ],
19
19
  "license": "PolyForm-Noncommercial-1.0.0",
20
20
  "dependencies": {
21
- "@dshtrading/api": "0.6.1"
21
+ "@dshtrading/base": "0.6.2"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "@deepseek-ai/cordis": ">=4.0.0",
25
- "@deepseek-ai/dsh-skill": ">=0.2.0-rc.2",
26
- "@deepseek-ai/dsh-tools": ">=0.2.0-rc.2",
25
+ "@deepseek-ai/dsh-skill": ">=0.2.1-rc.2",
26
+ "@deepseek-ai/dsh-tools": ">=0.2.1-rc.2",
27
27
  "@deepseek-ai/schemastery": ">=3.18.0"
28
28
  },
29
29
  "devDependencies": {