@zhin.js/plugin-rps 1.0.10 → 1.0.13
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/commands/rps/[[action]].js +1 -1
- package/commands/rps/[[action]].ts +1 -1
- package/lib/runtime-store.d.ts +3 -2
- package/lib/runtime-store.js.map +1 -1
- package/lib/view.d.ts +1 -1
- package/package.json +6 -6
- package/src/runtime-store.ts +3 -3
- package/src/view.ts +1 -1
|
@@ -10,7 +10,7 @@ export default defineCommand({
|
|
|
10
10
|
const action = normalizeRpsAction(String(params.action ?? ''));
|
|
11
11
|
if (!action || action === 'help')
|
|
12
12
|
return RPS_HELP;
|
|
13
|
-
const services = resolveGameServices({ use
|
|
13
|
+
const services = resolveGameServices({ use });
|
|
14
14
|
const message = messageFromCommandInput(input);
|
|
15
15
|
return runRpsCommand(services, message, action);
|
|
16
16
|
},
|
|
@@ -9,7 +9,7 @@ export default defineCommand({
|
|
|
9
9
|
async execute({ params, input, use, owner }) {
|
|
10
10
|
const action = normalizeRpsAction(String(params.action ?? ''));
|
|
11
11
|
if (!action || action === 'help') return RPS_HELP;
|
|
12
|
-
const services = resolveGameServices({ use
|
|
12
|
+
const services = resolveGameServices({ use });
|
|
13
13
|
const message = messageFromCommandInput(input);
|
|
14
14
|
return runRpsCommand(services, message, action);
|
|
15
15
|
},
|
package/lib/runtime-store.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { type Token } from '@zhin.js/plugin-runtime';
|
|
1
2
|
import type { SessionService } from './session-service.js';
|
|
2
3
|
/** Owner-scoped service consumed by discovered commands and middleware. */
|
|
3
|
-
export declare const gameServicesToken:
|
|
4
|
+
export declare const gameServicesToken: Token<SessionService>;
|
|
4
5
|
export declare function resolveGameServices(context: {
|
|
5
|
-
use<T>(token:
|
|
6
|
+
use<T>(token: Token<T>): T;
|
|
6
7
|
}): SessionService;
|
package/lib/runtime-store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-store.js","sourceRoot":"","sources":["../src/runtime-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"runtime-store.js","sourceRoot":"","sources":["../src/runtime-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAc,MAAM,yBAAyB,CAAC;AAGlE,2EAA2E;AAC3E,MAAM,CAAC,MAAM,iBAAiB,GAAG,WAAW,CAAiB,wBAAwB,CAAC,CAAC;AAEvF,MAAM,UAAU,mBAAmB,CAAC,OAAuC;IACzE,OAAO,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;AACxC,CAAC"}
|
package/lib/view.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SendContent } from '@zhin.js/core';
|
|
1
|
+
import type { SendContent } from '@zhin.js/core/runtime';
|
|
2
2
|
import type { RpsSessionRow } from './models.js';
|
|
3
3
|
import { type RpsMove } from './engine.js';
|
|
4
4
|
export declare function buildRpsView(session: RpsSessionRow, lastRound?: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/plugin-rps",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "Zhin.js 猜拳游戏 — 石头剪刀布三局两胜 (Plugin Runtime)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
],
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@zhin.js/command": "1.0.
|
|
28
|
-
"@zhin.js/core": "1.5.
|
|
29
|
-
"@zhin.js/game-kit": "3.0.
|
|
30
|
-
"@zhin.js/middleware": "1.0.
|
|
31
|
-
"@zhin.js/plugin-runtime": "1.1.
|
|
27
|
+
"@zhin.js/command": "1.0.10",
|
|
28
|
+
"@zhin.js/core": "1.5.5",
|
|
29
|
+
"@zhin.js/game-kit": "3.0.5",
|
|
30
|
+
"@zhin.js/middleware": "1.0.8",
|
|
31
|
+
"@zhin.js/plugin-runtime": "1.1.5"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"typescript": "^6.0.3",
|
package/src/runtime-store.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { createToken } from '@zhin.js/plugin-runtime';
|
|
1
|
+
import { createToken, type Token } from '@zhin.js/plugin-runtime';
|
|
2
2
|
import type { SessionService } from './session-service.js';
|
|
3
3
|
|
|
4
4
|
/** Owner-scoped service consumed by discovered commands and middleware. */
|
|
5
5
|
export const gameServicesToken = createToken<SessionService>('zhin.game.rps.services');
|
|
6
6
|
|
|
7
|
-
export function resolveGameServices(context: { use<T>(token:
|
|
8
|
-
return context.use(gameServicesToken)
|
|
7
|
+
export function resolveGameServices(context: { use<T>(token: Token<T>): T }): SessionService {
|
|
8
|
+
return context.use(gameServicesToken);
|
|
9
9
|
}
|
package/src/view.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { buildChoiceKeyboard } from '@zhin.js/game-kit';
|
|
2
|
-
import type { SendContent } from '@zhin.js/core';
|
|
2
|
+
import type { SendContent } from '@zhin.js/core/runtime';
|
|
3
3
|
import type { RpsSessionRow } from './models.js';
|
|
4
4
|
import { MOVE_LABELS, RPS_PREFIX, WIN_TARGET, type RpsMove } from './engine.js';
|
|
5
5
|
|