pyyol 1.10.0 → 1.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -26,7 +26,7 @@ export type { TracerOptions, ModelCall, MoveUsage, UsageAdd } from "./telemetry.
26
26
  export { instrument, uninstrument, recordResponse, extractUsage, patchPrototype } from "./instrument.js";
27
27
  export { route, enableGateway, disableGateway, gatewayBaseUrl, gatewayHeaders } from "./instrument.js";
28
28
  export type { ExtractedUsage } from "./instrument.js";
29
- export { estimateCost, rateFor, isKnown, canonical, PRICING_VERSION } from "./pricing.js";
30
- export { moveTool, moveToolChoice, moveToolName, moveFromResponse, boundMove, boundPlan, canonPlan, PLAN_KEY, MAX_SPAN_ROUNDS, canonMove, canonGoofspiel, canonMafia, canonMonopoly, NO_TARGET, TOOL_GOOFSPIEL, TOOL_MAFIA, TOOL_MONOPOLY, GAME_GOOFSPIEL, GAME_MAFIA, GAME_MONOPOLY, } from "./movetools.js";
29
+ export { estimateCost, rateFor, isKnown, canonical, cacheWriteRate, PRICING_VERSION, } from "./pricing.js";
30
+ export { moveTool, moveToolChoice, moveToolName, moveFromResponse, boundMove, boundPlan, canonPlan, promptFor, PLAN_KEY, MAX_SPAN_ROUNDS, canonMove, canonGoofspiel, canonMafia, canonMonopoly, NO_TARGET, TOOL_GOOFSPIEL, TOOL_MAFIA, TOOL_MONOPOLY, GAME_GOOFSPIEL, GAME_MAFIA, GAME_MONOPOLY, } from "./movetools.js";
31
31
  export type { Rate, CostArgs } from "./pricing.js";
32
32
  export { fingerprint as scaffoldFingerprint, fromRequest as scaffoldFromRequest, eligibleForPairing as scaffoldEligibleForPairing, SCAFFOLD_VERSION, } from "./scaffold.js";
package/dist/index.js CHANGED
@@ -20,14 +20,19 @@ export { gameRules } from "./rules.js";
20
20
  export { Tracer, Span, currentSpan, matchTraceId, currentUsage, UsageAccumulator, runTurnUsage } from "./telemetry.js";
21
21
  export { instrument, uninstrument, recordResponse, extractUsage, patchPrototype } from "./instrument.js";
22
22
  export { route, enableGateway, disableGateway, gatewayBaseUrl, gatewayHeaders } from "./instrument.js";
23
- export { estimateCost, rateFor, isKnown, canonical, PRICING_VERSION } from "./pricing.js";
23
+ // cacheWriteRate was defined and used internally but never re-exported, so "what will a cache
24
+ // write cost me?" was answerable in Python and not here. Cache writes bill at a premium, which
25
+ // makes it exactly the rate a developer wants to check before enabling caching.
26
+ export { estimateCost, rateFor, isKnown, canonical, cacheWriteRate, PRICING_VERSION, } from "./pricing.js";
24
27
  // Structured move tools: how an agent proves its MODEL chose the move it played. Routing
25
28
  // through the gateway proves a call happened for a turn; a tool call is what proves the
26
29
  // model's answer became the move. See src/movetools.ts.
27
30
  export { moveTool, moveToolChoice, moveToolName, moveFromResponse, boundMove,
28
31
  // Range bindings: one completion that decided several rounds. Coverage counts DECISIONS a
29
32
  // model made, not calls, so batching no longer costs an agent its verified share.
30
- boundPlan, canonPlan, PLAN_KEY, MAX_SPAN_ROUNDS, canonMove, canonGoofspiel, canonMafia, canonMonopoly, NO_TARGET, TOOL_GOOFSPIEL, TOOL_MAFIA, TOOL_MONOPOLY, GAME_GOOFSPIEL, GAME_MAFIA, GAME_MONOPOLY, } from "./movetools.js";
33
+ boundPlan, canonPlan,
34
+ // Renders a turn view as a prompt the move tools expect. Parity with Python's prompt_for.
35
+ promptFor, PLAN_KEY, MAX_SPAN_ROUNDS, canonMove, canonGoofspiel, canonMafia, canonMonopoly, NO_TARGET, TOOL_GOOFSPIEL, TOOL_MAFIA, TOOL_MONOPOLY, GAME_GOOFSPIEL, GAME_MAFIA, GAME_MONOPOLY, } from "./movetools.js";
31
36
  // Scaffold fingerprinting: the harness identity that makes a paired model comparison
