pi-mega-compact 0.8.23 → 0.8.25

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 (157) hide show
  1. package/README.md +26 -0
  2. package/dist/extensions/dashboard-server/api-contracts/endpoints.js +8 -0
  3. package/dist/extensions/dashboard-server/api-contracts/game-types.js +7 -0
  4. package/dist/extensions/mega-compact-s38.test.js +263 -14
  5. package/dist/extensions/mega-compact.js +15 -0
  6. package/dist/extensions/mega-config.js +3 -0
  7. package/dist/extensions/mega-events/agent-handlers.js +211 -26
  8. package/dist/extensions/mega-events/context-handler.js +45 -7
  9. package/dist/extensions/mega-events/error-classifier.js +125 -18
  10. package/dist/extensions/mega-pipeline/compact.js +24 -13
  11. package/dist/extensions/mega-pipeline/recall.js +31 -2
  12. package/dist/extensions/mega-runtime/append-event.js +24 -0
  13. package/dist/extensions/mega-runtime/bind-repo.js +65 -0
  14. package/dist/extensions/mega-runtime/capture-model.js +87 -0
  15. package/dist/extensions/mega-runtime/dashboard-snapshot.js +122 -0
  16. package/dist/extensions/mega-runtime/effects.js +86 -0
  17. package/dist/extensions/mega-runtime/engine-view.js +11 -0
  18. package/dist/extensions/mega-runtime/game-state.js +116 -0
  19. package/dist/extensions/mega-runtime/get-state-dir.js +10 -0
  20. package/dist/extensions/mega-runtime/perf.js +49 -0
  21. package/dist/extensions/mega-runtime/pressure-getters.js +64 -0
  22. package/dist/extensions/mega-runtime/render-widget.js +17 -0
  23. package/dist/extensions/mega-runtime/reset-runtime.js +50 -0
  24. package/dist/extensions/mega-runtime/runtime-helpers.js +73 -0
  25. package/dist/extensions/mega-runtime/runtime-snapshot.js +208 -0
  26. package/dist/extensions/mega-runtime/runtime.js +405 -0
  27. package/dist/extensions/mega-runtime/snapshot.js +142 -0
  28. package/dist/extensions/mega-runtime/state.js +5 -1151
  29. package/dist/extensions/mega-runtime/status.js +11 -0
  30. package/dist/extensions/mega-runtime/widget-ansi.js +207 -0
  31. package/dist/extensions/mega-runtime/widget-types.js +8 -0
  32. package/dist/extensions/mega-runtime/widget.js +15 -204
  33. package/dist/extensions/openclaw-mega-compact.js +291 -0
  34. package/dist/src/boundary.js +79 -43
  35. package/dist/src/boundary.test.js +119 -2
  36. package/dist/src/canary.js +10 -0
  37. package/dist/src/config/dedup.js +14 -0
  38. package/dist/src/config.js +3 -1
  39. package/dist/src/dedup/raptor/buildHistory.js +164 -0
  40. package/dist/src/dedup/raptor/buildHistory.test.js +292 -0
  41. package/dist/src/dedup/raptor/index.js +38 -0
  42. package/dist/src/dedup/raptor/multilevel-serve.test.js +229 -0
  43. package/dist/src/dedup/raptor/multilevel.js +17 -5
  44. package/dist/src/dedup/raptor/multilevel.test.js +36 -1
  45. package/dist/src/dedup/raptor/raptor.test.js +43 -0
  46. package/dist/src/dedup/raptor/retrieval.js +14 -2
  47. package/dist/src/dedup/raptor/retrieval.test.js +95 -0
  48. package/dist/src/dedup/raptor/serve-gate.test.js +298 -0
  49. package/dist/src/dedup/raptor/summarizer.js +1 -0
  50. package/dist/src/dedup/raptor/tree.js +16 -2
  51. package/dist/src/engine.js +18 -2
  52. package/dist/src/httpEmbedder.js +96 -6
  53. package/dist/src/httpEmbedder.test.js +277 -0
  54. package/dist/src/mechanical-fix.test.js +65 -0
  55. package/dist/src/minilm.js +92 -0
  56. package/dist/src/raptor-inject-summaries.test.js +155 -0
  57. package/dist/src/recall.js +135 -21
  58. package/dist/src/recall.test.js +179 -4
  59. package/dist/src/store/sqlite/dedup-mirror.js +32 -15
  60. package/dist/src/store/sqlite/maintenance.js +2 -2
  61. package/dist/src/store/sqlite/mechanical-fix.test.js +146 -0
  62. package/dist/src/store/sqlite/memories.js +5 -5
  63. package/dist/src/store/sqlite/meta.js +1 -1
  64. package/dist/src/store/sqlite/raptor.js +56 -17
  65. package/dist/src/store/sqlite/raptor.test.js +106 -0
  66. package/dist/src/store/sqlite/schema.js +90 -1
  67. package/dist/src/store/sqlite/session-state.js +9 -3
  68. package/dist/src/store/sqlite/stats.js +9 -5
  69. package/dist/src/store/sqlite/turns.js +181 -0
  70. package/dist/src/store/sqlite/turns.test.js +183 -0
  71. package/dist/src/store/sqlite/utils.js +15 -4
  72. package/dist/src/store/sqlite.js +1 -0
  73. package/dist/src/store.js +2 -2
  74. package/dist/src/vector-search-cache.test.js +157 -0
  75. package/dist/src/vector-search.js +107 -15
  76. package/dist/src/vectorStore.js +36 -8
  77. package/dist/src/wordpiece.js +129 -0
  78. package/extensions/dashboard-client/dist/assets/index-D_WtU2TV.js.map +1 -1
  79. package/extensions/dashboard-server/api-contracts/endpoints.ts +30 -155
  80. package/extensions/dashboard-server/api-contracts/game-types.ts +172 -0
  81. package/extensions/mega-compact-s38.test.ts +259 -14
  82. package/extensions/mega-compact.ts +15 -0
  83. package/extensions/mega-config.ts +18 -0
  84. package/extensions/mega-dashboard.ts +10 -1
  85. package/extensions/mega-events/agent-handlers.ts +211 -26
  86. package/extensions/mega-events/context-handler.ts +43 -7
  87. package/extensions/mega-events/error-classifier.ts +125 -17
  88. package/extensions/mega-pipeline/compact.ts +28 -16
  89. package/extensions/mega-pipeline/recall.ts +34 -2
  90. package/extensions/mega-runtime/DECOMPOSITION.md +180 -0
  91. package/extensions/mega-runtime/README.md +38 -0
  92. package/extensions/mega-runtime/append-event.ts +40 -0
  93. package/extensions/mega-runtime/bind-repo.ts +81 -0
  94. package/extensions/mega-runtime/capture-model.ts +101 -0
  95. package/extensions/mega-runtime/dashboard-snapshot.ts +181 -0
  96. package/extensions/mega-runtime/effects.ts +129 -0
  97. package/extensions/mega-runtime/engine-view.ts +17 -0
  98. package/extensions/mega-runtime/game-state.ts +149 -0
  99. package/extensions/mega-runtime/get-state-dir.ts +19 -0
  100. package/extensions/mega-runtime/helpers.ts +25 -1
  101. package/extensions/mega-runtime/perf.ts +60 -0
  102. package/extensions/mega-runtime/pressure-getters.ts +96 -0
  103. package/extensions/mega-runtime/render-widget.ts +41 -0
  104. package/extensions/mega-runtime/runtime-helpers.ts +119 -0
  105. package/extensions/mega-runtime/runtime-snapshot.ts +293 -0
  106. package/extensions/mega-runtime/runtime.ts +483 -0
  107. package/extensions/mega-runtime/snapshot.ts +230 -0
  108. package/extensions/mega-runtime/state.ts +5 -1268
  109. package/extensions/mega-runtime/status.ts +26 -0
  110. package/extensions/mega-runtime/widget-ansi.ts +217 -0
  111. package/extensions/mega-runtime/widget-types.ts +80 -0
  112. package/extensions/mega-runtime/widget.ts +34 -285
  113. package/package.json +1 -1
  114. package/src/boundary.test.ts +128 -2
  115. package/src/boundary.ts +75 -39
  116. package/src/canary.ts +10 -0
  117. package/src/config/dedup.ts +25 -0
  118. package/src/config.ts +3 -1
  119. package/src/dedup/raptor/buildHistory.test.ts +353 -0
  120. package/src/dedup/raptor/buildHistory.ts +259 -0
  121. package/src/dedup/raptor/index.ts +38 -0
  122. package/src/dedup/raptor/multilevel-serve.test.ts +273 -0
  123. package/src/dedup/raptor/multilevel.test.ts +47 -0
  124. package/src/dedup/raptor/multilevel.ts +18 -8
  125. package/src/dedup/raptor/raptor.test.ts +59 -0
  126. package/src/dedup/raptor/retrieval.test.ts +118 -0
  127. package/src/dedup/raptor/retrieval.ts +14 -2
  128. package/src/dedup/raptor/serve-gate.test.ts +348 -0
  129. package/src/dedup/raptor/summarizer.ts +1 -0
  130. package/src/dedup/raptor/tree.ts +17 -2
  131. package/src/engine.ts +32 -3
  132. package/src/httpEmbedder.test.ts +286 -0
  133. package/src/httpEmbedder.ts +98 -8
  134. package/src/mechanical-fix.test.ts +70 -0
  135. package/src/raptor-inject-summaries.test.ts +212 -0
  136. package/src/recall.test.ts +220 -4
  137. package/src/recall.ts +151 -22
  138. package/src/store/sqlite/dedup-mirror.ts +35 -18
  139. package/src/store/sqlite/maintenance.ts +2 -2
  140. package/src/store/sqlite/mechanical-fix.test.ts +162 -0
  141. package/src/store/sqlite/memories.ts +5 -5
  142. package/src/store/sqlite/meta.ts +1 -1
  143. package/src/store/sqlite/raptor.test.ts +139 -0
  144. package/src/store/sqlite/raptor.ts +135 -81
  145. package/src/store/sqlite/schema.ts +90 -1
  146. package/src/store/sqlite/session-state.ts +9 -3
  147. package/src/store/sqlite/stats.ts +10 -8
  148. package/src/store/sqlite/turns.test.ts +218 -0
  149. package/src/store/sqlite/turns.ts +292 -0
  150. package/src/store/sqlite/utils.ts +14 -4
  151. package/src/store/sqlite.ts +1 -0
  152. package/src/store.ts +9 -2
  153. package/src/vector-search-cache.test.ts +190 -0
  154. package/src/vector-search.ts +273 -156
  155. package/src/vectorStore.ts +443 -382
  156. package/dist/extensions/dashboard-client/src/hooks/useApi.js +0 -51
  157. package/dist/extensions/dashboard-client/src/hooks/useSSE.js +0 -63
