@rine-kit/pubg-plugin 0.1.2 โ 0.1.4
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/dist/index.d.ts +20 -0
- package/dist/index.js +21 -2
- package/package.json +5 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Plugin } from '@rine-kit/plugin-sdk';
|
|
2
2
|
import type { PubgDomainService } from '@rine-kit/pubg-domain';
|
|
3
|
+
import { type ReplyGuideProvider, type ShareAppender } from '@rine-kit/pubg-reply';
|
|
3
4
|
import { type PubgSubjectHost } from '@rine-kit/pubg-tools';
|
|
4
5
|
/** What the host decides for one request from its trusted context. */
|
|
5
6
|
export interface PubgAccess {
|
|
@@ -9,10 +10,29 @@ export interface PubgAccess {
|
|
|
9
10
|
host: PubgSubjectHost;
|
|
10
11
|
/** Names the conversation so result sets stay private to it. */
|
|
11
12
|
sessionId: string;
|
|
13
|
+
/** IANA zone the answers are written in ("today" and clock times). Default Asia/Shanghai, as in Lab. */
|
|
14
|
+
timezone?: string;
|
|
15
|
+
/** The share step for one tool's answer; absent, or returning undefined = no link (the answer then has no ๐ line). */
|
|
16
|
+
share?(toolName: string): ShareAppender | undefined;
|
|
17
|
+
/** Runs after a result was built, e.g. to store the share that was just issued before the link is shown. */
|
|
18
|
+
afterReply?(): Promise<void>;
|
|
12
19
|
}
|
|
13
20
|
export interface PubgPluginOptions<Ctx> {
|
|
14
21
|
/** May look the team up (a database read); the tools wait for it. */
|
|
15
22
|
access(ctx: Ctx): PubgAccess | Promise<PubgAccess>;
|
|
23
|
+
/**
|
|
24
|
+
* Deliver results the way Lab does: every tool result carries the validated `presentation`, the chat-layout
|
|
25
|
+
* `displayText` and the `replyGuide` (and `replyLink` when a share link was issued) instead of the bare Domain
|
|
26
|
+
* envelope. Without it the plugin returns the envelope as before.
|
|
27
|
+
*/
|
|
28
|
+
reply?: {
|
|
29
|
+
/** Worked examples / voice of the reply guide for this request; default is Lab's (Kurisu). */
|
|
30
|
+
guide?(ctx: Ctx): ReplyGuideProvider | undefined;
|
|
31
|
+
/** What the member asked in this turn, so a bare record request ("ไปๆฅๆ็ปฉ") is forced to the whole team. */
|
|
32
|
+
request?(ctx: Ctx): string | undefined;
|
|
33
|
+
};
|
|
34
|
+
/** 'chat' puts Lab's full PUBG skill rules into the instructions (instead of the four-sentence summary). */
|
|
35
|
+
rules?: 'chat' | 'summary';
|
|
16
36
|
}
|
|
17
37
|
/**
|
|
18
38
|
* The PUBG tool catalogue (shared with every other host) as a plugin. The tools take whatever the model
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { definePlugin } from '@rine-kit/plugin-sdk';
|
|
2
|
+
import { forceTeamScope, isBareRecordRequest, jsonToolResult, pubgChatRules, } from '@rine-kit/pubg-reply';
|
|
2
3
|
import { PUBG_TOOLS, runPubgTool } from '@rine-kit/pubg-tools';
|
|
3
4
|
const INSTRUCTIONS = [
|
|
4
5
|
"You can look up PUBG statistics and match reviews with the pubg_* tools. Every number, match, player, time range and coverage statement in your answer must come from this turn's tool results; never answer PUBG facts from memory or from the chat. Keep the tool's coverage, data time and partial/unknown states in your answer, and say plainly when data is missing. Name players only by the in-game names or aliases in tool results. Never pass tenant, team or user identifiers: who is asking is decided by the system.",
|
|
@@ -17,13 +18,31 @@ export function createPubgPlugin(options) {
|
|
|
17
18
|
input: spec.input,
|
|
18
19
|
run: async (input, ctx, { signal }) => {
|
|
19
20
|
const access = await options.access(ctx);
|
|
20
|
-
|
|
21
|
+
let arguments_ = input;
|
|
22
|
+
if (options.reply?.request && spec.name === 'pubg_query_stats') {
|
|
23
|
+
// A bare record request names no one, so it is the whole team: drop any person the model carried over.
|
|
24
|
+
const scoped = isBareRecordRequest(options.reply.request(ctx))
|
|
25
|
+
? forceTeamScope((input ?? {}))
|
|
26
|
+
: undefined;
|
|
27
|
+
if (scoped)
|
|
28
|
+
arguments_ = scoped;
|
|
29
|
+
}
|
|
30
|
+
const envelope = await runPubgTool(spec, arguments_, {
|
|
21
31
|
service: access.service,
|
|
22
32
|
host: access.host,
|
|
23
33
|
sessionId: access.sessionId,
|
|
24
34
|
...(signal ? { signal } : {}),
|
|
25
35
|
});
|
|
36
|
+
if (!options.reply)
|
|
37
|
+
return envelope;
|
|
38
|
+
const reply = jsonToolResult(spec.name, envelope, access.timezone ?? 'Asia/Shanghai', access.share?.(spec.name), options.reply.guide?.(ctx));
|
|
39
|
+
await access.afterReply?.();
|
|
40
|
+
return reply;
|
|
26
41
|
},
|
|
27
42
|
}));
|
|
28
|
-
return definePlugin({
|
|
43
|
+
return definePlugin({
|
|
44
|
+
id: 'rine.pubg',
|
|
45
|
+
instructions: options.rules === 'chat' ? pubgChatRules() : INSTRUCTIONS,
|
|
46
|
+
tools,
|
|
47
|
+
});
|
|
29
48
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rine-kit/pubg-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The PUBG tools as an @rine-kit/plugin-sdk plugin (Vercel AI SDK hosts such as RINE). The OpenClaw host keeps its own thin adapter over the same @rine-kit/pubg-tools catalogue.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,9 +12,10 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@rine-kit/plugin-sdk": "0.1.
|
|
16
|
-
"@rine-kit/pubg-domain": "0.1.
|
|
17
|
-
"@rine-kit/pubg-
|
|
15
|
+
"@rine-kit/plugin-sdk": "0.1.4",
|
|
16
|
+
"@rine-kit/pubg-domain": "0.1.4",
|
|
17
|
+
"@rine-kit/pubg-reply": "0.1.4",
|
|
18
|
+
"@rine-kit/pubg-tools": "0.1.4"
|
|
18
19
|
},
|
|
19
20
|
"devDependencies": {
|
|
20
21
|
"@types/node": "^26.6.5",
|