@air-jam/devtools 0.9.3 → 1.0.0-beta.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 (263) hide show
  1. package/README.md +60 -0
  2. package/dist/{chunk-VKMJO6VN.js → chunk-2O67AXCU.js} +150 -40
  3. package/dist/chunk-2O67AXCU.js.map +1 -0
  4. package/dist/chunk-AO3ZDXF6.js +142 -0
  5. package/dist/chunk-AO3ZDXF6.js.map +1 -0
  6. package/dist/chunk-ART5TEYT.js +472 -0
  7. package/dist/chunk-ART5TEYT.js.map +1 -0
  8. package/dist/chunk-ASC2CK2R.js +77 -0
  9. package/dist/chunk-ASC2CK2R.js.map +1 -0
  10. package/dist/chunk-E3UZZGAV.js +50 -0
  11. package/dist/chunk-E3UZZGAV.js.map +1 -0
  12. package/dist/chunk-EJTE7UKX.js +64 -0
  13. package/dist/chunk-EJTE7UKX.js.map +1 -0
  14. package/dist/chunk-ESFKNN75.js +110 -0
  15. package/dist/chunk-ESFKNN75.js.map +1 -0
  16. package/dist/chunk-EU7A6PXW.js +1339 -0
  17. package/dist/chunk-EU7A6PXW.js.map +1 -0
  18. package/dist/chunk-FN7E6EA7.js +549 -0
  19. package/dist/chunk-FN7E6EA7.js.map +1 -0
  20. package/dist/chunk-GDFAWHGA.js +190 -0
  21. package/dist/chunk-GDFAWHGA.js.map +1 -0
  22. package/dist/chunk-HZUGBH4Y.js +347 -0
  23. package/dist/chunk-HZUGBH4Y.js.map +1 -0
  24. package/dist/chunk-ITKAOEGX.js +93 -0
  25. package/dist/chunk-ITKAOEGX.js.map +1 -0
  26. package/dist/chunk-JBCUTWRI.js +897 -0
  27. package/dist/chunk-JBCUTWRI.js.map +1 -0
  28. package/dist/chunk-JSI5S4WP.js +1174 -0
  29. package/dist/chunk-JSI5S4WP.js.map +1 -0
  30. package/dist/chunk-L4D675BG.js +97 -0
  31. package/dist/chunk-L4D675BG.js.map +1 -0
  32. package/dist/chunk-M6CJ7GQC.js +133 -0
  33. package/dist/chunk-M6CJ7GQC.js.map +1 -0
  34. package/dist/{chunk-CKFT2ZJE.js → chunk-MEIMOSZC.js} +53 -105
  35. package/dist/chunk-MEIMOSZC.js.map +1 -0
  36. package/dist/{chunk-GUEZP773.js → chunk-O3XG3FNL.js} +204 -41
  37. package/dist/chunk-O3XG3FNL.js.map +1 -0
  38. package/dist/chunk-OM6SCJ7H.js +18 -0
  39. package/dist/chunk-OM6SCJ7H.js.map +1 -0
  40. package/dist/chunk-PKD4WVX5.js +63 -0
  41. package/dist/chunk-PKD4WVX5.js.map +1 -0
  42. package/dist/chunk-PMBLXGFM.js +3384 -0
  43. package/dist/chunk-PMBLXGFM.js.map +1 -0
  44. package/dist/chunk-PMNE5GIN.js +279 -0
  45. package/dist/chunk-PMNE5GIN.js.map +1 -0
  46. package/dist/chunk-QAWI64VR.js +148 -0
  47. package/dist/chunk-QAWI64VR.js.map +1 -0
  48. package/dist/chunk-QGADSPHZ.js +449 -0
  49. package/dist/chunk-QGADSPHZ.js.map +1 -0
  50. package/dist/chunk-SPYN66UV.js +338 -0
  51. package/dist/chunk-SPYN66UV.js.map +1 -0
  52. package/dist/context.d.ts +9 -3
  53. package/dist/context.js +2 -1
  54. package/dist/controller.d.ts +33 -7
  55. package/dist/controller.js +18 -8
  56. package/dist/dependencies.d.ts +44 -0
  57. package/dist/dependencies.js +10 -0
  58. package/dist/dev.d.ts +9 -3
  59. package/dist/dev.js +3 -4
  60. package/dist/game-builds.d.ts +200 -0
  61. package/dist/game-builds.js +16 -0
  62. package/dist/game-builds.js.map +1 -0
  63. package/dist/game-run-watch-CEd_SpAT.d.ts +84 -0
  64. package/dist/game-runs.d.ts +1452 -0
  65. package/dist/game-runs.js +76 -0
  66. package/dist/game-runs.js.map +1 -0
  67. package/dist/game-session-broker-CUvORfMd.d.ts +439 -0
  68. package/dist/game-session-broker.d.ts +4 -57
  69. package/dist/game-session-broker.js +33 -228
  70. package/dist/game-session-broker.js.map +1 -1
  71. package/dist/game-session.d.ts +3931 -10
  72. package/dist/game-session.js +186 -15
  73. package/dist/game-session.js.map +1 -1
  74. package/dist/game-settings.d.ts +16 -0
  75. package/dist/game-settings.js +237 -0
  76. package/dist/game-settings.js.map +1 -0
  77. package/dist/games.d.ts +11 -4
  78. package/dist/games.js +4 -2
  79. package/dist/harness/visual.d.ts +34 -151
  80. package/dist/harness/visual.js +6 -1
  81. package/dist/logs.d.ts +8 -2
  82. package/dist/logs.js +3 -4
  83. package/dist/logs.js.map +1 -1
  84. package/dist/managed-process-scope-BicYi_t9.d.ts +3 -0
  85. package/dist/mcp-config.js +2 -1
  86. package/dist/mcp-config.js.map +1 -1
  87. package/dist/platform-auth.d.ts +8 -111
  88. package/dist/platform-auth.js +9 -1
  89. package/dist/platform-game-analytics.d.ts +51 -0
  90. package/dist/platform-game-analytics.js +49 -0
  91. package/dist/platform-game-analytics.js.map +1 -0
  92. package/dist/platform-game-app-id.d.ts +46 -0
  93. package/dist/platform-game-app-id.js +93 -0
  94. package/dist/platform-game-app-id.js.map +1 -0
  95. package/dist/platform-game-media.d.ts +40 -2
  96. package/dist/platform-game-media.js +1 -1
  97. package/dist/platform-games.d.ts +24 -2
  98. package/dist/platform-games.js +16 -84
  99. package/dist/platform-games.js.map +1 -1
  100. package/dist/quality.d.ts +9 -3
  101. package/dist/quality.js +3 -4
  102. package/dist/quality.js.map +1 -1
  103. package/dist/release.d.ts +226 -16
  104. package/dist/release.js +18 -1331
  105. package/dist/release.js.map +1 -1
  106. package/dist/rooms-check.d.ts +90 -0
  107. package/dist/rooms-check.js +717 -0
  108. package/dist/rooms-check.js.map +1 -0
  109. package/dist/source-tree-contract.d.ts +16 -0
  110. package/dist/source-tree-contract.js +13 -0
  111. package/dist/source-tree-contract.js.map +1 -0
  112. package/dist/testing.d.ts +464 -0
  113. package/dist/testing.js +27 -0
  114. package/dist/testing.js.map +1 -0
  115. package/dist/tooling/describe-game.js +54 -0
  116. package/dist/tooling/describe-game.js.map +1 -0
  117. package/dist/tooling/game-session-broker.js +28 -0
  118. package/dist/tooling/game-session-broker.js.map +1 -0
  119. package/dist/tooling/hold-runtime-host.js +769 -67
  120. package/dist/tooling/hold-runtime-host.js.map +1 -1
  121. package/dist/tooling/list-visual-scenarios.js +18 -55
  122. package/dist/tooling/list-visual-scenarios.js.map +1 -1
  123. package/dist/tooling/process-scope-bootstrap.mjs +24 -0
  124. package/dist/tooling/process-scope-guard.d.ts +2 -0
  125. package/dist/tooling/process-scope-guard.js +388 -0
  126. package/dist/tooling/process-scope-guard.js.map +1 -0
  127. package/dist/tooling/process-scope-windows.ps1 +148 -0
  128. package/dist/tooling/rooms-check-device.d.ts +2 -0
  129. package/dist/tooling/rooms-check-device.js +498 -0
  130. package/dist/tooling/rooms-check-device.js.map +1 -0
  131. package/dist/tooling/run-headless-room.d.ts +2 -0
  132. package/dist/tooling/run-headless-room.js +287 -0
  133. package/dist/tooling/run-headless-room.js.map +1 -0
  134. package/dist/tooling/run-test-profile.d.ts +2 -0
  135. package/dist/tooling/run-test-profile.js +181 -0
  136. package/dist/tooling/run-test-profile.js.map +1 -0
  137. package/dist/tooling/run-visual-capture.js +70 -34
  138. package/dist/tooling/run-visual-capture.js.map +1 -1
  139. package/dist/tooling/seal-game-build.d.ts +2 -0
  140. package/dist/tooling/seal-game-build.js +120 -0
  141. package/dist/tooling/seal-game-build.js.map +1 -0
  142. package/dist/{types-C6NrHt88.d.ts → types-CdYrgrG_.d.ts} +337 -76
  143. package/dist/types-DyRD-ym1.d.ts +141 -0
  144. package/dist/visual.d.ts +9 -3
  145. package/dist/visual.js +24 -68
  146. package/dist/visual.js.map +1 -1
  147. package/package.json +51 -14
  148. package/src/bounded-response.ts +28 -0
  149. package/src/built-game-runtime.ts +152 -0
  150. package/src/context.ts +2 -13
  151. package/src/controller-protocol.ts +22 -0
  152. package/src/controller.ts +747 -597
  153. package/src/current-room-host.ts +166 -0
  154. package/src/decision-provider.ts +102 -0
  155. package/src/dependencies.ts +176 -0
  156. package/src/dependency-install-contract.ts +12 -0
  157. package/src/dev.ts +46 -50
  158. package/src/game-action-observation.ts +11 -1
  159. package/src/game-build-protocol.ts +72 -0
  160. package/src/game-build.ts +483 -0
  161. package/src/game-run-owner.ts +2358 -0
  162. package/src/game-run-protocol.ts +448 -0
  163. package/src/game-run-record.ts +92 -0
  164. package/src/game-run-replay.ts +95 -0
  165. package/src/game-run-watch.ts +155 -0
  166. package/src/game-session-broker.ts +689 -197
  167. package/src/game-session-operations.ts +61 -0
  168. package/src/game-session-protocol.ts +180 -0
  169. package/src/game-session-runtime.ts +861 -0
  170. package/src/game-session.ts +164 -417
  171. package/src/game-settings.ts +295 -0
  172. package/src/games.ts +88 -92
  173. package/src/harness/visual/browser.ts +100 -0
  174. package/src/harness/visual/controller-observation.ts +181 -0
  175. package/src/harness/visual/runner.ts +24 -21
  176. package/src/harness/visual/runtime-controller-observations.ts +151 -0
  177. package/src/harness/visual/scenario-contract.ts +1 -2
  178. package/src/harness/visual/scenario-helpers.ts +5 -1
  179. package/src/harness/visual/screencast.ts +155 -0
  180. package/src/harness/visual/session.ts +72 -41
  181. package/src/harness/visual/types.ts +8 -5
  182. package/src/headless-room-protocol.ts +112 -0
  183. package/src/headless-room.ts +222 -0
  184. package/src/helper-channel.ts +229 -0
  185. package/src/helper-scripts.ts +25 -5
  186. package/src/installed-dependencies.ts +74 -0
  187. package/src/managed-process-scope.ts +481 -0
  188. package/src/node-process-environment.ts +10 -0
  189. package/src/platform-auth.ts +194 -55
  190. package/src/platform-game-analytics.ts +50 -0
  191. package/src/platform-game-app-id.ts +99 -0
  192. package/src/platform-games.ts +13 -111
  193. package/src/policy-artifact-contract.ts +52 -0
  194. package/src/policy-artifacts.ts +134 -0
  195. package/src/process-scope-admission.ts +50 -0
  196. package/src/process-scope-protocol.ts +66 -0
  197. package/src/process-scope.ts +327 -0
  198. package/src/release.ts +28 -42
  199. package/src/rooms-check-fleet.ts +194 -0
  200. package/src/rooms-check-link.ts +138 -0
  201. package/src/rooms-check-protocol.ts +244 -0
  202. package/src/rooms-check.ts +797 -0
  203. package/src/runtime-owner-protocol.ts +106 -18
  204. package/src/source-tree-contract.ts +70 -0
  205. package/src/source-tree.ts +84 -0
  206. package/src/test-profile-process.ts +153 -0
  207. package/src/test-profile-protocol.ts +116 -0
  208. package/src/testing.ts +430 -0
  209. package/src/tooling/declaration-hook.ts +52 -0
  210. package/src/tooling/describe-game.ts +49 -0
  211. package/src/tooling/game-session-broker.ts +7 -0
  212. package/src/tooling/hold-runtime-host.ts +255 -38
  213. package/src/tooling/list-visual-scenarios.ts +19 -62
  214. package/src/tooling/load-game.ts +79 -0
  215. package/src/tooling/process-scope-bootstrap.mjs +24 -0
  216. package/src/tooling/process-scope-guard.ts +213 -0
  217. package/src/tooling/process-scope-windows.ps1 +148 -0
  218. package/src/tooling/rooms-check-device.ts +493 -0
  219. package/src/tooling/run-headless-room.ts +326 -0
  220. package/src/tooling/run-test-profile.ts +190 -0
  221. package/src/tooling/run-visual-capture.ts +37 -23
  222. package/src/tooling/runtime-owner-actions.ts +23 -0
  223. package/src/tooling/seal-game-build.ts +118 -0
  224. package/src/tooling/visual-pack.ts +10 -45
  225. package/src/types.ts +54 -77
  226. package/src/visual.ts +14 -22
  227. package/src/windows-process-scopes.ts +189 -0
  228. package/dist/agent.d.ts +0 -15
  229. package/dist/agent.js +0 -19
  230. package/dist/chunk-5YAARMW5.js +0 -36
  231. package/dist/chunk-5YAARMW5.js.map +0 -1
  232. package/dist/chunk-6WQODT37.js +0 -1019
  233. package/dist/chunk-6WQODT37.js.map +0 -1
  234. package/dist/chunk-CKFT2ZJE.js.map +0 -1
  235. package/dist/chunk-ER3Q2C4G.js +0 -358
  236. package/dist/chunk-ER3Q2C4G.js.map +0 -1
  237. package/dist/chunk-GUEZP773.js.map +0 -1
  238. package/dist/chunk-HIDNI56E.js +0 -33
  239. package/dist/chunk-HIDNI56E.js.map +0 -1
  240. package/dist/chunk-QKXS5D35.js +0 -43
  241. package/dist/chunk-QKXS5D35.js.map +0 -1
  242. package/dist/chunk-S4LSCEVE.js +0 -261
  243. package/dist/chunk-S4LSCEVE.js.map +0 -1
  244. package/dist/chunk-VKMJO6VN.js.map +0 -1
  245. package/dist/chunk-WFUR3MXY.js +0 -67
  246. package/dist/chunk-WFUR3MXY.js.map +0 -1
  247. package/dist/chunk-XEMR7KUE.js +0 -361
  248. package/dist/chunk-XEMR7KUE.js.map +0 -1
  249. package/dist/chunk-ZLPD7FY5.js +0 -191
  250. package/dist/chunk-ZLPD7FY5.js.map +0 -1
  251. package/dist/tooling/agent-contract.js +0 -193
  252. package/dist/tooling/agent-contract.js.map +0 -1
  253. package/dist/tooling/inspect-airjam-agent.js +0 -37
  254. package/dist/tooling/inspect-airjam-agent.js.map +0 -1
  255. package/src/agent.ts +0 -380
  256. package/src/tooling/agent-contract.ts +0 -232
  257. package/src/tooling/agent-declaration.ts +0 -36
  258. package/src/tooling/airjam-agent-inspection.ts +0 -45
  259. package/src/tooling/airjam-agent.ts +0 -118
  260. package/src/tooling/inspect-airjam-agent.ts +0 -20
  261. /package/dist/{agent.js.map → dependencies.js.map} +0 -0
  262. /package/dist/tooling/{agent-contract.d.ts → describe-game.d.ts} +0 -0
  263. /package/dist/tooling/{inspect-airjam-agent.d.ts → game-session-broker.d.ts} +0 -0
@@ -1,13 +1,3934 @@
1
- import { O as OpenGameSessionOptions, H as AirJamGameSessionSummary, K as ReadGameSessionOptions, L as AirJamGameSessionInspection, M as SendGameSessionInputOptions, N as SendGameSessionInputResult, P as InvokeGameSessionActionOptions, Q as InvokeGameSessionActionResult, T as CaptureGameSessionVisualsOptions, U as AirJamGameSessionVisualCaptureResult, V as CloseGameSessionOptions, W as CloseGameSessionResult } from './types-C6NrHt88.js';
2
- export { X as AirJamGameSessionActionDescriptor } from './types-C6NrHt88.js';
3
- import '@air-jam/sdk';
1
+ import { z } from 'zod';
2
+ import { AirJamTestProfileDescription } from './testing.js';
3
+ import { CurrentRoomSeatClaim, StartGameRunOptions, CurrentRoomAttachment, gameRunAddressSchema, gameRunWaitSchema, GameRunSteerOptions, gameRunDiscoverySchema } from './game-runs.js';
4
+ export { AirJamGameRunRecord } from './game-runs.js';
5
+ import { HostAgentRequest, HostAgentResponse, HostObservationRequest, HostObservation } from '@air-jam/sdk/runtime-control';
6
+ import { PinnedGameBuild } from './game-builds.js';
7
+ import { ControllerLeasedControl, ControllerLeasedControlAck } from '@air-jam/sdk/protocol';
8
+ import { ak as OpenGameSessionOptions, f as AirJamGameInspection, al as AirJamGameSessionSummary, am as ReadGameSessionOptions, an as AirJamGameSessionInspection, ao as SendGameSessionInputOptions, ap as SendGameSessionInputResult, aq as InvokeGameSessionActionOptions, ar as InvokeGameSessionActionResult, as as CaptureGameSessionVisualsOptions, at as AirJamGameSessionVisualCaptureResult, au as CloseGameSessionOptions, av as CloseGameSessionResult, aw as ControllerDisconnection } from './types-CdYrgrG_.js';
9
+ export { ax as AirJamGameSessionActionDescriptor } from './types-CdYrgrG_.js';
10
+ import { i as GameSurfaceWatcher } from './game-run-watch-CEd_SpAT.js';
11
+ import { a as gameSessionOperationSchemas, w as watchGameSessionBroker } from './game-session-broker-CUvORfMd.js';
12
+ import { P as ProcessScopeObserver } from './managed-process-scope-BicYi_t9.js';
13
+ import './types-DyRD-ym1.js';
14
+ import '@air-jam/sdk/core';
15
+ import '@air-jam/sdk/metadata';
16
+ import 'playwright-core';
4
17
  import '@air-jam/sdk/platform-machine';