@@ -12,9 +12,34 @@
12
12
  import type { EndpointDef } from './core.js';
13
13
  import type { SnapshotResponse } from './snapshot.js';
14
14
  import type { IndexesIndexRow, IndexesSummaryResponse } from './multi-repo.js';
15
- import type { GameConfig, GameStateResponse } from './game.js';
15
+ import type { GameStateResponse } from './game.js';
16
16
  import type { SseEvent } from './index.js';
17
17
 
18
+ import type {
19
+ GameScoreRow,
20
+ GameScoresQuery,
21
+ AchievementRow,
22
+ SessionsResponse,
23
+ SessionTimeseriesQuery,
24
+ SessionTimeseriesResponse,
25
+ GameStatePatch,
26
+ SseEndpointDef,
27
+ } from './game-types.js';
28
+
29
+ export type {
30
+ GameScoreRow,
31
+ GameScoresQuery,
32
+ AchievementRow,
33
+ ActiveSession,
34
+ SessionsResponse,
35
+ SessionDataPoint,
36
+ SessionSeries,
37
+ SessionTimeseriesQuery,
38
+ SessionTimeseriesResponse,
39
+ GameStatePatch,
40
+ SseEndpointDef,
41
+ } from './game-types.js';
42
+
18
43
  // ─── New Response Types (inline) ───────────────────────────────────────────
