@zhin.js/plugin-lottery 1.1.9 → 1.1.11
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 +8 -0
- package/commands/lottery/[[game]]/index.js +5 -4
- package/commands/lottery/[[game]]/index.ts +5 -4
- package/commands/lottery-backtest/[[game]]/index.js +9 -4
- package/commands/lottery-backtest/[[game]]/index.ts +8 -4
- package/commands/lottery-history/[game]/index.js +6 -4
- package/commands/lottery-history/[game]/index.ts +6 -4
- package/commands/lottery-stats/[game]/index.js +11 -6
- package/commands/lottery-stats/[game]/index.ts +11 -5
- package/commands/lottery-today/index.js +8 -4
- package/commands/lottery-today/index.ts +8 -3
- package/commands/lottery-train/[[game]]/index.js +4 -3
- package/commands/lottery-train/[[game]]/index.ts +4 -3
- package/lib/command-helpers.d.ts +2 -1
- package/lib/command-helpers.d.ts.map +1 -1
- package/lib/command-helpers.js +2 -1
- package/lib/command-helpers.js.map +1 -1
- package/lib/evaluate/backtest.d.ts +3 -2
- package/lib/evaluate/backtest.d.ts.map +1 -1
- package/lib/evaluate/backtest.js +12 -11
- package/lib/evaluate/backtest.js.map +1 -1
- package/lib/evaluate/tracker.d.ts +2 -1
- package/lib/evaluate/tracker.d.ts.map +1 -1
- package/lib/evaluate/tracker.js +9 -8
- package/lib/evaluate/tracker.js.map +1 -1
- package/lib/evaluate/train-weights.d.ts +3 -2
- package/lib/evaluate/train-weights.d.ts.map +1 -1
- package/lib/evaluate/train-weights.js +12 -11
- package/lib/evaluate/train-weights.js.map +1 -1
- package/lib/games/kl8-groups.d.ts +2 -0
- package/lib/games/kl8-groups.d.ts.map +1 -1
- package/lib/games/kl8-groups.js +2 -1
- package/lib/games/kl8-groups.js.map +1 -1
- package/lib/i18n.d.ts +2 -0
- package/lib/i18n.d.ts.map +1 -0
- package/lib/i18n.js +222 -0
- package/lib/i18n.js.map +1 -0
- package/lib/lottery-tool-handlers.d.ts +4 -3
- package/lib/lottery-tool-handlers.d.ts.map +1 -1
- package/lib/lottery-tool-handlers.js +12 -7
- package/lib/lottery-tool-handlers.js.map +1 -1
- package/lib/pipeline.d.ts +3 -1
- package/lib/pipeline.d.ts.map +1 -1
- package/lib/pipeline.js +9 -7
- package/lib/pipeline.js.map +1 -1
- package/lib/recommend/game-pick.d.ts +4 -2
- package/lib/recommend/game-pick.d.ts.map +1 -1
- package/lib/recommend/game-pick.js +39 -28
- package/lib/recommend/game-pick.js.map +1 -1
- package/lib/recommend/report.d.ts +4 -2
- package/lib/recommend/report.d.ts.map +1 -1
- package/lib/recommend/report.js +17 -10
- package/lib/recommend/report.js.map +1 -1
- package/lib/runtime-state.d.ts +2 -0
- package/lib/runtime-state.d.ts.map +1 -1
- package/lib/runtime-state.js.map +1 -1
- package/lib/stats/pro-analysis.d.ts +3 -2
- package/lib/stats/pro-analysis.d.ts.map +1 -1
- package/lib/stats/pro-analysis.js +10 -9
- package/lib/stats/pro-analysis.js.map +1 -1
- package/lib/sync/run-sync.d.ts +2 -1
- package/lib/sync/run-sync.d.ts.map +1 -1
- package/lib/sync/run-sync.js +4 -3
- package/lib/sync/run-sync.js.map +1 -1
- package/lib/types.d.ts +2 -0
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js.map +1 -1
- package/package.json +8 -8
- package/plugin.js +4 -0
- package/skills/lottery/tools/compute-recommend/index.js +1 -1
- package/skills/lottery/tools/compute-recommend/index.ts +1 -1
- package/skills/lottery/tools/history/index.js +2 -1
- package/skills/lottery/tools/history/index.ts +2 -1
- package/skills/lottery/tools/save-prediction/index.js +1 -1
- package/skills/lottery/tools/save-prediction/index.ts +1 -1
- package/skills/lottery/tools/stats-snapshot/index.js +1 -1
- package/skills/lottery/tools/stats-snapshot/index.ts +1 -1
- package/skills/lottery/tools/sync/index.js +1 -1
- package/skills/lottery/tools/sync/index.ts +1 -0
- package/src/command-helpers.ts +3 -0
- package/src/evaluate/backtest.ts +13 -11
- package/src/evaluate/tracker.ts +10 -8
- package/src/evaluate/train-weights.ts +13 -11
- package/src/games/kl8-groups.ts +4 -1
- package/src/i18n.ts +222 -0
- package/src/lottery-tool-handlers.ts +12 -7
- package/src/pipeline.ts +10 -7
- package/src/recommend/game-pick.ts +40 -28
- package/src/recommend/report.ts +18 -8
- package/src/runtime-state.ts +2 -0
- package/src/stats/pro-analysis.ts +11 -7
- package/src/sync/run-sync.ts +5 -2
- package/src/types.ts +2 -0
package/src/runtime-state.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import type { Locale } from 'zhin.js/i18n';
|
|
1
2
|
import { createToken } from 'zhin.js';
|
|
2
3
|
import type { LotteryConfig } from './config.js';
|
|
3
4
|
import type { LotteryDb } from './db.js';
|
|
4
5
|
import type { GameId } from './types.js';
|
|
5
6
|
|
|
6
7
|
export interface LotteryRuntime {
|
|
8
|
+
readonly locale?: Locale;
|
|
7
9
|
readonly db: LotteryDb;
|
|
8
10
|
readonly config: Readonly<LotteryConfig>;
|
|
9
11
|
readonly enabledGames: readonly GameId[];
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Locale } from 'zhin.js/i18n';
|
|
2
|
+
import { messages as t } from '../i18n.js';
|
|
1
3
|
import { DEFAULT_WEIGHTS, type DrawNumbers, type GameId, type NormalizedDraw, type ScoreWeights } from '../types.js';
|
|
2
4
|
|
|
3
5
|
import { formatWeights, normalizeWeights } from './weights.js';
|
|
@@ -59,6 +61,7 @@ export function computeProMetrics(
|
|
|
59
61
|
poolMin?: number,
|
|
60
62
|
poolMax?: number,
|
|
61
63
|
mid?: number,
|
|
64
|
+
locale?: Locale,
|
|
62
65
|
): import('../types.js').ProMetrics {
|
|
63
66
|
const odd = pick.filter((n) => n % 2 === 1).length;
|
|
64
67
|
const even = pick.length - odd;
|
|
@@ -76,7 +79,7 @@ export function computeProMetrics(
|
|
|
76
79
|
const idx = Math.min(2, Math.floor((n - poolMin) / size));
|
|
77
80
|
z[idx] = (z[idx] ?? 0) + 1;
|
|
78
81
|
}
|
|
79
|
-
zones =
|
|
82
|
+
zones = t(locale, 'zones', { zones: z.join(':') });
|
|
80
83
|
}
|
|
81
84
|
|
|
82
85
|
const rows = draws.map((d) => extractFlat(d.numbers, gameId)).filter((a) => a.length);
|
|
@@ -90,13 +93,13 @@ export function computeProMetrics(
|
|
|
90
93
|
.join(',');
|
|
91
94
|
|
|
92
95
|
return {
|
|
93
|
-
oddEven:
|
|
94
|
-
bigSmall:
|
|
96
|
+
oddEven: t(locale, 'oddEven', { odd, even }),
|
|
97
|
+
bigSmall: t(locale, 'bigSmall', { big, small }),
|
|
95
98
|
sum,
|
|
96
99
|
span,
|
|
97
100
|
zones,
|
|
98
|
-
recentHot: recentHot ?
|
|
99
|
-
modelWeights:
|
|
101
|
+
recentHot: recentHot ? t(locale, 'recentHot', { numbers: recentHot }) : '',
|
|
102
|
+
modelWeights: t(locale, 'weights', { weights: formatWeights(weights) }),
|
|
100
103
|
};
|
|
101
104
|
}
|
|
102
105
|
|
|
@@ -104,6 +107,7 @@ export function computeDigitProMetrics(
|
|
|
104
107
|
digits: number[],
|
|
105
108
|
draws: NormalizedDraw[],
|
|
106
109
|
weights: ScoreWeights,
|
|
110
|
+
locale?: Locale,
|
|
107
111
|
): import('../types.js').ProMetrics {
|
|
108
112
|
const sum = digits.reduce((a, b) => a + b, 0);
|
|
109
113
|
const span = digits.length ? Math.max(...digits) - Math.min(...digits) : 0;
|
|
@@ -115,7 +119,7 @@ export function computeDigitProMetrics(
|
|
|
115
119
|
for (let d = 0; d <= 9; d++) freq.set(d, 0);
|
|
116
120
|
col.slice(0, RECENT_WINDOW).forEach((n) => freq.set(n, (freq.get(n) ?? 0) + 1));
|
|
117
121
|
const top = [...freq.entries()].sort((a, b) => b[1] - a[1]).slice(0, 3).map(([d]) => d);
|
|
118
|
-
posHints.push(
|
|
122
|
+
posHints.push(t(locale, 'digitPos', { position: pos + 1, numbers: top.join(',') }));
|
|
119
123
|
}
|
|
120
124
|
return {
|
|
121
125
|
oddEven: '',
|
|
@@ -124,7 +128,7 @@ export function computeDigitProMetrics(
|
|
|
124
128
|
span,
|
|
125
129
|
digitPos: posHints.join(' '),
|
|
126
130
|
recentHot: '',
|
|
127
|
-
modelWeights:
|
|
131
|
+
modelWeights: t(locale, 'weights', { weights: formatWeights(weights) }),
|
|
128
132
|
};
|
|
129
133
|
}
|
|
130
134
|
|
package/src/sync/run-sync.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Locale } from 'zhin.js/i18n';
|
|
2
|
+
import { messages as t } from '../i18n.js';
|
|
1
3
|
import type { GameId, NormalizedDraw } from '../types.js';
|
|
2
4
|
import { syncGame, type LotteryDb } from '../db.js';
|
|
3
5
|
|
|
@@ -6,9 +8,10 @@ export async function runDataSync(
|
|
|
6
8
|
enabledGames: () => GameId[],
|
|
7
9
|
historyLimit: number,
|
|
8
10
|
gameId?: GameId,
|
|
11
|
+
locale?: Locale,
|
|
9
12
|
): Promise<{ text: string; newSummary: string; inserted: NormalizedDraw[] }> {
|
|
10
13
|
const db = getDb();
|
|
11
|
-
if (!db) return { text:
|
|
14
|
+
if (!db) return { text: t(locale, 'dbNotReady'), newSummary: '', inserted: [] };
|
|
12
15
|
const ids = gameId ? [gameId] : enabledGames();
|
|
13
16
|
const parts: string[] = [];
|
|
14
17
|
const newParts: string[] = [];
|
|
@@ -26,7 +29,7 @@ export async function runDataSync(
|
|
|
26
29
|
}
|
|
27
30
|
}
|
|
28
31
|
return {
|
|
29
|
-
text:
|
|
32
|
+
text: t(locale, 'syncResult', { result: parts.join(', ') }),
|
|
30
33
|
newSummary: newParts.join('; '),
|
|
31
34
|
inserted,
|
|
32
35
|
};
|
package/src/types.ts
CHANGED
|
@@ -54,6 +54,7 @@ export interface StatsSnapshot {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
export interface GamePick {
|
|
57
|
+
locale?: import('zhin.js/i18n').Locale;
|
|
57
58
|
gameId: GameId;
|
|
58
59
|
label: string;
|
|
59
60
|
numbers: DrawNumbers;
|
|
@@ -81,6 +82,7 @@ export interface HitSummary {
|
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
export interface DailyReport {
|
|
85
|
+
locale?: import('zhin.js/i18n').Locale;
|
|
84
86
|
date: string;
|
|
85
87
|
picks: GamePick[];
|
|
86
88
|
disclaimer: string;
|