@rine-kit/pubg-reply 0.1.9 → 0.2.0

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.
@@ -15,9 +15,14 @@ export declare const BARE_RECORD_TTL_MS = 120000;
15
15
  export declare const SAFE_REPLY = "\u8FD9\u6B21 PUBG \u6218\u7EE9\u6CA1\u6709\u5B8C\u6210\u672C\u8F6E\u6570\u636E\u6838\u9A8C\uFF0C\u6211\u4E0D\u80FD\u786E\u8BA4\u7ED3\u679C\u3002\u8BF7\u518D\u8BD5\u4E00\u6B21\u3002";
16
16
  export declare function isBareRecordRequest(request: unknown): boolean;
17
17
  /**
18
- * A bare record request ("今日战绩") names no one, so it is a whole-team request. The model sometimes carries a
19
- * player from earlier chat into the call instead (10-21 00:08: only SG_LabmemNo008 came back), so for such a turn
20
- * the subject is forced to the team and any person/player the model added is dropped.
18
+ * A bare record request ("今日战绩", "昨日战报") names no one, so it is a whole-team request. The model sometimes carries
19
+ * a player from earlier chat into the call instead (10-21 00:08: only SG_LabmemNo008 came back), so for such a turn the
20
+ * subject is forced to the team and any person/player the model added is cleared.
21
+ *
22
+ * The person fields are set to empty arrays rather than deleted: a host applies a hook's returned params on top of the
23
+ * model's original params (a shallow merge), so a deleted key would survive and meet `team: true` as an
24
+ * identity_subject_conflict (observed in the squad group on 11-09: "昨天战绩" came back as that error twice). An empty
25
+ * array overrides the original value in that merge and counts as "no subject" for a host that replaces the params.
21
26
  */
22
27
  export declare function forceTeamScope(params: Record<string, unknown>): Record<string, unknown> | undefined;
23
28
  export type EvidenceVerdict = 'not_applicable' | 'verified' | 'missing_data' | 'wrong_scope';
