@air-jam/devtools 0.9.3 → 1.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -0
- package/dist/{chunk-VKMJO6VN.js → chunk-2O67AXCU.js} +150 -40
- package/dist/chunk-2O67AXCU.js.map +1 -0
- package/dist/chunk-AO3ZDXF6.js +142 -0
- package/dist/chunk-AO3ZDXF6.js.map +1 -0
- package/dist/chunk-ART5TEYT.js +472 -0
- package/dist/chunk-ART5TEYT.js.map +1 -0
- package/dist/chunk-ASC2CK2R.js +77 -0
- package/dist/chunk-ASC2CK2R.js.map +1 -0
- package/dist/chunk-E3UZZGAV.js +50 -0
- package/dist/chunk-E3UZZGAV.js.map +1 -0
- package/dist/chunk-EJTE7UKX.js +64 -0
- package/dist/chunk-EJTE7UKX.js.map +1 -0
- package/dist/chunk-ESFKNN75.js +110 -0
- package/dist/chunk-ESFKNN75.js.map +1 -0
- package/dist/chunk-EU7A6PXW.js +1339 -0
- package/dist/chunk-EU7A6PXW.js.map +1 -0
- package/dist/chunk-FN7E6EA7.js +549 -0
- package/dist/chunk-FN7E6EA7.js.map +1 -0
- package/dist/chunk-GDFAWHGA.js +190 -0
- package/dist/chunk-GDFAWHGA.js.map +1 -0
- package/dist/chunk-HZUGBH4Y.js +347 -0
- package/dist/chunk-HZUGBH4Y.js.map +1 -0
- package/dist/chunk-ITKAOEGX.js +93 -0
- package/dist/chunk-ITKAOEGX.js.map +1 -0
- package/dist/chunk-JBCUTWRI.js +897 -0
- package/dist/chunk-JBCUTWRI.js.map +1 -0
- package/dist/chunk-JSI5S4WP.js +1174 -0
- package/dist/chunk-JSI5S4WP.js.map +1 -0
- package/dist/chunk-L4D675BG.js +97 -0
- package/dist/chunk-L4D675BG.js.map +1 -0
- package/dist/{chunk-GUEZP773.js → chunk-LB3Y64P5.js} +206 -60
- package/dist/chunk-LB3Y64P5.js.map +1 -0
- package/dist/chunk-M6CJ7GQC.js +133 -0
- package/dist/chunk-M6CJ7GQC.js.map +1 -0
- package/dist/{chunk-CKFT2ZJE.js → chunk-MEIMOSZC.js} +53 -105
- package/dist/chunk-MEIMOSZC.js.map +1 -0
- package/dist/chunk-OM6SCJ7H.js +18 -0
- package/dist/chunk-OM6SCJ7H.js.map +1 -0
- package/dist/chunk-PKD4WVX5.js +63 -0
- package/dist/chunk-PKD4WVX5.js.map +1 -0
- package/dist/chunk-PMBLXGFM.js +3384 -0
- package/dist/chunk-PMBLXGFM.js.map +1 -0
- package/dist/chunk-PMNE5GIN.js +279 -0
- package/dist/chunk-PMNE5GIN.js.map +1 -0
- package/dist/chunk-QAWI64VR.js +148 -0
- package/dist/chunk-QAWI64VR.js.map +1 -0
- package/dist/chunk-QGADSPHZ.js +449 -0
- package/dist/chunk-QGADSPHZ.js.map +1 -0
- package/dist/chunk-SPYN66UV.js +338 -0
- package/dist/chunk-SPYN66UV.js.map +1 -0
- package/dist/context.d.ts +9 -3
- package/dist/context.js +2 -1
- package/dist/controller.d.ts +33 -7
- package/dist/controller.js +18 -8
- package/dist/dependencies.d.ts +44 -0
- package/dist/dependencies.js +10 -0
- package/dist/dev.d.ts +9 -3
- package/dist/dev.js +3 -4
- package/dist/game-builds.d.ts +200 -0
- package/dist/game-builds.js +16 -0
- package/dist/game-builds.js.map +1 -0
- package/dist/game-run-watch-CEd_SpAT.d.ts +84 -0
- package/dist/game-runs.d.ts +1452 -0
- package/dist/game-runs.js +76 -0
- package/dist/game-runs.js.map +1 -0
- package/dist/game-session-broker-CUvORfMd.d.ts +439 -0
- package/dist/game-session-broker.d.ts +4 -57
- package/dist/game-session-broker.js +33 -228
- package/dist/game-session-broker.js.map +1 -1
- package/dist/game-session.d.ts +3931 -10
- package/dist/game-session.js +186 -15
- package/dist/game-session.js.map +1 -1
- package/dist/game-settings.d.ts +16 -0
- package/dist/game-settings.js +237 -0
- package/dist/game-settings.js.map +1 -0
- package/dist/games.d.ts +11 -4
- package/dist/games.js +4 -2
- package/dist/harness/visual.d.ts +34 -151
- package/dist/harness/visual.js +6 -1
- package/dist/logs.d.ts +8 -2
- package/dist/logs.js +3 -4
- package/dist/logs.js.map +1 -1
- package/dist/managed-process-scope-BicYi_t9.d.ts +3 -0
- package/dist/mcp-config.js +2 -1
- package/dist/mcp-config.js.map +1 -1
- package/dist/platform-auth.d.ts +8 -111
- package/dist/platform-auth.js +9 -1
- package/dist/platform-game-analytics.d.ts +51 -0
- package/dist/platform-game-analytics.js +49 -0
- package/dist/platform-game-analytics.js.map +1 -0
- package/dist/platform-game-app-id.d.ts +46 -0
- package/dist/platform-game-app-id.js +93 -0
- package/dist/platform-game-app-id.js.map +1 -0
- package/dist/platform-game-media.d.ts +40 -2
- package/dist/platform-game-media.js +1 -1
- package/dist/platform-games.d.ts +24 -2
- package/dist/platform-games.js +16 -84
- package/dist/platform-games.js.map +1 -1
- package/dist/quality.d.ts +9 -3
- package/dist/quality.js +3 -4
- package/dist/quality.js.map +1 -1
- package/dist/release.d.ts +226 -16
- package/dist/release.js +18 -1331
- package/dist/release.js.map +1 -1
- package/dist/rooms-check.d.ts +90 -0
- package/dist/rooms-check.js +717 -0
- package/dist/rooms-check.js.map +1 -0
- package/dist/source-tree-contract.d.ts +16 -0
- package/dist/source-tree-contract.js +13 -0
- package/dist/source-tree-contract.js.map +1 -0
- package/dist/testing.d.ts +464 -0
- package/dist/testing.js +27 -0
- package/dist/testing.js.map +1 -0
- package/dist/tooling/describe-game.js +54 -0
- package/dist/tooling/describe-game.js.map +1 -0
- package/dist/tooling/game-session-broker.js +28 -0
- package/dist/tooling/game-session-broker.js.map +1 -0
- package/dist/tooling/hold-runtime-host.js +770 -68
- package/dist/tooling/hold-runtime-host.js.map +1 -1
- package/dist/tooling/list-visual-scenarios.js +18 -55
- package/dist/tooling/list-visual-scenarios.js.map +1 -1
- package/dist/tooling/process-scope-bootstrap.mjs +24 -0
- package/dist/tooling/process-scope-guard.d.ts +2 -0
- package/dist/tooling/process-scope-guard.js +388 -0
- package/dist/tooling/process-scope-guard.js.map +1 -0
- package/dist/tooling/process-scope-windows.ps1 +148 -0
- package/dist/tooling/rooms-check-device.d.ts +2 -0
- package/dist/tooling/rooms-check-device.js +498 -0
- package/dist/tooling/rooms-check-device.js.map +1 -0
- package/dist/tooling/run-headless-room.d.ts +2 -0
- package/dist/tooling/run-headless-room.js +288 -0
- package/dist/tooling/run-headless-room.js.map +1 -0
- package/dist/tooling/run-test-profile.d.ts +2 -0
- package/dist/tooling/run-test-profile.js +181 -0
- package/dist/tooling/run-test-profile.js.map +1 -0
- package/dist/tooling/run-visual-capture.js +70 -34
- package/dist/tooling/run-visual-capture.js.map +1 -1
- package/dist/tooling/seal-game-build.d.ts +2 -0
- package/dist/tooling/seal-game-build.js +120 -0
- package/dist/tooling/seal-game-build.js.map +1 -0
- package/dist/{types-C6NrHt88.d.ts → types-CdYrgrG_.d.ts} +337 -76
- package/dist/types-DyRD-ym1.d.ts +141 -0
- package/dist/visual.d.ts +9 -3
- package/dist/visual.js +24 -68
- package/dist/visual.js.map +1 -1
- package/package.json +51 -14
- package/src/bounded-response.ts +28 -0
- package/src/built-game-runtime.ts +152 -0
- package/src/context.ts +2 -13
- package/src/controller-protocol.ts +22 -0
- package/src/controller.ts +747 -597
- package/src/current-room-host.ts +166 -0
- package/src/decision-provider.ts +102 -0
- package/src/dependencies.ts +176 -0
- package/src/dependency-install-contract.ts +12 -0
- package/src/dev.ts +46 -50
- package/src/game-action-observation.ts +11 -1
- package/src/game-build-protocol.ts +72 -0
- package/src/game-build.ts +483 -0
- package/src/game-run-owner.ts +2358 -0
- package/src/game-run-protocol.ts +448 -0
- package/src/game-run-record.ts +92 -0
- package/src/game-run-replay.ts +95 -0
- package/src/game-run-watch.ts +155 -0
- package/src/game-session-broker.ts +689 -197
- package/src/game-session-operations.ts +61 -0
- package/src/game-session-protocol.ts +180 -0
- package/src/game-session-runtime.ts +861 -0
- package/src/game-session.ts +164 -417
- package/src/game-settings.ts +295 -0
- package/src/games.ts +88 -92
- package/src/harness/visual/browser.ts +100 -0
- package/src/harness/visual/controller-observation.ts +181 -0
- package/src/harness/visual/runner.ts +24 -21
- package/src/harness/visual/runtime-controller-observations.ts +151 -0
- package/src/harness/visual/scenario-contract.ts +1 -2
- package/src/harness/visual/scenario-helpers.ts +5 -1
- package/src/harness/visual/screencast.ts +155 -0
- package/src/harness/visual/session.ts +74 -69
- package/src/harness/visual/types.ts +8 -5
- package/src/headless-room-protocol.ts +112 -0
- package/src/headless-room.ts +222 -0
- package/src/helper-channel.ts +229 -0
- package/src/helper-scripts.ts +25 -5
- package/src/installed-dependencies.ts +74 -0
- package/src/managed-process-scope.ts +481 -0
- package/src/node-process-environment.ts +10 -0
- package/src/platform-auth.ts +194 -55
- package/src/platform-game-analytics.ts +50 -0
- package/src/platform-game-app-id.ts +99 -0
- package/src/platform-games.ts +13 -111
- package/src/policy-artifact-contract.ts +52 -0
- package/src/policy-artifacts.ts +134 -0
- package/src/process-scope-admission.ts +50 -0
- package/src/process-scope-protocol.ts +66 -0
- package/src/process-scope.ts +327 -0
- package/src/release.ts +28 -42
- package/src/rooms-check-fleet.ts +194 -0
- package/src/rooms-check-link.ts +138 -0
- package/src/rooms-check-protocol.ts +244 -0
- package/src/rooms-check.ts +797 -0
- package/src/runtime-owner-protocol.ts +106 -18
- package/src/source-tree-contract.ts +70 -0
- package/src/source-tree.ts +84 -0
- package/src/test-profile-process.ts +153 -0
- package/src/test-profile-protocol.ts +116 -0
- package/src/testing.ts +430 -0
- package/src/tooling/declaration-hook.ts +52 -0
- package/src/tooling/describe-game.ts +49 -0
- package/src/tooling/game-session-broker.ts +7 -0
- package/src/tooling/hold-runtime-host.ts +254 -42
- package/src/tooling/list-visual-scenarios.ts +19 -62
- package/src/tooling/load-game.ts +79 -0
- package/src/tooling/process-scope-bootstrap.mjs +24 -0
- package/src/tooling/process-scope-guard.ts +213 -0
- package/src/tooling/process-scope-windows.ps1 +148 -0
- package/src/tooling/rooms-check-device.ts +493 -0
- package/src/tooling/run-headless-room.ts +329 -0
- package/src/tooling/run-test-profile.ts +190 -0
- package/src/tooling/run-visual-capture.ts +37 -23
- package/src/tooling/runtime-owner-actions.ts +23 -0
- package/src/tooling/seal-game-build.ts +118 -0
- package/src/tooling/visual-pack.ts +10 -45
- package/src/types.ts +54 -77
- package/src/visual.ts +14 -22
- package/src/windows-process-scopes.ts +189 -0
- package/dist/agent.d.ts +0 -15
- package/dist/agent.js +0 -19
- package/dist/chunk-5YAARMW5.js +0 -36
- package/dist/chunk-5YAARMW5.js.map +0 -1
- package/dist/chunk-6WQODT37.js +0 -1019
- package/dist/chunk-6WQODT37.js.map +0 -1
- package/dist/chunk-CKFT2ZJE.js.map +0 -1
- package/dist/chunk-ER3Q2C4G.js +0 -358
- package/dist/chunk-ER3Q2C4G.js.map +0 -1
- package/dist/chunk-GUEZP773.js.map +0 -1
- package/dist/chunk-HIDNI56E.js +0 -33
- package/dist/chunk-HIDNI56E.js.map +0 -1
- package/dist/chunk-QKXS5D35.js +0 -43
- package/dist/chunk-QKXS5D35.js.map +0 -1
- package/dist/chunk-S4LSCEVE.js +0 -261
- package/dist/chunk-S4LSCEVE.js.map +0 -1
- package/dist/chunk-VKMJO6VN.js.map +0 -1
- package/dist/chunk-WFUR3MXY.js +0 -67
- package/dist/chunk-WFUR3MXY.js.map +0 -1
- package/dist/chunk-XEMR7KUE.js +0 -361
- package/dist/chunk-XEMR7KUE.js.map +0 -1
- package/dist/chunk-ZLPD7FY5.js +0 -191
- package/dist/chunk-ZLPD7FY5.js.map +0 -1
- package/dist/tooling/agent-contract.js +0 -193
- package/dist/tooling/agent-contract.js.map +0 -1
- package/dist/tooling/inspect-airjam-agent.js +0 -37
- package/dist/tooling/inspect-airjam-agent.js.map +0 -1
- package/src/agent.ts +0 -380
- package/src/tooling/agent-contract.ts +0 -232
- package/src/tooling/agent-declaration.ts +0 -36
- package/src/tooling/airjam-agent-inspection.ts +0 -45
- package/src/tooling/airjam-agent.ts +0 -118
- package/src/tooling/inspect-airjam-agent.ts +0 -20
- /package/dist/{agent.js.map → dependencies.js.map} +0 -0
- /package/dist/tooling/{agent-contract.d.ts → describe-game.d.ts} +0 -0
- /package/dist/tooling/{inspect-airjam-agent.d.ts → game-session-broker.d.ts} +0 -0
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
import { type AirJamAgentContract } from "@air-jam/sdk";
|
|
2
|
-
import {
|
|
3
|
-
describeAirJamAgentAction,
|
|
4
|
-
listAirJamAgentStoreDomains,
|
|
5
|
-
resolveAirJamAgentActionPayload,
|
|
6
|
-
} from "@air-jam/sdk/agent-tooling";
|
|
7
|
-
import { pathToFileURL } from "node:url";
|
|
8
|
-
import {
|
|
9
|
-
loadAgentContractFromConfig,
|
|
10
|
-
loadAirJamAppConfig,
|
|
11
|
-
resolveAirJamConfigGameId,
|
|
12
|
-
} from "./airjam-agent.js";
|
|
13
|
-
|
|
14
|
-
const getFlagValue = (flag: string): string | null => {
|
|
15
|
-
const inline = process.argv.find((value) => value.startsWith(`${flag}=`));
|
|
16
|
-
if (inline) {
|
|
17
|
-
return inline.slice(flag.length + 1);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const index = process.argv.indexOf(flag);
|
|
21
|
-
return index === -1 ? null : (process.argv[index + 1] ?? null);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const operation = getFlagValue("--operation");
|
|
25
|
-
const contractPath = getFlagValue("--contract");
|
|
26
|
-
const configPath = getFlagValue("--config");
|
|
27
|
-
const gameId = getFlagValue("--game-id");
|
|
28
|
-
|
|
29
|
-
if (!operation || (!contractPath && !configPath)) {
|
|
30
|
-
throw new Error(
|
|
31
|
-
"Missing required --operation and (--config or --contract) input for Air Jam agent contract helper.",
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const resolveContractFromModule = async (
|
|
36
|
-
nextContractPath: string,
|
|
37
|
-
): Promise<AirJamAgentContract | null> => {
|
|
38
|
-
const contractModule = (await import(
|
|
39
|
-
pathToFileURL(nextContractPath).toString()
|
|
40
|
-
)) as {
|
|
41
|
-
default?: AirJamAgentContract;
|
|
42
|
-
agentContract?: AirJamAgentContract;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
return contractModule.agentContract ?? contractModule.default ?? null;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const inspectedConfig =
|
|
49
|
-
configPath && operation === "inspect"
|
|
50
|
-
? await loadAirJamAppConfig(configPath)
|
|
51
|
-
: null;
|
|
52
|
-
|
|
53
|
-
const resolvedContract: AirJamAgentContract | null = inspectedConfig
|
|
54
|
-
? (inspectedConfig.agent ?? null)
|
|
55
|
-
: configPath
|
|
56
|
-
? await loadAgentContractFromConfig(configPath)
|
|
57
|
-
: await resolveContractFromModule(contractPath!);
|
|
58
|
-
|
|
59
|
-
if (!resolvedContract) {
|
|
60
|
-
if (configPath && operation === "inspect") {
|
|
61
|
-
process.stdout.write(
|
|
62
|
-
`${JSON.stringify(
|
|
63
|
-
{
|
|
64
|
-
hasContract: false,
|
|
65
|
-
},
|
|
66
|
-
null,
|
|
67
|
-
2,
|
|
68
|
-
)}\n`,
|
|
69
|
-
);
|
|
70
|
-
process.exit(0);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
throw new Error(
|
|
74
|
-
configPath
|
|
75
|
-
? `Air Jam config "${configPath}" does not export a valid agent contract.`
|
|
76
|
-
: `Agent contract module "${contractPath}" does not export agentContract.`,
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (operation === "inspect") {
|
|
81
|
-
const snapshotStoreDomains = listAirJamAgentStoreDomains(resolvedContract);
|
|
82
|
-
process.stdout.write(
|
|
83
|
-
`${JSON.stringify(
|
|
84
|
-
{
|
|
85
|
-
hasContract: true,
|
|
86
|
-
snapshotStoreDomains,
|
|
87
|
-
snapshotDescription: resolvedContract.snapshotDescription ?? null,
|
|
88
|
-
actions: Object.entries(resolvedContract.actions).map(
|
|
89
|
-
([actionId, action]) => {
|
|
90
|
-
const metadata = describeAirJamAgentAction(action);
|
|
91
|
-
return {
|
|
92
|
-
actionId,
|
|
93
|
-
target: {
|
|
94
|
-
kind: action.target.kind,
|
|
95
|
-
actionName: action.target.actionName,
|
|
96
|
-
storeDomain: action.target.storeDomain ?? "default",
|
|
97
|
-
},
|
|
98
|
-
description: metadata.description ?? null,
|
|
99
|
-
availability: action.availability ?? null,
|
|
100
|
-
payload: {
|
|
101
|
-
kind: metadata.payload.kind,
|
|
102
|
-
description: metadata.payload.description ?? null,
|
|
103
|
-
...(metadata.payload.allowedValues
|
|
104
|
-
? { allowedValues: [...metadata.payload.allowedValues] }
|
|
105
|
-
: {}),
|
|
106
|
-
},
|
|
107
|
-
resultDescription: metadata.resultDescription ?? null,
|
|
108
|
-
};
|
|
109
|
-
},
|
|
110
|
-
),
|
|
111
|
-
},
|
|
112
|
-
null,
|
|
113
|
-
2,
|
|
114
|
-
)}\n`,
|
|
115
|
-
);
|
|
116
|
-
process.exit(0);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (operation === "project") {
|
|
120
|
-
const controllerId = getFlagValue("--controller-id");
|
|
121
|
-
const storesPayload = getFlagValue("--stores-base64");
|
|
122
|
-
if (!storesPayload) {
|
|
123
|
-
throw new Error("Missing required --stores-base64 input.");
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
const stores = JSON.parse(
|
|
127
|
-
Buffer.from(storesPayload, "base64url").toString("utf8"),
|
|
128
|
-
) as Record<string, Record<string, unknown>>;
|
|
129
|
-
const snapshot = await resolvedContract.projectSnapshot({
|
|
130
|
-
controllerId: controllerId?.trim() || null,
|
|
131
|
-
stores,
|
|
132
|
-
});
|
|
133
|
-
process.stdout.write(
|
|
134
|
-
`${JSON.stringify(
|
|
135
|
-
{
|
|
136
|
-
snapshot,
|
|
137
|
-
},
|
|
138
|
-
null,
|
|
139
|
-
2,
|
|
140
|
-
)}\n`,
|
|
141
|
-
);
|
|
142
|
-
process.exit(0);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if (operation === "read-action") {
|
|
146
|
-
const actionId = getFlagValue("--action-id");
|
|
147
|
-
if (!actionId) {
|
|
148
|
-
throw new Error("Missing required --action-id input.");
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
const action = resolvedContract.actions[actionId];
|
|
152
|
-
if (!action) {
|
|
153
|
-
throw new Error(`Unknown agent action "${actionId}".`);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
process.stdout.write(
|
|
157
|
-
`${JSON.stringify(
|
|
158
|
-
(() => {
|
|
159
|
-
const metadata = describeAirJamAgentAction(action);
|
|
160
|
-
return {
|
|
161
|
-
actionId,
|
|
162
|
-
target: {
|
|
163
|
-
kind: action.target.kind,
|
|
164
|
-
actionName: action.target.actionName,
|
|
165
|
-
storeDomain: action.target.storeDomain ?? "default",
|
|
166
|
-
},
|
|
167
|
-
description: metadata.description ?? null,
|
|
168
|
-
availability: action.availability ?? null,
|
|
169
|
-
payload: {
|
|
170
|
-
kind: metadata.payload.kind,
|
|
171
|
-
description: metadata.payload.description ?? null,
|
|
172
|
-
...(metadata.payload.allowedValues
|
|
173
|
-
? { allowedValues: [...metadata.payload.allowedValues] }
|
|
174
|
-
: {}),
|
|
175
|
-
},
|
|
176
|
-
resultDescription: metadata.resultDescription ?? null,
|
|
177
|
-
};
|
|
178
|
-
})(),
|
|
179
|
-
null,
|
|
180
|
-
2,
|
|
181
|
-
)}\n`,
|
|
182
|
-
);
|
|
183
|
-
process.exit(0);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
if (operation === "resolve-input") {
|
|
187
|
-
const actionId = getFlagValue("--action-id");
|
|
188
|
-
const payloadBase64 = getFlagValue("--payload-base64");
|
|
189
|
-
if (!actionId || !payloadBase64) {
|
|
190
|
-
throw new Error("Missing required --action-id or --payload-base64 input.");
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
const action = resolvedContract.actions[actionId];
|
|
194
|
-
if (!action) {
|
|
195
|
-
throw new Error(`Unknown agent action "${actionId}".`);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
const payload = JSON.parse(
|
|
199
|
-
Buffer.from(payloadBase64, "base64url").toString("utf8"),
|
|
200
|
-
) as unknown;
|
|
201
|
-
const resolvedPayload = resolveAirJamAgentActionPayload(action, payload, {
|
|
202
|
-
gameId:
|
|
203
|
-
gameId ??
|
|
204
|
-
(configPath
|
|
205
|
-
? (resolveAirJamConfigGameId(await loadAirJamAppConfig(configPath)) ??
|
|
206
|
-
"unknown-game")
|
|
207
|
-
: "unknown-game"),
|
|
208
|
-
actionName: actionId,
|
|
209
|
-
contractKind: "agent",
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
process.stdout.write(
|
|
213
|
-
`${JSON.stringify(
|
|
214
|
-
{
|
|
215
|
-
actionId,
|
|
216
|
-
target: {
|
|
217
|
-
kind: action.target.kind,
|
|
218
|
-
actionName: action.target.actionName,
|
|
219
|
-
storeDomain: action.target.storeDomain ?? "default",
|
|
220
|
-
},
|
|
221
|
-
payload: resolvedPayload ?? null,
|
|
222
|
-
},
|
|
223
|
-
null,
|
|
224
|
-
2,
|
|
225
|
-
)}\n`,
|
|
226
|
-
);
|
|
227
|
-
process.exit(0);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
throw new Error(
|
|
231
|
-
`Unknown Air Jam agent contract helper operation "${operation}".`,
|
|
232
|
-
);
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import { loadAirJamAppConfig } from "./airjam-agent.js";
|
|
3
|
-
|
|
4
|
-
type InternalVisualHarnessDeclaration = {
|
|
5
|
-
visualScenariosModule?: unknown;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export type AirJamAgentDeclaration = {
|
|
9
|
-
hasAgent: boolean;
|
|
10
|
-
visualScenariosModulePath: string | null;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const inspectAirJamAgentDeclaration = async (
|
|
14
|
-
configPath: string,
|
|
15
|
-
): Promise<AirJamAgentDeclaration> => {
|
|
16
|
-
const airjam = await loadAirJamAppConfig(configPath);
|
|
17
|
-
const moduleSpecifier =
|
|
18
|
-
(airjam as InternalVisualHarnessDeclaration).visualScenariosModule ?? null;
|
|
19
|
-
|
|
20
|
-
if (
|
|
21
|
-
moduleSpecifier !== null &&
|
|
22
|
-
(typeof moduleSpecifier !== "string" || moduleSpecifier.trim() === "")
|
|
23
|
-
) {
|
|
24
|
-
throw new Error(
|
|
25
|
-
`Air Jam config "${configPath}" exports an invalid visualScenariosModule value.`,
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return {
|
|
30
|
-
hasAgent: Boolean(airjam.agent),
|
|
31
|
-
visualScenariosModulePath:
|
|
32
|
-
typeof moduleSpecifier === "string"
|
|
33
|
-
? path.resolve(path.dirname(configPath), moduleSpecifier)
|
|
34
|
-
: null,
|
|
35
|
-
};
|
|
36
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import { runCommandResult } from "../commands.js";
|
|
3
|
-
import {
|
|
4
|
-
resolveDevtoolsHelperArgs,
|
|
5
|
-
resolveDevtoolsHelperScript,
|
|
6
|
-
} from "../helper-scripts.js";
|
|
7
|
-
|
|
8
|
-
type AirJamAgentInspection = {
|
|
9
|
-
hasAgent: boolean;
|
|
10
|
-
visualScenariosModulePath: string | null;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const parseHelperJson = <T>(output: string): T => {
|
|
14
|
-
const startIndex = output.indexOf("{");
|
|
15
|
-
const endIndex = output.lastIndexOf("}");
|
|
16
|
-
if (startIndex === -1 || endIndex === -1 || endIndex < startIndex) {
|
|
17
|
-
throw new Error(`Expected JSON helper output but received:\n${output}`);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return JSON.parse(output.slice(startIndex, endIndex + 1)) as T;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export const inspectAirJamAgentConfig = async (
|
|
24
|
-
configPath: string,
|
|
25
|
-
): Promise<AirJamAgentInspection> => {
|
|
26
|
-
const result = runCommandResult({
|
|
27
|
-
command: process.execPath,
|
|
28
|
-
args: [
|
|
29
|
-
...resolveDevtoolsHelperArgs(
|
|
30
|
-
resolveDevtoolsHelperScript("inspect-airjam-agent.ts"),
|
|
31
|
-
),
|
|
32
|
-
"--config",
|
|
33
|
-
configPath,
|
|
34
|
-
],
|
|
35
|
-
cwd: path.dirname(configPath),
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
if (!result.ok) {
|
|
39
|
-
throw new Error(
|
|
40
|
-
`Air Jam agent config helper failed.\n\n${result.stderr || result.stdout}`,
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return parseHelperJson<AirJamAgentInspection>(result.stdout);
|
|
45
|
-
};
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import type { AirJamAgentContract, AirJamApp } from "@air-jam/sdk";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { pathToFileURL } from "node:url";
|
|
4
|
-
import type {
|
|
5
|
-
AnyAirJamAgentContract,
|
|
6
|
-
VisualScenarioPack,
|
|
7
|
-
} from "../harness/visual.js";
|
|
8
|
-
|
|
9
|
-
type AirJamConfigModule = {
|
|
10
|
-
airjam?: AirJamApp;
|
|
11
|
-
default?: AirJamApp;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
type InternalVisualHarnessDeclaration = {
|
|
15
|
-
visualScenariosModule?: unknown;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const readPublishedAgent = (
|
|
19
|
-
airjam: AirJamApp,
|
|
20
|
-
): {
|
|
21
|
-
agent: AirJamAgentContract | null;
|
|
22
|
-
visualScenariosModule: string | null;
|
|
23
|
-
} => ({
|
|
24
|
-
agent: airjam.agent ?? null,
|
|
25
|
-
visualScenariosModule:
|
|
26
|
-
((airjam as InternalVisualHarnessDeclaration).visualScenariosModule as
|
|
27
|
-
| string
|
|
28
|
-
| null
|
|
29
|
-
| undefined) ?? null,
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const isVisualScenarioPack = (
|
|
33
|
-
value: unknown,
|
|
34
|
-
): value is VisualScenarioPack<AnyAirJamAgentContract> =>
|
|
35
|
-
Boolean(
|
|
36
|
-
value &&
|
|
37
|
-
typeof value === "object" &&
|
|
38
|
-
"agent" in (value as Record<string, unknown>) &&
|
|
39
|
-
Array.isArray((value as { scenarios?: unknown[] }).scenarios),
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
export const resolveAirJamConfigGameId = (airjam: AirJamApp): string | null =>
|
|
43
|
-
airjam.metadata?.slug ?? null;
|
|
44
|
-
|
|
45
|
-
export const loadAirJamAppConfig = async (
|
|
46
|
-
configPath: string,
|
|
47
|
-
): Promise<AirJamApp> => {
|
|
48
|
-
const loaded = (await import(
|
|
49
|
-
pathToFileURL(configPath).href
|
|
50
|
-
)) as AirJamConfigModule;
|
|
51
|
-
const airjam = loaded.airjam ?? loaded.default ?? null;
|
|
52
|
-
|
|
53
|
-
if (!airjam || typeof airjam !== "object") {
|
|
54
|
-
throw new Error(
|
|
55
|
-
`Air Jam config module "${configPath}" does not export an airjam app config.`,
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return airjam;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export const loadAgentContractFromConfig = async (
|
|
63
|
-
configPath: string,
|
|
64
|
-
): Promise<AirJamAgentContract> => {
|
|
65
|
-
const airjam = await loadAirJamAppConfig(configPath);
|
|
66
|
-
const contract = readPublishedAgent(airjam).agent;
|
|
67
|
-
|
|
68
|
-
if (!contract) {
|
|
69
|
-
throw new Error(`Air Jam config "${configPath}" does not publish agent.`);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return contract;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export const resolveVisualScenarioModulePathFromConfig = async (
|
|
76
|
-
configPath: string,
|
|
77
|
-
): Promise<string | null> => {
|
|
78
|
-
const airjam = await loadAirJamAppConfig(configPath);
|
|
79
|
-
const moduleSpecifier = readPublishedAgent(airjam).visualScenariosModule;
|
|
80
|
-
|
|
81
|
-
if (!moduleSpecifier) {
|
|
82
|
-
return null;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (typeof moduleSpecifier !== "string" || moduleSpecifier.trim() === "") {
|
|
86
|
-
throw new Error(
|
|
87
|
-
`Air Jam config "${configPath}" exports an invalid visualScenariosModule value.`,
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return path.resolve(path.dirname(configPath), moduleSpecifier);
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
export const loadVisualScenarioPackFromConfig = async (
|
|
95
|
-
configPath: string,
|
|
96
|
-
): Promise<VisualScenarioPack<AnyAirJamAgentContract>> => {
|
|
97
|
-
const modulePath =
|
|
98
|
-
await resolveVisualScenarioModulePathFromConfig(configPath);
|
|
99
|
-
if (!modulePath) {
|
|
100
|
-
throw new Error(
|
|
101
|
-
`Air Jam config "${configPath}" does not publish visualScenariosModule.`,
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const loaded = (await import(pathToFileURL(modulePath).href)) as {
|
|
106
|
-
visualScenarios?: VisualScenarioPack<AnyAirJamAgentContract>;
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
const scenarioPack = loaded.visualScenarios ?? null;
|
|
110
|
-
|
|
111
|
-
if (!isVisualScenarioPack(scenarioPack)) {
|
|
112
|
-
throw new Error(
|
|
113
|
-
`Air Jam visual scenarios module "${modulePath}" does not export a valid scenario pack.`,
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
return scenarioPack;
|
|
118
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { inspectAirJamAgentDeclaration } from "./agent-declaration.js";
|
|
2
|
-
|
|
3
|
-
const getFlagValue = (flag: string): string | null => {
|
|
4
|
-
const inline = process.argv.find((value) => value.startsWith(`${flag}=`));
|
|
5
|
-
if (inline) {
|
|
6
|
-
return inline.slice(flag.length + 1);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const index = process.argv.indexOf(flag);
|
|
10
|
-
return index === -1 ? null : (process.argv[index + 1] ?? null);
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const configPath = getFlagValue("--config");
|
|
14
|
-
|
|
15
|
-
if (!configPath) {
|
|
16
|
-
throw new Error("Missing required --config input for Air Jam agent helper.");
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const inspection = await inspectAirJamAgentDeclaration(configPath);
|
|
20
|
-
process.stdout.write(`${JSON.stringify(inspection, null, 2)}\n`);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|