@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,204 @@
|
|
|
1
|
+
import { a as VisualHarnessMode, b as VisualViewport, c as VisualHarnessUrls, V as VisualScenarioPack, d as VisualHarnessPageSurface, e as VisualScenarioAgent, f as VisualScenario, g as VisualCaptureSummary, h as VisualScenarioContext } from '../types-DyRD-ym1.js';
|
|
2
|
+
export { I as InferVisualScenarioSnapshot, R as RunVisualCaptureCommandOptions, m as VisualCaptureScenarioMetadata, j as VisualQuerySurface, k as VisualScenarioAgentActionDescriptor, l as VisualScenarioAgentInvocation, i as VisualScreenshotRecord } from '../types-DyRD-ym1.js';
|
|
3
|
+
import { AnyAirJamAgentContract } from '@air-jam/sdk/core';
|
|
4
|
+
export { AnyAirJamAgentContract } from '@air-jam/sdk/core';
|
|
5
|
+
import { AirJamGameInputModality } from '@air-jam/sdk/metadata';
|
|
6
|
+
import { ResolvedAirJamRuntimeTopology } from '@air-jam/sdk/runtime-topology';
|
|
7
|
+
import { Browser, Page } from 'playwright-core';
|
|
8
|
+
import '../types-CdYrgrG_.js';
|
|
9
|
+
import '@air-jam/sdk/platform-machine';
|
|
10
|
+
import 'zod';
|
|
11
|
+
import '@air-jam/sdk/agent-tooling';
|
|
12
|
+
import '../game-session-broker-CUvORfMd.js';
|
|
13
|
+
import '../game-run-watch-CEd_SpAT.js';
|
|
14
|
+
import 'node:stream';
|
|
15
|
+
import '@air-jam/sdk';
|
|
16
|
+
|
|
17
|
+
type PrefabCaptureVariants = Readonly<Record<string, string>>;
|
|
18
|
+
type PrefabCaptureRequest = {
|
|
19
|
+
prefabId: string;
|
|
20
|
+
variants: PrefabCaptureVariants;
|
|
21
|
+
mode: VisualHarnessMode;
|
|
22
|
+
};
|
|
23
|
+
type PrefabCaptureDefinition = {
|
|
24
|
+
id: string;
|
|
25
|
+
prefabId: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
viewport?: VisualViewport;
|
|
28
|
+
waitForTestId?: string;
|
|
29
|
+
buildHostUrl: (hostUrl: string, request: PrefabCaptureRequest) => string;
|
|
30
|
+
};
|
|
31
|
+
type PrefabCaptureHarness = {
|
|
32
|
+
gameId: string;
|
|
33
|
+
prefabs: readonly PrefabCaptureDefinition[];
|
|
34
|
+
};
|
|
35
|
+
declare const definePrefabCaptureHarness: <const THarness extends PrefabCaptureHarness>(harness: THarness) => THarness;
|
|
36
|
+
|
|
37
|
+
declare const loadPrefabCapture: ({ gameId, gameDirectory, prefabId, variantPairs, mode, secure, }: {
|
|
38
|
+
gameId: string;
|
|
39
|
+
gameDirectory: string;
|
|
40
|
+
prefabId: string;
|
|
41
|
+
variantPairs?: string[];
|
|
42
|
+
mode?: VisualHarnessMode;
|
|
43
|
+
secure?: boolean;
|
|
44
|
+
}) => Promise<{
|
|
45
|
+
gameId: string;
|
|
46
|
+
prefab: {
|
|
47
|
+
id: string;
|
|
48
|
+
prefabId: string;
|
|
49
|
+
buildHostUrl: (hostUrl: string, request: PrefabCaptureRequest) => string;
|
|
50
|
+
description?: string | undefined;
|
|
51
|
+
viewport?: {
|
|
52
|
+
width: number;
|
|
53
|
+
height: number;
|
|
54
|
+
} | undefined;
|
|
55
|
+
waitForTestId?: string | undefined;
|
|
56
|
+
};
|
|
57
|
+
variants: {
|
|
58
|
+
[k: string]: string;
|
|
59
|
+
};
|
|
60
|
+
artifactId: string;
|
|
61
|
+
mode: VisualHarnessMode;
|
|
62
|
+
secure: boolean;
|
|
63
|
+
}>;
|
|
64
|
+
declare const capturePrefabAtRuntime: ({ capture, hostUrl, artifactRoot, }: {
|
|
65
|
+
capture: Awaited<ReturnType<typeof loadPrefabCapture>>;
|
|
66
|
+
hostUrl: string;
|
|
67
|
+
artifactRoot: string;
|
|
68
|
+
}) => Promise<{
|
|
69
|
+
artifactDirectory: string;
|
|
70
|
+
metadataPath: string;
|
|
71
|
+
metadata: {
|
|
72
|
+
gameId: string;
|
|
73
|
+
captureId: string;
|
|
74
|
+
prefabId: string;
|
|
75
|
+
runtimeMode: VisualHarnessMode;
|
|
76
|
+
secure: boolean;
|
|
77
|
+
capturedAt: string;
|
|
78
|
+
viewport: {
|
|
79
|
+
width: number;
|
|
80
|
+
height: number;
|
|
81
|
+
};
|
|
82
|
+
variants: {
|
|
83
|
+
[k: string]: string;
|
|
84
|
+
};
|
|
85
|
+
url: string;
|
|
86
|
+
screenshot: {
|
|
87
|
+
fileName: string;
|
|
88
|
+
relativePath: string;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
}>;
|
|
92
|
+
|
|
93
|
+
type VisualAgentSessionOptions = {
|
|
94
|
+
gameId: string;
|
|
95
|
+
scenarioId: string;
|
|
96
|
+
host: VisualHarnessPageSurface;
|
|
97
|
+
urls: VisualHarnessUrls;
|
|
98
|
+
mode: VisualHarnessMode;
|
|
99
|
+
secure: boolean;
|
|
100
|
+
};
|
|
101
|
+
type VisualHarnessStackHandle = {
|
|
102
|
+
urls: Omit<VisualHarnessUrls, "controllerJoinUrl">;
|
|
103
|
+
shutdown: () => Promise<void> | void;
|
|
104
|
+
};
|
|
105
|
+
type RunVisualHarnessOptions = {
|
|
106
|
+
gameId: string;
|
|
107
|
+
scenarioId?: string | null;
|
|
108
|
+
mode?: VisualHarnessMode;
|
|
109
|
+
secure?: boolean;
|
|
110
|
+
artifactRoot: string;
|
|
111
|
+
loadScenarioPack: (gameId: string) => Promise<VisualScenarioPack<AnyAirJamAgentContract>>;
|
|
112
|
+
startStack: (options: {
|
|
113
|
+
gameId: string;
|
|
114
|
+
mode: VisualHarnessMode;
|
|
115
|
+
secure: boolean;
|
|
116
|
+
}) => Promise<VisualHarnessStackHandle>;
|
|
117
|
+
createAgentSession?: (options: VisualAgentSessionOptions) => Promise<VisualScenarioAgent<Record<string, unknown>>>;
|
|
118
|
+
onScenarioStart?: (scenario: VisualScenario<AnyAirJamAgentContract>) => void;
|
|
119
|
+
onCaptureStart?: (info: {
|
|
120
|
+
gameId: string;
|
|
121
|
+
mode: VisualHarnessMode;
|
|
122
|
+
scenarioCount: number;
|
|
123
|
+
}) => void;
|
|
124
|
+
onComplete?: (summary: VisualCaptureSummary) => void;
|
|
125
|
+
};
|
|
126
|
+
declare const runVisualHarness: ({ gameId, scenarioId, mode, secure, artifactRoot, loadScenarioPack, startStack, createAgentSession, onScenarioStart, onCaptureStart, onComplete, }: RunVisualHarnessOptions) => Promise<VisualCaptureSummary>;
|
|
127
|
+
|
|
128
|
+
declare const defineVisualScenarios: <TAgent extends AnyAirJamAgentContract>(pack: {
|
|
129
|
+
scenarios: ReadonlyArray<VisualScenario<TAgent>>;
|
|
130
|
+
}) => VisualScenarioPack<TAgent>;
|
|
131
|
+
|
|
132
|
+
declare const STANDARD_HOST_VIEWPORTS: readonly [["mac-desktop", {
|
|
133
|
+
readonly width: 3016;
|
|
134
|
+
readonly height: 1504;
|
|
135
|
+
}], ["desktop", {
|
|
136
|
+
readonly width: 1440;
|
|
137
|
+
readonly height: 1024;
|
|
138
|
+
}], ["tablet", {
|
|
139
|
+
readonly width: 1024;
|
|
140
|
+
readonly height: 1180;
|
|
141
|
+
}]];
|
|
142
|
+
declare const STANDARD_CONTROLLER_VIEWPORTS: readonly [["mobile", {
|
|
143
|
+
readonly width: 390;
|
|
144
|
+
readonly height: 844;
|
|
145
|
+
}], ["small-mobile", {
|
|
146
|
+
readonly width: 360;
|
|
147
|
+
readonly height: 640;
|
|
148
|
+
}]];
|
|
149
|
+
declare const STANDARD_CONTROLLER_LANDSCAPE_VIEWPORTS: readonly [["mobile", {
|
|
150
|
+
readonly width: 844;
|
|
151
|
+
readonly height: 390;
|
|
152
|
+
}], ["small-mobile", {
|
|
153
|
+
readonly width: 640;
|
|
154
|
+
readonly height: 360;
|
|
155
|
+
}]];
|
|
156
|
+
declare const captureStandardSurfaces: (context: VisualScenarioContext, options?: {
|
|
157
|
+
controllerOrientation?: "portrait" | "landscape";
|
|
158
|
+
}) => Promise<void>;
|
|
159
|
+
declare const waitForHostText: (context: VisualScenarioContext, text: string | RegExp, timeout?: number) => Promise<void>;
|
|
160
|
+
declare const waitForControllerText: (context: VisualScenarioContext, text: string | RegExp, timeout?: number) => Promise<void>;
|
|
161
|
+
|
|
162
|
+
declare const launchHarnessBrowser: () => Promise<Browser>;
|
|
163
|
+
|
|
164
|
+
declare const DEFAULT_HOST_VIEWPORT: VisualViewport;
|
|
165
|
+
declare const DEFAULT_CONTROLLER_VIEWPORT: VisualViewport;
|
|
166
|
+
declare const dismissHarnessControllerFullscreenPrompt: (page: Page) => Promise<boolean>;
|
|
167
|
+
declare function bindHarnessControllerUrl(resolvedJoinUrl: string, controllerBaseUrl: string): string;
|
|
168
|
+
type OpenVisualHarnessSessionOptions = {
|
|
169
|
+
browser: Browser;
|
|
170
|
+
inputModalities?: readonly AirJamGameInputModality[];
|
|
171
|
+
runtimeTopology?: ResolvedAirJamRuntimeTopology;
|
|
172
|
+
onDiagnostic?: (message: string) => void;
|
|
173
|
+
urls: Omit<VisualHarnessUrls, "controllerJoinUrl">;
|
|
174
|
+
mode: VisualHarnessMode;
|
|
175
|
+
};
|
|
176
|
+
type OpenVisualHarnessHostSessionResult = {
|
|
177
|
+
urls: Omit<VisualHarnessUrls, "controllerJoinUrl"> & {
|
|
178
|
+
controllerJoinUrl: null;
|
|
179
|
+
};
|
|
180
|
+
host: VisualHarnessPageSurface;
|
|
181
|
+
close: () => Promise<void>;
|
|
182
|
+
};
|
|
183
|
+
type OpenVisualHarnessControllerSessionResult = {
|
|
184
|
+
urls: VisualHarnessUrls;
|
|
185
|
+
controller: VisualHarnessPageSurface & {
|
|
186
|
+
fullscreenPromptDismissed: boolean;
|
|
187
|
+
};
|
|
188
|
+
close: () => Promise<void>;
|
|
189
|
+
};
|
|
190
|
+
type OpenVisualHarnessSessionResult = {
|
|
191
|
+
urls: VisualHarnessUrls;
|
|
192
|
+
host: VisualHarnessPageSurface;
|
|
193
|
+
controller: VisualHarnessPageSurface & {
|
|
194
|
+
fullscreenPromptDismissed: boolean;
|
|
195
|
+
};
|
|
196
|
+
close: () => Promise<void>;
|
|
197
|
+
};
|
|
198
|
+
declare const openVisualHarnessHostSession: ({ browser, runtimeTopology, onDiagnostic, urls, mode, }: OpenVisualHarnessSessionOptions) => Promise<OpenVisualHarnessHostSessionResult>;
|
|
199
|
+
declare const openVisualHarnessControllerSession: ({ browser, inputModalities, runtimeTopology, urls, host, }: Omit<OpenVisualHarnessSessionOptions, "mode"> & {
|
|
200
|
+
host: VisualHarnessPageSurface;
|
|
201
|
+
}) => Promise<OpenVisualHarnessControllerSessionResult>;
|
|
202
|
+
declare const openVisualHarnessSession: ({ browser, inputModalities, runtimeTopology, onDiagnostic, urls, mode, }: OpenVisualHarnessSessionOptions) => Promise<OpenVisualHarnessSessionResult>;
|
|
203
|
+
|
|
204
|
+
export { DEFAULT_CONTROLLER_VIEWPORT, DEFAULT_HOST_VIEWPORT, type OpenVisualHarnessControllerSessionResult, type OpenVisualHarnessHostSessionResult, type OpenVisualHarnessSessionOptions, type OpenVisualHarnessSessionResult, type PrefabCaptureDefinition, type PrefabCaptureHarness, type PrefabCaptureRequest, type PrefabCaptureVariants, type RunVisualHarnessOptions, STANDARD_CONTROLLER_LANDSCAPE_VIEWPORTS, STANDARD_CONTROLLER_VIEWPORTS, STANDARD_HOST_VIEWPORTS, VisualCaptureSummary, VisualHarnessMode, VisualHarnessPageSurface, type VisualHarnessStackHandle, VisualHarnessUrls, VisualScenario, VisualScenarioAgent, VisualScenarioContext, VisualScenarioPack, VisualViewport, bindHarnessControllerUrl, capturePrefabAtRuntime, captureStandardSurfaces, definePrefabCaptureHarness, defineVisualScenarios, dismissHarnessControllerFullscreenPrompt, launchHarnessBrowser, loadPrefabCapture, openVisualHarnessControllerSession, openVisualHarnessHostSession, openVisualHarnessSession, runVisualHarness, waitForControllerText, waitForHostText };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_CONTROLLER_VIEWPORT,
|
|
3
|
+
DEFAULT_HOST_VIEWPORT,
|
|
4
|
+
STANDARD_CONTROLLER_LANDSCAPE_VIEWPORTS,
|
|
5
|
+
STANDARD_CONTROLLER_VIEWPORTS,
|
|
6
|
+
STANDARD_HOST_VIEWPORTS,
|
|
7
|
+
bindHarnessControllerUrl,
|
|
8
|
+
capturePrefabAtRuntime,
|
|
9
|
+
captureStandardSurfaces,
|
|
10
|
+
definePrefabCaptureHarness,
|
|
11
|
+
defineVisualScenarios,
|
|
12
|
+
dismissHarnessControllerFullscreenPrompt,
|
|
13
|
+
launchHarnessBrowser,
|
|
14
|
+
loadPrefabCapture,
|
|
15
|
+
openVisualHarnessControllerSession,
|
|
16
|
+
openVisualHarnessHostSession,
|
|
17
|
+
openVisualHarnessSession,
|
|
18
|
+
runVisualHarness,
|
|
19
|
+
waitForControllerText,
|
|
20
|
+
waitForHostText
|
|
21
|
+
} from "../chunk-O3XG3FNL.js";
|
|
22
|
+
import "../chunk-SPYN66UV.js";
|
|
23
|
+
import "../chunk-ART5TEYT.js";
|
|
24
|
+
import "../chunk-PKD4WVX5.js";
|
|
25
|
+
export {
|
|
26
|
+
DEFAULT_CONTROLLER_VIEWPORT,
|
|
27
|
+
DEFAULT_HOST_VIEWPORT,
|
|
28
|
+
STANDARD_CONTROLLER_LANDSCAPE_VIEWPORTS,
|
|
29
|
+
STANDARD_CONTROLLER_VIEWPORTS,
|
|
30
|
+
STANDARD_HOST_VIEWPORTS,
|
|
31
|
+
bindHarnessControllerUrl,
|
|
32
|
+
capturePrefabAtRuntime,
|
|
33
|
+
captureStandardSurfaces,
|
|
34
|
+
definePrefabCaptureHarness,
|
|
35
|
+
defineVisualScenarios,
|
|
36
|
+
dismissHarnessControllerFullscreenPrompt,
|
|
37
|
+
launchHarnessBrowser,
|
|
38
|
+
loadPrefabCapture,
|
|
39
|
+
openVisualHarnessControllerSession,
|
|
40
|
+
openVisualHarnessHostSession,
|
|
41
|
+
openVisualHarnessSession,
|
|
42
|
+
runVisualHarness,
|
|
43
|
+
waitForControllerText,
|
|
44
|
+
waitForHostText
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=visual.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/logs.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { E as ReadDevLogsOptions, F as CommandResult } from './types-CdYrgrG_.js';
|
|
2
|
+
import '@air-jam/sdk/platform-machine';
|
|
3
|
+
import 'zod';
|
|
4
|
+
import '@air-jam/sdk/agent-tooling';
|
|
5
|
+
import './game-session-broker-CUvORfMd.js';
|
|
6
|
+
import './game-run-watch-CEd_SpAT.js';
|
|
7
|
+
import 'node:stream';
|
|
8
|
+
import '@air-jam/sdk';
|
|
9
|
+
import '@air-jam/sdk/core';
|
|
10
|
+
|
|
11
|
+
declare const readDevLogs: (options?: ReadDevLogsOptions) => Promise<CommandResult & {
|
|
12
|
+
lines: string[];
|
|
13
|
+
}>;
|
|
14
|
+
|
|
15
|
+
export { CommandResult, ReadDevLogsOptions, readDevLogs };
|
package/dist/logs.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {
|
|
2
|
+
detectProjectContext,
|
|
3
|
+
runCommandResult
|
|
4
|
+
} from "./chunk-ART5TEYT.js";
|
|
5
|
+
import "./chunk-PKD4WVX5.js";
|
|
6
|
+
|
|
7
|
+
// src/logs.ts
|
|
8
|
+
var pushOption = (args, name, value) => {
|
|
9
|
+
if (value !== void 0 && value !== "") {
|
|
10
|
+
args.push(`--${name}=${String(value)}`);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
var readDevLogs = async (options = {}) => {
|
|
14
|
+
const context = await detectProjectContext({ cwd: options.cwd });
|
|
15
|
+
const args = ["exec", "air-jam-server", "logs"];
|
|
16
|
+
pushOption(args, "view", options.view ?? "signal");
|
|
17
|
+
pushOption(args, "source", options.source);
|
|
18
|
+
pushOption(args, "trace", options.trace);
|
|
19
|
+
pushOption(args, "room", options.room);
|
|
20
|
+
pushOption(args, "controller", options.controller);
|
|
21
|
+
pushOption(args, "event", options.event);
|
|
22
|
+
pushOption(args, "process", options.process);
|
|
23
|
+
pushOption(args, "level", options.level);
|
|
24
|
+
pushOption(args, "runtime", options.runtime);
|
|
25
|
+
pushOption(args, "epoch", options.epoch);
|
|
26
|
+
pushOption(args, "console-category", options.consoleCategory);
|
|
27
|
+
pushOption(args, "file", options.file);
|
|
28
|
+
const result = runCommandResult({
|
|
29
|
+
command: "pnpm",
|
|
30
|
+
args,
|
|
31
|
+
cwd: context.rootDir
|
|
32
|
+
});
|
|
33
|
+
const missingLogMessage = `${result.stderr}
|
|
34
|
+
${result.stdout}`;
|
|
35
|
+
if (!result.ok && /Dev log file not found:/i.test(missingLogMessage)) {
|
|
36
|
+
const message = "Air Jam dev logs are not ready yet. Start local dev with `pnpm run dev`, then retry logs after the server creates `.airjam/logs/dev-latest.ndjson`.";
|
|
37
|
+
return {
|
|
38
|
+
...result,
|
|
39
|
+
exitCode: 0,
|
|
40
|
+
ok: true,
|
|
41
|
+
stdout: message,
|
|
42
|
+
stderr: "",
|
|
43
|
+
lines: [message]
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const allLines = result.stdout.split(/\r?\n/).filter(Boolean);
|
|
47
|
+
const lines = typeof options.tail === "number" && options.tail >= 0 ? allLines.slice(-options.tail) : allLines;
|
|
48
|
+
return {
|
|
49
|
+
...result,
|
|
50
|
+
stdout: lines.join("\n"),
|
|
51
|
+
lines
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export {
|
|
55
|
+
readDevLogs
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=logs.js.map
|
package/dist/logs.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/logs.ts"],"sourcesContent":["import { runCommandResult } from \"./commands.js\";\nimport { detectProjectContext } from \"./context.js\";\nimport type { CommandResult, ReadDevLogsOptions } from \"./types.js\";\n\nexport type { CommandResult, ReadDevLogsOptions } from \"./types.js\";\n\nconst pushOption = (\n args: string[],\n name: string,\n value: string | number | undefined,\n): void => {\n if (value !== undefined && value !== \"\") {\n args.push(`--${name}=${String(value)}`);\n }\n};\n\nexport const readDevLogs = async (\n options: ReadDevLogsOptions = {},\n): Promise<CommandResult & { lines: string[] }> => {\n const context = await detectProjectContext({ cwd: options.cwd });\n const args = [\"exec\", \"air-jam-server\", \"logs\"];\n\n pushOption(args, \"view\", options.view ?? \"signal\");\n pushOption(args, \"source\", options.source);\n pushOption(args, \"trace\", options.trace);\n pushOption(args, \"room\", options.room);\n pushOption(args, \"controller\", options.controller);\n pushOption(args, \"event\", options.event);\n pushOption(args, \"process\", options.process);\n pushOption(args, \"level\", options.level);\n pushOption(args, \"runtime\", options.runtime);\n pushOption(args, \"epoch\", options.epoch);\n pushOption(args, \"console-category\", options.consoleCategory);\n pushOption(args, \"file\", options.file);\n\n const result = runCommandResult({\n command: \"pnpm\",\n args,\n cwd: context.rootDir,\n });\n\n const missingLogMessage = `${result.stderr}\\n${result.stdout}`;\n if (!result.ok && /Dev log file not found:/i.test(missingLogMessage)) {\n const message =\n \"Air Jam dev logs are not ready yet. Start local dev with `pnpm run dev`, then retry logs after the server creates `.airjam/logs/dev-latest.ndjson`.\";\n return {\n ...result,\n exitCode: 0,\n ok: true,\n stdout: message,\n stderr: \"\",\n lines: [message],\n };\n }\n\n const allLines = result.stdout.split(/\\r?\\n/).filter(Boolean);\n const lines =\n typeof options.tail === \"number\" && options.tail >= 0\n ? allLines.slice(-options.tail)\n : allLines;\n\n return {\n ...result,\n stdout: lines.join(\"\\n\"),\n lines,\n };\n};\n"],"mappings":";;;;;;;AAMA,IAAM,aAAa,CACjB,MACA,MACA,UACS;AACT,MAAI,UAAU,UAAa,UAAU,IAAI;AACvC,SAAK,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,CAAC,EAAE;AAAA,EACxC;AACF;AAEO,IAAM,cAAc,OACzB,UAA8B,CAAC,MACkB;AACjD,QAAM,UAAU,MAAM,qBAAqB,EAAE,KAAK,QAAQ,IAAI,CAAC;AAC/D,QAAM,OAAO,CAAC,QAAQ,kBAAkB,MAAM;AAE9C,aAAW,MAAM,QAAQ,QAAQ,QAAQ,QAAQ;AACjD,aAAW,MAAM,UAAU,QAAQ,MAAM;AACzC,aAAW,MAAM,SAAS,QAAQ,KAAK;AACvC,aAAW,MAAM,QAAQ,QAAQ,IAAI;AACrC,aAAW,MAAM,cAAc,QAAQ,UAAU;AACjD,aAAW,MAAM,SAAS,QAAQ,KAAK;AACvC,aAAW,MAAM,WAAW,QAAQ,OAAO;AAC3C,aAAW,MAAM,SAAS,QAAQ,KAAK;AACvC,aAAW,MAAM,WAAW,QAAQ,OAAO;AAC3C,aAAW,MAAM,SAAS,QAAQ,KAAK;AACvC,aAAW,MAAM,oBAAoB,QAAQ,eAAe;AAC5D,aAAW,MAAM,QAAQ,QAAQ,IAAI;AAErC,QAAM,SAAS,iBAAiB;AAAA,IAC9B,SAAS;AAAA,IACT;AAAA,IACA,KAAK,QAAQ;AAAA,EACf,CAAC;AAED,QAAM,oBAAoB,GAAG,OAAO,MAAM;AAAA,EAAK,OAAO,MAAM;AAC5D,MAAI,CAAC,OAAO,MAAM,2BAA2B,KAAK,iBAAiB,GAAG;AACpE,UAAM,UACJ;AACF,WAAO;AAAA,MACL,GAAG;AAAA,MACH,UAAU;AAAA,MACV,IAAI;AAAA,MACJ,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,OAAO,CAAC,OAAO;AAAA,IACjB;AAAA,EACF;AAEA,QAAM,WAAW,OAAO,OAAO,MAAM,OAAO,EAAE,OAAO,OAAO;AAC5D,QAAM,QACJ,OAAO,QAAQ,SAAS,YAAY,QAAQ,QAAQ,IAChD,SAAS,MAAM,CAAC,QAAQ,IAAI,IAC5B;AAEN,SAAO;AAAA,IACL,GAAG;AAAA,IACH,QAAQ,MAAM,KAAK,IAAI;AAAA,IACvB;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
type AirJamMcpServerDeclaration = {
|
|
2
|
+
name: "airjam";
|
|
3
|
+
transport: "stdio";
|
|
4
|
+
command: "pnpm";
|
|
5
|
+
args: ["exec", "airjam-mcp"];
|
|
6
|
+
};
|
|
7
|
+
type AirJamProjectLocalMcpConfig = {
|
|
8
|
+
mcpServers: {
|
|
9
|
+
airjam: {
|
|
10
|
+
command: string;
|
|
11
|
+
args: string[];
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
type AirJamMcpClientProfile = "portable" | "codex" | "claude-desktop";
|
|
16
|
+
type AirJamMcpClientProfileRender = {
|
|
17
|
+
profile: AirJamMcpClientProfile;
|
|
18
|
+
format: "json" | "toml";
|
|
19
|
+
scope: "project" | "client-global";
|
|
20
|
+
configPath: string | null;
|
|
21
|
+
content: string;
|
|
22
|
+
installCommand: string | null;
|
|
23
|
+
};
|
|
24
|
+
type AirJamMcpRegistrationInspection = {
|
|
25
|
+
profile: AirJamMcpClientProfile;
|
|
26
|
+
configPath: string | null;
|
|
27
|
+
configPresent: boolean | null;
|
|
28
|
+
registered: boolean | null;
|
|
29
|
+
};
|
|
30
|
+
type InspectMcpProjectSetupResult = {
|
|
31
|
+
projectDir: string;
|
|
32
|
+
server: AirJamMcpServerDeclaration;
|
|
33
|
+
package: {
|
|
34
|
+
dependencyPresent: boolean;
|
|
35
|
+
scriptPresent: boolean;
|
|
36
|
+
};
|
|
37
|
+
portableDeclaration: {
|
|
38
|
+
configPath: string;
|
|
39
|
+
present: boolean;
|
|
40
|
+
};
|
|
41
|
+
clients: {
|
|
42
|
+
codex: AirJamMcpRegistrationInspection;
|
|
43
|
+
claudeDesktop: AirJamMcpRegistrationInspection;
|
|
44
|
+
};
|
|
45
|
+
recommendedConfig: AirJamProjectLocalMcpConfig;
|
|
46
|
+
};
|
|
47
|
+
declare const AIRJAM_PROJECT_MCP_FILE = ".mcp.json";
|
|
48
|
+
declare const AIRJAM_CODEX_PROJECT_MCP_FILE: string;
|
|
49
|
+
declare const createAirJamMcpServerDeclaration: () => AirJamMcpServerDeclaration;
|
|
50
|
+
declare const createProjectLocalMcpConfig: () => AirJamProjectLocalMcpConfig;
|
|
51
|
+
declare const renderMcpClientProfile: ({ profile, projectDir, }: {
|
|
52
|
+
profile: AirJamMcpClientProfile;
|
|
53
|
+
projectDir?: string;
|
|
54
|
+
}) => AirJamMcpClientProfileRender;
|
|
55
|
+
declare const inspectMcpProjectSetup: ({ cwd, }?: {
|
|
56
|
+
cwd?: string;
|
|
57
|
+
}) => Promise<InspectMcpProjectSetupResult>;
|
|
58
|
+
declare const writeProjectLocalMcpConfig: ({ cwd, force, }?: {
|
|
59
|
+
cwd?: string;
|
|
60
|
+
force?: boolean;
|
|
61
|
+
}) => Promise<InspectMcpProjectSetupResult>;
|
|
62
|
+
|
|
63
|
+
export { AIRJAM_CODEX_PROJECT_MCP_FILE, AIRJAM_PROJECT_MCP_FILE, type AirJamMcpClientProfile, type AirJamMcpClientProfileRender, type AirJamMcpRegistrationInspection, type AirJamMcpServerDeclaration, type AirJamProjectLocalMcpConfig, type InspectMcpProjectSetupResult, createAirJamMcpServerDeclaration, createProjectLocalMcpConfig, inspectMcpProjectSetup, renderMcpClientProfile, writeProjectLocalMcpConfig };
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import {
|
|
2
|
+
inspectProject
|
|
3
|
+
} from "./chunk-ART5TEYT.js";
|
|
4
|
+
import "./chunk-PKD4WVX5.js";
|
|
5
|
+
|
|
6
|
+
// src/mcp-config.ts
|
|
7
|
+
import { access, mkdir, readFile, writeFile } from "fs/promises";
|
|
8
|
+
import os from "os";
|
|
9
|
+
import path from "path";
|
|
10
|
+
var AIRJAM_PROJECT_MCP_FILE = ".mcp.json";
|
|
11
|
+
var AIRJAM_CODEX_PROJECT_MCP_FILE = path.join(".codex", "config.toml");
|
|
12
|
+
var createAirJamMcpServerDeclaration = () => ({
|
|
13
|
+
name: "airjam",
|
|
14
|
+
transport: "stdio",
|
|
15
|
+
command: "pnpm",
|
|
16
|
+
args: ["exec", "airjam-mcp"]
|
|
17
|
+
});
|
|
18
|
+
var createProjectLocalMcpConfig = () => {
|
|
19
|
+
const server = createAirJamMcpServerDeclaration();
|
|
20
|
+
return {
|
|
21
|
+
mcpServers: {
|
|
22
|
+
airjam: {
|
|
23
|
+
command: server.command,
|
|
24
|
+
args: [...server.args]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
var pathExists = async (targetPath) => {
|
|
30
|
+
try {
|
|
31
|
+
await access(targetPath);
|
|
32
|
+
return true;
|
|
33
|
+
} catch {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var resolveClaudeDesktopConfigPath = () => {
|
|
38
|
+
if (process.platform === "darwin") {
|
|
39
|
+
return path.join(
|
|
40
|
+
os.homedir(),
|
|
41
|
+
"Library",
|
|
42
|
+
"Application Support",
|
|
43
|
+
"Claude",
|
|
44
|
+
"claude_desktop_config.json"
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
if (process.platform === "win32") {
|
|
48
|
+
const appData = process.env.APPDATA;
|
|
49
|
+
return appData ? path.join(appData, "Claude", "claude_desktop_config.json") : null;
|
|
50
|
+
}
|
|
51
|
+
return path.join(
|
|
52
|
+
os.homedir(),
|
|
53
|
+
".config",
|
|
54
|
+
"Claude",
|
|
55
|
+
"claude_desktop_config.json"
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
var inspectJsonRegistration = async (profile, configPath) => {
|
|
59
|
+
if (!configPath) {
|
|
60
|
+
return { profile, configPath, configPresent: null, registered: null };
|
|
61
|
+
}
|
|
62
|
+
if (!await pathExists(configPath)) {
|
|
63
|
+
return { profile, configPath, configPresent: false, registered: false };
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
const parsed = JSON.parse(await readFile(configPath, "utf8"));
|
|
67
|
+
return {
|
|
68
|
+
profile,
|
|
69
|
+
configPath,
|
|
70
|
+
configPresent: true,
|
|
71
|
+
registered: Boolean(parsed.mcpServers?.airjam)
|
|
72
|
+
};
|
|
73
|
+
} catch {
|
|
74
|
+
return { profile, configPath, configPresent: true, registered: false };
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
var inspectCodexRegistration = async (projectDir) => {
|
|
78
|
+
const configPath = path.join(projectDir, AIRJAM_CODEX_PROJECT_MCP_FILE);
|
|
79
|
+
if (!await pathExists(configPath)) {
|
|
80
|
+
return {
|
|
81
|
+
profile: "codex",
|
|
82
|
+
configPath,
|
|
83
|
+
configPresent: false,
|
|
84
|
+
registered: false
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
const source = await readFile(configPath, "utf8");
|
|
88
|
+
return {
|
|
89
|
+
profile: "codex",
|
|
90
|
+
configPath,
|
|
91
|
+
configPresent: true,
|
|
92
|
+
registered: /^\s*\[mcp_servers\.airjam\]\s*$/m.test(source)
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
var renderMcpClientProfile = ({
|
|
96
|
+
profile,
|
|
97
|
+
projectDir = process.cwd()
|
|
98
|
+
}) => {
|
|
99
|
+
const server = createAirJamMcpServerDeclaration();
|
|
100
|
+
if (profile === "codex") {
|
|
101
|
+
const escapedCwd = projectDir.replaceAll("\\", "\\\\").replaceAll('"', '\\"');
|
|
102
|
+
return {
|
|
103
|
+
profile,
|
|
104
|
+
format: "toml",
|
|
105
|
+
scope: "project",
|
|
106
|
+
configPath: path.join(projectDir, AIRJAM_CODEX_PROJECT_MCP_FILE),
|
|
107
|
+
content: `[mcp_servers.airjam]
|
|
108
|
+
command = "${server.command}"
|
|
109
|
+
args = ["exec", "airjam-mcp"]
|
|
110
|
+
cwd = "${escapedCwd}"
|
|
111
|
+
`,
|
|
112
|
+
installCommand: `codex mcp add airjam -- ${server.command} ${server.args.join(" ")}`
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
const config = createProjectLocalMcpConfig();
|
|
116
|
+
if (profile === "claude-desktop") {
|
|
117
|
+
config.mcpServers.airjam.args = [
|
|
118
|
+
"--dir",
|
|
119
|
+
path.resolve(projectDir),
|
|
120
|
+
...server.args
|
|
121
|
+
];
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
profile,
|
|
125
|
+
format: "json",
|
|
126
|
+
scope: profile === "portable" ? "project" : "client-global",
|
|
127
|
+
configPath: profile === "portable" ? path.join(projectDir, AIRJAM_PROJECT_MCP_FILE) : resolveClaudeDesktopConfigPath(),
|
|
128
|
+
content: `${JSON.stringify(config, null, 2)}
|
|
129
|
+
`,
|
|
130
|
+
installCommand: null
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
var inspectMcpProjectSetup = async ({
|
|
134
|
+
cwd = process.cwd()
|
|
135
|
+
} = {}) => {
|
|
136
|
+
const project = await inspectProject({ cwd });
|
|
137
|
+
const projectDir = project.context.rootDir;
|
|
138
|
+
const configPath = path.join(projectDir, AIRJAM_PROJECT_MCP_FILE);
|
|
139
|
+
return {
|
|
140
|
+
projectDir,
|
|
141
|
+
server: createAirJamMcpServerDeclaration(),
|
|
142
|
+
package: {
|
|
143
|
+
dependencyPresent: Boolean(project.airJamPackages["@air-jam/mcp-server"]),
|
|
144
|
+
scriptPresent: Boolean(project.scripts.mcp)
|
|
145
|
+
},
|
|
146
|
+
portableDeclaration: {
|
|
147
|
+
configPath,
|
|
148
|
+
present: await pathExists(configPath)
|
|
149
|
+
},
|
|
150
|
+
clients: {
|
|
151
|
+
codex: await inspectCodexRegistration(projectDir),
|
|
152
|
+
claudeDesktop: await inspectJsonRegistration(
|
|
153
|
+
"claude-desktop",
|
|
154
|
+
resolveClaudeDesktopConfigPath()
|
|
155
|
+
)
|
|
156
|
+
},
|
|
157
|
+
recommendedConfig: createProjectLocalMcpConfig()
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
var writeProjectLocalMcpConfig = async ({
|
|
161
|
+
cwd = process.cwd(),
|
|
162
|
+
force = false
|
|
163
|
+
} = {}) => {
|
|
164
|
+
const inspection = await inspectMcpProjectSetup({ cwd });
|
|
165
|
+
const configPath = inspection.portableDeclaration.configPath;
|
|
166
|
+
if (inspection.portableDeclaration.present && !force) {
|
|
167
|
+
throw new Error(
|
|
168
|
+
`MCP declaration already exists at ${configPath}. Re-run with force to overwrite it.`
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
await mkdir(path.dirname(configPath), { recursive: true });
|
|
172
|
+
await writeFile(
|
|
173
|
+
configPath,
|
|
174
|
+
renderMcpClientProfile({
|
|
175
|
+
profile: "portable",
|
|
176
|
+
projectDir: inspection.projectDir
|
|
177
|
+
}).content,
|
|
178
|
+
"utf8"
|
|
179
|
+
);
|
|
180
|
+
return inspectMcpProjectSetup({ cwd });
|
|
181
|
+
};
|
|
182
|
+
export {
|
|
183
|
+
AIRJAM_CODEX_PROJECT_MCP_FILE,
|
|
184
|
+
AIRJAM_PROJECT_MCP_FILE,
|
|
185
|
+
createAirJamMcpServerDeclaration,
|
|
186
|
+
createProjectLocalMcpConfig,
|
|
187
|
+
inspectMcpProjectSetup,
|
|
188
|
+
renderMcpClientProfile,
|
|
189
|
+
writeProjectLocalMcpConfig
|
|
190
|
+
};
|
|
191
|
+
//# sourceMappingURL=mcp-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/mcp-config.ts"],"sourcesContent":["import { access, mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport { inspectProject } from \"./context.js\";\nexport type AirJamMcpServerDeclaration = {\n name: \"airjam\";\n transport: \"stdio\";\n command: \"pnpm\";\n args: [\"exec\", \"airjam-mcp\"];\n};\n\nexport type AirJamProjectLocalMcpConfig = {\n mcpServers: {\n airjam: {\n command: string;\n args: string[];\n };\n };\n};\n\nexport type AirJamMcpClientProfile = \"portable\" | \"codex\" | \"claude-desktop\";\n\nexport type AirJamMcpClientProfileRender = {\n profile: AirJamMcpClientProfile;\n format: \"json\" | \"toml\";\n scope: \"project\" | \"client-global\";\n configPath: string | null;\n content: string;\n installCommand: string | null;\n};\n\nexport type AirJamMcpRegistrationInspection = {\n profile: AirJamMcpClientProfile;\n configPath: string | null;\n configPresent: boolean | null;\n registered: boolean | null;\n};\n\nexport type InspectMcpProjectSetupResult = {\n projectDir: string;\n server: AirJamMcpServerDeclaration;\n package: {\n dependencyPresent: boolean;\n scriptPresent: boolean;\n };\n portableDeclaration: {\n configPath: string;\n present: boolean;\n };\n clients: {\n codex: AirJamMcpRegistrationInspection;\n claudeDesktop: AirJamMcpRegistrationInspection;\n };\n recommendedConfig: AirJamProjectLocalMcpConfig;\n};\n\nexport const AIRJAM_PROJECT_MCP_FILE = \".mcp.json\";\nexport const AIRJAM_CODEX_PROJECT_MCP_FILE = path.join(\".codex\", \"config.toml\");\n\nexport const createAirJamMcpServerDeclaration =\n (): AirJamMcpServerDeclaration => ({\n name: \"airjam\",\n transport: \"stdio\",\n command: \"pnpm\",\n args: [\"exec\", \"airjam-mcp\"],\n });\n\nexport const createProjectLocalMcpConfig = (): AirJamProjectLocalMcpConfig => {\n const server = createAirJamMcpServerDeclaration();\n return {\n mcpServers: {\n airjam: {\n command: server.command,\n args: [...server.args],\n },\n },\n };\n};\n\nconst pathExists = async (targetPath: string): Promise<boolean> => {\n try {\n await access(targetPath);\n return true;\n } catch {\n return false;\n }\n};\n\nconst resolveClaudeDesktopConfigPath = (): string | null => {\n if (process.platform === \"darwin\") {\n return path.join(\n os.homedir(),\n \"Library\",\n \"Application Support\",\n \"Claude\",\n \"claude_desktop_config.json\",\n );\n }\n if (process.platform === \"win32\") {\n const appData = process.env.APPDATA;\n return appData\n ? path.join(appData, \"Claude\", \"claude_desktop_config.json\")\n : null;\n }\n return path.join(\n os.homedir(),\n \".config\",\n \"Claude\",\n \"claude_desktop_config.json\",\n );\n};\n\nconst inspectJsonRegistration = async (\n profile: AirJamMcpClientProfile,\n configPath: string | null,\n): Promise<AirJamMcpRegistrationInspection> => {\n if (!configPath) {\n return { profile, configPath, configPresent: null, registered: null };\n }\n if (!(await pathExists(configPath))) {\n return { profile, configPath, configPresent: false, registered: false };\n }\n try {\n const parsed = JSON.parse(await readFile(configPath, \"utf8\")) as {\n mcpServers?: Record<string, unknown>;\n };\n return {\n profile,\n configPath,\n configPresent: true,\n registered: Boolean(parsed.mcpServers?.airjam),\n };\n } catch {\n return { profile, configPath, configPresent: true, registered: false };\n }\n};\n\nconst inspectCodexRegistration = async (\n projectDir: string,\n): Promise<AirJamMcpRegistrationInspection> => {\n const configPath = path.join(projectDir, AIRJAM_CODEX_PROJECT_MCP_FILE);\n if (!(await pathExists(configPath))) {\n return {\n profile: \"codex\",\n configPath,\n configPresent: false,\n registered: false,\n };\n }\n const source = await readFile(configPath, \"utf8\");\n return {\n profile: \"codex\",\n configPath,\n configPresent: true,\n registered: /^\\s*\\[mcp_servers\\.airjam\\]\\s*$/m.test(source),\n };\n};\n\nexport const renderMcpClientProfile = ({\n profile,\n projectDir = process.cwd(),\n}: {\n profile: AirJamMcpClientProfile;\n projectDir?: string;\n}): AirJamMcpClientProfileRender => {\n const server = createAirJamMcpServerDeclaration();\n if (profile === \"codex\") {\n const escapedCwd = projectDir\n .replaceAll(\"\\\\\", \"\\\\\\\\\")\n .replaceAll('\"', '\\\\\"');\n return {\n profile,\n format: \"toml\",\n scope: \"project\",\n configPath: path.join(projectDir, AIRJAM_CODEX_PROJECT_MCP_FILE),\n content: `[mcp_servers.airjam]\\ncommand = \"${server.command}\"\\nargs = [\"exec\", \"airjam-mcp\"]\\ncwd = \"${escapedCwd}\"\\n`,\n installCommand: `codex mcp add airjam -- ${server.command} ${server.args.join(\" \")}`,\n };\n }\n\n const config = createProjectLocalMcpConfig();\n if (profile === \"claude-desktop\") {\n // Desktop launches globally, not from the game's project directory.\n config.mcpServers.airjam.args = [\n \"--dir\",\n path.resolve(projectDir),\n ...server.args,\n ];\n }\n\n return {\n profile,\n format: \"json\",\n scope: profile === \"portable\" ? \"project\" : \"client-global\",\n configPath:\n profile === \"portable\"\n ? path.join(projectDir, AIRJAM_PROJECT_MCP_FILE)\n : resolveClaudeDesktopConfigPath(),\n content: `${JSON.stringify(config, null, 2)}\\n`,\n installCommand: null,\n };\n};\n\nexport const inspectMcpProjectSetup = async ({\n cwd = process.cwd(),\n}: {\n cwd?: string;\n} = {}): Promise<InspectMcpProjectSetupResult> => {\n const project = await inspectProject({ cwd });\n const projectDir = project.context.rootDir;\n const configPath = path.join(projectDir, AIRJAM_PROJECT_MCP_FILE);\n\n return {\n projectDir,\n server: createAirJamMcpServerDeclaration(),\n package: {\n dependencyPresent: Boolean(project.airJamPackages[\"@air-jam/mcp-server\"]),\n scriptPresent: Boolean(project.scripts.mcp),\n },\n portableDeclaration: {\n configPath,\n present: await pathExists(configPath),\n },\n clients: {\n codex: await inspectCodexRegistration(projectDir),\n claudeDesktop: await inspectJsonRegistration(\n \"claude-desktop\",\n resolveClaudeDesktopConfigPath(),\n ),\n },\n recommendedConfig: createProjectLocalMcpConfig(),\n };\n};\n\nexport const writeProjectLocalMcpConfig = async ({\n cwd = process.cwd(),\n force = false,\n}: {\n cwd?: string;\n force?: boolean;\n} = {}): Promise<InspectMcpProjectSetupResult> => {\n const inspection = await inspectMcpProjectSetup({ cwd });\n const configPath = inspection.portableDeclaration.configPath;\n\n if (inspection.portableDeclaration.present && !force) {\n throw new Error(\n `MCP declaration already exists at ${configPath}. Re-run with force to overwrite it.`,\n );\n }\n\n await mkdir(path.dirname(configPath), { recursive: true });\n await writeFile(\n configPath,\n renderMcpClientProfile({\n profile: \"portable\",\n projectDir: inspection.projectDir,\n }).content,\n \"utf8\",\n );\n\n return inspectMcpProjectSetup({ cwd });\n};\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import '@air-jam/sdk/platform-machine';
|
|
2
|
+
import 'zod';
|
|
3
|
+
export { aA as AirJamPlatformApiError, aS as AirJamPlatformAuthStatus, aT as AirJamPlatformMachineSessionStore, aB as AirJamStoredPlatformSessionError, aU as GetPlatformMachineProfileOptions, aV as LoginPlatformWithDeviceFlowOptions, aW as LogoutPlatformMachineSessionOptions, aX as PollPlatformDeviceAuthorizationOptions, aY as StartPlatformDeviceAuthorizationOptions, aG as clearStoredPlatformMachineSession, aR as getPlatformAuthStoragePath, aQ as getPlatformMachineAuthStatus, aN as getPlatformMachineProfile, aL as listPlatformMachineSessions, aJ as loginPlatformWithDeviceFlow, aP as logoutPlatformMachineSession, aI as pollPlatformDeviceAuthorization, aE as readStoredPlatformMachineSession, aD as requestPlatformMachineApi, ay as resolveAirJamStateDirectory, aC as resolvePlatformBaseUrl, aK as resolvePlatformMachineAuth, aM as revokePlatformMachineSession, aH as startPlatformDeviceAuthorization, az as storedPlatformSessionSchema, aO as updatePlatformMachineProfile, aF as writeStoredPlatformMachineSession } from './types-CdYrgrG_.js';
|
|
4
|
+
import '@air-jam/sdk/agent-tooling';
|
|
5
|
+
import './game-session-broker-CUvORfMd.js';
|
|
6
|
+
import './game-run-watch-CEd_SpAT.js';
|
|
7
|
+
import 'node:stream';
|
|
8
|
+
import '@air-jam/sdk';
|
|
9
|
+
import '@air-jam/sdk/core';
|