@gatherround/sdk 0.4.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.
Files changed (56) hide show
  1. package/dist/adapters/i-client-adapter.d.ts +45 -0
  2. package/dist/adapters/i-client-adapter.d.ts.map +1 -0
  3. package/dist/adapters/i-client-adapter.js +9 -0
  4. package/dist/adapters/i-client-adapter.js.map +1 -0
  5. package/dist/adapters/i-content-adapter.d.ts +23 -0
  6. package/dist/adapters/i-content-adapter.d.ts.map +1 -0
  7. package/dist/adapters/i-content-adapter.js +9 -0
  8. package/dist/adapters/i-content-adapter.js.map +1 -0
  9. package/dist/adapters/i-controller-transport.d.ts +31 -0
  10. package/dist/adapters/i-controller-transport.d.ts.map +1 -0
  11. package/dist/adapters/i-controller-transport.js +9 -0
  12. package/dist/adapters/i-controller-transport.js.map +1 -0
  13. package/dist/adapters/i-session-adapter.d.ts +42 -0
  14. package/dist/adapters/i-session-adapter.d.ts.map +1 -0
  15. package/dist/adapters/i-session-adapter.js +9 -0
  16. package/dist/adapters/i-session-adapter.js.map +1 -0
  17. package/dist/controller-message.d.ts +59 -0
  18. package/dist/controller-message.d.ts.map +1 -0
  19. package/dist/controller-message.js +8 -0
  20. package/dist/controller-message.js.map +1 -0
  21. package/dist/display-instruction.d.ts +81 -0
  22. package/dist/display-instruction.d.ts.map +1 -0
  23. package/dist/display-instruction.js +8 -0
  24. package/dist/display-instruction.js.map +1 -0
  25. package/dist/index.d.ts +18 -0
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/index.js +9 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/runtime-assets.d.ts +17 -0
  30. package/dist/runtime-assets.d.ts.map +1 -0
  31. package/dist/runtime-assets.js +8 -0
  32. package/dist/runtime-assets.js.map +1 -0
  33. package/dist/runtime-episode.d.ts +84 -0
  34. package/dist/runtime-episode.d.ts.map +1 -0
  35. package/dist/runtime-episode.js +8 -0
  36. package/dist/runtime-episode.js.map +1 -0
  37. package/dist/runtime-strings.d.ts +12 -0
  38. package/dist/runtime-strings.d.ts.map +1 -0
  39. package/dist/runtime-strings.js +8 -0
  40. package/dist/runtime-strings.js.map +1 -0
  41. package/dist/runtime-types.d.ts +68 -0
  42. package/dist/runtime-types.d.ts.map +1 -0
  43. package/dist/runtime-types.js +8 -0
  44. package/dist/runtime-types.js.map +1 -0
  45. package/package.json +35 -0
  46. package/src/adapters/i-client-adapter.ts +63 -0
  47. package/src/adapters/i-content-adapter.ts +28 -0
  48. package/src/adapters/i-controller-transport.ts +35 -0
  49. package/src/adapters/i-session-adapter.ts +67 -0
  50. package/src/controller-message.ts +82 -0
  51. package/src/display-instruction.ts +105 -0
  52. package/src/index.ts +81 -0
  53. package/src/runtime-assets.ts +18 -0
  54. package/src/runtime-episode.ts +109 -0
  55. package/src/runtime-strings.ts +12 -0
  56. package/src/runtime-types.ts +84 -0