19
44
 
20
45
  /**
@@ -293,167 +318,17 @@ export interface PerfResponse {
293
318
  }
294
319
 
295
320
  // ─── Game Score & Achievement Types ─────────────────────────────────────────
296
-
297
- /**
298
- * A leaderboard row for GET /api/game-scores. One row per repo per metric.
299
- */
300
- export interface GameScoreRow {
301
- /** Absolute path to the repo root. */
302
- readonly repo_root: string;
303
- /** Score value (interpretation depends on the metric). */
304
- readonly value: number;
305
- /** Unix timestamp (milliseconds) when the score was recorded. */
306
- readonly ts: number;
307
- /** Optional metadata associated with the score event. */
308
- readonly meta: unknown;
309
- }
310
-
311
- /**
312
- * Query parameters for GET /api/game-scores.
313
- */
314
- export interface GameScoresQuery {
315
- /** Leaderboard metric (must be one of: cache, dedupe, turns, repos, mega_cache). Optional. */
316
- readonly metric?: string;
317
- /** Maximum number of rows to return (default: 10, clamped to [1, 100]). Optional. */
318
- readonly limit?: number;
319
- }
320
-
321
- /**
322
- * An achievement row for GET /api/achievements. One row per seeded achievement.
323
- */
324
- export interface AchievementRow {
325
- /** Achievement identifier. */
326
- readonly id: string;
327
- /** Display title of the achievement. */
328
- readonly title: string;
329
- /** Description of the unlock condition. */
330
- readonly description: string;
331
- /** Whether the achievement is hidden (1 = hidden, 0 = visible). */
332
- readonly hidden: number;
333
- /** Icon identifier, or null if no icon. */
334
- readonly icon: string | null;
335
- /** Unix timestamp (seconds) when unlocked, or null if not yet unlocked. */
336
- readonly unlocked_at: number | null;
337
- }
321
+ // (moved to game-types.ts; re-exported for backwards compatibility)
338
322
 
