@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.
- package/README.md +60 -0
- package/dist/{chunk-VKMJO6VN.js → chunk-2O67AXCU.js} +150 -40
- package/dist/chunk-2O67AXCU.js.map +1 -0
- package/dist/chunk-AO3ZDXF6.js +142 -0
- package/dist/chunk-AO3ZDXF6.js.map +1 -0
- package/dist/chunk-ART5TEYT.js +472 -0
- package/dist/chunk-ART5TEYT.js.map +1 -0
- package/dist/chunk-ASC2CK2R.js +77 -0
- package/dist/chunk-ASC2CK2R.js.map +1 -0
- package/dist/chunk-E3UZZGAV.js +50 -0
- package/dist/chunk-E3UZZGAV.js.map +1 -0
- package/dist/chunk-EJTE7UKX.js +64 -0
- package/dist/chunk-EJTE7UKX.js.map +1 -0
- package/dist/chunk-ESFKNN75.js +110 -0
- package/dist/chunk-ESFKNN75.js.map +1 -0
- package/dist/chunk-EU7A6PXW.js +1339 -0
- package/dist/chunk-EU7A6PXW.js.map +1 -0
- package/dist/chunk-FN7E6EA7.js +549 -0
- package/dist/chunk-FN7E6EA7.js.map +1 -0
- package/dist/chunk-GDFAWHGA.js +190 -0
- package/dist/chunk-GDFAWHGA.js.map +1 -0
- package/dist/chunk-HZUGBH4Y.js +347 -0
- package/dist/chunk-HZUGBH4Y.js.map +1 -0
- package/dist/chunk-ITKAOEGX.js +93 -0
- package/dist/chunk-ITKAOEGX.js.map +1 -0
- package/dist/chunk-JBCUTWRI.js +897 -0
- package/dist/chunk-JBCUTWRI.js.map +1 -0
- package/dist/chunk-JSI5S4WP.js +1174 -0
- package/dist/chunk-JSI5S4WP.js.map +1 -0
- package/dist/chunk-L4D675BG.js +97 -0
- package/dist/chunk-L4D675BG.js.map +1 -0
- package/dist/chunk-M6CJ7GQC.js +133 -0
- package/dist/chunk-M6CJ7GQC.js.map +1 -0
- package/dist/{chunk-CKFT2ZJE.js → chunk-MEIMOSZC.js} +53 -105
- package/dist/chunk-MEIMOSZC.js.map +1 -0
- package/dist/{chunk-GUEZP773.js → chunk-O3XG3FNL.js} +204 -41
- package/dist/chunk-O3XG3FNL.js.map +1 -0
- package/dist/chunk-OM6SCJ7H.js +18 -0
- package/dist/chunk-OM6SCJ7H.js.map +1 -0
- package/dist/chunk-PKD4WVX5.js +63 -0
- package/dist/chunk-PKD4WVX5.js.map +1 -0
- package/dist/chunk-PMBLXGFM.js +3384 -0
- package/dist/chunk-PMBLXGFM.js.map +1 -0
- package/dist/chunk-PMNE5GIN.js +279 -0
- package/dist/chunk-PMNE5GIN.js.map +1 -0
- package/dist/chunk-QAWI64VR.js +148 -0
- package/dist/chunk-QAWI64VR.js.map +1 -0
- package/dist/chunk-QGADSPHZ.js +449 -0
- package/dist/chunk-QGADSPHZ.js.map +1 -0
- package/dist/chunk-SPYN66UV.js +338 -0
- package/dist/chunk-SPYN66UV.js.map +1 -0
- package/dist/context.d.ts +9 -3
- package/dist/context.js +2 -1
- package/dist/controller.d.ts +33 -7
- package/dist/controller.js +18 -8
- package/dist/dependencies.d.ts +44 -0
- package/dist/dependencies.js +10 -0
- package/dist/dev.d.ts +9 -3
- package/dist/dev.js +3 -4
- package/dist/game-builds.d.ts +200 -0
- package/dist/game-builds.js +16 -0
- package/dist/game-builds.js.map +1 -0
- package/dist/game-run-watch-CEd_SpAT.d.ts +84 -0
- package/dist/game-runs.d.ts +1452 -0
- package/dist/game-runs.js +76 -0
- package/dist/game-runs.js.map +1 -0
- package/dist/game-session-broker-CUvORfMd.d.ts +439 -0
- package/dist/game-session-broker.d.ts +4 -57
- package/dist/game-session-broker.js +33 -228
- package/dist/game-session-broker.js.map +1 -1
- package/dist/game-session.d.ts +3931 -10
- package/dist/game-session.js +186 -15
- package/dist/game-session.js.map +1 -1
- package/dist/game-settings.d.ts +16 -0
- package/dist/game-settings.js +237 -0
- package/dist/game-settings.js.map +1 -0
- package/dist/games.d.ts +11 -4
- package/dist/games.js +4 -2
- package/dist/harness/visual.d.ts +34 -151
- package/dist/harness/visual.js +6 -1
- package/dist/logs.d.ts +8 -2
- package/dist/logs.js +3 -4
- package/dist/logs.js.map +1 -1
- package/dist/managed-process-scope-BicYi_t9.d.ts +3 -0
- package/dist/mcp-config.js +2 -1
- package/dist/mcp-config.js.map +1 -1
- package/dist/platform-auth.d.ts +8 -111
- package/dist/platform-auth.js +9 -1
- package/dist/platform-game-analytics.d.ts +51 -0
- package/dist/platform-game-analytics.js +49 -0
- package/dist/platform-game-analytics.js.map +1 -0
- package/dist/platform-game-app-id.d.ts +46 -0
- package/dist/platform-game-app-id.js +93 -0
- package/dist/platform-game-app-id.js.map +1 -0
- package/dist/platform-game-media.d.ts +40 -2
- package/dist/platform-game-media.js +1 -1
- package/dist/platform-games.d.ts +24 -2
- package/dist/platform-games.js +16 -84
- package/dist/platform-games.js.map +1 -1
- package/dist/quality.d.ts +9 -3
- package/dist/quality.js +3 -4
- package/dist/quality.js.map +1 -1
- package/dist/release.d.ts +226 -16
- package/dist/release.js +18 -1331
- package/dist/release.js.map +1 -1
- package/dist/rooms-check.d.ts +90 -0
- package/dist/rooms-check.js +717 -0
- package/dist/rooms-check.js.map +1 -0
- package/dist/source-tree-contract.d.ts +16 -0
- package/dist/source-tree-contract.js +13 -0
- package/dist/source-tree-contract.js.map +1 -0
- package/dist/testing.d.ts +464 -0
- package/dist/testing.js +27 -0
- package/dist/testing.js.map +1 -0
- package/dist/tooling/describe-game.js +54 -0
- package/dist/tooling/describe-game.js.map +1 -0
- package/dist/tooling/game-session-broker.js +28 -0
- package/dist/tooling/game-session-broker.js.map +1 -0
- package/dist/tooling/hold-runtime-host.js +769 -67
- package/dist/tooling/hold-runtime-host.js.map +1 -1
- package/dist/tooling/list-visual-scenarios.js +18 -55
- package/dist/tooling/list-visual-scenarios.js.map +1 -1
- package/dist/tooling/process-scope-bootstrap.mjs +24 -0
- package/dist/tooling/process-scope-guard.d.ts +2 -0
- package/dist/tooling/process-scope-guard.js +388 -0
- package/dist/tooling/process-scope-guard.js.map +1 -0
- package/dist/tooling/process-scope-windows.ps1 +148 -0
- package/dist/tooling/rooms-check-device.d.ts +2 -0
- package/dist/tooling/rooms-check-device.js +498 -0
- package/dist/tooling/rooms-check-device.js.map +1 -0
- package/dist/tooling/run-headless-room.d.ts +2 -0
- package/dist/tooling/run-headless-room.js +287 -0
- package/dist/tooling/run-headless-room.js.map +1 -0
- package/dist/tooling/run-test-profile.d.ts +2 -0
- package/dist/tooling/run-test-profile.js +181 -0
- package/dist/tooling/run-test-profile.js.map +1 -0
- package/dist/tooling/run-visual-capture.js +70 -34
- package/dist/tooling/run-visual-capture.js.map +1 -1
- package/dist/tooling/seal-game-build.d.ts +2 -0
- package/dist/tooling/seal-game-build.js +120 -0
- package/dist/tooling/seal-game-build.js.map +1 -0
- package/dist/{types-C6NrHt88.d.ts → types-CdYrgrG_.d.ts} +337 -76
- package/dist/types-DyRD-ym1.d.ts +141 -0
- package/dist/visual.d.ts +9 -3
- package/dist/visual.js +24 -68
- package/dist/visual.js.map +1 -1
- package/package.json +51 -14
- package/src/bounded-response.ts +28 -0
- package/src/built-game-runtime.ts +152 -0
- package/src/context.ts +2 -13
- package/src/controller-protocol.ts +22 -0
- package/src/controller.ts +747 -597
- package/src/current-room-host.ts +166 -0
- package/src/decision-provider.ts +102 -0
- package/src/dependencies.ts +176 -0
- package/src/dependency-install-contract.ts +12 -0
- package/src/dev.ts +46 -50
- package/src/game-action-observation.ts +11 -1
- package/src/game-build-protocol.ts +72 -0
- package/src/game-build.ts +483 -0
- package/src/game-run-owner.ts +2358 -0
- package/src/game-run-protocol.ts +448 -0
- package/src/game-run-record.ts +92 -0
- package/src/game-run-replay.ts +95 -0
- package/src/game-run-watch.ts +155 -0
- package/src/game-session-broker.ts +689 -197
- package/src/game-session-operations.ts +61 -0
- package/src/game-session-protocol.ts +180 -0
- package/src/game-session-runtime.ts +861 -0
- package/src/game-session.ts +164 -417
- package/src/game-settings.ts +295 -0
- package/src/games.ts +88 -92
- package/src/harness/visual/browser.ts +100 -0
- package/src/harness/visual/controller-observation.ts +181 -0
- package/src/harness/visual/runner.ts +24 -21
- package/src/harness/visual/runtime-controller-observations.ts +151 -0
- package/src/harness/visual/scenario-contract.ts +1 -2
- package/src/harness/visual/scenario-helpers.ts +5 -1
- package/src/harness/visual/screencast.ts +155 -0
- package/src/harness/visual/session.ts +72 -41
- package/src/harness/visual/types.ts +8 -5
- package/src/headless-room-protocol.ts +112 -0
- package/src/headless-room.ts +222 -0
- package/src/helper-channel.ts +229 -0
- package/src/helper-scripts.ts +25 -5
- package/src/installed-dependencies.ts +74 -0
- package/src/managed-process-scope.ts +481 -0
- package/src/node-process-environment.ts +10 -0
- package/src/platform-auth.ts +194 -55
- package/src/platform-game-analytics.ts +50 -0
- package/src/platform-game-app-id.ts +99 -0
- package/src/platform-games.ts +13 -111
- package/src/policy-artifact-contract.ts +52 -0
- package/src/policy-artifacts.ts +134 -0
- package/src/process-scope-admission.ts +50 -0
- package/src/process-scope-protocol.ts +66 -0
- package/src/process-scope.ts +327 -0
- package/src/release.ts +28 -42
- package/src/rooms-check-fleet.ts +194 -0
- package/src/rooms-check-link.ts +138 -0
- package/src/rooms-check-protocol.ts +244 -0
- package/src/rooms-check.ts +797 -0
- package/src/runtime-owner-protocol.ts +106 -18
- package/src/source-tree-contract.ts +70 -0
- package/src/source-tree.ts +84 -0
- package/src/test-profile-process.ts +153 -0
- package/src/test-profile-protocol.ts +116 -0
- package/src/testing.ts +430 -0
- package/src/tooling/declaration-hook.ts +52 -0
- package/src/tooling/describe-game.ts +49 -0
- package/src/tooling/game-session-broker.ts +7 -0
- package/src/tooling/hold-runtime-host.ts +255 -38
- package/src/tooling/list-visual-scenarios.ts +19 -62
- package/src/tooling/load-game.ts +79 -0
- package/src/tooling/process-scope-bootstrap.mjs +24 -0
- package/src/tooling/process-scope-guard.ts +213 -0
- package/src/tooling/process-scope-windows.ps1 +148 -0
- package/src/tooling/rooms-check-device.ts +493 -0
- package/src/tooling/run-headless-room.ts +326 -0
- package/src/tooling/run-test-profile.ts +190 -0
- package/src/tooling/run-visual-capture.ts +37 -23
- package/src/tooling/runtime-owner-actions.ts +23 -0
- package/src/tooling/seal-game-build.ts +118 -0
- package/src/tooling/visual-pack.ts +10 -45
- package/src/types.ts +54 -77
- package/src/visual.ts +14 -22
- package/src/windows-process-scopes.ts +189 -0
- package/dist/agent.d.ts +0 -15
- package/dist/agent.js +0 -19
- package/dist/chunk-5YAARMW5.js +0 -36
- package/dist/chunk-5YAARMW5.js.map +0 -1
- package/dist/chunk-6WQODT37.js +0 -1019
- package/dist/chunk-6WQODT37.js.map +0 -1
- package/dist/chunk-CKFT2ZJE.js.map +0 -1
- package/dist/chunk-ER3Q2C4G.js +0 -358
- package/dist/chunk-ER3Q2C4G.js.map +0 -1
- package/dist/chunk-GUEZP773.js.map +0 -1
- package/dist/chunk-HIDNI56E.js +0 -33
- package/dist/chunk-HIDNI56E.js.map +0 -1
- package/dist/chunk-QKXS5D35.js +0 -43
- package/dist/chunk-QKXS5D35.js.map +0 -1
- package/dist/chunk-S4LSCEVE.js +0 -261
- package/dist/chunk-S4LSCEVE.js.map +0 -1
- package/dist/chunk-VKMJO6VN.js.map +0 -1
- package/dist/chunk-WFUR3MXY.js +0 -67
- package/dist/chunk-WFUR3MXY.js.map +0 -1
- package/dist/chunk-XEMR7KUE.js +0 -361
- package/dist/chunk-XEMR7KUE.js.map +0 -1
- package/dist/chunk-ZLPD7FY5.js +0 -191
- package/dist/chunk-ZLPD7FY5.js.map +0 -1
- package/dist/tooling/agent-contract.js +0 -193
- package/dist/tooling/agent-contract.js.map +0 -1
- package/dist/tooling/inspect-airjam-agent.js +0 -37
- package/dist/tooling/inspect-airjam-agent.js.map +0 -1
- package/src/agent.ts +0 -380
- package/src/tooling/agent-contract.ts +0 -232
- package/src/tooling/agent-declaration.ts +0 -36
- package/src/tooling/airjam-agent-inspection.ts +0 -45
- package/src/tooling/airjam-agent.ts +0 -118
- package/src/tooling/inspect-airjam-agent.ts +0 -20
- /package/dist/{agent.js.map → dependencies.js.map} +0 -0
- /package/dist/tooling/{agent-contract.d.ts → describe-game.d.ts} +0 -0
- /package/dist/tooling/{inspect-airjam-agent.d.ts → game-session-broker.d.ts} +0 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import type { Writable } from "node:stream";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
export const MAXIMUM_GAME_WATCH_FRAME_BASE64 = 512 * 1024;
|
|
5
|
+
export const GAME_WATCH_HEARTBEAT_MS = 2000;
|
|
6
|
+
export const gameRunWatchSurfaceSchema = z.discriminatedUnion("kind", [
|
|
7
|
+
z.object({ kind: z.literal("host") }).strict(),
|
|
8
|
+
z
|
|
9
|
+
.object({
|
|
10
|
+
kind: z.literal("controller"),
|
|
11
|
+
seatId: z.string().min(1).max(64),
|
|
12
|
+
})
|
|
13
|
+
.strict(),
|
|
14
|
+
]);
|
|
15
|
+
export type GameRunWatchSurface = z.infer<typeof gameRunWatchSurfaceSchema>;
|
|
16
|
+
export function formatGameRunWatchSurface(surface: GameRunWatchSurface) {
|
|
17
|
+
return surface.kind === "host" ? "host" : `controller:${surface.seatId}`;
|
|
18
|
+
}
|
|
19
|
+
export function parseGameRunWatchSurface(value: string): GameRunWatchSurface {
|
|
20
|
+
return gameRunWatchSurfaceSchema.parse(
|
|
21
|
+
value === "host"
|
|
22
|
+
? { kind: "host" }
|
|
23
|
+
: value.startsWith("controller:")
|
|
24
|
+
? { kind: "controller", seatId: value.slice("controller:".length) }
|
|
25
|
+
: { kind: value },
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
export const gameRunWatchRequestSchema = z
|
|
29
|
+
.object({
|
|
30
|
+
cwd: z.string().min(1).optional(),
|
|
31
|
+
runId: z.uuid(),
|
|
32
|
+
surface: gameRunWatchSurfaceSchema,
|
|
33
|
+
})
|
|
34
|
+
.strict();
|
|
35
|
+
export const gameRunWatchEventSchema = z.discriminatedUnion("type", [
|
|
36
|
+
z
|
|
37
|
+
.object({
|
|
38
|
+
type: z.literal("ready"),
|
|
39
|
+
runId: z.uuid(),
|
|
40
|
+
surface: gameRunWatchSurfaceSchema,
|
|
41
|
+
width: z.number().int().positive(),
|
|
42
|
+
height: z.number().int().positive(),
|
|
43
|
+
})
|
|
44
|
+
.strict(),
|
|
45
|
+
z
|
|
46
|
+
.object({
|
|
47
|
+
type: z.literal("frame"),
|
|
48
|
+
seq: z.number().int().nonnegative(),
|
|
49
|
+
capturedAt: z.number().finite(),
|
|
50
|
+
data: z.string().min(1).max(MAXIMUM_GAME_WATCH_FRAME_BASE64),
|
|
51
|
+
})
|
|
52
|
+
.strict(),
|
|
53
|
+
z
|
|
54
|
+
.object({
|
|
55
|
+
type: z.literal("heartbeat"),
|
|
56
|
+
at: z.number().finite(),
|
|
57
|
+
lastFrameSeq: z.number().int().nonnegative().nullable(),
|
|
58
|
+
})
|
|
59
|
+
.strict(),
|
|
60
|
+
z
|
|
61
|
+
.object({ type: z.literal("error"), message: z.string().min(1).max(4000) })
|
|
62
|
+
.strict(),
|
|
63
|
+
]);
|
|
64
|
+
export type GameRunWatchEvent = z.infer<typeof gameRunWatchEventSchema>;
|
|
65
|
+
export const gameSurfaceWatchEventSchema = z.discriminatedUnion("type", [
|
|
66
|
+
gameRunWatchEventSchema.options[0].omit({ runId: true, surface: true }),
|
|
67
|
+
gameRunWatchEventSchema.options[1],
|
|
68
|
+
gameRunWatchEventSchema.options[2],
|
|
69
|
+
gameRunWatchEventSchema.options[3],
|
|
70
|
+
]);
|
|
71
|
+
export type GameSurfaceWatchEvent = z.infer<typeof gameSurfaceWatchEventSchema>;
|
|
72
|
+
export type GameSurfaceWatcher = (
|
|
73
|
+
onEvent: (event: GameSurfaceWatchEvent) => void,
|
|
74
|
+
signal: AbortSignal,
|
|
75
|
+
) => Promise<void>;
|
|
76
|
+
|
|
77
|
+
// Frame production must never wait for a slow viewer or accumulate old images.
|
|
78
|
+
export class GameRunWatchWriter {
|
|
79
|
+
private blocked = false;
|
|
80
|
+
private closed = false;
|
|
81
|
+
private ready?: GameRunWatchEvent & { type: "ready" };
|
|
82
|
+
private frame?: GameRunWatchEvent & { type: "frame" };
|
|
83
|
+
private heartbeat?: GameRunWatchEvent & { type: "heartbeat" };
|
|
84
|
+
private readonly drained = () => {
|
|
85
|
+
this.blocked = false;
|
|
86
|
+
this.flush();
|
|
87
|
+
};
|
|
88
|
+
constructor(private readonly output: Writable) {
|
|
89
|
+
output.on("drain", this.drained);
|
|
90
|
+
}
|
|
91
|
+
send(event: GameRunWatchEvent) {
|
|
92
|
+
if (this.closed) return;
|
|
93
|
+
if (event.type === "error") {
|
|
94
|
+
this.close();
|
|
95
|
+
this.output.end(`${JSON.stringify(event)}\n`);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if (event.type === "ready") this.ready = event;
|
|
99
|
+
if (event.type === "frame") this.frame = event;
|
|
100
|
+
if (event.type === "heartbeat") this.heartbeat = event;
|
|
101
|
+
this.flush();
|
|
102
|
+
}
|
|
103
|
+
private flush() {
|
|
104
|
+
while (!this.closed && !this.blocked) {
|
|
105
|
+
const event = this.ready ?? this.heartbeat ?? this.frame;
|
|
106
|
+
if (!event) return;
|
|
107
|
+
if (event.type === "ready") this.ready = undefined;
|
|
108
|
+
if (event.type === "frame") this.frame = undefined;
|
|
109
|
+
if (event.type === "heartbeat") this.heartbeat = undefined;
|
|
110
|
+
this.blocked = !this.output.write(`${JSON.stringify(event)}\n`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
close() {
|
|
114
|
+
this.closed = true;
|
|
115
|
+
this.ready = undefined;
|
|
116
|
+
this.frame = undefined;
|
|
117
|
+
this.heartbeat = undefined;
|
|
118
|
+
this.output.off("drain", this.drained);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export async function readGameRunWatchStream(
|
|
123
|
+
stream: ReadableStream<Uint8Array>,
|
|
124
|
+
onEvent: (event: GameRunWatchEvent) => void,
|
|
125
|
+
) {
|
|
126
|
+
const reader = stream.getReader();
|
|
127
|
+
const decoder = new TextDecoder();
|
|
128
|
+
let pending = "";
|
|
129
|
+
try {
|
|
130
|
+
while (true) {
|
|
131
|
+
const part = await reader.read();
|
|
132
|
+
pending += decoder.decode(part.value, { stream: !part.done });
|
|
133
|
+
let newline: number;
|
|
134
|
+
while ((newline = pending.indexOf("\n")) >= 0) {
|
|
135
|
+
if (newline > MAXIMUM_GAME_WATCH_FRAME_BASE64 + 8192)
|
|
136
|
+
throw new Error("Run watch event exceeds its transfer allowance.");
|
|
137
|
+
const line = pending.slice(0, newline);
|
|
138
|
+
pending = pending.slice(newline + 1);
|
|
139
|
+
const event = gameRunWatchEventSchema.parse(JSON.parse(line));
|
|
140
|
+
onEvent(event);
|
|
141
|
+
if (event.type === "error") throw new Error(event.message);
|
|
142
|
+
}
|
|
143
|
+
if (pending.length > MAXIMUM_GAME_WATCH_FRAME_BASE64 + 8192)
|
|
144
|
+
throw new Error("Run watch event exceeds its transfer allowance.");
|
|
145
|
+
if (part.done) {
|
|
146
|
+
if (pending.length)
|
|
147
|
+
throw new Error("Run watch ended with an incomplete event.");
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
} finally {
|
|
152
|
+
await reader.cancel();
|
|
153
|
+
reader.releaseLock();
|
|
154
|
+
}
|
|
155
|
+
}
|