@wowok/skills 2.0.1 → 2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wowok/skills",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "WoWok AI Skills for Claude and other AI assistants - Dialogue orchestration layer on top of the WoWok MCP server (rules/reference knowledge is served by MCP directly since v2.0.0)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -313,7 +313,7 @@ Before calling `order.receive`, query what the Order has received to verify ther
313
313
  }
314
314
  ```
315
315
 
316
- **Expected response**: A `ReceivedBalance` object with `token_type`, `balance`, and `received[]` array of `CoinWrapper` objects. If empty, there is nothing to withdraw yet.
316
+ **Expected response**: A `ReceivedBalance` object with `token_type`, `balance`, `received[]` array of `CoinWrapper` objects, and `_money_display` annotation (unit-converted values with decimals reminder). If empty, there is nothing to withdraw yet.
317
317
 
318
318
  #### Step 2: Call `order.receive` with `"recently"` (simplest form)
319
319
 
@@ -21,13 +21,23 @@ this skill's shortening rules are DISABLED — display complete 66-character add
21
21
 
22
22
  ## Short Address Format
23
23
 
24
- **MUST APPLY TO ALL ADDRESSES** (0x prefix + 64 hex chars = 66 chars total):
25
- 1. Remove `0x` prefix
26
- 2. Take first 5 characters
27
- 3. Convert to UPPERCASE
28
- 4. Wrap in parentheses `()`
24
+ **MUST APPLY TO ALL ADDRESSES AND OBJECT IDs** (0x prefix + 64 hex chars = 66 chars total).
29
25
 
30
- **Example**: `0xa1d421902a3e5f2e4da7590e8f243712b3b3479d1a07c48c2de543184fc97a33` `(A1D42)`
26
+ Generate a short ID by the following rules:
27
+ 1. Remove `0x` prefix → get the hex string
28
+ 2. Take the first 5 characters (or fewer if the address is shorter)
29
+ 3. Convert to UPPERCASE
30
+ 4. **If all 5 characters are the same character** (e.g., `00000` → `AAAAA`), fall back to the last 5 characters, prefixed with `...`
31
+ 5. **If even the last 5 are all the same character** (extremely rare), find 5 consecutive characters near the middle that differ, wrapped with `...` on both sides
32
+ 6. **Display rule**: no parentheses by default; parentheses are only used when paired with a name (see Display Format Rules below)
33
+
34
+ **Examples**:
35
+ | Full Address | Short ID | Rule |
36
+ |---|---|---|
37
+ | `0xa1d421902a3e5f2e4da7590e8f243712b3b3479d1a07c48c2de543184fc97a33` | `A1D42` | Normal: first 5 |
38
+ | `0x00000123456789abcdef0123456789abcdef0123456789abcdef000000000000` | `...00000` | First 5 all same → last 5 |
39
+ | `0x00000000000000000000000000000000000000000000000000000000000000000` | `...00000...` | Both ends all same → middle 5 |
40
+ | `0x2` | `2` | Short address, take actual length |
31
41
 
32
42
  ## Resolution Priority & Display Format
33
43
 
@@ -39,10 +49,10 @@ Returns: `{ account?: string, local_mark?: string, address: string }`
39
49
 
40
50
  | Condition | Display Format | Example |
41
51
  |-----------|----------------|---------|
42
- | **Both account AND local_mark exist** | `{account_name} \| {local_mark_name} (ABCDE)` | `alice \| my_mark (A1D42)` |
43
- | **Only account exists** | `{account_name} (ABCDE)` | `alice_wallet (A1D42)` |
44
- | **Only local_mark exists** | `{local_mark_name} (ABCDE)` | `my_service (A1D42)` |
45
- | **Neither exists** | `(ABCDE)` | `(A1D42)` |
52
+ | **Both account AND local_mark exist** | `{account_name} \| {local_mark_name}({ID})` | `alice \| my_mark(A1D42)` |
53
+ | **Only account exists** | `{account_name}({ID})` | `alice_wallet(A1D42)` |
54
+ | **Only local_mark exists** | `{local_mark_name}({ID})` | `my_service(A1D42)` |
55
+ | **Neither exists** | `{ID}` | `A1D42` |
46
56
 
47
57
  ---
48
58
 
@@ -54,24 +64,32 @@ Returns: `{ account?: string, local_mark?: string, address: string }`
54
64
 
55
65
  # Amount Formatting Rules
56
66
 
57
- ## Conservative Principle
67
+ ## Primary Source: `_money_display`
68
+
69
+ The MCP fund layer now annotates all monetary query results with `_money_display` — a map of field paths to `ChainValueDisplay` objects containing `{raw, display, symbol, decimals, precision_known, text}`. **Use `_money_display` directly when present** — it is the authoritative formatted display, consistent with the MCP's own precision resolution.
70
+
71
+ - `precision_known === true` → `text` field already contains the complete formatted string: e.g. `"2.2 WOW (decimals: 9; raw: 2200000000)"`
72
+ - `precision_known === false` → `text` contains the raw value with a retry hint; show as-is (the true raw value is authoritative)
73
+
74
+ Supported query types with `_money_display`:
75
+ - `account_balance` — balance and coin amounts
76
+ - `onchain_objects` — Treasury, Service, Order, Allocation, Payment, Reward, Arb, Discount monetary fields
77
+ - `onchain_table_item_treasury_history` / `onchain_table_item_reward_record` — table entry amounts
78
+ - `onchain_received` — CoinWrapper balances
79
+ - `onchain_transaction` — balance_changes (each change has its own `coin_type`)
80
+ - `onchain_events` — NewOrderEvent.amount (via the order's Service generic token type)
81
+
82
+ ## Fallback (when `_money_display` is absent)
58
83
 
59
84
  **When in doubt, display raw value.**
60
85
 
61
86
  | Condition | Display | Example |
62
87
  |-----------|---------|---------|
63
88
  | Token info UNAVAILABLE | Raw amount | `500000000` |
64
- | Token info AVAILABLE | Converted + symbol + precision | `0.5 WOW (9P)` |
65
-
66
- ## Conversion Requirements
67
-
68
- ONLY convert when ALL conditions met:
69
- 1. Token type explicitly identified
70
- 2. Successfully queried via `query_toolkit` with `query_type: "token_list"`
71
- 3. Metadata contains valid `decimals` and `symbol`
89
+ | Token info AVAILABLE | Converted + symbol + precision | `2.2 WOW (decimals: 9; raw: 2200000000)` |
72
90
 
73
91
  **Formula**: `converted = raw / (10 ^ decimals)`
74
- **Format**: `{amount} {symbol} ({decimals}P)`
92
+ **Format**: `{amount} {symbol} (decimals: {N}; raw: {raw})`
75
93
 
76
94
  ---
77
95
 
@@ -82,10 +100,10 @@ ONLY convert when ALL conditions met:
82
100
  ```
