@pouchy_ai/world-sdk 0.22.0 → 0.23.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,23 @@
1
1
  # @pouchy_ai/world-sdk
2
2
 
3
+ ## 0.23.0
4
+
5
+ - **`runTurn` gains `focusRoles?: string[]`** — narrow one beat to the named
6
+ roles: an interview, a one-on-one scene, a whispered aside. Before this,
7
+ every caller beat ran (and billed) every bound role up to the server cap,
8
+ and a one-on-one scene was impossible to express through the API.
9
+ - **Shrink-only.** The server intersects the focus with the bound story cast,
10
+ mirroring the event lane's subscription routing: it can never widen a beat
11
+ past the roles the story declares or past the server's own cap. A focus
12
+ that matches no bound role is refused as `no selectable role` and spends
13
+ nothing.
14
+ - Roles outside the focus are **not run and not billed**; the result's
15
+ `skippedRoles` records each as `'not focused'` — a new member of the skip
16
+ vocabulary — so the readback stays honest about who was passed over.
17
+ - Absent or empty means every bound role answers, exactly as before. No
18
+ existing call changes behaviour.
19
+ - Server-side this is world API 1.29.0.
20
+
3
21
  ## 0.22.0
4
22
 
5
23
  - **`startNextEpisode(environmentId, worldInstanceId)`** — start the next
package/README.md CHANGED
@@ -115,6 +115,23 @@ await world.runTurn({
115
115
  no single commit for a deterministic write to ride, and sending patches to one
116
116
  answers 422 rather than dropping them quietly.
117
117
 
118
+ **Focusing a beat on some of the cast.** By default every bound role answers a
119
+ beat (up to the server cap). For an interview or a one-on-one scene, pass
120
+ `focusRoles` and only those roles run — the rest are not billed and are
121
+ recorded in `skippedRoles` as `'not focused'`:
122
+
123
+ ```ts
124
+ const beat = await world.runTurn({
125
+ environmentId, worldInstanceId,
126
+ text: 'Amara, what did you see?',
127
+ focusRoles: ['amara']
128
+ });
129
+ ```
130
+
131
+ Shrink-only: the server intersects the focus with the bound story cast, so it
132
+ can never widen a beat, and a focus matching no bound role is refused as
133
+ `no selectable role` without spending anything.
134
+
118
135
  **Resuming after a crash.** `getTurn` returns the same fields the live result
119
136
  did — `nextOptions` included — so a recovered session can offer the audience
120
137
  the choices it was about to. To catch up on beats you missed entirely, store
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.22.0";
7
+ export declare const WORLD_SDK_VERSION = "0.23.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. */
@@ -1320,6 +1320,15 @@ export declare class PouchyWorldClient {
1320
1320
  turnId?: string;
1321
1321
  text: string;
1322
1322
  sourceRoleId?: string;
1323
+ /** Narrow this beat to the named roles — an interview, a one-on-one
1324
+ * scene, a whispered aside. Shrink-only: the server intersects it with
1325
+ * the bound story cast, so it can never widen the beat past the roles
1326
+ * the story declares or the server's own cap. Roles outside the focus
1327
+ * are not run and not billed; they appear in the result's
1328
+ * `skippedRoles` as `'not focused'`. A focus that matches no bound
1329
+ * role is refused as "no selectable role" and spends nothing. Absent
1330
+ * or empty means every bound role answers, exactly as before. */
1331
+ focusRoles?: readonly string[];
1323
1332
  traceId?: string;
1324
1333
  /** PROVIDER-authored state changes, committed with this beat.
1325
1334
  *
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.22.0';
26
+ export const WORLD_SDK_VERSION = '0.23.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
@@ -700,6 +700,7 @@ export class PouchyWorldClient {
700
700
  kind: 'user',
701
701
  text: input.text,
702
702
  ...(input.sourceRoleId ? { sourceRoleId: input.sourceRoleId } : {}),
703
+ ...(input.focusRoles?.length ? { focusRoles: [...input.focusRoles] } : {}),
703
704
  ...(input.proposedPatches ? { proposedPatches: input.proposedPatches } : {})
704
705
  },
705
706
  ...(input.traceId ? { traceId: input.traceId } : {})
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pouchy_ai/world-sdk",
3
- "version": "0.22.0",
3
+ "version": "0.23.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",