@air-jam/devtools 0.9.3 → 1.0.0-beta.2

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
@@ -0,0 +1,118 @@
1
+ import crossSpawn from "cross-spawn";
2
+ import { createHash } from "node:crypto";
3
+ import { readFile } from "node:fs/promises";
4
+ import path from "node:path";
5
+ import { z } from "zod";
6
+ import { detectProjectContext } from "../context.js";
7
+ import { installDependencies } from "../dependencies.js";
8
+ import { distributionFiles, materializeGameBuild } from "../game-build.js";
9
+ import { resolveDevtoolsHelperScript } from "../helper-scripts.js";
10
+ import { validateLocalRelease } from "../release.js";
11
+
12
+ const input = z
13
+ .object({
14
+ projectDir: z.string().min(1),
15
+ configRelative: z
16
+ .string()
17
+ .min(1)
18
+ .refine(
19
+ (value) =>
20
+ !path.isAbsolute(value) && !value.split(/[\\/]/).includes(".."),
21
+ ),
22
+ })
23
+ .parse(JSON.parse(process.argv[2] ?? "null"));
24
+ async function command(command: string, args: string[], cwd: string) {
25
+ const child = crossSpawn(command, args, {
26
+ cwd,
27
+ stdio: ["ignore", "pipe", "inherit"],
28
+ env: { ...process.env, CI: "true" },
29
+ });
30
+ let output = "";
31
+ child.stdout?.on("data", (chunk: Buffer) => {
32
+ output += chunk.toString();
33
+ if (output.length > 1_000_000) output = output.slice(-1_000_000);
34
+ });
35
+ const code = await new Promise<number | null>((resolve, reject) => {
36
+ child.once("error", reject);
37
+ child.once("exit", resolve);
38
+ });
39
+ if (code !== 0)
40
+ throw new Error(
41
+ `build_command_failed: ${command} ${args.join(" ")} (${code})\n${output}`,
42
+ );
43
+ return output.trim();
44
+ }
45
+ try {
46
+ const context = await detectProjectContext({ cwd: input.projectDir });
47
+ if (
48
+ context.mode !== "standalone-game" ||
49
+ context.packageManager !== "pnpm" ||
50
+ context.rootDir !== input.projectDir
51
+ )
52
+ throw new Error(
53
+ "pinned_build_unsupported: Built tests currently require a standalone game with a frozen pnpm lockfile.",
54
+ );
55
+ const directory = path.dirname(
56
+ path.dirname(resolveDevtoolsHelperScript("seal-game-build.ts")),
57
+ );
58
+ const implementation = await distributionFiles(directory);
59
+ const packageJson = JSON.parse(
60
+ await readFile(path.join(directory, "../package.json"), "utf8"),
61
+ );
62
+ const result = await materializeGameBuild({
63
+ ...input,
64
+ toolchain: {
65
+ node: process.version,
66
+ pnpm: await command("pnpm", ["--version"], input.projectDir),
67
+ devtools: z.string().parse(packageJson.version),
68
+ platform: process.platform,
69
+ architecture: process.arch,
70
+ nodeAbi: process.versions.modules,
71
+ projectRoot: input.projectDir,
72
+ implementationHash: createHash("sha256")
73
+ .update(JSON.stringify(implementation))
74
+ .digest("hex"),
75
+ environmentHash: createHash("sha256")
76
+ .update(
77
+ JSON.stringify(
78
+ Object.entries(process.env)
79
+ .filter(
80
+ ([name]) =>
81
+ ![
82
+ "AIRJAM_PROCESS_SCOPE",
83
+ "PWD",
84
+ "OLDPWD",
85
+ "SHLVL",
86
+ "_",
87
+ ].includes(name),
88
+ )
89
+ .sort(([left], [right]) => left.localeCompare(right)),
90
+ ),
91
+ )
92
+ .digest("hex"),
93
+ },
94
+ install: (rootDir) =>
95
+ installDependencies(rootDir, { network: "prefer-offline" }),
96
+ async build(rootDir) {
97
+ const validation = await validateLocalRelease({ cwd: rootDir });
98
+ if (!validation.ok)
99
+ throw new Error(
100
+ `build_validation_failed: ${validation.issues
101
+ .filter((issue) => issue.severity === "error")
102
+ .map((issue) => issue.message)
103
+ .join("\n")}`,
104
+ );
105
+ },
106
+ });
107
+ process.send?.({ type: "air-jam-game-build/v1", ok: true, build: result });
108
+ } catch (error) {
109
+ console.error(error instanceof Error ? error.stack : String(error));
110
+ process.send?.({
111
+ type: "air-jam-game-build/v1",
112
+ ok: false,
113
+ error: (error instanceof Error ? error.message : String(error)).slice(
114
+ 0,
115
+ 4000,
116
+ ),
117
+ });
118
+ }
@@ -1,46 +1,11 @@
1
- import { pathToFileURL } from "node:url";
2
- import type {
3
- AnyAirJamAgentContract,
4
- VisualScenarioPack,
5
- } from "../harness/visual.js";
6
- import { loadVisualScenarioPackFromConfig } from "./airjam-agent.js";
7
-
8
- export const loadVisualScenarioPack = async (
9
- modulePath: string,
10
- ): Promise<VisualScenarioPack<AnyAirJamAgentContract>> => {
11
- const loaded = (await import(pathToFileURL(modulePath).href)) as {
12
- visualScenarios?: VisualScenarioPack<AnyAirJamAgentContract>;
13
- };
14
-
15
- const scenarioPack = loaded.visualScenarios ?? null;
16
-
17
- if (
18
- !scenarioPack ||
19
- !scenarioPack.agent ||
20
- !Array.isArray(scenarioPack.scenarios)
21
- ) {
22
- throw new Error(`Invalid Air Jam visual scenario pack at ${modulePath}.`);
23
- }
24
-
25
- return scenarioPack;
26
- };
27
-
28
- export const loadVisualScenarioPackFromModuleOrConfig = async ({
29
- modulePath,
30
- configPath,
31
- }: {
32
- modulePath?: string | null;
33
- configPath?: string | null;
34
- }): Promise<VisualScenarioPack<AnyAirJamAgentContract>> => {
35
- if (configPath) {
36
- return loadVisualScenarioPackFromConfig(configPath);
37
- }
38
-
39
- if (modulePath) {
40
- return loadVisualScenarioPack(modulePath);
41
- }
42
-
43
- throw new Error(
44
- "Missing visual scenario source. Expected --config or --module-path.",
45
- );
1
+ import { loadAirJamGame, loadAirJamTesting } from "./load-game.js";
2
+
3
+ export const loadVisualScenarioPackFromConfig = async (configPath: string) => {
4
+ const game = await loadAirJamGame(configPath);
5
+ const testing = await loadAirJamTesting(configPath, game);
6
+ if (!game.agent || !testing?.visual)
7
+ throw new Error(
8
+ `Game "${game.metadata.slug}" must declare agent and testing.visual for visual scenarios.`,
9
+ );
10
+ return testing.visual;
46
11
  };
package/src/types.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { AirJamActionInvocationResult } from "@air-jam/sdk";
2
+ import type { AirJamGameDescription } from "@air-jam/sdk/core";
2
3
  import type {
3
4
  PlatformMachineCreateOwnedGameInput,
4
5
  PlatformMachineCreateOwnedGameResult,
@@ -19,6 +20,7 @@ import type {
19
20
  PlatformMachineUpdateOwnedGameInput,
20
21
  PlatformMachineUpdateOwnedGameResult,
21
22
  } from "@air-jam/sdk/platform-machine";
23
+ import type { ControllerDisconnection } from "./controller-protocol.js";
22
24
  import type { AirJamRuntimeOwnerScreenshot } from "./runtime-owner-protocol.js";
23
25
 
24
26
  export type AirJamProjectMode = "monorepo" | "standalone-game" | "unknown";
@@ -79,14 +81,13 @@ export type AirJamGameSummary = {
79
81
  category: string | null;
80
82
  scaffold: boolean | null;
81
83
  manifestPath: string | null;
82
- configPath: string | null;
84
+ configPath: string;
85
+ declaration: AirJamGameDescription;
83
86
  };
84
87
 
85
88
  export type AirJamGameInspection = AirJamGameSummary & {
86
89
  packageJsonPath: string | null;
87
90
  scripts: Record<string, string>;
88
- metadataExportLikely: boolean;
89
- controllerPathLikely: string | null;
90
91
  qualityGates: AirJamQualityGate[];
91
92
  };
92
93
 
@@ -141,7 +142,7 @@ export type AirJamLocalReleaseDoctor = {
141
142
  packageManager: AirJamPackageManager;
142
143
  configPath: string | null;
143
144
  buildScript: string | null;
144
- metadataExportLikely: boolean;
145
+ gameSlug: string | null;
145
146
  controllerPath: string | null;
146
147
  distDir: string;
147
148
  distExists: boolean;
@@ -272,6 +273,8 @@ export type InspectPlatformReleaseOptions = {
272
273
  releaseId: string;
273
274
  };
274
275
 
276
+ export type ArchivePlatformReleaseOptions = InspectPlatformReleaseOptions;
277
+
275
278
  export type PublishPlatformReleaseOptions = {
276
279
  platformUrl?: string;
277
280
  token?: string;
@@ -383,6 +386,7 @@ export type AirJamPlatformAuthStatus = {
383
386
  session: {
384
387
  id: string;
385
388
  expiresAt: string;
389
+ refreshExpiresAt: string;
386
390
  createdAt: string;
387
391
  userAgent: string;
388
392
  } | null;
@@ -517,6 +521,11 @@ export type GetDevStatusOptions = {
517
521
  };
518
522
 
519
523
  export type AirJamDevStatus = {
524
+ gameSessionBroker: Awaited<
525
+ ReturnType<
526
+ typeof import("./game-session-broker.js").getGameSessionBrokerStatus
527
+ >
528
+ >;
520
529
  processes: AirJamManagedDevProcess[];
521
530
  unmanagedProcesses: AirJamUnmanagedDevProcess[];
522
531
  knownPorts: number[];
@@ -527,6 +536,9 @@ export type ResetLocalDevOptions = {
527
536
  };
528
537
 
529
538
  export type ResetLocalDevResult = {
539
+ gameSessionBroker: Awaited<
540
+ ReturnType<typeof import("./game-session-broker.js").stopGameSessionBroker>
541
+ >;
530
542
  stoppedManaged: AirJamManagedDevProcess[];
531
543
  stoppedUnmanaged: AirJamUnmanagedDevProcess[];
532
544
  remainingUnmanaged: AirJamUnmanagedDevProcess[];
@@ -547,44 +559,13 @@ export type AirJamVisualScenarioSummary = {
547
559
  supportedModes: AirJamVisualCaptureMode[];
548
560
  };
549
561
 
550
- export type AirJamGameAgentActionDescriptor = {
551
- actionId: string;
552
- target: {
553
- kind: "participant" | "host";
554
- actionName: string;
555
- storeDomain: string;
556
- };
557
- description: string | null;
558
- availability: string | null;
559
- payload: {
560
- kind: "none" | "boolean" | "number" | "string" | "enum" | "json";
561
- description: string | null;
562
- allowedValues?: string[];
563
- };
564
- resultDescription: string | null;
565
- };
566
-
567
- export type AirJamAgentContractInspection = {
568
- gameId: string;
569
- rootDir: string;
570
- hasContract: boolean;
571
- snapshotStoreDomains: string[];
572
- snapshotDescription: string | null;
573
- actions: AirJamGameAgentActionDescriptor[];
574
- };
575
-
576
- export type InspectGameAgentContractOptions = {
577
- cwd?: string;
578
- gameId?: string;
579
- };
580
-
581
- export type ReadGameSnapshotOptions = {
582
- controllerSessionId: string;
583
- requestSync?: boolean;
584
- timeoutMs?: number;
585
- };
562
+ export type AirJamGameAgentActionDescriptor = import("zod").z.infer<
563
+ typeof import("@air-jam/sdk/agent-tooling").agentActionDescriptorSchema
564
+ >;
586
565
 
587
566
  export type AirJamGameSnapshotInspection = {
567
+ contractId: string;
568
+ runtimeId: string;
588
569
  controllerSessionId: string;
589
570
  gameId: string;
590
571
  /** Logical store names declared by the game contract. */
@@ -601,18 +582,13 @@ export type AirJamGameSnapshotInspection = {
601
582
  rawStores: AirJamRuntimeStoreSnapshot[];
602
583
  };
603
584
 
604
- export type InvokeGameActionOptions = {
605
- controllerSessionId: string;
606
- actionId: string;
607
- payload?: unknown;
608
- timeoutMs?: number;
609
- };
610
-
611
585
  export type AirJamGameActionAcknowledgementObservation =
612
586
  | "host-acknowledged"
613
587
  | "host-acknowledgement-not-observed";
614
588
 
615
589
  export type AirJamGameActionOutcome =
590
+ | "contract_changed"
591
+ | "runtime_replaced"
616
592
  | "accepted"
617
593
  | "rejected"
618
594
  | "acknowledgement-not-observed-state-changed"
@@ -632,7 +608,9 @@ export type InvokeGameActionResult = AirJamVirtualControllerSessionSummary & {
632
608
  snapshotAfter: AirJamGameSnapshotInspection;
633
609
  snapshotAfterStatus:
634
610
  | "committed-update-observed"
635
- | "no-new-commit-before-timeout";
611
+ | "no-new-commit-before-timeout"
612
+ | "contract_changed"
613
+ | "runtime_replaced";
636
614
  observedStateChange: boolean;
637
615
  };
638
616
 
@@ -652,7 +630,7 @@ export type AirJamGameSessionActionDescriptor = {
652
630
 
653
631
  export type AirJamVisualScenarioList = {
654
632
  gameId: string;
655
- scenarioModulePath: string | null;
633
+ configPath: string;
656
634
  scenarios: AirJamVisualScenarioSummary[];
657
635
  };
658
636
 
@@ -707,11 +685,8 @@ export type ConnectControllerOptions = {
707
685
  secure?: boolean;
708
686
  roomId?: string;
709
687
  controllerJoinUrl?: string;
710
- controllerId?: string;
711
- deviceId?: string;
712
688
  nickname?: string;
713
689
  avatarId?: string;
714
- capabilityToken?: string;
715
690
  timeoutMs?: number;
716
691
  };
717
692
 
@@ -721,6 +696,7 @@ export type SendControllerInputOptions = {
721
696
  };
722
697
 
723
698
  export type InvokeControllerActionOptions = {
699
+ timeoutMs?: number;
724
700
  controllerSessionId: string;
725
701
  actionName: string;
726
702
  storeDomain: string;
@@ -750,12 +726,17 @@ export type AirJamVirtualControllerSessionSummary = {
750
726
  gameId: string | null;
751
727
  projectMode: AirJamProjectMode;
752
728
  mode: AirJamDevMode | null;
753
- topologyMode: "standalone-dev" | "arcade-live" | "arcade-built" | null;
729
+ topologyMode:
730
+ | "standalone-dev"
731
+ | "arcade-live"
732
+ | "arcade-built"
733
+ | "self-hosted-production"
734
+ | null;
754
735
  secure: boolean;
755
736
  process: AirJamManagedDevProcess | null;
756
737
  roomId: string;
738
+ /** The seat the room gave this phone. */
757
739
  controllerId: string;
758
- deviceId: string;
759
740
  controllerJoinUrl: string;
760
741
  socketOrigin: string;
761
742
  connected: boolean;
@@ -791,7 +772,7 @@ export type InvokeControllerActionResult =
791
772
  acknowledgement: AirJamActionInvocationResult;
792
773
  };
793
774
 
794
- export type DisconnectControllerResult = {
775
+ export type DisconnectControllerResult = ControllerDisconnection & {
795
776
  disconnected: boolean;
796
777
  session: AirJamVirtualControllerSessionSummary;
797
778
  };
@@ -801,17 +782,19 @@ export type AirJamRuntimeSnapshotInspection = AirJamVirtualControllerSession;
801
782
  export type OpenGameSessionOptions = ConnectControllerOptions;
802
783
 
803
784
  export type ReadGameSessionOptions = {
785
+ cwd?: string;
804
786
  gameSessionId: string;
805
- requestSync?: boolean;
806
787
  timeoutMs?: number;
807
788
  };
808
789
 
809
790
  export type SendGameSessionInputOptions = {
791
+ cwd?: string;
810
792
  gameSessionId: string;
811
793
  input: JsonObject;
812
794
  };
813
795
 
814
796
  export type InvokeGameSessionActionOptions = {
797
+ cwd?: string;
815
798
  gameSessionId: string;
816
799
  actionId: string;
817
800
  payload?: unknown;
@@ -819,27 +802,36 @@ export type InvokeGameSessionActionOptions = {
819
802
  };
820
803
 
821
804
  export type CaptureGameSessionVisualsOptions = {
805
+ cwd?: string;
822
806
  gameSessionId: string;
823
807
  timeoutMs?: number;
824
808
  };
825
809
 
826
810
  export type CloseGameSessionOptions = {
811
+ cwd?: string;
827
812
  gameSessionId: string;
828
813
  };
829
814
 
830
815
  export type AirJamGameSessionSummary = {
816
+ ownerInstanceId: string;
817
+ semanticAccess: "owned-host" | "delegated-host" | "participant-only";
831
818
  gameSessionId: string;
832
819
  cwd: string;
833
820
  gameId: string | null;
834
821
  controllerSessionId: string;
835
822
  projectMode: AirJamProjectMode;
836
823
  mode: AirJamDevMode | null;
837
- topologyMode: "standalone-dev" | "arcade-live" | "arcade-built" | null;
824
+ topologyMode:
825
+ | "standalone-dev"
826
+ | "arcade-live"
827
+ | "arcade-built"
828
+ | "self-hosted-production"
829
+ | null;
838
830
  secure: boolean;
839
831
  process: AirJamManagedDevProcess | null;
840
832
  roomId: string;
833
+ /** The seat the room gave this phone. */
841
834
  controllerId: string;
842
- deviceId: string;
843
835
  controllerJoinUrl: string;
844
836
  socketOrigin: string;
845
837
  connected: boolean;
@@ -875,6 +867,7 @@ export type AirJamGameSessionVisualCaptureResult = AirJamGameSessionSummary & {
875
867
 
876
868
  export type CloseGameSessionResult = {
877
869
  closed: boolean;
870
+ disconnection: Pick<DisconnectControllerResult, "release" | "leave">;
878
871
  session: AirJamGameSessionSummary;
879
872
  };
880
873
 
@@ -897,25 +890,9 @@ export type AirJamVisualCaptureInspection = {
897
890
  summary: AirJamVisualCaptureSummary;
898
891
  };
899
892
 
900
- export type AirJamPlatformMachineSessionStore = {
901
- version: 1;
902
- platformBaseUrl: string;
903
- clientName: string | null;
904
- storedAt: string;
905
- user: {
906
- id: string;
907
- name: string;
908
- email: string;
909
- role: "creator" | "ops_admin";
910
- };
911
- session: {
912
- id: string;
913
- token: string;
914
- expiresAt: string;
915
- createdAt: string;
916
- userAgent: string;
917
- };
918
- };
893
+ export type AirJamPlatformMachineSessionStore = import("zod").infer<
894
+ typeof import("./platform-auth.js").storedPlatformSessionSchema
895
+ >;
919
896
 
920
897
  export type StartPlatformDeviceAuthorizationOptions = {
921
898
  platformUrl?: string;
package/src/visual.ts CHANGED
@@ -13,7 +13,6 @@ import {
13
13
  resolveDevtoolsHelperArgs,
14
14
  resolveDevtoolsHelperScript,
15
15
  } from "./helper-scripts.js";
16
- import { inspectAirJamAgentConfig } from "./tooling/airjam-agent-inspection.js";
17
16
  import type {
18
17
  AirJamSurfaceUrlSummary,
19
18
  AirJamVisualArtifactMode,
@@ -39,7 +38,6 @@ export type {
39
38
 
40
39
  type ResolvedVisualSource = {
41
40
  configPath: string;
42
- scenarioModulePath: string;
43
41
  };
44
42
 
45
43
  const captureUrlsSchema = z.object({
@@ -96,18 +94,10 @@ const runTsxHelper = <T>({
96
94
  return parseHelperJson<T>(result.stdout);
97
95
  };
98
96
 
99
- const resolveVisualSource = async (
100
- configPath: string | null,
101
- ): Promise<ResolvedVisualSource | null> => {
102
- if (!configPath) {
103
- return null;
104
- }
105
-
106
- const scenarioModulePath = await inspectAirJamAgentConfig(configPath).then(
107
- (inspection) => inspection.visualScenariosModulePath,
108
- );
109
- return scenarioModulePath ? { configPath, scenarioModulePath } : null;
110
- };
97
+ const resolveVisualSource = (
98
+ game: Awaited<ReturnType<typeof inspectGame>>,
99
+ ): ResolvedVisualSource | null =>
100
+ game.declaration.testing ? { configPath: game.configPath } : null;
111
101
 
112
102
  const readScenarioMetadata = async ({
113
103
  artifactRoot,
@@ -139,14 +129,15 @@ export const listVisualScenarios = async ({
139
129
  gameId,
140
130
  }: ListVisualScenariosOptions = {}): Promise<AirJamVisualScenarioList> => {
141
131
  const game = await inspectGame({ cwd, gameId });
142
- const source = await resolveVisualSource(game.configPath);
132
+ const source = resolveVisualSource(game);
143
133
  if (!source) {
144
134
  throw new Error(
145
- `No visual scenarios published for "${game.id}" in ${game.rootDir}.`,
135
+ `No visual scenarios declared for "${game.id}" in ${game.rootDir}.`,
146
136
  );
147
137
  }
148
138
 
149
139
  const result = runTsxHelper<{
140
+ hasVisualScenarios: boolean;
150
141
  gameId: string;
151
142
  scenarios: AirJamVisualScenarioList["scenarios"];
152
143
  }>({
@@ -154,9 +145,11 @@ export const listVisualScenarios = async ({
154
145
  cwd: game.rootDir,
155
146
  args: [`--config=${source.configPath}`],
156
147
  });
148
+ if (!result.hasVisualScenarios)
149
+ throw new Error(`No visual scenarios declared for "${game.id}".`);
157
150
  return {
158
151
  gameId: result.gameId,
159
- scenarioModulePath: source.scenarioModulePath,
152
+ configPath: source.configPath,
160
153
  scenarios: result.scenarios,
161
154
  };
162
155
  };
@@ -179,10 +172,10 @@ const withVisualSession = async <T>({
179
172
  }) => Promise<T>;
180
173
  }): Promise<T> => {
181
174
  const game = await inspectGame({ cwd, gameId });
182
- const visualSource = await resolveVisualSource(game.configPath);
175
+ const visualSource = resolveVisualSource(game);
183
176
  if (!visualSource) {
184
177
  throw new Error(
185
- `No visual scenarios published for "${game.id}" in ${game.rootDir}.`,
178
+ `No visual scenarios declared for "${game.id}" in ${game.rootDir}.`,
186
179
  );
187
180
  }
188
181
 
@@ -234,7 +227,6 @@ const captureGameAtRuntime = async ({
234
227
  args: [
235
228
  `--game-id=${game.id}`,
236
229
  `--config=${visualSource.configPath}`,
237
- `--module-path=${visualSource.scenarioModulePath}`,
238
230
  `--artifact-root=${artifactRoot}`,
239
231
  `--mode=${mode === "arcade-built" ? "arcade-test" : "standalone-dev"}`,
240
232
  `--app-origin=${resolvedUrls.appOrigin}`,
@@ -268,10 +260,10 @@ export const captureVisualsAtRuntime = async ({
268
260
  ...runtime
269
261
  }: CaptureVisualsAtRuntimeOptions): Promise<CaptureVisualsResult> => {
270
262
  const game = await inspectGame({ cwd, gameId });
271
- const visualSource = await resolveVisualSource(game.configPath);
263
+ const visualSource = resolveVisualSource(game);
272
264
  if (!visualSource) {
273
265
  throw new Error(
274
- `No visual scenarios published for "${game.id}" in ${game.rootDir}.`,
266
+ `No visual scenarios declared for "${game.id}" in ${game.rootDir}.`,
275
267
  );
276
268
  }
277
269
  return captureGameAtRuntime({ game, visualSource, ...runtime });