339
323
  // ─── Sessions Memory Graph (S39) ─────────────────────────────────────────
340
-
341
- /**
342
- * A single active session in the GET /api/sessions response. Represents a
343
- * live pi process with its latest token usage and heartbeat.
344
- */
345
- export interface ActiveSession {
346
- /** OS process ID of the pi process. */
347
- readonly pid: number;
348
- /** Session identifier (normalized). */
349
- readonly sessionId: string;
350
- /** Absolute path to the repo root, or null if not in a git repo. */
351
- readonly repoRoot: string | null;
352
- /** Display name (repo basename or state dir basename). */
353
- readonly displayName: string;
354
- /** Model name, or null if not captured. Available from repo_registry join. */
355
- readonly model: string | null;
356
- /** Latest context token count, or null if no sample yet. */
357
- readonly tokens: number | null;
358
- /** Latest context pressure percentage (0–100), or null. */
359
- readonly percent: number | null;
360
- /** Context window size in tokens. */
361
- readonly ctxWindow: number;
362
- /** Unix timestamp (ms) of the last heartbeat. */
363
- readonly lastSeen: number;
364
- /** State directory of the session. */
365
- readonly stateDir: string | null;
366
- }
367
-
368
- /**
369
- * Response for GET /api/sessions. Lists active sessions with their latest
370
- * token usage after pruning stale entries.
371
- */
372
- export interface SessionsResponse {
373
- /** ISO timestamp when the response was generated. */
374
- readonly updatedAt: string;
375
- /** Number of stale sessions pruned during this request. */
376
- readonly pruned: number;
377
- /** Array of active sessions, sorted by lastSeen descending. */
378
- readonly sessions: ActiveSession[];
379
- }
380
-
381
- /** A single time-series data point for a session. */
382
- export interface SessionDataPoint {
383
- /** Unix timestamp (ms). */
384
- readonly ts: number;
385
- /** Token count at this sample. */
386
- readonly tokens: number;
387
- /** Context pressure percentage (0–100). */
388
- readonly percent: number;
389
- }
390
-
391
- /** A recharts-ready per-session series with a stable color. */
392
- export interface SessionSeries {
393
- /** Session identifier. */
394
- readonly sessionId: string;
395
- /** Short display label for the legend. */
396
- readonly label: string;
397
- /** Stable hex color string (e.g. "#60a5fa"). */
398
- readonly color: string;
399
- /** Data points ordered by timestamp ascending. */
400
- readonly data: SessionDataPoint[];
401
- }
402
-
403
- /**
404
- * Query parameters for GET /api/sessions/timeseries. The `minutes` parameter
405
- * controls the rolling window size.
406
- */
407
- export interface SessionTimeseriesQuery {
408
- /** Rolling window size in minutes (default: 30, clamped to [1, 1440]). */
409
- readonly minutes?: number;
410
- }
411
-
412
- /**
413
- * Response for GET /api/sessions/timeseries. Returns recharts-ready stacked
414
- * per-session series + a totals array.
415
- */
416
- export interface SessionTimeseriesResponse {
417
- /** ISO timestamp when the response was generated. */
418
- readonly updatedAt: string;
419
- /** Rolling window size in minutes. */
420
- readonly windowMinutes: number;
421
- /** Per-session series with stable colors. */
422
- readonly series: SessionSeries[];
423
- /** Totals (sum of all sessions) per timestamp. */
424
- readonly totals: { readonly ts: number; readonly tokens: number }[];
425
- }
324
+ // (moved to game-types.ts; re-exported for backwards compatibility)
426
325
 
427
326
  // ─── Game State Patch (PUT request body) ────────────────────────────────────