18
+ import '@air-jam/sdk/agent-tooling';
19
+ import 'node:stream';
20
+ import '@air-jam/sdk';
21
+
22
+ /** Sends one semantic request to the game's host realm. */
23
+ /** Claims a seat a run's player holds in a room it was granted. */
24
+ type SeatClaimer = (claim: CurrentRoomSeatClaim, timeoutMs: number) => Promise<void>;
25
+ type HostRequester = (request: HostAgentRequest, timeoutMs: number, signal?: AbortSignal) => Promise<HostAgentResponse>;
26
+ declare function createGameSessionRuntime(ownerInstanceId?: `${string}-${string}-${string}-${string}-${string}`): {
27
+ openGameSession: (options?: OpenGameSessionOptions, host?: {
28
+ access: "owned-host" | "delegated-host";
29
+ request: HostRequester;
30
+ claimSeat?: SeatClaimer;
31
+ }, build?: PinnedGameBuild, onScope?: ProcessScopeObserver, settings?: Record<string, number | boolean | string>, game?: AirJamGameInspection) => Promise<AirJamGameSessionSummary>;
32
+ readGameSession: ({ gameSessionId, timeoutMs, }: ReadGameSessionOptions) => Promise<AirJamGameSessionInspection>;
33
+ observeGameSession: ({ gameSessionId, timeoutMs, scope, includeImage, expected, }: ReadGameSessionOptions & Partial<Pick<HostObservationRequest, "scope" | "includeImage" | "expected">>) => Promise<{
34
+ version: 1;
35
+ id: string;
36
+ identity: {
37
+ documentId: string;
38
+ roomId: string;
39
+ contractId: string;
40
+ runtimeId: string;
41
+ surfaceId: string | null;
42
+ participantId: string | null;
43
+ };
44
+ sequence: number;
45
+ scope: "player" | "diagnostic";
46
+ controllerId: string | null;
47
+ capturedAt: string;
48
+ durationMs: number;
49
+ snapshot: Record<string, unknown>;
50
+ runtime: Record<string, unknown> | null;
51
+ ticks: {
52
+ before: number | null;
53
+ after: number | null;
54
+ };
55
+ stores: {
56
+ before: {
57
+ storeDomain: string;
58
+ revision: number;
59
+ }[];
60
+ after: {
61
+ storeDomain: string;
62
+ revision: number;
63
+ }[];
64
+ };
65
+ visual: {
66
+ status: "captured";
67
+ image: {
68
+ mimeType: "image/jpeg" | "image/png" | "image/webp";
69
+ data: string;
70
+ width: number;
71
+ height: number;
72
+ coverage: "render-surface" | "host-document" | "controller-view";
73
+ };
74
+ } | {
75
+ status: "unavailable";
76
+ reason: "timeout" | "unsupported" | "surface-unavailable" | "not-requested";
77
+ detail?: string | undefined;
78
+ };
79
+ host?: {
80
+ before: {
81
+ runtimeState: "paused" | "playing";
82
+ connectionStatus: "connected" | "connecting" | "reconnecting" | "idle" | "disconnected";
83
+ fault?: {
84
+ name: string;
85
+ message: string;
86
+ source: {
87
+ file: string;
88
+ line: number;
89
+ column: number;
90
+ } | null;
91
+ stack: string;
92
+ } | null | undefined;
93
+ } | null;
94
+ after: {
95
+ runtimeState: "paused" | "playing";
96
+ connectionStatus: "connected" | "connecting" | "reconnecting" | "idle" | "disconnected";
97
+ fault?: {
98
+ name: string;
99
+ message: string;
100
+ source: {
101
+ file: string;
102
+ line: number;
103
+ column: number;
104
+ } | null;
105
+ stack: string;
106
+ } | null | undefined;
107
+ } | null;
108
+ } | undefined;
109
+ actions?: {
110
+ actionId: string;
111
+ target: {
112
+ kind: "host" | "participant";
113
+ actionName: string;
114
+ storeDomain: string;
115
+ };
116
+ description: string | null;
117
+ availability: string | null;
118
+ payload: {
119
+ kind: "string" | "number" | "boolean" | "enum" | "none" | "json";
120
+ description: string | null;
121
+ allowedValues?: string[] | undefined;
122
+ };
123
+ resultDescription: string | null;
124
+ }[] | undefined;
125
+ capabilities?: {
126
+ participantControl?: {
127
+ input?: 1 | undefined;
128
+ inputSchema?: {
129
+ status: "available";
130
+ schema: Record<string, z.core.util.JSONType>;
131
+ } | {
132
+ status: "unavailable";
133
+ reason: "not-configured" | "not-representable";
134
+ } | undefined;
135
+ actions?: 1 | undefined;
136
+ } | undefined;
137
+ } | undefined;
138
+ clock?: {
139
+ startedAtMs: number;
140
+ finishedAtMs: number;
141
+ } | undefined;
142
+ pace?: {
143
+ frames: number;
144
+ wallMs: number;
145
+ simulatedMs: number;
146
+ } | undefined;
147
+ }>;
148
+ readGameSettings: (options: z.infer<(typeof gameSessionOperationSchemas)["settings-read"]>) => Promise<{
149
+ values: Record<string, string | number | boolean>;
150
+ revision: number;
151
+ }>;
152
+ updateGameSettings: (options: z.infer<(typeof gameSessionOperationSchemas)["settings-update"]>) => Promise<{
153
+ values: Record<string, string | number | boolean>;
154
+ revision: number;
155
+ }>;
156
+ sendGameSessionInput: ({ gameSessionId, input, }: SendGameSessionInputOptions) => Promise<SendGameSessionInputResult>;
157
+ controlGameSessionParticipant: (options: z.infer<typeof gameSessionOperationSchemas.control>) => Promise<{
158
+ status: "applied";
159
+ leaseId: string;
160
+ sequence: number;
161
+ replayed: boolean;
162
+ operation: {
163
+ kind: "input";
164
+ } | {
165
+ kind: "release";
166
+ } | {
167
+ kind: "action";
168
+ result: {
169
+ ok: true;
170
+ status: "accepted";
171
+ source: "client" | "host";
172
+ result?: unknown;
173
+ } | {
174
+ ok: false;
175
+ status: "rejected";
176
+ source: "client" | "host" | "server";
177
+ reason: string;
178
+ message: string;
179
+ details?: Record<string, unknown> | undefined;
180
+ } | {
181
+ ok: false;
182
+ status: "unconfirmed";
183
+ source: "client";
184
+ };
185
+ };
186
+ } | {
187
+ status: "rejected";
188
+ reason: "busy" | "unsupported" | "invalid_request" | "rate_limited" | "invalid_input" | "invalid_action" | "invalid_action_lane" | "room_not_found" | "unauthorized" | "active_host_missing" | "stale_identity" | "stale_decision" | "invalid_deadline" | "lease_conflict" | "stale_sequence" | "sequence_conflict";
189
+ } | {
190
+ status: "unconfirmed";
191
+ reason: "runtime_replaced" | "host_ack_unavailable" | "transport_ack_unavailable" | "invalid_acknowledgement" | "runtime_unavailable";
192
+ }>;
193
+ invokeGameSessionAction: (options: InvokeGameSessionActionOptions) => Promise<InvokeGameSessionActionResult>;
194
+ captureGameSessionVisuals: ({ gameSessionId, timeoutMs, }: CaptureGameSessionVisualsOptions) => Promise<AirJamGameSessionVisualCaptureResult>;
195
+ closeGameSession: (input: CloseGameSessionOptions) => Promise<CloseGameSessionResult>;
196
+ openRunSession(options: OpenGameSessionOptions, { delegation, game, build, room, settings, onScope, }?: {
197
+ /** The creator's host, how many seats the run may hold there, and how it claims each. */
198
+ delegation?: {
199
+ host: HostRequester;
200
+ seats: number;
201
+ claimSeat: SeatClaimer;
202
+ };
203
+ game?: AirJamGameInspection;
204
+ build?: PinnedGameBuild;
205
+ /** A headless room this run owns; its players join it on game time. */
206
+ room?: HeadlessRoom;
207
+ settings?: Record<string, number | boolean | string>;
208
+ onScope?: ProcessScopeObserver;
209
+ }): Promise<GameRunSession>;
210
+ };
211
+
212
+ type HeadlessRoom = {
213
+ gameId: string | null;
214
+ roomId: string;
215
+ controllerJoinUrl: string;
216
+ /** Reaches the room's host directly, as an owned host. */
217
+ requestHost: HostRequester;
218
+ /** Game time: waiting advances the game rather than the wall clock. */
219
+ clock: GameRunClock;
220
+ /**
221
+ * Writes everything that reached the game so far, by step, for replays;
222
+ * null when the game declares no simulation to replay.
223
+ */
224
+ saveInputLog: ((path: string) => Promise<{
225
+ sha256: string;
226
+ ticks: number;
227
+ stepMs: number;
228
+ entries: number;
229
+ full: boolean;
230
+ }>) | null;
231
+ stop: () => Promise<void>;
232
+ };
233
+
234
+ type HostObservationIdentity = HostObservation["identity"];
235
+ type GameRunParticipant = {
236
+ watch: GameSurfaceWatcher;
237
+ controllerId: string;
238
+ checkConnected: () => Promise<void>;
239
+ observe: (options: {
240
+ scope: "player" | "diagnostic";
241
+ includeImage: boolean;
242
+ expected?: HostObservationIdentity;
243
+ }) => Promise<HostObservation>;
244
+ control: (request: Pick<ControllerLeasedControl, "expected" | "lease" | "operation">) => Promise<ControllerLeasedControlAck>;
245
+ close: () => Promise<ControllerDisconnection>;
246
+ forceClose: () => Promise<ControllerDisconnection>;
247
+ };
248
+ /**
249
+ * The time a run plays on. A live room plays on the wall clock; a headless
250
+ * room's clock is game time, which moves only while the run waits on it.
251
+ */
252
+ type GameRunClock = {
253
+ now: () => number;
254
+ wait: (ms: number, signal?: AbortSignal) => Promise<void>;
255
+ };
256
+ type GameRunSession = Omit<GameRunParticipant, "controllerId" | "close" | "forceClose"> & {
257
+ summary: AirJamGameSessionSummary;
258
+ clock: GameRunClock;
259
+ watchHost: GameSurfaceWatcher;
260
+ requestHost?: (request: HostAgentRequest, timeoutMs: number) => Promise<HostAgentResponse>;
261
+ readParticipants: () => Promise<{
262
+ roomId: string;
263
+ controllerIds: string[];
264
+ }>;
265
+ addParticipant: (nickname: string) => Promise<GameRunParticipant>;
266
+ invokeHost: (actionId: string, input: unknown) => Promise<unknown>;
267
+ close: () => Promise<CloseGameSessionResult>;
268
+ forceClose: () => Promise<CloseGameSessionResult>;
269
+ };
270
+
271
+ /**
272
+ * Replays an ended headless run from its input log on a fresh copy of the
273
+ * game, and compares where the replay ends with the run's final observation.
274
+ */
275
+ declare function replayGameRun({ cwd, runId, }: {
276
+ cwd?: string;
277
+ runId: string;
278
+ }): Promise<{
279
+ runId: string;
280
+ gameId: string | null;
281
+ ticks: number;
282
+ reproduced: boolean;
283
+ replayed: {
284
+ snapshot: Record<string, unknown>;
285
+ runtime: Record<string, unknown> | null;
286
+ tick: number | null;
287
+ };
288
+ recorded: {
289
+ snapshot: Record<string, unknown>;
290
+ runtime: Record<string, unknown> | null;
291
+ tick: number | null;
292
+ };
293
+ }>;
294
+
295
+ type ControlGameSessionParticipantOptions = Parameters<ReturnType<typeof createGameSessionRuntime>["controlGameSessionParticipant"]>[0];
296
+ type ObserveGameSessionOptions = Parameters<ReturnType<typeof createGameSessionRuntime>["observeGameSession"]>[0];
297
+ declare const openGameSession: (input?: OpenGameSessionOptions) => Promise<AirJamGameSessionSummary>;
298
+ declare const readGameSession: (input: ReadGameSessionOptions) => Promise<AirJamGameSessionInspection>;
299
+ declare const observeGameSession: (input: ObserveGameSessionOptions) => Promise<{
300
+ version: 1;
301
+ id: string;
302
+ identity: {
303
+ documentId: string;
304
+ roomId: string;
305
+ contractId: string;
306
+ runtimeId: string;
307
+ surfaceId: string | null;
308
+ participantId: string | null;
309
+ };
310
+ sequence: number;
311
+ scope: "player" | "diagnostic";
312
+ controllerId: string | null;
313
+ capturedAt: string;
314
+ durationMs: number;
315
+ snapshot: Record<string, unknown>;
316
+ runtime: Record<string, unknown> | null;
317
+ ticks: {
318
+ before: number | null;
319
+ after: number | null;
320
+ };
321
+ stores: {
322
+ before: {
323
+ storeDomain: string;
324
+ revision: number;
325
+ }[];
326
+ after: {
327
+ storeDomain: string;
328
+ revision: number;
329
+ }[];
330
+ };
331
+ visual: {
332
+ status: "captured";
333
+ image: {
334
+ mimeType: "image/jpeg" | "image/png" | "image/webp";
335
+ data: string;
336
+ width: number;
337
+ height: number;
338
+ coverage: "render-surface" | "host-document" | "controller-view";
339
+ };
340
+ } | {
341
+ status: "unavailable";
342
+ reason: "timeout" | "unsupported" | "surface-unavailable" | "not-requested";
343
+ detail?: string | undefined;
344
+ };
345
+ host?: {
346
+ before: {
347
+ runtimeState: "paused" | "playing";
348
+ connectionStatus: "connected" | "connecting" | "reconnecting" | "idle" | "disconnected";
349
+ fault?: {
350
+ name: string;
351
+ message: string;
352
+ source: {
353
+ file: string;
354
+ line: number;
355
+ column: number;
356
+ } | null;
357
+ stack: string;
358
+ } | null | undefined;
359
+ } | null;
360
+ after: {
361
+ runtimeState: "paused" | "playing";
362
+ connectionStatus: "connected" | "connecting" | "reconnecting" | "idle" | "disconnected";
363
+ fault?: {
364
+ name: string;
365
+ message: string;
366
+ source: {
367
+ file: string;
368
+ line: number;
369
+ column: number;
370
+ } | null;
371
+ stack: string;
372
+ } | null | undefined;
373
+ } | null;
374
+ } | undefined;
375
+ actions?: {
376
+ actionId: string;
377
+ target: {
378
+ kind: "host" | "participant";
379
+ actionName: string;
380
+ storeDomain: string;
381
+ };
382
+ description: string | null;
383
+ availability: string | null;
384
+ payload: {
385
+ kind: "string" | "number" | "boolean" | "json" | "enum" | "none";
386
+ description: string | null;
387
+ allowedValues?: string[] | undefined;
388
+ };
389
+ resultDescription: string | null;
390
+ }[] | undefined;
391
+ capabilities?: {
392
+ participantControl?: {
393
+ input?: 1 | undefined;
394
+ inputSchema?: {
395
+ status: "available";
396
+ schema: Record<string, z.core.util.JSONType>;
397
+ } | {
398
+ status: "unavailable";
399
+ reason: "not-configured" | "not-representable";
400
+ } | undefined;
401
+ actions?: 1 | undefined;
402
+ } | undefined;
403
+ } | undefined;
404
+ clock?: {
405
+ startedAtMs: number;
406
+ finishedAtMs: number;
407
+ } | undefined;
408
+ pace?: {
409
+ frames: number;
410
+ wallMs: number;
411
+ simulatedMs: number;
412
+ } | undefined;
413
+ }>;
414
+ declare const readGameSettings: (input: z.infer<(typeof gameSessionOperationSchemas)["settings-read"]>) => Promise<{
415
+ values: Record<string, string | number | boolean>;
416
+ revision: number;
417
+ }>;
418
+ declare const updateGameSettings: (input: z.infer<(typeof gameSessionOperationSchemas)["settings-update"]>) => Promise<{
419
+ values: Record<string, string | number | boolean>;
420
+ revision: number;
421
+ }>;
422
+ declare const controlGameSessionParticipant: (input: ControlGameSessionParticipantOptions) => Promise<{
423
+ status: "applied";
424
+ leaseId: string;
425
+ sequence: number;
426
+ replayed: boolean;
427
+ operation: {
428
+ kind: "input";
429
+ } | {
430
+ kind: "release";
431
+ } | {
432
+ kind: "action";
433
+ result: {
434
+ ok: true;
435
+ status: "accepted";
436
+ source: "client" | "host";
437
+ result?: unknown;
438
+ } | {
439
+ ok: false;
440
+ status: "rejected";
441
+ source: "server" | "client" | "host";
442
+ reason: string;
443
+ message: string;
444
+ details?: Record<string, unknown> | undefined;
445
+ } | {
446
+ ok: false;
447
+ status: "unconfirmed";
448
+ source: "client";
449
+ };
450
+ };
451
+ } | {
452
+ status: "rejected";
453
+ reason: "busy" | "unsupported" | "invalid_request" | "rate_limited" | "invalid_input" | "invalid_action" | "invalid_action_lane" | "room_not_found" | "unauthorized" | "active_host_missing" | "stale_identity" | "stale_decision" | "invalid_deadline" | "lease_conflict" | "stale_sequence" | "sequence_conflict";
454
+ } | {
455
+ status: "unconfirmed";
456
+ reason: "runtime_replaced" | "host_ack_unavailable" | "transport_ack_unavailable" | "invalid_acknowledgement" | "runtime_unavailable";
457
+ }>;
458
+ declare const sendGameSessionInput: (input: SendGameSessionInputOptions) => Promise<SendGameSessionInputResult>;
459
+ declare const invokeGameSessionAction: (input: InvokeGameSessionActionOptions) => Promise<InvokeGameSessionActionResult>;
460
+ declare const captureGameSessionVisuals: (input: CaptureGameSessionVisualsOptions) => Promise<AirJamGameSessionVisualCaptureResult>;
461
+ declare const closeGameSession: (input: CloseGameSessionOptions) => Promise<CloseGameSessionResult>;
462
+ declare const startGameRun: (input: StartGameRunOptions, attachment?: CurrentRoomAttachment) => Promise<{
463
+ version: 1;
464
+ runId: string;
465
+ ownerInstanceId: string;
466
+ request: {
467
+ runId: string;
468
+ target: {
469
+ kind: "owned";
470
+ } | {
471
+ kind: "current";
472
+ } | {
473
+ kind: "headless";
474
+ };
475
+ seed: number;
476
+ kind: "test";
477
+ profileId: string;
478
+ policyId: string;
479
+ budget: {
480
+ durationMs: number;
481
+ steps: number;
482
+ };
483
+ cwd?: string | undefined;
484
+ gameId?: string | undefined;
485
+ settings?: Record<string, string | number | boolean> | undefined;
486
+ intents?: Record<string, string> | undefined;
487
+ } | {
488
+ runId: string;
489
+ seed: number;
490
+ kind: "play";
491
+ target: {
492
+ kind: "current";
493
+ };
494
+ cwd?: string | undefined;
495
+ gameId?: string | undefined;
496
+ intent?: string | undefined;
497
+ };
498
+ state: "setup" | "playing" | "starting" | "stopping" | "ended";
499
+ startedAt: string;
500
+ seats: {
501
+ seatId: string;
502
+ controllerId: string;
503
+ counters: {
504
+ decisions: number;
505
+ applied: number;
506
+ rejected: number;
507
+ unconfirmed: number;
508
+ timeout: number;
509
+ blocked: number;
510
+ effects: number;
511
+ };
512
+ intent: string | null;
513
+ expected?: {
514
+ documentId: string;
515
+ roomId: string;
516
+ contractId: string;
517
+ runtimeId: string;
518
+ surfaceId: string | null;
519
+ participantId: string | null;
520
+ } | undefined;
521
+ answers?: {
522
+ asked: number;
523
+ answered: number;
524
+ missed: number;
525
+ lowConfidence: number;
526
+ lowConfidenceStretches: number;
527
+ choices: Record<string, number>;
528
+ automatic?: number | undefined;
529
+ } | undefined;
530
+ }[];
531
+ counters: {
532
+ steps: number;
533
+ applied: number;
534
+ rejected: number;
535
+ unconfirmed: number;
536
+ missed: number;
537
+ };
538
+ endedAt?: string | undefined;
539
+ stopRequestedAt?: string | undefined;
540
+ abortedAt?: string | undefined;
541
+ lastInputAt?: string | undefined;
542
+ releaseAcknowledgedAt?: string | undefined;
543
+ rosterJoinedAt?: string | undefined;
544
+ playStartedAt?: string | undefined;
545
+ watched?: true | undefined;
546
+ profile?: {
547
+ id: string;
548
+ label: string;
549
+ seats: {
550
+ id: string;
551
+ label: string;
552
+ }[];
553
+ setup: ({
554
+ lane: "host";
555
+ actionId: string;
556
+ input?: z.core.util.JSONType | undefined;
557
+ } | {
558
+ lane: "participant";
559
+ seatId: string;
560
+ actionId: string;
561
+ input?: z.core.util.JSONType | undefined;
562
+ })[];
563
+ actions: string[];
564
+ scope: "player" | "diagnostic";
565
+ includeImage: boolean;
566
+ timing: {
567
+ intervalMs: number;
568
+ decisionMs: number;
569
+ inputTtlMs: number;
570
+ };
571
+ policies: {
572
+ id: string;
573
+ label: string;
574
+ artifacts?: string | undefined;
575
+ }[];
576
+ metrics: {
577
+ id: string;
578
+ label: string;
579
+ }[];
580
+ handBack?: ({
581
+ lane: "host";
582
+ actionId: string;
583
+ input?: z.core.util.JSONType | undefined;
584
+ } | {
585
+ lane: "participant";
586
+ seatId: string;
587
+ actionId: string;
588
+ input?: z.core.util.JSONType | undefined;
589
+ })[] | undefined;
590
+ } | undefined;
591
+ policyPreparation?: {
592
+ seatId: string;
593
+ prepareMs: number;
594
+ }[] | undefined;
595
+ policyInitializationMs?: number | undefined;
596
+ policyArtifacts?: {
597
+ manifestSha256: string;
598
+ manifest: {
599
+ version: 1;
600
+ provenance: Record<string, z.core.util.JSONType>;
601
+ files: {
602
+ path: string;
603
+ bytes: number;
604
+ sha256: string;
605
+ }[];
606
+ };
607
+ verifyMs: number;
608
+ } | undefined;
609
+ decisionModel?: string | undefined;
610
+ build?: {
611
+ version: 1;
612
+ buildKey: string;
613
+ sourceHash: string;
614
+ lockfileHash: string;
615
+ distHash: string;
616
+ toolchain: {
617
+ node: string;
618
+ pnpm: string;
619
+ devtools: string;
620
+ platform: string;
621
+ architecture: string;
622
+ implementationHash: string;
623
+ environmentHash: string;
624
+ projectRoot: string;
625
+ nodeAbi: string;
626
+ };
627
+ dependencies: {
628
+ installedTreeHash: string;
629
+ installedLockfileHash: string;
630
+ installation: {
631
+ durationMs: number;
632
+ packageCount: number;
633
+ reused: number;
634
+ downloaded: number;
635
+ added: number;
636
+ stages: {
637
+ stage: string;
638
+ offsetMs: number;
639
+ }[];
640
+ importMethods?: string[] | undefined;
641
+ };
642
+ };
643
+ createdAt: string;
644
+ integrity: "sealed" | "verified" | "changed";
645
+ } | undefined;
646
+ session?: {
647
+ gameSessionId: string;
648
+ gameId: string | null;
649
+ roomId: string;
650
+ controllerId: string;
651
+ semanticAccess: "owned-host" | "delegated-host" | "participant-only";
652
+ connected: boolean;
653
+ } | undefined;
654
+ expected?: {
655
+ documentId: string;
656
+ roomId: string;
657
+ contractId: string;
658
+ runtimeId: string;
659
+ surfaceId: string | null;
660
+ participantId: string | null;
661
+ } | undefined;
662
+ hostPace?: {
663
+ framesPerSecond: number;
664
+ simulationSpeed: number;
665
+ } | undefined;
666
+ steering?: {
667
+ at: string;
668
+ seatId: string;
669
+ intent: string | null;
670
+ source: "agent" | "creator" | "operator";
671
+ }[] | undefined;
672
+ evaluation?: {
673
+ play?: {
674
+ status: "failed" | "pending" | "passed";
675
+ message?: string | undefined;
676
+ metrics?: Record<string, number> | undefined;
677
+ } | undefined;
678
+ final?: {
679
+ status: "failed" | "pending" | "passed";
680
+ message?: string | undefined;
681
+ metrics?: Record<string, number> | undefined;
682
+ } | undefined;
683
+ } | undefined;
684
+ end?: {
685
+ reason: "error" | "runtime_replaced" | "failed" | "budget" | "completed" | "safety_deadline" | "stopped" | "owner_stopping" | "owner_lost" | "session_expired" | "policy_unresponsive" | "decision_latency" | "host_not_advancing" | "seat_replaced" | "untested_seat" | "evaluator_unresponsive" | "trace_budget";
686
+ message: string;
687
+ outcome?: "failed" | "passed" | "inconclusive" | undefined;
688
+ hostFault?: {
689
+ name: string;
690
+ message: string;
691
+ source: {
692
+ file: string;
693
+ line: number;
694
+ column: number;
695
+ } | null;
696
+ stack: string;
697
+ } | undefined;
698
+ } | undefined;
699
+ cleanup?: {
700
+ participantsClosed: boolean;
701
+ seats: {
702
+ seatId: string;
703
+ release?: {
704
+ status: "applied";
705
+ leaseId: string;
706
+ sequence: number;
707
+ replayed: boolean;
708
+ operation: {
709
+ kind: "input";
710
+ } | {
711
+ kind: "release";
712
+ } | {
713
+ kind: "action";
714
+ result: {
715
+ ok: true;
716
+ status: "accepted";
717
+ source: "client" | "host";
718
+ result?: unknown;
719
+ } | {
720
+ ok: false;
721
+ status: "rejected";
722
+ source: "server" | "client" | "host";
723
+ reason: string;
724
+ message: string;
725
+ details?: Record<string, unknown> | undefined;
726
+ } | {
727
+ ok: false;
728
+ status: "unconfirmed";
729
+ source: "client";
730
+ };
731
+ };
732
+ } | {
733
+ status: "rejected";
734
+ reason: "busy" | "unsupported" | "invalid_request" | "rate_limited" | "invalid_input" | "invalid_action" | "invalid_action_lane" | "room_not_found" | "unauthorized" | "active_host_missing" | "stale_identity" | "stale_decision" | "invalid_deadline" | "lease_conflict" | "stale_sequence" | "sequence_conflict";
735
+ } | {
736
+ status: "unconfirmed";
737
+ reason: "runtime_replaced" | "host_ack_unavailable" | "transport_ack_unavailable" | "invalid_acknowledgement" | "runtime_unavailable";
738
+ } | undefined;
739
+ disconnection?: {
740
+ release: {
741
+ status: "applied";
742
+ leaseId: string;
743
+ sequence: number;
744
+ replayed: boolean;
745
+ operation: {
746
+ kind: "input";
747
+ } | {
748
+ kind: "release";
749
+ } | {
750
+ kind: "action";
751
+ result: {
752
+ ok: true;
753
+ status: "accepted";
754
+ source: "client" | "host";
755
+ result?: unknown;
756
+ } | {
757
+ ok: false;
758
+ status: "rejected";
759
+ source: "server" | "client" | "host";
760
+ reason: string;
761
+ message: string;
762
+ details?: Record<string, unknown> | undefined;
763
+ } | {
764
+ ok: false;
765
+ status: "unconfirmed";
766
+ source: "client";
767
+ };
768
+ };
769
+ } | {
770
+ status: "rejected";
771
+ reason: "busy" | "unsupported" | "invalid_request" | "rate_limited" | "invalid_input" | "invalid_action" | "invalid_action_lane" | "room_not_found" | "unauthorized" | "active_host_missing" | "stale_identity" | "stale_decision" | "invalid_deadline" | "lease_conflict" | "stale_sequence" | "sequence_conflict";
772
+ } | {
773
+ status: "unconfirmed";
774
+ reason: "runtime_replaced" | "host_ack_unavailable" | "transport_ack_unavailable" | "invalid_acknowledgement" | "runtime_unavailable";
775
+ } | {
776
+ status: "not-leased";
777
+ };
778
+ leave: {
779
+ status: "acknowledged";
780
+ } | {
781
+ status: "not-connected";
782
+ } | {
783
+ status: "rejected";
784
+ message: string;
785
+ } | {
786
+ status: "unconfirmed";
787
+ message: string;
788
+ };
789
+ } | undefined;
790
+ }[];
791
+ errors: string[];
792
+ processesClosed?: boolean | undefined;
793
+ close?: {
794
+ closed: boolean;
795
+ disconnection: {
796
+ release: {
797
+ status: "applied";
798
+ leaseId: string;
799
+ sequence: number;
800
+ replayed: boolean;
801
+ operation: {
802
+ kind: "input";
803
+ } | {
804
+ kind: "release";
805
+ } | {
806
+ kind: "action";
807
+ result: {
808
+ ok: true;
809
+ status: "accepted";
810
+ source: "client" | "host";
811
+ result?: unknown;
812
+ } | {
813
+ ok: false;
814
+ status: "rejected";
815
+ source: "server" | "client" | "host";
816
+ reason: string;
817
+ message: string;
818
+ details?: Record<string, unknown> | undefined;
819
+ } | {
820
+ ok: false;
821
+ status: "unconfirmed";
822
+ source: "client";
823
+ };
824
+ };
825
+ } | {
826
+ status: "rejected";
827
+ reason: "busy" | "unsupported" | "invalid_request" | "rate_limited" | "invalid_input" | "invalid_action" | "invalid_action_lane" | "room_not_found" | "unauthorized" | "active_host_missing" | "stale_identity" | "stale_decision" | "invalid_deadline" | "lease_conflict" | "stale_sequence" | "sequence_conflict";
828
+ } | {
829
+ status: "unconfirmed";
830
+ reason: "runtime_replaced" | "host_ack_unavailable" | "transport_ack_unavailable" | "invalid_acknowledgement" | "runtime_unavailable";
831
+ } | {
832
+ status: "not-leased";
833
+ };
834
+ leave: {
835
+ status: "acknowledged";
836
+ } | {
837
+ status: "not-connected";
838
+ } | {
839
+ status: "rejected";
840
+ message: string;
841
+ } | {
842
+ status: "unconfirmed";
843
+ message: string;
844
+ };
845
+ };
846
+ } | undefined;
847
+ forced?: true | undefined;
848
+ handBack?: "failed" | "returned" | "undeclared" | undefined;
849
+ } | undefined;
850
+ evidence?: {
851
+ observation: {
852
+ path: string;
853
+ sha256: string;
854
+ } | null;
855
+ error: string | null;
856
+ clip?: {
857
+ status: "captured";
858
+ path: string;
859
+ sha256: string;
860
+ bytes: number;
861
+ frames: number;
862
+ durationMs: number;
863
+ } | {
864
+ status: "not-captured";
865
+ reason: "headless" | "busy" | "unsupported" | "surface-unavailable" | "capture-failed" | "runtime-replaced" | "host-unavailable";
866
+ } | undefined;
867
+ buildLog?: {
868
+ path: string;
869
+ sha256: string;
870
+ bytes: number;
871
+ truncated: boolean;
872
+ } | undefined;
873
+ trace?: {
874
+ path: string;
875
+ sha256: string;
876
+ bytes: number;
877
+ truncated: boolean;
878
+ } | undefined;
879
+ replay?: {
880
+ reason: "loading" | "runtime-replaced" | "host-unavailable" | "no-simulation";
881
+ message: string;
882
+ } | undefined;
883
+ inputLog?: {
884
+ path: string;
885
+ sha256: string;
886
+ ticks: number;
887
+ stepMs: number;
888
+ entries: number;
889
+ fromTick: number;
890
+ full: boolean;
891
+ } | undefined;
892
+ } | undefined;
893
+ }>;
894
+ declare const readGameRun: (input: z.infer<typeof gameRunAddressSchema>) => Promise<{
895
+ version: 1;
896
+ runId: string;
897
+ ownerInstanceId: string;
898
+ request: {
899
+ runId: string;
900
+ target: {
901
+ kind: "owned";
902
+ } | {
903
+ kind: "current";
904
+ } | {
905
+ kind: "headless";
906
+ };
907
+ seed: number;
908
+ kind: "test";
909
+ profileId: string;
910
+ policyId: string;
911
+ budget: {
912
+ durationMs: number;
913
+ steps: number;
914
+ };
915
+ cwd?: string | undefined;
916
+ gameId?: string | undefined;
917
+ settings?: Record<string, string | number | boolean> | undefined;
918
+ intents?: Record<string, string> | undefined;
919
+ } | {
920
+ runId: string;
921
+ seed: number;
922
+ kind: "play";
923
+ target: {
924
+ kind: "current";
925
+ };
926
+ cwd?: string | undefined;
927
+ gameId?: string | undefined;
928
+ intent?: string | undefined;
929
+ };
930
+ state: "setup" | "playing" | "starting" | "stopping" | "ended";
931
+ startedAt: string;
932
+ seats: {
933
+ seatId: string;
934
+ controllerId: string;
935
+ counters: {
936
+ decisions: number;
937
+ applied: number;
938
+ rejected: number;
939
+ unconfirmed: number;
940
+ timeout: number;
941
+ blocked: number;
942
+ effects: number;
943
+ };
944
+ intent: string | null;
945
+ expected?: {
946
+ documentId: string;
947
+ roomId: string;
948
+ contractId: string;
949
+ runtimeId: string;
950
+ surfaceId: string | null;
951
+ participantId: string | null;
952
+ } | undefined;
953
+ answers?: {
954
+ asked: number;
955
+ answered: number;
956
+ missed: number;
957
+ lowConfidence: number;
958
+ lowConfidenceStretches: number;
959
+ choices: Record<string, number>;
960
+ automatic?: number | undefined;
961
+ } | undefined;
962
+ }[];
963
+ counters: {
964
+ steps: number;
965
+ applied: number;
966
+ rejected: number;
967
+ unconfirmed: number;
968
+ missed: number;
969
+ };
970
+ endedAt?: string | undefined;
971
+ stopRequestedAt?: string | undefined;
972
+ abortedAt?: string | undefined;
973
+ lastInputAt?: string | undefined;
974
+ releaseAcknowledgedAt?: string | undefined;
975
+ rosterJoinedAt?: string | undefined;
976
+ playStartedAt?: string | undefined;
977
+ watched?: true | undefined;
978
+ profile?: {
979
+ id: string;
980
+ label: string;
981
+ seats: {
982
+ id: string;
983
+ label: string;
984
+ }[];
985
+ setup: ({
986
+ lane: "host";
987
+ actionId: string;
988
+ input?: z.core.util.JSONType | undefined;
989
+ } | {
990
+ lane: "participant";
991
+ seatId: string;
992
+ actionId: string;
993
+ input?: z.core.util.JSONType | undefined;
994
+ })[];
995
+ actions: string[];
996
+ scope: "player" | "diagnostic";
997
+ includeImage: boolean;
998
+ timing: {
999
+ intervalMs: number;
1000
+ decisionMs: number;
1001
+ inputTtlMs: number;
1002
+ };
1003
+ policies: {
1004
+ id: string;
1005
+ label: string;
1006
+ artifacts?: string | undefined;
1007
+ }[];
1008
+ metrics: {
1009
+ id: string;
1010
+ label: string;
1011
+ }[];
1012
+ handBack?: ({
1013
+ lane: "host";
1014
+ actionId: string;
1015
+ input?: z.core.util.JSONType | undefined;
1016
+ } | {
1017
+ lane: "participant";
1018
+ seatId: string;
1019
+ actionId: string;
1020
+ input?: z.core.util.JSONType | undefined;
1021
+ })[] | undefined;
1022
+ } | undefined;
1023
+ policyPreparation?: {
1024
+ seatId: string;
1025
+ prepareMs: number;
1026
+ }[] | undefined;
1027
+ policyInitializationMs?: number | undefined;
1028
+ policyArtifacts?: {
1029
+ manifestSha256: string;
1030
+ manifest: {
1031
+ version: 1;
1032
+ provenance: Record<string, z.core.util.JSONType>;
1033
+ files: {
1034
+ path: string;
1035
+ bytes: number;
1036
+ sha256: string;
1037
+ }[];
1038
+ };
1039
+ verifyMs: number;
1040
+ } | undefined;
1041
+ decisionModel?: string | undefined;
1042
+ build?: {
1043
+ version: 1;
1044
+ buildKey: string;
1045
+ sourceHash: string;
1046
+ lockfileHash: string;
1047
+ distHash: string;
1048
+ toolchain: {
1049
+ node: string;
1050
+ pnpm: string;
1051
+ devtools: string;
1052
+ platform: string;
1053
+ architecture: string;
1054
+ implementationHash: string;
1055
+ environmentHash: string;
1056
+ projectRoot: string;
1057
+ nodeAbi: string;
1058
+ };
1059
+ dependencies: {
1060
+ installedTreeHash: string;
1061
+ installedLockfileHash: string;
1062
+ installation: {
1063
+ durationMs: number;
1064
+ packageCount: number;
1065
+ reused: number;
1066
+ downloaded: number;
1067
+ added: number;
1068
+ stages: {
1069
+ stage: string;
1070
+ offsetMs: number;
1071
+ }[];
1072
+ importMethods?: string[] | undefined;
1073
+ };
1074
+ };
1075
+ createdAt: string;
1076
+ integrity: "sealed" | "verified" | "changed";
1077
+ } | undefined;
1078
+ session?: {
1079
+ gameSessionId: string;
1080
+ gameId: string | null;
1081
+ roomId: string;
1082
+ controllerId: string;
1083
+ semanticAccess: "owned-host" | "delegated-host" | "participant-only";
1084
+ connected: boolean;
1085
+ } | undefined;
1086
+ expected?: {
1087
+ documentId: string;
1088
+ roomId: string;
1089
+ contractId: string;
1090
+ runtimeId: string;
1091
+ surfaceId: string | null;
1092
+ participantId: string | null;
1093
+ } | undefined;
1094
+ hostPace?: {
1095
+ framesPerSecond: number;
1096
+ simulationSpeed: number;
1097
+ } | undefined;
1098
+ steering?: {
1099
+ at: string;
1100
+ seatId: string;
1101
+ intent: string | null;
1102
+ source: "agent" | "creator" | "operator";
1103
+ }[] | undefined;
1104
+ evaluation?: {
1105
+ play?: {
1106
+ status: "failed" | "pending" | "passed";
1107
+ message?: string | undefined;
1108
+ metrics?: Record<string, number> | undefined;
1109
+ } | undefined;
1110
+ final?: {
1111
+ status: "failed" | "pending" | "passed";
1112
+ message?: string | undefined;
1113
+ metrics?: Record<string, number> | undefined;
1114
+ } | undefined;
1115
+ } | undefined;
1116
+ end?: {
1117
+ reason: "error" | "runtime_replaced" | "failed" | "budget" | "completed" | "safety_deadline" | "stopped" | "owner_stopping" | "owner_lost" | "session_expired" | "policy_unresponsive" | "decision_latency" | "host_not_advancing" | "seat_replaced" | "untested_seat" | "evaluator_unresponsive" | "trace_budget";
1118
+ message: string;
1119
+ outcome?: "failed" | "passed" | "inconclusive" | undefined;
1120
+ hostFault?: {
1121
+ name: string;
1122
+ message: string;
1123
+ source: {
1124
+ file: string;
1125
+ line: number;
1126
+ column: number;
1127
+ } | null;
1128
+ stack: string;
1129
+ } | undefined;
1130
+ } | undefined;
1131
+ cleanup?: {
1132
+ participantsClosed: boolean;
1133
+ seats: {
1134
+ seatId: string;
1135
+ release?: {
1136
+ status: "applied";
1137
+ leaseId: string;
1138
+ sequence: number;
1139
+ replayed: boolean;
1140
+ operation: {
1141
+ kind: "input";
1142
+ } | {
1143
+ kind: "release";
1144
+ } | {
1145
+ kind: "action";
1146
+ result: {
1147
+ ok: true;
1148
+ status: "accepted";
1149
+ source: "client" | "host";
1150
+ result?: unknown;
1151
+ } | {
1152
+ ok: false;
1153
+ status: "rejected";
1154
+ source: "server" | "client" | "host";
1155
+ reason: string;
1156
+ message: string;
1157
+ details?: Record<string, unknown> | undefined;
1158
+ } | {
1159
+ ok: false;
1160
+ status: "unconfirmed";
1161
+ source: "client";
1162
+ };
1163
+ };
1164
+ } | {
1165
+ status: "rejected";
1166
+ reason: "busy" | "unsupported" | "invalid_request" | "rate_limited" | "invalid_input" | "invalid_action" | "invalid_action_lane" | "room_not_found" | "unauthorized" | "active_host_missing" | "stale_identity" | "stale_decision" | "invalid_deadline" | "lease_conflict" | "stale_sequence" | "sequence_conflict";
1167
+ } | {
1168
+ status: "unconfirmed";
1169
+ reason: "runtime_replaced" | "host_ack_unavailable" | "transport_ack_unavailable" | "invalid_acknowledgement" | "runtime_unavailable";
1170
+ } | undefined;
1171
+ disconnection?: {
1172
+ release: {
1173
+ status: "applied";
1174
+ leaseId: string;
1175
+ sequence: number;
1176
+ replayed: boolean;
1177
+ operation: {
1178
+ kind: "input";
1179
+ } | {
1180
+ kind: "release";
1181
+ } | {
1182
+ kind: "action";
1183
+ result: {
1184
+ ok: true;
1185
+ status: "accepted";
1186
+ source: "client" | "host";
1187
+ result?: unknown;
1188
+ } | {
1189
+ ok: false;
1190
+ status: "rejected";
1191
+ source: "server" | "client" | "host";
1192
+ reason: string;
1193
+ message: string;
1194
+ details?: Record<string, unknown> | undefined;
1195
+ } | {
1196
+ ok: false;
1197
+ status: "unconfirmed";
1198
+ source: "client";
1199
+ };
1200
+ };
1201
+ } | {
1202
+ status: "rejected";
1203
+ reason: "busy" | "unsupported" | "invalid_request" | "rate_limited" | "invalid_input" | "invalid_action" | "invalid_action_lane" | "room_not_found" | "unauthorized" | "active_host_missing" | "stale_identity" | "stale_decision" | "invalid_deadline" | "lease_conflict" | "stale_sequence" | "sequence_conflict";
1204
+ } | {
1205
+ status: "unconfirmed";
1206
+ reason: "runtime_replaced" | "host_ack_unavailable" | "transport_ack_unavailable" | "invalid_acknowledgement" | "runtime_unavailable";
1207
+ } | {
1208
+ status: "not-leased";
1209
+ };
1210
+ leave: {
1211
+ status: "acknowledged";
1212
+ } | {
1213
+ status: "not-connected";
1214
+ } | {
1215
+ status: "rejected";
1216
+ message: string;
1217
+ } | {
1218
+ status: "unconfirmed";
1219
+ message: string;
1220
+ };
1221
+ } | undefined;
1222
+ }[];
1223
+ errors: string[];
1224
+ processesClosed?: boolean | undefined;
1225
+ close?: {
1226
+ closed: boolean;
1227
+ disconnection: {
1228
+ release: {
1229
+ status: "applied";
1230
+ leaseId: string;
1231
+ sequence: number;
1232
+ replayed: boolean;
1233
+ operation: {
1234
+ kind: "input";
1235
+ } | {
1236
+ kind: "release";
1237
+ } | {
1238
+ kind: "action";
1239
+ result: {
1240
+ ok: true;
1241
+ status: "accepted";
1242
+ source: "client" | "host";
1243
+ result?: unknown;
1244
+ } | {
1245
+ ok: false;
1246
+ status: "rejected";
1247
+ source: "server" | "client" | "host";
1248
+ reason: string;
1249
+ message: string;
1250
+ details?: Record<string, unknown> | undefined;
1251
+ } | {
1252
+ ok: false;
1253
+ status: "unconfirmed";
1254
+ source: "client";
1255
+ };
1256
+ };
1257
+ } | {
1258
+ status: "rejected";
1259
+ reason: "busy" | "unsupported" | "invalid_request" | "rate_limited" | "invalid_input" | "invalid_action" | "invalid_action_lane" | "room_not_found" | "unauthorized" | "active_host_missing" | "stale_identity" | "stale_decision" | "invalid_deadline" | "lease_conflict" | "stale_sequence" | "sequence_conflict";
1260
+ } | {
1261
+ status: "unconfirmed";
1262
+ reason: "runtime_replaced" | "host_ack_unavailable" | "transport_ack_unavailable" | "invalid_acknowledgement" | "runtime_unavailable";
1263
+ } | {
1264
+ status: "not-leased";
1265
+ };
1266
+ leave: {
1267
+ status: "acknowledged";
1268
+ } | {
1269
+ status: "not-connected";
1270
+ } | {
1271
+ status: "rejected";
1272
+ message: string;
1273
+ } | {
1274
+ status: "unconfirmed";
1275
+ message: string;
1276
+ };
1277
+ };
1278
+ } | undefined;
1279
+ forced?: true | undefined;
1280
+ handBack?: "failed" | "returned" | "undeclared" | undefined;
1281
+ } | undefined;
1282
+ evidence?: {
1283
+ observation: {
1284
+ path: string;
1285
+ sha256: string;
1286
+ } | null;
1287
+ error: string | null;
1288
+ clip?: {
1289
+ status: "captured";
1290
+ path: string;
1291
+ sha256: string;
1292
+ bytes: number;
1293
+ frames: number;
1294
+ durationMs: number;
1295
+ } | {
1296
+ status: "not-captured";
1297
+ reason: "headless" | "busy" | "unsupported" | "surface-unavailable" | "capture-failed" | "runtime-replaced" | "host-unavailable";
1298
+ } | undefined;
1299
+ buildLog?: {
1300
+ path: string;
1301
+ sha256: string;
1302
+ bytes: number;
1303
+ truncated: boolean;
1304
+ } | undefined;
1305
+ trace?: {
1306
+ path: string;
1307
+ sha256: string;
1308
+ bytes: number;
1309
+ truncated: boolean;
1310
+ } | undefined;
1311
+ replay?: {
1312
+ reason: "loading" | "runtime-replaced" | "host-unavailable" | "no-simulation";
1313
+ message: string;
1314
+ } | undefined;
1315
+ inputLog?: {
1316
+ path: string;
1317
+ sha256: string;
1318
+ ticks: number;
1319
+ stepMs: number;
1320
+ entries: number;
1321
+ fromTick: number;
1322
+ full: boolean;
1323
+ } | undefined;
1324
+ } | undefined;
1325
+ }>;
1326
+ declare const waitGameRun: (input: z.input<typeof gameRunWaitSchema>) => Promise<{
1327
+ version: 1;
1328
+ runId: string;
1329
+ ownerInstanceId: string;
1330
+ request: {
1331
+ runId: string;
1332
+ target: {
1333
+ kind: "owned";
1334
+ } | {
1335
+ kind: "current";
1336
+ } | {
1337
+ kind: "headless";
1338
+ };
1339
+ seed: number;
1340
+ kind: "test";
1341
+ profileId: string;
1342
+ policyId: string;
1343
+ budget: {
1344
+ durationMs: number;
1345
+ steps: number;
1346
+ };
1347
+ cwd?: string | undefined;
1348
+ gameId?: string | undefined;
1349
+ settings?: Record<string, string | number | boolean> | undefined;
1350
+ intents?: Record<string, string> | undefined;
1351
+ } | {
1352
+ runId: string;
1353
+ seed: number;
1354
+ kind: "play";
1355
+ target: {
1356
+ kind: "current";
1357
+ };
1358
+ cwd?: string | undefined;
1359
+ gameId?: string | undefined;
1360
+ intent?: string | undefined;
1361
+ };
1362
+ state: "setup" | "playing" | "starting" | "stopping" | "ended";
1363
+ startedAt: string;
1364
+ seats: {
1365
+ seatId: string;
1366
+ controllerId: string;
1367
+ counters: {
1368
+ decisions: number;
1369
+ applied: number;
1370
+ rejected: number;
1371
+ unconfirmed: number;
1372
+ timeout: number;
1373
+ blocked: number;
1374
+ effects: number;
1375
+ };
1376
+ intent: string | null;
1377
+ expected?: {
1378
+ documentId: string;
1379
+ roomId: string;
1380
+ contractId: string;
1381
+ runtimeId: string;
1382
+ surfaceId: string | null;
1383
+ participantId: string | null;
1384
+ } | undefined;
1385
+ answers?: {
1386
+ asked: number;
1387
+ answered: number;
1388
+ missed: number;
1389
+ lowConfidence: number;
1390
+ lowConfidenceStretches: number;
1391
+ choices: Record<string, number>;
1392
+ automatic?: number | undefined;
1393
+ } | undefined;
1394
+ }[];
1395
+ counters: {
1396
+ steps: number;
1397
+ applied: number;
1398
+ rejected: number;
1399
+ unconfirmed: number;
1400
+ missed: number;
1401
+ };
1402
+ endedAt?: string | undefined;
1403
+ stopRequestedAt?: string | undefined;
1404
+ abortedAt?: string | undefined;
1405
+ lastInputAt?: string | undefined;
1406
+ releaseAcknowledgedAt?: string | undefined;
1407
+ rosterJoinedAt?: string | undefined;
1408
+ playStartedAt?: string | undefined;
1409
+ watched?: true | undefined;
1410
+ profile?: {
1411
+ id: string;
1412
+ label: string;
1413
+ seats: {
1414
+ id: string;
1415
+ label: string;
1416
+ }[];
1417
+ setup: ({
1418
+ lane: "host";
1419
+ actionId: string;
1420
+ input?: z.core.util.JSONType | undefined;
1421
+ } | {
1422
+ lane: "participant";
1423
+ seatId: string;
1424
+ actionId: string;
1425
+ input?: z.core.util.JSONType | undefined;
1426
+ })[];
1427
+ actions: string[];
1428
+ scope: "player" | "diagnostic";
1429
+ includeImage: boolean;
1430
+ timing: {
1431
+ intervalMs: number;
1432
+ decisionMs: number;
1433
+ inputTtlMs: number;
1434
+ };
1435
+ policies: {
1436
+ id: string;
1437
+ label: string;
1438
+ artifacts?: string | undefined;
1439
+ }[];
1440
+ metrics: {
1441
+ id: string;
1442
+ label: string;
1443
+ }[];
1444
+ handBack?: ({
1445
+ lane: "host";
1446
+ actionId: string;
1447
+ input?: z.core.util.JSONType | undefined;
1448
+ } | {
1449
+ lane: "participant";
1450
+ seatId: string;
1451
+ actionId: string;
1452
+ input?: z.core.util.JSONType | undefined;
1453
+ })[] | undefined;
1454
+ } | undefined;
1455
+ policyPreparation?: {
1456
+ seatId: string;
1457
+ prepareMs: number;
1458
+ }[] | undefined;
1459
+ policyInitializationMs?: number | undefined;
1460
+ policyArtifacts?: {
1461
+ manifestSha256: string;
1462
+ manifest: {
1463
+ version: 1;
1464
+ provenance: Record<string, z.core.util.JSONType>;
1465
+ files: {
1466
+ path: string;
1467
+ bytes: number;
1468
+ sha256: string;
1469
+ }[];
1470
+ };
1471
+ verifyMs: number;
1472
+ } | undefined;
1473
+ decisionModel?: string | undefined;
1474
+ build?: {
1475
+ version: 1;
1476
+ buildKey: string;
1477
+ sourceHash: string;
1478
+ lockfileHash: string;
1479
+ distHash: string;
1480
+ toolchain: {
1481
+ node: string;
1482
+ pnpm: string;
1483
+ devtools: string;
1484
+ platform: string;
1485
+ architecture: string;
1486
+ implementationHash: string;
1487
+ environmentHash: string;
1488
+ projectRoot: string;
1489
+ nodeAbi: string;
1490
+ };
1491
+ dependencies: {
1492
+ installedTreeHash: string;
1493
+ installedLockfileHash: string;
1494
+ installation: {
1495
+ durationMs: number;
1496
+ packageCount: number;
1497
+ reused: number;
1498
+ downloaded: number;
1499
+ added: number;
1500
+ stages: {
1501
+ stage: string;
1502
+ offsetMs: number;
1503
+ }[];
1504
+ importMethods?: string[] | undefined;
1505
+ };
1506
+ };
1507
+ createdAt: string;
1508
+ integrity: "sealed" | "verified" | "changed";
1509
+ } | undefined;
1510
+ session?: {
1511
+ gameSessionId: string;
1512
+ gameId: string | null;
1513
+ roomId: string;
1514
+ controllerId: string;
1515
+ semanticAccess: "owned-host" | "delegated-host" | "participant-only";
1516
+ connected: boolean;
1517
+ } | undefined;
1518
+ expected?: {
1519
+ documentId: string;
1520
+ roomId: string;
1521
+ contractId: string;
1522
+ runtimeId: string;
1523
+ surfaceId: string | null;
1524
+ participantId: string | null;
1525
+ } | undefined;
1526
+ hostPace?: {
1527
+ framesPerSecond: number;
1528
+ simulationSpeed: number;
1529
+ } | undefined;
1530
+ steering?: {
1531
+ at: string;
1532
+ seatId: string;
1533
+ intent: string | null;
1534
+ source: "agent" | "creator" | "operator";
1535
+ }[] | undefined;
1536
+ evaluation?: {
1537
+ play?: {
1538
+ status: "failed" | "pending" | "passed";
1539
+ message?: string | undefined;
1540
+ metrics?: Record<string, number> | undefined;
1541
+ } | undefined;
1542
+ final?: {
1543
+ status: "failed" | "pending" | "passed";
1544
+ message?: string | undefined;
1545
+ metrics?: Record<string, number> | undefined;
1546
+ } | undefined;
1547
+ } | undefined;
1548
+ end?: {
1549
+ reason: "error" | "runtime_replaced" | "failed" | "budget" | "completed" | "safety_deadline" | "stopped" | "owner_stopping" | "owner_lost" | "session_expired" | "policy_unresponsive" | "decision_latency" | "host_not_advancing" | "seat_replaced" | "untested_seat" | "evaluator_unresponsive" | "trace_budget";
1550
+ message: string;
1551
+ outcome?: "failed" | "passed" | "inconclusive" | undefined;
1552
+ hostFault?: {
1553
+ name: string;
1554
+ message: string;
1555
+ source: {
1556
+ file: string;
1557
+ line: number;
1558
+ column: number;
1559
+ } | null;
1560
+ stack: string;
1561
+ } | undefined;
1562
+ } | undefined;
1563
+ cleanup?: {
1564
+ participantsClosed: boolean;
1565
+ seats: {
1566
+ seatId: string;
1567
+ release?: {
1568
+ status: "applied";
1569
+ leaseId: string;
1570
+ sequence: number;
1571
+ replayed: boolean;
1572
+ operation: {
1573
+ kind: "input";
1574
+ } | {
1575
+ kind: "release";
1576
+ } | {
1577
+ kind: "action";
1578
+ result: {
1579
+ ok: true;
1580
+ status: "accepted";
1581
+ source: "client" | "host";
1582
+ result?: unknown;
1583
+ } | {
1584
+ ok: false;
1585
+ status: "rejected";
1586
+ source: "server" | "client" | "host";
1587
+ reason: string;
1588
+ message: string;
1589
+ details?: Record<string, unknown> | undefined;
1590
+ } | {
1591
+ ok: false;
1592
+ status: "unconfirmed";
1593
+ source: "client";
1594
+ };
1595
+ };
1596
+ } | {
1597
+ status: "rejected";
1598
+ reason: "busy" | "unsupported" | "invalid_request" | "rate_limited" | "invalid_input" | "invalid_action" | "invalid_action_lane" | "room_not_found" | "unauthorized" | "active_host_missing" | "stale_identity" | "stale_decision" | "invalid_deadline" | "lease_conflict" | "stale_sequence" | "sequence_conflict";
1599
+ } | {
1600
+ status: "unconfirmed";
1601
+ reason: "runtime_replaced" | "host_ack_unavailable" | "transport_ack_unavailable" | "invalid_acknowledgement" | "runtime_unavailable";
1602
+ } | undefined;
1603
+ disconnection?: {
1604
+ release: {
1605
+ status: "applied";
1606
+ leaseId: string;
1607
+ sequence: number;
1608
+ replayed: boolean;
1609
+ operation: {
1610
+ kind: "input";
1611
+ } | {
1612
+ kind: "release";
1613
+ } | {
1614
+ kind: "action";
1615
+ result: {
1616
+ ok: true;
1617
+ status: "accepted";
1618
+ source: "client" | "host";
1619
+ result?: unknown;
1620
+ } | {
1621
+ ok: false;
1622
+ status: "rejected";
1623
+ source: "server" | "client" | "host";
1624
+ reason: string;
1625
+ message: string;
1626
+ details?: Record<string, unknown> | undefined;
1627
+ } | {
1628
+ ok: false;
1629
+ status: "unconfirmed";
1630
+ source: "client";
1631
+ };
1632
+ };
1633
+ } | {
1634
+ status: "rejected";
1635
+ reason: "busy" | "unsupported" | "invalid_request" | "rate_limited" | "invalid_input" | "invalid_action" | "invalid_action_lane" | "room_not_found" | "unauthorized" | "active_host_missing" | "stale_identity" | "stale_decision" | "invalid_deadline" | "lease_conflict" | "stale_sequence" | "sequence_conflict";
1636
+ } | {
1637
+ status: "unconfirmed";
1638
+ reason: "runtime_replaced" | "host_ack_unavailable" | "transport_ack_unavailable" | "invalid_acknowledgement" | "runtime_unavailable";
1639
+ } | {
1640
+ status: "not-leased";
1641
+ };
1642
+ leave: {
1643
+ status: "acknowledged";
1644
+ } | {
1645
+ status: "not-connected";
1646
+ } | {
1647
+ status: "rejected";
1648
+ message: string;
1649
+ } | {
1650
+ status: "unconfirmed";
1651
+ message: string;
1652
+ };
1653
+ } | undefined;
1654
+ }[];
1655
+ errors: string[];
1656
+ processesClosed?: boolean | undefined;
1657
+ close?: {
1658
+ closed: boolean;
1659
+ disconnection: {
1660
+ release: {
1661
+ status: "applied";
1662
+ leaseId: string;
1663
+ sequence: number;
1664
+ replayed: boolean;
1665
+ operation: {
1666
+ kind: "input";
1667
+ } | {
1668
+ kind: "release";
1669
+ } | {
1670
+ kind: "action";
1671
+ result: {
1672
+ ok: true;
1673
+ status: "accepted";
1674
+ source: "client" | "host";
1675
+ result?: unknown;
1676
+ } | {
1677
+ ok: false;
1678
+ status: "rejected";
1679
+ source: "server" | "client" | "host";
1680
+ reason: string;
1681
+ message: string;
1682
+ details?: Record<string, unknown> | undefined;
1683
+ } | {
1684
+ ok: false;
1685
+ status: "unconfirmed";
1686
+ source: "client";
1687
+ };
1688
+ };
1689
+ } | {
1690
+ status: "rejected";
1691
+ reason: "busy" | "unsupported" | "invalid_request" | "rate_limited" | "invalid_input" | "invalid_action" | "invalid_action_lane" | "room_not_found" | "unauthorized" | "active_host_missing" | "stale_identity" | "stale_decision" | "invalid_deadline" | "lease_conflict" | "stale_sequence" | "sequence_conflict";
1692
+ } | {
1693
+ status: "unconfirmed";
1694
+ reason: "runtime_replaced" | "host_ack_unavailable" | "transport_ack_unavailable" | "invalid_acknowledgement" | "runtime_unavailable";
1695
+ } | {
1696
+ status: "not-leased";
1697
+ };
1698
+ leave: {
1699
+ status: "acknowledged";
1700
+ } | {
1701
+ status: "not-connected";
1702
+ } | {
1703
+ status: "rejected";
1704
+ message: string;
1705
+ } | {
1706
+ status: "unconfirmed";
1707
+ message: string;
1708
+ };
1709
+ };
1710
+ } | undefined;
1711
+ forced?: true | undefined;
1712
+ handBack?: "failed" | "returned" | "undeclared" | undefined;
1713
+ } | undefined;
1714
+ evidence?: {
1715
+ observation: {
1716
+ path: string;
1717
+ sha256: string;
1718
+ } | null;
1719
+ error: string | null;
1720
+ clip?: {
1721
+ status: "captured";
1722
+ path: string;
1723
+ sha256: string;
1724
+ bytes: number;
1725
+ frames: number;
1726
+ durationMs: number;
1727
+ } | {
1728
+ status: "not-captured";
1729
+ reason: "headless" | "busy" | "unsupported" | "surface-unavailable" | "capture-failed" | "runtime-replaced" | "host-unavailable";
1730
+ } | undefined;
1731
+ buildLog?: {
1732
+ path: string;
1733
+ sha256: string;
1734
+ bytes: number;
1735
+ truncated: boolean;
1736
+ } | undefined;
1737
+ trace?: {
1738
+ path: string;
1739
+ sha256: string;
1740
+ bytes: number;
1741
+ truncated: boolean;
1742
+ } | undefined;
1743
+ replay?: {
1744
+ reason: "loading" | "runtime-replaced" | "host-unavailable" | "no-simulation";
1745
+ message: string;
1746
+ } | undefined;
1747
+ inputLog?: {
1748
+ path: string;
1749
+ sha256: string;
1750
+ ticks: number;
1751
+ stepMs: number;
1752
+ entries: number;
1753
+ fromTick: number;
1754
+ full: boolean;
1755
+ } | undefined;
1756
+ } | undefined;
1757
+ }>;
1758
+ declare const stopGameRun: (input: z.infer<typeof gameRunAddressSchema>) => Promise<{
1759
+ version: 1;
1760
+ runId: string;
1761
+ ownerInstanceId: string;
1762
+ request: {
1763
+ runId: string;
1764
+ target: {
1765
+ kind: "owned";
1766
+ } | {
1767
+ kind: "current";
1768
+ } | {
1769
+ kind: "headless";
1770
+ };
1771
+ seed: number;
1772
+ kind: "test";
1773
+ profileId: string;
1774
+ policyId: string;
1775
+ budget: {
1776
+ durationMs: number;
1777
+ steps: number;
1778
+ };
1779
+ cwd?: string | undefined;
1780
+ gameId?: string | undefined;
1781
+ settings?: Record<string, string | number | boolean> | undefined;
1782
+ intents?: Record<string, string> | undefined;
1783
+ } | {
1784
+ runId: string;
1785
+ seed: number;
1786
+ kind: "play";
1787
+ target: {
1788
+ kind: "current";
1789
+ };
1790
+ cwd?: string | undefined;
1791
+ gameId?: string | undefined;
1792
+ intent?: string | undefined;
1793
+ };
1794
+ state: "setup" | "playing" | "starting" | "stopping" | "ended";
1795
+ startedAt: string;
1796
+ seats: {
1797
+ seatId: string;
1798
+ controllerId: string;
1799
+ counters: {
1800
+ decisions: number;
1801
+ applied: number;
1802
+ rejected: number;
1803
+ unconfirmed: number;
1804
+ timeout: number;
1805
+ blocked: number;
1806
+ effects: number;
1807
+ };
1808
+ intent: string | null;
1809
+ expected?: {
1810
+ documentId: string;
1811
+ roomId: string;
1812
+ contractId: string;
1813
+ runtimeId: string;
1814
+ surfaceId: string | null;
1815
+ participantId: string | null;
1816
+ } | undefined;
1817
+ answers?: {
1818
+ asked: number;
1819
+ answered: number;
1820
+ missed: number;
1821
+ lowConfidence: number;
1822
+ lowConfidenceStretches: number;
1823
+ choices: Record<string, number>;
1824
+ automatic?: number | undefined;
1825
+ } | undefined;
1826
+ }[];
1827
+ counters: {
1828
+ steps: number;
1829
+ applied: number;
1830
+ rejected: number;
1831
+ unconfirmed: number;
1832
+ missed: number;
1833
+ };
1834
+ endedAt?: string | undefined;
1835
+ stopRequestedAt?: string | undefined;
1836
+ abortedAt?: string | undefined;
1837
+ lastInputAt?: string | undefined;
1838
+ releaseAcknowledgedAt?: string | undefined;
1839
+ rosterJoinedAt?: string | undefined;
1840
+ playStartedAt?: string | undefined;
1841
+ watched?: true | undefined;
1842
+ profile?: {
1843
+ id: string;
1844
+ label: string;
1845
+ seats: {
1846
+ id: string;
1847
+ label: string;
1848
+ }[];
1849
+ setup: ({
1850
+ lane: "host";
1851
+ actionId: string;
1852
+ input?: z.core.util.JSONType | undefined;
1853
+ } | {
1854
+ lane: "participant";
1855
+ seatId: string;
1856
+ actionId: string;
1857
+ input?: z.core.util.JSONType | undefined;
1858
+ })[];
1859
+ actions: string[];
1860
+ scope: "player" | "diagnostic";
1861
+ includeImage: boolean;
1862
+ timing: {
1863
+ intervalMs: number;
1864
+ decisionMs: number;
1865
+ inputTtlMs: number;
1866
+ };
1867
+ policies: {
1868
+ id: string;
1869
+ label: string;
1870
+ artifacts?: string | undefined;
1871
+ }[];
1872
+ metrics: {
1873
+ id: string;
1874
+ label: string;
1875
+ }[];
1876
+ handBack?: ({
1877
+ lane: "host";
1878
+ actionId: string;
1879
+ input?: z.core.util.JSONType | undefined;
1880
+ } | {
1881
+ lane: "participant";
1882
+ seatId: string;
1883
+ actionId: string;
1884
+ input?: z.core.util.JSONType | undefined;
1885
+ })[] | undefined;
1886
+ } | undefined;
1887
+ policyPreparation?: {
1888
+ seatId: string;
1889
+ prepareMs: number;
1890
+ }[] | undefined;
1891
+ policyInitializationMs?: number | undefined;
1892
+ policyArtifacts?: {
1893
+ manifestSha256: string;
1894
+ manifest: {
1895
+ version: 1;
1896
+ provenance: Record<string, z.core.util.JSONType>;
1897
+ files: {
1898
+ path: string;
1899
+ bytes: number;
1900
+ sha256: string;
1901
+ }[];
1902
+ };
1903
+ verifyMs: number;
1904
+ } | undefined;
1905
+ decisionModel?: string | undefined;
1906
+ build?: {
1907
+ version: 1;
1908
+ buildKey: string;
1909
+ sourceHash: string;
1910
+ lockfileHash: string;
1911
+ distHash: string;
1912
+ toolchain: {
1913
+ node: string;
1914
+ pnpm: string;
1915
+ devtools: string;
1916
+ platform: string;
1917
+ architecture: string;
1918
+ implementationHash: string;
1919
+ environmentHash: string;
1920
+ projectRoot: string;
1921
+ nodeAbi: string;
1922
+ };
1923
+ dependencies: {
1924
+ installedTreeHash: string;
1925
+ installedLockfileHash: string;
1926
+ installation: {
1927
+ durationMs: number;
1928
+ packageCount: number;
1929
+ reused: number;
1930
+ downloaded: number;
1931
+ added: number;
1932
+ stages: {
1933
+ stage: string;
1934
+ offsetMs: number;
1935
+ }[];
1936
+ importMethods?: string[] | undefined;
1937
+ };
1938
+ };
1939
+ createdAt: string;
1940
+ integrity: "sealed" | "verified" | "changed";
1941
+ } | undefined;
1942
+ session?: {
1943
+ gameSessionId: string;
1944
+ gameId: string | null;
1945
+ roomId: string;
1946
+ controllerId: string;
1947
+ semanticAccess: "owned-host" | "delegated-host" | "participant-only";
1948
+ connected: boolean;
1949
+ } | undefined;
1950
+ expected?: {
1951
+ documentId: string;
1952
+ roomId: string;
1953
+ contractId: string;
1954
+ runtimeId: string;
1955
+ surfaceId: string | null;
1956
+ participantId: string | null;
1957
+ } | undefined;
1958
+ hostPace?: {
1959
+ framesPerSecond: number;
1960
+ simulationSpeed: number;
1961
+ } | undefined;
1962
+ steering?: {
1963
+ at: string;
1964
+ seatId: string;
1965
+ intent: string | null;
1966
+ source: "agent" | "creator" | "operator";
1967
+ }[] | undefined;
1968
+ evaluation?: {
1969
+ play?: {
1970
+ status: "failed" | "pending" | "passed";
1971
+ message?: string | undefined;
1972
+ metrics?: Record<string, number> | undefined;
1973
+ } | undefined;
1974
+ final?: {
1975
+ status: "failed" | "pending" | "passed";
1976
+ message?: string | undefined;
1977
+ metrics?: Record<string, number> | undefined;
1978
+ } | undefined;
1979
+ } | undefined;
1980
+ end?: {
1981
+ reason: "error" | "runtime_replaced" | "failed" | "budget" | "completed" | "safety_deadline" | "stopped" | "owner_stopping" | "owner_lost" | "session_expired" | "policy_unresponsive" | "decision_latency" | "host_not_advancing" | "seat_replaced" | "untested_seat" | "evaluator_unresponsive" | "trace_budget";
1982
+ message: string;
1983
+ outcome?: "failed" | "passed" | "inconclusive" | undefined;
1984
+ hostFault?: {
1985
+ name: string;
1986
+ message: string;
1987
+ source: {
1988
+ file: string;
1989
+ line: number;
1990
+ column: number;
1991
+ } | null;
1992
+ stack: string;
1993
+ } | undefined;
1994
+ } | undefined;
1995
+ cleanup?: {
1996
+ participantsClosed: boolean;
1997
+ seats: {
1998
+ seatId: string;
1999
+ release?: {
2000
+ status: "applied";
2001
+ leaseId: string;
2002
+ sequence: number;
2003
+ replayed: boolean;
2004
+ operation: {
2005
+ kind: "input";
2006
+ } | {
2007
+ kind: "release";
2008
+ } | {
2009
+ kind: "action";
2010
+ result: {
2011
+ ok: true;
2012
+ status: "accepted";
2013
+ source: "client" | "host";
2014
+ result?: unknown;
2015
+ } | {
2016
+ ok: false;
2017
+ status: "rejected";
2018
+ source: "server" | "client" | "host";
2019
+ reason: string;
2020
+ message: string;
2021
+ details?: Record<string, unknown> | undefined;
2022
+ } | {
2023
+ ok: false;
2024
+ status: "unconfirmed";
2025
+ source: "client";
2026
+ };
2027
+ };
2028
+ } | {
2029
+ status: "rejected";
2030
+ reason: "busy" | "unsupported" | "invalid_request" | "rate_limited" | "invalid_input" | "invalid_action" | "invalid_action_lane" | "room_not_found" | "unauthorized" | "active_host_missing" | "stale_identity" | "stale_decision" | "invalid_deadline" | "lease_conflict" | "stale_sequence" | "sequence_conflict";
2031
+ } | {
2032
+ status: "unconfirmed";
2033
+ reason: "runtime_replaced" | "host_ack_unavailable" | "transport_ack_unavailable" | "invalid_acknowledgement" | "runtime_unavailable";
2034
+ } | undefined;
2035
+ disconnection?: {
2036
+ release: {
2037
+ status: "applied";
2038
+ leaseId: string;
2039
+ sequence: number;
2040
+ replayed: boolean;
2041
+ operation: {
2042
+ kind: "input";
2043
+ } | {
2044
+ kind: "release";
2045
+ } | {
2046
+ kind: "action";
2047
+ result: {
2048
+ ok: true;
2049
+ status: "accepted";
2050
+ source: "client" | "host";
2051
+ result?: unknown;
2052
+ } | {
2053
+ ok: false;
2054
+ status: "rejected";
2055
+ source: "server" | "client" | "host";
2056
+ reason: string;
2057
+ message: string;
2058
+ details?: Record<string, unknown> | undefined;
2059
+ } | {
2060
+ ok: false;
2061
+ status: "unconfirmed";
2062
+ source: "client";
2063
+ };
2064
+ };
2065
+ } | {
2066
+ status: "rejected";
2067
+ reason: "busy" | "unsupported" | "invalid_request" | "rate_limited" | "invalid_input" | "invalid_action" | "invalid_action_lane" | "room_not_found" | "unauthorized" | "active_host_missing" | "stale_identity" | "stale_decision" | "invalid_deadline" | "lease_conflict" | "stale_sequence" | "sequence_conflict";
2068
+ } | {
2069
+ status: "unconfirmed";
2070
+ reason: "runtime_replaced" | "host_ack_unavailable" | "transport_ack_unavailable" | "invalid_acknowledgement" | "runtime_unavailable";
2071
+ } | {
2072
+ status: "not-leased";
2073
+ };
2074
+ leave: {
2075
+ status: "acknowledged";
2076
+ } | {
2077
+ status: "not-connected";
2078
+ } | {
2079
+ status: "rejected";
2080
+ message: string;
2081
+ } | {
2082
+ status: "unconfirmed";
2083
+ message: string;
2084
+ };
2085
+ } | undefined;
2086
+ }[];
2087
+ errors: string[];
2088
+ processesClosed?: boolean | undefined;
2089
+ close?: {
2090
+ closed: boolean;
2091
+ disconnection: {
2092
+ release: {
2093
+ status: "applied";
2094
+ leaseId: string;
2095
+ sequence: number;
2096
+ replayed: boolean;
2097
+ operation: {
2098
+ kind: "input";
2099
+ } | {
2100
+ kind: "release";
2101
+ } | {
2102
+ kind: "action";
2103
+ result: {
2104
+ ok: true;
2105
+ status: "accepted";
2106
+ source: "client" | "host";
2107
+ result?: unknown;
2108
+ } | {
2109
+ ok: false;
2110
+ status: "rejected";
2111
+ source: "server" | "client" | "host";
2112
+ reason: string;
2113
+ message: string;
2114
+ details?: Record<string, unknown> | undefined;
2115
+ } | {
2116
+ ok: false;
2117
+ status: "unconfirmed";
2118
+ source: "client";
2119
+ };
2120
+ };
2121
+ } | {
2122
+ status: "rejected";
2123
+ reason: "busy" | "unsupported" | "invalid_request" | "rate_limited" | "invalid_input" | "invalid_action" | "invalid_action_lane" | "room_not_found" | "unauthorized" | "active_host_missing" | "stale_identity" | "stale_decision" | "invalid_deadline" | "lease_conflict" | "stale_sequence" | "sequence_conflict";
2124
+ } | {
2125
+ status: "unconfirmed";
2126
+ reason: "runtime_replaced" | "host_ack_unavailable" | "transport_ack_unavailable" | "invalid_acknowledgement" | "runtime_unavailable";
2127
+ } | {
2128
+ status: "not-leased";
2129
+ };
2130
+ leave: {
2131
+ status: "acknowledged";
2132
+ } | {
2133
+ status: "not-connected";
2134
+ } | {
2135
+ status: "rejected";
2136
+ message: string;
2137
+ } | {
2138
+ status: "unconfirmed";
2139
+ message: string;
2140
+ };
2141
+ };
2142
+ } | undefined;
2143
+ forced?: true | undefined;
2144
+ handBack?: "failed" | "returned" | "undeclared" | undefined;
2145
+ } | undefined;
2146
+ evidence?: {
2147
+ observation: {
2148
+ path: string;
2149
+ sha256: string;
2150
+ } | null;
2151
+ error: string | null;
2152
+ clip?: {
2153
+ status: "captured";
2154
+ path: string;
2155
+ sha256: string;
2156
+ bytes: number;
2157
+ frames: number;
2158
+ durationMs: number;
2159
+ } | {
2160
+ status: "not-captured";
2161
+ reason: "headless" | "busy" | "unsupported" | "surface-unavailable" | "capture-failed" | "runtime-replaced" | "host-unavailable";
2162
+ } | undefined;
2163
+ buildLog?: {
2164
+ path: string;
2165
+ sha256: string;
2166
+ bytes: number;
2167
+ truncated: boolean;
2168
+ } | undefined;
2169
+ trace?: {
2170
+ path: string;
2171
+ sha256: string;
2172
+ bytes: number;
2173
+ truncated: boolean;
2174
+ } | undefined;
2175
+ replay?: {
2176
+ reason: "loading" | "runtime-replaced" | "host-unavailable" | "no-simulation";
2177
+ message: string;
2178
+ } | undefined;
2179
+ inputLog?: {
2180
+ path: string;
2181
+ sha256: string;
2182
+ ticks: number;
2183
+ stepMs: number;
2184
+ entries: number;
2185
+ fromTick: number;
2186
+ full: boolean;
2187
+ } | undefined;
2188
+ } | undefined;
2189
+ }>;
2190
+ declare const steerGameRun: (input: GameRunSteerOptions) => Promise<{
2191
+ version: 1;
2192
+ runId: string;
2193
+ ownerInstanceId: string;
2194
+ request: {
2195
+ runId: string;
2196
+ target: {
2197
+ kind: "owned";
2198
+ } | {
2199
+ kind: "current";
2200
+ } | {
2201
+ kind: "headless";
2202
+ };
2203
+ seed: number;
2204
+ kind: "test";
2205
+ profileId: string;
2206
+ policyId: string;
2207
+ budget: {
2208
+ durationMs: number;
2209
+ steps: number;
2210
+ };
2211
+ cwd?: string | undefined;
2212
+ gameId?: string | undefined;
2213
+ settings?: Record<string, string | number | boolean> | undefined;
2214
+ intents?: Record<string, string> | undefined;
2215
+ } | {
2216
+ runId: string;
2217
+ seed: number;
2218
+ kind: "play";
2219
+ target: {
2220
+ kind: "current";
2221
+ };
2222
+ cwd?: string | undefined;
2223
+ gameId?: string | undefined;
2224
+ intent?: string | undefined;
2225
+ };
2226
+ state: "setup" | "playing" | "starting" | "stopping" | "ended";
2227
+ startedAt: string;
2228
+ seats: {
2229
+ seatId: string;
2230
+ controllerId: string;
2231
+ counters: {
2232
+ decisions: number;
2233
+ applied: number;
2234
+ rejected: number;
2235
+ unconfirmed: number;
2236
+ timeout: number;
2237
+ blocked: number;
2238
+ effects: number;
2239
+ };
2240
+ intent: string | null;
2241
+ expected?: {
2242
+ documentId: string;
2243
+ roomId: string;
2244
+ contractId: string;
2245
+ runtimeId: string;
2246
+ surfaceId: string | null;
2247
+ participantId: string | null;
2248
+ } | undefined;
2249
+ answers?: {
2250
+ asked: number;
2251
+ answered: number;
2252
+ missed: number;
2253
+ lowConfidence: number;
2254
+ lowConfidenceStretches: number;
2255
+ choices: Record<string, number>;
2256
+ automatic?: number | undefined;
2257
+ } | undefined;
2258
+ }[];
2259
+ counters: {
2260
+ steps: number;
2261
+ applied: number;
2262
+ rejected: number;
2263
+ unconfirmed: number;
2264
+ missed: number;
2265
+ };
2266
+ endedAt?: string | undefined;
2267
+ stopRequestedAt?: string | undefined;
2268
+ abortedAt?: string | undefined;
2269
+ lastInputAt?: string | undefined;
2270
+ releaseAcknowledgedAt?: string | undefined;
2271
+ rosterJoinedAt?: string | undefined;
2272
+ playStartedAt?: string | undefined;
2273
+ watched?: true | undefined;
2274
+ profile?: {
2275
+ id: string;
2276
+ label: string;
2277
+ seats: {
2278
+ id: string;
2279
+ label: string;
2280
+ }[];
2281
+ setup: ({
2282
+ lane: "host";
2283
+ actionId: string;
2284
+ input?: z.core.util.JSONType | undefined;
2285
+ } | {
2286
+ lane: "participant";
2287
+ seatId: string;
2288
+ actionId: string;
2289
+ input?: z.core.util.JSONType | undefined;
2290
+ })[];
2291
+ actions: string[];
2292
+ scope: "player" | "diagnostic";
2293
+ includeImage: boolean;
2294
+ timing: {
2295
+ intervalMs: number;
2296
+ decisionMs: number;
2297
+ inputTtlMs: number;
2298
+ };
2299
+ policies: {
2300
+ id: string;
2301
+ label: string;
2302
+ artifacts?: string | undefined;
2303
+ }[];
2304
+ metrics: {
2305
+ id: string;
2306
+ label: string;
2307
+ }[];
2308
+ handBack?: ({
2309
+ lane: "host";
2310
+ actionId: string;
2311
+ input?: z.core.util.JSONType | undefined;
2312
+ } | {
2313
+ lane: "participant";
2314
+ seatId: string;
2315
+ actionId: string;
2316
+ input?: z.core.util.JSONType | undefined;
2317
+ })[] | undefined;
2318
+ } | undefined;
2319
+ policyPreparation?: {
2320
+ seatId: string;
2321
+ prepareMs: number;
2322
+ }[] | undefined;
2323
+ policyInitializationMs?: number | undefined;
2324
+ policyArtifacts?: {
2325
+ manifestSha256: string;
2326
+ manifest: {
2327
+ version: 1;
2328
+ provenance: Record<string, z.core.util.JSONType>;
2329
+ files: {
2330
+ path: string;
2331
+ bytes: number;
2332
+ sha256: string;
2333
+ }[];
2334
+ };
2335
+ verifyMs: number;
2336
+ } | undefined;
2337
+ decisionModel?: string | undefined;
2338
+ build?: {
2339
+ version: 1;
2340
+ buildKey: string;
2341
+ sourceHash: string;
2342
+ lockfileHash: string;
2343
+ distHash: string;
2344
+ toolchain: {
2345
+ node: string;
2346
+ pnpm: string;
2347
+ devtools: string;
2348
+ platform: string;
2349
+ architecture: string;
2350
+ implementationHash: string;
2351
+ environmentHash: string;
2352
+ projectRoot: string;
2353
+ nodeAbi: string;
2354
+ };
2355
+ dependencies: {
2356
+ installedTreeHash: string;
2357
+ installedLockfileHash: string;
2358
+ installation: {
2359
+ durationMs: number;
2360
+ packageCount: number;
2361
+ reused: number;
2362
+ downloaded: number;
2363
+ added: number;
2364
+ stages: {
2365
+ stage: string;
2366
+ offsetMs: number;
2367
+ }[];
2368
+ importMethods?: string[] | undefined;
2369
+ };
2370
+ };
2371
+ createdAt: string;
2372
+ integrity: "sealed" | "verified" | "changed";
2373
+ } | undefined;
2374
+ session?: {
2375
+ gameSessionId: string;
2376
+ gameId: string | null;
2377
+ roomId: string;
2378
+ controllerId: string;
2379
+ semanticAccess: "owned-host" | "delegated-host" | "participant-only";
2380
+ connected: boolean;
2381
+ } | undefined;
2382
+ expected?: {
2383
+ documentId: string;
2384
+ roomId: string;
2385
+ contractId: string;
2386
+ runtimeId: string;
2387
+ surfaceId: string | null;
2388
+ participantId: string | null;
2389
+ } | undefined;
2390
+ hostPace?: {
2391
+ framesPerSecond: number;
2392
+ simulationSpeed: number;
2393
+ } | undefined;
2394
+ steering?: {
2395
+ at: string;
2396
+ seatId: string;
2397
+ intent: string | null;
2398
+ source: "agent" | "creator" | "operator";
2399
+ }[] | undefined;
2400
+ evaluation?: {
2401
+ play?: {
2402
+ status: "failed" | "pending" | "passed";
2403
+ message?: string | undefined;
2404
+ metrics?: Record<string, number> | undefined;
2405
+ } | undefined;
2406
+ final?: {
2407
+ status: "failed" | "pending" | "passed";
2408
+ message?: string | undefined;
2409
+ metrics?: Record<string, number> | undefined;
2410
+ } | undefined;
2411
+ } | undefined;
2412
+ end?: {
2413
+ reason: "error" | "runtime_replaced" | "failed" | "budget" | "completed" | "safety_deadline" | "stopped" | "owner_stopping" | "owner_lost" | "session_expired" | "policy_unresponsive" | "decision_latency" | "host_not_advancing" | "seat_replaced" | "untested_seat" | "evaluator_unresponsive" | "trace_budget";
2414
+ message: string;
2415
+ outcome?: "failed" | "passed" | "inconclusive" | undefined;
2416
+ hostFault?: {
2417
+ name: string;
2418
+ message: string;
2419
+ source: {
2420
+ file: string;
2421
+ line: number;
2422
+ column: number;
2423
+ } | null;
2424
+ stack: string;
2425
+ } | undefined;
2426
+ } | undefined;
2427
+ cleanup?: {
2428
+ participantsClosed: boolean;
2429
+ seats: {
2430
+ seatId: string;
2431
+ release?: {
2432
+ status: "applied";
2433
+ leaseId: string;
2434
+ sequence: number;
2435
+ replayed: boolean;
2436
+ operation: {
2437
+ kind: "input";
2438
+ } | {
2439
+ kind: "release";
2440
+ } | {
2441
+ kind: "action";
2442
+ result: {
2443
+ ok: true;
2444
+ status: "accepted";
2445
+ source: "client" | "host";
2446
+ result?: unknown;
2447
+ } | {
2448
+ ok: false;
2449
+ status: "rejected";
2450
+ source: "server" | "client" | "host";
2451
+ reason: string;
2452
+ message: string;
2453
+ details?: Record<string, unknown> | undefined;
2454
+ } | {
2455
+ ok: false;
2456
+ status: "unconfirmed";
2457
+ source: "client";
2458
+ };
2459
+ };
2460
+ } | {
2461
+ status: "rejected";
2462
+ reason: "busy" | "unsupported" | "invalid_request" | "rate_limited" | "invalid_input" | "invalid_action" | "invalid_action_lane" | "room_not_found" | "unauthorized" | "active_host_missing" | "stale_identity" | "stale_decision" | "invalid_deadline" | "lease_conflict" | "stale_sequence" | "sequence_conflict";
2463
+ } | {
2464
+ status: "unconfirmed";
2465
+ reason: "runtime_replaced" | "host_ack_unavailable" | "transport_ack_unavailable" | "invalid_acknowledgement" | "runtime_unavailable";
2466
+ } | undefined;
2467
+ disconnection?: {
2468
+ release: {
2469
+ status: "applied";
2470
+ leaseId: string;
2471
+ sequence: number;
2472
+ replayed: boolean;
2473
+ operation: {
2474
+ kind: "input";
2475
+ } | {
2476
+ kind: "release";
2477
+ } | {
2478
+ kind: "action";
2479
+ result: {
2480
+ ok: true;
2481
+ status: "accepted";
2482
+ source: "client" | "host";
2483
+ result?: unknown;
2484
+ } | {
2485
+ ok: false;
2486
+ status: "rejected";
2487
+ source: "server" | "client" | "host";
2488
+ reason: string;
2489
+ message: string;
2490
+ details?: Record<string, unknown> | undefined;
2491
+ } | {
2492
+ ok: false;
2493
+ status: "unconfirmed";
2494
+ source: "client";
2495
+ };
2496
+ };
2497
+ } | {
2498
+ status: "rejected";
2499
+ reason: "busy" | "unsupported" | "invalid_request" | "rate_limited" | "invalid_input" | "invalid_action" | "invalid_action_lane" | "room_not_found" | "unauthorized" | "active_host_missing" | "stale_identity" | "stale_decision" | "invalid_deadline" | "lease_conflict" | "stale_sequence" | "sequence_conflict";
2500
+ } | {
2501
+ status: "unconfirmed";
2502
+ reason: "runtime_replaced" | "host_ack_unavailable" | "transport_ack_unavailable" | "invalid_acknowledgement" | "runtime_unavailable";
2503
+ } | {
2504
+ status: "not-leased";
2505
+ };
2506
+ leave: {
2507
+ status: "acknowledged";
2508
+ } | {
2509
+ status: "not-connected";
2510
+ } | {
2511
+ status: "rejected";
2512
+ message: string;
2513
+ } | {
2514
+ status: "unconfirmed";
2515
+ message: string;
2516
+ };
2517
+ } | undefined;
2518
+ }[];
2519
+ errors: string[];
2520
+ processesClosed?: boolean | undefined;
2521
+ close?: {
2522
+ closed: boolean;
2523
+ disconnection: {
2524
+ release: {
2525
+ status: "applied";
2526
+ leaseId: string;
2527
+ sequence: number;
2528
+ replayed: boolean;
2529
+ operation: {
2530
+ kind: "input";
2531
+ } | {
2532
+ kind: "release";
2533
+ } | {
2534
+ kind: "action";
2535
+ result: {
2536
+ ok: true;
2537
+ status: "accepted";
2538
+ source: "client" | "host";
2539
+ result?: unknown;
2540
+ } | {
2541
+ ok: false;
2542
+ status: "rejected";
2543
+ source: "server" | "client" | "host";
2544
+ reason: string;
2545
+ message: string;
2546
+ details?: Record<string, unknown> | undefined;
2547
+ } | {
2548
+ ok: false;
2549
+ status: "unconfirmed";
2550
+ source: "client";
2551
+ };
2552
+ };
2553
+ } | {
2554
+ status: "rejected";
2555
+ reason: "busy" | "unsupported" | "invalid_request" | "rate_limited" | "invalid_input" | "invalid_action" | "invalid_action_lane" | "room_not_found" | "unauthorized" | "active_host_missing" | "stale_identity" | "stale_decision" | "invalid_deadline" | "lease_conflict" | "stale_sequence" | "sequence_conflict";
2556
+ } | {
2557
+ status: "unconfirmed";
2558
+ reason: "runtime_replaced" | "host_ack_unavailable" | "transport_ack_unavailable" | "invalid_acknowledgement" | "runtime_unavailable";
2559
+ } | {
2560
+ status: "not-leased";
2561
+ };
2562
+ leave: {
2563
+ status: "acknowledged";
2564
+ } | {
2565
+ status: "not-connected";
2566
+ } | {
2567
+ status: "rejected";
2568
+ message: string;
2569
+ } | {
2570
+ status: "unconfirmed";
2571
+ message: string;
2572
+ };
2573
+ };
2574
+ } | undefined;
2575
+ forced?: true | undefined;
2576
+ handBack?: "failed" | "returned" | "undeclared" | undefined;
2577
+ } | undefined;
2578
+ evidence?: {
2579
+ observation: {
2580
+ path: string;
2581
+ sha256: string;
2582
+ } | null;
2583
+ error: string | null;
2584
+ clip?: {
2585
+ status: "captured";
2586
+ path: string;
2587
+ sha256: string;
2588
+ bytes: number;
2589
+ frames: number;
2590
+ durationMs: number;
2591
+ } | {
2592
+ status: "not-captured";
2593
+ reason: "headless" | "busy" | "unsupported" | "surface-unavailable" | "capture-failed" | "runtime-replaced" | "host-unavailable";
2594
+ } | undefined;
2595
+ buildLog?: {
2596
+ path: string;
2597
+ sha256: string;
2598
+ bytes: number;
2599
+ truncated: boolean;
2600
+ } | undefined;
2601
+ trace?: {
2602
+ path: string;
2603
+ sha256: string;
2604
+ bytes: number;
2605
+ truncated: boolean;
2606
+ } | undefined;
2607
+ replay?: {
2608
+ reason: "loading" | "runtime-replaced" | "host-unavailable" | "no-simulation";
2609
+ message: string;
2610
+ } | undefined;
2611
+ inputLog?: {
2612
+ path: string;
2613
+ sha256: string;
2614
+ ticks: number;
2615
+ stepMs: number;
2616
+ entries: number;
2617
+ fromTick: number;
2618
+ full: boolean;
2619
+ } | undefined;
2620
+ } | undefined;
2621
+ }>;
2622
+ declare const cancelGameRun: (input: z.infer<typeof gameRunAddressSchema>) => Promise<{
2623
+ runId: string;
2624
+ ownerInstanceId: string;
2625
+ fenced: true;
2626
+ record: {
2627
+ version: 1;
2628
+ runId: string;
2629
+ ownerInstanceId: string;
2630
+ request: {
2631
+ runId: string;
2632
+ target: {
2633
+ kind: "owned";
2634
+ } | {
2635
+ kind: "current";
2636
+ } | {
2637
+ kind: "headless";
2638
+ };
2639
+ seed: number;
2640
+ kind: "test";
2641
+ profileId: string;
2642
+ policyId: string;
2643
+ budget: {
2644
+ durationMs: number;
2645
+ steps: number;
2646
+ };
2647
+ cwd?: string | undefined;
2648
+ gameId?: string | undefined;
2649
+ settings?: Record<string, string | number | boolean> | undefined;
2650
+ intents?: Record<string, string> | undefined;
2651
+ } | {
2652
+ runId: string;
2653
+ seed: number;
2654
+ kind: "play";
2655
+ target: {
2656
+ kind: "current";
2657
+ };
2658
+ cwd?: string | undefined;
2659
+ gameId?: string | undefined;
2660
+ intent?: string | undefined;
2661
+ };
2662
+ state: "setup" | "playing" | "starting" | "stopping" | "ended";
2663
+ startedAt: string;
2664
+ seats: {
2665
+ seatId: string;
2666
+ controllerId: string;
2667
+ counters: {
2668
+ decisions: number;
2669
+ applied: number;
2670
+ rejected: number;
2671
+ unconfirmed: number;
2672
+ timeout: number;
2673
+ blocked: number;
2674
+ effects: number;
2675
+ };
2676
+ intent: string | null;
2677
+ expected?: {
2678
+ documentId: string;
2679
+ roomId: string;
2680
+ contractId: string;
2681
+ runtimeId: string;
2682
+ surfaceId: string | null;
2683
+ participantId: string | null;
2684
+ } | undefined;
2685
+ answers?: {
2686
+ asked: number;
2687
+ answered: number;
2688
+ missed: number;
2689
+ lowConfidence: number;
2690
+ lowConfidenceStretches: number;
2691
+ choices: Record<string, number>;
2692
+ automatic?: number | undefined;
2693
+ } | undefined;
2694
+ }[];
2695
+ counters: {
2696
+ steps: number;
2697
+ applied: number;
2698
+ rejected: number;
2699
+ unconfirmed: number;
2700
+ missed: number;
2701
+ };
2702
+ endedAt?: string | undefined;
2703
+ stopRequestedAt?: string | undefined;
2704
+ abortedAt?: string | undefined;
2705
+ lastInputAt?: string | undefined;
2706
+ releaseAcknowledgedAt?: string | undefined;
2707
+ rosterJoinedAt?: string | undefined;
2708
+ playStartedAt?: string | undefined;
2709
+ watched?: true | undefined;
2710
+ profile?: {
2711
+ id: string;
2712
+ label: string;
2713
+ seats: {
2714
+ id: string;
2715
+ label: string;
2716
+ }[];
2717
+ setup: ({
2718
+ lane: "host";
2719
+ actionId: string;
2720
+ input?: z.core.util.JSONType | undefined;
2721
+ } | {
2722
+ lane: "participant";
2723
+ seatId: string;
2724
+ actionId: string;
2725
+ input?: z.core.util.JSONType | undefined;
2726
+ })[];
2727
+ actions: string[];
2728
+ scope: "player" | "diagnostic";
2729
+ includeImage: boolean;
2730
+ timing: {
2731
+ intervalMs: number;
2732
+ decisionMs: number;
2733
+ inputTtlMs: number;
2734
+ };
2735
+ policies: {
2736
+ id: string;
2737
+ label: string;
2738
+ artifacts?: string | undefined;
2739
+ }[];
2740
+ metrics: {
2741
+ id: string;
2742
+ label: string;
2743
+ }[];
2744
+ handBack?: ({
2745
+ lane: "host";
2746
+ actionId: string;
2747
+ input?: z.core.util.JSONType | undefined;
2748
+ } | {
2749
+ lane: "participant";
2750
+ seatId: string;
2751
+ actionId: string;
2752
+ input?: z.core.util.JSONType | undefined;
2753
+ })[] | undefined;
2754
+ } | undefined;
2755
+ policyPreparation?: {
2756
+ seatId: string;
2757
+ prepareMs: number;
2758
+ }[] | undefined;
2759
+ policyInitializationMs?: number | undefined;
2760
+ policyArtifacts?: {
2761
+ manifestSha256: string;
2762
+ manifest: {
2763
+ version: 1;
2764
+ provenance: Record<string, z.core.util.JSONType>;
2765
+ files: {
2766
+ path: string;
2767
+ bytes: number;
2768
+ sha256: string;
2769
+ }[];
2770
+ };
2771
+ verifyMs: number;
2772
+ } | undefined;
2773
+ decisionModel?: string | undefined;
2774
+ build?: {
2775
+ version: 1;
2776
+ buildKey: string;
2777
+ sourceHash: string;
2778
+ lockfileHash: string;
2779
+ distHash: string;
2780
+ toolchain: {
2781
+ node: string;
2782
+ pnpm: string;
2783
+ devtools: string;
2784
+ platform: string;
2785
+ architecture: string;
2786
+ implementationHash: string;
2787
+ environmentHash: string;
2788
+ projectRoot: string;
2789
+ nodeAbi: string;
2790
+ };
2791
+ dependencies: {
2792
+ installedTreeHash: string;
2793
+ installedLockfileHash: string;
2794
+ installation: {
2795
+ durationMs: number;
2796
+ packageCount: number;
2797
+ reused: number;
2798
+ downloaded: number;
2799
+ added: number;
2800
+ stages: {
2801
+ stage: string;
2802
+ offsetMs: number;
2803
+ }[];
2804
+ importMethods?: string[] | undefined;
2805
+ };
2806
+ };
2807
+ createdAt: string;
2808
+ integrity: "sealed" | "verified" | "changed";
2809
+ } | undefined;
2810
+ session?: {
2811
+ gameSessionId: string;
2812
+ gameId: string | null;
2813
+ roomId: string;
2814
+ controllerId: string;
2815
+ semanticAccess: "owned-host" | "delegated-host" | "participant-only";
2816
+ connected: boolean;
2817
+ } | undefined;
2818
+ expected?: {
2819
+ documentId: string;
2820
+ roomId: string;
2821
+ contractId: string;
2822
+ runtimeId: string;
2823
+ surfaceId: string | null;
2824
+ participantId: string | null;
2825
+ } | undefined;
2826
+ hostPace?: {
2827
+ framesPerSecond: number;
2828
+ simulationSpeed: number;
2829
+ } | undefined;
2830
+ steering?: {
2831
+ at: string;
2832
+ seatId: string;
2833
+ intent: string | null;
2834
+ source: "agent" | "creator" | "operator";
2835
+ }[] | undefined;
2836
+ evaluation?: {
2837
+ play?: {
2838
+ status: "failed" | "pending" | "passed";
2839
+ message?: string | undefined;
2840
+ metrics?: Record<string, number> | undefined;
2841
+ } | undefined;
2842
+ final?: {
2843
+ status: "failed" | "pending" | "passed";
2844
+ message?: string | undefined;
2845
+ metrics?: Record<string, number> | undefined;
2846
+ } | undefined;
2847
+ } | undefined;
2848
+ end?: {
2849
+ reason: "error" | "runtime_replaced" | "failed" | "budget" | "completed" | "safety_deadline" | "stopped" | "owner_stopping" | "owner_lost" | "session_expired" | "policy_unresponsive" | "decision_latency" | "host_not_advancing" | "seat_replaced" | "untested_seat" | "evaluator_unresponsive" | "trace_budget";
2850
+ message: string;
2851
+ outcome?: "failed" | "passed" | "inconclusive" | undefined;
2852
+ hostFault?: {
2853
+ name: string;
2854
+ message: string;
2855
+ source: {
2856
+ file: string;
2857
+ line: number;
2858
+ column: number;
2859
+ } | null;
2860
+ stack: string;
2861
+ } | undefined;
2862
+ } | undefined;
2863
+ cleanup?: {
2864
+ participantsClosed: boolean;
2865
+ seats: {
2866
+ seatId: string;
2867
+ release?: {
2868
+ status: "applied";
2869
+ leaseId: string;
2870
+ sequence: number;
2871
+ replayed: boolean;
2872
+ operation: {
2873
+ kind: "input";
2874
+ } | {
2875
+ kind: "release";
2876
+ } | {
2877
+ kind: "action";
2878
+ result: {
2879
+ ok: true;
2880
+ status: "accepted";
2881
+ source: "client" | "host";
2882
+ result?: unknown;
2883
+ } | {
2884
+ ok: false;
2885
+ status: "rejected";
2886
+ source: "server" | "client" | "host";
2887
+ reason: string;
2888
+ message: string;
2889
+ details?: Record<string, unknown> | undefined;
2890
+ } | {
2891
+ ok: false;
2892
+ status: "unconfirmed";
2893
+ source: "client";
2894
+ };
2895
+ };
2896
+ } | {
2897
+ status: "rejected";
2898
+ reason: "busy" | "unsupported" | "invalid_request" | "rate_limited" | "invalid_input" | "invalid_action" | "invalid_action_lane" | "room_not_found" | "unauthorized" | "active_host_missing" | "stale_identity" | "stale_decision" | "invalid_deadline" | "lease_conflict" | "stale_sequence" | "sequence_conflict";
2899
+ } | {
2900
+ status: "unconfirmed";
2901
+ reason: "runtime_replaced" | "host_ack_unavailable" | "transport_ack_unavailable" | "invalid_acknowledgement" | "runtime_unavailable";
2902
+ } | undefined;
2903
+ disconnection?: {
2904
+ release: {
2905
+ status: "applied";
2906
+ leaseId: string;
2907
+ sequence: number;
2908
+ replayed: boolean;
2909
+ operation: {
2910
+ kind: "input";
2911
+ } | {
2912
+ kind: "release";
2913
+ } | {
2914
+ kind: "action";
2915
+ result: {
2916
+ ok: true;
2917
+ status: "accepted";
2918
+ source: "client" | "host";
2919
+ result?: unknown;
2920
+ } | {
2921
+ ok: false;
2922
+ status: "rejected";
2923
+ source: "server" | "client" | "host";
2924
+ reason: string;
2925
+ message: string;
2926
+ details?: Record<string, unknown> | undefined;
2927
+ } | {
2928
+ ok: false;
2929
+ status: "unconfirmed";
2930
+ source: "client";
2931
+ };
2932
+ };
2933
+ } | {
2934
+ status: "rejected";
2935
+ reason: "busy" | "unsupported" | "invalid_request" | "rate_limited" | "invalid_input" | "invalid_action" | "invalid_action_lane" | "room_not_found" | "unauthorized" | "active_host_missing" | "stale_identity" | "stale_decision" | "invalid_deadline" | "lease_conflict" | "stale_sequence" | "sequence_conflict";
2936
+ } | {
2937
+ status: "unconfirmed";
2938
+ reason: "runtime_replaced" | "host_ack_unavailable" | "transport_ack_unavailable" | "invalid_acknowledgement" | "runtime_unavailable";
2939
+ } | {
2940
+ status: "not-leased";
2941
+ };
2942
+ leave: {
2943
+ status: "acknowledged";
2944
+ } | {
2945
+ status: "not-connected";
2946
+ } | {
2947
+ status: "rejected";
2948
+ message: string;
2949
+ } | {
2950
+ status: "unconfirmed";
2951
+ message: string;
2952
+ };
2953
+ } | undefined;
2954
+ }[];
2955
+ errors: string[];
2956
+ processesClosed?: boolean | undefined;
2957
+ close?: {
2958
+ closed: boolean;
2959
+ disconnection: {
2960
+ release: {
2961
+ status: "applied";
2962
+ leaseId: string;
2963
+ sequence: number;
2964
+ replayed: boolean;
2965
+ operation: {
2966
+ kind: "input";
2967
+ } | {
2968
+ kind: "release";
2969
+ } | {
2970
+ kind: "action";
2971
+ result: {
2972
+ ok: true;
2973
+ status: "accepted";
2974
+ source: "client" | "host";
2975
+ result?: unknown;
2976
+ } | {
2977
+ ok: false;
2978
+ status: "rejected";
2979
+ source: "server" | "client" | "host";
2980
+ reason: string;
2981
+ message: string;
2982
+ details?: Record<string, unknown> | undefined;
2983
+ } | {
2984
+ ok: false;
2985
+ status: "unconfirmed";
2986
+ source: "client";
2987
+ };
2988
+ };
2989
+ } | {
2990
+ status: "rejected";
2991
+ reason: "busy" | "unsupported" | "invalid_request" | "rate_limited" | "invalid_input" | "invalid_action" | "invalid_action_lane" | "room_not_found" | "unauthorized" | "active_host_missing" | "stale_identity" | "stale_decision" | "invalid_deadline" | "lease_conflict" | "stale_sequence" | "sequence_conflict";
2992
+ } | {
2993
+ status: "unconfirmed";
2994
+ reason: "runtime_replaced" | "host_ack_unavailable" | "transport_ack_unavailable" | "invalid_acknowledgement" | "runtime_unavailable";
2995
+ } | {
2996
+ status: "not-leased";
2997
+ };
2998
+ leave: {
2999
+ status: "acknowledged";
3000
+ } | {
3001
+ status: "not-connected";
3002
+ } | {
3003
+ status: "rejected";
3004
+ message: string;
3005
+ } | {
3006
+ status: "unconfirmed";
3007
+ message: string;
3008
+ };
3009
+ };
3010
+ } | undefined;
3011
+ forced?: true | undefined;
3012
+ handBack?: "failed" | "returned" | "undeclared" | undefined;
3013
+ } | undefined;
3014
+ evidence?: {
3015
+ observation: {
3016
+ path: string;
3017
+ sha256: string;
3018
+ } | null;
3019
+ error: string | null;
3020
+ clip?: {
3021
+ status: "captured";
3022
+ path: string;
3023
+ sha256: string;
3024
+ bytes: number;
3025
+ frames: number;
3026
+ durationMs: number;
3027
+ } | {
3028
+ status: "not-captured";
3029
+ reason: "headless" | "busy" | "unsupported" | "surface-unavailable" | "capture-failed" | "runtime-replaced" | "host-unavailable";
3030
+ } | undefined;
3031
+ buildLog?: {
3032
+ path: string;
3033
+ sha256: string;
3034
+ bytes: number;
3035
+ truncated: boolean;
3036
+ } | undefined;
3037
+ trace?: {
3038
+ path: string;
3039
+ sha256: string;
3040
+ bytes: number;
3041
+ truncated: boolean;
3042
+ } | undefined;
3043
+ replay?: {
3044
+ reason: "loading" | "runtime-replaced" | "host-unavailable" | "no-simulation";
3045
+ message: string;
3046
+ } | undefined;
3047
+ inputLog?: {
3048
+ path: string;
3049
+ sha256: string;
3050
+ ticks: number;
3051
+ stepMs: number;
3052
+ entries: number;
3053
+ fromTick: number;
3054
+ full: boolean;
3055
+ } | undefined;
3056
+ } | undefined;
3057
+ } | null;
3058
+ }>;
5
3059
 