32
37
  // possible (same scaffold, different model). Exported so a developer can print their own
33
38
  // fingerprint and confirm it is stable before relying on it.
@@ -139,3 +139,16 @@ export declare function canonPlan(game: string, args: Record<string, unknown> |
139
139
  * intend to submit, the match will reject it.
140
140
  */
141
141
  export declare function boundPlan(game: string, resp: unknown, provenRound: number): RoundMove[] | null;
142
+ /**
143
+ * A minimal, honest description of the turn, for agents that want a starting point.
144
+ *
145
+ * Deliberately plain. Nothing about the prompt is checked or scored, and a helper that implied
146
+ * otherwise would mislead — this exists so the tool-call example is runnable, not because the
147
+ * platform has a preferred prompt.
148
+ *
149
+ * Mirrors Python's `prompt_for`. It was missing here while Python shipped it, which is the kind
150
+ * of gap that turns "the SDKs are equivalent" into something a developer discovers is false
151
+ * halfway through a port. The STRING is identical in both languages so a paired comparison of
152
+ * the same scaffold across SDKs is not silently comparing two different prompts.
153
+ */
154
+ export declare function promptFor(view: unknown): string;
package/dist/movetools.js CHANGED
@@ -484,3 +484,47 @@ function planEntries(args) {
484
484
  export function boundPlan(game, resp, provenRound) {
485
485
  return canonPlan(game, moveFromResponse(game, resp), provenRound);
486
486
  }
487
+ /**
488
+ * A minimal, honest description of the turn, for agents that want a starting point.
489
+ *
490
+ * Deliberately plain. Nothing about the prompt is checked or scored, and a helper that implied
491
+ * otherwise would mislead — this exists so the tool-call example is runnable, not because the
492
+ * platform has a preferred prompt.
493
+ *
494
+ * Mirrors Python's `prompt_for`. It was missing here while Python shipped it, which is the kind
495
+ * of gap that turns "the SDKs are equivalent" into something a developer discovers is false
496
+ * halfway through a port. The STRING is identical in both languages so a paired comparison of
497
+ * the same scaffold across SDKs is not silently comparing two different prompts.
498
+ */
499
+ export function promptFor(view) {
500
+ let body;
501
+ try {
502
+ body = JSON.stringify(viewObject(view)) ?? String(view);
503
+ }
504
+ catch {
505
+ body = String(view);
506
+ }
507
+ return ("You are playing a match in the Pyyol arena. Here is your view of the current turn:\n" +
508
+ body +
509
+ "\n\nDecide your move and report it by calling the provided tool. Do not answer in prose.");
510
+ }
511
+ /** The plain object behind a view, however the caller's SDK models it. */
512
+ function viewObject(view) {
513
+ if (view === null || typeof view !== "object")
514
+ return view;
515
+ // Mirrors the Python helper's attempt order: an explicit serializer wins over the raw fields.
516
+ for (const name of ["toDict", "toJSON", "modelDump"]) {
517
+ const fn = view[name];
518
+ if (typeof fn === "function") {
519
+ try {
520
+ const out = fn.call(view);
521
+ if (out !== null && typeof out === "object")
522
+ return out;
523
+ }
524
+ catch {
525
+ // A helper must never break a turn.
526
+ }
527
+ }
528
+ }
529
+ return view;
530
+ }
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.10.0";
1
+ export declare const SDK_VERSION = "1.10.1";
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // GENERATED by scripts/genversion.mjs — do not edit by hand.
2
2
  // Source of truth is the "version" field in package.json.
3
- export const SDK_VERSION = "1.10.0";
3
+ export const SDK_VERSION = "1.10.1"; // x-release-please-version
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pyyol",
3
- "version": "1.10.0",
3
+ "version": "1.10.1",
4
4
  "description": "Official JS/TS SDK for pyyol — run AI game-playing agents locally over a WebSocket (Beta)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",