@@ -0,0 +1,68 @@
1
+ /**
2
+ * runtime-types.ts
3
+ *
4
+ * Node-level runtime types: nodes, transitions, conditions, mutations.
5
+ * These define the structure of individual story graph nodes within a RuntimeEpisode.
6
+ */
7
+ export interface RuntimeNode {
8
+ id: string;
9
+ kind: string;
10
+ /** Author's label for this node (debugging / game-log use). */
11
+ label?: string;
12
+ /**
13
+ * Kind-specific payload. Shape varies by kind:
14
+ * play_video: { url, loop, pipTarget, onPlay, timeEvents }
15
+ * hero_action: { prompt, choices: { text, mutations? }[], targetRoles, timer? }
16
+ * trigger_qte: { text, timeLimit, targetRoles, qteType, difficulty }
17
+ * vote: { prompt, options, timeLimit, tallyMode, targetRoles }
18
+ * explore: { options: { text, image?, showOnce }[], target_roles, locationLabel?, locationImage? }
19
+ * set_variable: absent (uses mutations)
20
+ * logic: absent (uses conditions + mutations)
21
+ * end_episode: absent (terminal node — no payload, no transitions)
22
+ */
23
+ payload?: Record<string, unknown>;
24
+ /** Logic-kind conditions — evaluated top-to-bottom, first match wins.
25
+ * Each element is a branch: either a single RuntimeCondition (legacy)
26
+ * or a RuntimeConditionGroup (compound boolean logic). */
27
+ conditions?: (RuntimeCondition | RuntimeConditionGroup)[];
28
+ /** Variable mutations — executed on node entry. */
29
+ mutations?: RuntimeMutation[];
30
+ /** Compiled transitions from graph edges. */
31
+ transitions: RuntimeTransition[];
32
+ }
33
+ export interface RuntimeTransition {
34
+ /** The event that fires this transition. */
35
+ on: string;
36
+ /** For choice-based transitions: index into the choices array. */
37
+ choiceIndex?: number;
38
+ /** For condition-based transitions: index into the conditions array. */
39
+ conditionIndex?: number;
40
+ /** For cue-based transitions: index into the timeEvents array. */
41
+ cueIndex?: number;
42
+ /** For exit-based transitions: index into the exits array (explore node). */
43
+ exitIndex?: number;
44
+ /** Destination node ID. */
45
+ target: string;
46
+ }
47
+ export interface RuntimeCondition {
48
+ variable: string;
49
+ operator: "eq" | "neq" | "gt" | "lt" | "gte" | "lte";
50
+ value: string | number | boolean;
51
+ }
52
+ /**
53
+ * A compound condition branch — multiple atomic conditions combined with
54
+ * a boolean operator (AND/OR) or an arbitrary formula.
55
+ */
56
+ export interface RuntimeConditionGroup {
57
+ conditions: RuntimeCondition[];
58
+ /** "and" | "or" — uniform inline join. "formula" — uses the `formula` field. */
59
+ mode: "and" | "or" | "formula";
60
+ /** Boolean formula string (e.g. "(A & B) | !C"). Only present when mode === "formula". */
61
+ formula?: string;
62
+ }
63
+ export interface RuntimeMutation {
64
+ target: string;
65
+ operation: "set" | "increment" | "decrement";
66
+ value: string | number | boolean;
67
+ }
68
+ //# sourceMappingURL=runtime-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-types.d.ts","sourceRoot":"","sources":["../src/runtime-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAElC;;+DAE2D;IAC3D,UAAU,CAAC,EAAE,CAAC,gBAAgB,GAAG,qBAAqB,CAAC,EAAE,CAAC;IAE1D,mDAAmD;IACnD,SAAS,CAAC,EAAE,eAAe,EAAE,CAAC;IAE9B,6CAA6C;IAC7C,WAAW,EAAE,iBAAiB,EAAE,CAAC;CAClC;AAID,MAAM,WAAW,iBAAiB;IAChC,4CAA4C;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,kEAAkE;IAClE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2BAA2B;IAC3B,MAAM,EAAE,MAAM,CAAC;CAChB;AAID,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,CAAC;IACrD,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;CAClC;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,gBAAgB,EAAE,CAAC;IAC/B,gFAAgF;IAChF,IAAI,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,CAAC;IAC/B,0FAA0F;IAC1F,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAID,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,KAAK,GAAG,WAAW,GAAG,WAAW,CAAC;IAC7C,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;CAClC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * runtime-types.ts
3
+ *
4
+ * Node-level runtime types: nodes, transitions, conditions, mutations.
5
+ * These define the structure of individual story graph nodes within a RuntimeEpisode.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=runtime-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-types.js","sourceRoot":"","sources":["../src/runtime-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@gatherround/sdk",
3
+ "version": "0.4.1",
4
+ "description": "Shared types, interfaces, and JSON schemas for the Gather Round ecosystem",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "src"
17
+ ],
18
+ "scripts": {
19
+ "build": "tsc",
20
+ "clean": "rimraf dist",
21
+ "prepublishOnly": "npm run build"
22
+ },
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "https://github.com/stremblay4/gather-round-sdk.git"
26
+ },
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "license": "UNLICENSED",
31
+ "devDependencies": {
32
+ "typescript": "^5.8.0",
33
+ "rimraf": "^6.0.0"
34
+ }
35
+ }
@@ -0,0 +1,63 @@
1
+ /**
2
+ * i-client-adapter.ts
3
+ *
4
+ * TV engine ↔ platform adapter for session lifecycle and messaging.
5
+ * The TV app uses this to create sessions, send display instructions
6
+ * to phone controllers, and receive controller messages.
7
+ */
8
+
9
+ import type { ControllerMessage } from "../controller-message.js";
10
+ import type { DisplayInstruction } from "../display-instruction.js";
11
+
12
+ // ── Supporting types ────────────────────────────────────────────────────────
13
+
14
+ export interface GameSessionOptions {
15
+ /** Published episode ID to play. */
16
+ episodeId: string;
17
+ /** Published version ID (optional — uses latest if omitted). */
18
+ versionId?: string;
19
+ /** Maximum number of players (excluding the TV host). */
20
+ maxPlayers: number;
21
+ }
22
+
23
+ export interface GameSessionResult {
24
+ /** Unique session identifier. */
25
+ sessionId: string;
26
+ /** Short alphanumeric code for manual entry (e.g. "A3F9K2"). */
27
+ sessionCode: string;
28
+ /** Full URL for phone controller join (embedded in QR code). */
29
+ controllerUrl: string;
30
+ }
31
+
32
+ export interface PlayerSessionResult {
33
+ /** The player's unique ID within this session. */
34
+ playerId: string;
35
+ /** The session they joined. */
36
+ sessionId: string;
37
+ }
38
+
39
+ // ── Adapter interface ───────────────────────────────────────────────────────
40
+
41
+ /**
42
+ * Engine-side adapter for session management and bidirectional messaging.
43
+ */
44
+ export interface IClientAdapter {
45
+ // ── Session lifecycle ─────────────────────────────────────────────────
46
+ createGameSession(options: GameSessionOptions): Promise<GameSessionResult>;
47
+ joinGameSession(sessionId: string): Promise<PlayerSessionResult>;
48
+ disconnect(): void;
49
+
50
+ // ── Outbound: TV engine → phone controller(s) ────────────────────────
51
+ sendToController(
52
+ playerId: string,
53
+ instruction: DisplayInstruction,
54
+ ): Promise<void>;
55
+ broadcastToAll(instruction: DisplayInstruction): Promise<void>;
56
+
57
+ // ── Inbound: phone controller → TV engine ────────────────────────────
58
+ onControllerMessage(
59
+ cb: (playerId: string, message: ControllerMessage) => void,
60
+ ): void;
61
+ onPlayerConnected(cb: (playerId: string) => void): void;
62
+ onPlayerDisconnected(cb: (playerId: string) => void): void;
63
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * i-content-adapter.ts
3
+ *
4
+ * TV engine ↔ episode content adapter.
5
+ * Resolves published episode JSON from whatever storage backend is active
6
+ * (Firestore registry → GCS for GRG, embedded build for Luna, etc.).
7
+ */
8
+
9
+ import type { RuntimeEpisode } from "../runtime-episode.js";
10
+
11
+ /**
12
+ * Adapter for loading published episode content at runtime.
13
+ */
14
+ export interface IContentAdapter {
15
+ /**
16
+ * Fetch the latest published episode.
17
+ * Resolution: platform registry → storage path → parsed JSON.
18
+ */
19
+ loadEpisode(episodeId: string): Promise<RuntimeEpisode>;
20
+
21
+ /**
22
+ * Fetch a specific published version (for rollback / pinned builds).
23
+ */
24
+ loadEpisodeVersion(
25
+ episodeId: string,
26
+ versionId: string,
27
+ ): Promise<RuntimeEpisode>;
28
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * i-controller-transport.ts
3
+ *
4
+ * Controller-side transport interface.
5
+ * The phone controller app uses this to communicate with the TV game engine.
6
+ * GRG implements this over Firebase RTDB; Luna uses GameLift Realtime JS SDK.
7
+ */
8
+
9
+ import type { ControllerMessage } from "../controller-message.js";
10
+ import type { DisplayInstruction } from "../display-instruction.js";
11
+
12
+ /**
13
+ * Transport layer for phone controller ↔ TV engine communication.
14
+ */
15
+ export interface IControllerTransport {
16
+ /**
17
+ * Connect to an active session (called after scanning QR / reading URL param).
18
+ */
19
+ joinSession(sessionId: string): Promise<void>;
20
+
21
+ /**
22
+ * Send a player input event to the TV engine.
23
+ */
24
+ sendInput(message: ControllerMessage): Promise<void>;
25
+
26
+ /**
27
+ * Register a callback for display instructions from the TV engine.
28
+ */
29
+ onDisplayInstruction(cb: (instruction: DisplayInstruction) => void): void;
30
+
31
+ /**
32
+ * Tear down transport connection.
33
+ */
34
+ disconnect(): void;
35
+ }
@@ -0,0 +1,67 @@
1
+ /**
2
+ * i-session-adapter.ts
3
+ *
4
+ * TV engine ↔ session persistence adapter.
5
+ * Manages game session state (variables, scene checkpoints) in whatever
6
+ * persistence layer the platform provides (RTDB for GRG, save system for Luna, etc.).
7
+ */
8
+
9
+ // ── Supporting types ────────────────────────────────────────────────────────
10
+
11
+ export interface PlayerConfig {
12
+ /** Player's unique ID (e.g. Firebase UID). */
13
+ playerId: string;
14
+ /** Display name. */
15
+ name: string;
16
+ /** Assigned hero role slot (0 = host, 1–4 = players). */
17
+ role: number;
18
+ }
19
+
20
+ /**
21
+ * Runtime variable state for an episode session.
22
+ * Keys are variable names; values are their current runtime values.
23
+ */
24
+ export type EpisodeVariables = Record<string, boolean | number | string>;
25
+
26
+ /**
27
+ * Serializable checkpoint for a scene's execution state.
28
+ * Shape is intentionally loose — the engine defines what goes in here.
29
+ */
30
+ export interface SceneCheckpoint {
31
+ /** Current node ID within the scene. */
32
+ currentNodeId: string;
33
+ /** Any additional engine state needed to resume. */
34
+ [key: string]: unknown;
35
+ }
36
+
37
+ // ── Adapter interface ───────────────────────────────────────────────────────
38
+
39
+ /**
40
+ * Engine-side adapter for session state persistence.
41
+ */
42
+ export interface ISessionAdapter {
43
+ createSession(
44
+ episodeId: string,
45
+ players: PlayerConfig[],
46
+ ): Promise<string>;
47
+
48
+ getSessionVariables(sessionId: string): Promise<EpisodeVariables>;
49
+
50
+ updateSessionVariables(
51
+ sessionId: string,
52
+ vars: Partial<EpisodeVariables>,
53
+ ): Promise<void>;
54
+
55
+ saveSceneState(
56
+ sessionId: string,
57
+ sceneId: string,
58
+ state: SceneCheckpoint,
59
+ ): Promise<void>;
60
+
61
+ loadSceneState(
62
+ sessionId: string,
63
+ sceneId: string,
64
+ ): Promise<SceneCheckpoint | null>;
65
+
66
+ advanceScene(sessionId: string, nextSceneId: string): Promise<void>;
67
+ }
@@ -0,0 +1,82 @@
1
+ /**
2
+ * controller-message.ts
3
+ *
4
+ * Phone → TV typed event union.
5
+ * Sent by the phone controller to the TV game engine via IControllerTransport.sendInput().
6
+ */
7
+
8
+ // ── Individual message types ────────────────────────────────────────────────
9
+
10
+ export interface HeroSelected {
11
+ type: "HeroSelected";
12
+ /** The hero role slot chosen by this player. */
13
+ role: number;
14
+ }
15
+
16
+ export interface QTEResponse {
17
+ type: "QTEResponse";
18
+ /** Whether the player succeeded the QTE within the time limit. */
19
+ success: boolean;
20
+ /** Reaction time in milliseconds, or null if timed out. */
21
+ reactionTimeMs: number | null;
22
+ }
23
+
24
+ export interface ChoiceSelected {
25
+ type: "ChoiceSelected";
26
+ /** Index into the node's choices array. */
27
+ choiceIndex: number;
28
+ }
29
+
30
+ export interface VoteSubmitted {
31
+ type: "VoteSubmitted";
32
+ /** Index into the node's vote options array. */
33
+ optionIndex: number;
34
+ }
35
+
36
+ export interface ReadyConfirmed {
37
+ type: "ReadyConfirmed";
38
+ }
39
+
40
+ export interface ExploreOptionSelected {
41
+ type: "ExploreOptionSelected";
42
+ /** Index into the explore node's options array. */
43
+ optionIndex: number;
44
+ }
45
+
46
+ export interface ExploreExitSelected {
47
+ type: "ExploreExitSelected";
48
+ /** Index into the explore node's exits array. */
49
+ exitIndex: number;
50
+ }
51
+
52
+ export interface ExploreExitVote {
53
+ type: "ExploreExitVote";
54
+ /** Whether this player accepts the proposed exit. */
55
+ accepted: boolean;
56
+ }
57
+
58
+ export interface PlayerPing {
59
+ type: "PlayerPing";
60
+ /** ISO-8601 timestamp from the controller. */
61
+ timestamp: string;
62
+ }
63
+
64
+ // ── Union ───────────────────────────────────────────────────────────────────
65
+
66
+ /**
67
+ * Discriminated union of all messages a phone controller can send to the TV engine.
68
+ * Discriminant field: `type`.
69
+ */
70
+ export type ControllerMessage =
71
+ | HeroSelected
72
+ | QTEResponse
73
+ | ChoiceSelected
74
+ | VoteSubmitted
75
+ | ExploreOptionSelected
76
+ | ExploreExitSelected
77
+ | ExploreExitVote
78
+ | ReadyConfirmed
79
+ | PlayerPing;
80
+
81
+ /** All possible `type` values for ControllerMessage. */
82
+ export type ControllerMessageType = ControllerMessage["type"];
@@ -0,0 +1,105 @@
1
+ /**
2
+ * display-instruction.ts
3
+ *
4
+ * TV → Phone typed payload union.
5
+ * Sent by the TV game engine to phone controllers via IClientAdapter.sendToController().
6
+ */
7
+
8
+ // ── Individual instruction types ────────────────────────────────────────────
9
+
10
+ export interface RenderLayout {
11
+ type: "RenderLayout";
12
+ /** Layout template identifier (e.g. "choice_prompt", "qte_tap", "vote_grid"). */
13
+ template: string;
14
+ /** Template-specific data — shape varies by template. */
15
+ data: Record<string, unknown>;
16
+ }
17
+
18
+ export interface ShowPrompt {
19
+ type: "ShowPrompt";
20
+ /** Prompt text to display. */
21
+ text: string;
22
+ /** Optional choices for the player. */
23
+ choices?: string[];
24
+ /** Optional timer duration in seconds. */
25
+ timerSeconds?: number;
26
+ /** Hero profile image URL for the controller top bar, or null if unset. */
27
+ heroProfileImg?: string | null;
28
+ }
29
+
30
+ export interface ShowFeedback {
31
+ type: "ShowFeedback";
32
+ /** Feedback message (e.g. "Correct!", "Time's up!"). */
33
+ text: string;
34
+ /** Visual style hint. */
35
+ style: "success" | "failure" | "neutral";
36
+ }
37
+
38
+ export interface ApplyTheme {
39
+ type: "ApplyTheme";
40
+ /** CSS custom properties to apply on the controller. */
41
+ properties: Record<string, string>;
42
+ }
43
+
44
+ export interface ShowCountdown {
45
+ type: "ShowCountdown";
46
+ /** Duration in seconds. */
47
+ durationSeconds: number;
48
+ /** Optional label (e.g. "Get ready!"). */
49
+ label?: string;
50
+ }
51
+
52
+ export interface ClearScreen {
53
+ type: "ClearScreen";
54
+ }
55
+
56
+ export interface GameTerminated {
57
+ type: "GameTerminated";
58
+ /** Optional reason for termination. */
59
+ reason?: string;
60
+ }
61
+
62
+ export interface UpdateMeters {
63
+ type: "UpdateMeters";
64
+ /** Meter ID → current value. */
65
+ meters: Record<string, number>;
66
+ }
67
+
68
+ export interface ScheduledCue {
69
+ /** Milliseconds from playStartServerTime to show this QTE. */
70
+ atMs: number;
71
+ /** Cue index (matches the timeEvent index on the play_video node). */
72
+ cueIndex: number;
73
+ /** QTE template (e.g. "qte_tap"). */
74
+ template: string;
75
+ /** Template-specific data (text, timeLimit, difficulty, heroProfileImg). */
76
+ data: Record<string, unknown>;
77
+ }
78
+
79
+ export interface ScheduleQTE {
80
+ type: "ScheduleQTE";
81
+ /** Server timestamp (Date.now() on app) when the video started playing. */
82
+ playStartServerTime: number;
83
+ /** Cues to schedule, sorted by atMs ascending. */
84
+ cues: ScheduledCue[];
85
+ }
86
+
87
+ // ── Union ───────────────────────────────────────────────────────────────────
88
+
89
+ /**
90
+ * Discriminated union of all instructions the TV engine can send to phone controllers.
91
+ * Discriminant field: `type`.
92
+ */
93
+ export type DisplayInstruction =
94
+ | RenderLayout
95
+ | ShowPrompt
96
+ | ShowFeedback
97
+ | ApplyTheme
98
+ | ShowCountdown
99
+ | ClearScreen
100
+ | GameTerminated
101
+ | UpdateMeters
102
+ | ScheduleQTE;
103
+
104
+ /** All possible `type` values for DisplayInstruction. */
105
+ export type DisplayInstructionType = DisplayInstruction["type"];
package/src/index.ts ADDED
@@ -0,0 +1,81 @@
1
+ /**
2
+ * @grg/sdk — Gather Round SDK
3
+ *
4
+ * Shared types, interfaces, and schemas for the Gather Round ecosystem.
5
+ * This package contains contracts only — no business logic, no platform
6
+ * imports, no React.
7
+ */
8
+
9
+ // ── Runtime types (episode.json, strings.en.json, assets.json) ──────────────
10
+
11
+ export type {
12
+ RuntimeEpisode,
13
+ RuntimeHero,
14
+ RuntimeHeroAttribute,
15
+ RuntimeMeterDefinition,
16
+ RuntimeVariable,
17
+ RuntimeEpisodeAssets,
18
+ } from "./runtime-episode.js";
19
+
20
+ export type {
21
+ RuntimeNode,
22
+ RuntimeTransition,
23
+ RuntimeCondition,
24
+ RuntimeConditionGroup,
25
+ RuntimeMutation,
26
+ } from "./runtime-types.js";
27
+
28
+ export type { RuntimeStrings } from "./runtime-strings.js";
29
+
30
+ export type { AssetEntry, RuntimeAssetManifest } from "./runtime-assets.js";
31
+
32
+ // ── Message protocol ────────────────────────────────────────────────────────
33
+
34
+ export type {
35
+ ControllerMessage,
36
+ ControllerMessageType,
37
+ HeroSelected,
38
+ QTEResponse,
39
+ ChoiceSelected,
40
+ VoteSubmitted,
41
+ ExploreOptionSelected,
42
+ ExploreExitSelected,
43
+ ExploreExitVote,
44
+ ReadyConfirmed,
45
+ PlayerPing,
46
+ } from "./controller-message.js";
47
+
48
+ export type {
49
+ DisplayInstruction,
50
+ DisplayInstructionType,
51
+ RenderLayout,
52
+ ShowPrompt,
53
+ ShowFeedback,
54
+ ApplyTheme,
55
+ ShowCountdown,
56
+ ClearScreen,
57
+ GameTerminated,
58
+ UpdateMeters,
59
+ ScheduledCue,
60
+ ScheduleQTE,
61
+ } from "./display-instruction.js";
62
+
63
+ // ── Adapter interfaces ──────────────────────────────────────────────────────
64
+
65
+ export type { IContentAdapter } from "./adapters/i-content-adapter.js";
66
+
67
+ export type {
68
+ IClientAdapter,
69
+ GameSessionOptions,
70
+ GameSessionResult,
71
+ PlayerSessionResult,
72
+ } from "./adapters/i-client-adapter.js";
73
+
74
+ export type {
75
+ ISessionAdapter,
76
+ PlayerConfig,
77
+ EpisodeVariables,
78
+ SceneCheckpoint,
79
+ } from "./adapters/i-session-adapter.js";
80
+
81
+ export type { IControllerTransport } from "./adapters/i-controller-transport.js";
@@ -0,0 +1,18 @@
1
+ /**
2
+ * runtime-assets.ts
3
+ *
4
+ * Asset manifest artifact (assets.json).
5
+ * Lists all media files referenced by the episode for pre-loading.
6
+ */
7
+
8
+ export interface AssetEntry {
9
+ /** GCS bucket name. */
10
+ bucket: string;
11
+ /** Object path within the bucket. */
12
+ path: string;
13
+ /** Asset type for pre-loading strategy. */
14
+ type: "video" | "image" | "audio";
15
+ }
16
+
17
+ /** Keyed by a logical ID (e.g. "hero.1.cardImg", "node-abc.url"). */
18
+ export type RuntimeAssetManifest = Record<string, AssetEntry>;