package/dist/evidence.js CHANGED
@@ -6,8 +6,8 @@ export const FACT_TOOLS = new Set([
6
6
  const REQUEST = /PUBG|绝地求生|吃鸡|战绩|对局|几局|击杀|KD|K\/D/u;
7
7
  export const FACT = /PUBG|绝地求生|吃鸡|战绩|对局|击杀|伤害|KD|K\/D|no_matches|\d+\s*(?:局|杀|场|次)|一局都没有|没有.{0,8}战绩/u;
8
8
  const TEAM = /全队|整队|队伍|小队|我们|咱们|大家|所有人|全员|team|squad/iu;
9
- // A bare record request names no one ("昨日战绩", "@Kurisu 今天战绩"); in the squad it means the whole team.
10
- const BARE_RECORD = /^(?:\s|@\S+\s*)*(?:今天|今日|昨天|昨日|前天|本周|这周|上周|最近)?\s*(?:的)?\s*(?:PUBG|吃鸡)?\s*(?:战绩|战况)\s*[??!!。.~]*\s*$/iu;
9
+ // A bare record request names no one ("昨日战绩", "昨日战报", "@Kurisu 今天战绩"); in the squad it means the whole team.
10
+ const BARE_RECORD = /^(?:\s|@\S+\s*)*(?:今天|今日|昨天|昨日|前天|本周|这周|上周|最近)?\s*(?:的)?\s*(?:PUBG|吃鸡)?\s*(?:战绩|战况|战报|日报)\s*[??!!。.~]*\s*$/iu;
11
11
  export const BARE_RECORD_TTL_MS = 120_000;
12
12
  // Session key -> when the latest inbound message was a bare record request. Module-level on purpose: the plugin is
13
13
  // registered several times per process and the dispatch and tool-call hooks may run in different registrations.
@@ -37,16 +37,21 @@ export function isBareRecordRequest(request) {
37
37
  return typeof request === 'string' && BARE_RECORD.test(request.trim());
38
38
  }
39
39
  /**
40
- * A bare record request ("今日战绩") names no one, so it is a whole-team request. The model sometimes carries a
41
- * player from earlier chat into the call instead (10-21 00:08: only SG_LabmemNo008 came back), so for such a turn
42
- * the subject is forced to the team and any person/player the model added is dropped.
40
+ * A bare record request ("今日战绩", "昨日战报") names no one, so it is a whole-team request. The model sometimes carries
41
+ * a player from earlier chat into the call instead (10-21 00:08: only SG_LabmemNo008 came back), so for such a turn the
42
+ * subject is forced to the team and any person/player the model added is cleared.
43
+ *
44
+ * The person fields are set to empty arrays rather than deleted: a host applies a hook's returned params on top of the
45
+ * model's original params (a shallow merge), so a deleted key would survive and meet `team: true` as an
46
+ * identity_subject_conflict (observed in the squad group on 11-09: "昨天战绩" came back as that error twice). An empty
47
+ * array overrides the original value in that merge and counts as "no subject" for a host that replaces the params.
43
48
  */
44
49
  export function forceTeamScope(params) {
45
- const named = ['playerIds', 'playerNames', 'personIds'].some((key) => params[key] !== undefined);
50
+ const present = (value) => value !== undefined && !(Array.isArray(value) && value.length === 0);
51
+ const named = ['playerIds', 'playerNames', 'personIds'].some((key) => present(params[key]));
46
52
  if (params.team === true && !named)
47
53
  return undefined;
48
- const { playerIds: _playerIds, playerNames: _playerNames, personIds: _personIds, ...rest } = params;
49
- return { ...rest, team: true };
54
+ return { ...params, playerIds: [], playerNames: [], personIds: [], team: true };
50
55
  }
51
56
  export function assessPubgEvidence(messages, finalText) {
52
57
  if (!Array.isArray(messages) || !finalText || !FACT.test(finalText))
package/dist/rules.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export declare const PUBG_SKILL_RULES = "# PUBG\n\nUse the PUBG tools for match statistics and review. OpenClaw resolves the\nuser's natural-language request, but the identity-first dispatch contract below\nis mandatory. Do not answer a person-specific PUBG request before completing\nthat tool sequence. These rules are scoped to PUBG requests and must not limit\nKurisu's other native capabilities.\n\n## Mandatory identity-first dispatch\n\nAny PUBG request that names a person by a human nickname, alias, or mention is\nperson-specific, including short messages such as \u201C\u80F6\u6628\u5929\u6218\u7EE9\u201D, \u201C\u7334\u6628\u5929\u6218\u7EE9\u201D,\n\u201C\u5E2E\u6211\u770B\u516B\u6212\u6700\u540E\u4E00\u628A\u201D, or \u201C\u80F6\u5462\u201D when the surrounding context makes PUBG the\nsubject. For each such request:\n\n1. Call `identity_resolve` with `reference=alias` and the exact nickname text\n (or use `reference=mention` / `reference=reply_sender` for a trusted native\n mention or reply).\n2. If the result is `status=resolved`, immediately call the relevant PUBG tool\n with `personIds=[result.person.personId]`.\n3. Only report an identity/account problem when the tools return\n `unbound`, `ambiguous`, `candidate`, `not_found`, or\n `identity_pubg_account_unbound`. A previous assistant reply claiming that a\n nickname is unconfirmed is not evidence; resolve it again with the current\n tools.\n\nFirst-person PUBG requests such as \u201C\u6211\u6628\u5929\u6218\u7EE9\u201D\u201C\u6211\u7684\u6218\u7EE9\u201D or \u201C\u672C\u4EBA\u6700\u540E\u4E00\u628A\u201D\nmust call `identity_resolve` with `reference=self` first and then pass the\nreturned canonical `personId` as `personIds`. They must never be converted to\n`team=true`; `team=true` is reserved for an explicit whole-team/squad request.\n\nA bare record request that names no one and has no \u201C\u6211\u201D, such as \u201C\u4ECA\u65E5\u6218\u7EE9\u201D\n\u201C\u6628\u65E5\u6218\u7EE9\u201D\u201C\u4ECA\u5929\u6218\u7EE9\u201D or \u201C@Kurisu \u6628\u5929\u6218\u7EE9\u201D, is a whole-team request: call the\nPUBG tool directly with `team=true` and the period selector. Do not call\n`identity_resolve` first for it. Never carry a player from earlier chat into\nsuch a request; the plugin also forces `team=true` on a bare record turn.\n\nRecord requests (\u201C\u4ECA\u65E5\u6218\u7EE9\u201D\u201C\u4ECA\u5929\u6218\u7EE9\u201D\u201C\u6628\u65E5\u6218\u7EE9\u201D\u201C\u6628\u5929\u6218\u7EE9\u201D\u201C\u672C\u5468\u6218\u7EE9\u201D\u201C\u67E5\u8BE2\u4ECA\u65E5\u6218\u7EE9\u201D\nand person-specific variants) always use `pubg_query_stats` (operation\n`report`, `groupBy: \"player\"`) \u2014 that result carries the full card\n`displayText` with per-member stats, titles and team totals. Never answer a\nrecord request with `pubg_search_matches`: a per-match list\n(\u201C\u5BF9\u5C40\u5217\u8868 \u5171 N \u573A\u201D) is only for explicit list asks such as \u201C\u4ECA\u5929\u6253\u4E86\u54EA\u51E0\u628A\u201D\n\u201C\u5BF9\u5C40\u5217\u8868\u201D, or as the first step of a review.\n\nNever ask the user for a PUBG ID or say that the account is unconfirmed before\nthe identity lookup. Preloaded nickname/account mappings are already confirmed\nfor this deployment; use the resolved `personId` directly. `pubg_resolve_players` is not a substitute for\n`identity_resolve`: `playerNames` is for an explicit PUBG in-game name, while a\nchat nickname must first become a canonical `personId`.\n\nTool rules:\n\n- Never invent match IDs, players, metrics, telemetry facts, coverage, or\n timestamps. Use the native tools as the only source of PUBG facts.\n- Every new PUBG factual request must call the relevant native tool, even when\n the current OpenClaw session already contains a previous answer or tool\n result. This includes short requests such as \u201C\u6628\u5929 SG007 \u8E22 kim_kkl \u591A\u5C11\u811A\u201D,\n \u201C\u6628\u5929\u6218\u7EE9\u201D, \u201C\u603B\u4F24\u5BB3\u201D, \u201C\u4ECA\u5929\u51E0\u5C40\u201D, or a follow-up that asks for a number.\n Context may resolve identity, period, and scope only; it must never supply\n the numeric/event facts. The native tool reads the persistent SQLite cache\n and applies its default refresh policy, so do not answer directly from\n conversation context.\n A repeated or teasing re-ask (\u201C\u7B2C\u56DB\u904D\u4E86\u201D) still calls the tool and still gets the full\n card block; earlier shorter replies in this session are not a format to copy.\n- Resolve a person before a person-specific PUBG query. For \u201C\u6211\u201D, call\n `identity_resolve` with `reference=self`; for a nickname or mention, resolve\n the group-scoped/global alias or trusted mention first. Pass the returned\n canonical `personId` as `personIds` to the PUBG tool, or pass an explicit\n PUBG account returned by the identity/PUBG tools.\n- Never treat the configured team as an implicit subject for a sender. If\n `identity_resolve` returns `unbound`, `ambiguous`, or `candidate`, stop and\n explain that identity must be bound or confirmed. `team=true` is the only\n explicit request for the configured team (an explicit whole-team request, or\n a bare record request that names no one).\n- A transport sender name is never a PUBG name. Never use WhatsApp/Telegram\n display names, profile names, push names, phone numbers, JIDs, or quoted\n sender labels as `playerNames`. If the user explicitly gives an in-game name\n or alias, use `pubg_resolve_players` before the player-specific query.\n- In a group or DM, \u201C\u6211\u201D always means the current trusted channel sender. Do\n not derive a Person or PUBG account from a display name, phone number, JID,\n quoted label, or nickname alone.\n- Use `pubg_search_matches` to find a concrete match before requesting a\n Telemetry review. Pass the returned `matchId` to `pubg_get_review_facts`.\n- \u201C\u6700\u8FD1\u4E00\u5C40\u201D\u201C\u6700\u540E\u4E00\u5C40\u201D\u201C\u6700\u65B0\u6BD4\u8D5B\u201D\u4EE5\u53CA\u201C\u590D\u76D8\u6700\u8FD1\u4E00\u5C40\u201D\u6BCF\u6B21\u90FD\u5FC5\u987B\u91CD\u65B0\u8C03\u7528\n `pubg_search_matches`\uFF0C\u56FA\u5B9A\u4F7F\u7528 `sort: \"desc\"`\u3001`recentN: 1`\u3001`refresh: true`\u3002\n \u5373\u4F7F\u5F53\u524D\u4F1A\u8BDD\u91CC\u5DF2\u7ECF\u6709\u65E7\u7684 `matchId` \u6216\u65E7\u7ED3\u679C\uFF0C\u4E5F\u4E0D\u80FD\u8DF3\u8FC7\u8FD9\u6B21\u641C\u7D22\uFF1B\u5148\u7528\u641C\u7D22\u8FD4\u56DE\u7684\n \u6700\u65B0 `matchId`\uFF0C\u518D\u8C03\u7528 `pubg_get_review_facts`\u3002\u5E95\u5C42\u4F1A\u5237\u65B0\u6BD4\u8D5B\u5217\u8868\uFF0C\u53EA\u8BF7\u6C42\u65B0\u6BD4\u8D5B\u7684\n \u8BE6\u60C5\uFF0C\u5E76\u5728\u6CA1\u6709\u65B0\u589E\u6BD4\u8D5B\u65F6\u590D\u7528\u7F13\u5B58\u3002\u53EA\u6709\u7528\u6237\u660E\u786E\u8BF4\u201C\u8FD9\u628A/\u521A\u624D\u67E5\u5230\u7684\u90A3\u4E00\u628A\u201D\u65F6\uFF0C\u624D\u53EF\n \u6CBF\u7528\u5F53\u524D\u4F1A\u8BDD\u7684\u5177\u4F53 `matchId`\u3002\n- Any period review request such as \u201C\u590D\u76D8\u4ECA\u5929/\u6628\u5929\u201D\u201C\u56DE\u987E\u8FD9\u6BB5\u65F6\u95F4\u201D or \u201C\u603B\u7ED3\u4ECA\u5929\u5BF9\u5C40\u201D\n is also a fresh-data intent. Let the LLM emit a structured semantic selector rather than\n calculating timestamps: use `pubg_search_matches` with\n `selector: { type: \"relative_period\", value: \"today\" | \"yesterday\" }`, `refresh: true`,\n `sort: \"asc\"`, and `pageSize: 50`; omit `recentN` for the full period so the returned\n matches follow chronological play order. The Domain resolves this selector with the configured\n `Asia/Shanghai` `06:00` business-day boundary. Pass the returned `resultSetId` to\n `pubg_get_period_review`; Domain order and partial coverage are authoritative. Do not\n manually loop over stale facts or a result set from an earlier turn.\n- Any period teammate-action or friendly-fire request must use\n `pubg_query_team_damage` directly; this is the batch Telemetry owner and it refreshes\n Match discovery and ensures Telemetry for every selected match itself. For all-team\n requests such as \u201C\u6628\u5929\u961F\u5185\u8BEF\u4F24\u8BE6\u60C5\u201D, omit `actorPlayer` and `victimPlayer` so every\n `actor \u2192 victim` direction is returned. For a directional request, pass both configured\n PUBG names/aliases, such as `actorPlayer: \"007\"` and `victimPlayer: \"004\"`. For \u201C\u8E22/\u811A\u201D\n pass `source: \"MELEE\", meleeKind: \"KICK\"`; for \u201C\u62F3\u201D use `meleeKind: \"PUNCH\"`.\n Use a semantic `relative_period` or explicit `time_range` selector and omit `recentN`\n and `resultSetId`; do not call `pubg_search_matches` and then stop, and never infer\n zero from a `partial` Telemetry result. `pubg_get_review_facts` remains the tool for\n a selected single-match deep review, not the period batch aggregation.\n- Use `pubg_query_stats` for bounded aggregates. Prefer an explicit selector:\n `time_range` uses the half-open interval `[from,to)` and IANA timezone\n `Asia/Shanghai` unless the user specifies another timezone. PUBG's canonical\n business day runs from `06:00` through the next `06:00`; preserve that\n boundary when resolving date-based selectors. `last_n_matches` is bounded to\n at most 100 matches per call. Omit `refresh` or set `refresh: true` for a\n new query; the default refreshes the upstream match list before reading the\n persistent cache. Use `refresh: false` only when the user explicitly asks\n for cache-only data.\n- For a clock split repeated across multiple calendar days, make each day's\n before/after windows explicit half-open intervals and keep them separate;\n never use `groupBy: day` over a widened range that contains both sides of the\n clock boundary, because that double-counts full days and cannot prove a\n before/after comparison.\n- Use `pubg_compare_stats` only with two explicit segments. A comparison ratio\n is `null` when its denominator is zero or unknown; never turn it into zero or\n infinity.\n- Treat `null` as unknown. Never convert unknown deaths, assists, ratios, or\n coverage gaps into zero or a confident conclusion. Preserve the requested\n business-day boundary when resolving a date or clock-based selector.\n- Use `pubg_get_match` for the selected match's Match API facts, then\n `pubg_get_review_facts` for Telemetry-derived facts. Never present a missing\n Telemetry fact as zero.\n- Friendly-fire and teammate-action questions are directional facts. Always\n normalize and state the direction as `actor \u2192 victim` (for example,\n `kim_kkl \u2192 SG007`). \u201C\u53CD\u8FC7\u6765\u5462\u201D swaps the actor and victim and starts a new\n independent query; it does not invalidate or correct the previous direction.\n Never append a sentence saying that the previous number was wrong unless the\n current native-tool result covers the exact same actor, victim, period, and\n calculation and directly contradicts it. Do not mix the two directions into\n one total.\n- Pass `categories` only when a bounded review is requested. The match and\n player summary remains available; detail groups such as `combat`, `fights`,\n `weapons`, `vehicles`, `heavy_weapons`, `special_events`, `team_damage`,\n `recovery`, `loot`, `environment`, and `evidence` are returned when their\n category is requested (or when `categories` is omitted). An empty group is\n not proof that the event did not happen.\n- Preserve the returned `status`, `coverage`, `asOf`, `metricVersion`,\n `queryResolved`, and `evidenceRefs` while explaining results. `partial`,\n `no_matches`, and `error` are meaningful outcomes, not successful data.\n- Every native PUBG result also contains a validated `presentation` contract\n and canonical `displayText`. Use `displayText` as the factual response block\n and preserve the raw envelope/evidence alongside it; do not reconstruct a\n second user-facing summary from raw JSON.\n- Every PUBG result for a user-facing answer carries `replyGuide`: the reply shape\n for that kind of answer (\u6218\u7EE9 cards, \u961F\u5185\u8BEF\u4F24\u8D26\u672C, match lists, comparisons,\n reviews) and how to report no_matches, partial or failed results. Follow it:\n keep the whole `displayText` block with its numbers, titles and bold markers,\n swap account names for the roster's \u79F0\u547C, and add Kurisu's voice around it.\n Collapsing the block into short bullets is a wrong answer even when every\n remaining number is correct; a repeated question still gets the full block.\n- When `displayText` ends with a `\uD83D\uDD17 https://\u2026/s/\u2026` line, that is the no-login\n share page for exactly the matches in this answer. Keep that line verbatim as\n the last line of the reply; never edit, shorten, re-host or invent such a link,\n and never add one when the tool result has none. The result's `replyLink`\n carries the same link: the delivery runtime appends it if the reply lacks it\n and drops any other share link, so a retold answer still ends with it.\n- For a review, use the tool's validated `presentation` contract as the factual\n response boundary. Render its `dataUpdatedAt`/`dataUpdatedAtLocal` and\n `dataSourceRange`/`fromLocal` with the presentation formatter: same-local-day\n times use `HH:mm`, cross-day values use `YYYY-MM-DD HH:mm`, and unknown values\n stay unknown. Never print raw UTC clock components as if they were local time.\n- Every native PUBG result carries a validated presentation and canonical\n `displayText`. For final factual replies, use `displayText` instead of\n reconstructing facts from raw fields; preserve evidence and any returned\n local source range as \u6570\u636E\u6765\u6E90\u65F6\u95F4\u8303\u56F4, and render `dataUpdatedAt` as \u6570\u636E\u66F4\u65B0\u65F6\u95F4\n through the presentation formatter.\n- For a comparison, render each returned segment's local range separately. Use\n `*Local` fields such as `startedAtLocal` for every other user-visible time. Do\n not substitute the current reply time for the source range; if the tool\n returns null, say that the source range is unknown.\n- Telemetry status is explicit: `HIT` means the feature cache was read,\n `FETCHED` + `cacheStatus=FETCHED` + `cacheLookup=MISS` + `availability=AVAILABLE`\n means the cache was empty but the official Telemetry was fetched successfully and\n written to cache, and `UNAVAILABLE` means the data could not be obtained. Never\n describe a successful `FETCHED` result or `cacheLookup=MISS` as missing Telemetry.\n- `pubg_prefetch_telemetry` is a bounded team-wide scheduled operation. It refreshes\n player match lists hourly, fetches only new Match API records, and prefetches only\n missing Telemetry; its retry state is persistent. `pubg_telemetry_sync_report`\n summarizes the previous natural calendar day and returns the exact notification\n payload for `amadeus_notify_owner`; preserve its counts and timestamp.\n- Keep the same OpenClaw session for identity and query continuity, but do not\n reuse prior PUBG facts or prose. Tool results are session-scoped; do not reuse\n a `resultSetId` from another conversation, and use a new native tool result\n for every new factual answer.\n\nThe plugin returns structured JSON. OpenClaw owns interpretation, clarification,\nand the final natural-language response; the plugin does not contain an LLM,\nkeyword router, fixed prose workflow, or platform adapter.\n";
1
+ export declare const PUBG_SKILL_RULES = "# PUBG\n\nUse the PUBG tools for match statistics and review. OpenClaw resolves the\nuser's natural-language request, but the identity-first dispatch contract below\nis mandatory. Do not answer a person-specific PUBG request before completing\nthat tool sequence. These rules are scoped to PUBG requests and must not limit\nKurisu's other native capabilities.\n\n## Mandatory identity-first dispatch\n\nAny PUBG request that names a person by a human nickname, alias, or mention is\nperson-specific, including short messages such as \u201C\u80F6\u6628\u5929\u6218\u7EE9\u201D, \u201C\u7334\u6628\u5929\u6218\u7EE9\u201D,\n\u201C\u5E2E\u6211\u770B\u516B\u6212\u6700\u540E\u4E00\u628A\u201D, or \u201C\u80F6\u5462\u201D when the surrounding context makes PUBG the\nsubject. For each such request:\n\n1. Call `identity_resolve` with `reference=alias` and the exact nickname text\n (or use `reference=mention` / `reference=reply_sender` for a trusted native\n mention or reply).\n2. If the result is `status=resolved`, immediately call the relevant PUBG tool\n with `personIds=[result.person.personId]`.\n3. Only report an identity/account problem when the tools return\n `unbound`, `ambiguous`, `candidate`, `not_found`, or\n `identity_pubg_account_unbound`. A previous assistant reply claiming that a\n nickname is unconfirmed is not evidence; resolve it again with the current\n tools.\n\nFirst-person PUBG requests such as \u201C\u6211\u6628\u5929\u6218\u7EE9\u201D\u201C\u6211\u7684\u6218\u7EE9\u201D or \u201C\u672C\u4EBA\u6700\u540E\u4E00\u628A\u201D\nmust call `identity_resolve` with `reference=self` first and then pass the\nreturned canonical `personId` as `personIds`. They must never be converted to\n`team=true`; `team=true` is reserved for an explicit whole-team/squad request.\n\nA bare record request that names no one and has no \u201C\u6211\u201D, such as \u201C\u4ECA\u65E5\u6218\u7EE9\u201D\n\u201C\u6628\u65E5\u6218\u7EE9\u201D\u201C\u4ECA\u5929\u6218\u7EE9\u201D or \u201C@Kurisu \u6628\u5929\u6218\u7EE9\u201D, is a whole-team request: call the\nPUBG tool directly with `team=true` and the period selector. Do not call\n`identity_resolve` first for it. Never carry a player from earlier chat into\nsuch a request; the plugin also forces `team=true` on a bare record turn.\n\nA bare **\u6218\u62A5** (\u201C\u6628\u65E5\u6218\u62A5\u201D\u201C\u6628\u5929\u6218\u62A5\u201D\u201C\u4ECA\u65E5\u6218\u62A5\u201D, also \u201C\u65E5\u62A5\u201D) is the same thing: the\nteam's record card, not one person's. It also uses `team=true` and only\n`team=true` \u2014 never `personIds`, `playerIds` or `playerNames` next to it (mixing them\nis an `identity_subject_conflict` error).\n\nRecord requests (\u201C\u4ECA\u65E5\u6218\u7EE9\u201D\u201C\u4ECA\u5929\u6218\u7EE9\u201D\u201C\u6628\u65E5\u6218\u7EE9\u201D\u201C\u6628\u5929\u6218\u7EE9\u201D\u201C\u672C\u5468\u6218\u7EE9\u201D\u201C\u67E5\u8BE2\u4ECA\u65E5\u6218\u7EE9\u201D\nand person-specific variants) always use `pubg_query_stats` (operation\n`report`, `groupBy: \"player\"`) \u2014 that result carries the full card\n`displayText` with per-member stats, titles and team totals. Never answer a\nrecord request with `pubg_search_matches`: a per-match list\n(\u201C\u5BF9\u5C40\u5217\u8868 \u5171 N \u573A\u201D) is only for explicit list asks such as \u201C\u4ECA\u5929\u6253\u4E86\u54EA\u51E0\u628A\u201D\n\u201C\u5BF9\u5C40\u5217\u8868\u201D, or as the first step of a review. This holds for \u6218\u62A5 as well, and also\nwhen the stats call failed: correct the call (`team=true` alone for a whole-team\nask) and call `pubg_query_stats` again instead of falling back to a per-match list.\n\nNever ask the user for a PUBG ID or say that the account is unconfirmed before\nthe identity lookup. Preloaded nickname/account mappings are already confirmed\nfor this deployment; use the resolved `personId` directly. `pubg_resolve_players` is not a substitute for\n`identity_resolve`: `playerNames` is for an explicit PUBG in-game name, while a\nchat nickname must first become a canonical `personId`.\n\nTool rules:\n\n- Never invent match IDs, players, metrics, telemetry facts, coverage, or\n timestamps. Use the native tools as the only source of PUBG facts.\n- Every new PUBG factual request must call the relevant native tool, even when\n the current OpenClaw session already contains a previous answer or tool\n result. This includes short requests such as \u201C\u6628\u5929 SG007 \u8E22 kim_kkl \u591A\u5C11\u811A\u201D,\n \u201C\u6628\u5929\u6218\u7EE9\u201D, \u201C\u603B\u4F24\u5BB3\u201D, \u201C\u4ECA\u5929\u51E0\u5C40\u201D, or a follow-up that asks for a number.\n Context may resolve identity, period, and scope only; it must never supply\n the numeric/event facts. The native tool reads the persistent SQLite cache\n and applies its default refresh policy, so do not answer directly from\n conversation context.\n A repeated or teasing re-ask (\u201C\u7B2C\u56DB\u904D\u4E86\u201D) still calls the tool and still gets the full\n card block; earlier shorter replies in this session are not a format to copy.\n- Resolve a person before a person-specific PUBG query. For \u201C\u6211\u201D, call\n `identity_resolve` with `reference=self`; for a nickname or mention, resolve\n the group-scoped/global alias or trusted mention first. Pass the returned\n canonical `personId` as `personIds` to the PUBG tool, or pass an explicit\n PUBG account returned by the identity/PUBG tools.\n- Never treat the configured team as an implicit subject for a sender. If\n `identity_resolve` returns `unbound`, `ambiguous`, or `candidate`, stop and\n explain that identity must be bound or confirmed. `team=true` is the only\n explicit request for the configured team (an explicit whole-team request, or\n a bare record request that names no one).\n- A transport sender name is never a PUBG name. Never use WhatsApp/Telegram\n display names, profile names, push names, phone numbers, JIDs, or quoted\n sender labels as `playerNames`. If the user explicitly gives an in-game name\n or alias, use `pubg_resolve_players` before the player-specific query.\n- In a group or DM, \u201C\u6211\u201D always means the current trusted channel sender. Do\n not derive a Person or PUBG account from a display name, phone number, JID,\n quoted label, or nickname alone.\n- Use `pubg_search_matches` to find a concrete match before requesting a\n Telemetry review. Pass the returned `matchId` to `pubg_get_review_facts`.\n- \u201C\u6700\u8FD1\u4E00\u5C40\u201D\u201C\u6700\u540E\u4E00\u5C40\u201D\u201C\u6700\u65B0\u6BD4\u8D5B\u201D\u4EE5\u53CA\u201C\u590D\u76D8\u6700\u8FD1\u4E00\u5C40\u201D\u6BCF\u6B21\u90FD\u5FC5\u987B\u91CD\u65B0\u8C03\u7528\n `pubg_search_matches`\uFF0C\u56FA\u5B9A\u4F7F\u7528 `sort: \"desc\"`\u3001`recentN: 1`\u3001`refresh: true`\u3002\n \u5373\u4F7F\u5F53\u524D\u4F1A\u8BDD\u91CC\u5DF2\u7ECF\u6709\u65E7\u7684 `matchId` \u6216\u65E7\u7ED3\u679C\uFF0C\u4E5F\u4E0D\u80FD\u8DF3\u8FC7\u8FD9\u6B21\u641C\u7D22\uFF1B\u5148\u7528\u641C\u7D22\u8FD4\u56DE\u7684\n \u6700\u65B0 `matchId`\uFF0C\u518D\u8C03\u7528 `pubg_get_review_facts`\u3002\u5E95\u5C42\u4F1A\u5237\u65B0\u6BD4\u8D5B\u5217\u8868\uFF0C\u53EA\u8BF7\u6C42\u65B0\u6BD4\u8D5B\u7684\n \u8BE6\u60C5\uFF0C\u5E76\u5728\u6CA1\u6709\u65B0\u589E\u6BD4\u8D5B\u65F6\u590D\u7528\u7F13\u5B58\u3002\u53EA\u6709\u7528\u6237\u660E\u786E\u8BF4\u201C\u8FD9\u628A/\u521A\u624D\u67E5\u5230\u7684\u90A3\u4E00\u628A\u201D\u65F6\uFF0C\u624D\u53EF\n \u6CBF\u7528\u5F53\u524D\u4F1A\u8BDD\u7684\u5177\u4F53 `matchId`\u3002\n- Any period review request such as \u201C\u590D\u76D8\u4ECA\u5929/\u6628\u5929\u201D\u201C\u56DE\u987E\u8FD9\u6BB5\u65F6\u95F4\u201D or \u201C\u603B\u7ED3\u4ECA\u5929\u5BF9\u5C40\u201D\n is also a fresh-data intent. Let the LLM emit a structured semantic selector rather than\n calculating timestamps: use `pubg_search_matches` with\n `selector: { type: \"relative_period\", value: \"today\" | \"yesterday\" }`, `refresh: true`,\n `sort: \"asc\"`, and `pageSize: 50`; omit `recentN` for the full period so the returned\n matches follow chronological play order. The Domain resolves this selector with the configured\n `Asia/Shanghai` `06:00` business-day boundary. Pass the returned `resultSetId` to\n `pubg_get_period_review`; Domain order and partial coverage are authoritative. Do not\n manually loop over stale facts or a result set from an earlier turn.\n- Any period teammate-action or friendly-fire request must use\n `pubg_query_team_damage` directly; this is the batch Telemetry owner and it refreshes\n Match discovery and ensures Telemetry for every selected match itself. For all-team\n requests such as \u201C\u6628\u5929\u961F\u5185\u8BEF\u4F24\u8BE6\u60C5\u201D, omit `actorPlayer` and `victimPlayer` so every\n `actor \u2192 victim` direction is returned. For a directional request, pass both configured\n PUBG names/aliases, such as `actorPlayer: \"007\"` and `victimPlayer: \"004\"`. For \u201C\u8E22/\u811A\u201D\n pass `source: \"MELEE\", meleeKind: \"KICK\"`; for \u201C\u62F3\u201D use `meleeKind: \"PUNCH\"`.\n Use a semantic `relative_period` or explicit `time_range` selector and omit `recentN`\n and `resultSetId`; do not call `pubg_search_matches` and then stop, and never infer\n zero from a `partial` Telemetry result. `pubg_get_review_facts` remains the tool for\n a selected single-match deep review, not the period batch aggregation.\n- Use `pubg_query_stats` for bounded aggregates. Prefer an explicit selector:\n `time_range` uses the half-open interval `[from,to)` and IANA timezone\n `Asia/Shanghai` unless the user specifies another timezone. PUBG's canonical\n business day runs from `06:00` through the next `06:00`; preserve that\n boundary when resolving date-based selectors. `last_n_matches` is bounded to\n at most 100 matches per call. Omit `refresh` or set `refresh: true` for a\n new query; the default refreshes the upstream match list before reading the\n persistent cache. Use `refresh: false` only when the user explicitly asks\n for cache-only data.\n- For a clock split repeated across multiple calendar days, make each day's\n before/after windows explicit half-open intervals and keep them separate;\n never use `groupBy: day` over a widened range that contains both sides of the\n clock boundary, because that double-counts full days and cannot prove a\n before/after comparison.\n- Use `pubg_compare_stats` only with two explicit segments. A comparison ratio\n is `null` when its denominator is zero or unknown; never turn it into zero or\n infinity.\n- Treat `null` as unknown. Never convert unknown deaths, assists, ratios, or\n coverage gaps into zero or a confident conclusion. Preserve the requested\n business-day boundary when resolving a date or clock-based selector.\n- Use `pubg_get_match` for the selected match's Match API facts, then\n `pubg_get_review_facts` for Telemetry-derived facts. Never present a missing\n Telemetry fact as zero.\n- Friendly-fire and teammate-action questions are directional facts. Always\n normalize and state the direction as `actor \u2192 victim` (for example,\n `kim_kkl \u2192 SG007`). \u201C\u53CD\u8FC7\u6765\u5462\u201D swaps the actor and victim and starts a new\n independent query; it does not invalidate or correct the previous direction.\n Never append a sentence saying that the previous number was wrong unless the\n current native-tool result covers the exact same actor, victim, period, and\n calculation and directly contradicts it. Do not mix the two directions into\n one total.\n- Pass `categories` only when a bounded review is requested. The match and\n player summary remains available; detail groups such as `combat`, `fights`,\n `weapons`, `vehicles`, `heavy_weapons`, `special_events`, `team_damage`,\n `recovery`, `loot`, `environment`, and `evidence` are returned when their\n category is requested (or when `categories` is omitted). An empty group is\n not proof that the event did not happen.\n- Preserve the returned `status`, `coverage`, `asOf`, `metricVersion`,\n `queryResolved`, and `evidenceRefs` while explaining results. `partial`,\n `no_matches`, and `error` are meaningful outcomes, not successful data.\n- Every native PUBG result also contains a validated `presentation` contract\n and canonical `displayText`. Use `displayText` as the factual response block\n and preserve the raw envelope/evidence alongside it; do not reconstruct a\n second user-facing summary from raw JSON.\n- Every PUBG result for a user-facing answer carries `replyGuide`: the reply shape\n for that kind of answer (\u6218\u7EE9 cards, \u961F\u5185\u8BEF\u4F24\u8D26\u672C, match lists, comparisons,\n reviews) and how to report no_matches, partial or failed results. Follow it:\n keep the whole `displayText` block with its numbers, titles and bold markers,\n swap account names for the roster's \u79F0\u547C, and add Kurisu's voice around it.\n Collapsing the block into short bullets is a wrong answer even when every\n remaining number is correct; a repeated question still gets the full block.\n- When `displayText` ends with a `\uD83D\uDD17 https://\u2026/s/\u2026` line, that is the no-login\n share page for exactly the matches in this answer. Keep that line verbatim as\n the last line of the reply; never edit, shorten, re-host or invent such a link,\n and never add one when the tool result has none. The result's `replyLink`\n carries the same link: the delivery runtime appends it if the reply lacks it\n and drops any other share link, so a retold answer still ends with it.\n- For a review, use the tool's validated `presentation` contract as the factual\n response boundary. Render its `dataUpdatedAt`/`dataUpdatedAtLocal` and\n `dataSourceRange`/`fromLocal` with the presentation formatter: same-local-day\n times use `HH:mm`, cross-day values use `YYYY-MM-DD HH:mm`, and unknown values\n stay unknown. Never print raw UTC clock components as if they were local time.\n- Every native PUBG result carries a validated presentation and canonical\n `displayText`. For final factual replies, use `displayText` instead of\n reconstructing facts from raw fields; preserve evidence and any returned\n local source range as \u6570\u636E\u6765\u6E90\u65F6\u95F4\u8303\u56F4, and render `dataUpdatedAt` as \u6570\u636E\u66F4\u65B0\u65F6\u95F4\n through the presentation formatter.\n- For a comparison, render each returned segment's local range separately. Use\n `*Local` fields such as `startedAtLocal` for every other user-visible time. Do\n not substitute the current reply time for the source range; if the tool\n returns null, say that the source range is unknown.\n- Telemetry status is explicit: `HIT` means the feature cache was read,\n `FETCHED` + `cacheStatus=FETCHED` + `cacheLookup=MISS` + `availability=AVAILABLE`\n means the cache was empty but the official Telemetry was fetched successfully and\n written to cache, and `UNAVAILABLE` means the data could not be obtained. Never\n describe a successful `FETCHED` result or `cacheLookup=MISS` as missing Telemetry.\n- `pubg_prefetch_telemetry` is a bounded team-wide scheduled operation. It refreshes\n player match lists hourly, fetches only new Match API records, and prefetches only\n missing Telemetry; its retry state is persistent. `pubg_telemetry_sync_report`\n summarizes the previous natural calendar day and returns the exact notification\n payload for `amadeus_notify_owner`; preserve its counts and timestamp.\n- Keep the same OpenClaw session for identity and query continuity, but do not\n reuse prior PUBG facts or prose. Tool results are session-scoped; do not reuse\n a `resultSetId` from another conversation, and use a new native tool result\n for every new factual answer.\n\nThe plugin returns structured JSON. OpenClaw owns interpretation, clarification,\nand the final natural-language response; the plugin does not contain an LLM,\nkeyword router, fixed prose workflow, or platform adapter.\n";
2
2
  /** The rules without the bullet about the scheduled prefetch / sync-report tools, which a chat host does not expose. */
3
3
  export declare function pubgChatRules(): string;
package/dist/rules.js CHANGED
@@ -40,13 +40,20 @@ PUBG tool directly with \`team=true\` and the period selector. Do not call
40
40
  \`identity_resolve\` first for it. Never carry a player from earlier chat into
41
41
  such a request; the plugin also forces \`team=true\` on a bare record turn.
42
42
 
43
+ A bare **战报** (“昨日战报”“昨天战报”“今日战报”, also “日报”) is the same thing: the
44
+ team's record card, not one person's. It also uses \`team=true\` and only
45
+ \`team=true\` — never \`personIds\`, \`playerIds\` or \`playerNames\` next to it (mixing them
46
+ is an \`identity_subject_conflict\` error).
47
+
43
48
  Record requests (“今日战绩”“今天战绩”“昨日战绩”“昨天战绩”“本周战绩”“查询今日战绩”
44
49
  and person-specific variants) always use \`pubg_query_stats\` (operation
45
50
  \`report\`, \`groupBy: "player"\`) — that result carries the full card
46
51
  \`displayText\` with per-member stats, titles and team totals. Never answer a
47
52
  record request with \`pubg_search_matches\`: a per-match list
48
53
  (“对局列表 共 N 场”) is only for explicit list asks such as “今天打了哪几把”
49
- “对局列表”, or as the first step of a review.
54
+ “对局列表”, or as the first step of a review. This holds for 战报 as well, and also
55
+ when the stats call failed: correct the call (\`team=true\` alone for a whole-team
56
+ ask) and call \`pubg_query_stats\` again instead of falling back to a per-match list.
50
57
 
51
58
  Never ask the user for a PUBG ID or say that the account is unconfirmed before
52
59
  the identity lookup. Preloaded nickname/account mappings are already confirmed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rine-kit/pubg-reply",
3
- "version": "0.1.9",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "description": "How a PUBG tool result reaches the model and the chat: the presentation glue (displayText in the chat layout, replyGuide, share link), the squad voice and roster, the PUBG rules text, the bare-record scope guard and the outbound evidence check. Moved unchanged from Lab's plugins/pubg and plugins/amadeus; hosts add only delivery.",
6
6
  "license": "MIT",
@@ -18,8 +18,8 @@
18
18
  "dist"
19
19
  ],
20
20
  "dependencies": {
21
- "@rine-kit/presentation": "0.1.9",
22
- "@rine-kit/pubg-domain": "0.1.9"
21
+ "@rine-kit/presentation": "0.2.0",
22
+ "@rine-kit/pubg-domain": "0.2.0"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/node": "^26.6.5",