428
-
429
- /**
430
- * Request body for PUT /api/game-state. A partial patch of the game config.
431
- * Unknown keys are ignored; invalid values result in a 400 response.
432
- */
433
- export type GameStatePatch = Partial<GameConfig>;
327
+ // (moved to game-types.ts; re-exported for backwards compatibility)
434
328
 
435
329
  // ─── SSE Endpoint Definition ────────────────────────────────────────────────
330
+ // (moved to game-types.ts; re-exported for backwards compatibility)
436
331
 
437
- /**
438
- * Endpoint definition for SSE (Server-Sent Events) streaming endpoints.
439
- * Unlike standard REST endpoints, the response is a continuous `text/event-stream`
440
- * with `data:` frames containing JSON-serialized event objects.
441
- * @template Data - The SSE event data type streamed by this endpoint.
442
- */
443
- export interface SseEndpointDef<Data extends SseEvent = SseEvent> {
444
- /** Discriminator: always 'sse' for streaming endpoints. */
445
- readonly type: 'sse';
446
- /** HTTP method (always 'GET' for SSE). */
447
- readonly method: 'GET';
448
- /** URL path of the endpoint. */
449
- readonly path: string;
450
- /** Human-readable description of the endpoint. */
451
- readonly description: string;
452
- /** SSE event name sent with each data frame. */
453
- readonly event: string;
454
- /** The SSE event data type streamed by this endpoint. */
455
- readonly dataType?: Data;
456
- }
457
332
 
458
333
  // ─── ENDPOINTS Registry ─────────────────────────────────────────────────────
459
334
 
