@pouchy_ai/world-sdk 0.30.0 → 0.31.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/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @pouchy_ai/world-sdk
2
2
 
3
+ ## 0.31.0
4
+
5
+ - **`WorldStateView`** — `getWorldState().state` is typed, instead of
6
+ `Record<string, unknown>`. The same shape is published in the world OpenAPI
7
+ (it said `anyObj`), and a census derives the field list from the projection
8
+ itself so the document and the runtime cannot drift.
9
+
10
+ Asked by an integrator building highlight triggers who needed three things
11
+ from `state` and could not answer any of them from anything published. They
12
+ declined to guess the keys from one live call, on the grounds that a key
13
+ which is merely PRESENT is a feature that vanishes silently on some later
14
+ change — and the symptom would have been "highlights stopped firing", with no
15
+ error. The prose that was there had already drifted: it never mentioned
16
+ `completedNodes`, which is exactly the field they concluded did not exist.
17
+
18
+ Two answers that surprise people, both because `getProgress` beside it
19
+ filters differently:
20
+
21
+ - **`flags` is EVERY flag**, not only those an author marked `public: true`.
22
+ That filter belongs to the progress checkpoint, whose audience is a
23
+ player's client. This door is the operator's, so forwarding these bytes to
24
+ a reader — including the spoiler risk in a flag's NAME — is your decision.
25
+ - **`completedNodes` gives node IDS.** The checkpoint reports only
26
+ `completedNodeCount` and says outright it is not a denominator.
27
+
28
+ Also additive on the envelope: `environmentId` and `storyPackageRef` are
29
+ returned by the route and were named in neither plane's document.
30
+
3
31
  ## 0.30.0
4
32
 
5
33
  - **`SKIP_COST_MODEL_VERSION` / `SKIP_COST_MODEL_DIGEST`** — the cost model's
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * a project is running — which is exactly the field you reach for when a
5
5
  * customer's integration behaves like an older SDK than they say they have.
6
6
  * It sat at '0.1.0' for eight releases before anything compared the two. */
7
- export declare const WORLD_SDK_VERSION = "0.30.0";
7
+ export declare const WORLD_SDK_VERSION = "0.31.0";
8
8
  export declare const DEFAULT_BASE_URL = "https://pouchy.ai/v1";
9
9
  /** One direction a beat could take. The WHOLE of what a deliberation shows a
10
10
  * player: no reasoning, no role secrets, no simulated effects, no scores. */
@@ -526,6 +526,43 @@ export interface EditorialDraftRow {
526
526
  * purpose: one word answering both is how a delivery outage reads as a
527
527
  * content problem. */
528
528
  /** The shared refusal taxonomy (Batch 7). Only `narrative_conflict` is content. */
529
+ /** The USER projection of world state — what `getWorldState` returns.
530
+ *
531
+ * Typed from 0.31.0. Before that it was `Record<string, unknown>`, and an
532
+ * integrator building highlight triggers could not answer three basic
533
+ * questions from anything published — the spec said `anyObj` and its prose
534
+ * summary had drifted, omitting `completedNodes` entirely. They declined to
535
+ * guess the keys from one live call, on the grounds that a key which is merely
536
+ * PRESENT is a feature that disappears silently later. They were right, and
537
+ * this is the fix.
538
+ *
539
+ * TWO THINGS THAT SURPRISE PEOPLE, both because the progress checkpoint beside
540
+ * this filters differently:
541
+ *
542
+ * - `flags` is EVERY flag, not only those an author marked `public: true`.
543
+ * That filter belongs to `getProgress`, whose audience is a player's client.
544
+ * This door is the operator's — if you forward these bytes to a reader, the
545
+ * decision (and the spoiler risk in a flag's NAME) is yours.
546
+ * - `completedNodes` gives the node IDS. The checkpoint reports only
547
+ * `completedNodeCount`, and says outright that it is not a denominator.
548
+ *
549
+ * The role-private layer is never here. */
550
+ export interface WorldStateView {
551
+ stateRevision: number;
552
+ clock: number;
553
+ sceneId?: string;
554
+ location?: string;
555
+ flags: Record<string, boolean | number | string>;
556
+ completedNodes: string[];
557
+ factsVisible: string[];
558
+ relations: Record<string, string>;
559
+ entities: Record<string, string>;
560
+ lastEntries: Array<{
561
+ entryId: string;
562
+ kind: string;
563
+ at: number;
564
+ }>;
565
+ }
529
566
  export type WorldRejectionCode = 'narrative_conflict' | 'policy_rejection' | 'schema_rejection' | 'canon_rejection' | 'concurrency_rejection' | 'repair_failure';
530
567
  /** WHY a role that was in the cast did not speak — the machine half of
531
568
  * `skippedRoles[].reason`, added 2026-09-09.
@@ -1166,7 +1203,7 @@ export declare class PouchyWorldClient {
1166
1203
  getWorldState(environmentId: string, worldInstanceId: string): Promise<{
1167
1204
  worldInstanceId: string;
1168
1205
  environmentRevision: number;
1169
- state: Record<string, unknown>;
1206
+ state: WorldStateView;
1170
1207
  }>;
1171
1208
  /** What this world's own record proves about itself. World API 1.19.
1172
1209
  *
package/dist/index.js CHANGED
@@ -23,7 +23,7 @@ import { createHash, createHmac, randomUUID } from 'node:crypto';
23
23
  * a project is running — which is exactly the field you reach for when a
24
24
  * customer's integration behaves like an older SDK than they say they have.
25
25
  * It sat at '0.1.0' for eight releases before anything compared the two. */
26
- export const WORLD_SDK_VERSION = '0.30.0';
26
+ export const WORLD_SDK_VERSION = '0.31.0';
27
27
  export const DEFAULT_BASE_URL = 'https://pouchy.ai/v1';
28
28
  /** Read the commit turn id out of an envelope, so the signature covers the id
29
29
  * the server will commit under. The payload half is base64url JSON; the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pouchy_ai/world-sdk",
3
- "version": "0.30.0",
3
+ "version": "0.31.0",
4
4
  "description": "Server-side TypeScript client for Pouchy World \u2014 story packages, world definitions, world sessions, coordinated turns, trusted events, replay verification and script drafts. Node only: it holds a project Secret Key and a source signing key, which never belong in a browser or a mobile app.",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE",