@air-jam/devtools 0.0.0-stage → 0.9.3
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 +52 -2
- package/dist/agent.d.ts +15 -0
- package/dist/agent.js +19 -0
- package/dist/agent.js.map +1 -0
- package/dist/chunk-5YAARMW5.js +36 -0
- package/dist/chunk-5YAARMW5.js.map +1 -0
- package/dist/chunk-6WQODT37.js +1019 -0
- package/dist/chunk-6WQODT37.js.map +1 -0
- package/dist/chunk-CKFT2ZJE.js +801 -0
- package/dist/chunk-CKFT2ZJE.js.map +1 -0
- package/dist/chunk-ER3Q2C4G.js +358 -0
- package/dist/chunk-ER3Q2C4G.js.map +1 -0
- package/dist/chunk-GUEZP773.js +851 -0
- package/dist/chunk-GUEZP773.js.map +1 -0
- package/dist/chunk-HIDNI56E.js +33 -0
- package/dist/chunk-HIDNI56E.js.map +1 -0
- package/dist/chunk-QKXS5D35.js +43 -0
- package/dist/chunk-QKXS5D35.js.map +1 -0
- package/dist/chunk-S4LSCEVE.js +261 -0
- package/dist/chunk-S4LSCEVE.js.map +1 -0
- package/dist/chunk-VKMJO6VN.js +360 -0
- package/dist/chunk-VKMJO6VN.js.map +1 -0
- package/dist/chunk-WFUR3MXY.js +67 -0
- package/dist/chunk-WFUR3MXY.js.map +1 -0
- package/dist/chunk-XEMR7KUE.js +361 -0
- package/dist/chunk-XEMR7KUE.js.map +1 -0
- package/dist/chunk-ZLPD7FY5.js +191 -0
- package/dist/chunk-ZLPD7FY5.js.map +1 -0
- package/dist/context.d.ts +13 -0
- package/dist/context.js +9 -0
- package/dist/context.js.map +1 -0
- package/dist/controller.d.ts +41 -0
- package/dist/controller.js +30 -0
- package/dist/controller.js.map +1 -0
- package/dist/dev.d.ts +15 -0
- package/dist/dev.js +20 -0
- package/dist/dev.js.map +1 -0
- package/dist/game-session-broker.d.ts +57 -0
- package/dist/game-session-broker.js +235 -0
- package/dist/game-session-broker.js.map +1 -0
- package/dist/game-session.d.ts +13 -0
- package/dist/game-session.js +24 -0
- package/dist/game-session.js.map +1 -0
- package/dist/games.d.ts +21 -0
- package/dist/games.js +14 -0
- package/dist/games.js.map +1 -0
- package/dist/harness/visual.d.ts +321 -0
- package/dist/harness/visual.js +41 -0
- package/dist/harness/visual.js.map +1 -0
- package/dist/logs.d.ts +9 -0
- package/dist/logs.js +58 -0
- package/dist/logs.js.map +1 -0
- package/dist/mcp-config.d.ts +63 -0
- package/dist/mcp-config.js +190 -0
- package/dist/mcp-config.js.map +1 -0
- package/dist/platform-auth.d.ts +112 -0
- package/dist/platform-auth.js +37 -0
- package/dist/platform-auth.js.map +1 -0
- package/dist/platform-game-media.d.ts +309 -0
- package/dist/platform-game-media.js +168 -0
- package/dist/platform-game-media.js.map +1 -0
- package/dist/platform-games.d.ts +65 -0
- package/dist/platform-games.js +251 -0
- package/dist/platform-games.js.map +1 -0
- package/dist/quality.d.ts +10 -0
- package/dist/quality.js +63 -0
- package/dist/quality.js.map +1 -0
- package/dist/release.d.ts +1094 -0
- package/dist/release.js +1347 -0
- package/dist/release.js.map +1 -0
- package/dist/tooling/agent-contract.d.ts +2 -0
- package/dist/tooling/agent-contract.js +193 -0
- package/dist/tooling/agent-contract.js.map +1 -0
- package/dist/tooling/hold-runtime-host.d.ts +2 -0
- package/dist/tooling/hold-runtime-host.js +229 -0
- package/dist/tooling/hold-runtime-host.js.map +1 -0
- package/dist/tooling/inspect-airjam-agent.d.ts +2 -0
- package/dist/tooling/inspect-airjam-agent.js +37 -0
- package/dist/tooling/inspect-airjam-agent.js.map +1 -0
- package/dist/tooling/list-visual-scenarios.d.ts +2 -0
- package/dist/tooling/list-visual-scenarios.js +62 -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/run-visual-capture.d.ts +2 -0
- package/dist/tooling/run-visual-capture.js +167 -0
- package/dist/tooling/run-visual-capture.js.map +1 -0
- package/dist/types-C6NrHt88.d.ts +775 -0
- package/dist/visual.d.ts +15 -0
- package/dist/visual.js +263 -0
- package/dist/visual.js.map +1 -0
- package/package.json +113 -3
- package/src/agent.ts +380 -0
- package/src/commands.ts +40 -0
- package/src/context.ts +229 -0
- package/src/controller.ts +1376 -0
- package/src/dev.ts +999 -0
- package/src/fs-utils.ts +93 -0
- package/src/game-action-observation.ts +96 -0
- package/src/game-session-broker.ts +301 -0
- package/src/game-session.ts +459 -0
- package/src/games.ts +266 -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 +546 -0
- package/src/harness/visual/scenario-contract.ts +9 -0
- package/src/harness/visual/scenario-helpers.ts +63 -0
- package/src/harness/visual/session.ts +369 -0
- package/src/harness/visual/types.ts +181 -0
- package/src/harness/visual.ts +7 -0
- package/src/helper-scripts.ts +49 -0
- package/src/logs.ts +67 -0
- package/src/mcp-config.ts +262 -0
- package/src/platform-auth.ts +455 -0
- package/src/platform-game-media.ts +209 -0
- package/src/platform-games.ts +315 -0
- package/src/quality.ts +82 -0
- package/src/release.ts +1697 -0
- package/src/runtime-owner-protocol.ts +130 -0
- package/src/tooling/agent-contract.ts +232 -0
- package/src/tooling/agent-declaration.ts +36 -0
- package/src/tooling/airjam-agent-inspection.ts +45 -0
- package/src/tooling/airjam-agent.ts +118 -0
- package/src/tooling/hold-runtime-host.ts +224 -0
- package/src/tooling/inspect-airjam-agent.ts +20 -0
- package/src/tooling/list-visual-scenarios.ts +64 -0
- package/src/tooling/managed-dev-supervisor.ts +71 -0
- package/src/tooling/run-visual-capture.ts +217 -0
- package/src/tooling/runtime-owner-actions.ts +42 -0
- package/src/tooling/visual-pack.ts +46 -0
- package/src/types.ts +951 -0
- package/src/visual.ts +304 -0
- package/src/workspace-contract.ts +32 -0
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import { AnyAirJamAgentContract, AirJamAgentContract } from '@air-jam/sdk';
|
|
2
|
+
export { AnyAirJamAgentContract } from '@air-jam/sdk';
|
|
3
|
+
import { Page, Browser } from 'playwright-core';
|
|
4
|
+
|
|
5
|
+
type VisualHarnessMode = "standalone-dev" | "arcade-built";
|
|
6
|
+
type VisualViewport = {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
};
|
|
10
|
+
type VisualScreenshotRecord = {
|
|
11
|
+
surface: "host" | "controller";
|
|
12
|
+
viewportName: string;
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
fileName: string;
|
|
16
|
+
filePath: string;
|
|
17
|
+
};
|
|
18
|
+
type VisualHarnessUrls = {
|
|
19
|
+
appOrigin: string;
|
|
20
|
+
hostUrl: string;
|
|
21
|
+
controllerBaseUrl: string;
|
|
22
|
+
publicHost: string;
|
|
23
|
+
localBuildUrl: string | null;
|
|
24
|
+
browserBuildUrl: string | null;
|
|
25
|
+
controllerJoinUrl: string;
|
|
26
|
+
};
|
|
27
|
+
type VisualQuerySurface = {
|
|
28
|
+
getByLabel: Page["getByLabel"];
|
|
29
|
+
getByRole: Page["getByRole"];
|
|
30
|
+
getByTestId: Page["getByTestId"];
|
|
31
|
+
getByText: Page["getByText"];
|
|
32
|
+
locator: Page["locator"];
|
|
33
|
+
};
|
|
34
|
+
type VisualHarnessPageSurface = {
|
|
35
|
+
page: Page;
|
|
36
|
+
game: VisualQuerySurface;
|
|
37
|
+
embedded: boolean;
|
|
38
|
+
};
|
|
39
|
+
type InferVisualScenarioSnapshot<TAgent> = TAgent extends AirJamAgentContract<infer TSnapshot, infer _TStores> ? TSnapshot : never;
|
|
40
|
+
type VisualScenarioAgentActionDescriptor = {
|
|
41
|
+
actionId: string;
|
|
42
|
+
lane: "player" | "host";
|
|
43
|
+
source: "semantic-game";
|
|
44
|
+
description: string | null;
|
|
45
|
+
availability: string | null;
|
|
46
|
+
payload: {
|
|
47
|
+
kind: "none" | "boolean" | "number" | "string" | "enum" | "json";
|
|
48
|
+
description: string | null;
|
|
49
|
+
allowedValues?: string[];
|
|
50
|
+
};
|
|
51
|
+
resultDescription: string | null;
|
|
52
|
+
};
|
|
53
|
+
type VisualScenarioAgentInvocation<TSnapshot = Record<string, unknown>> = {
|
|
54
|
+
actionId: string;
|
|
55
|
+
lane: "player" | "host";
|
|
56
|
+
outcome: string | null;
|
|
57
|
+
acknowledgementObservation: string | null;
|
|
58
|
+
snapshotBefore: TSnapshot | null;
|
|
59
|
+
snapshotAfter: TSnapshot | null;
|
|
60
|
+
snapshotAfterStatus: "committed-update-observed" | "no-new-commit-before-timeout" | null;
|
|
61
|
+
};
|
|
62
|
+
type VisualScenarioAgent<TSnapshot = Record<string, unknown>> = {
|
|
63
|
+
listActions: () => Promise<readonly VisualScenarioAgentActionDescriptor[]>;
|
|
64
|
+
read: () => Promise<TSnapshot>;
|
|
65
|
+
waitFor: (predicate: (snapshot: TSnapshot) => boolean | Promise<boolean>, description?: string, timeout?: number) => Promise<TSnapshot>;
|
|
66
|
+
invoke: (actionId: string, payload?: unknown, options?: {
|
|
67
|
+
timeoutMs?: number;
|
|
68
|
+
}) => Promise<VisualScenarioAgentInvocation<TSnapshot>>;
|
|
69
|
+
close: () => Promise<void>;
|
|
70
|
+
};
|
|
71
|
+
type VisualScenarioContext<TAgent extends AnyAirJamAgentContract = AnyAirJamAgentContract> = {
|
|
72
|
+
gameId: string;
|
|
73
|
+
scenario: VisualScenario<TAgent>;
|
|
74
|
+
scenarioDir: string;
|
|
75
|
+
urls: VisualHarnessUrls;
|
|
76
|
+
host: VisualHarnessPageSurface;
|
|
77
|
+
controller: VisualHarnessPageSurface & {
|
|
78
|
+
fullscreenPromptDismissed: boolean;
|
|
79
|
+
};
|
|
80
|
+
note: (value: string) => void;
|
|
81
|
+
sleep: (ms: number) => Promise<void>;
|
|
82
|
+
ensureControllerInteractive: () => Promise<void>;
|
|
83
|
+
agent: VisualScenarioAgent<InferVisualScenarioSnapshot<TAgent>>;
|
|
84
|
+
captureHost: (viewportName: string, viewport: VisualViewport) => Promise<void>;
|
|
85
|
+
captureController: (viewportName: string, viewport: VisualViewport) => Promise<void>;
|
|
86
|
+
screenshotRecords: VisualScreenshotRecord[];
|
|
87
|
+
notes: string[];
|
|
88
|
+
close: () => Promise<void>;
|
|
89
|
+
};
|
|
90
|
+
type VisualScenario<TAgent extends AnyAirJamAgentContract = AnyAirJamAgentContract> = {
|
|
91
|
+
id: string;
|
|
92
|
+
description?: string;
|
|
93
|
+
run: (context: VisualScenarioContext<TAgent>) => Promise<void>;
|
|
94
|
+
};
|
|
95
|
+
type VisualScenarioPack<TAgent extends AnyAirJamAgentContract = AnyAirJamAgentContract> = {
|
|
96
|
+
agent: TAgent;
|
|
97
|
+
scenarios: ReadonlyArray<VisualScenario<TAgent>>;
|
|
98
|
+
};
|
|
99
|
+
type VisualCaptureScenarioMetadata = {
|
|
100
|
+
gameId: string;
|
|
101
|
+
scenarioId: string;
|
|
102
|
+
scenarioDescription: string | null;
|
|
103
|
+
runtimeMode: VisualHarnessMode;
|
|
104
|
+
capturedAt: string;
|
|
105
|
+
status: "captured" | "failed";
|
|
106
|
+
urls: Omit<VisualHarnessUrls, "controllerJoinUrl"> | VisualHarnessUrls;
|
|
107
|
+
screenshots: Array<{
|
|
108
|
+
surface: "host" | "controller";
|
|
109
|
+
viewportName: string;
|
|
110
|
+
width: number;
|
|
111
|
+
height: number;
|
|
112
|
+
fileName: string;
|
|
113
|
+
relativePath: string;
|
|
114
|
+
}>;
|
|
115
|
+
notes: string[];
|
|
116
|
+
error: {
|
|
117
|
+
message: string;
|
|
118
|
+
stack: string | null;
|
|
119
|
+
} | null;
|
|
120
|
+
};
|
|
121
|
+
type VisualCaptureSummary = {
|
|
122
|
+
gameId: string;
|
|
123
|
+
mode: VisualHarnessMode;
|
|
124
|
+
secure: boolean;
|
|
125
|
+
capturedAt: string;
|
|
126
|
+
scenarios: Array<{
|
|
127
|
+
scenarioId: string;
|
|
128
|
+
status: "captured" | "failed";
|
|
129
|
+
screenshotCount: number;
|
|
130
|
+
relativeDir: string;
|
|
131
|
+
}>;
|
|
132
|
+
};
|
|
133
|
+
type RunVisualCaptureCommandOptions = {
|
|
134
|
+
gameId: string;
|
|
135
|
+
scenarioId?: string | null;
|
|
136
|
+
mode?: VisualHarnessMode;
|
|
137
|
+
secure?: boolean;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
type PrefabCaptureVariants = Readonly<Record<string, string>>;
|
|
141
|
+
type PrefabCaptureRequest = {
|
|
142
|
+
prefabId: string;
|
|
143
|
+
variants: PrefabCaptureVariants;
|
|
144
|
+
mode: VisualHarnessMode;
|
|
145
|
+
};
|
|
146
|
+
type PrefabCaptureDefinition = {
|
|
147
|
+
id: string;
|
|
148
|
+
prefabId: string;
|
|
149
|
+
description?: string;
|
|
150
|
+
viewport?: VisualViewport;
|
|
151
|
+
waitForTestId?: string;
|
|
152
|
+
buildHostUrl: (hostUrl: string, request: PrefabCaptureRequest) => string;
|
|
153
|
+
};
|
|
154
|
+
type PrefabCaptureHarness = {
|
|
155
|
+
gameId: string;
|
|
156
|
+
prefabs: readonly PrefabCaptureDefinition[];
|
|
157
|
+
};
|
|
158
|
+
declare const definePrefabCaptureHarness: <const THarness extends PrefabCaptureHarness>(harness: THarness) => THarness;
|
|
159
|
+
|
|
160
|
+
declare const loadPrefabCapture: ({ gameId, gameDirectory, prefabId, variantPairs, mode, secure, }: {
|
|
161
|
+
gameId: string;
|
|
162
|
+
gameDirectory: string;
|
|
163
|
+
prefabId: string;
|
|
164
|
+
variantPairs?: string[];
|
|
165
|
+
mode?: VisualHarnessMode;
|
|
166
|
+
secure?: boolean;
|
|
167
|
+
}) => Promise<{
|
|
168
|
+
gameId: string;
|
|
169
|
+
prefab: {
|
|
170
|
+
id: string;
|
|
171
|
+
prefabId: string;
|
|
172
|
+
buildHostUrl: (hostUrl: string, request: PrefabCaptureRequest) => string;
|
|
173
|
+
description?: string | undefined;
|
|
174
|
+
viewport?: {
|
|
175
|
+
width: number;
|
|
176
|
+
height: number;
|
|
177
|
+
} | undefined;
|
|
178
|
+
waitForTestId?: string | undefined;
|
|
179
|
+
};
|
|
180
|
+
variants: {
|
|
181
|
+
[k: string]: string;
|
|
182
|
+
};
|
|
183
|
+
artifactId: string;
|
|
184
|
+
mode: VisualHarnessMode;
|
|
185
|
+
secure: boolean;
|
|
186
|
+
}>;
|
|
187
|
+
declare const capturePrefabAtRuntime: ({ capture, hostUrl, artifactRoot, }: {
|
|
188
|
+
capture: Awaited<ReturnType<typeof loadPrefabCapture>>;
|
|
189
|
+
hostUrl: string;
|
|
190
|
+
artifactRoot: string;
|
|
191
|
+
}) => Promise<{
|
|
192
|
+
artifactDirectory: string;
|
|
193
|
+
metadataPath: string;
|
|
194
|
+
metadata: {
|
|
195
|
+
gameId: string;
|
|
196
|
+
captureId: string;
|
|
197
|
+
prefabId: string;
|
|
198
|
+
runtimeMode: VisualHarnessMode;
|
|
199
|
+
secure: boolean;
|
|
200
|
+
capturedAt: string;
|
|
201
|
+
viewport: {
|
|
202
|
+
width: number;
|
|
203
|
+
height: number;
|
|
204
|
+
};
|
|
205
|
+
variants: {
|
|
206
|
+
[k: string]: string;
|
|
207
|
+
};
|
|
208
|
+
url: string;
|
|
209
|
+
screenshot: {
|
|
210
|
+
fileName: string;
|
|
211
|
+
relativePath: string;
|
|
212
|
+
};
|
|
213
|
+
};
|
|
214
|
+
}>;
|
|
215
|
+
|
|
216
|
+
type VisualHarnessStackHandle = {
|
|
217
|
+
urls: Omit<VisualHarnessUrls, "controllerJoinUrl">;
|
|
218
|
+
shutdown: () => Promise<void> | void;
|
|
219
|
+
};
|
|
220
|
+
type RunVisualHarnessOptions = {
|
|
221
|
+
gameId: string;
|
|
222
|
+
scenarioId?: string | null;
|
|
223
|
+
mode?: VisualHarnessMode;
|
|
224
|
+
secure?: boolean;
|
|
225
|
+
artifactRoot: string;
|
|
226
|
+
loadScenarioPack: (gameId: string) => Promise<VisualScenarioPack<AnyAirJamAgentContract>>;
|
|
227
|
+
startStack: (options: {
|
|
228
|
+
gameId: string;
|
|
229
|
+
mode: VisualHarnessMode;
|
|
230
|
+
secure: boolean;
|
|
231
|
+
}) => Promise<VisualHarnessStackHandle>;
|
|
232
|
+
createAgentSession?: (options: {
|
|
233
|
+
gameId: string;
|
|
234
|
+
scenarioId: string;
|
|
235
|
+
urls: VisualHarnessUrls;
|
|
236
|
+
mode: VisualHarnessMode;
|
|
237
|
+
secure: boolean;
|
|
238
|
+
}) => Promise<VisualScenarioAgent<Record<string, unknown>>>;
|
|
239
|
+
onScenarioStart?: (scenario: VisualScenario<AnyAirJamAgentContract>) => void;
|
|
240
|
+
onCaptureStart?: (info: {
|
|
241
|
+
gameId: string;
|
|
242
|
+
mode: VisualHarnessMode;
|
|
243
|
+
scenarioCount: number;
|
|
244
|
+
}) => void;
|
|
245
|
+
onComplete?: (summary: VisualCaptureSummary) => void;
|
|
246
|
+
};
|
|
247
|
+
declare const runVisualHarness: ({ gameId, scenarioId, mode, secure, artifactRoot, loadScenarioPack, startStack, createAgentSession, onScenarioStart, onCaptureStart, onComplete, }: RunVisualHarnessOptions) => Promise<VisualCaptureSummary>;
|
|
248
|
+
|
|
249
|
+
declare const defineVisualScenarios: <TAgent extends AnyAirJamAgentContract>(pack: {
|
|
250
|
+
agent: TAgent;
|
|
251
|
+
scenarios: ReadonlyArray<VisualScenario<TAgent>>;
|
|
252
|
+
}) => VisualScenarioPack<TAgent>;
|
|
253
|
+
|
|
254
|
+
declare const STANDARD_HOST_VIEWPORTS: readonly [["mac-desktop", {
|
|
255
|
+
readonly width: 3016;
|
|
256
|
+
readonly height: 1504;
|
|
257
|
+
}], ["desktop", {
|
|
258
|
+
readonly width: 1440;
|
|
259
|
+
readonly height: 1024;
|
|
260
|
+
}], ["tablet", {
|
|
261
|
+
readonly width: 1024;
|
|
262
|
+
readonly height: 1180;
|
|
263
|
+
}]];
|
|
264
|
+
declare const STANDARD_CONTROLLER_VIEWPORTS: readonly [["mobile", {
|
|
265
|
+
readonly width: 390;
|
|
266
|
+
readonly height: 844;
|
|
267
|
+
}], ["small-mobile", {
|
|
268
|
+
readonly width: 360;
|
|
269
|
+
readonly height: 640;
|
|
270
|
+
}]];
|
|
271
|
+
declare const STANDARD_CONTROLLER_LANDSCAPE_VIEWPORTS: readonly [["mobile", {
|
|
272
|
+
readonly width: 844;
|
|
273
|
+
readonly height: 390;
|
|
274
|
+
}], ["small-mobile", {
|
|
275
|
+
readonly width: 640;
|
|
276
|
+
readonly height: 360;
|
|
277
|
+
}]];
|
|
278
|
+
declare const captureStandardSurfaces: (context: VisualScenarioContext, options?: {
|
|
279
|
+
controllerOrientation?: "portrait" | "landscape";
|
|
280
|
+
}) => Promise<void>;
|
|
281
|
+
declare const waitForHostText: (context: VisualScenarioContext, text: string | RegExp, timeout?: number) => Promise<void>;
|
|
282
|
+
declare const waitForControllerText: (context: VisualScenarioContext, text: string | RegExp, timeout?: number) => Promise<void>;
|
|
283
|
+
|
|
284
|
+
declare const DEFAULT_HOST_VIEWPORT: VisualViewport;
|
|
285
|
+
declare const DEFAULT_CONTROLLER_VIEWPORT: VisualViewport;
|
|
286
|
+
declare const dismissHarnessControllerFullscreenPrompt: (page: Page) => Promise<boolean>;
|
|
287
|
+
type OpenVisualHarnessSessionOptions = {
|
|
288
|
+
browser: Browser;
|
|
289
|
+
urls: Omit<VisualHarnessUrls, "controllerJoinUrl">;
|
|
290
|
+
mode: VisualHarnessMode;
|
|
291
|
+
};
|
|
292
|
+
type OpenVisualHarnessHostSessionResult = {
|
|
293
|
+
urls: Omit<VisualHarnessUrls, "controllerJoinUrl"> & {
|
|
294
|
+
controllerJoinUrl: null;
|
|
295
|
+
};
|
|
296
|
+
host: VisualHarnessPageSurface;
|
|
297
|
+
close: () => Promise<void>;
|
|
298
|
+
};
|
|
299
|
+
type OpenVisualHarnessControllerSessionResult = {
|
|
300
|
+
urls: VisualHarnessUrls;
|
|
301
|
+
controller: VisualHarnessPageSurface & {
|
|
302
|
+
fullscreenPromptDismissed: boolean;
|
|
303
|
+
};
|
|
304
|
+
close: () => Promise<void>;
|
|
305
|
+
};
|
|
306
|
+
type OpenVisualHarnessSessionResult = {
|
|
307
|
+
urls: VisualHarnessUrls;
|
|
308
|
+
host: VisualHarnessPageSurface;
|
|
309
|
+
controller: VisualHarnessPageSurface & {
|
|
310
|
+
fullscreenPromptDismissed: boolean;
|
|
311
|
+
};
|
|
312
|
+
close: () => Promise<void>;
|
|
313
|
+
};
|
|
314
|
+
declare const openVisualHarnessHostSession: ({ browser, urls, mode, }: OpenVisualHarnessSessionOptions) => Promise<OpenVisualHarnessHostSessionResult>;
|
|
315
|
+
declare const openVisualHarnessControllerSession: ({ browser, urls, host, }: Omit<OpenVisualHarnessSessionOptions, "mode"> & {
|
|
316
|
+
host: VisualHarnessPageSurface;
|
|
317
|
+
}) => Promise<OpenVisualHarnessControllerSessionResult>;
|
|
318
|
+
declare const openVisualHarnessSession: ({ browser, urls, mode, }: OpenVisualHarnessSessionOptions) => Promise<OpenVisualHarnessSessionResult>;
|
|
319
|
+
declare const launchHarnessBrowser: () => Promise<Browser>;
|
|
320
|
+
|
|
321
|
+
export { DEFAULT_CONTROLLER_VIEWPORT, DEFAULT_HOST_VIEWPORT, type InferVisualScenarioSnapshot, type OpenVisualHarnessControllerSessionResult, type OpenVisualHarnessHostSessionResult, type OpenVisualHarnessSessionOptions, type OpenVisualHarnessSessionResult, type PrefabCaptureDefinition, type PrefabCaptureHarness, type PrefabCaptureRequest, type PrefabCaptureVariants, type RunVisualCaptureCommandOptions, type RunVisualHarnessOptions, STANDARD_CONTROLLER_LANDSCAPE_VIEWPORTS, STANDARD_CONTROLLER_VIEWPORTS, STANDARD_HOST_VIEWPORTS, type VisualCaptureScenarioMetadata, type VisualCaptureSummary, type VisualHarnessMode, type VisualHarnessPageSurface, type VisualHarnessStackHandle, type VisualHarnessUrls, type VisualQuerySurface, type VisualScenario, type VisualScenarioAgent, type VisualScenarioAgentActionDescriptor, type VisualScenarioAgentInvocation, type VisualScenarioContext, type VisualScenarioPack, type VisualScreenshotRecord, type VisualViewport, capturePrefabAtRuntime, captureStandardSurfaces, definePrefabCaptureHarness, defineVisualScenarios, dismissHarnessControllerFullscreenPrompt, launchHarnessBrowser, loadPrefabCapture, openVisualHarnessControllerSession, openVisualHarnessHostSession, openVisualHarnessSession, runVisualHarness, waitForControllerText, waitForHostText };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_CONTROLLER_VIEWPORT,
|
|
3
|
+
DEFAULT_HOST_VIEWPORT,
|
|
4
|
+
STANDARD_CONTROLLER_LANDSCAPE_VIEWPORTS,
|
|
5
|
+
STANDARD_CONTROLLER_VIEWPORTS,
|
|
6
|
+
STANDARD_HOST_VIEWPORTS,
|
|
7
|
+
capturePrefabAtRuntime,
|
|
8
|
+
captureStandardSurfaces,
|
|
9
|
+
definePrefabCaptureHarness,
|
|
10
|
+
defineVisualScenarios,
|
|
11
|
+
dismissHarnessControllerFullscreenPrompt,
|
|
12
|
+
launchHarnessBrowser,
|
|
13
|
+
loadPrefabCapture,
|
|
14
|
+
openVisualHarnessControllerSession,
|
|
15
|
+
openVisualHarnessHostSession,
|
|
16
|
+
openVisualHarnessSession,
|
|
17
|
+
runVisualHarness,
|
|
18
|
+
waitForControllerText,
|
|
19
|
+
waitForHostText
|
|
20
|
+
} from "../chunk-GUEZP773.js";
|
|
21
|
+
export {
|
|
22
|
+
DEFAULT_CONTROLLER_VIEWPORT,
|
|
23
|
+
DEFAULT_HOST_VIEWPORT,
|
|
24
|
+
STANDARD_CONTROLLER_LANDSCAPE_VIEWPORTS,
|
|
25
|
+
STANDARD_CONTROLLER_VIEWPORTS,
|
|
26
|
+
STANDARD_HOST_VIEWPORTS,
|
|
27
|
+
capturePrefabAtRuntime,
|
|
28
|
+
captureStandardSurfaces,
|
|
29
|
+
definePrefabCaptureHarness,
|
|
30
|
+
defineVisualScenarios,
|
|
31
|
+
dismissHarnessControllerFullscreenPrompt,
|
|
32
|
+
launchHarnessBrowser,
|
|
33
|
+
loadPrefabCapture,
|
|
34
|
+
openVisualHarnessControllerSession,
|
|
35
|
+
openVisualHarnessHostSession,
|
|
36
|
+
openVisualHarnessSession,
|
|
37
|
+
runVisualHarness,
|
|
38
|
+
waitForControllerText,
|
|
39
|
+
waitForHostText
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=visual.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/logs.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { a0 as ReadDevLogsOptions, a1 as CommandResult } from './types-C6NrHt88.js';
|
|
2
|
+
import '@air-jam/sdk';
|
|
3
|
+
import '@air-jam/sdk/platform-machine';
|
|
4
|
+
|
|
5
|
+
declare const readDevLogs: (options?: ReadDevLogsOptions) => Promise<CommandResult & {
|
|
6
|
+
lines: string[];
|
|
7
|
+
}>;
|
|
8
|
+
|
|
9
|
+
export { CommandResult, ReadDevLogsOptions, readDevLogs };
|
package/dist/logs.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
runCommandResult
|
|
3
|
+
} from "./chunk-5YAARMW5.js";
|
|
4
|
+
import {
|
|
5
|
+
detectProjectContext
|
|
6
|
+
} from "./chunk-S4LSCEVE.js";
|
|
7
|
+
|
|
8
|
+
// src/logs.ts
|
|
9
|
+
var pushOption = (args, name, value) => {
|
|
10
|
+
if (value !== void 0 && value !== "") {
|
|
11
|
+
args.push(`--${name}=${String(value)}`);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
var readDevLogs = async (options = {}) => {
|
|
15
|
+
const context = await detectProjectContext({ cwd: options.cwd });
|
|
16
|
+
const args = ["exec", "air-jam-server", "logs"];
|
|
17
|
+
pushOption(args, "view", options.view ?? "signal");
|
|
18
|
+
pushOption(args, "source", options.source);
|
|
19
|
+
pushOption(args, "trace", options.trace);
|
|
20
|
+
pushOption(args, "room", options.room);
|
|
21
|
+
pushOption(args, "controller", options.controller);
|
|
22
|
+
pushOption(args, "event", options.event);
|
|
23
|
+
pushOption(args, "process", options.process);
|
|
24
|
+
pushOption(args, "level", options.level);
|
|
25
|
+
pushOption(args, "runtime", options.runtime);
|
|
26
|
+
pushOption(args, "epoch", options.epoch);
|
|
27
|
+
pushOption(args, "console-category", options.consoleCategory);
|
|
28
|
+
pushOption(args, "file", options.file);
|
|
29
|
+
const result = runCommandResult({
|
|
30
|
+
command: "pnpm",
|
|
31
|
+
args,
|
|
32
|
+
cwd: context.rootDir
|
|
33
|
+
});
|
|
34
|
+
const missingLogMessage = `${result.stderr}
|
|
35
|
+
${result.stdout}`;
|
|
36
|
+
if (!result.ok && /Dev log file not found:/i.test(missingLogMessage)) {
|
|
37
|
+
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`.";
|
|
38
|
+
return {
|
|
39
|
+
...result,
|
|
40
|
+
exitCode: 0,
|
|
41
|
+
ok: true,
|
|
42
|
+
stdout: message,
|
|
43
|
+
stderr: "",
|
|
44
|
+
lines: [message]
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
const allLines = result.stdout.split(/\r?\n/).filter(Boolean);
|
|
48
|
+
const lines = typeof options.tail === "number" && options.tail >= 0 ? allLines.slice(-options.tail) : allLines;
|
|
49
|
+
return {
|
|
50
|
+
...result,
|
|
51
|
+
stdout: lines.join("\n"),
|
|
52
|
+
lines
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
readDevLogs
|
|
57
|
+
};
|
|
58
|
+
//# 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,190 @@
|
|
|
1
|
+
import {
|
|
2
|
+
inspectProject
|
|
3
|
+
} from "./chunk-S4LSCEVE.js";
|
|
4
|
+
|
|
5
|
+
// src/mcp-config.ts
|
|
6
|
+
import { access, mkdir, readFile, writeFile } from "fs/promises";
|
|
7
|
+
import os from "os";
|
|
8
|
+
import path from "path";
|
|
9
|
+
var AIRJAM_PROJECT_MCP_FILE = ".mcp.json";
|
|
10
|
+
var AIRJAM_CODEX_PROJECT_MCP_FILE = path.join(".codex", "config.toml");
|
|
11
|
+
var createAirJamMcpServerDeclaration = () => ({
|
|
12
|
+
name: "airjam",
|
|
13
|
+
transport: "stdio",
|
|
14
|
+
command: "pnpm",
|
|
15
|
+
args: ["exec", "airjam-mcp"]
|
|
16
|
+
});
|
|
17
|
+
var createProjectLocalMcpConfig = () => {
|
|
18
|
+
const server = createAirJamMcpServerDeclaration();
|
|
19
|
+
return {
|
|
20
|
+
mcpServers: {
|
|
21
|
+
airjam: {
|
|
22
|
+
command: server.command,
|
|
23
|
+
args: [...server.args]
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
var pathExists = async (targetPath) => {
|
|
29
|
+
try {
|
|
30
|
+
await access(targetPath);
|
|
31
|
+
return true;
|
|
32
|
+
} catch {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
var resolveClaudeDesktopConfigPath = () => {
|
|
37
|
+
if (process.platform === "darwin") {
|
|
38
|
+
return path.join(
|
|
39
|
+
os.homedir(),
|
|
40
|
+
"Library",
|
|
41
|
+
"Application Support",
|
|
42
|
+
"Claude",
|
|
43
|
+
"claude_desktop_config.json"
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
if (process.platform === "win32") {
|
|
47
|
+
const appData = process.env.APPDATA;
|
|
48
|
+
return appData ? path.join(appData, "Claude", "claude_desktop_config.json") : null;
|
|
49
|
+
}
|
|
50
|
+
return path.join(
|
|
51
|
+
os.homedir(),
|
|
52
|
+
".config",
|
|
53
|
+
"Claude",
|
|
54
|
+
"claude_desktop_config.json"
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
var inspectJsonRegistration = async (profile, configPath) => {
|
|
58
|
+
if (!configPath) {
|
|
59
|
+
return { profile, configPath, configPresent: null, registered: null };
|
|
60
|
+
}
|
|
61
|
+
if (!await pathExists(configPath)) {
|
|
62
|
+
return { profile, configPath, configPresent: false, registered: false };
|
|
63
|
+
}
|
|
64
|
+
try {
|
|
65
|
+
const parsed = JSON.parse(await readFile(configPath, "utf8"));
|
|
66
|
+
return {
|
|
67
|
+
profile,
|
|
68
|
+
configPath,
|
|
69
|
+
configPresent: true,
|
|
70
|
+
registered: Boolean(parsed.mcpServers?.airjam)
|
|
71
|
+
};
|
|
72
|
+
} catch {
|
|
73
|
+
return { profile, configPath, configPresent: true, registered: false };
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
var inspectCodexRegistration = async (projectDir) => {
|
|
77
|
+
const configPath = path.join(projectDir, AIRJAM_CODEX_PROJECT_MCP_FILE);
|
|
78
|
+
if (!await pathExists(configPath)) {
|
|
79
|
+
return {
|
|
80
|
+
profile: "codex",
|
|
81
|
+
configPath,
|
|
82
|
+
configPresent: false,
|
|
83
|
+
registered: false
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
const source = await readFile(configPath, "utf8");
|
|
87
|
+
return {
|
|
88
|
+
profile: "codex",
|
|
89
|
+
configPath,
|
|
90
|
+
configPresent: true,
|
|
91
|
+
registered: /^\s*\[mcp_servers\.airjam\]\s*$/m.test(source)
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
var renderMcpClientProfile = ({
|
|
95
|
+
profile,
|
|
96
|
+
projectDir = process.cwd()
|
|
97
|
+
}) => {
|
|
98
|
+
const server = createAirJamMcpServerDeclaration();
|
|
99
|
+
if (profile === "codex") {
|
|
100
|
+
const escapedCwd = projectDir.replaceAll("\\", "\\\\").replaceAll('"', '\\"');
|
|
101
|
+
return {
|
|
102
|
+
profile,
|
|
103
|
+
format: "toml",
|
|
104
|
+
scope: "project",
|
|
105
|
+
configPath: path.join(projectDir, AIRJAM_CODEX_PROJECT_MCP_FILE),
|
|
106
|
+
content: `[mcp_servers.airjam]
|
|
107
|
+
command = "${server.command}"
|
|
108
|
+
args = ["exec", "airjam-mcp"]
|
|
109
|
+
cwd = "${escapedCwd}"
|
|
110
|
+
`,
|
|
111
|
+
installCommand: `codex mcp add airjam -- ${server.command} ${server.args.join(" ")}`
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
const config = createProjectLocalMcpConfig();
|
|
115
|
+
if (profile === "claude-desktop") {
|
|
116
|
+
config.mcpServers.airjam.args = [
|
|
117
|
+
"--dir",
|
|
118
|
+
path.resolve(projectDir),
|
|
119
|
+
...server.args
|
|
120
|
+
];
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
profile,
|
|
124
|
+
format: "json",
|
|
125
|
+
scope: profile === "portable" ? "project" : "client-global",
|
|
126
|
+
configPath: profile === "portable" ? path.join(projectDir, AIRJAM_PROJECT_MCP_FILE) : resolveClaudeDesktopConfigPath(),
|
|
127
|
+
content: `${JSON.stringify(config, null, 2)}
|
|
128
|
+
`,
|
|
129
|
+
installCommand: null
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
var inspectMcpProjectSetup = async ({
|
|
133
|
+
cwd = process.cwd()
|
|
134
|
+
} = {}) => {
|
|
135
|
+
const project = await inspectProject({ cwd });
|
|
136
|
+
const projectDir = project.context.rootDir;
|
|
137
|
+
const configPath = path.join(projectDir, AIRJAM_PROJECT_MCP_FILE);
|
|
138
|
+
return {
|
|
139
|
+
projectDir,
|
|
140
|
+
server: createAirJamMcpServerDeclaration(),
|
|
141
|
+
package: {
|
|
142
|
+
dependencyPresent: Boolean(project.airJamPackages["@air-jam/mcp-server"]),
|
|
143
|
+
scriptPresent: Boolean(project.scripts.mcp)
|
|
144
|
+
},
|
|
145
|
+
portableDeclaration: {
|
|
146
|
+
configPath,
|
|
147
|
+
present: await pathExists(configPath)
|
|
148
|
+
},
|
|
149
|
+
clients: {
|
|
150
|
+
codex: await inspectCodexRegistration(projectDir),
|
|
151
|
+
claudeDesktop: await inspectJsonRegistration(
|
|
152
|
+
"claude-desktop",
|
|
153
|
+
resolveClaudeDesktopConfigPath()
|
|
154
|
+
)
|
|
155
|
+
},
|
|
156
|
+
recommendedConfig: createProjectLocalMcpConfig()
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
var writeProjectLocalMcpConfig = async ({
|
|
160
|
+
cwd = process.cwd(),
|
|
161
|
+
force = false
|
|
162
|
+
} = {}) => {
|
|
163
|
+
const inspection = await inspectMcpProjectSetup({ cwd });
|
|
164
|
+
const configPath = inspection.portableDeclaration.configPath;
|
|
165
|
+
if (inspection.portableDeclaration.present && !force) {
|
|
166
|
+
throw new Error(
|
|
167
|
+
`MCP declaration already exists at ${configPath}. Re-run with force to overwrite it.`
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
await mkdir(path.dirname(configPath), { recursive: true });
|
|
171
|
+
await writeFile(
|
|
172
|
+
configPath,
|
|
173
|
+
renderMcpClientProfile({
|
|
174
|
+
profile: "portable",
|
|
175
|
+
projectDir: inspection.projectDir
|
|
176
|
+
}).content,
|
|
177
|
+
"utf8"
|
|
178
|
+
);
|
|
179
|
+
return inspectMcpProjectSetup({ cwd });
|
|
180
|
+
};
|
|
181
|
+
export {
|
|
182
|
+
AIRJAM_CODEX_PROJECT_MCP_FILE,
|
|
183
|
+
AIRJAM_PROJECT_MCP_FILE,
|
|
184
|
+
createAirJamMcpServerDeclaration,
|
|
185
|
+
createProjectLocalMcpConfig,
|
|
186
|
+
inspectMcpProjectSetup,
|
|
187
|
+
renderMcpClientProfile,
|
|
188
|
+
writeProjectLocalMcpConfig
|
|
189
|
+
};
|
|
190
|
+
//# sourceMappingURL=mcp-config.js.map
|