@@ -0,0 +1,172 @@
1
+ /**
2
+ * api-contracts/game-types.ts — Split-out dashboard API types.
3
+ *
4
+ * Contains the “Game Score & Achievement Types” and “Sessions Memory Graph”
5
+ * related type definitions that previously lived in endpoints.ts.
6
+ */
7
+
8
+ import type { GameConfig } from './game.js';
9
+ import type { SseEvent } from './index.js';
10
+
11
+ // ─── Game Score & Achievement Types ─────────────────────────────────────────
12
+
13
+ /**
14
+ * A leaderboard row for GET /api/game-scores. One row per repo per metric.
15
+ */
16
+ export interface GameScoreRow {
17
+ /** Absolute path to the repo root. */
18
+ readonly repo_root: string;
19
+ /** Score value (interpretation depends on the metric). */
20
+ readonly value: number;
21
+ /** Unix timestamp (milliseconds) when the score was recorded. */
22
+ readonly ts: number;
23
+ /** Optional metadata associated with the score event. */
24
+ readonly meta: unknown;
25
+ }
26
+
27
+ /**
28
+ * Query parameters for GET /api/game-scores.
29
+ */
30
+ export interface GameScoresQuery {
31
+ /** Leaderboard metric (must be one of: cache, dedupe, turns, repos, mega_cache). Optional. */
32
+ readonly metric?: string;
33
+ /** Maximum number of rows to return (default: 10, clamped to [1, 100]). Optional. */
34
+ readonly limit?: number;
35
+ }
36
+
37
+ /**
38
+ * An achievement row for GET /api/achievements. One row per seeded achievement.
39
+ */
40
+ export interface AchievementRow {
41
+ /** Achievement identifier. */
42
+ readonly id: string;
43
+ /** Display title of the achievement. */
44
+ readonly title: string;
45
+ /** Description of the unlock condition. */
46
+ readonly description: string;
47
+ /** Whether the achievement is hidden (1 = hidden, 0 = visible). */
48
+ readonly hidden: number;
49
+ /** Icon identifier, or null if no icon. */
50
+ readonly icon: string | null;
51
+ /** Unix timestamp (seconds) when unlocked, or null if not yet unlocked. */
52
+ readonly unlocked_at: number | null;
53
+ }
54
+
55
+ // ─── Sessions Memory Graph (S39) ─────────────────────────────────────────
56
+
57
+ /**
58
+ * A single active session in the GET /api/sessions response. Represents a
59
+ * live pi process with its latest token usage and heartbeat.
60
+ */
61
+ export interface ActiveSession {
62
+ /** OS process ID of the pi process. */
63
+ readonly pid: number;
64
+ /** Session identifier (normalized). */
65
+ readonly sessionId: string;
66
+ /** Absolute path to the repo root, or null if not in a git repo. */
67
+ readonly repoRoot: string | null;
68
+ /** Display name (repo basename or state dir basename). */
69
+ readonly displayName: string;
70
+ /** Model name, or null if not captured. Available from repo_registry join. */
71
+ readonly model: string | null;
72
+ /** Latest context token count, or null if no sample yet. */
73
+ readonly tokens: number | null;
74
+ /** Latest context pressure percentage (0–100), or null. */
75
+ readonly percent: number | null;
76
+ /** Context window size in tokens. */
77
+ readonly ctxWindow: number;
78
+ /** Unix timestamp (ms) of the last heartbeat. */
79
+ readonly lastSeen: number;
80
+ /** State directory of the session. */
81
+ readonly stateDir: string | null;
82
+ }
83
+
84
+ /**
85
+ * Response for GET /api/sessions. Lists active sessions with their latest
86
+ * token usage after pruning stale entries.
87
+ */
88
+ export interface SessionsResponse {
89
+ /** ISO timestamp when the response was generated. */
90
+ readonly updatedAt: string;
91
+ /** Number of stale sessions pruned during this request. */
92
+ readonly pruned: number;
93
+ /** Array of active sessions, sorted by lastSeen descending. */
94
+ readonly sessions: ActiveSession[];
95
+ }
96
+
97
+ /** A single time-series data point for a session. */
98
+ export interface SessionDataPoint {
99
+ /** Unix timestamp (ms). */
100
+ readonly ts: number;
101
+ /** Token count at this sample. */
102
+ readonly tokens: number;
103
+ /** Context pressure percentage (0–100). */
104
+ readonly percent: number;
105
+ }
106
+
107
+ /** A recharts-ready per-session series with a stable color. */
108
+ export interface SessionSeries {
109
+ /** Session identifier. */
110
+ readonly sessionId: string;
111
+ /** Short display label for the legend. */
112
+ readonly label: string;
113
+ /** Stable hex color string (e.g. "#60a5fa"). */
114
+ readonly color: string;
115
+ /** Data points ordered by timestamp ascending. */
116
+ readonly data: SessionDataPoint[];
117
+ }
118
+
119
+ /**
120
+ * Query parameters for GET /api/sessions/timeseries. The `minutes` parameter
121
+ * controls the rolling window size.
122
+ */
123
+ export interface SessionTimeseriesQuery {
124
+ /** Rolling window size in minutes (default: 30, clamped to [1, 1440]). */
125
+ readonly minutes?: number;
126
+ }
127
+
128
+ /**
129
+ * Response for GET /api/sessions/timeseries. Returns recharts-ready stacked
130
+ * per-session series + a totals array.
131
+ */
132
+ export interface SessionTimeseriesResponse {
133
+ /** ISO timestamp when the response was generated. */
134
+ readonly updatedAt: string;
135
+ /** Rolling window size in minutes. */
136
+ readonly windowMinutes: number;
137
+ /** Per-session series with stable colors. */
138
+ readonly series: SessionSeries[];
139
+ /** Totals (sum of all sessions) per timestamp. */
140
+ readonly totals: { readonly ts: number; readonly tokens: number }[];
141
+ }
142
+
143
+ // ─── Game State Patch (PUT request body) ────────────────────────────────────
144
+
145
+ /**
146
+ * Request body for PUT /api/game-state. A partial patch of the game config.
147
+ * Unknown keys are ignored; invalid values result in a 400 response.
148
+ */
149
+ export type GameStatePatch = Partial<GameConfig>;
150
+
151
+ // ─── SSE Endpoint Definition ────────────────────────────────────────────────
152
+
153
+ /**
154
+ * Endpoint definition for SSE (Server-Sent Events) streaming endpoints.
155
+ * Unlike standard REST endpoints, the response is a continuous `text/event-stream`
156
+ * with `data:` frames containing JSON-serialized event objects.
157
+ * @template Data - The SSE event data type streamed by this endpoint.
158
+ */
159
+ export interface SseEndpointDef<Data extends SseEvent = SseEvent> {
160
+ /** Discriminator: always 'sse' for streaming endpoints. */
161
+ readonly type: 'sse';
162
+ /** HTTP method (always 'GET' for SSE). */
163
+ readonly method: 'GET';
164
+ /** URL path of the endpoint. */
165
+ readonly path: string;
166
+ /** Human-readable description of the endpoint. */
167
+ readonly description: string;
168
+ /** SSE event name sent with each data frame. */
169
+ readonly event: string;
170
+ /** The SSE event data type streamed by this endpoint. */
171
+ readonly dataType?: Data;
172
+ }