@umicat/platform-sdk 0.1.0 → 0.2.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/README.md CHANGED
@@ -4,10 +4,13 @@ The engine-neutral half of the Umicat game SDK. Identity, cloud saves, shared
4
4
  game data, multiplayer rooms, runtime AI, voice input and scripted dialogue —
5
5
  none of which care how pixels get on screen.
6
6
 
7
- **Status: extracted and verified, not yet adopted.** `@umicat/phaser-sdk` still
8
- ships its own copies; the swap is proven safe by `scripts/verify-swap.mjs` but
9
- has not been applied, because applying it requires publishing this package to
10
- npm first. Nothing in production consumes this yet.
7
+ **Status: adopted.** `@umicat/phaser-sdk@1.0.91` consumes this package — the
8
+ platform code exists in one place again. `@umicat/three-sdk` consumes it too.
9
+
10
+ `scripts/verify-swap.mjs` is now a regression guard rather than a migration
11
+ plan: it still copies both repos to scratch, applies the swap from scratch, and
12
+ asserts the Phaser SDK exports the same 105 names and passes its whole suite.
13
+ Run it after changing anything in here.
11
14
 
12
15
  ## Why it exists
13
16
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export { UmicatCore } from './core/UmicatCore.js';
2
2
  export type { UmicatInitOptions } from './core/UmicatCore.js';
3
+ export { ORIENTATION_DIMENSIONS } from './orientation.js';
4
+ export type { Orientation } from './orientation.js';
3
5
  export { RpcError } from './core/Transport.js';
4
6
  export type { Transport, TransportKind } from './core/Transport.js';
5
7
  export { PostMessageTransport } from './core/transports/PostMessageTransport.js';
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@
4
4
  // three.js, or by something we have not chosen yet. Anything that needs to
5
5
  // know how pixels get on screen belongs in a runtime package, not here.
6
6
  export { UmicatCore } from './core/UmicatCore.js';
7
+ export { ORIENTATION_DIMENSIONS } from './orientation.js';
7
8
  export { RpcError } from './core/Transport.js';
8
9
  export { PostMessageTransport } from './core/transports/PostMessageTransport.js';
9
10
  export { LocalStorageTransport } from './core/transports/LocalStorageTransport.js';
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The canvas shape a game is authored for.
3
+ *
4
+ * Platform data, not engine data: it is the contract between the host surface
5
+ * and the game about what shape the play area is, and it reads the same whether
6
+ * the game is drawn by Phaser, by three.js, or by something later. The value is
7
+ * chosen at game creation and is immutable afterwards — every scene is laid out
8
+ * against it, so switching mid-development breaks layouts.
9
+ *
10
+ * `@umicat/phaser-sdk` still carries its own copy of these six lines (it
11
+ * predates this package). Consolidating it there is a safe cleanup for whenever
12
+ * that package is next touched; it is frozen data, so the drift risk is low.
13
+ */
14
+ export type Orientation = 'portrait' | 'landscape';
15
+ export declare const ORIENTATION_DIMENSIONS: Record<Orientation, {
16
+ width: number;
17
+ height: number;
18
+ }>;
@@ -0,0 +1,4 @@
1
+ export const ORIENTATION_DIMENSIONS = {
2
+ landscape: { width: 1280, height: 720 },
3
+ portrait: { width: 720, height: 1280 },
4
+ };
@@ -202,6 +202,20 @@ export interface AiActSuccess {
202
202
  export interface AiActFailure {
203
203
  ok: false;
204
204
  reason: AiReason;
205
+ /**
206
+ * The platform's own sentence about why, when it has one worth reading.
207
+ *
208
+ * Set by the host for a deliberate 4xx the backend explained — today that
209
+ * is overwhelmingly `UNAVAILABLE` from a 403 because the game has not
210
+ * declared the `ai` capability in its Settings. It exists because the
211
+ * reason codes are for the GAME to branch on, and none of them can tell a
212
+ * creator what to go and fix.
213
+ *
214
+ * Human-readable, English, written by the platform for the person holding
215
+ * the device — not localized, not a stable identifier, and never something
216
+ * to branch on. Show it when you have nothing better to say.
217
+ */
218
+ detail?: string;
205
219
  }
206
220
  export type AiActResult = AiActSuccess | AiActFailure;
207
221
  export interface AiCompleteParams {
@@ -225,6 +239,8 @@ export interface AiCompleteSuccess {
225
239
  export interface AiCompleteFailure {
226
240
  ok: false;
227
241
  reason: AiReason;
242
+ /** As `AiActFailure.detail`. */
243
+ detail?: string;
228
244
  }
229
245
  export type AiCompleteResult = AiCompleteSuccess | AiCompleteFailure;
230
246
  export interface RealtimeGetTokenParams {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umicat/platform-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "Umicat's platform layer, independent of any rendering engine: identity, cloud saves, shared game data, multiplayer, runtime AI, voice and scripted dialogue. Consumed by @umicat/phaser-sdk and @umicat/three-sdk alike.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -45,4 +45,4 @@
45
45
  "type": "git",
46
46
  "url": "umicat-platform-sdk"
47
47
  }
48
- }
48
+ }