6
- declare const openGameSession: (options?: OpenGameSessionOptions) => Promise<AirJamGameSessionSummary>;
7
- declare const readGameSession: ({ gameSessionId, requestSync, timeoutMs, }: ReadGameSessionOptions) => Promise<AirJamGameSessionInspection>;
8
- declare const sendGameSessionInput: ({ gameSessionId, input, }: SendGameSessionInputOptions) => Promise<SendGameSessionInputResult>;
9
- declare const invokeGameSessionAction: (options: InvokeGameSessionActionOptions) => Promise<InvokeGameSessionActionResult>;
10
- declare const captureGameSessionVisuals: ({ gameSessionId, timeoutMs, }: CaptureGameSessionVisualsOptions) => Promise<AirJamGameSessionVisualCaptureResult>;
11
- declare const closeGameSession: ({ gameSessionId, }: CloseGameSessionOptions) => Promise<CloseGameSessionResult>;
3060
+ declare const listGameRuns: (input?: {
3061
+ cwd?: string;
3062
+ }) => Promise<{
3063
+ version: 1;
3064
+ runId: string;
3065
+ ownerInstanceId: string;
3066
+ request: {
3067
+ runId: string;
3068
+ target: {
3069
+ kind: "owned";
3070
+ } | {
3071
+ kind: "current";
3072
+ } | {
3073
+ kind: "headless";
3074
+ };
3075
+ seed: number;
3076
+ kind: "test";
3077
+ profileId: string;
3078
+ policyId: string;
3079
+ budget: {
3080
+ durationMs: number;
3081
+ steps: number;
3082
+ };
3083
+ cwd?: string | undefined;
3084
+ gameId?: string | undefined;
3085
+ settings?: Record<string, string | number | boolean> | undefined;
3086
+ intents?: Record<string, string> | undefined;
3087
+ } | {
3088
+ runId: string;
3089
+ seed: number;
3090
+ kind: "play";
3091
+ target: {
3092
+ kind: "current";
3093
+ };
3094
+ cwd?: string | undefined;
3095
+ gameId?: string | undefined;
3096
+ intent?: string | undefined;
3097
+ };
3098
+ state: "setup" | "playing" | "starting" | "stopping" | "ended";
3099
+ startedAt: string;
3100
+ seats: {
3101
+ seatId: string;
3102
+ controllerId: string;
3103
+ counters: {
3104
+ decisions: number;
3105
+ applied: number;
3106
+ rejected: number;
3107
+ unconfirmed: number;
3108
+ timeout: number;
3109
+ blocked: number;
3110
+ effects: number;
3111
+ };
3112
+ intent: string | null;
3113
+ expected?: {
3114
+ documentId: string;
3115
+ roomId: string;
3116
+ contractId: string;
3117
+ runtimeId: string;
3118
+ surfaceId: string | null;
3119
+ participantId: string | null;
3120
+ } | undefined;
3121
+ answers?: {
3122
+ asked: number;
3123
+ answered: number;
3124
+ missed: number;
3125
+ lowConfidence: number;
3126
+ lowConfidenceStretches: number;
3127
+ choices: Record<string, number>;
3128
+ automatic?: number | undefined;
3129
+ } | undefined;
3130
+ }[];
3131
+ counters: {
3132
+ steps: number;
3133
+ applied: number;
3134
+ rejected: number;
3135
+ unconfirmed: number;
3136
+ missed: number;
3137
+ };
3138
+ endedAt?: string | undefined;
3139
+ stopRequestedAt?: string | undefined;
3140
+ abortedAt?: string | undefined;
3141
+ lastInputAt?: string | undefined;
3142
+ releaseAcknowledgedAt?: string | undefined;
3143
+ rosterJoinedAt?: string | undefined;
3144
+ playStartedAt?: string | undefined;
3145
+ watched?: true | undefined;
3146
+ profile?: {
3147
+ id: string;
3148
+ label: string;
3149
+ seats: {
3150
+ id: string;
3151
+ label: string;
3152
+ }[];
3153
+ setup: ({
3154
+ lane: "host";
3155
+ actionId: string;
3156
+ input?: z.core.util.JSONType | undefined;
3157
+ } | {
3158
+ lane: "participant";
3159
+ seatId: string;
3160
+ actionId: string;
3161
+ input?: z.core.util.JSONType | undefined;
3162
+ })[];
3163
+ actions: string[];
3164
+ scope: "player" | "diagnostic";
3165
+ includeImage: boolean;
3166
+ timing: {
3167
+ intervalMs: number;
3168
+ decisionMs: number;
3169
+ inputTtlMs: number;
3170
+ };
3171
+ policies: {
3172
+ id: string;
3173
+ label: string;
3174
+ artifacts?: string | undefined;
3175
+ }[];
3176
+ metrics: {
3177
+ id: string;
3178
+ label: string;
3179
+ }[];
3180
+ handBack?: ({
3181
+ lane: "host";
3182
+ actionId: string;
3183
+ input?: z.core.util.JSONType | undefined;
3184
+ } | {
3185
+ lane: "participant";
3186
+ seatId: string;
3187
+ actionId: string;
3188
+ input?: z.core.util.JSONType | undefined;
3189
+ })[] | undefined;
3190
+ } | undefined;
3191
+ policyPreparation?: {
3192
+ seatId: string;
3193
+ prepareMs: number;
3194
+ }[] | undefined;
3195
+ policyInitializationMs?: number | undefined;
3196
+ policyArtifacts?: {
3197
+ manifestSha256: string;
3198
+ manifest: {
3199
+ version: 1;
3200
+ provenance: Record<string, z.core.util.JSONType>;
3201
+ files: {
3202
+ path: string;
3203
+ bytes: number;
3204
+ sha256: string;
3205
+ }[];
3206
+ };
3207
+ verifyMs: number;
3208
+ } | undefined;
3209
+ decisionModel?: string | undefined;
3210
+ build?: {
3211
+ version: 1;
3212
+ buildKey: string;
3213
+ sourceHash: string;
3214
+ lockfileHash: string;
3215
+ distHash: string;
3216
+ toolchain: {
3217
+ node: string;
3218
+ pnpm: string;
3219
+ devtools: string;
3220
+ platform: string;
3221
+ architecture: string;
3222
+ implementationHash: string;
3223
+ environmentHash: string;
3224
+ projectRoot: string;
3225
+ nodeAbi: string;
3226
+ };
3227
+ dependencies: {
3228
+ installedTreeHash: string;
3229
+ installedLockfileHash: string;
3230
+ installation: {
3231
+ durationMs: number;
3232
+ packageCount: number;
3233
+ reused: number;
3234
+ downloaded: number;
3235
+ added: number;
3236
+ stages: {
3237
+ stage: string;
3238
+ offsetMs: number;
3239
+ }[];
3240
+ importMethods?: string[] | undefined;
3241
+ };
3242
+ };
3243
+ createdAt: string;
3244
+ integrity: "sealed" | "verified" | "changed";
3245
+ } | undefined;
3246
+ session?: {
3247
+ gameSessionId: string;
3248
+ gameId: string | null;
3249
+ roomId: string;
3250
+ controllerId: string;
3251
+ semanticAccess: "owned-host" | "delegated-host" | "participant-only";
3252
+ connected: boolean;
3253
+ } | undefined;
3254
+ expected?: {
3255
+ documentId: string;
3256
+ roomId: string;
3257
+ contractId: string;
3258
+ runtimeId: string;
3259
+ surfaceId: string | null;
3260
+ participantId: string | null;
3261
+ } | undefined;
3262
+ hostPace?: {
3263
+ framesPerSecond: number;
3264
+ simulationSpeed: number;
3265
+ } | undefined;
3266
+ steering?: {
3267
+ at: string;
3268
+ seatId: string;
3269
+ intent: string | null;
3270
+ source: "agent" | "creator" | "operator";
3271
+ }[] | undefined;
3272
+ evaluation?: {
3273
+ play?: {
3274
+ status: "failed" | "pending" | "passed";
3275
+ message?: string | undefined;
3276
+ metrics?: Record<string, number> | undefined;
3277
+ } | undefined;
3278
+ final?: {
3279
+ status: "failed" | "pending" | "passed";
3280
+ message?: string | undefined;
3281
+ metrics?: Record<string, number> | undefined;
3282
+ } | undefined;
3283
+ } | undefined;
3284
+ end?: {
3285
+ reason: "error" | "runtime_replaced" | "failed" | "budget" | "completed" | "safety_deadline" | "stopped" | "owner_stopping" | "owner_lost" | "session_expired" | "policy_unresponsive" | "decision_latency" | "host_not_advancing" | "seat_replaced" | "untested_seat" | "evaluator_unresponsive" | "trace_budget";
3286
+ message: string;
3287
+ outcome?: "failed" | "passed" | "inconclusive" | undefined;
3288
+ hostFault?: {
3289
+ name: string;
3290
+ message: string;
3291
+ source: {
3292
+ file: string;
3293
+ line: number;
3294
+ column: number;
3295
+ } | null;
3296
+ stack: string;
3297
+ } | undefined;
3298
+ } | undefined;
3299
+ cleanup?: {
3300
+ participantsClosed: boolean;
3301
+ seats: {
3302
+ seatId: string;
3303
+ release?: {
3304
+ status: "applied";
3305
+ leaseId: string;
3306
+ sequence: number;
3307
+ replayed: boolean;
3308
+ operation: {
3309
+ kind: "input";
3310
+ } | {
3311
+ kind: "release";
3312
+ } | {
3313
+ kind: "action";
3314
+ result: {
3315
+ ok: true;
3316
+ status: "accepted";
3317
+ source: "client" | "host";
3318
+ result?: unknown;
3319
+ } | {
3320
+ ok: false;
3321
+ status: "rejected";
3322
+ source: "server" | "client" | "host";
3323
+ reason: string;
3324
+ message: string;
3325
+ details?: Record<string, unknown> | undefined;
3326
+ } | {
3327
+ ok: false;
3328
+ status: "unconfirmed";
3329
+ source: "client";
3330
+ };
3331
+ };
3332
+ } | {
3333
+ status: "rejected";
3334
+ reason: "busy" | "unsupported" | "invalid_request" | "rate_limited" | "invalid_input" | "invalid_action" | "invalid_action_lane" | "room_not_found" | "unauthorized" | "active_host_missing" | "stale_identity" | "stale_decision" | "invalid_deadline" | "lease_conflict" | "stale_sequence" | "sequence_conflict";
3335
+ } | {
3336
+ status: "unconfirmed";
3337
+ reason: "runtime_replaced" | "host_ack_unavailable" | "transport_ack_unavailable" | "invalid_acknowledgement" | "runtime_unavailable";
3338
+ } | undefined;
3339
+ disconnection?: {
3340
+ release: {
3341
+ status: "applied";
3342
+ leaseId: string;
3343
+ sequence: number;
3344
+ replayed: boolean;
3345
+ operation: {
3346
+ kind: "input";
3347
+ } | {
3348
+ kind: "release";
3349
+ } | {
3350
+ kind: "action";
3351
+ result: {
3352
+ ok: true;
3353
+ status: "accepted";
3354
+ source: "client" | "host";
3355
+ result?: unknown;
3356
+ } | {
3357
+ ok: false;
3358
+ status: "rejected";
3359
+ source: "server" | "client" | "host";
3360
+ reason: string;
3361
+ message: string;
3362
+ details?: Record<string, unknown> | undefined;
3363
+ } | {
3364
+ ok: false;
3365
+ status: "unconfirmed";
3366
+ source: "client";
3367
+ };
3368
+ };
3369
+ } | {
3370
+ status: "rejected";
3371
+ reason: "busy" | "unsupported" | "invalid_request" | "rate_limited" | "invalid_input" | "invalid_action" | "invalid_action_lane" | "room_not_found" | "unauthorized" | "active_host_missing" | "stale_identity" | "stale_decision" | "invalid_deadline" | "lease_conflict" | "stale_sequence" | "sequence_conflict";
3372
+ } | {
3373
+ status: "unconfirmed";
3374
+ reason: "runtime_replaced" | "host_ack_unavailable" | "transport_ack_unavailable" | "invalid_acknowledgement" | "runtime_unavailable";
3375
+ } | {
3376
+ status: "not-leased";
3377
+ };
3378
+ leave: {
3379
+ status: "acknowledged";
3380
+ } | {
3381
+ status: "not-connected";
3382
+ } | {
3383
+ status: "rejected";
3384
+ message: string;
3385
+ } | {
3386
+ status: "unconfirmed";
3387
+ message: string;
3388
+ };
3389
+ } | undefined;
3390
+ }[];
3391
+ errors: string[];
3392
+ processesClosed?: boolean | undefined;
3393
+ close?: {
3394
+ closed: boolean;
3395
+ disconnection: {
3396
+ release: {
3397
+ status: "applied";
3398
+ leaseId: string;
3399
+ sequence: number;
3400
+ replayed: boolean;
3401
+ operation: {
3402
+ kind: "input";
3403
+ } | {
3404
+ kind: "release";
3405
+ } | {
3406
+ kind: "action";
3407
+ result: {
3408
+ ok: true;
3409
+ status: "accepted";
3410
+ source: "client" | "host";
3411
+ result?: unknown;
3412
+ } | {
3413
+ ok: false;
3414
+ status: "rejected";
3415
+ source: "server" | "client" | "host";
3416
+ reason: string;
3417
+ message: string;
3418
+ details?: Record<string, unknown> | undefined;
3419
+ } | {
3420
+ ok: false;
3421
+ status: "unconfirmed";
3422
+ source: "client";
3423
+ };
3424
+ };
3425
+ } | {
3426
+ status: "rejected";
3427
+ reason: "busy" | "unsupported" | "invalid_request" | "rate_limited" | "invalid_input" | "invalid_action" | "invalid_action_lane" | "room_not_found" | "unauthorized" | "active_host_missing" | "stale_identity" | "stale_decision" | "invalid_deadline" | "lease_conflict" | "stale_sequence" | "sequence_conflict";
3428
+ } | {
3429
+ status: "unconfirmed";
3430
+ reason: "runtime_replaced" | "host_ack_unavailable" | "transport_ack_unavailable" | "invalid_acknowledgement" | "runtime_unavailable";
3431
+ } | {
3432
+ status: "not-leased";
3433
+ };
3434
+ leave: {
3435
+ status: "acknowledged";
3436
+ } | {
3437
+ status: "not-connected";
3438
+ } | {
3439
+ status: "rejected";
3440
+ message: string;
3441
+ } | {
3442
+ status: "unconfirmed";
3443
+ message: string;
3444
+ };
3445
+ };
3446
+ } | undefined;
3447
+ forced?: true | undefined;
3448
+ handBack?: "failed" | "returned" | "undeclared" | undefined;
3449
+ } | undefined;
3450
+ evidence?: {
3451
+ observation: {
3452
+ path: string;
3453
+ sha256: string;
3454
+ } | null;
3455
+ error: string | null;
3456
+ clip?: {
3457
+ status: "captured";
3458
+ path: string;
3459
+ sha256: string;
3460
+ bytes: number;
3461
+ frames: number;
3462
+ durationMs: number;
3463
+ } | {
3464
+ status: "not-captured";
3465
+ reason: "headless" | "busy" | "unsupported" | "surface-unavailable" | "capture-failed" | "runtime-replaced" | "host-unavailable";
3466
+ } | undefined;
3467
+ buildLog?: {
3468
+ path: string;
3469
+ sha256: string;
3470
+ bytes: number;
3471
+ truncated: boolean;
3472
+ } | undefined;
3473
+ trace?: {
3474
+ path: string;
3475
+ sha256: string;
3476
+ bytes: number;
3477
+ truncated: boolean;
3478
+ } | undefined;
3479
+ replay?: {
3480
+ reason: "loading" | "runtime-replaced" | "host-unavailable" | "no-simulation";
3481
+ message: string;
3482
+ } | undefined;
3483
+ inputLog?: {
3484
+ path: string;
3485
+ sha256: string;
3486
+ ticks: number;
3487
+ stepMs: number;
3488
+ entries: number;
3489
+ fromTick: number;
3490
+ full: boolean;
3491
+ } | undefined;
3492
+ } | undefined;
3493
+ }[]>;
3494
+ declare const stopAllGameRuns: (input?: {
3495
+ cwd?: string;
3496
+ }) => Promise<{
3497
+ version: 1;
3498
+ runId: string;
3499
+ ownerInstanceId: string;
3500
+ request: {
3501
+ runId: string;
3502
+ target: {
3503
+ kind: "owned";
3504
+ } | {
3505
+ kind: "current";
3506
+ } | {
3507
+ kind: "headless";
3508
+ };
3509
+ seed: number;
3510
+ kind: "test";
3511
+ profileId: string;
3512
+ policyId: string;
3513
+ budget: {
3514
+ durationMs: number;
3515
+ steps: number;
3516
+ };
3517
+ cwd?: string | undefined;
3518
+ gameId?: string | undefined;
3519
+ settings?: Record<string, string | number | boolean> | undefined;
3520
+ intents?: Record<string, string> | undefined;
3521
+ } | {
3522
+ runId: string;
3523
+ seed: number;
3524
+ kind: "play";
3525
+ target: {
3526
+ kind: "current";
3527
+ };
3528
+ cwd?: string | undefined;
3529
+ gameId?: string | undefined;
3530
+ intent?: string | undefined;
3531
+ };
3532
+ state: "setup" | "playing" | "starting" | "stopping" | "ended";
3533
+ startedAt: string;
3534
+ seats: {
3535
+ seatId: string;
3536
+ controllerId: string;
3537
+ counters: {
3538
+ decisions: number;
3539
+ applied: number;
3540
+ rejected: number;
3541
+ unconfirmed: number;
3542
+ timeout: number;
3543
+ blocked: number;
3544
+ effects: number;
3545
+ };
3546
+ intent: string | null;
3547
+ expected?: {
3548
+ documentId: string;
3549
+ roomId: string;
3550
+ contractId: string;
3551
+ runtimeId: string;
3552
+ surfaceId: string | null;
3553
+ participantId: string | null;
3554
+ } | undefined;
3555
+ answers?: {
3556
+ asked: number;
3557
+ answered: number;
3558
+ missed: number;
3559
+ lowConfidence: number;
3560
+ lowConfidenceStretches: number;
3561
+ choices: Record<string, number>;
3562
+ automatic?: number | undefined;
3563
+ } | undefined;
3564
+ }[];
3565
+ counters: {
3566
+ steps: number;
3567
+ applied: number;
3568
+ rejected: number;
3569
+ unconfirmed: number;
3570
+ missed: number;
3571
+ };
3572
+ endedAt?: string | undefined;
3573
+ stopRequestedAt?: string | undefined;
3574
+ abortedAt?: string | undefined;
3575
+ lastInputAt?: string | undefined;
3576
+ releaseAcknowledgedAt?: string | undefined;
3577
+ rosterJoinedAt?: string | undefined;
3578
+ playStartedAt?: string | undefined;
3579
+ watched?: true | undefined;
3580
+ profile?: {
3581
+ id: string;
3582
+ label: string;
3583
+ seats: {
3584
+ id: string;
3585
+ label: string;
3586
+ }[];
3587
+ setup: ({
3588
+ lane: "host";
3589
+ actionId: string;
3590
+ input?: z.core.util.JSONType | undefined;
3591
+ } | {
3592
+ lane: "participant";
3593
+ seatId: string;
3594
+ actionId: string;
3595
+ input?: z.core.util.JSONType | undefined;
3596
+ })[];
3597
+ actions: string[];
3598
+ scope: "player" | "diagnostic";
3599
+ includeImage: boolean;
3600
+ timing: {
3601
+ intervalMs: number;
3602
+ decisionMs: number;
3603
+ inputTtlMs: number;
3604
+ };
3605
+ policies: {
3606
+ id: string;
3607
+ label: string;
3608
+ artifacts?: string | undefined;
3609
+ }[];
3610
+ metrics: {
3611
+ id: string;
3612
+ label: string;
3613
+ }[];
3614
+ handBack?: ({
3615
+ lane: "host";
3616
+ actionId: string;
3617
+ input?: z.core.util.JSONType | undefined;
3618
+ } | {
3619
+ lane: "participant";
3620
+ seatId: string;
3621
+ actionId: string;
3622
+ input?: z.core.util.JSONType | undefined;
3623
+ })[] | undefined;
3624
+ } | undefined;
3625
+ policyPreparation?: {
3626
+ seatId: string;
3627
+ prepareMs: number;
3628
+ }[] | undefined;
3629
+ policyInitializationMs?: number | undefined;
3630
+ policyArtifacts?: {
3631
+ manifestSha256: string;
3632
+ manifest: {
3633
+ version: 1;
3634
+ provenance: Record<string, z.core.util.JSONType>;
3635
+ files: {
3636
+ path: string;
3637
+ bytes: number;
3638
+ sha256: string;
3639
+ }[];
3640
+ };
3641
+ verifyMs: number;
3642
+ } | undefined;
3643
+ decisionModel?: string | undefined;
3644
+ build?: {
3645
+ version: 1;
3646
+ buildKey: string;
3647
+ sourceHash: string;
3648
+ lockfileHash: string;
3649
+ distHash: string;
3650
+ toolchain: {
3651
+ node: string;
3652
+ pnpm: string;
3653
+ devtools: string;
3654
+ platform: string;
3655
+ architecture: string;
3656
+ implementationHash: string;
3657
+ environmentHash: string;
3658
+ projectRoot: string;
3659
+ nodeAbi: string;
3660
+ };
3661
+ dependencies: {
3662
+ installedTreeHash: string;
3663
+ installedLockfileHash: string;
3664
+ installation: {
3665
+ durationMs: number;
3666
+ packageCount: number;
3667
+ reused: number;
3668
+ downloaded: number;
3669
+ added: number;
3670
+ stages: {
3671
+ stage: string;
3672
+ offsetMs: number;
3673
+ }[];
3674
+ importMethods?: string[] | undefined;
3675
+ };
3676
+ };
3677
+ createdAt: string;
3678
+ integrity: "sealed" | "verified" | "changed";
3679
+ } | undefined;
3680
+ session?: {
3681
+ gameSessionId: string;
3682
+ gameId: string | null;
3683
+ roomId: string;
3684
+ controllerId: string;
3685
+ semanticAccess: "owned-host" | "delegated-host" | "participant-only";
3686
+ connected: boolean;
3687
+ } | undefined;
3688
+ expected?: {
3689
+ documentId: string;
3690
+ roomId: string;
3691
+ contractId: string;
3692
+ runtimeId: string;
3693
+ surfaceId: string | null;
3694
+ participantId: string | null;
3695
+ } | undefined;
3696
+ hostPace?: {
3697
+ framesPerSecond: number;
3698
+ simulationSpeed: number;
3699
+ } | undefined;
3700
+ steering?: {
3701
+ at: string;
3702
+ seatId: string;
3703
+ intent: string | null;
3704
+ source: "agent" | "creator" | "operator";
3705
+ }[] | undefined;
3706
+ evaluation?: {
3707
+ play?: {
3708
+ status: "failed" | "pending" | "passed";
3709
+ message?: string | undefined;
3710
+ metrics?: Record<string, number> | undefined;
3711
+ } | undefined;
3712
+ final?: {
3713
+ status: "failed" | "pending" | "passed";
3714
+ message?: string | undefined;
3715
+ metrics?: Record<string, number> | undefined;
3716
+ } | undefined;
3717
+ } | undefined;
3718
+ end?: {
3719
+ reason: "error" | "runtime_replaced" | "failed" | "budget" | "completed" | "safety_deadline" | "stopped" | "owner_stopping" | "owner_lost" | "session_expired" | "policy_unresponsive" | "decision_latency" | "host_not_advancing" | "seat_replaced" | "untested_seat" | "evaluator_unresponsive" | "trace_budget";
3720
+ message: string;
3721
+ outcome?: "failed" | "passed" | "inconclusive" | undefined;
3722
+ hostFault?: {
3723
+ name: string;
3724
+ message: string;
3725
+ source: {
3726
+ file: string;
3727
+ line: number;
3728
+ column: number;
3729
+ } | null;
3730
+ stack: string;
3731
+ } | undefined;
3732
+ } | undefined;
3733
+ cleanup?: {
3734
+ participantsClosed: boolean;
3735
+ seats: {
3736
+ seatId: string;
3737
+ release?: {
3738
+ status: "applied";
3739
+ leaseId: string;
3740
+ sequence: number;
3741
+ replayed: boolean;
3742
+ operation: {
3743
+ kind: "input";
3744
+ } | {
3745
+ kind: "release";
3746
+ } | {
3747
+ kind: "action";
3748
+ result: {
3749
+ ok: true;
3750
+ status: "accepted";
3751
+ source: "client" | "host";
3752
+ result?: unknown;
3753
+ } | {
3754
+ ok: false;
3755
+ status: "rejected";
3756
+ source: "server" | "client" | "host";
3757
+ reason: string;
3758
+ message: string;
3759
+ details?: Record<string, unknown> | undefined;
3760
+ } | {
3761
+ ok: false;
3762
+ status: "unconfirmed";
3763
+ source: "client";
3764
+ };
3765
+ };
3766
+ } | {
3767
+ status: "rejected";
3768
+ reason: "busy" | "unsupported" | "invalid_request" | "rate_limited" | "invalid_input" | "invalid_action" | "invalid_action_lane" | "room_not_found" | "unauthorized" | "active_host_missing" | "stale_identity" | "stale_decision" | "invalid_deadline" | "lease_conflict" | "stale_sequence" | "sequence_conflict";
3769
+ } | {
3770
+ status: "unconfirmed";
3771
+ reason: "runtime_replaced" | "host_ack_unavailable" | "transport_ack_unavailable" | "invalid_acknowledgement" | "runtime_unavailable";
3772
+ } | undefined;
3773
+ disconnection?: {
3774
+ release: {
3775
+ status: "applied";
3776
+ leaseId: string;
3777
+ sequence: number;
3778
+ replayed: boolean;
3779
+ operation: {
3780
+ kind: "input";
3781
+ } | {
3782
+ kind: "release";
3783
+ } | {
3784
+ kind: "action";
3785
+ result: {
3786
+ ok: true;
3787
+ status: "accepted";
3788
+ source: "client" | "host";
3789
+ result?: unknown;
3790
+ } | {
3791
+ ok: false;
3792
+ status: "rejected";
3793
+ source: "server" | "client" | "host";
3794
+ reason: string;
3795
+ message: string;
3796
+ details?: Record<string, unknown> | undefined;
3797
+ } | {
3798
+ ok: false;
3799
+ status: "unconfirmed";
3800
+ source: "client";
3801
+ };
3802
+ };
3803
+ } | {
3804
+ status: "rejected";
3805
+ reason: "busy" | "unsupported" | "invalid_request" | "rate_limited" | "invalid_input" | "invalid_action" | "invalid_action_lane" | "room_not_found" | "unauthorized" | "active_host_missing" | "stale_identity" | "stale_decision" | "invalid_deadline" | "lease_conflict" | "stale_sequence" | "sequence_conflict";
3806
+ } | {
3807
+ status: "unconfirmed";
3808
+ reason: "runtime_replaced" | "host_ack_unavailable" | "transport_ack_unavailable" | "invalid_acknowledgement" | "runtime_unavailable";
3809
+ } | {
3810
+ status: "not-leased";
3811
+ };
3812
+ leave: {
3813
+ status: "acknowledged";
3814
+ } | {
3815
+ status: "not-connected";
3816
+ } | {
3817
+ status: "rejected";
3818
+ message: string;
3819
+ } | {
3820
+ status: "unconfirmed";
3821
+ message: string;
3822
+ };
3823
+ } | undefined;
3824
+ }[];
3825
+ errors: string[];
3826
+ processesClosed?: boolean | undefined;
3827
+ close?: {
3828
+ closed: boolean;
3829
+ disconnection: {
3830
+ release: {
3831
+ status: "applied";
3832
+ leaseId: string;
3833
+ sequence: number;
3834
+ replayed: boolean;
3835
+ operation: {
3836
+ kind: "input";
3837
+ } | {
3838
+ kind: "release";
3839
+ } | {
3840
+ kind: "action";
3841
+ result: {
3842
+ ok: true;
3843
+ status: "accepted";
3844
+ source: "client" | "host";
3845
+ result?: unknown;
3846
+ } | {
3847
+ ok: false;
3848
+ status: "rejected";
3849
+ source: "server" | "client" | "host";
3850
+ reason: string;
3851
+ message: string;
3852
+ details?: Record<string, unknown> | undefined;
3853
+ } | {
3854
+ ok: false;
3855
+ status: "unconfirmed";
3856
+ source: "client";
3857
+ };
3858
+ };
3859
+ } | {
3860
+ status: "rejected";
3861
+ reason: "busy" | "unsupported" | "invalid_request" | "rate_limited" | "invalid_input" | "invalid_action" | "invalid_action_lane" | "room_not_found" | "unauthorized" | "active_host_missing" | "stale_identity" | "stale_decision" | "invalid_deadline" | "lease_conflict" | "stale_sequence" | "sequence_conflict";
3862
+ } | {
3863
+ status: "unconfirmed";
3864
+ reason: "runtime_replaced" | "host_ack_unavailable" | "transport_ack_unavailable" | "invalid_acknowledgement" | "runtime_unavailable";
3865
+ } | {
3866
+ status: "not-leased";
3867
+ };
3868
+ leave: {
3869
+ status: "acknowledged";
3870
+ } | {
3871
+ status: "not-connected";
3872
+ } | {
3873
+ status: "rejected";
3874
+ message: string;
3875
+ } | {
3876
+ status: "unconfirmed";
3877
+ message: string;
3878
+ };
3879
+ };
3880
+ } | undefined;
3881
+ forced?: true | undefined;
3882
+ handBack?: "failed" | "returned" | "undeclared" | undefined;
3883
+ } | undefined;
3884
+ evidence?: {
3885
+ observation: {
3886
+ path: string;
3887
+ sha256: string;
3888
+ } | null;
3889
+ error: string | null;
3890
+ clip?: {
3891
+ status: "captured";
3892
+ path: string;
3893
+ sha256: string;
3894
+ bytes: number;
3895
+ frames: number;
3896
+ durationMs: number;
3897
+ } | {
3898
+ status: "not-captured";
3899
+ reason: "headless" | "busy" | "unsupported" | "surface-unavailable" | "capture-failed" | "runtime-replaced" | "host-unavailable";
3900
+ } | undefined;
3901
+ buildLog?: {
3902
+ path: string;
3903
+ sha256: string;
3904
+ bytes: number;
3905
+ truncated: boolean;
3906
+ } | undefined;
3907
+ trace?: {
3908
+ path: string;
3909
+ sha256: string;
3910
+ bytes: number;
3911
+ truncated: boolean;
3912
+ } | undefined;
3913
+ replay?: {
3914
+ reason: "loading" | "runtime-replaced" | "host-unavailable" | "no-simulation";
3915
+ message: string;
3916
+ } | undefined;
3917
+ inputLog?: {
3918
+ path: string;
3919
+ sha256: string;
3920
+ ticks: number;
3921
+ stepMs: number;
3922
+ entries: number;
3923
+ fromTick: number;
3924
+ full: boolean;
3925
+ } | undefined;
3926
+ } | undefined;
3927
+ }[]>;
3928
+ declare const listGameTestProfiles: (input?: z.infer<typeof gameRunDiscoverySchema>) => Promise<{
3929
+ gameId: string;
3930
+ profiles: AirJamTestProfileDescription[];
3931
+ }>;
3932
+ declare function watchGameRun(input: unknown, onEvent: Parameters<typeof watchGameSessionBroker>[0]["onEvent"], signal: AbortSignal): Promise<void>;
12
3933
 
