@air-jam/devtools 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +112 -2
- package/dist/chunk-2O67AXCU.js +470 -0
- 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-MEIMOSZC.js +749 -0
- package/dist/chunk-MEIMOSZC.js.map +1 -0
- package/dist/chunk-O3XG3FNL.js +1014 -0
- 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 +19 -0
- package/dist/context.js +10 -0
- package/dist/context.js.map +1 -0
- package/dist/controller.d.ts +67 -0
- package/dist/controller.js +40 -0
- package/dist/controller.js.map +1 -0
- package/dist/dependencies.d.ts +44 -0
- package/dist/dependencies.js +10 -0
- package/dist/dependencies.js.map +1 -0
- package/dist/dev.d.ts +21 -0
- package/dist/dev.js +19 -0
- package/dist/dev.js.map +1 -0
- 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 -0
- package/dist/game-session-broker.js +40 -0
- package/dist/game-session-broker.js.map +1 -0
- package/dist/game-session.d.ts +3934 -0
- package/dist/game-session.js +195 -0
- package/dist/game-session.js.map +1 -0
- 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 +28 -0
- package/dist/games.js +16 -0
- package/dist/games.js.map +1 -0
- package/dist/harness/visual.d.ts +204 -0
- package/dist/harness/visual.js +46 -0
- package/dist/harness/visual.js.map +1 -0
- package/dist/logs.d.ts +15 -0
- package/dist/logs.js +57 -0
- package/dist/logs.js.map +1 -0
- package/dist/managed-process-scope-BicYi_t9.d.ts +3 -0
- package/dist/mcp-config.d.ts +63 -0
- package/dist/mcp-config.js +191 -0
- package/dist/mcp-config.js.map +1 -0
- package/dist/platform-auth.d.ts +9 -0
- package/dist/platform-auth.js +45 -0
- package/dist/platform-auth.js.map +1 -0
- 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 +347 -0
- package/dist/platform-game-media.js +168 -0
- package/dist/platform-game-media.js.map +1 -0
- package/dist/platform-games.d.ts +87 -0
- package/dist/platform-games.js +183 -0
- package/dist/platform-games.js.map +1 -0
- package/dist/quality.d.ts +16 -0
- package/dist/quality.js +62 -0
- package/dist/quality.js.map +1 -0
- package/dist/release.d.ts +1304 -0
- package/dist/release.js +34 -0
- package/dist/release.js.map +1 -0
- 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.d.ts +2 -0
- package/dist/tooling/describe-game.js +54 -0
- package/dist/tooling/describe-game.js.map +1 -0
- package/dist/tooling/game-session-broker.d.ts +2 -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.d.ts +2 -0
- package/dist/tooling/hold-runtime-host.js +931 -0
- package/dist/tooling/hold-runtime-host.js.map +1 -0
- package/dist/tooling/list-visual-scenarios.d.ts +2 -0
- package/dist/tooling/list-visual-scenarios.js +25 -0
- package/dist/tooling/list-visual-scenarios.js.map +1 -0
- package/dist/tooling/managed-dev-supervisor.d.ts +2 -0
- package/dist/tooling/managed-dev-supervisor.js +51 -0
- package/dist/tooling/managed-dev-supervisor.js.map +1 -0
- 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.d.ts +2 -0
- package/dist/tooling/run-visual-capture.js +203 -0
- package/dist/tooling/run-visual-capture.js.map +1 -0
- 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-CdYrgrG_.d.ts +1036 -0
- package/dist/types-DyRD-ym1.d.ts +141 -0
- package/dist/visual.d.ts +21 -0
- package/dist/visual.js +219 -0
- package/dist/visual.js.map +1 -0
- package/package.json +150 -3
- package/src/bounded-response.ts +28 -0
- package/src/built-game-runtime.ts +152 -0
- package/src/commands.ts +40 -0
- package/src/context.ts +218 -0
- package/src/controller-protocol.ts +22 -0
- package/src/controller.ts +1526 -0
- 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 +995 -0
- package/src/fs-utils.ts +93 -0
- package/src/game-action-observation.ts +106 -0
- 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 +793 -0
- 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 +206 -0
- package/src/game-settings.ts +295 -0
- package/src/games.ts +262 -0
- package/src/harness/visual/browser.ts +100 -0
- package/src/harness/visual/controller-observation.ts +181 -0
- package/src/harness/visual/prefab-contract.ts +29 -0
- package/src/harness/visual/prefab-runner.ts +178 -0
- package/src/harness/visual/runner.ts +549 -0
- package/src/harness/visual/runtime-controller-observations.ts +151 -0
- package/src/harness/visual/scenario-contract.ts +8 -0
- package/src/harness/visual/scenario-helpers.ts +67 -0
- package/src/harness/visual/screencast.ts +155 -0
- package/src/harness/visual/session.ts +400 -0
- package/src/harness/visual/types.ts +184 -0
- package/src/harness/visual.ts +7 -0
- 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 +69 -0
- package/src/installed-dependencies.ts +74 -0
- package/src/logs.ts +67 -0
- package/src/managed-process-scope.ts +481 -0
- package/src/mcp-config.ts +262 -0
- package/src/node-process-environment.ts +10 -0
- package/src/platform-auth.ts +594 -0
- package/src/platform-game-analytics.ts +50 -0
- package/src/platform-game-app-id.ts +99 -0
- package/src/platform-game-media.ts +209 -0
- package/src/platform-games.ts +217 -0
- 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/quality.ts +82 -0
- package/src/release.ts +1683 -0
- 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 +218 -0
- 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 +441 -0
- package/src/tooling/list-visual-scenarios.ts +21 -0
- package/src/tooling/load-game.ts +79 -0
- package/src/tooling/managed-dev-supervisor.ts +71 -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 +231 -0
- package/src/tooling/runtime-owner-actions.ts +65 -0
- package/src/tooling/seal-game-build.ts +118 -0
- package/src/tooling/visual-pack.ts +11 -0
- package/src/types.ts +928 -0
- package/src/visual.ts +296 -0
- package/src/windows-process-scopes.ts +189 -0
- package/src/workspace-contract.ts +32 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { aj as InvokeGameActionResult } from './types-CdYrgrG_.js';
|
|
2
|
+
import { AnyAirJamAgentContract, AirJamAgentContract } from '@air-jam/sdk/core';
|
|
3
|
+
import { AirJamGameInputModality } from '@air-jam/sdk/metadata';
|
|
4
|
+
import { Page } from 'playwright-core';
|
|
5
|
+
|
|
6
|
+
type VisualHarnessMode = "standalone-dev" | "arcade-built";
|
|
7
|
+
type VisualViewport = {
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
};
|
|
11
|
+
type VisualScreenshotRecord = {
|
|
12
|
+
surface: "host" | "controller";
|
|
13
|
+
viewportName: string;
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
fileName: string;
|
|
17
|
+
filePath: string;
|
|
18
|
+
};
|
|
19
|
+
type VisualHarnessUrls = {
|
|
20
|
+
appOrigin: string;
|
|
21
|
+
hostUrl: string;
|
|
22
|
+
controllerBaseUrl: string;
|
|
23
|
+
publicHost: string;
|
|
24
|
+
localBuildUrl: string | null;
|
|
25
|
+
browserBuildUrl: string | null;
|
|
26
|
+
controllerJoinUrl: string;
|
|
27
|
+
};
|
|
28
|
+
type VisualQuerySurface = {
|
|
29
|
+
getByLabel: Page["getByLabel"];
|
|
30
|
+
getByRole: Page["getByRole"];
|
|
31
|
+
getByTestId: Page["getByTestId"];
|
|
32
|
+
getByText: Page["getByText"];
|
|
33
|
+
locator: Page["locator"];
|
|
34
|
+
};
|
|
35
|
+
type VisualHarnessPageSurface = {
|
|
36
|
+
page: Page;
|
|
37
|
+
game: VisualQuerySurface;
|
|
38
|
+
embedded: boolean;
|
|
39
|
+
};
|
|
40
|
+
type InferVisualScenarioSnapshot<TAgent> = TAgent extends AirJamAgentContract<infer TSnapshot, infer _TStores> ? TSnapshot : never;
|
|
41
|
+
type VisualScenarioAgentActionDescriptor = {
|
|
42
|
+
actionId: string;
|
|
43
|
+
lane: "player" | "host";
|
|
44
|
+
source: "semantic-game";
|
|
45
|
+
description: string | null;
|
|
46
|
+
availability: string | null;
|
|
47
|
+
payload: {
|
|
48
|
+
kind: "none" | "boolean" | "number" | "string" | "enum" | "json";
|
|
49
|
+
description: string | null;
|
|
50
|
+
allowedValues?: string[];
|
|
51
|
+
};
|
|
52
|
+
resultDescription: string | null;
|
|
53
|
+
};
|
|
54
|
+
type VisualScenarioAgentInvocation<TSnapshot = Record<string, unknown>> = {
|
|
55
|
+
actionId: string;
|
|
56
|
+
lane: "player" | "host";
|
|
57
|
+
outcome: string | null;
|
|
58
|
+
acknowledgementObservation: string | null;
|
|
59
|
+
snapshotBefore: TSnapshot | null;
|
|
60
|
+
snapshotAfter: TSnapshot | null;
|
|
61
|
+
snapshotAfterStatus: InvokeGameActionResult["snapshotAfterStatus"] | null;
|
|
62
|
+
};
|
|
63
|
+
type VisualScenarioAgent<TSnapshot = Record<string, unknown>> = {
|
|
64
|
+
listActions: () => Promise<readonly VisualScenarioAgentActionDescriptor[]>;
|
|
65
|
+
read: () => Promise<TSnapshot>;
|
|
66
|
+
waitFor: (predicate: (snapshot: TSnapshot) => boolean | Promise<boolean>, description?: string, timeout?: number) => Promise<TSnapshot>;
|
|
67
|
+
invoke: (actionId: string, payload?: unknown, options?: {
|
|
68
|
+
timeoutMs?: number;
|
|
69
|
+
}) => Promise<VisualScenarioAgentInvocation<TSnapshot>>;
|
|
70
|
+
close: () => Promise<void>;
|
|
71
|
+
};
|
|
72
|
+
type VisualScenarioContext<TAgent extends AnyAirJamAgentContract = AnyAirJamAgentContract> = {
|
|
73
|
+
gameId: string;
|
|
74
|
+
scenario: VisualScenario<TAgent>;
|
|
75
|
+
scenarioDir: string;
|
|
76
|
+
inputModalities?: readonly AirJamGameInputModality[];
|
|
77
|
+
urls: VisualHarnessUrls;
|
|
78
|
+
host: VisualHarnessPageSurface;
|
|
79
|
+
controller: VisualHarnessPageSurface & {
|
|
80
|
+
fullscreenPromptDismissed: boolean;
|
|
81
|
+
};
|
|
82
|
+
note: (value: string) => void;
|
|
83
|
+
sleep: (ms: number) => Promise<void>;
|
|
84
|
+
ensureControllerInteractive: () => Promise<void>;
|
|
85
|
+
agent: VisualScenarioAgent<InferVisualScenarioSnapshot<TAgent>>;
|
|
86
|
+
captureHost: (viewportName: string, viewport: VisualViewport) => Promise<void>;
|
|
87
|
+
captureController: (viewportName: string, viewport: VisualViewport) => Promise<void>;
|
|
88
|
+
screenshotRecords: VisualScreenshotRecord[];
|
|
89
|
+
notes: string[];
|
|
90
|
+
close: () => Promise<void>;
|
|
91
|
+
};
|
|
92
|
+
type VisualScenario<TAgent extends AnyAirJamAgentContract = AnyAirJamAgentContract> = {
|
|
93
|
+
id: string;
|
|
94
|
+
description?: string;
|
|
95
|
+
run: (context: VisualScenarioContext<TAgent>) => Promise<void>;
|
|
96
|
+
};
|
|
97
|
+
type VisualScenarioPack<TAgent extends AnyAirJamAgentContract = AnyAirJamAgentContract> = {
|
|
98
|
+
scenarios: ReadonlyArray<VisualScenario<TAgent>>;
|
|
99
|
+
};
|
|
100
|
+
type VisualCaptureScenarioMetadata = {
|
|
101
|
+
gameId: string;
|
|
102
|
+
scenarioId: string;
|
|
103
|
+
scenarioDescription: string | null;
|
|
104
|
+
runtimeMode: VisualHarnessMode;
|
|
105
|
+
capturedAt: string;
|
|
106
|
+
status: "captured" | "failed";
|
|
107
|
+
urls: Omit<VisualHarnessUrls, "controllerJoinUrl"> | VisualHarnessUrls;
|
|
108
|
+
screenshots: Array<{
|
|
109
|
+
surface: "host" | "controller";
|
|
110
|
+
viewportName: string;
|
|
111
|
+
width: number;
|
|
112
|
+
height: number;
|
|
113
|
+
fileName: string;
|
|
114
|
+
relativePath: string;
|
|
115
|
+
}>;
|
|
116
|
+
notes: string[];
|
|
117
|
+
error: {
|
|
118
|
+
message: string;
|
|
119
|
+
stack: string | null;
|
|
120
|
+
} | null;
|
|
121
|
+
};
|
|
122
|
+
type VisualCaptureSummary = {
|
|
123
|
+
gameId: string;
|
|
124
|
+
mode: VisualHarnessMode;
|
|
125
|
+
secure: boolean;
|
|
126
|
+
capturedAt: string;
|
|
127
|
+
scenarios: Array<{
|
|
128
|
+
scenarioId: string;
|
|
129
|
+
status: "captured" | "failed";
|
|
130
|
+
screenshotCount: number;
|
|
131
|
+
relativeDir: string;
|
|
132
|
+
}>;
|
|
133
|
+
};
|
|
134
|
+
type RunVisualCaptureCommandOptions = {
|
|
135
|
+
gameId: string;
|
|
136
|
+
scenarioId?: string | null;
|
|
137
|
+
mode?: VisualHarnessMode;
|
|
138
|
+
secure?: boolean;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
export type { InferVisualScenarioSnapshot as I, RunVisualCaptureCommandOptions as R, VisualScenarioPack as V, VisualHarnessMode as a, VisualViewport as b, VisualHarnessUrls as c, VisualHarnessPageSurface as d, VisualScenarioAgent as e, VisualScenario as f, VisualCaptureSummary as g, VisualScenarioContext as h, VisualScreenshotRecord as i, VisualQuerySurface as j, VisualScenarioAgentActionDescriptor as k, VisualScenarioAgentInvocation as l, VisualCaptureScenarioMetadata as m };
|
package/dist/visual.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ad as CaptureVisualsOptions, ae as AirJamVisualArtifactMode, x as AirJamSurfaceUrlSummary, af as ListVisualScenariosOptions, ag as AirJamVisualScenarioList, ah as CaptureVisualsResult } from './types-CdYrgrG_.js';
|
|
2
|
+
export { z as AirJamVisualCaptureInspection, B as AirJamVisualCaptureSummary, ai as AirJamVisualScenarioMetadata } from './types-CdYrgrG_.js';
|
|
3
|
+
import '@air-jam/sdk/platform-machine';
|
|
4
|
+
import 'zod';
|
|
5
|
+
import '@air-jam/sdk/agent-tooling';
|
|
6
|
+
import './game-session-broker-CUvORfMd.js';
|
|
7
|
+
import './game-run-watch-CEd_SpAT.js';
|
|
8
|
+
import 'node:stream';
|
|
9
|
+
import '@air-jam/sdk';
|
|
10
|
+
import '@air-jam/sdk/core';
|
|
11
|
+
|
|
12
|
+
type CaptureVisualsAtRuntimeOptions = Pick<CaptureVisualsOptions, "cwd" | "gameId" | "scenarioId" | "secure"> & {
|
|
13
|
+
mode: AirJamVisualArtifactMode;
|
|
14
|
+
urls: AirJamSurfaceUrlSummary;
|
|
15
|
+
artifactRoot: string;
|
|
16
|
+
};
|
|
17
|
+
declare const listVisualScenarios: ({ cwd, gameId, }?: ListVisualScenariosOptions) => Promise<AirJamVisualScenarioList>;
|
|
18
|
+
declare const captureVisualsAtRuntime: ({ cwd, gameId, ...runtime }: CaptureVisualsAtRuntimeOptions) => Promise<CaptureVisualsResult>;
|
|
19
|
+
declare const captureVisuals: ({ cwd, gameId, scenarioId, mode, secure, }?: CaptureVisualsOptions) => Promise<CaptureVisualsResult>;
|
|
20
|
+
|
|
21
|
+
export { AirJamVisualArtifactMode, AirJamVisualScenarioList, type CaptureVisualsAtRuntimeOptions, CaptureVisualsOptions, CaptureVisualsResult, ListVisualScenariosOptions, captureVisuals, captureVisualsAtRuntime, listVisualScenarios };
|
package/dist/visual.js
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import {
|
|
2
|
+
startDev,
|
|
3
|
+
stopDev,
|
|
4
|
+
tryAttachToRunningDev
|
|
5
|
+
} from "./chunk-MEIMOSZC.js";
|
|
6
|
+
import {
|
|
7
|
+
inspectGame,
|
|
8
|
+
pathExists,
|
|
9
|
+
readJsonFile,
|
|
10
|
+
runCommandResult
|
|
11
|
+
} from "./chunk-ART5TEYT.js";
|
|
12
|
+
import {
|
|
13
|
+
resolveDevtoolsHelperArgs,
|
|
14
|
+
resolveDevtoolsHelperScript
|
|
15
|
+
} from "./chunk-PKD4WVX5.js";
|
|
16
|
+
|
|
17
|
+
// src/visual.ts
|
|
18
|
+
import path from "path";
|
|
19
|
+
import { z } from "zod";
|
|
20
|
+
var captureUrlsSchema = z.object({
|
|
21
|
+
appOrigin: z.url(),
|
|
22
|
+
hostUrl: z.url(),
|
|
23
|
+
controllerBaseUrl: z.url(),
|
|
24
|
+
publicHost: z.url(),
|
|
25
|
+
localBuildUrl: z.url().nullable(),
|
|
26
|
+
browserBuildUrl: z.url().nullable()
|
|
27
|
+
});
|
|
28
|
+
var resolveVisualArtifactRoot = (rootDir) => path.join(rootDir, ".airjam", "artifacts", "visual");
|
|
29
|
+
var parseHelperJson = (output) => {
|
|
30
|
+
const startIndex = output.indexOf("{");
|
|
31
|
+
const endIndex = output.lastIndexOf("}");
|
|
32
|
+
if (startIndex === -1 || endIndex === -1 || endIndex < startIndex) {
|
|
33
|
+
throw new Error(`Expected JSON helper output but received:
|
|
34
|
+
${output}`);
|
|
35
|
+
}
|
|
36
|
+
return JSON.parse(output.slice(startIndex, endIndex + 1));
|
|
37
|
+
};
|
|
38
|
+
var runTsxHelper = ({
|
|
39
|
+
helperFile,
|
|
40
|
+
args,
|
|
41
|
+
cwd
|
|
42
|
+
}) => {
|
|
43
|
+
const result = runCommandResult({
|
|
44
|
+
command: process.execPath,
|
|
45
|
+
args: [...resolveDevtoolsHelperArgs(helperFile), ...args],
|
|
46
|
+
cwd
|
|
47
|
+
});
|
|
48
|
+
if (!result.ok) {
|
|
49
|
+
throw new Error(
|
|
50
|
+
`Air Jam visual helper failed.
|
|
51
|
+
|
|
52
|
+
${result.stderr || result.stdout}`
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
return parseHelperJson(result.stdout);
|
|
56
|
+
};
|
|
57
|
+
var resolveVisualSource = (game) => game.declaration.testing ? { configPath: game.configPath } : null;
|
|
58
|
+
var readScenarioMetadata = async ({
|
|
59
|
+
artifactRoot,
|
|
60
|
+
summary
|
|
61
|
+
}) => {
|
|
62
|
+
const entries = await Promise.all(
|
|
63
|
+
summary.scenarios.map(async (scenario) => {
|
|
64
|
+
const metadataPath = path.join(
|
|
65
|
+
artifactRoot,
|
|
66
|
+
scenario.relativeDir,
|
|
67
|
+
"metadata.json"
|
|
68
|
+
);
|
|
69
|
+
return await pathExists(metadataPath) ? readJsonFile(metadataPath) : null;
|
|
70
|
+
})
|
|
71
|
+
);
|
|
72
|
+
return entries.filter(
|
|
73
|
+
(entry) => entry !== null
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
var listVisualScenarios = async ({
|
|
77
|
+
cwd = process.cwd(),
|
|
78
|
+
gameId
|
|
79
|
+
} = {}) => {
|
|
80
|
+
const game = await inspectGame({ cwd, gameId });
|
|
81
|
+
const source = resolveVisualSource(game);
|
|
82
|
+
if (!source) {
|
|
83
|
+
throw new Error(
|
|
84
|
+
`No visual scenarios declared for "${game.id}" in ${game.rootDir}.`
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
const result = runTsxHelper({
|
|
88
|
+
helperFile: resolveDevtoolsHelperScript("list-visual-scenarios.ts"),
|
|
89
|
+
cwd: game.rootDir,
|
|
90
|
+
args: [`--config=${source.configPath}`]
|
|
91
|
+
});
|
|
92
|
+
if (!result.hasVisualScenarios)
|
|
93
|
+
throw new Error(`No visual scenarios declared for "${game.id}".`);
|
|
94
|
+
return {
|
|
95
|
+
gameId: result.gameId,
|
|
96
|
+
configPath: source.configPath,
|
|
97
|
+
scenarios: result.scenarios
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
var withVisualSession = async ({
|
|
101
|
+
cwd = process.cwd(),
|
|
102
|
+
gameId,
|
|
103
|
+
mode = "standalone-dev",
|
|
104
|
+
secure = false,
|
|
105
|
+
run
|
|
106
|
+
}) => {
|
|
107
|
+
const game = await inspectGame({ cwd, gameId });
|
|
108
|
+
const visualSource = resolveVisualSource(game);
|
|
109
|
+
if (!visualSource) {
|
|
110
|
+
throw new Error(
|
|
111
|
+
`No visual scenarios declared for "${game.id}" in ${game.rootDir}.`
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
const attachedTopology = await tryAttachToRunningDev({
|
|
115
|
+
cwd,
|
|
116
|
+
gameId: game.id,
|
|
117
|
+
mode,
|
|
118
|
+
secure
|
|
119
|
+
});
|
|
120
|
+
const session = attachedTopology ? {
|
|
121
|
+
topology: attachedTopology,
|
|
122
|
+
reusedExistingProcess: true,
|
|
123
|
+
managedProcessId: attachedTopology.process?.id ?? null
|
|
124
|
+
} : await startDev({ cwd, gameId: game.id, mode, secure }).then(
|
|
125
|
+
(started) => ({
|
|
126
|
+
topology: started.topology,
|
|
127
|
+
reusedExistingProcess: started.reusedExistingProcess,
|
|
128
|
+
managedProcessId: started.process.id
|
|
129
|
+
})
|
|
130
|
+
);
|
|
131
|
+
try {
|
|
132
|
+
return await run({ game, visualSource, topology: session.topology });
|
|
133
|
+
} finally {
|
|
134
|
+
if (!session.reusedExistingProcess && session.managedProcessId) {
|
|
135
|
+
await stopDev({ cwd, processId: session.managedProcessId });
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
var captureGameAtRuntime = async ({
|
|
140
|
+
game,
|
|
141
|
+
visualSource,
|
|
142
|
+
scenarioId,
|
|
143
|
+
mode,
|
|
144
|
+
secure,
|
|
145
|
+
urls,
|
|
146
|
+
artifactRoot
|
|
147
|
+
}) => {
|
|
148
|
+
const resolvedUrls = captureUrlsSchema.parse(urls);
|
|
149
|
+
runTsxHelper({
|
|
150
|
+
helperFile: resolveDevtoolsHelperScript("run-visual-capture.ts"),
|
|
151
|
+
cwd: game.rootDir,
|
|
152
|
+
args: [
|
|
153
|
+
`--game-id=${game.id}`,
|
|
154
|
+
`--config=${visualSource.configPath}`,
|
|
155
|
+
`--artifact-root=${artifactRoot}`,
|
|
156
|
+
`--mode=${mode === "arcade-built" ? "arcade-test" : "standalone-dev"}`,
|
|
157
|
+
`--app-origin=${resolvedUrls.appOrigin}`,
|
|
158
|
+
`--host-url=${resolvedUrls.hostUrl}`,
|
|
159
|
+
`--controller-base-url=${resolvedUrls.controllerBaseUrl}`,
|
|
160
|
+
`--public-host=${resolvedUrls.publicHost}`,
|
|
161
|
+
...resolvedUrls.localBuildUrl ? [`--local-build-url=${resolvedUrls.localBuildUrl}`] : [],
|
|
162
|
+
...resolvedUrls.browserBuildUrl ? [`--browser-build-url=${resolvedUrls.browserBuildUrl}`] : [],
|
|
163
|
+
...scenarioId ? [`--scenario-id=${scenarioId}`] : [],
|
|
164
|
+
...secure ? ["--secure"] : []
|
|
165
|
+
]
|
|
166
|
+
});
|
|
167
|
+
const summaryPath = path.join(artifactRoot, game.id, "capture-summary.json");
|
|
168
|
+
const summary = await readJsonFile(summaryPath);
|
|
169
|
+
return {
|
|
170
|
+
gameId: game.id,
|
|
171
|
+
artifactRoot,
|
|
172
|
+
summaryPath,
|
|
173
|
+
summary,
|
|
174
|
+
scenarios: await readScenarioMetadata({ artifactRoot, summary })
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
var captureVisualsAtRuntime = async ({
|
|
178
|
+
cwd = process.cwd(),
|
|
179
|
+
gameId,
|
|
180
|
+
...runtime
|
|
181
|
+
}) => {
|
|
182
|
+
const game = await inspectGame({ cwd, gameId });
|
|
183
|
+
const visualSource = resolveVisualSource(game);
|
|
184
|
+
if (!visualSource) {
|
|
185
|
+
throw new Error(
|
|
186
|
+
`No visual scenarios declared for "${game.id}" in ${game.rootDir}.`
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
return captureGameAtRuntime({ game, visualSource, ...runtime });
|
|
190
|
+
};
|
|
191
|
+
var captureVisuals = async ({
|
|
192
|
+
cwd = process.cwd(),
|
|
193
|
+
gameId,
|
|
194
|
+
scenarioId,
|
|
195
|
+
mode = "standalone-dev",
|
|
196
|
+
secure = false
|
|
197
|
+
} = {}) => withVisualSession({
|
|
198
|
+
cwd,
|
|
199
|
+
gameId,
|
|
200
|
+
mode,
|
|
201
|
+
secure,
|
|
202
|
+
run: ({ game, visualSource, topology }) => captureGameAtRuntime({
|
|
203
|
+
game,
|
|
204
|
+
visualSource,
|
|
205
|
+
scenarioId,
|
|
206
|
+
mode: mode === "arcade-test" ? "arcade-built" : "standalone-dev",
|
|
207
|
+
secure,
|
|
208
|
+
urls: topology.urls,
|
|
209
|
+
artifactRoot: resolveVisualArtifactRoot(
|
|
210
|
+
topology.process?.cwd ?? game.rootDir
|
|
211
|
+
)
|
|
212
|
+
})
|
|
213
|
+
});
|
|
214
|
+
export {
|
|
215
|
+
captureVisuals,
|
|
216
|
+
captureVisualsAtRuntime,
|
|
217
|
+
listVisualScenarios
|
|
218
|
+
};
|
|
219
|
+
//# sourceMappingURL=visual.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/visual.ts"],"sourcesContent":["import path from \"node:path\";\nimport { z } from \"zod\";\nimport { runCommandResult } from \"./commands.js\";\nimport {\n getTopology,\n startDev,\n stopDev,\n tryAttachToRunningDev,\n} from \"./dev.js\";\nimport { pathExists, readJsonFile } from \"./fs-utils.js\";\nimport { inspectGame } from \"./games.js\";\nimport {\n resolveDevtoolsHelperArgs,\n resolveDevtoolsHelperScript,\n} from \"./helper-scripts.js\";\nimport type {\n AirJamSurfaceUrlSummary,\n AirJamVisualArtifactMode,\n AirJamVisualCaptureInspection,\n AirJamVisualCaptureSummary,\n AirJamVisualScenarioList,\n AirJamVisualScenarioMetadata,\n CaptureVisualsOptions,\n CaptureVisualsResult,\n ListVisualScenariosOptions,\n} from \"./types.js\";\n\nexport type {\n AirJamVisualArtifactMode,\n AirJamVisualCaptureInspection,\n AirJamVisualCaptureSummary,\n AirJamVisualScenarioList,\n AirJamVisualScenarioMetadata,\n CaptureVisualsOptions,\n CaptureVisualsResult,\n ListVisualScenariosOptions,\n} from \"./types.js\";\n\ntype ResolvedVisualSource = {\n configPath: string;\n};\n\nconst captureUrlsSchema = z.object({\n appOrigin: z.url(),\n hostUrl: z.url(),\n controllerBaseUrl: z.url(),\n publicHost: z.url(),\n localBuildUrl: z.url().nullable(),\n browserBuildUrl: z.url().nullable(),\n});\n\nexport type CaptureVisualsAtRuntimeOptions = Pick<\n CaptureVisualsOptions,\n \"cwd\" | \"gameId\" | \"scenarioId\" | \"secure\"\n> & {\n mode: AirJamVisualArtifactMode;\n urls: AirJamSurfaceUrlSummary;\n artifactRoot: string;\n};\n\nconst resolveVisualArtifactRoot = (rootDir: string): string =>\n path.join(rootDir, \".airjam\", \"artifacts\", \"visual\");\n\nconst parseHelperJson = <T>(output: string): T => {\n const startIndex = output.indexOf(\"{\");\n const endIndex = output.lastIndexOf(\"}\");\n if (startIndex === -1 || endIndex === -1 || endIndex < startIndex) {\n throw new Error(`Expected JSON helper output but received:\\n${output}`);\n }\n\n return JSON.parse(output.slice(startIndex, endIndex + 1)) as T;\n};\n\nconst runTsxHelper = <T>({\n helperFile,\n args,\n cwd,\n}: {\n helperFile: string;\n args: string[];\n cwd: string;\n}): T => {\n const result = runCommandResult({\n command: process.execPath,\n args: [...resolveDevtoolsHelperArgs(helperFile), ...args],\n cwd,\n });\n if (!result.ok) {\n throw new Error(\n `Air Jam visual helper failed.\\n\\n${result.stderr || result.stdout}`,\n );\n }\n\n return parseHelperJson<T>(result.stdout);\n};\n\nconst resolveVisualSource = (\n game: Awaited<ReturnType<typeof inspectGame>>,\n): ResolvedVisualSource | null =>\n game.declaration.testing ? { configPath: game.configPath } : null;\n\nconst readScenarioMetadata = async ({\n artifactRoot,\n summary,\n}: {\n artifactRoot: string;\n summary: AirJamVisualCaptureInspection[\"summary\"];\n}): Promise<AirJamVisualScenarioMetadata[]> => {\n const entries = await Promise.all(\n summary.scenarios.map(async (scenario) => {\n const metadataPath = path.join(\n artifactRoot,\n scenario.relativeDir,\n \"metadata.json\",\n );\n return (await pathExists(metadataPath))\n ? readJsonFile<AirJamVisualScenarioMetadata>(metadataPath)\n : null;\n }),\n );\n\n return entries.filter(\n (entry): entry is AirJamVisualScenarioMetadata => entry !== null,\n );\n};\n\nexport const listVisualScenarios = async ({\n cwd = process.cwd(),\n gameId,\n}: ListVisualScenariosOptions = {}): Promise<AirJamVisualScenarioList> => {\n const game = await inspectGame({ cwd, gameId });\n const source = resolveVisualSource(game);\n if (!source) {\n throw new Error(\n `No visual scenarios declared for \"${game.id}\" in ${game.rootDir}.`,\n );\n }\n\n const result = runTsxHelper<{\n hasVisualScenarios: boolean;\n gameId: string;\n scenarios: AirJamVisualScenarioList[\"scenarios\"];\n }>({\n helperFile: resolveDevtoolsHelperScript(\"list-visual-scenarios.ts\"),\n cwd: game.rootDir,\n args: [`--config=${source.configPath}`],\n });\n if (!result.hasVisualScenarios)\n throw new Error(`No visual scenarios declared for \"${game.id}\".`);\n return {\n gameId: result.gameId,\n configPath: source.configPath,\n scenarios: result.scenarios,\n };\n};\n\nconst withVisualSession = async <T>({\n cwd = process.cwd(),\n gameId,\n mode = \"standalone-dev\",\n secure = false,\n run,\n}: {\n cwd?: string;\n gameId?: string;\n mode?: \"standalone-dev\" | \"arcade-dev\" | \"arcade-test\";\n secure?: boolean;\n run: (input: {\n game: Awaited<ReturnType<typeof inspectGame>>;\n visualSource: ResolvedVisualSource;\n topology: Awaited<ReturnType<typeof getTopology>>;\n }) => Promise<T>;\n}): Promise<T> => {\n const game = await inspectGame({ cwd, gameId });\n const visualSource = resolveVisualSource(game);\n if (!visualSource) {\n throw new Error(\n `No visual scenarios declared for \"${game.id}\" in ${game.rootDir}.`,\n );\n }\n\n const attachedTopology = await tryAttachToRunningDev({\n cwd,\n gameId: game.id,\n mode,\n secure,\n });\n const session = attachedTopology\n ? {\n topology: attachedTopology,\n reusedExistingProcess: true,\n managedProcessId: attachedTopology.process?.id ?? null,\n }\n : await startDev({ cwd, gameId: game.id, mode, secure }).then(\n (started) => ({\n topology: started.topology,\n reusedExistingProcess: started.reusedExistingProcess,\n managedProcessId: started.process.id,\n }),\n );\n\n try {\n return await run({ game, visualSource, topology: session.topology });\n } finally {\n if (!session.reusedExistingProcess && session.managedProcessId) {\n await stopDev({ cwd, processId: session.managedProcessId });\n }\n }\n};\n\nconst captureGameAtRuntime = async ({\n game,\n visualSource,\n scenarioId,\n mode,\n secure,\n urls,\n artifactRoot,\n}: Omit<CaptureVisualsAtRuntimeOptions, \"cwd\" | \"gameId\"> & {\n game: Awaited<ReturnType<typeof inspectGame>>;\n visualSource: ResolvedVisualSource;\n}): Promise<CaptureVisualsResult> => {\n const resolvedUrls = captureUrlsSchema.parse(urls);\n runTsxHelper<AirJamVisualCaptureSummary>({\n helperFile: resolveDevtoolsHelperScript(\"run-visual-capture.ts\"),\n cwd: game.rootDir,\n args: [\n `--game-id=${game.id}`,\n `--config=${visualSource.configPath}`,\n `--artifact-root=${artifactRoot}`,\n `--mode=${mode === \"arcade-built\" ? \"arcade-test\" : \"standalone-dev\"}`,\n `--app-origin=${resolvedUrls.appOrigin}`,\n `--host-url=${resolvedUrls.hostUrl}`,\n `--controller-base-url=${resolvedUrls.controllerBaseUrl}`,\n `--public-host=${resolvedUrls.publicHost}`,\n ...(resolvedUrls.localBuildUrl\n ? [`--local-build-url=${resolvedUrls.localBuildUrl}`]\n : []),\n ...(resolvedUrls.browserBuildUrl\n ? [`--browser-build-url=${resolvedUrls.browserBuildUrl}`]\n : []),\n ...(scenarioId ? [`--scenario-id=${scenarioId}`] : []),\n ...(secure ? [\"--secure\"] : []),\n ],\n });\n const summaryPath = path.join(artifactRoot, game.id, \"capture-summary.json\");\n const summary = await readJsonFile<AirJamVisualCaptureSummary>(summaryPath);\n return {\n gameId: game.id,\n artifactRoot,\n summaryPath,\n summary,\n scenarios: await readScenarioMetadata({ artifactRoot, summary }),\n };\n};\n\nexport const captureVisualsAtRuntime = async ({\n cwd = process.cwd(),\n gameId,\n ...runtime\n}: CaptureVisualsAtRuntimeOptions): Promise<CaptureVisualsResult> => {\n const game = await inspectGame({ cwd, gameId });\n const visualSource = resolveVisualSource(game);\n if (!visualSource) {\n throw new Error(\n `No visual scenarios declared for \"${game.id}\" in ${game.rootDir}.`,\n );\n }\n return captureGameAtRuntime({ game, visualSource, ...runtime });\n};\n\nexport const captureVisuals = async ({\n cwd = process.cwd(),\n gameId,\n scenarioId,\n mode = \"standalone-dev\",\n secure = false,\n}: CaptureVisualsOptions = {}): Promise<CaptureVisualsResult> =>\n withVisualSession({\n cwd,\n gameId,\n mode,\n secure,\n run: ({ game, visualSource, topology }) =>\n captureGameAtRuntime({\n game,\n visualSource,\n scenarioId,\n mode: mode === \"arcade-test\" ? \"arcade-built\" : \"standalone-dev\",\n secure,\n urls: topology.urls,\n artifactRoot: resolveVisualArtifactRoot(\n topology.process?.cwd ?? game.rootDir,\n ),\n }),\n });\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,OAAO,UAAU;AACjB,SAAS,SAAS;AAyClB,IAAM,oBAAoB,EAAE,OAAO;AAAA,EACjC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|
"name": "@air-jam/devtools",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
|
|
3
|
+
"version": "1.0.0-beta.1",
|
|
4
|
+
"engines": {
|
|
5
|
+
"node": ">=22.15.0"
|
|
6
|
+
},
|
|
7
|
+
"description": "Air Jam authoring, inspection and evaluation toolchain for CLI, MCP and Studio consumers",
|
|
8
|
+
"private": false,
|
|
9
|
+
"type": "module",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/vucinatim/air-jam.git",
|
|
14
|
+
"directory": "packages/devtools"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://github.com/vucinatim/air-jam#readme",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/vucinatim/air-jam/issues"
|
|
19
|
+
},
|
|
20
|
+
"exports": {
|
|
21
|
+
"./game-runs": {
|
|
22
|
+
"types": "./dist/game-runs.d.ts",
|
|
23
|
+
"import": "./dist/game-runs.js"
|
|
24
|
+
},
|
|
25
|
+
"./testing": {
|
|
26
|
+
"types": "./dist/testing.d.ts",
|
|
27
|
+
"import": "./dist/testing.js"
|
|
28
|
+
},
|
|
29
|
+
"./harness/visual": {
|
|
30
|
+
"types": "./dist/harness/visual.d.ts",
|
|
31
|
+
"import": "./dist/harness/visual.js"
|
|
32
|
+
},
|
|
33
|
+
"./mcp-config": {
|
|
34
|
+
"types": "./dist/mcp-config.d.ts",
|
|
35
|
+
"import": "./dist/mcp-config.js"
|
|
36
|
+
},
|
|
37
|
+
"./controller": {
|
|
38
|
+
"types": "./dist/controller.d.ts",
|
|
39
|
+
"import": "./dist/controller.js"
|
|
40
|
+
},
|
|
41
|
+
"./context": {
|
|
42
|
+
"types": "./dist/context.d.ts",
|
|
43
|
+
"import": "./dist/context.js"
|
|
44
|
+
},
|
|
45
|
+
"./dev": {
|
|
46
|
+
"types": "./dist/dev.d.ts",
|
|
47
|
+
"import": "./dist/dev.js"
|
|
48
|
+
},
|
|
49
|
+
"./game-session": {
|
|
50
|
+
"types": "./dist/game-session.d.ts",
|
|
51
|
+
"import": "./dist/game-session.js"
|
|
52
|
+
},
|
|
53
|
+
"./game-session-broker": {
|
|
54
|
+
"types": "./dist/game-session-broker.d.ts",
|
|
55
|
+
"import": "./dist/game-session-broker.js"
|
|
56
|
+
},
|
|
57
|
+
"./games": {
|
|
58
|
+
"types": "./dist/games.d.ts",
|
|
59
|
+
"import": "./dist/games.js"
|
|
60
|
+
},
|
|
61
|
+
"./logs": {
|
|
62
|
+
"types": "./dist/logs.d.ts",
|
|
63
|
+
"import": "./dist/logs.js"
|
|
64
|
+
},
|
|
65
|
+
"./platform-auth": {
|
|
66
|
+
"types": "./dist/platform-auth.d.ts",
|
|
67
|
+
"import": "./dist/platform-auth.js"
|
|
68
|
+
},
|
|
69
|
+
"./platform-game-media": {
|
|
70
|
+
"types": "./dist/platform-game-media.d.ts",
|
|
71
|
+
"import": "./dist/platform-game-media.js"
|
|
72
|
+
},
|
|
73
|
+
"./platform-games": {
|
|
74
|
+
"types": "./dist/platform-games.d.ts",
|
|
75
|
+
"import": "./dist/platform-games.js"
|
|
76
|
+
},
|
|
77
|
+
"./quality": {
|
|
78
|
+
"types": "./dist/quality.d.ts",
|
|
79
|
+
"import": "./dist/quality.js"
|
|
80
|
+
},
|
|
81
|
+
"./release": {
|
|
82
|
+
"types": "./dist/release.d.ts",
|
|
83
|
+
"import": "./dist/release.js"
|
|
84
|
+
},
|
|
85
|
+
"./rooms-check": {
|
|
86
|
+
"types": "./dist/rooms-check.d.ts",
|
|
87
|
+
"import": "./dist/rooms-check.js"
|
|
88
|
+
},
|
|
89
|
+
"./visual": {
|
|
90
|
+
"types": "./dist/visual.d.ts",
|
|
91
|
+
"import": "./dist/visual.js"
|
|
92
|
+
},
|
|
93
|
+
"./source-tree": {
|
|
94
|
+
"types": "./dist/source-tree-contract.d.ts",
|
|
95
|
+
"import": "./dist/source-tree-contract.js"
|
|
96
|
+
},
|
|
97
|
+
"./dependencies": {
|
|
98
|
+
"types": "./dist/dependencies.d.ts",
|
|
99
|
+
"import": "./dist/dependencies.js"
|
|
100
|
+
},
|
|
101
|
+
"./package.json": "./package.json",
|
|
102
|
+
"./game-builds": {
|
|
103
|
+
"types": "./dist/game-builds.d.ts",
|
|
104
|
+
"import": "./dist/game-builds.js"
|
|
105
|
+
},
|
|
106
|
+
"./platform-game-analytics": {
|
|
107
|
+
"types": "./dist/platform-game-analytics.d.ts",
|
|
108
|
+
"import": "./dist/platform-game-analytics.js"
|
|
109
|
+
},
|
|
110
|
+
"./platform-game-app-id": {
|
|
111
|
+
"types": "./dist/platform-game-app-id.d.ts",
|
|
112
|
+
"import": "./dist/platform-game-app-id.js"
|
|
113
|
+
},
|
|
114
|
+
"./game-settings": {
|
|
115
|
+
"types": "./dist/game-settings.d.ts",
|
|
116
|
+
"import": "./dist/game-settings.js"
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"files": [
|
|
120
|
+
"dist",
|
|
121
|
+
"src"
|
|
122
|
+
],
|
|
123
|
+
"dependencies": {
|
|
124
|
+
"@air-jam/sdk": "^1.0.0-beta.1",
|
|
125
|
+
"@air-jam/server": "^1.0.0-beta.1",
|
|
126
|
+
"cross-spawn": "^7.0.6",
|
|
127
|
+
"playwright-core": "^1.58.2",
|
|
128
|
+
"proper-lockfile": "4.1.2",
|
|
129
|
+
"tsx": "4.20.6",
|
|
130
|
+
"ws": "^8.18.3",
|
|
131
|
+
"yauzl": "^3.2.1",
|
|
132
|
+
"yazl": "^3.3.1",
|
|
133
|
+
"zod": "^4.2.1"
|
|
134
|
+
},
|
|
135
|
+
"devDependencies": {
|
|
136
|
+
"@types/cross-spawn": "^6.0.6",
|
|
137
|
+
"@types/node": "^24.10.1",
|
|
138
|
+
"@types/proper-lockfile": "4.1.4",
|
|
139
|
+
"@types/ws": "^8.18.1",
|
|
140
|
+
"@types/yauzl": "^2.10.3",
|
|
141
|
+
"@types/yazl": "^2.4.5",
|
|
142
|
+
"tsup": "^8.5.1",
|
|
143
|
+
"typescript": "~5.9.3",
|
|
144
|
+
"vitest": "^3.2.4"
|
|
145
|
+
},
|
|
146
|
+
"scripts": {
|
|
147
|
+
"build": "node ../../scripts/ensure-workspace-package-build.mjs @air-jam/server && tsup",
|
|
148
|
+
"test": "node ../../scripts/ensure-workspace-package-build.mjs @air-jam/server && vitest run --config vitest.config.ts",
|
|
149
|
+
"test:watch": "vitest --config vitest.config.ts",
|
|
150
|
+
"perf:sanity": "tsx scripts/perf-sanity.ts",
|
|
151
|
+
"typecheck": "node ../../scripts/ensure-workspace-package-build.mjs @air-jam/devtools && tsc --noEmit && tsc -p tests/tsconfig.json --noEmit"
|
|
152
|
+
}
|
|
6
153
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** A response body exceeded its caller's transfer budget and was cancelled. */
|
|
2
|
+
export class BodyLimitError extends Error {}
|
|
3
|
+
|
|
4
|
+
/** Read a body as UTF-8 text, cancelling it on failure or beyond `maxBytes`. */
|
|
5
|
+
export async function readBoundedText(
|
|
6
|
+
body: ReadableStream<Uint8Array>,
|
|
7
|
+
maxBytes: number,
|
|
8
|
+
) {
|
|
9
|
+
const reader = body.getReader();
|
|
10
|
+
const chunks: Uint8Array[] = [];
|
|
11
|
+
let bytes = 0;
|
|
12
|
+
try {
|
|
13
|
+
while (true) {
|
|
14
|
+
const next = await reader.read();
|
|
15
|
+
if (next.done) break;
|
|
16
|
+
bytes += next.value.byteLength;
|
|
17
|
+
if (bytes > maxBytes)
|
|
18
|
+
throw new BodyLimitError(`Response exceeded ${maxBytes} bytes.`);
|
|
19
|
+
chunks.push(next.value);
|
|
20
|
+
}
|
|
21
|
+
} catch (error) {
|
|
22
|
+
await reader.cancel().catch(() => undefined);
|
|
23
|
+
throw error;
|
|
24
|
+
} finally {
|
|
25
|
+
reader.releaseLock();
|
|
26
|
+
}
|
|
27
|
+
return Buffer.concat(chunks, bytes).toString("utf8");
|
|
28
|
+
}
|