@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,109 @@
1
+ /**
2
+ * runtime-episode.ts
3
+ *
4
+ * Top-level runtime episode type — the root of episode.json.
5
+ * Produced by the editor's publish pipeline, consumed by the game engine.
6
+ */
7
+
8
+ import type { RuntimeNode } from "./runtime-types.js";
9
+
10
+ // ── Heroes ──────────────────────────────────────────────────────────────────
11
+
12
+ export interface RuntimeHeroAttribute {
13
+ /** Stable key (e.g. "essence", "fear_meter"). */
14
+ id: string;
15
+ /** Display name (e.g. "Essence", "Fear Meter"). */
16
+ label: string;
17
+ /** Narrative descriptor value — always string. */
18
+ value: string;
19
+ }
20
+
21
+ export interface RuntimeMeterDefinition {
22
+ /** Stable key matching variable name (e.g. "alignment"). */
23
+ id: string;
24
+ /** Display label (e.g. "Alignment"). */
25
+ label: string;
26
+ /** Starting value (e.g. 10). */
27
+ defaultValue: number;
28
+ /** Range floor (e.g. 0). */
29
+ min: number;
30
+ /** Range ceiling (e.g. 20). */
31
+ max: number;
32
+ /** Optional CSS color for bar, null = theme default. */
33
+ color: string | null;
34
+ }
35
+
36
+ export interface RuntimeHero {
37
+ /** Role slot: 0 = TV Host, 1–4 = player heroes. */
38
+ role: number;
39
+ name: string;
40
+ description: string;
41
+ /** Self-describing attribute array — includes all designer-defined attributes. */
42
+ attributes: RuntimeHeroAttribute[];
43
+ /** Meter definitions for this hero's class (numeric bars with min/max range). */
44
+ meters: RuntimeMeterDefinition[];
45
+ /** GCS path to hero card image (lobby / character sheet), or null if unset. */
46
+ cardImg: string | null;
47
+ /** GCS path to profile image (thumbnail / PiP overlay), or null if unset. */
48
+ profileImg: string | null;
49
+ }
50
+
51
+ // ── Variables ───────────────────────────────────────────────────────────────
52
+
53
+ export interface RuntimeVariable {
54
+ /** Variable name (the target key used in mutations/conditions). */
55
+ name: string;
56
+ /** Data type — determines valid runtime operations. */
57
+ type: "boolean" | "number" | "string";
58
+ /** Starting value at episode begin. */
59
+ defaultValue: boolean | number | string;
60
+ /**
61
+ * When set, the engine creates one instance per entity of this type.
62
+ * null = plain global variable. "hero" = one instance per hero.
63
+ */
64
+ expandBy: "hero" | null;
65
+ }
66
+
67
+ // ── Episode-level assets ────────────────────────────────────────────────────
68
+
69
+ export interface RuntimeEpisodeAssets {
70
+ logo: string | null;
71
+ thumbnail: string | null;
72
+ /** Full-screen image shown on the start/title screen. */
73
+ startBg: string | null;
74
+ /** Background image shown behind the lobby UI. */
75
+ lobbyBg: string | null;
76
+ }
77
+
78
+ // ── Runtime Episode (episode.json root) ─────────────────────────────────────
79
+
80
+ export interface RuntimeEpisode {
81
+ /** Schema version — bumped on breaking changes to the runtime format. */
82
+ version: "2.0" | "2.1" | "2.2";
83
+ /** Firestore episode document ID. */
84
+ episodeId: string;
85
+ /** ISO-8601 timestamp of when this artifact was compiled. */
86
+ compiledAt: string;
87
+ /** Publish version ID (timestamp-based, e.g. "20260306T120000Z"). */
88
+ versionId: string;
89
+
90
+ // ── Episode metadata ────────────────────────────────────────────────────
91
+ title: string;
92
+ genre: string | null;
93
+ summary: string | null;
94
+
95
+ /** Node ID to begin execution from. */
96
+ startNodeId: string;
97
+
98
+ // ── Heroes ──────────────────────────────────────────────────────────────
99
+ heroes: RuntimeHero[];
100
+
101
+ // ── Variables (mutable episode state) ───────────────────────────────────
102
+ variables: RuntimeVariable[];
103
+
104
+ // ── Episode-level assets (GCS paths) ────────────────────────────────────
105
+ assets: RuntimeEpisodeAssets;
106
+
107
+ // ── Flat node array — the entire story graph ────────────────────────────
108
+ nodes: RuntimeNode[];
109
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * runtime-strings.ts
3
+ *
4
+ * String extraction artifact (strings.en.json).
5
+ * Flat key-value map of all player-facing text, keyed by node + field path.
6
+ */
7
+
8
+ /**
9
+ * Flat key-value map of all player-facing text.
10
+ * Keys follow the pattern: `{nodeId}.{field}` or `{nodeId}.{field}.{index}`
11
+ */
12
+ export type RuntimeStrings = Record<string, string>;
@@ -0,0 +1,84 @@
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
+
8
+ // ── Runtime Node ───────────────────────────────────────────────────────────
9
+
10
+ export interface RuntimeNode {
11
+ id: string;
12
+ kind: string;
13
+ /** Author's label for this node (debugging / game-log use). */
14
+ label?: string;
15
+
16
+ /**
17
+ * Kind-specific payload. Shape varies by kind:
18
+ * play_video: { url, loop, pipTarget, onPlay, timeEvents }
19
+ * hero_action: { prompt, choices: { text, mutations? }[], targetRoles, timer? }
20
+ * trigger_qte: { text, timeLimit, targetRoles, qteType, difficulty }
21
+ * vote: { prompt, options, timeLimit, tallyMode, targetRoles }
22
+ * explore: { options: { text, image?, showOnce }[], target_roles, locationLabel?, locationImage? }
23
+ * set_variable: absent (uses mutations)
24
+ * logic: absent (uses conditions + mutations)
25
+ * end_episode: absent (terminal node — no payload, no transitions)
26
+ */
27
+ payload?: Record<string, unknown>;
28
+
29
+ /** Logic-kind conditions — evaluated top-to-bottom, first match wins.
30
+ * Each element is a branch: either a single RuntimeCondition (legacy)
31
+ * or a RuntimeConditionGroup (compound boolean logic). */
32
+ conditions?: (RuntimeCondition | RuntimeConditionGroup)[];
33
+
34
+ /** Variable mutations — executed on node entry. */
35
+ mutations?: RuntimeMutation[];
36
+
37
+ /** Compiled transitions from graph edges. */
38
+ transitions: RuntimeTransition[];
39
+ }
40
+
41
+ // ── Transitions ────────────────────────────────────────────────────────────
42
+
43
+ export interface RuntimeTransition {
44
+ /** The event that fires this transition. */
45
+ on: string;
46
+ /** For choice-based transitions: index into the choices array. */
47
+ choiceIndex?: number;
48
+ /** For condition-based transitions: index into the conditions array. */
49
+ conditionIndex?: number;
50
+ /** For cue-based transitions: index into the timeEvents array. */
51
+ cueIndex?: number;
52
+ /** For exit-based transitions: index into the exits array (explore node). */
53
+ exitIndex?: number;
54
+ /** Destination node ID. */
55
+ target: string;
56
+ }
57
+
58
+ // ── Conditions ─────────────────────────────────────────────────────────────
59
+
60
+ export interface RuntimeCondition {
61
+ variable: string;
62
+ operator: "eq" | "neq" | "gt" | "lt" | "gte" | "lte";
63
+ value: string | number | boolean;
64
+ }
65
+
66
+ /**
67
+ * A compound condition branch — multiple atomic conditions combined with
68
+ * a boolean operator (AND/OR) or an arbitrary formula.
69
+ */
70
+ export interface RuntimeConditionGroup {
71
+ conditions: RuntimeCondition[];
72
+ /** "and" | "or" — uniform inline join. "formula" — uses the `formula` field. */
73
+ mode: "and" | "or" | "formula";
74
+ /** Boolean formula string (e.g. "(A & B) | !C"). Only present when mode === "formula". */
75
+ formula?: string;
76
+ }
77
+
78
+ // ── Mutations ──────────────────────────────────────────────────────────────
79
+
80
+ export interface RuntimeMutation {
81
+ target: string;
82
+ operation: "set" | "increment" | "decrement";
83
+ value: string | number | boolean;
84
+ }