13
- export { AirJamGameSessionInspection, AirJamGameSessionSummary, AirJamGameSessionVisualCaptureResult, CaptureGameSessionVisualsOptions, CloseGameSessionOptions, CloseGameSessionResult, InvokeGameSessionActionOptions, InvokeGameSessionActionResult, OpenGameSessionOptions, ReadGameSessionOptions, SendGameSessionInputOptions, SendGameSessionInputResult, captureGameSessionVisuals, closeGameSession, invokeGameSessionAction, openGameSession, readGameSession, sendGameSessionInput };
3934
+ export { AirJamGameSessionInspection, AirJamGameSessionSummary, AirJamGameSessionVisualCaptureResult, CaptureGameSessionVisualsOptions, CloseGameSessionOptions, CloseGameSessionResult, type ControlGameSessionParticipantOptions, CurrentRoomAttachment, GameRunSteerOptions, InvokeGameSessionActionOptions, InvokeGameSessionActionResult, type ObserveGameSessionOptions, OpenGameSessionOptions, ReadGameSessionOptions, SendGameSessionInputOptions, SendGameSessionInputResult, StartGameRunOptions, cancelGameRun, captureGameSessionVisuals, closeGameSession, controlGameSessionParticipant, gameSessionOperationSchemas, invokeGameSessionAction, listGameRuns, listGameTestProfiles, observeGameSession, openGameSession, readGameRun, readGameSession, readGameSettings, replayGameRun, sendGameSessionInput, startGameRun, steerGameRun, stopAllGameRuns, stopGameRun, updateGameSettings, waitGameRun, watchGameRun };