@holdem-api/holdem-sdk 0.1.4 → 0.3.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.
package/README.md CHANGED
@@ -1,337 +1,331 @@
1
- # Holdem SDK
2
-
3
- **Poker decisions, equity, and range tracking for your Node.js backend.**
4
-
5
- [![npm version](https://img.shields.io/npm/v/%40holdem-api%2Fholdem-sdk)](https://www.npmjs.com/package/@holdem-api/holdem-sdk)
6
- ![Node.js 20+](https://img.shields.io/badge/node-%3E%3D20-339933)
7
- [![License: MIT](https://img.shields.io/badge/license-MIT-blue)](./LICENSE)
8
-
9
- A typed JavaScript/TypeScript client for Holdem API with zero runtime dependencies. Ships as ESM with TypeScript declarations. Live decisions use `POST /api/actions`; range storage and complete hand-history parsing run locally.
10
-
11
- | Start with | Use it to |
12
- | --- | --- |
13
- | `HoldemClient.actions()` | Request a decision from an encoded public game state |
14
- | `HoldemClient.actionsFromHistory()` | Request the next decision from unfinished PokerStars hand-history text |
15
- | `RangeStore` | Keep player ranges across turns in your server process |
16
- | `parseHandHistories()` | Turn complete hand-history files into recorded decisions locally |
17
-
18
- **Requires:** Node.js 20+, an API key, and access to a Holdem API deployment for live requests. Keep API credentials on your backend.
19
-
20
- [Install](#install) · [API access](#configure-your-api-access) · [First request](#first-live-request) · [Integration](#integrate-decisions-and-track-ranges) · [Ranges](#ranges) · [Hand histories](#convert-hand-history-files) · [Encoding reference](#public-policy-encoding-reference)
21
-
22
-
23
- ## Install
24
-
25
- In your **backend/server project** (for Blitzfold, use `blitzfold-server`):
26
-
27
- ```sh
28
- npm install @holdem-api/holdem-sdk
29
- ```
30
-
31
- No repository clone, local archive, or SDK build step is required. Node.js 20+ is required. The package is ESM-only. JavaScript `.mjs` files can import it directly. CommonJS applications can use native `await import('@holdem-api/holdem-sdk')` inside an async function; TypeScript compiling to CommonJS must preserve that native import rather than rewriting it to require().
32
-
33
- Verify installation without an API key or network request:
34
-
35
- ```sh
36
- node --input-type=module -e "import { HoldemClient, RangeStore } from '@holdem-api/holdem-sdk'; console.log('SDK ready:', typeof HoldemClient, typeof RangeStore)"
37
- ```
38
-
39
- Expected output: `SDK ready: function function`.
40
-
41
- ## Configure your API access
42
-
43
- Obtain a Holdem API key and the origin of the API deployment you are authorized to use. Installing this package does not create an API account, provision a server, or include credentials. Configure these variables on your backend:
44
-
45
- ```dotenv
46
- HOLDEM_API_KEY=your_api_key
47
- HOLDEM_API_URL=https://your-api-host.example
48
- ```
49
-
50
- Replace the example host with your actual deployment origin, without `/api`. Keep `.env` out of version control. Node 20.6+ can load it using `node --env-file=.env your-script.mjs`; on earlier Node 20 versions set environment variables in your shell or use your application's environment loader. Never put the key in browser code.
51
-
52
- ## First live request
53
-
54
- Save this as `holdem-smoke.mjs` in the project where you installed the SDK:
55
-
56
- ```js
57
- import { readFile } from 'node:fs/promises'
58
- import { HoldemClient } from '@holdem-api/holdem-sdk'
59
-
60
- const { HOLDEM_API_KEY: apiKey, HOLDEM_API_URL: baseUrl } = process.env
61
- if (!apiKey || !baseUrl || !process.argv[2]) {
62
- throw new Error('Set HOLDEM_API_KEY and HOLDEM_API_URL; supply a request JSON file')
63
- }
64
- const client = new HoldemClient({ apiKey, baseUrl })
65
- const request = JSON.parse(await readFile(process.argv[2], 'utf8'))
66
- const result = await client.actions(request)
67
- console.log({
68
- chosenAction: result.chosenAction,
69
- probabilities: result.output,
70
- equity: result.equity,
71
- expectedValues: result.expectedValues,
72
- rangeCount: Object.keys(result.range).length,
73
- })
74
- ```
75
-
76
- Export a real pre-decision game state using the policy encoding below into `actions-request.json`, with top-level `{ "hand": "AsAh", "policy": { "schemaVersion": "holdem-public-board-joint-v1", "context": [...], "history": [...], "legalMask": [0,1,1] } }`. The ellipses describe encoder output; replace them with actual arrays. Do not use made-up features or an empty context. Then run:
77
-
78
- ```sh
79
- node --env-file=.env holdem-smoke.mjs actions-request.json
80
- ```
81
-
82
- This makes one live request and may consume API quota. It does not execute an action in your game. If this fails, 401/403 indicates an access/authentication issue; 400 indicates invalid input; 502/503 can indicate unavailable equity/model services. Inspect the SDK error status and your API configuration.
83
-
84
- ## Integrate decisions and track ranges
85
-
86
- ```ts
87
- import { HoldemClient, RangeStore } from '@holdem-api/holdem-sdk'
88
- import type { PublicPolicy } from '@holdem-api/holdem-sdk'
89
-
90
- const holdem = new HoldemClient({
91
- apiKey: process.env.HOLDEM_API_KEY!,
92
- baseUrl: process.env.HOLDEM_API_URL!, // origin without /api
93
- })
94
- const ranges = new RangeStore()
95
-
96
- async function decide(handId: string, playerId: string, policy: PublicPolicy) {
97
- const result = await holdem.actions({
98
- policy,
99
- hand: 'AsAh',
100
- range: ranges.get(handId, playerId),
101
- // opponentRanges: [ranges.get(handId, opponentId) ?? null],
102
- })
103
- // Your engine executes result.chosenAction, sampling sizes/weights on aggression.
104
- // Only AFTER successful execution of that action:
105
- // ranges.record(handId, playerId, result, executedAction)
106
- return result
107
- }
108
- ```
109
-
110
- `predictActions` is an alias with the same request and response. This replaces the original unpublished SDK's legacy state-based prediction, separate range-update, and equity methods.
111
-
112
- Supply the exact public encoder output as `policy`: schemaVersion `holdem-public-board-joint-v1`, 316 context features, chronological history of at most 512 events with 32 features each, and legalMask `[fold, passive, aggressive]`. Use the API/parser public encoder; an ordinary game snapshot is not that encoding. Context has board slots (260), actor (9), street (4), six log-scaled amounts/counts, nine public seat records (36), and remaining opponents / 9. Amount scaling is `log1p(max(0,value))/log1p(400)`.
113
-
114
- ## Response at a glance
115
-
116
- - `equity`, `uniformEquity`, `equityBasis`, optional `opponentEquity`.
117
- - `output`: hand-specific action probabilities; `population`: public model targets.
118
- - `chosenAction`: sampled fold/call/raise or check/bet. No size is sampled.
119
- - `sizes` and `weights`: conditional aggression sizing distribution. Your engine applies legal payments, raises, all-ins and side pots.
120
- - `range`: normalized actor posterior conditioned on chosenAction.
121
- - `expectedValues`: simplified uniform heads-up showdown benchmark in BB. Assumes one caller, no fold equity, no future betting, no rake or side pots; not strategic or opponent-range-aware EV.
122
- - Optional `learnedExpectedValues`: experimental observed-action historical returns, only when configured on the API server. Not validated counterfactual action values.
123
- - `improvementPotential`, `improvement`, allocation identifiers, and all additional server fields are preserved.
124
-
125
- ## Ranges
126
-
127
- `WeightedRange` maps exact two-card combos to nonnegative weights. Omit `range` for a uniform board-compatible actor population. Pass a prior to track a reached range; the actual hand must have positive mass. Do not initialize a range with just the known hand. Optional `opponentRanges` has one map or null (uniform) per remaining opponent; never send revealed opponents' actual cards.
128
-
129
- ### Local range storage
130
-
131
- `RangeStore` keeps ranges in your backend server's memory. It keeps a JavaScript `Map` keyed by hand ID and player ID. Players do not need to manage range files or enter ranges themselves; your backend handles that work.
132
-
133
- `HoldemClient` does not save ranges automatically. Create one store for the lifetime of your room/server, read the prior before each request, and save the returned range only after the chosen action executes successfully. Do not create a new store inside each decision.
134
-
135
- ### Example: reuse a player's range across turns
136
-
137
- ```ts
138
- import { HoldemClient, RangeStore } from '@holdem-api/holdem-sdk'
139
- import type { ActionsResult, ActionType, PublicPolicy } from '@holdem-api/holdem-sdk'
140
-
141
- const client = new HoldemClient({
142
- apiKey: process.env.HOLDEM_API_KEY!,
143
- baseUrl: process.env.HOLDEM_API_URL!,
144
- })
145
- const ranges = new RangeStore() // Shared across this room's decisions.
146
-
147
- // Your engine adapter executes result.chosenAction and returns the category
148
- // actually executed. Throw on failure. For bet/raise, sample the conditional
149
- // sizes/weights and enforce your engine's legal sizing limits.
150
- type ExecuteAction = (result: ActionsResult) => Promise<ActionType>
151
-
152
- async function decideAndExecute(
153
- handId: string,
154
- playerId: string,
155
- hand: string,
156
- policy: PublicPolicy,
157
- executeAction: ExecuteAction,
158
- ) {
159
- const result = await client.actions({
160
- hand,
161
- policy,
162
- // First turn: undefined means a uniform board-compatible range.
163
- // Later turns: reuse this player's last saved range for this hand.
164
- range: ranges.get(handId, playerId),
165
- })
166
-
167
- // Execute chosenAction directly; do not sample the category a second time.
168
- const executedAction = await executeAction(result)
169
- // Save only after successful execution. A different category throws and
170
- // leaves the store unchanged: this posterior belongs to chosenAction.
171
- ranges.record(handId, playerId, result, executedAction)
172
- return result
173
- }
174
-
175
- function onHandFinished(handId: string) {
176
- ranges.clear(handId) // Remove every player's range for this hand.
177
- }
178
- ```
179
-
180
- Call `decideAndExecute` on each turn with the same hand/player IDs, the actor's actual hand, and freshly encoded public policy. Your application supplies the engine adapter and calls `onHandFinished` when the hand ends. Serialize the request, execution, and save per player, and reject expired hand/turn responses before execution. If the engine executes a different category, stop this flow and explicitly resolve the player's prior before another decision; do not save this response's range for that different action.
181
-
182
- ### Lifetime and persistence
183
-
184
- - `get(handId, playerId)` returns a copy of the stored range, or `undefined` if none exists.
185
- - `record(handId, playerId, result, executedAction)` saves a copy after verifying that the executed category matches `chosenAction`.
186
- - `set(handId, playerId, range)` explicitly stores a validated range, including a snapshot restored from your database.
187
- - `clear(handId)` clears one hand; `clear()` clears the entire store, for example when disposing of a room.
188
-
189
- This is in-process server memory, not browser local storage or a file on disk. Ranges disappear when the process restarts and are not shared across workers or server instances. If you need restart recovery or shared state, persist `get()` snapshots in your application's database and restore them with `set()`. The SDK does not include a persistence layer.
190
-
191
- The API itself stores no ranges. The SDK does not infer ranges for arbitrary observed opponent actions. Optional `opponentRanges` must contain valid tracked priors or `null` for uniform; never substitute an opponent's revealed actual hand.
192
-
193
- ## Errors and cancellation
194
-
195
- | Error | Meaning |
196
- | --- | --- |
197
- | `HoldemValidationError` | Invalid local input; the request was not sent |
198
- | `HoldemApiError` | The API rejected the request; inspect `status` and `body` |
199
- | `HoldemResponseError` | A successful HTTP response did not match the expected shape |
200
- | `HoldemTransportError` | Network failure, timeout, or cancellation |
201
-
202
- Request methods accept `{ signal }` as the second argument:
203
-
204
- ```ts
205
- const controller = new AbortController()
206
- const result = await client.actions(request, { signal: controller.signal })
207
- ```
208
-
209
- The default timeout is 60 seconds and includes reading the response body. Override it with `timeoutMs` in the client constructor. There are no automatic retries. API keys are sent in the `x-api-key` header.
210
-
211
- ## Convert hand-history files
212
-
213
- ### Request a live decision from text
214
-
215
- `client.actionsFromHistory()` sends an unfinished hand to `POST /api/actions`.
216
- The API parses the text, replays actions, identifies the next actor, and builds
217
- the public policy. Callers do not construct numeric feature arrays.
218
- Requires an API deployment with live-history input support.
219
-
220
- ```ts
221
- const result = await client.actionsFromHistory({
222
- handHistory: `PokerStars Hand #123: Hold'em No Limit ($0.10/$0.25 USD) - 2026/11/05 20:00:00 ET
223
- Table 'Blitzfold' 2-max Seat #1 is the button
224
- Seat 1: Hero ($25 in chips)
225
- Seat 2: Opponent ($25 in chips)
226
- Hero: posts small blind $0.10
227
- Opponent: posts big blind $0.25
228
- *** HOLE CARDS ***
229
- Dealt to Hero [As Ah]`,
230
- player: 'Hero', // optional assertion of whose turn it is
231
- style: 'tight-aggressive',
232
- // hand: 'AsAh', // required if the actor has no Dealt to line
233
- // range: ranges.get(handId, playerId),
234
- })
235
- console.log(result.chosenAction, result.equity)
236
- ```
237
-
238
- Append executed actions and dealt street markers, then send the full prefix again
239
- at each decision. The API is stateless: include the header, seats, starting stacks,
240
- button, blinds, and all preceding actions every time. Stop before the pending
241
- action; omit showdown, collection, and summary lines. For a closed betting round,
242
- include the next dealt street before requesting. Headers alone do not describe
243
- a later decision.
244
-
245
- Supports ordinary PokerStars USD No Limit Hold'em cash text, up to 100 KB and
246
- 512 preceding events. Arbitrary prose and other sites' formats are rejected.
247
- Optional `range`, `opponentRanges`, `style`, `gateSlope`, `policyVersion`, and
248
- cancellation work as with `actions()`. Track ranges explicitly and record them
249
- only after executing the returned action. This method reads text, not filesystem
250
- paths, and does not execute game actions. The structured `actions({ policy, hand })`
251
- entry point remains available.
252
-
253
- ### Parse complete files locally
254
-
255
- `parseHandHistories(text)` locally converts one or more complete PokerStars USD
256
- No Limit Hold'em regular cash histories into decisions. Unsupported formats,
257
- incomplete hands, and inconsistent settlement totals throw an error.
258
-
259
- ```ts
260
- import { readFile } from 'node:fs/promises'
261
- import { HoldemClient, parseHandHistories } from '@holdem-api/holdem-sdk'
262
-
263
- const client = new HoldemClient({
264
- apiKey: process.env.HOLDEM_API_KEY!,
265
- baseUrl: process.env.HOLDEM_API_URL!,
266
- })
267
- const hands = parseHandHistories(await readFile('history.txt', 'utf8'))
268
- for (const hand of hands) {
269
- for (const decision of hand.decisions) {
270
- if (decision.player !== 'YourPlayerName' || !decision.hand) continue
271
- const result = await client.actions({ policy: decision.policy, hand: decision.hand })
272
- console.log(hand.handId, decision.street, result.chosenAction)
273
- }
274
- }
275
- ```
276
-
277
- Decisions include actionIndex, player, street, observedAction, policy, optional
278
- hand and optional cardSource. Unknown cards remain absent. Revealed actor cards
279
- may be used for retrospective analysis; private cards, future board cards and
280
- future actions never enter earlier public policies. The helper makes no API calls.
281
- It returns recorded decisions, not pending decisions from unfinished live hands.
282
- It does not infer reached ranges. Omitted ranges use uniform defaults; do not
283
- carry a sampled-action posterior through a history that took a different action.
284
-
285
- ## Public policy encoding reference
286
-
287
- The SDK accepts encoded public features; it does not reconstruct betting state. Use consistent seat IDs 0-8 throughout a hand. Cards are indexed by `rankIndex * 4 + suitIndex`, ranks `23456789TJQKA`, suits `cdhs`. Street indexes are preflop=0, flop=1, turn=2, river=3. A one-hot block has exactly one 1; an empty board slot is all zeros. Board slots retain deal order. All amounts below are BB unless a count is specified; scale amounts/counts using `log1p(max(0,x))/log1p(400)`.
288
-
289
- | Context indexes | Encoding |
290
- | --- | --- |
291
- | 0-259 | Five ordered 52-value board one-hot slots |
292
- | 260-268 | Actor seat one-hot |
293
- | 269-272 | Street one-hot |
294
- | 273-278 | Scaled pot, facing amount, call payment, min raise-to, max raise-to, number of seats |
295
- | 279-314 | Nine seat records: present flag, scaled remaining stack, scaled current-street contribution, active flag; absent seats have four zeros |
296
- | 315 | Remaining active opponent count divided by 9 |
297
-
298
- Each history event has 32 values: actor seat one-hot (9), street one-hot (4), action one-hot (6, ordered posts/folds/checks/calls/bets/raises), four scaled values (payment added, raise-to or 0, live post or 0, dead post or 0), and nine scaled refund amounts indexed by seat. Sum multiple refunds to the same seat after the event before scaling. History must contain all actual preceding events in order, across streets, excluding the current decision. Send no artificial padding; empty history is supported. Maximum history length is 512. LegalMask is `[fold, passive, aggressive]` derived from actual engine legality, with only 0/1 values and at least one allowed action. Do not include opponents' private cards or future events. Encode call payment, contributions, and raise limits from actual engine state; do not infer them from incomplete logs.
299
-
300
- ## Blitzfold migration checklist
301
-
302
- Install in the server. Replace the `/api/equity_actions` request with `client.actions(payload)` using the existing public encoder. Preserve the full response, including `range`; remove any code deleting it. Use `chosenAction` directly instead of sampling the action category a second time. Sample only the conditional size after aggression and enforce engine legality. Commit the actor range only after that same category executes successfully; reject stale hand/turn responses and clear completed hands. Select optional player styles locally and send them with the request, so decisions need only `/api/actions`. Keep error/cooldown handling and the game's timeout budget. Verify both the development runner and the compiled server can load this ESM package.
303
-
304
- ## SDK maintainers: build and publish
305
-
306
- ```sh
307
- npm ci
308
- npm test
309
- npm pack
310
- ```
311
-
312
- The package is configured for public publication as `@holdem-api/holdem-sdk` under the MIT license. For publication:
313
-
314
- 1. Create or obtain access to the `holdem-api` npm organization. The package name is configured as `@holdem-api/holdem-sdk`. The public access setting and MIT license are already configured.
315
- 2. Run `npm login` and complete npm's browser authentication/2FA.
316
- 3. Run `npm test` and `npm pack --dry-run` to inspect contents.
317
- 4. Run `npm publish --access public` and complete any npm verification prompt.
318
- 5. In the consuming project, run `npm install @holdem-api/holdem-sdk`.
319
-
320
- Do not put credentials in source or the package. Before publishing another release, bump the version with `npm version patch` (requires a clean git checkout) or edit the version and update the lockfile.
321
-
322
- ### Stakes and optional model settings
323
-
324
- Pass `stake: '200 NL'` (USD $1/$2) with encoded actions, or let
325
- actionsFromHistory detect it from the history. Supported labels are 25NL, 50NL,
326
- 100NL, 200NL, 500NL, 1000NL; spaces are accepted and normalized.
327
- Only 25NL currently has a released model; unreleased selections return MODEL_UNAVAILABLE.
328
-
329
- Normal calls need no tuning parameters. The API defaults to 25NL / population-v1
330
- for encoded requests. Advanced callers may set model, gateSlope, style and
331
- policyVersion per call, or configure reusable client defaults:
332
-
333
- `new HoldemClient({ baseUrl, apiKey, defaults: { stake: '25NL', model: 'population-v1' } })`
334
-
335
- Omit stake defaults when using automatic text-history stake detection. Explicit
336
- stakes must agree with the history. Model IDs select registered server releases,
337
- never local filesystem paths. New IDs require a compatible API release.
1
+ # Actions and Exploit
2
+
3
+ `client.actions()` returns population behavior and ranges. EV fields have been removed from its typed contract.
4
+
5
+ ```typescript
6
+ try {
7
+ const analysis = await client.exploit({ policy, hand: 'AsAh', stake: '25NL' })
8
+ // Future success: candidates has action, amountAddedBB, evBB per supported play.
9
+ // chosenAction is the highest estimated EV, not a sampled action.
10
+ } catch (error) {
11
+ // Currently returns 503 EXPLOIT_MODEL_UNAVAILABLE. Never invent EVs.
12
+ }
13
+ ```
14
+
15
+ Only stake defaults carry over to Exploit. Model selection is server-managed. Calls support the same AbortSignal, timeout and structured errors as Actions. Keep API keys on the server. Version 0.3.0 adds Exploit route support. Model release, candidate construction and successful-request billing remain future work.
16
+
17
+ # Holdem SDK
18
+
19
+ **Poker decisions, equity, and range tracking for your Node.js backend.**
20
+
21
+ [![npm version](https://img.shields.io/npm/v/%40holdem-api%2Fholdem-sdk)](https://www.npmjs.com/package/@holdem-api/holdem-sdk)
22
+ ![Node.js 20+](https://img.shields.io/badge/node-%3E%3D20-339933)
23
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue)](./LICENSE)
24
+
25
+ A typed JavaScript/TypeScript client for Holdem API with zero runtime dependencies. Ships as ESM with TypeScript declarations. Live decisions use `POST /api/actions`; range storage and complete hand-history parsing run locally.
26
+
27
+ | Start with | Use it to |
28
+ | --- | --- |
29
+ | `HoldemClient.actions()` | Request a decision from an encoded public game state |
30
+ | `HoldemClient.actionsFromHistory()` | Request the next decision from unfinished PokerStars hand-history text |
31
+ | `RangeStore` | Keep player ranges across turns in your server process |
32
+ | `parseHandHistories()` | Turn complete hand-history files into recorded decisions locally |
33
+
34
+ **Requires:** Node.js 20+, an API key, and access to a Holdem API deployment for live requests. Keep API credentials on your backend.
35
+
36
+ [Install](#install) · [API access](#configure-your-api-access) · [First request](#first-live-request) · [Integration](#integrate-decisions-and-track-ranges) · [Ranges](#ranges) · [Hand histories](#convert-hand-history-files) · [Encoding reference](#public-policy-encoding-reference)
37
+
38
+
39
+ ## Install
40
+
41
+ In your **backend/server project**:
42
+
43
+ ```sh
44
+ npm install @holdem-api/holdem-sdk
45
+ ```
46
+
47
+ No repository clone, local archive, or SDK build step is required. Node.js 20+ is required. The package is ESM-only. JavaScript `.mjs` files can import it directly. CommonJS applications can use native `await import('@holdem-api/holdem-sdk')` inside an async function; TypeScript compiling to CommonJS must preserve that native import rather than rewriting it to require().
48
+
49
+ Verify installation without an API key or network request:
50
+
51
+ ```sh
52
+ node --input-type=module -e "import { HoldemClient, RangeStore } from '@holdem-api/holdem-sdk'; console.log('SDK ready:', typeof HoldemClient, typeof RangeStore)"
53
+ ```
54
+
55
+ Expected output: `SDK ready: function function`.
56
+
57
+ ## Configure your API access
58
+
59
+ Obtain a Holdem API key and the origin of the API deployment you are authorized to use. Installing this package does not create an API account, provision a server, or include credentials. Configure these variables on your backend:
60
+
61
+ ```dotenv
62
+ HOLDEM_API_KEY=your_api_key
63
+ HOLDEM_API_URL=https://www.holdemapi.com
64
+ ```
65
+
66
+ Use the production origin above, without `/api`; override it only for a separate deployment. Keep `.env` out of version control. Node 20.6+ can load it using `node --env-file=.env your-script.mjs`; on earlier Node 20 versions set environment variables in your shell or use your application's environment loader. Never put the key in browser code.
67
+
68
+ ## First live request
69
+
70
+ Use `actionsFromHistory()` for the next decision in one unfinished PokerStars USD cash hand. `parseHandHistories()` instead replays complete recorded hands locally and makes no API requests. Engine adapters can use `actions()` with an encoded policy; the numeric encoding is described later.
71
+
72
+ Download [the sample unfinished hand](https://www.holdemapi.com/examples/hand-history.txt) as `hand-history.txt`. Save this as `holdem-smoke.mjs` in the project where you installed the SDK:
73
+
74
+ ```js
75
+ import { readFile } from 'node:fs/promises'
76
+ import { HoldemClient } from '@holdem-api/holdem-sdk'
77
+
78
+ const apiKey = process.env.HOLDEM_API_KEY
79
+ const file = process.argv[2]
80
+ if (!apiKey || !file) throw new Error('Set HOLDEM_API_KEY and supply a hand-history file')
81
+ const client = new HoldemClient({
82
+ apiKey,
83
+ baseUrl: process.env.HOLDEM_API_URL || 'https://www.holdemapi.com',
84
+ })
85
+ const handHistory = await readFile(file, 'utf8')
86
+ const result = await client.actionsFromHistory({ handHistory })
87
+ console.log({ chosenAction: result.chosenAction, probabilities: result.output,
88
+ equity: result.equity, sizes: result.sizes, weights: result.weights })
89
+ ```
90
+
91
+ ```sh
92
+ node --env-file=.env holdem-smoke.mjs hand-history.txt
93
+ ```
94
+
95
+ This makes one live request and may consume API quota. It does not execute an action. The API infers the pending actor and uses their `Dealt to` cards. For another file, stop immediately before the decision; exclude showdown, collection and summary lines. Optionally supply `player` to check the actor or `hand` when dealt cards are absent. Do not mix `handHistory` and `policy`. Hand-history input reconstructs public state, not earlier reached ranges.
96
+
97
+ If the request fails, inspect the SDK error status and message: 400 indicates invalid input, 401/403 indicates an access issue, and 502/503 can indicate unavailable dependencies or model releases. If a 403 contains HTML, retain the response headers, timestamp and request identifier for support, excluding your key.
98
+
99
+ ## Integrate decisions and track ranges
100
+
101
+ ```ts
102
+ import { HoldemClient, RangeStore } from '@holdem-api/holdem-sdk'
103
+ import type { PublicPolicy } from '@holdem-api/holdem-sdk'
104
+
105
+ const holdem = new HoldemClient({
106
+ apiKey: process.env.HOLDEM_API_KEY!,
107
+ baseUrl: process.env.HOLDEM_API_URL!, // origin without /api
108
+ })
109
+ const ranges = new RangeStore()
110
+
111
+ async function decide(handId: string, playerId: string, policy: PublicPolicy) {
112
+ const result = await holdem.actions({
113
+ policy,
114
+ hand: 'AsAh',
115
+ range: ranges.get(handId, playerId),
116
+ // opponentRanges: [ranges.get(handId, opponentId) ?? null],
117
+ })
118
+ // Your engine executes result.chosenAction, sampling sizes/weights on aggression.
119
+ // Only AFTER successful execution of that action:
120
+ // ranges.record(handId, playerId, result, executedAction)
121
+ return result
122
+ }
123
+ ```
124
+
125
+ `predictActions` is an alias with the same request and response. This replaces the original unpublished SDK's legacy state-based prediction, separate range-update, and equity methods.
126
+
127
+ Supply the exact public encoder output as `policy`: schemaVersion `holdem-public-board-joint-v1`, 316 context features, chronological history of at most 512 events with 32 features each, and legalMask `[fold, passive, aggressive]`. Use the API/parser public encoder; an ordinary game snapshot is not that encoding. Context has board slots (260), actor (9), street (4), six log-scaled amounts/counts, nine public seat records (36), and remaining opponents / 9. Amount scaling is `log1p(max(0,value))/log1p(400)`.
128
+
129
+ ## Response at a glance
130
+
131
+ - `equity`, `uniformEquity`, `equityBasis`, optional `opponentEquity`.
132
+ - `output`: hand-specific action probabilities; `population`: public model targets.
133
+ - `chosenAction`: sampled fold/call/raise or check/bet. No size is sampled.
134
+ - `sizes` and `weights`: conditional aggression sizing distribution. Your engine applies legal payments, raises, all-ins and side pots.
135
+ - `range`: normalized actor posterior conditioned on chosenAction.
136
+ - `improvementPotential`, `improvement`, allocation identifiers, and all additional server fields are preserved.
137
+
138
+ ## Ranges
139
+
140
+ `WeightedRange` maps exact two-card combos to nonnegative weights. Omit `range` for a uniform board-compatible actor population. Pass a prior to track a reached range; the actual hand must have positive mass. Do not initialize a range with just the known hand. Optional `opponentRanges` has one map or null (uniform) per remaining opponent; never send revealed opponents' actual cards.
141
+
142
+ ### Local range storage
143
+
144
+ `RangeStore` keeps ranges in your backend server's memory. It keeps a JavaScript `Map` keyed by hand ID and player ID. Players do not need to manage range files or enter ranges themselves; your backend handles that work.
145
+
146
+ `HoldemClient` does not save ranges automatically. Create one store for the lifetime of your room/server, read the prior before each request, and save the returned range only after the chosen action executes successfully. Do not create a new store inside each decision.
147
+
148
+ ### Example: reuse a player's range across turns
149
+
150
+ ```ts
151
+ import { HoldemClient, RangeStore } from '@holdem-api/holdem-sdk'
152
+ import type { ActionsResult, ActionType, PublicPolicy } from '@holdem-api/holdem-sdk'
153
+
154
+ const client = new HoldemClient({
155
+ apiKey: process.env.HOLDEM_API_KEY!,
156
+ baseUrl: process.env.HOLDEM_API_URL!,
157
+ })
158
+ const ranges = new RangeStore() // Shared across this room's decisions.
159
+
160
+ // Your engine adapter executes result.chosenAction and returns the category
161
+ // actually executed. Throw on failure. For bet/raise, sample the conditional
162
+ // sizes/weights and enforce your engine's legal sizing limits.
163
+ type ExecuteAction = (result: ActionsResult) => Promise<ActionType>
164
+
165
+ async function decideAndExecute(
166
+ handId: string,
167
+ playerId: string,
168
+ hand: string,
169
+ policy: PublicPolicy,
170
+ executeAction: ExecuteAction,
171
+ ) {
172
+ const result = await client.actions({
173
+ hand,
174
+ policy,
175
+ // First turn: undefined means a uniform board-compatible range.
176
+ // Later turns: reuse this player's last saved range for this hand.
177
+ range: ranges.get(handId, playerId),
178
+ })
179
+
180
+ // Execute chosenAction directly; do not sample the category a second time.
181
+ const executedAction = await executeAction(result)
182
+ // Save only after successful execution. A different category throws and
183
+ // leaves the store unchanged: this posterior belongs to chosenAction.
184
+ ranges.record(handId, playerId, result, executedAction)
185
+ return result
186
+ }
187
+
188
+ function onHandFinished(handId: string) {
189
+ ranges.clear(handId) // Remove every player's range for this hand.
190
+ }
191
+ ```
192
+
193
+ Call `decideAndExecute` on each turn with the same hand/player IDs, the actor's actual hand, and freshly encoded public policy. Your application supplies the engine adapter and calls `onHandFinished` when the hand ends. Serialize the request, execution, and save per player, and reject expired hand/turn responses before execution. If the engine executes a different category, stop this flow and explicitly resolve the player's prior before another decision; do not save this response's range for that different action.
194
+
195
+ ### Lifetime and persistence
196
+
197
+ - `get(handId, playerId)` returns a copy of the stored range, or `undefined` if none exists.
198
+ - `record(handId, playerId, result, executedAction)` saves a copy after verifying that the executed category matches `chosenAction`.
199
+ - `set(handId, playerId, range)` explicitly stores a validated range, including a snapshot restored from your database.
200
+ - `clear(handId)` clears one hand; `clear()` clears the entire store, for example when disposing of a room.
201
+
202
+ This is in-process server memory, not browser local storage or a file on disk. Ranges disappear when the process restarts and are not shared across workers or server instances. If you need restart recovery or shared state, persist `get()` snapshots in your application's database and restore them with `set()`. The SDK does not include a persistence layer.
203
+
204
+ The API itself stores no ranges. The SDK does not infer ranges for arbitrary observed opponent actions. Optional `opponentRanges` must contain valid tracked priors or `null` for uniform; never substitute an opponent's revealed actual hand.
205
+
206
+ ## Errors and cancellation
207
+
208
+ | Error | Meaning |
209
+ | --- | --- |
210
+ | `HoldemValidationError` | Invalid local input; the request was not sent |
211
+ | `HoldemApiError` | The API rejected the request; inspect `status` and `body` |
212
+ | `HoldemResponseError` | A successful HTTP response did not match the expected shape |
213
+ | `HoldemTransportError` | Network failure, timeout, or cancellation |
214
+
215
+ Request methods accept `{ signal }` as the second argument:
216
+
217
+ ```ts
218
+ const controller = new AbortController()
219
+ const result = await client.actions(request, { signal: controller.signal })
220
+ ```
221
+
222
+ The default timeout is 60 seconds and includes reading the response body. Override it with `timeoutMs` in the client constructor. There are no automatic retries. API keys are sent in the `x-api-key` header.
223
+
224
+ ## Convert hand-history files
225
+
226
+ ### Request a live decision from text
227
+
228
+ `client.actionsFromHistory()` sends an unfinished hand to `POST /api/actions`.
229
+ The API parses the text, replays actions, identifies the next actor, and builds
230
+ the public policy. Callers do not construct numeric feature arrays.
231
+ Requires an API deployment with live-history input support.
232
+
233
+ ```ts
234
+ const result = await client.actionsFromHistory({
235
+ handHistory: `PokerStars Hand #123: Hold'em No Limit ($0.10/$0.25 USD) - 2026/11/05 20:00:00 ET
236
+ Table 'Blitzfold' 2-max Seat #1 is the button
237
+ Seat 1: Hero ($25 in chips)
238
+ Seat 2: Opponent ($25 in chips)
239
+ Hero: posts small blind $0.10
240
+ Opponent: posts big blind $0.25
241
+ *** HOLE CARDS ***
242
+ Dealt to Hero [As Ah]`,
243
+ player: 'Hero', // optional assertion of whose turn it is
244
+ style: 'tight-aggressive',
245
+ // hand: 'AsAh', // required if the actor has no Dealt to line
246
+ // range: ranges.get(handId, playerId),
247
+ })
248
+ console.log(result.chosenAction, result.equity)
249
+ ```
250
+
251
+ Append executed actions and dealt street markers, then send the full prefix again
252
+ at each decision. The API is stateless: include the header, seats, starting stacks,
253
+ button, blinds, and all preceding actions every time. Stop before the pending
254
+ action; omit showdown, collection, and summary lines. For a closed betting round,
255
+ include the next dealt street before requesting. Headers alone do not describe
256
+ a later decision.
257
+
258
+ Supports ordinary PokerStars USD No Limit Hold'em cash text, up to 100 KB and
259
+ 512 preceding events. Arbitrary prose and other sites' formats are rejected.
260
+ Optional `range`, `opponentRanges`, `style`, `gateSlope`, `policyVersion`, and
261
+ cancellation work as with `actions()`. Track ranges explicitly and record them
262
+ only after executing the returned action. This method reads text, not filesystem
263
+ paths, and does not execute game actions. The structured `actions({ policy, hand })`
264
+ entry point remains available.
265
+
266
+ ### Parse complete files locally
267
+
268
+ `parseHandHistories(text)` locally converts one or more complete PokerStars USD
269
+ No Limit Hold'em regular cash histories into decisions. Unsupported formats,
270
+ incomplete hands, and inconsistent settlement totals throw an error.
271
+
272
+ ```ts
273
+ import { readFile } from 'node:fs/promises'
274
+ import { HoldemClient, parseHandHistories } from '@holdem-api/holdem-sdk'
275
+
276
+ const client = new HoldemClient({
277
+ apiKey: process.env.HOLDEM_API_KEY!,
278
+ baseUrl: process.env.HOLDEM_API_URL!,
279
+ })
280
+ const hands = parseHandHistories(await readFile('history.txt', 'utf8'))
281
+ for (const hand of hands) {
282
+ for (const decision of hand.decisions) {
283
+ if (decision.player !== 'YourPlayerName' || !decision.hand) continue
284
+ const result = await client.actions({ policy: decision.policy, hand: decision.hand })
285
+ console.log(hand.handId, decision.street, result.chosenAction)
286
+ }
287
+ }
288
+ ```
289
+
290
+ Decisions include actionIndex, player, street, observedAction, policy, optional
291
+ hand and optional cardSource. Unknown cards remain absent. Revealed actor cards
292
+ may be used for retrospective analysis; private cards, future board cards and
293
+ future actions never enter earlier public policies. The helper makes no API calls.
294
+ It returns recorded decisions, not pending decisions from unfinished live hands.
295
+ It does not infer reached ranges. Omitted ranges use uniform defaults; do not
296
+ carry a sampled-action posterior through a history that took a different action.
297
+
298
+ ## Public policy encoding reference
299
+
300
+ The SDK accepts encoded public features; it does not reconstruct betting state. Use consistent seat IDs 0-8 throughout a hand. Cards are indexed by `rankIndex * 4 + suitIndex`, ranks `23456789TJQKA`, suits `cdhs`. Street indexes are preflop=0, flop=1, turn=2, river=3. A one-hot block has exactly one 1; an empty board slot is all zeros. Board slots retain deal order. All amounts below are BB unless a count is specified; scale amounts/counts using `log1p(max(0,x))/log1p(400)`.
301
+
302
+ | Context indexes | Encoding |
303
+ | --- | --- |
304
+ | 0-259 | Five ordered 52-value board one-hot slots |
305
+ | 260-268 | Actor seat one-hot |
306
+ | 269-272 | Street one-hot |
307
+ | 273-278 | Scaled pot, facing amount, call payment, min raise-to, max raise-to, number of seats |
308
+ | 279-314 | Nine seat records: present flag, scaled remaining stack, scaled current-street contribution, active flag; absent seats have four zeros |
309
+ | 315 | Remaining active opponent count divided by 9 |
310
+
311
+ Each history event has 32 values: actor seat one-hot (9), street one-hot (4), action one-hot (6, ordered posts/folds/checks/calls/bets/raises), four scaled values (payment added, raise-to or 0, live post or 0, dead post or 0), and nine scaled refund amounts indexed by seat. Sum multiple refunds to the same seat after the event before scaling. History must contain all actual preceding events in order, across streets, excluding the current decision. Send no artificial padding; empty history is supported. Maximum history length is 512. LegalMask is `[fold, passive, aggressive]` derived from actual engine legality, with only 0/1 values and at least one allowed action. Do not include opponents' private cards or future events. Encode call payment, contributions, and raise limits from actual engine state; do not infer them from incomplete logs.
312
+
313
+ ## Stakes and server-managed models
314
+
315
+ Pass `stake: '200 NL'` (USD $1/$2) with encoded actions, or let
316
+ actionsFromHistory detect it from the history. Supported labels are 25NL, 50NL,
317
+ 100NL, 200NL, 500NL, 1000NL; spaces are accepted and normalized.
318
+ Only 25NL currently has a released model; unreleased selections return MODEL_UNAVAILABLE.
319
+
320
+ Normal calls need no tuning parameters. The API defaults to 25NL / population-v1
321
+ for encoded requests. The server selects the default release for each stake. Callers may set gateSlope, style and
322
+ policyVersion per call, or configure reusable client defaults:
323
+
324
+ `new HoldemClient({ baseUrl, apiKey, defaults: { stake: '25NL' } })`
325
+
326
+ Omit stake defaults when using automatic text-history stake detection. Explicit
327
+ stakes must agree with the history. Request model selection has been removed.
328
+ Remove model from constructor defaults and per-call options when migrating. Legacy
329
+ JavaScript model properties are stripped before transport. Preserve response model
330
+ metadata to log the actual server release. Stop sending model in consumers before deploying the updated API;
331
+ older clients sending model directly receive BAD_REQUEST from the updated API.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export * from './types.js';
2
2
  export { parseHandHistories } from './history/index.js';
3
3
  export { HoldemValidationError } from './validation.js';
4
- import type { CallOptions, ClientOptions, ActionsInput, ActionsResult, HistoryActionsInput } from './types.js';
4
+ import type { CallOptions, ClientOptions, ActionsInput, ActionsResult, HistoryActionsInput, ExploitInput, ExploitResult } from './types.js';
5
5
  export { RangeStore } from './ranges.js';
6
6
  export declare class HoldemApiError extends Error {
7
7
  readonly status: number;
@@ -25,6 +25,8 @@ export declare class HoldemClient {
25
25
  constructor(config: ClientOptions);
26
26
  /** Returns the complete action response without dropping analysis or optional fields. */
27
27
  actions(input: ActionsInput, call?: CallOptions): Promise<ActionsResult>;
28
+ /** Rank private-hand plays by EV. Currently fails with 503 until an exploit release exists. */
29
+ exploit(input: ExploitInput, call?: CallOptions): Promise<ExploitResult>;
28
30
  /** Parse a live hand-history prefix on the API and request the next decision. */
29
31
  actionsFromHistory(input: HistoryActionsInput, call?: CallOptions): Promise<ActionsResult>;
30
32
  /** Alias for actions; uses the same /api/actions contract. */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,KAAK,E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E,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;IAUhG,8DAA8D;IACxD,cAAc,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;IAGrF,OAAO,CAAC,SAAS;YAYH,IAAI;CA2BnB"}
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export * from './types.js';
2
2
  export { parseHandHistories } from './history/index.js';
3
3
  export { HoldemValidationError } from './validation.js';
4
- import { check, validateActions, range } from './validation.js';
4
+ import { check, validateActions, validateExploit, range } from './validation.js';
5
5
  export { RangeStore } from './ranges.js';
6
6
  export class HoldemApiError extends Error {
7
7
  status;
@@ -43,11 +43,39 @@ function validActions(v) {
43
43
  }
44
44
  return object(v.range) && Math.abs(Object.values(v.range).reduce((s, n) => s + Number(n), 0) - 1) < 1e-6 &&
45
45
  typeof v.requestId === 'string' && typeof v.hand === 'string' && probability(v.equity) && probability(v.uniformEquity) &&
46
- typeof v.equityBasis === 'string' && object(v.expectedValues) && object(v.expectedValues.output) &&
46
+ typeof v.equityBasis === 'string' &&
47
47
  object(v.population) && ['fold', 'passive', 'aggressive'].every(k => probability(v.population[k])) &&
48
48
  Array.isArray(v.sizes) && v.sizes.every(x => typeof x === 'string') &&
49
49
  Array.isArray(v.weights) && v.weights.length === v.sizes.length && v.weights.every(probability);
50
50
  }
51
+ function validExploit(v) {
52
+ if (!object(v) || v.ok !== true || v.schema !== 'holdem-exploit-decision-v1' || v.units !== 'BB' ||
53
+ v.basis !== 'net_from_current_decision' || !['experimental', 'validated'].includes(String(v.status)) ||
54
+ !['25NL', '50NL', '100NL', '200NL', '500NL', '1000NL'].includes(String(v.stake)) ||
55
+ !['requestId', 'hand', 'model', 'opponentId'].every(k => typeof v[k] === 'string' && v[k].length > 0) ||
56
+ !Array.isArray(v.candidates) || v.candidates.length === 0)
57
+ return false;
58
+ const seen = new Set();
59
+ for (let i = 0; i < v.candidates.length; i++) {
60
+ const c = v.candidates[i];
61
+ if (!object(c) || !['fold', 'check', 'call', 'bet', 'raise'].includes(String(c.action)) ||
62
+ typeof c.amountAddedBB !== 'number' || !Number.isFinite(c.amountAddedBB) || c.amountAddedBB < 0 ||
63
+ typeof c.evBB !== 'number' || !Number.isFinite(c.evBB))
64
+ return false;
65
+ if (['fold', 'check'].includes(String(c.action)) ? c.amountAddedBB !== 0 : c.amountAddedBB <= 0)
66
+ return false;
67
+ if (c.action === 'fold' && c.evBB !== 0)
68
+ return false;
69
+ if (i > 0 && v.candidates[i - 1].evBB < c.evBB)
70
+ return false;
71
+ const key = `${c.action}:${c.amountAddedBB}`;
72
+ if (seen.has(key))
73
+ return false;
74
+ seen.add(key);
75
+ }
76
+ const first = v.candidates[0];
77
+ return object(v.chosenAction) && ['action', 'amountAddedBB', 'evBB'].every(k => v.chosenAction && v.chosenAction[k] === first[k]);
78
+ }
51
79
  /** Server-side client. Credentials are sent only in the x-api-key header. No automatic retries. */
52
80
  export class HoldemClient {
53
81
  defaults;
@@ -79,6 +107,15 @@ export class HoldemClient {
79
107
  validateActions(input);
80
108
  return this.post('/api/actions', input, validActions, call);
81
109
  }
110
+ /** Rank private-hand plays by EV. Currently fails with 503 until an exploit release exists. */
111
+ async exploit(input, call) {
112
+ check(input && typeof input === 'object', 'Exploit input is required');
113
+ // Actions-only defaults must never leak into the Exploit request.
114
+ const selected = { ...input, stake: input.stake ?? this.defaults.stake };
115
+ const payload = { ...selected, stake: this.selection(selected).stake };
116
+ validateExploit(payload);
117
+ return this.post('/api/exploit', payload, validExploit, call);
118
+ }
82
119
  /** Parse a live hand-history prefix on the API and request the next decision. */
83
120
  async actionsFromHistory(input, call) {
84
121
  check(input && typeof input === 'object', 'History input is required');
@@ -101,7 +138,8 @@ export class HoldemClient {
101
138
  check(['25NL', '50NL', '100NL', '200NL', '500NL', '1000NL'].includes(stake), 'Unsupported stake');
102
139
  selected.stake = stake;
103
140
  }
104
- check(selected.model === undefined || (typeof selected.model === 'string' && selected.model.trim().length > 0), 'Invalid model');
141
+ // Strip legacy JavaScript options, including constructor defaults. The server owns releases.
142
+ delete selected.model;
105
143
  return selected;
106
144
  }
107
145
  async post(path, payload, valid, call) {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAEvD,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC,MAAM,OAAO,cAAe,SAAQ,KAAK;IACM;IAAgC;IAA7E,YAAY,OAAe,EAAkB,MAAc,EAAkB,IAAa;QACxF,KAAK,CAAC,OAAO,CAAC,CAAC;QAD4B,WAAM,GAAN,MAAM,CAAQ;QAAkB,SAAI,GAAJ,IAAI,CAAS;QACxE,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAA;IAC9C,CAAC;CACF;AACD,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,OAAe,EAAE,KAAc,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAA,CAAC,CAAC;CAC/G;AACD,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAChB;IAA5B,YAA4B,MAAc;QAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAAnE,WAAM,GAAN,MAAM,CAAQ;QAAsD,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAA;IAAC,CAAC;CACpI;AACD,MAAM,MAAM,GAAG,CAAC,CAAU,EAAgC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,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CAAC;CACF"}
package/dist/types.d.ts CHANGED
@@ -15,8 +15,6 @@ export type Stake = '25NL' | '50NL' | '100NL' | '200NL' | '500NL' | '1000NL' | '
15
15
  export interface ModelOptions {
16
16
  /** Defaults to 25NL for encoded requests; detected from text histories. */
17
17
  stake?: Stake;
18
- /** Advanced: omit to use the server's population-v1 release. */
19
- model?: string;
20
18
  }
21
19
  export interface ActionsInput extends ModelOptions {
22
20
  policy: PublicPolicy;
@@ -54,18 +52,6 @@ export type ActionOutput<T> = {
54
52
  check: T;
55
53
  bet: T;
56
54
  };
57
- export interface ExpectedValues {
58
- units: 'BB';
59
- model: string;
60
- output: ActionOutput<number | null>;
61
- sizing: {
62
- size: string;
63
- paymentBB: number | null;
64
- evBB: number | null;
65
- }[];
66
- assumptions?: string[];
67
- [key: string]: unknown;
68
- }
69
55
  export interface ActionsResult {
70
56
  stake?: Stake;
71
57
  model?: string;
@@ -87,8 +73,6 @@ export interface ActionsResult {
87
73
  };
88
74
  sizes: string[];
89
75
  weights: number[];
90
- expectedValues: ExpectedValues;
91
- learnedExpectedValues?: ExpectedValues;
92
76
  opponentEquity?: {
93
77
  equity: number;
94
78
  [key: string]: unknown;
@@ -111,4 +95,29 @@ export interface ActionsResult {
111
95
  }
112
96
  export type PredictActionsInput = ActionsInput;
113
97
  export type PredictActionsResult = ActionsResult;
98
+ export interface ExploitInput extends ModelOptions {
99
+ policy: PublicPolicy;
100
+ hand: string;
101
+ }
102
+ export interface ExploitCandidate {
103
+ action: ActionType;
104
+ /** Additional payment now, not a raise-to total. */
105
+ amountAddedBB: number;
106
+ evBB: number;
107
+ }
108
+ /** Future success contract. The route currently returns EXPLOIT_MODEL_UNAVAILABLE. */
109
+ export interface ExploitResult {
110
+ ok: true;
111
+ requestId: string;
112
+ schema: 'holdem-exploit-decision-v1';
113
+ hand: string;
114
+ stake: Stake;
115
+ status: 'experimental' | 'validated';
116
+ units: 'BB';
117
+ basis: 'net_from_current_decision';
118
+ chosenAction: ExploitCandidate;
119
+ candidates: ExploitCandidate[];
120
+ model: string;
121
+ opponentId: string;
122
+ }
114
123
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,IAAI,GAAG,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,GAAG,CAAA;AACtE,MAAM,MAAM,IAAI,GAAG,GAAG,IAAI,GAAG,GAAG,GAAC,GAAG,GAAC,GAAG,GAAC,GAAG,EAAE,CAAA;AAC9C,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;AAC5D,MAAM,MAAM,UAAU,GAAG,MAAM,GAAC,OAAO,GAAC,MAAM,GAAC,KAAK,GAAC,OAAO,CAAA;AAC5D,MAAM,MAAM,WAAW,GAAG,eAAe,GAAC,kBAAkB,GAAC,eAAe,GAAC,kBAAkB,CAAA;AAC/F,6DAA6D;AAC7D,MAAM,WAAW,YAAY;IAC3B,aAAa,EAAE,8BAA8B,CAAA;IAC7C,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;IAC1B,OAAO,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAA;IACvC,SAAS,EAAE,SAAS,CAAC,CAAC,GAAC,CAAC,EAAE,CAAC,GAAC,CAAC,EAAE,CAAC,GAAC,CAAC,CAAC,CAAA;CACpC;AACD,6EAA6E;AAC7E,MAAM,MAAM,KAAK,GAAG,MAAM,GAAC,MAAM,GAAC,OAAO,GAAC,OAAO,GAAC,OAAO,GAAC,QAAQ,GAAC,OAAO,GAAC,OAAO,GAAC,QAAQ,GAAC,QAAQ,GAAC,QAAQ,GAAC,SAAS,CAAA;AACvH,MAAM,WAAW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E,CAAA;IAC9B,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAClC"}
@@ -1,4 +1,4 @@
1
- import type { ActionsInput, WeightedRange } from './types.js';
1
+ import type { ActionsInput, ExploitInput, WeightedRange } from './types.js';
2
2
  export declare class HoldemValidationError extends Error {
3
3
  constructor(message: string);
4
4
  }
@@ -7,4 +7,5 @@ export declare function amount(value: number, label: string): void;
7
7
  export declare function cards(values: readonly string[]): void;
8
8
  export declare function range(value: WeightedRange | undefined, board: readonly string[]): void;
9
9
  export declare function validateActions(input: ActionsInput): void;
10
+ export declare function validateExploit(input: ExploitInput): void;
10
11
  //# sourceMappingURL=validation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC7D,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,OAAO,EAAE,MAAM;CAC5B;AACD,wBAAgB,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAE5E;AACD,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAEzD;AACD,wBAAgB,KAAK,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAGrD;AACD,wBAAgB,KAAK,CAAC,KAAK,EAAE,aAAa,GAAC,SAAS,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAcpF;AACD,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CA0BzD"}
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC3E,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,OAAO,EAAE,MAAM;CAC5B;AACD,wBAAgB,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAE5E;AACD,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAEzD;AACD,wBAAgB,KAAK,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAGrD;AACD,wBAAgB,KAAK,CAAC,KAAK,EAAE,aAAa,GAAC,SAAS,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAcpF;AACD,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CA0BzD;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAQzD"}
@@ -66,4 +66,13 @@ export function validateActions(input) {
66
66
  if (input.style !== undefined)
67
67
  check(['tight-passive', 'tight-aggressive', 'loose-passive', 'loose-aggressive'].includes(input.style), 'Invalid style');
68
68
  }
69
+ export function validateExploit(input) {
70
+ check(input && typeof input === 'object' && Object.keys(input).every(k => ['policy', 'hand', 'stake'].includes(k)), 'Expected policy, hand, and optional stake');
71
+ check(input.policy && Object.keys(input.policy).every(k => ['schemaVersion', 'context', 'history', 'legalMask'].includes(k)), 'Invalid policy fields');
72
+ validateActions(input);
73
+ const street = input.policy.context.slice(269, 273);
74
+ const count = Array.from({ length: 5 }, (_, i) => input.policy.context.slice(i * 52, (i + 1) * 52).includes(1)).filter(Boolean).length;
75
+ check([0, 3, 4, 5].includes(count) && street.every(x => x === 0 || x === 1) && street.reduce((a, b) => a + b, 0) === 1 && street.indexOf(1) === [0, 3, 4, 5].indexOf(count), 'Board and street must agree');
76
+ check(input.policy.context[274] >= 0 && (input.policy.context[274] !== 0 || input.policy.legalMask[0] === 0), 'Folding requires a faced bet');
77
+ }
69
78
  //# sour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K,CAAC,IAAI,CAAC,EAAC,MAAM,EAAC,CAAC,EAAC,EAAE,CAAC,CAAC,EAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAC,EAAE,EAAC,CAAC,CAAC,GAAC,CAAC,CAAC,GAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAA;IAC3H,KAAK,CAAC,CAAC,CAAC,EAAC,CAAC,EAAC,CAAC,EAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,CAAS,CAAC,CAAC,EAAC,CAAC,EAAC,EAAE,CAAA,CAAC,GAAC,CAAC,EAAC,CAAC,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAC,CAAC,EAAC,CAAC,EAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,6BAA6B,CAAC,CAAA;IACvM,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,8BAA8B,CAAC,CAAA;AAChJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holdem-api/holdem-sdk",
3
- "version": "0.1.4",
3
+ "version": "0.3.0",
4
4
  "description": "Typed server-side client for Holdem API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",