@zhin.js/plugin-lottery 1.0.1 → 1.0.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/README.md +25 -26
- package/agent/tools/compute_recommend.ts +2 -2
- package/agent/tools/get_model_state.ts +2 -2
- package/agent/tools/history.ts +2 -2
- package/agent/tools/list_pending.ts +2 -2
- package/agent/tools/save_prediction.ts +2 -2
- package/agent/tools/stats_snapshot.ts +2 -2
- package/agent/tools/sync.ts +2 -2
- package/commands/lottery/[game:string=].ts +25 -0
- package/commands/lottery-backtest/[game:string=].ts +34 -0
- package/commands/lottery-history/[game:string].ts +20 -0
- package/commands/lottery-stats/[game:string].ts +34 -0
- package/commands/lottery-today.ts +15 -0
- package/commands/lottery-train/[game:string=].ts +34 -0
- package/lib/agent/prompts.d.ts +11 -0
- package/lib/agent/prompts.d.ts.map +1 -0
- package/lib/agent/prompts.js.map +1 -0
- package/lib/agent/read-skills.d.ts +3 -0
- package/lib/agent/read-skills.d.ts.map +1 -0
- package/lib/agent/read-skills.js.map +1 -0
- package/lib/command-helpers.d.ts +8 -0
- package/lib/command-helpers.d.ts.map +1 -0
- package/lib/command-helpers.js +24 -0
- package/lib/command-helpers.js.map +1 -0
- package/lib/config.d.ts +30 -0
- package/lib/config.d.ts.map +1 -0
- package/lib/config.js +52 -0
- package/lib/config.js.map +1 -0
- package/lib/db-store.d.ts +10 -0
- package/lib/db-store.d.ts.map +1 -0
- package/lib/db-store.js +30 -0
- package/lib/db-store.js.map +1 -0
- package/lib/db.d.ts +33 -0
- package/lib/db.d.ts.map +1 -0
- package/lib/db.js.map +1 -0
- package/lib/evaluate/adaptive-sim.d.ts +31 -0
- package/lib/evaluate/adaptive-sim.d.ts.map +1 -0
- package/lib/evaluate/adaptive-sim.js.map +1 -0
- package/lib/evaluate/backtest.d.ts +29 -0
- package/lib/evaluate/backtest.d.ts.map +1 -0
- package/lib/evaluate/backtest.js.map +1 -0
- package/lib/evaluate/hit-rate.d.ts +7 -0
- package/lib/evaluate/hit-rate.d.ts.map +1 -0
- package/lib/evaluate/hit-rate.js.map +1 -0
- package/lib/evaluate/review-pending.d.ts +13 -0
- package/lib/evaluate/review-pending.d.ts.map +1 -0
- package/lib/evaluate/review-pending.js.map +1 -0
- package/lib/evaluate/tracker.d.ts +27 -0
- package/lib/evaluate/tracker.d.ts.map +1 -0
- package/lib/evaluate/tracker.js.map +1 -0
- package/lib/evaluate/train-weights.d.ts +28 -0
- package/lib/evaluate/train-weights.d.ts.map +1 -0
- package/lib/evaluate/train-weights.js.map +1 -0
- package/lib/evaluate/weight-guard.d.ts +15 -0
- package/lib/evaluate/weight-guard.d.ts.map +1 -0
- package/lib/evaluate/weight-guard.js.map +1 -0
- package/lib/games/kl8-groups.d.ts +30 -0
- package/lib/games/kl8-groups.d.ts.map +1 -0
- package/lib/games/kl8-groups.js.map +1 -0
- package/lib/games/registry.d.ts +13 -0
- package/lib/games/registry.d.ts.map +1 -0
- package/lib/games/registry.js.map +1 -0
- package/lib/index.d.ts +8 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +6 -0
- package/lib/index.js.map +1 -0
- package/lib/lottery-agent-deps.d.ts +24 -0
- package/lib/lottery-agent-deps.d.ts.map +1 -0
- package/lib/lottery-agent-deps.js +22 -0
- package/lib/lottery-agent-deps.js.map +1 -0
- package/lib/lottery-tool-handlers.d.ts +17 -0
- package/lib/lottery-tool-handlers.d.ts.map +1 -0
- package/lib/{src/lottery-tool-handlers.js → lottery-tool-handlers.js} +3 -3
- package/lib/lottery-tool-handlers.js.map +1 -0
- package/lib/memory-db.d.ts +7 -0
- package/lib/memory-db.d.ts.map +1 -0
- package/lib/memory-db.js +49 -0
- package/lib/memory-db.js.map +1 -0
- package/lib/pipeline.d.ts +33 -0
- package/lib/pipeline.d.ts.map +1 -0
- package/lib/{src/pipeline.js → pipeline.js} +5 -8
- package/lib/pipeline.js.map +1 -0
- package/lib/push.d.ts +14 -0
- package/lib/push.d.ts.map +1 -0
- package/lib/push.js +24 -0
- package/lib/push.js.map +1 -0
- package/lib/recommend/game-pick.d.ts +13 -0
- package/lib/recommend/game-pick.d.ts.map +1 -0
- package/lib/recommend/game-pick.js.map +1 -0
- package/lib/recommend/report.d.ts +19 -0
- package/lib/recommend/report.d.ts.map +1 -0
- package/lib/{src/recommend → recommend}/report.js +0 -25
- package/lib/recommend/report.js.map +1 -0
- package/lib/runtime-state.d.ts +12 -0
- package/lib/runtime-state.d.ts.map +1 -0
- package/lib/runtime-state.js +13 -0
- package/lib/runtime-state.js.map +1 -0
- package/lib/stats/engine.d.ts +18 -0
- package/lib/stats/engine.d.ts.map +1 -0
- package/lib/stats/engine.js.map +1 -0
- package/lib/stats/pro-analysis.d.ts +7 -0
- package/lib/stats/pro-analysis.d.ts.map +1 -0
- package/lib/stats/pro-analysis.js.map +1 -0
- package/lib/stats/weights.d.ts +7 -0
- package/lib/stats/weights.d.ts.map +1 -0
- package/lib/stats/weights.js.map +1 -0
- package/lib/sync/fetch-official.d.ts +4 -0
- package/lib/sync/fetch-official.d.ts.map +1 -0
- package/lib/sync/fetch-official.js.map +1 -0
- package/lib/sync/run-sync.d.ts +8 -0
- package/lib/sync/run-sync.d.ts.map +1 -0
- package/lib/sync/run-sync.js.map +1 -0
- package/lib/types.d.ts +84 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js.map +1 -0
- package/package.json +30 -7
- package/plugin.ts +106 -0
- package/schema.json +52 -0
- package/src/command-helpers.ts +35 -0
- package/src/config.ts +83 -0
- package/src/db-store.ts +34 -0
- package/src/index.ts +13 -216
- package/src/lottery-agent-deps.ts +14 -4
- package/src/lottery-tool-handlers.ts +3 -3
- package/src/memory-db.ts +60 -0
- package/src/pipeline.ts +4 -11
- package/src/push.ts +32 -31
- package/src/recommend/report.ts +0 -30
- package/src/runtime-state.ts +23 -0
- package/agent/schedules/daily_pipeline.ts +0 -34
- package/lib/agent/agent.js +0 -6
- package/lib/agent/agent.js.map +0 -1
- package/lib/agent/schedules/daily_pipeline.js +0 -36
- package/lib/agent/schedules/daily_pipeline.js.map +0 -1
- package/lib/agent/tools/compute_recommend.js +0 -11
- package/lib/agent/tools/compute_recommend.js.map +0 -1
- package/lib/agent/tools/get_model_state.js +0 -11
- package/lib/agent/tools/get_model_state.js.map +0 -1
- package/lib/agent/tools/history.js +0 -24
- package/lib/agent/tools/history.js.map +0 -1
- package/lib/agent/tools/list_pending.js +0 -11
- package/lib/agent/tools/list_pending.js.map +0 -1
- package/lib/agent/tools/save_prediction.js +0 -14
- package/lib/agent/tools/save_prediction.js.map +0 -1
- package/lib/agent/tools/stats_snapshot.js +0 -11
- package/lib/agent/tools/stats_snapshot.js.map +0 -1
- package/lib/agent/tools/sync.js +0 -19
- package/lib/agent/tools/sync.js.map +0 -1
- package/lib/evals/pipeline_smoke.eval.js +0 -8
- package/lib/evals/pipeline_smoke.eval.js.map +0 -1
- package/lib/src/agent/prompts.js.map +0 -1
- package/lib/src/agent/read-skills.js.map +0 -1
- package/lib/src/agent/run-turn.js +0 -47
- package/lib/src/agent/run-turn.js.map +0 -1
- package/lib/src/db.js.map +0 -1
- package/lib/src/evaluate/adaptive-sim.js.map +0 -1
- package/lib/src/evaluate/backtest.js.map +0 -1
- package/lib/src/evaluate/hit-rate.js.map +0 -1
- package/lib/src/evaluate/review-pending.js.map +0 -1
- package/lib/src/evaluate/tracker.js.map +0 -1
- package/lib/src/evaluate/train-weights.js.map +0 -1
- package/lib/src/evaluate/weight-guard.js.map +0 -1
- package/lib/src/games/kl8-groups.js.map +0 -1
- package/lib/src/games/registry.js.map +0 -1
- package/lib/src/index.js +0 -183
- package/lib/src/index.js.map +0 -1
- package/lib/src/lottery-agent-deps.js +0 -10
- package/lib/src/lottery-agent-deps.js.map +0 -1
- package/lib/src/lottery-tool-handlers.js.map +0 -1
- package/lib/src/pipeline.js.map +0 -1
- package/lib/src/push.js +0 -31
- package/lib/src/push.js.map +0 -1
- package/lib/src/recommend/game-pick.js.map +0 -1
- package/lib/src/recommend/report.js.map +0 -1
- package/lib/src/stats/engine.js.map +0 -1
- package/lib/src/stats/pro-analysis.js.map +0 -1
- package/lib/src/stats/weights.js.map +0 -1
- package/lib/src/sync/fetch-official.js.map +0 -1
- package/lib/src/sync/run-sync.js.map +0 -1
- package/lib/src/types.js.map +0 -1
- package/src/agent/run-turn.ts +0 -74
- /package/lib/{src/agent → agent}/prompts.js +0 -0
- /package/lib/{src/agent → agent}/read-skills.js +0 -0
- /package/lib/{src/db.js → db.js} +0 -0
- /package/lib/{src/evaluate → evaluate}/adaptive-sim.js +0 -0
- /package/lib/{src/evaluate → evaluate}/backtest.js +0 -0
- /package/lib/{src/evaluate → evaluate}/hit-rate.js +0 -0
- /package/lib/{src/evaluate → evaluate}/review-pending.js +0 -0
- /package/lib/{src/evaluate → evaluate}/tracker.js +0 -0
- /package/lib/{src/evaluate → evaluate}/train-weights.js +0 -0
- /package/lib/{src/evaluate → evaluate}/weight-guard.js +0 -0
- /package/lib/{src/games → games}/kl8-groups.js +0 -0
- /package/lib/{src/games → games}/registry.js +0 -0
- /package/lib/{src/recommend → recommend}/game-pick.js +0 -0
- /package/lib/{src/stats → stats}/engine.js +0 -0
- /package/lib/{src/stats → stats}/pro-analysis.js +0 -0
- /package/lib/{src/stats → stats}/weights.js +0 -0
- /package/lib/{src/sync → sync}/fetch-official.js +0 -0
- /package/lib/{src/sync → sync}/run-sync.js +0 -0
- /package/lib/{src/types.js → types.js} +0 -0
package/README.md
CHANGED
|
@@ -6,8 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
- **单条定时流水线**:同步 → 复盘 → 推荐 → 推送(默认 18:00)
|
|
8
8
|
- 频率 + 遗漏 + 趋势综合统计;开奖后自动调权
|
|
9
|
-
- 按 `games`
|
|
9
|
+
- 按 `games` 配置过滤,经 Runtime `OutboundHost` 推送到显式 `pushTargets`
|
|
10
10
|
- 手动触发:`lottery`(不推送,结果在会话内返回)
|
|
11
|
+
- IM commands 通过 owner-scoped `LotteryRuntime` 使用实例 DB。Agent deps 与 Outbound
|
|
12
|
+
sender 使用 generation-owned 注册;配置关闭推送时会显式遮蔽旧 generation,回滚时再
|
|
13
|
+
恢复仍存活的上一代。
|
|
11
14
|
|
|
12
15
|
## 安装
|
|
13
16
|
|
|
@@ -23,7 +26,7 @@ scheduleCron (18:00)
|
|
|
23
26
|
2. review pending picks vs new issues → tune weights → **lottery_model_weights**
|
|
24
27
|
3. if no new review: replay history simulation → refresh **lottery_model_weights**
|
|
25
28
|
4. compute next-period picks (reads weights from DB) → lottery_predictions
|
|
26
|
-
5. push report to
|
|
29
|
+
5. push report to configured targets (enabled games only)
|
|
27
30
|
```
|
|
28
31
|
|
|
29
32
|
权重表 `lottery_model_weights` 每玩法一行,字段 `freq_weight` / `omit_weight` / `trend_weight` + `eval_count` / `avg_hit_rate`:
|
|
@@ -33,35 +36,31 @@ scheduleCron (18:00)
|
|
|
33
36
|
- **推荐**:`loadGameWeights` 读库中最新权重算号
|
|
34
37
|
|
|
35
38
|
- **代码层**:官网同步、F/O/T 引擎、复盘调权
|
|
36
|
-
-
|
|
39
|
+
- **确定性报告**:主流水线不依赖 legacy Plugin 或 LLM,Agent 可通过独立 tools 读取结果
|
|
37
40
|
|
|
38
41
|
## 配置
|
|
39
42
|
|
|
40
43
|
```yaml
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
pickCount: 5
|
|
50
|
-
historyLimit: 500
|
|
51
|
-
kl8:
|
|
44
|
+
plugins:
|
|
45
|
+
lottery:
|
|
46
|
+
scheduleCron: "0 0 18 * * *"
|
|
47
|
+
scheduleEnabled: true
|
|
48
|
+
backtestEnabled: true
|
|
49
|
+
backtestWindow: 50
|
|
50
|
+
backtestRandomTrials: 64
|
|
51
|
+
backtestMinHistory: 30
|
|
52
52
|
pickCount: 5
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
- pl5
|
|
53
|
+
historyLimit: 500
|
|
54
|
+
kl8:
|
|
55
|
+
pickCount: 5
|
|
56
|
+
recommendGroups: 3
|
|
57
|
+
groupStrategies: [balanced, hot, cold]
|
|
58
|
+
games: [kl8, ssq, dlt, fc3d, pl3, pl5]
|
|
59
|
+
pushTargets:
|
|
60
|
+
- adapter: sandbox
|
|
61
|
+
endpointId: sandbox-bot
|
|
62
|
+
channelType: private
|
|
63
|
+
channelId: operator
|
|
65
64
|
```
|
|
66
65
|
|
|
67
66
|
## 权重训练(模拟盘)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineAgentTool } from '@zhin.js/agent/tools';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { handleComputeRecommend } from '../../src/lottery-tool-handlers.js';
|
|
4
4
|
|
|
5
|
-
export default
|
|
5
|
+
export default defineAgentTool<{ game: string }>({
|
|
6
6
|
description: 'Compute lottery recommendation numbers via F/O/T stats engine',
|
|
7
7
|
inputSchema: z.object({ game: z.string().min(1) }),
|
|
8
8
|
async execute({ game }) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineAgentTool } from '@zhin.js/agent/tools';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { handleGetModelState } from '../../src/lottery-tool-handlers.js';
|
|
4
4
|
|
|
5
|
-
export default
|
|
5
|
+
export default defineAgentTool<{ game?: string }>({
|
|
6
6
|
description: 'Query model weights and historical hit rate per game',
|
|
7
7
|
inputSchema: z.object({ game: z.string().optional() }),
|
|
8
8
|
async execute({ game }) {
|
package/agent/tools/history.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineAgentTool } from '@zhin.js/agent/tools';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { parseGameId } from '../../src/games/registry.js';
|
|
4
4
|
import { loadDraws } from '../../src/db.js';
|
|
5
5
|
import { getLotteryAgentDeps } from '../../src/lottery-agent-deps.js';
|
|
6
6
|
|
|
7
|
-
export default
|
|
7
|
+
export default defineAgentTool<{ game: string; count?: number }>({
|
|
8
8
|
description: 'Query historical lottery draws',
|
|
9
9
|
inputSchema: z.object({
|
|
10
10
|
game: z.string().min(1),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineAgentTool } from '@zhin.js/agent/tools';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { handleListPending } from '../../src/lottery-tool-handlers.js';
|
|
4
4
|
|
|
5
|
-
export default
|
|
5
|
+
export default defineAgentTool<{ game?: string }>({
|
|
6
6
|
description: 'List pending lottery predictions awaiting review',
|
|
7
7
|
inputSchema: z.object({ game: z.string().optional() }),
|
|
8
8
|
async execute({ game }) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineAgentTool } from '@zhin.js/agent/tools';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { handleSavePrediction } from '../../src/lottery-tool-handlers.js';
|
|
4
4
|
|
|
5
|
-
export default
|
|
5
|
+
export default defineAgentTool<{ game: string; numbers_json: string }>({
|
|
6
6
|
description: 'Save a pending lottery prediction',
|
|
7
7
|
inputSchema: z.object({
|
|
8
8
|
game: z.string().min(1),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineAgentTool } from '@zhin.js/agent/tools';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { handleStatsSnapshot } from '../../src/lottery-tool-handlers.js';
|
|
4
4
|
|
|
5
|
-
export default
|
|
5
|
+
export default defineAgentTool<{ game: string }>({
|
|
6
6
|
description: 'Get stats snapshot for a lottery game',
|
|
7
7
|
inputSchema: z.object({ game: z.string().min(1) }),
|
|
8
8
|
async execute({ game }) {
|
package/agent/tools/sync.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineAgentTool } from '@zhin.js/agent/tools';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { parseGameId } from '../../src/games/registry.js';
|
|
4
4
|
import { getLotteryAgentDeps } from '../../src/lottery-agent-deps.js';
|
|
5
5
|
import { runDataSync } from '../../src/sync/run-sync.js';
|
|
6
6
|
|
|
7
|
-
export default
|
|
7
|
+
export default defineAgentTool<{ game?: string }>({
|
|
8
8
|
description: 'Sync official lottery draws into DB',
|
|
9
9
|
inputSchema: z.object({ game: z.string().optional() }),
|
|
10
10
|
async execute({ game }) {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { defineCommand } from '@zhin.js/command';
|
|
2
|
+
import { parseGameId } from '../../src/games/registry.js';
|
|
3
|
+
import {
|
|
4
|
+
buildPipelineDeps,
|
|
5
|
+
formatPipelineReply,
|
|
6
|
+
getLotteryDb,
|
|
7
|
+
runLotteryPipeline,
|
|
8
|
+
resolveLotteryConfig,
|
|
9
|
+
type LotteryConfig,
|
|
10
|
+
} from '../../src/command-helpers.js';
|
|
11
|
+
import { resolveLotteryRuntime } from '../../src/runtime-state.js';
|
|
12
|
+
|
|
13
|
+
export default defineCommand<LotteryConfig>({
|
|
14
|
+
description: 'Run full pipeline: sync → review → recommend (manual, no push)',
|
|
15
|
+
async execute({ params, config, owner, use }) {
|
|
16
|
+
const cfg = resolveLotteryConfig(config);
|
|
17
|
+
const gid = parseGameId(String(params.game ?? ''));
|
|
18
|
+
const db = resolveLotteryRuntime({ owner, use })?.db ?? getLotteryDb();
|
|
19
|
+
const out = await runLotteryPipeline(buildPipelineDeps(cfg, db), {
|
|
20
|
+
gameId: gid ?? undefined,
|
|
21
|
+
push: false,
|
|
22
|
+
});
|
|
23
|
+
return formatPipelineReply(out);
|
|
24
|
+
},
|
|
25
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { defineCommand } from '@zhin.js/command';
|
|
2
|
+
import { parseGameId } from '../../src/games/registry.js';
|
|
3
|
+
import {
|
|
4
|
+
formatBacktestSection,
|
|
5
|
+
runBacktestForGames,
|
|
6
|
+
} from '../../src/evaluate/backtest.js';
|
|
7
|
+
import {
|
|
8
|
+
getLotteryDb,
|
|
9
|
+
resolveLotteryConfig,
|
|
10
|
+
type LotteryConfig,
|
|
11
|
+
} from '../../src/command-helpers.js';
|
|
12
|
+
import { lotteryEnabledGames } from '../../src/config.js';
|
|
13
|
+
import { resolveLotteryRuntime } from '../../src/runtime-state.js';
|
|
14
|
+
|
|
15
|
+
export default defineCommand<LotteryConfig>({
|
|
16
|
+
description: 'Walk-forward backtest vs random baseline',
|
|
17
|
+
async execute({ params, config, owner, use }) {
|
|
18
|
+
const db = resolveLotteryRuntime({ owner, use })?.db ?? getLotteryDb();
|
|
19
|
+
if (!db) return '数据库未就绪';
|
|
20
|
+
const cfg = resolveLotteryConfig(config);
|
|
21
|
+
const gid = parseGameId(String(params.game ?? ''));
|
|
22
|
+
const gameIds = gid ? [gid] : lotteryEnabledGames(cfg);
|
|
23
|
+
const summaries = await runBacktestForGames(db, gameIds, {
|
|
24
|
+
pickCount: cfg.pickCount,
|
|
25
|
+
window: cfg.backtestWindow,
|
|
26
|
+
randomTrials: cfg.backtestRandomTrials,
|
|
27
|
+
minHistory: cfg.backtestMinHistory,
|
|
28
|
+
historyLimit: cfg.historyLimit,
|
|
29
|
+
adaptive: cfg.backtestAdaptive,
|
|
30
|
+
});
|
|
31
|
+
const text = formatBacktestSection(summaries);
|
|
32
|
+
return text || '历史数据不足,请先执行 lottery 同步开奖';
|
|
33
|
+
},
|
|
34
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineCommand } from '@zhin.js/command';
|
|
2
|
+
import { parseGameId } from '../../src/games/registry.js';
|
|
3
|
+
import { loadDraws } from '../../src/db.js';
|
|
4
|
+
import { getLotteryDb, type LotteryConfig } from '../../src/command-helpers.js';
|
|
5
|
+
import { resolveLotteryRuntime } from '../../src/runtime-state.js';
|
|
6
|
+
|
|
7
|
+
export default defineCommand<LotteryConfig>({
|
|
8
|
+
description: 'List historical draw results',
|
|
9
|
+
async execute({ params, args, owner, use }) {
|
|
10
|
+
const gid = parseGameId(String(params.game ?? ''));
|
|
11
|
+
if (!gid) return '请指定玩法';
|
|
12
|
+
const db = resolveLotteryRuntime({ owner, use })?.db ?? getLotteryDb();
|
|
13
|
+
if (!db) return '数据库未就绪';
|
|
14
|
+
// count 原来是第二动态段,约定式命令只支持单动态文件参数,改从 args 取
|
|
15
|
+
const count = Math.min(50, Math.max(1, Number(args[0]) || 10));
|
|
16
|
+
const draws = await loadDraws(db, gid, count);
|
|
17
|
+
if (!draws.length) return '暂无数据';
|
|
18
|
+
return draws.map((d) => `${d.issue} ${d.drawTime} ${JSON.stringify(d.numbers)}`).join('\n');
|
|
19
|
+
},
|
|
20
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { defineCommand } from '@zhin.js/command';
|
|
2
|
+
import { parseGameId } from '../../src/games/registry.js';
|
|
3
|
+
import { loadDraws } from '../../src/db.js';
|
|
4
|
+
import { recommendGame, formatPickLine, formatPickStats } from '../../src/recommend/game-pick.js';
|
|
5
|
+
import { loadAccuracySnapshot, loadGameWeights } from '../../src/evaluate/tracker.js';
|
|
6
|
+
import {
|
|
7
|
+
getLotteryDb,
|
|
8
|
+
resolveLotteryConfig,
|
|
9
|
+
type LotteryConfig,
|
|
10
|
+
} from '../../src/command-helpers.js';
|
|
11
|
+
import { lotteryKl8 } from '../../src/config.js';
|
|
12
|
+
import { resolveLotteryRuntime } from '../../src/runtime-state.js';
|
|
13
|
+
|
|
14
|
+
export default defineCommand<LotteryConfig>({
|
|
15
|
+
description: 'Single-game stats snapshot',
|
|
16
|
+
async execute({ params, config, owner, use }) {
|
|
17
|
+
const gid = parseGameId(String(params.game ?? ''));
|
|
18
|
+
if (!gid) return '请指定玩法';
|
|
19
|
+
const db = resolveLotteryRuntime({ owner, use })?.db ?? getLotteryDb();
|
|
20
|
+
if (!db) return '数据库未就绪';
|
|
21
|
+
const cfg = resolveLotteryConfig(config);
|
|
22
|
+
const draws = await loadDraws(db, gid, cfg.historyLimit);
|
|
23
|
+
if (!draws.length) return '暂无数据,请先 lottery';
|
|
24
|
+
const kl8 = lotteryKl8(cfg);
|
|
25
|
+
const pick = recommendGame(gid, draws, {
|
|
26
|
+
pickCount: gid === 'kl8' ? kl8.pickCount : cfg.pickCount,
|
|
27
|
+
tieSeed: 'stats',
|
|
28
|
+
weights: await loadGameWeights(db, gid),
|
|
29
|
+
accuracy: await loadAccuracySnapshot(db, gid),
|
|
30
|
+
kl8: gid === 'kl8' ? kl8 : undefined,
|
|
31
|
+
});
|
|
32
|
+
return [formatPickLine(pick), formatPickStats(pick), `样本 ${draws.length} 期`].join('\n');
|
|
33
|
+
},
|
|
34
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineCommand } from '@zhin.js/command';
|
|
2
|
+
import { formatDailyReportText, loadTodayReport } from '../src/recommend/report.js';
|
|
3
|
+
import { getLotteryDb, type LotteryConfig } from '../src/command-helpers.js';
|
|
4
|
+
import { resolveLotteryRuntime } from '../src/runtime-state.js';
|
|
5
|
+
|
|
6
|
+
export default defineCommand<LotteryConfig>({
|
|
7
|
+
description: 'Show today published recommendation report',
|
|
8
|
+
async execute({ owner, use }) {
|
|
9
|
+
const db = resolveLotteryRuntime({ owner, use })?.db ?? getLotteryDb();
|
|
10
|
+
if (!db) return '数据库未就绪';
|
|
11
|
+
const report = await loadTodayReport(db);
|
|
12
|
+
if (!report) return '今日尚无推荐,可执行 lottery 或等待定时任务';
|
|
13
|
+
return formatDailyReportText(report, '');
|
|
14
|
+
},
|
|
15
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { defineCommand } from '@zhin.js/command';
|
|
2
|
+
import { parseGameId } from '../../src/games/registry.js';
|
|
3
|
+
import {
|
|
4
|
+
formatTrainReport,
|
|
5
|
+
trainAllGameWeights,
|
|
6
|
+
} from '../../src/evaluate/backtest.js';
|
|
7
|
+
import {
|
|
8
|
+
getLotteryDb,
|
|
9
|
+
resolveLotteryConfig,
|
|
10
|
+
type LotteryConfig,
|
|
11
|
+
} from '../../src/command-helpers.js';
|
|
12
|
+
import { lotteryEnabledGames } from '../../src/config.js';
|
|
13
|
+
import { resolveLotteryRuntime } from '../../src/runtime-state.js';
|
|
14
|
+
|
|
15
|
+
export default defineCommand<LotteryConfig>({
|
|
16
|
+
description: 'Full-history weight training',
|
|
17
|
+
async execute({ params, config, owner, use }) {
|
|
18
|
+
const db = resolveLotteryRuntime({ owner, use })?.db ?? getLotteryDb();
|
|
19
|
+
if (!db) return '数据库未就绪';
|
|
20
|
+
const cfg = resolveLotteryConfig(config);
|
|
21
|
+
const gid = parseGameId(String(params.game ?? ''));
|
|
22
|
+
const gameIds = gid ? [gid] : lotteryEnabledGames(cfg);
|
|
23
|
+
const results = await trainAllGameWeights(db, gameIds, {
|
|
24
|
+
pickCount: cfg.pickCount,
|
|
25
|
+
minHistory: cfg.backtestMinHistory,
|
|
26
|
+
historyLimit: cfg.historyLimit,
|
|
27
|
+
randomTrials: cfg.backtestRandomTrials,
|
|
28
|
+
holdoutWindow: cfg.backtestWindow,
|
|
29
|
+
holdoutFallback: cfg.weightHoldoutFallback,
|
|
30
|
+
persist: true,
|
|
31
|
+
});
|
|
32
|
+
return formatTrainReport(results);
|
|
33
|
+
},
|
|
34
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { GameId } from '../types.js';
|
|
2
|
+
export type LotteryAgentTask = 'daily_pipeline';
|
|
3
|
+
export interface LotteryAgentContext {
|
|
4
|
+
syncSummary?: string;
|
|
5
|
+
newDrawsSummary?: string;
|
|
6
|
+
games?: GameId[];
|
|
7
|
+
push?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** Prompt when agent is invoked interactively (cron uses code pipeline). */
|
|
10
|
+
export declare function buildDailyPipelinePrompt(ctx: LotteryAgentContext): string;
|
|
11
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/agent/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAEhD,MAAM,WAAW,mBAAmB;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,4EAA4E;AAC5E,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,mBAAmB,GAAG,MAAM,CAQzE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/agent/prompts.ts"],"names":[],"mappings":"AAWA,4EAA4E;AAC5E,MAAM,UAAU,wBAAwB,CAAC,GAAwB;IAC/D,MAAM,KAAK,GAAG,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,+BAA+B,CAAC;IAC9E,OAAO;QACL,0BAA0B;QAC1B,UAAU,KAAK,EAAE;QACjB,2GAA2G;QAC3G,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,aAAa;KACxC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-skills.d.ts","sourceRoot":"","sources":["../../src/agent/read-skills.ts"],"names":[],"mappings":"AAMA,wBAAgB,iBAAiB,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAS5D;AAED,wBAAgB,6BAA6B,IAAI,MAAM,CAStD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-skills.js","sourceRoot":"","sources":["../../src/agent/read-skills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AAExF,MAAM,UAAU,iBAAiB,CAAC,GAAG,KAAe;IAClD,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC;QAC7D,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,6BAA6B;IAC3C,MAAM,MAAM,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAC5C,OAAO;QACL,sDAAsD;QACtD,oEAAoE;QACpE,8CAA8C;QAC9C,EAAE;QACF,MAAM,IAAI,4BAA4B;KACvC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { resolveLotteryConfig, type LotteryConfig } from './config.js';
|
|
2
|
+
import { getLotteryDb } from './db-store.js';
|
|
3
|
+
import type { LotteryDb } from './db.js';
|
|
4
|
+
import { formatPipelineReply, runLotteryPipeline, type PipelineDeps } from './pipeline.js';
|
|
5
|
+
export declare function buildPipelineDeps(raw: Partial<LotteryConfig> | undefined, db?: LotteryDb | null): PipelineDeps;
|
|
6
|
+
export { formatPipelineReply, runLotteryPipeline, resolveLotteryConfig, getLotteryDb };
|
|
7
|
+
export type { LotteryConfig };
|
|
8
|
+
//# sourceMappingURL=command-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-helpers.d.ts","sourceRoot":"","sources":["../src/command-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,oBAAoB,EACpB,KAAK,aAAa,EACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAE3F,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,SAAS,EACvC,EAAE,GAAE,SAAS,GAAG,IAAqB,GACpC,YAAY,CAkBd;AAED,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,YAAY,EAAE,CAAC;AACvF,YAAY,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { lotteryEnabledGames, lotteryKl8, resolveLotteryConfig, } from './config.js';
|
|
2
|
+
import { getLotteryDb } from './db-store.js';
|
|
3
|
+
import { formatPipelineReply, runLotteryPipeline } from './pipeline.js';
|
|
4
|
+
export function buildPipelineDeps(raw, db = getLotteryDb()) {
|
|
5
|
+
const config = resolveLotteryConfig(raw);
|
|
6
|
+
return {
|
|
7
|
+
getDb: () => db,
|
|
8
|
+
enabledGames: () => lotteryEnabledGames(config),
|
|
9
|
+
historyLimit: config.historyLimit,
|
|
10
|
+
pickCount: config.pickCount,
|
|
11
|
+
kl8: lotteryKl8(config),
|
|
12
|
+
backtest: {
|
|
13
|
+
enabled: config.backtestEnabled,
|
|
14
|
+
window: config.backtestWindow,
|
|
15
|
+
randomTrials: config.backtestRandomTrials,
|
|
16
|
+
minHistory: config.backtestMinHistory,
|
|
17
|
+
adaptive: config.backtestAdaptive,
|
|
18
|
+
},
|
|
19
|
+
weightPersist: config.weightPersistEnabled,
|
|
20
|
+
weightHoldoutFallback: config.weightHoldoutFallback,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export { formatPipelineReply, runLotteryPipeline, resolveLotteryConfig, getLotteryDb };
|
|
24
|
+
//# sourceMappingURL=command-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-helpers.js","sourceRoot":"","sources":["../src/command-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,UAAU,EACV,oBAAoB,GAErB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAqB,MAAM,eAAe,CAAC;AAE3F,MAAM,UAAU,iBAAiB,CAC/B,GAAuC,EACvC,KAAuB,YAAY,EAAE;IAErC,MAAM,MAAM,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;IACzC,OAAO;QACL,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE;QACf,YAAY,EAAE,GAAG,EAAE,CAAC,mBAAmB,CAAC,MAAM,CAAC;QAC/C,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,GAAG,EAAE,UAAU,CAAC,MAAM,CAAC;QACvB,QAAQ,EAAE;YACR,OAAO,EAAE,MAAM,CAAC,eAAe;YAC/B,MAAM,EAAE,MAAM,CAAC,cAAc;YAC7B,YAAY,EAAE,MAAM,CAAC,oBAAoB;YACzC,UAAU,EAAE,MAAM,CAAC,kBAAkB;YACrC,QAAQ,EAAE,MAAM,CAAC,gBAAgB;SAClC;QACD,aAAa,EAAE,MAAM,CAAC,oBAAoB;QAC1C,qBAAqB,EAAE,MAAM,CAAC,qBAAqB;KACpD,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,YAAY,EAAE,CAAC"}
|
package/lib/config.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Kl8Config, Kl8ConfigInput } from './games/kl8-groups.js';
|
|
2
|
+
import type { GameId } from './types.js';
|
|
3
|
+
export interface LotteryConfig {
|
|
4
|
+
readonly pickCount: number;
|
|
5
|
+
readonly scheduleCron: string;
|
|
6
|
+
readonly historyLimit: number;
|
|
7
|
+
readonly scheduleEnabled: boolean;
|
|
8
|
+
readonly backtestEnabled: boolean;
|
|
9
|
+
readonly backtestWindow: number;
|
|
10
|
+
readonly backtestRandomTrials: number;
|
|
11
|
+
readonly backtestMinHistory: number;
|
|
12
|
+
readonly backtestAdaptive: boolean;
|
|
13
|
+
readonly weightPersistEnabled: boolean;
|
|
14
|
+
readonly weightHoldoutFallback: boolean;
|
|
15
|
+
readonly kl8?: Kl8ConfigInput;
|
|
16
|
+
readonly games: readonly string[];
|
|
17
|
+
/** Plugin Runtime OutboundHost push targets (cron / publish). */
|
|
18
|
+
readonly pushTargets: readonly LotteryPushTargetConfig[];
|
|
19
|
+
}
|
|
20
|
+
export interface LotteryPushTargetConfig {
|
|
21
|
+
readonly adapter: string;
|
|
22
|
+
readonly endpointId?: string;
|
|
23
|
+
readonly channelType?: string;
|
|
24
|
+
readonly channelId: string;
|
|
25
|
+
}
|
|
26
|
+
export declare const DEFAULT_LOTTERY_CONFIG: LotteryConfig;
|
|
27
|
+
export declare function resolveLotteryConfig(raw: Partial<LotteryConfig> | undefined): LotteryConfig;
|
|
28
|
+
export declare function lotteryKl8(config: LotteryConfig): Kl8Config;
|
|
29
|
+
export declare function lotteryEnabledGames(config: LotteryConfig): GameId[];
|
|
30
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGzC,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,QAAQ,CAAC,oBAAoB,EAAE,OAAO,CAAC;IACvC,QAAQ,CAAC,qBAAqB,EAAE,OAAO,CAAC;IACxC,QAAQ,CAAC,GAAG,CAAC,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,iEAAiE;IACjE,QAAQ,CAAC,WAAW,EAAE,SAAS,uBAAuB,EAAE,CAAC;CAC1D;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,eAAO,MAAM,sBAAsB,EAAE,aAmBpC,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,SAAS,GAAG,aAAa,CAuB3F;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,aAAa,GAAG,SAAS,CAE3D;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,EAAE,CAEnE"}
|
package/lib/config.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { resolveKl8Config } from './games/kl8-groups.js';
|
|
2
|
+
import { resolveEnabledGames } from './games/registry.js';
|
|
3
|
+
export const DEFAULT_LOTTERY_CONFIG = {
|
|
4
|
+
pickCount: 5,
|
|
5
|
+
scheduleCron: '0 0 18 * * *',
|
|
6
|
+
historyLimit: 500,
|
|
7
|
+
scheduleEnabled: true,
|
|
8
|
+
backtestEnabled: true,
|
|
9
|
+
backtestWindow: 50,
|
|
10
|
+
backtestRandomTrials: 64,
|
|
11
|
+
backtestMinHistory: 30,
|
|
12
|
+
backtestAdaptive: true,
|
|
13
|
+
weightPersistEnabled: true,
|
|
14
|
+
weightHoldoutFallback: true,
|
|
15
|
+
kl8: {
|
|
16
|
+
pickCount: 5,
|
|
17
|
+
recommendGroups: 3,
|
|
18
|
+
groupStrategies: ['balanced', 'hot', 'cold'],
|
|
19
|
+
},
|
|
20
|
+
games: ['kl8', 'ssq', 'dlt', 'fc3d', 'pl3', 'pl5'],
|
|
21
|
+
pushTargets: [],
|
|
22
|
+
};
|
|
23
|
+
export function resolveLotteryConfig(raw) {
|
|
24
|
+
const pushTargets = Array.isArray(raw?.pushTargets)
|
|
25
|
+
? raw.pushTargets
|
|
26
|
+
.filter((t) => !!t && typeof t === 'object'
|
|
27
|
+
&& typeof t.adapter === 'string'
|
|
28
|
+
&& typeof t.channelId === 'string'
|
|
29
|
+
&& t.adapter.length > 0
|
|
30
|
+
&& t.channelId.length > 0)
|
|
31
|
+
.map((t) => Object.freeze({
|
|
32
|
+
adapter: t.adapter,
|
|
33
|
+
endpointId: typeof t.endpointId === 'string' ? t.endpointId : t.adapter,
|
|
34
|
+
channelType: typeof t.channelType === 'string' ? t.channelType : 'private',
|
|
35
|
+
channelId: t.channelId,
|
|
36
|
+
}))
|
|
37
|
+
: [];
|
|
38
|
+
return {
|
|
39
|
+
...DEFAULT_LOTTERY_CONFIG,
|
|
40
|
+
...raw,
|
|
41
|
+
games: raw?.games?.length ? [...raw.games] : [...DEFAULT_LOTTERY_CONFIG.games],
|
|
42
|
+
kl8: { ...DEFAULT_LOTTERY_CONFIG.kl8, ...raw?.kl8 },
|
|
43
|
+
pushTargets,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export function lotteryKl8(config) {
|
|
47
|
+
return resolveKl8Config(config.pickCount, config.kl8);
|
|
48
|
+
}
|
|
49
|
+
export function lotteryEnabledGames(config) {
|
|
50
|
+
return resolveEnabledGames([...config.games]);
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AA2B1D,MAAM,CAAC,MAAM,sBAAsB,GAAkB;IACnD,SAAS,EAAE,CAAC;IACZ,YAAY,EAAE,cAAc;IAC5B,YAAY,EAAE,GAAG;IACjB,eAAe,EAAE,IAAI;IACrB,eAAe,EAAE,IAAI;IACrB,cAAc,EAAE,EAAE;IAClB,oBAAoB,EAAE,EAAE;IACxB,kBAAkB,EAAE,EAAE;IACtB,gBAAgB,EAAE,IAAI;IACtB,oBAAoB,EAAE,IAAI;IAC1B,qBAAqB,EAAE,IAAI;IAC3B,GAAG,EA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CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,sBAAsB,CAAC,KAAK,CAAC;QAC9E,GAAG,EAAE,EAAE,GAAG,sBAAsB,CAAC,GAAG,EAAE,GAAG,GAAG,EAAE,GAAG,EAAE;QACnD,WAAW;KACZ,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,MAAqB;IAC9C,OAAO,gBAAgB,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,MAAqB;IACvD,OAAO,mBAAmB,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { LotteryDb } from './db.js';
|
|
2
|
+
/** Ensure an in-memory store when Runtime database Resource is not wired yet. */
|
|
3
|
+
export declare function ensureLotteryMemoryDb(): LotteryDb;
|
|
4
|
+
export declare function getLotteryDb(): LotteryDb | null;
|
|
5
|
+
export declare function setLotteryDb(db: LotteryDb | null): void;
|
|
6
|
+
/** Generation-owned database binding used by Plugin Runtime setup(). */
|
|
7
|
+
export declare function registerLotteryDb(db: LotteryDb): () => void;
|
|
8
|
+
/** Test helper: clear module store. */
|
|
9
|
+
export declare function resetLotteryDb(): void;
|
|
10
|
+
//# sourceMappingURL=db-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db-store.d.ts","sourceRoot":"","sources":["../src/db-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAMzC,iFAAiF;AACjF,wBAAgB,qBAAqB,IAAI,SAAS,CAGjD;AAED,wBAAgB,YAAY,IAAI,SAAS,GAAG,IAAI,CAE/C;AAED,wBAAgB,YAAY,CAAC,EAAE,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI,CAEvD;AAED,wEAAwE;AACxE,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,SAAS,GAAG,MAAM,IAAI,CAO3D;AAED,uCAAuC;AACvC,wBAAgB,cAAc,IAAI,IAAI,CAErC"}
|
package/lib/db-store.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createInMemoryLotteryDb } from './memory-db.js';
|
|
2
|
+
let _db = null;
|
|
3
|
+
const registrations = [];
|
|
4
|
+
/** Ensure an in-memory store when Runtime database Resource is not wired yet. */
|
|
5
|
+
export function ensureLotteryMemoryDb() {
|
|
6
|
+
if (!_db)
|
|
7
|
+
_db = createInMemoryLotteryDb();
|
|
8
|
+
return _db;
|
|
9
|
+
}
|
|
10
|
+
export function getLotteryDb() {
|
|
11
|
+
return registrations[registrations.length - 1]?.value ?? ensureLotteryMemoryDb();
|
|
12
|
+
}
|
|
13
|
+
export function setLotteryDb(db) {
|
|
14
|
+
_db = db;
|
|
15
|
+
}
|
|
16
|
+
/** Generation-owned database binding used by Plugin Runtime setup(). */
|
|
17
|
+
export function registerLotteryDb(db) {
|
|
18
|
+
const registration = Object.freeze({ value: db });
|
|
19
|
+
registrations.push(registration);
|
|
20
|
+
return () => {
|
|
21
|
+
const index = registrations.lastIndexOf(registration);
|
|
22
|
+
if (index >= 0)
|
|
23
|
+
registrations.splice(index, 1);
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/** Test helper: clear module store. */
|
|
27
|
+
export function resetLotteryDb() {
|
|
28
|
+
_db = null;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=db-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db-store.js","sourceRoot":"","sources":["../src/db-store.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,IAAI,GAAG,GAAqB,IAAI,CAAC;AACjC,MAAM,aAAa,GAAyC,EAAE,CAAC;AAE/D,iFAAiF;AACjF,MAAM,UAAU,qBAAqB;IACnC,IAAI,CAAC,GAAG;QAAE,GAAG,GAAG,uBAAuB,EAAE,CAAC;IAC1C,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,OAAO,aAAa,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,KAAK,IAAI,qBAAqB,EAAE,CAAC;AACnF,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,EAAoB;IAC/C,GAAG,GAAG,EAAE,CAAC;AACX,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,iBAAiB,CAAC,EAAa;IAC7C,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IAClD,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACjC,OAAO,GAAG,EAAE;QACV,MAAM,KAAK,GAAG,aAAa,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;QACtD,IAAI,KAAK,IAAI,CAAC;YAAE,aAAa,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACjD,CAAC,CAAC;AACJ,CAAC;AAED,uCAAuC;AACvC,MAAM,UAAU,cAAc;IAC5B,GAAG,GAAG,IAAI,CAAC;AACb,CAAC"}
|
package/lib/db.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { GameId, NormalizedDraw } from './types.js';
|
|
2
|
+
export declare const DRAWS_TABLE = "lottery_draws";
|
|
3
|
+
export declare const REPORTS_TABLE = "lottery_daily_reports";
|
|
4
|
+
export interface LotteryDb {
|
|
5
|
+
models: {
|
|
6
|
+
get: (name: string) => LotteryModel | undefined;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export interface LotteryModel {
|
|
10
|
+
select: () => {
|
|
11
|
+
where: (q: Record<string, unknown>) => Promise<unknown[]>;
|
|
12
|
+
};
|
|
13
|
+
insert: (row: Record<string, unknown>) => Promise<unknown>;
|
|
14
|
+
delete: () => {
|
|
15
|
+
where: (q: Record<string, unknown>) => Promise<unknown>;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export declare function defineLotteryTables(db: {
|
|
19
|
+
define: (name: string, schema: Record<string, unknown>) => void;
|
|
20
|
+
}): void;
|
|
21
|
+
export declare function upsertDraws(db: LotteryDb, draws: NormalizedDraw[]): Promise<{
|
|
22
|
+
count: number;
|
|
23
|
+
inserted: NormalizedDraw[];
|
|
24
|
+
}>;
|
|
25
|
+
export declare function trimHistory(db: LotteryDb, gameId: GameId, limit: number): Promise<void>;
|
|
26
|
+
export declare function parseStoredJson<T>(value: unknown, fallback: T): T;
|
|
27
|
+
export declare function loadDraws(db: LotteryDb, gameId: GameId, limit: number): Promise<NormalizedDraw[]>;
|
|
28
|
+
export declare function fetchGameDraws(gameId: GameId, count: number): Promise<NormalizedDraw[]>;
|
|
29
|
+
export declare function syncGame(db: LotteryDb, gameId: GameId, historyLimit: number): Promise<{
|
|
30
|
+
count: number;
|
|
31
|
+
inserted: NormalizedDraw[];
|
|
32
|
+
}>;
|
|
33
|
+
//# sourceMappingURL=db.d.ts.map
|
package/lib/db.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../src/db.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,MAAM,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAKtE,eAAO,MAAM,WAAW,kBAAkB,CAAC;AAC3C,eAAO,MAAM,aAAa,0BAA0B,CAAC;AAErD,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE;QACN,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,YAAY,GAAG,SAAS,CAAC;KACjD,CAAC;CACH;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM;QACZ,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE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