83
101
  | # | Time | Sender | Service | Amount | Order |
84
102
  |---|------|--------|---------|--------|-------|
85
- | 1 | {time} | {name} (ABCDE) | {name} (ABCDE) | {amount} | (ABCDE) |
103
+ | 1 | {time} | {name}(ABCDE) | {name}(ABCDE) | {amount} | ABCDE |
86
104
  ```
87
105
 
88
- **Note**: `{name}` follows Display Format Rules above (account | local_mark). If no name, show only `(ABCDE)`.
106
+ **Note**: `{name}` follows Display Format Rules above (account | local_mark). If no name, show only the short ID (no parentheses).
89
107
 
90
108
  ## Event Type Fields
91
109
 
@@ -108,12 +126,13 @@ When user asks about field meanings:
108
126
  - **Sender**: Account that initiated the transaction
109
127
  - **Service**: Service object being ordered/interacted with
110
128
  - **Order Object**: Unique on-chain identifier for this order
111
- - **Short Address (ABCDE)**: First 5 chars for quick visual identification
129
+ - **Short Address (ABCDE)**: Shortened ID for quick visual identification — see Short Address Format rules (first 5 chars; fallback to last 5 or middle 5 if all same)
112
130
 
113
131
  ## Amounts
114
132
  - **Raw**: Actual U64 integer stored on-chain
115
133
  - **Converted**: Human-readable after applying decimals
116
- - **Precision (XP)**: Number of decimal places
134
+ - **Precision (N decimals)**: Number of decimal places
135
+ - **`_money_display`**: MCP-annotated display map (see Amount Formatting Rules above)
117
136
 
118
137
  ## Time
119
138
  - **Timestamp**: Unix milliseconds since epoch
@@ -125,9 +144,10 @@ When user asks about field meanings:
125
144
 
126
145
  - [ ] Extract unique addresses from response
127
146
  - [ ] Query `local_names` for resolution
128
- - [ ] Query `token_list` for amount formatting
147
+ - [ ] Check for `_money_display` annotations in query results (primary amount source)
148
+ - [ ] If `_money_display` absent, query `token_list` for manual amount formatting
129
149
  - [ ] Apply address format rules
130
- - [ ] Apply amount format rules (conservative)
150
+ - [ ] Apply amount format rules (use `_money_display` first; fallback to conservative)
131
151
  - [ ] Render final output
132
152
 
133
153
  ---