@air-jam/sdk 0.1.4 → 0.9.0
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 +627 -57
- package/dist/agent-tooling-BSMGBix9.d.cts +123 -0
- package/dist/agent-tooling-BSMGBix9.d.ts +123 -0
- package/dist/agent-tooling.cjs +83 -0
- package/dist/agent-tooling.cjs.map +1 -0
- package/dist/agent-tooling.d.cts +2 -0
- package/dist/agent-tooling.d.ts +2 -0
- package/dist/agent-tooling.js +17 -0
- package/dist/agent-tooling.js.map +1 -0
- package/dist/arcade/bridge/controller.cjs +749 -0
- package/dist/arcade/bridge/controller.cjs.map +1 -0
- package/dist/arcade/bridge/controller.d.cts +85 -0
- package/dist/arcade/bridge/controller.d.ts +85 -0
- package/dist/arcade/bridge/controller.js +33 -0
- package/dist/arcade/bridge/controller.js.map +1 -0
- package/dist/arcade/bridge/host.cjs +421 -0
- package/dist/arcade/bridge/host.cjs.map +1 -0
- package/dist/arcade/bridge/host.d.cts +73 -0
- package/dist/arcade/bridge/host.d.ts +73 -0
- package/dist/arcade/bridge/host.js +25 -0
- package/dist/arcade/bridge/host.js.map +1 -0
- package/dist/arcade/bridge/iframe.cjs +453 -0
- package/dist/arcade/bridge/iframe.cjs.map +1 -0
- package/dist/arcade/bridge/iframe.d.cts +80 -0
- package/dist/arcade/bridge/iframe.d.ts +80 -0
- package/dist/arcade/bridge/iframe.js +28 -0
- package/dist/arcade/bridge/iframe.js.map +1 -0
- package/dist/arcade/bridge.cjs +1067 -0
- package/dist/arcade/bridge.cjs.map +1 -0
- package/dist/arcade/bridge.d.cts +11 -0
- package/dist/arcade/bridge.d.ts +11 -0
- package/dist/arcade/bridge.js +76 -0
- package/dist/arcade/bridge.js.map +1 -0
- package/dist/arcade/host.cjs +488 -0
- package/dist/arcade/host.cjs.map +1 -0
- package/dist/arcade/host.d.cts +19 -0
- package/dist/arcade/host.d.ts +19 -0
- package/dist/arcade/host.js +13 -0
- package/dist/arcade/host.js.map +1 -0
- package/dist/arcade/surface.cjs +113 -0
- package/dist/arcade/surface.cjs.map +1 -0
- package/dist/arcade/surface.d.cts +14 -0
- package/dist/arcade/surface.d.ts +14 -0
- package/dist/arcade/surface.js +27 -0
- package/dist/arcade/surface.js.map +1 -0
- package/dist/arcade/url.cjs +363 -0
- package/dist/arcade/url.cjs.map +1 -0
- package/dist/arcade/url.d.cts +68 -0
- package/dist/arcade/url.d.ts +68 -0
- package/dist/arcade/url.js +28 -0
- package/dist/arcade/url.js.map +1 -0
- package/dist/arcade-runtime-url-BW-MUAOY.d.cts +28 -0
- package/dist/arcade-runtime-url-l8qj01Pg.d.ts +28 -0
- package/dist/arcade-surface-identity-CQxDpn_w.d.cts +16 -0
- package/dist/arcade-surface-identity-CQxDpn_w.d.ts +16 -0
- package/dist/arcade.cjs +1565 -0
- package/dist/arcade.cjs.map +1 -0
- package/dist/arcade.d.cts +18 -0
- package/dist/arcade.d.ts +18 -0
- package/dist/arcade.js +122 -0
- package/dist/arcade.js.map +1 -0
- package/dist/capabilities.cjs +39 -0
- package/dist/capabilities.cjs.map +1 -0
- package/dist/capabilities.d.cts +31 -0
- package/dist/capabilities.d.ts +31 -0
- package/dist/capabilities.js +12 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/chunk-2432OL7L.js +193 -0
- package/dist/chunk-2432OL7L.js.map +1 -0
- package/dist/chunk-2J65FXEP.js +41 -0
- package/dist/chunk-2J65FXEP.js.map +1 -0
- package/dist/chunk-32NYL7XI.js +539 -0
- package/dist/chunk-32NYL7XI.js.map +1 -0
- package/dist/chunk-3USU7GY2.js +54 -0
- package/dist/chunk-3USU7GY2.js.map +1 -0
- package/dist/chunk-BE6Z4SIT.js +65 -0
- package/dist/chunk-BE6Z4SIT.js.map +1 -0
- package/dist/chunk-CQUG24WX.js +249 -0
- package/dist/chunk-CQUG24WX.js.map +1 -0
- package/dist/chunk-D3X4MN4U.js +288 -0
- package/dist/chunk-D3X4MN4U.js.map +1 -0
- package/dist/chunk-EVZJA6RN.js +140 -0
- package/dist/chunk-EVZJA6RN.js.map +1 -0
- package/dist/chunk-HFWRZVZ3.js +1438 -0
- package/dist/chunk-HFWRZVZ3.js.map +1 -0
- package/dist/chunk-IKKDONQL.js +1 -0
- package/dist/chunk-IKKDONQL.js.map +1 -0
- package/dist/chunk-JTF47B56.js +1 -0
- package/dist/chunk-JTF47B56.js.map +1 -0
- package/dist/chunk-LIXPF4P6.js +22 -0
- package/dist/chunk-LIXPF4P6.js.map +1 -0
- package/dist/chunk-MKBASO6X.js +216 -0
- package/dist/chunk-MKBASO6X.js.map +1 -0
- package/dist/chunk-MPDMJIX5.js +1 -0
- package/dist/chunk-MPDMJIX5.js.map +1 -0
- package/dist/chunk-NCL6WJCL.js +91 -0
- package/dist/chunk-NCL6WJCL.js.map +1 -0
- package/dist/chunk-NU5W6VAV.js +126 -0
- package/dist/chunk-NU5W6VAV.js.map +1 -0
- package/dist/chunk-TGRTEWYV.js +195 -0
- package/dist/chunk-TGRTEWYV.js.map +1 -0
- package/dist/chunk-VDRNNGHX.js +184 -0
- package/dist/chunk-VDRNNGHX.js.map +1 -0
- package/dist/chunk-VN5LDWVN.js +32 -0
- package/dist/chunk-VN5LDWVN.js.map +1 -0
- package/dist/chunk-W2VK36RO.js +11 -0
- package/dist/chunk-W2VK36RO.js.map +1 -0
- package/dist/chunk-X24K52DG.js +12 -0
- package/dist/chunk-X24K52DG.js.map +1 -0
- package/dist/chunk-XLUWV45V.js +25 -0
- package/dist/chunk-XLUWV45V.js.map +1 -0
- package/dist/chunk-Y4RAPKKB.js +238 -0
- package/dist/chunk-Y4RAPKKB.js.map +1 -0
- package/dist/chunk-YXHH3MQT.js +230 -0
- package/dist/chunk-YXHH3MQT.js.map +1 -0
- package/dist/chunk-ZLPL2R3R.js +183 -0
- package/dist/chunk-ZLPL2R3R.js.map +1 -0
- package/dist/chunk-ZTQ5SP4H.js +9 -0
- package/dist/chunk-ZTQ5SP4H.js.map +1 -0
- package/dist/controller-Bod8YYr1.d.cts +172 -0
- package/dist/controller-DxVchfiA.d.ts +172 -0
- package/dist/dev-log-events-CVAM29hx.d.cts +123 -0
- package/dist/dev-log-events-CVAM29hx.d.ts +123 -0
- package/dist/handshake-CC_LrK5g.d.cts +31 -0
- package/dist/handshake-CC_LrK5g.d.ts +31 -0
- package/dist/host-8hmq_Sgc.d.cts +109 -0
- package/dist/host-Cw-N6e-5.d.ts +109 -0
- package/dist/index.cjs +8507 -3523
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +676 -1070
- package/dist/index.d.ts +676 -1070
- package/dist/index.js +4890 -3196
- package/dist/index.js.map +1 -1
- package/dist/metadata.cjs +114 -0
- package/dist/metadata.cjs.map +1 -0
- package/dist/metadata.d.cts +95 -0
- package/dist/metadata.d.ts +95 -0
- package/dist/metadata.js +83 -0
- package/dist/metadata.js.map +1 -0
- package/dist/notices-CnGaaS8B.d.ts +38 -0
- package/dist/notices-NyDM5Mtz.d.cts +38 -0
- package/dist/platform-machine.cjs +425 -0
- package/dist/platform-machine.cjs.map +1 -0
- package/dist/platform-machine.d.cts +1183 -0
- package/dist/platform-machine.d.ts +1183 -0
- package/dist/platform-machine.js +309 -0
- package/dist/platform-machine.js.map +1 -0
- package/dist/platform-settings-cuor3i11.d.cts +48 -0
- package/dist/platform-settings-cuor3i11.d.ts +48 -0
- package/dist/prefabs.cjs +36 -0
- package/dist/prefabs.cjs.map +1 -0
- package/dist/prefabs.d.cts +49 -0
- package/dist/prefabs.d.ts +49 -0
- package/dist/prefabs.js +8 -0
- package/dist/prefabs.js.map +1 -0
- package/dist/preview.cjs +2609 -0
- package/dist/preview.cjs.map +1 -0
- package/dist/preview.d.cts +155 -0
- package/dist/preview.d.ts +155 -0
- package/dist/preview.js +1671 -0
- package/dist/preview.js.map +1 -0
- package/dist/protocol.cjs +621 -54
- package/dist/protocol.cjs.map +1 -1
- package/dist/protocol.d.cts +76 -240
- package/dist/protocol.d.ts +76 -240
- package/dist/protocol.js +100 -2
- package/dist/protocol.js.map +1 -1
- package/dist/realtime-client-Cu8yVJFw.d.cts +15 -0
- package/dist/realtime-client-Cu8yVJFw.d.ts +15 -0
- package/dist/release.cjs +143 -0
- package/dist/release.cjs.map +1 -0
- package/dist/release.d.cts +64 -0
- package/dist/release.d.ts +64 -0
- package/dist/release.js +43 -0
- package/dist/release.js.map +1 -0
- package/dist/standard-match-phase-BucA5dYo.d.ts +44 -0
- package/dist/standard-match-phase-U2ra8J-0.d.cts +44 -0
- package/dist/sync-B6QsNrXz.d.cts +125 -0
- package/dist/sync-B6QsNrXz.d.ts +125 -0
- package/dist/ui.cjs +2827 -0
- package/dist/ui.cjs.map +1 -0
- package/dist/ui.d.cts +320 -0
- package/dist/ui.d.ts +320 -0
- package/dist/ui.js +1718 -0
- package/dist/ui.js.map +1 -0
- package/dist/url-policy-C89zxgw9.d.cts +9 -0
- package/dist/url-policy-C89zxgw9.d.ts +9 -0
- package/package.json +149 -11
- package/src/agent/agent-action.ts +304 -0
- package/src/agent/agent-contract.ts +180 -0
- package/src/agent-tooling.ts +20 -0
- package/src/arcade/bridge/controller.ts +15 -0
- package/src/arcade/bridge/host.ts +12 -0
- package/src/arcade/bridge/iframe.ts +61 -0
- package/src/arcade/bridge.ts +3 -0
- package/src/arcade/host.ts +1 -0
- package/src/arcade/surface.ts +4 -0
- package/src/arcade/url.ts +60 -0
- package/src/arcade.ts +4 -0
- package/src/audio/audio-manager.ts +162 -171
- package/src/audio/hooks.tsx +218 -97
- package/src/audio/index.ts +1 -1
- package/src/audio/music.tsx +139 -0
- package/src/capabilities/manifest.ts +71 -0
- package/src/capabilities.ts +12 -0
- package/src/components/connection-status-pill.tsx +55 -0
- package/src/components/controller-player-name-field.tsx +119 -0
- package/src/components/controller-primary-action.tsx +58 -0
- package/src/components/host-mute-button.tsx +49 -0
- package/src/components/join-qr-overlay.tsx +133 -0
- package/src/components/join-url-action-buttons.tsx +95 -0
- package/src/components/join-url-controls.tsx +58 -0
- package/src/components/join-url-field.tsx +52 -0
- package/src/components/lifecycle-action-group.tsx +129 -0
- package/src/components/player-avatar-strip.tsx +65 -0
- package/src/components/player-avatar.tsx +42 -13
- package/src/components/room-qr-code.tsx +125 -0
- package/src/components/runtime-shell-header.tsx +37 -0
- package/src/components/shell-classes.ts +19 -0
- package/src/components/surface-orientation-layout.ts +60 -0
- package/src/components/surface-viewport-layout.ts +268 -0
- package/src/components/surface-viewport.tsx +314 -0
- package/src/components/ui/button.tsx +4 -6
- package/src/components/ui/slider.tsx +1 -1
- package/src/components/volume-controls.tsx +65 -6
- package/src/context/air-jam-context.tsx +209 -161
- package/src/context/index.ts +2 -2
- package/src/context/session-providers.tsx +77 -0
- package/src/context/session-scope.ts +64 -0
- package/src/context/socket-manager.ts +6 -24
- package/src/contracts/v2/bridge.ts +261 -0
- package/src/contracts/v2/handshake.ts +40 -0
- package/src/contracts/v2/index.ts +2 -0
- package/src/dev/browser-log-sink.ts +912 -0
- package/src/diagnostics.ts +128 -0
- package/src/events.ts +7 -34
- package/src/hooks/internal/use-controller-runtime-api.ts +875 -0
- package/src/hooks/internal/use-host-runtime-api.ts +1051 -0
- package/src/hooks/internal/use-runtime-control-contract.ts +15 -0
- package/src/hooks/internal/use-runtime-inspection-contract.ts +16 -0
- package/src/hooks/internal/use-runtime-observability-contract.ts +24 -0
- package/src/hooks/use-air-jam-controller.ts +155 -475
- package/src/hooks/use-air-jam-host.ts +156 -485
- package/src/hooks/use-connection-status.ts +8 -0
- package/src/hooks/use-controller-lifecycle-intents.ts +27 -0
- package/src/hooks/use-controller-lifecycle-permissions.ts +36 -0
- package/src/hooks/use-controller-shell-status.ts +40 -0
- package/src/hooks/use-controller-tick.ts +65 -0
- package/src/hooks/use-controller-toasts.ts +116 -0
- package/src/hooks/use-get-input.ts +8 -5
- package/src/hooks/use-host-arcade-restore.ts +30 -0
- package/src/hooks/use-host-join-controls.ts +152 -0
- package/src/hooks/use-host-tick.ts +171 -0
- package/src/hooks/use-input-writer.ts +83 -0
- package/src/hooks/use-lifecycle-action-group-model.ts +98 -0
- package/src/hooks/use-players.ts +12 -0
- package/src/hooks/use-room.ts +22 -0
- package/src/hooks/use-send-signal.ts +6 -2
- package/src/index.ts +205 -31
- package/src/internal/input-manager.ts +195 -215
- package/src/lifecycle/index.ts +9 -0
- package/src/lifecycle/standard-match-phase.ts +32 -0
- package/src/metadata/manifest.ts +152 -0
- package/src/metadata.ts +12 -0
- package/src/platform-machine.ts +475 -0
- package/src/prefabs/types.ts +82 -0
- package/src/prefabs.ts +12 -0
- package/src/preview/host-workspace.tsx +59 -0
- package/src/preview/identity.ts +66 -0
- package/src/preview/layout.ts +223 -0
- package/src/preview/manager.ts +577 -0
- package/src/preview/messages.ts +26 -0
- package/src/preview/ownership.ts +81 -0
- package/src/preview/url.ts +117 -0
- package/src/preview/window.tsx +490 -0
- package/src/preview/workspace.tsx +678 -0
- package/src/preview.ts +42 -0
- package/src/protocol/arcade-platform-actions.ts +29 -0
- package/src/protocol/controller.ts +187 -0
- package/src/protocol/core.ts +23 -0
- package/src/protocol/dev-log-events.ts +222 -0
- package/src/protocol/errors.ts +21 -0
- package/src/protocol/host-grant.ts +185 -0
- package/src/protocol/host.ts +138 -0
- package/src/protocol/notices.ts +43 -0
- package/src/protocol/signals.ts +38 -0
- package/src/protocol/socket-events.ts +154 -0
- package/src/protocol/sync.ts +121 -0
- package/src/protocol/url-policy.ts +63 -0
- package/src/protocol.ts +12 -386
- package/src/qrcode.d.ts +16 -0
- package/src/release.ts +99 -0
- package/src/runtime/air-jam-config.ts +287 -0
- package/src/runtime/air-jam-error-boundary.tsx +672 -0
- package/src/runtime/arcade-bridge-request-surface.ts +15 -0
- package/src/runtime/arcade-runtime-url.ts +95 -0
- package/src/runtime/arcade-surface-identity.ts +16 -0
- package/src/runtime/contracts/control.ts +68 -0
- package/src/runtime/contracts/inspection.ts +165 -0
- package/src/runtime/contracts/observability.ts +94 -0
- package/src/runtime/controller-bridge.ts +451 -0
- package/src/runtime/controller-identity.ts +132 -0
- package/src/runtime/controller-presentation.ts +24 -0
- package/src/runtime/controller-realtime-client.ts +591 -0
- package/src/runtime/create-air-jam-app.tsx +260 -0
- package/src/runtime/dev-runtime-events.ts +36 -0
- package/src/runtime/embedded-runtime-adapters.ts +68 -0
- package/src/runtime/host-bridge.ts +388 -0
- package/src/runtime/host-realtime-client.ts +550 -0
- package/src/runtime/iframe-bridge.ts +135 -0
- package/src/runtime/realtime-client.ts +20 -0
- package/src/runtime/router-basename.ts +25 -0
- package/src/runtime/runtime-owner-contexts.tsx +4 -0
- package/src/runtime/runtime-session-params.ts +169 -0
- package/src/runtime/sdk-version.ts +6 -0
- package/src/runtime/session-runtimes.tsx +188 -0
- package/src/runtime/validate-arcade-bridge-attach.ts +14 -0
- package/src/runtime-control.ts +10 -0
- package/src/runtime-inspection.ts +14 -0
- package/src/runtime-observability.ts +9 -0
- package/src/settings/platform-settings-bridge.ts +336 -0
- package/src/settings/platform-settings-runtime.tsx +387 -0
- package/src/settings/platform-settings.ts +288 -0
- package/src/state/connection-store.ts +80 -12
- package/src/store/air-jam-store-domain-constants.ts +4 -0
- package/src/store/create-air-jam-store.ts +1094 -227
- package/src/styles.css +4 -38
- package/src/ui.ts +29 -0
- package/src/utils/is-rpc-serializable.ts +56 -0
- package/src/utils/player-avatar-url.ts +48 -0
- package/src/utils/url-builder.ts +7 -0
- package/dist/.tsbuildinfo +0 -1
- package/dist/chunk-B5DURUWT.js +0 -80
- package/dist/chunk-B5DURUWT.js.map +0 -1
- package/src/AirJamClient.ts +0 -224
- package/src/audio/volume-store.ts +0 -124
- package/src/components/controller-shell.tsx +0 -346
- package/src/components/host-shell.tsx +0 -520
- package/src/components/qr-scanner-dialog.tsx +0 -373
- package/src/components/ui/alert.tsx +0 -66
- package/src/components/ui/avatar.tsx +0 -46
- package/src/components/ui/badge.tsx +0 -47
- package/src/components/ui/card.tsx +0 -92
- package/src/components/ui/dialog.tsx +0 -122
- package/src/components/ui/tabs.tsx +0 -64
- package/src/hooks/use-air-jam-shell.ts +0 -379
- package/src/hooks/use-fullscreen.ts +0 -108
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/metadata.ts
|
|
21
|
+
var metadata_exports = {};
|
|
22
|
+
__export(metadata_exports, {
|
|
23
|
+
GAME_CATEGORIES: () => GAME_CATEGORIES,
|
|
24
|
+
GAME_INPUT_MODALITIES: () => GAME_INPUT_MODALITIES,
|
|
25
|
+
airJamGameMetadataSchema: () => airJamGameMetadataSchema,
|
|
26
|
+
defineAirJamGameMetadata: () => defineAirJamGameMetadata,
|
|
27
|
+
parseAirJamGameMetadata: () => parseAirJamGameMetadata
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(metadata_exports);
|
|
30
|
+
|
|
31
|
+
// src/metadata/manifest.ts
|
|
32
|
+
var import_zod = require("zod");
|
|
33
|
+
var GAME_CATEGORIES = [
|
|
34
|
+
"party",
|
|
35
|
+
"arcade",
|
|
36
|
+
"puzzle",
|
|
37
|
+
"music",
|
|
38
|
+
"sports",
|
|
39
|
+
"strategy",
|
|
40
|
+
"creative",
|
|
41
|
+
"showcase",
|
|
42
|
+
"other"
|
|
43
|
+
];
|
|
44
|
+
var GAME_INPUT_MODALITIES = [
|
|
45
|
+
"buttons",
|
|
46
|
+
"joystick",
|
|
47
|
+
"touch",
|
|
48
|
+
"motion",
|
|
49
|
+
"text",
|
|
50
|
+
"audio"
|
|
51
|
+
];
|
|
52
|
+
var slugSchema = import_zod.z.string().min(2).max(64).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, {
|
|
53
|
+
message: "slug must be lowercase kebab-case (e.g. `my-cool-game`)"
|
|
54
|
+
});
|
|
55
|
+
var playerCountSchema = import_zod.z.number().int().min(1).max(16);
|
|
56
|
+
var semverRangeSchema = import_zod.z.string().min(1).max(64).regex(/^[\^~<>=\d][\d\w\s.\-+<>=^~|*x]*$/, {
|
|
57
|
+
message: "supportedSdkRange must be a valid semver range"
|
|
58
|
+
});
|
|
59
|
+
var maintainerSchema = import_zod.z.object({
|
|
60
|
+
name: import_zod.z.string().min(1).max(80),
|
|
61
|
+
handle: import_zod.z.string().min(1).max(80).optional(),
|
|
62
|
+
url: import_zod.z.string().url().max(500).optional()
|
|
63
|
+
});
|
|
64
|
+
var airJamGameMetadataSchema = import_zod.z.object({
|
|
65
|
+
/** Fixed identifier for the contract version. Lets us evolve safely later. */
|
|
66
|
+
version: import_zod.z.literal(1).default(1),
|
|
67
|
+
/** Stable URL-safe slug. */
|
|
68
|
+
slug: slugSchema,
|
|
69
|
+
/** Human-readable display name shown in the catalog. */
|
|
70
|
+
name: import_zod.z.string().min(1).max(80),
|
|
71
|
+
/** One- to two-sentence description for catalog cards. Keep under ~240 chars. */
|
|
72
|
+
tagline: import_zod.z.string().min(1).max(240),
|
|
73
|
+
/** Broad taxonomy category. Use `other` sparingly. */
|
|
74
|
+
category: import_zod.z.enum(GAME_CATEGORIES),
|
|
75
|
+
/** Inclusive minimum player count. */
|
|
76
|
+
minPlayers: playerCountSchema,
|
|
77
|
+
/** Inclusive maximum player count. */
|
|
78
|
+
maxPlayers: playerCountSchema,
|
|
79
|
+
/** At least one input modality the controller uses. */
|
|
80
|
+
inputModalities: import_zod.z.array(import_zod.z.enum(GAME_INPUT_MODALITIES)).min(1).max(GAME_INPUT_MODALITIES.length),
|
|
81
|
+
/** Semver range of `@air-jam/sdk` this game is known to run against. */
|
|
82
|
+
supportedSdkRange: semverRangeSchema,
|
|
83
|
+
/** The person or team responsible for this game. */
|
|
84
|
+
maintainer: maintainerSchema,
|
|
85
|
+
/** Optional content advisory for age-sensitive catalog sorting. */
|
|
86
|
+
ageRating: import_zod.z.enum(["all-ages", "teen", "mature"]).optional(),
|
|
87
|
+
/** Optional short list of keyword tags for search. */
|
|
88
|
+
tags: import_zod.z.array(import_zod.z.string().min(1).max(32)).max(12).optional()
|
|
89
|
+
}).refine((value) => value.minPlayers <= value.maxPlayers, {
|
|
90
|
+
message: "minPlayers must be <= maxPlayers",
|
|
91
|
+
path: ["minPlayers"]
|
|
92
|
+
});
|
|
93
|
+
var defineAirJamGameMetadata = (input) => Object.freeze(
|
|
94
|
+
airJamGameMetadataSchema.parse({
|
|
95
|
+
version: 1,
|
|
96
|
+
...input
|
|
97
|
+
})
|
|
98
|
+
);
|
|
99
|
+
var parseAirJamGameMetadata = (value) => {
|
|
100
|
+
const result = airJamGameMetadataSchema.safeParse(value);
|
|
101
|
+
if (result.success) {
|
|
102
|
+
return { ok: true, data: result.data };
|
|
103
|
+
}
|
|
104
|
+
return { ok: false, error: result.error };
|
|
105
|
+
};
|
|
106
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
107
|
+
0 && (module.exports = {
|
|
108
|
+
GAME_CATEGORIES,
|
|
109
|
+
GAME_INPUT_MODALITIES,
|
|
110
|
+
airJamGameMetadataSchema,
|
|
111
|
+
defineAirJamGameMetadata,
|
|
112
|
+
parseAirJamGameMetadata
|
|
113
|
+
});
|
|
114
|
+
//# sourceMappingURL=metadata.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/metadata.ts","../src/metadata/manifest.ts"],"sourcesContent":["export {\n GAME_CATEGORIES,\n GAME_INPUT_MODALITIES,\n airJamGameMetadataSchema,\n defineAirJamGameMetadata,\n parseAirJamGameMetadata,\n type AirJamGameCategory,\n type AirJamGameInputModality,\n type AirJamGameMaintainer,\n type AirJamGameMetadata,\n type DefineAirJamGameMetadataInput,\n} from \"./metadata/manifest\";\n","import { z } from \"zod\";\n\n/**\n * Canonical game metadata contract.\n *\n * This is the typed shape a creator declares once for their game. The platform\n * and Arcade consume it to render catalog entries, validate compatibility, and\n * (later) power filtering, moderation, and recommendation.\n *\n * Scope is intentionally narrow at v1. Additions require a schema change so\n * consumers can keep assuming the shape is stable. External creators should be\n * able to target this contract before the first third-party catalog submission.\n *\n * This contract is distinct from `@air-jam/sdk/capabilities` — capabilities\n * describe what a game exposes at runtime (actions, state, evaluation seams);\n * metadata describes what the catalog needs to present the game.\n */\n\n/** Broad taxonomy for catalog filtering and landing-page grouping. */\nexport const GAME_CATEGORIES = [\n \"party\",\n \"arcade\",\n \"puzzle\",\n \"music\",\n \"sports\",\n \"strategy\",\n \"creative\",\n \"showcase\",\n \"other\",\n] as const;\n\nexport type AirJamGameCategory = (typeof GAME_CATEGORIES)[number];\n\n/** How the controller is expected to be used. Multi-select, at least one entry. */\nexport const GAME_INPUT_MODALITIES = [\n \"buttons\",\n \"joystick\",\n \"touch\",\n \"motion\",\n \"text\",\n \"audio\",\n] as const;\n\nexport type AirJamGameInputModality = (typeof GAME_INPUT_MODALITIES)[number];\n\nconst slugSchema = z\n .string()\n .min(2)\n .max(64)\n .regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, {\n message: \"slug must be lowercase kebab-case (e.g. `my-cool-game`)\",\n });\n\nconst playerCountSchema = z.number().int().min(1).max(16);\n\n// Accept any npm-style semver range (e.g. \"^1.0.0\", \">=1.2 <2\", \"1.x\"). We do\n// not resolve it here — consumers like the platform will compare against the\n// live SDK version at listing/build time.\nconst semverRangeSchema = z\n .string()\n .min(1)\n .max(64)\n .regex(/^[\\^~<>=\\d][\\d\\w\\s.\\-+<>=^~|*x]*$/, {\n message: \"supportedSdkRange must be a valid semver range\",\n });\n\nconst maintainerSchema = z.object({\n name: z.string().min(1).max(80),\n handle: z.string().min(1).max(80).optional(),\n url: z.string().url().max(500).optional(),\n});\n\nexport type AirJamGameMaintainer = z.infer<typeof maintainerSchema>;\n\nexport const airJamGameMetadataSchema = z\n .object({\n /** Fixed identifier for the contract version. Lets us evolve safely later. */\n version: z.literal(1).default(1),\n /** Stable URL-safe slug. */\n slug: slugSchema,\n /** Human-readable display name shown in the catalog. */\n name: z.string().min(1).max(80),\n /** One- to two-sentence description for catalog cards. Keep under ~240 chars. */\n tagline: z.string().min(1).max(240),\n /** Broad taxonomy category. Use `other` sparingly. */\n category: z.enum(GAME_CATEGORIES),\n /** Inclusive minimum player count. */\n minPlayers: playerCountSchema,\n /** Inclusive maximum player count. */\n maxPlayers: playerCountSchema,\n /** At least one input modality the controller uses. */\n inputModalities: z\n .array(z.enum(GAME_INPUT_MODALITIES))\n .min(1)\n .max(GAME_INPUT_MODALITIES.length),\n /** Semver range of `@air-jam/sdk` this game is known to run against. */\n supportedSdkRange: semverRangeSchema,\n /** The person or team responsible for this game. */\n maintainer: maintainerSchema,\n /** Optional content advisory for age-sensitive catalog sorting. */\n ageRating: z.enum([\"all-ages\", \"teen\", \"mature\"]).optional(),\n /** Optional short list of keyword tags for search. */\n tags: z.array(z.string().min(1).max(32)).max(12).optional(),\n })\n .refine((value) => value.minPlayers <= value.maxPlayers, {\n message: \"minPlayers must be <= maxPlayers\",\n path: [\"minPlayers\"],\n });\n\nexport type AirJamGameMetadata = z.infer<typeof airJamGameMetadataSchema>;\n\nexport type DefineAirJamGameMetadataInput = Omit<\n z.input<typeof airJamGameMetadataSchema>,\n \"inputModalities\" | \"tags\" | \"version\"\n> & {\n inputModalities: readonly AirJamGameInputModality[];\n tags?: readonly string[];\n version?: 1;\n};\n\n/**\n * Validate and freeze a metadata object. Throws `ZodError` on invalid input.\n *\n * Call this once in `airjam.config.ts` (or the equivalent entry for your game)\n * so the shape is checked at build time instead of at catalog ingestion.\n */\nexport const defineAirJamGameMetadata = (\n input: DefineAirJamGameMetadataInput,\n): AirJamGameMetadata =>\n Object.freeze(\n airJamGameMetadataSchema.parse({\n version: 1,\n ...input,\n }),\n );\n\n/**\n * Lenient parser for read-side consumption (e.g. the platform reading stored\n * metadata). Returns a `{ ok, data } | { ok, error }` discriminated result so\n * the caller can surface validation failures without throwing.\n */\nexport const parseAirJamGameMetadata = (\n value: unknown,\n):\n | { ok: true; data: AirJamGameMetadata }\n | { ok: false; error: z.ZodError } => {\n const result = airJamGameMetadataSchema.safeParse(value);\n if (result.success) {\n return { ok: true, data: result.data };\n }\n return { ok: false, error: result.error };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBAAkB;AAmBX,IAAM,kBAAkB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAKO,IAAM,wBAAwB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIA,IAAM,aAAa,aAChB,OAAO,EACP,IAAI,CAAC,EACL,IAAI,EAAE,EACN,MAAM,8BAA8B;AAAA,EACnC,SAAS;AACX,CAAC;AAEH,IAAM,oBAAoB,aAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE;AAKxD,IAAM,oBAAoB,aACvB,OAAO,EACP,IAAI,CAAC,EACL,IAAI,EAAE,EACN,MAAM,qCAAqC;AAAA,EAC1C,SAAS;AACX,CAAC;AAEH,IAAM,mBAAmB,aAAE,OAAO;AAAA,EAChC,MAAM,aAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE;AAAA,EAC9B,QAAQ,aAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,SAAS;AAAA,EAC3C,KAAK,aAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,EAAE,SAAS;AAC1C,CAAC;AAIM,IAAM,2BAA2B,aACrC,OAAO;AAAA;AAAA,EAEN,SAAS,aAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC;AAAA;AAAA,EAE/B,MAAM;AAAA;AAAA,EAEN,MAAM,aAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE;AAAA;AAAA,EAE9B,SAAS,aAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA;AAAA,EAElC,UAAU,aAAE,KAAK,eAAe;AAAA;AAAA,EAEhC,YAAY;AAAA;AAAA,EAEZ,YAAY;AAAA;AAAA,EAEZ,iBAAiB,aACd,MAAM,aAAE,KAAK,qBAAqB,CAAC,EACnC,IAAI,CAAC,EACL,IAAI,sBAAsB,MAAM;AAAA;AAAA,EAEnC,mBAAmB;AAAA;AAAA,EAEnB,YAAY;AAAA;AAAA,EAEZ,WAAW,aAAE,KAAK,CAAC,YAAY,QAAQ,QAAQ,CAAC,EAAE,SAAS;AAAA;AAAA,EAE3D,MAAM,aAAE,MAAM,aAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,SAAS;AAC5D,CAAC,EACA,OAAO,CAAC,UAAU,MAAM,cAAc,MAAM,YAAY;AAAA,EACvD,SAAS;AAAA,EACT,MAAM,CAAC,YAAY;AACrB,CAAC;AAmBI,IAAM,2BAA2B,CACtC,UAEA,OAAO;AAAA,EACL,yBAAyB,MAAM;AAAA,IAC7B,SAAS;AAAA,IACT,GAAG;AAAA,EACL,CAAC;AACH;AAOK,IAAM,0BAA0B,CACrC,UAGsC;AACtC,QAAM,SAAS,yBAAyB,UAAU,KAAK;AACvD,MAAI,OAAO,SAAS;AAClB,WAAO,EAAE,IAAI,MAAM,MAAM,OAAO,KAAK;AAAA,EACvC;AACA,SAAO,EAAE,IAAI,OAAO,OAAO,OAAO,MAAM;AAC1C;","names":[]}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Canonical game metadata contract.
|
|
5
|
+
*
|
|
6
|
+
* This is the typed shape a creator declares once for their game. The platform
|
|
7
|
+
* and Arcade consume it to render catalog entries, validate compatibility, and
|
|
8
|
+
* (later) power filtering, moderation, and recommendation.
|
|
9
|
+
*
|
|
10
|
+
* Scope is intentionally narrow at v1. Additions require a schema change so
|
|
11
|
+
* consumers can keep assuming the shape is stable. External creators should be
|
|
12
|
+
* able to target this contract before the first third-party catalog submission.
|
|
13
|
+
*
|
|
14
|
+
* This contract is distinct from `@air-jam/sdk/capabilities` — capabilities
|
|
15
|
+
* describe what a game exposes at runtime (actions, state, evaluation seams);
|
|
16
|
+
* metadata describes what the catalog needs to present the game.
|
|
17
|
+
*/
|
|
18
|
+
/** Broad taxonomy for catalog filtering and landing-page grouping. */
|
|
19
|
+
declare const GAME_CATEGORIES: readonly ["party", "arcade", "puzzle", "music", "sports", "strategy", "creative", "showcase", "other"];
|
|
20
|
+
type AirJamGameCategory = (typeof GAME_CATEGORIES)[number];
|
|
21
|
+
/** How the controller is expected to be used. Multi-select, at least one entry. */
|
|
22
|
+
declare const GAME_INPUT_MODALITIES: readonly ["buttons", "joystick", "touch", "motion", "text", "audio"];
|
|
23
|
+
type AirJamGameInputModality = (typeof GAME_INPUT_MODALITIES)[number];
|
|
24
|
+
declare const maintainerSchema: z.ZodObject<{
|
|
25
|
+
name: z.ZodString;
|
|
26
|
+
handle: z.ZodOptional<z.ZodString>;
|
|
27
|
+
url: z.ZodOptional<z.ZodString>;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
type AirJamGameMaintainer = z.infer<typeof maintainerSchema>;
|
|
30
|
+
declare const airJamGameMetadataSchema: z.ZodObject<{
|
|
31
|
+
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
32
|
+
slug: z.ZodString;
|
|
33
|
+
name: z.ZodString;
|
|
34
|
+
tagline: z.ZodString;
|
|
35
|
+
category: z.ZodEnum<{
|
|
36
|
+
music: "music";
|
|
37
|
+
party: "party";
|
|
38
|
+
arcade: "arcade";
|
|
39
|
+
puzzle: "puzzle";
|
|
40
|
+
sports: "sports";
|
|
41
|
+
strategy: "strategy";
|
|
42
|
+
creative: "creative";
|
|
43
|
+
showcase: "showcase";
|
|
44
|
+
other: "other";
|
|
45
|
+
}>;
|
|
46
|
+
minPlayers: z.ZodNumber;
|
|
47
|
+
maxPlayers: z.ZodNumber;
|
|
48
|
+
inputModalities: z.ZodArray<z.ZodEnum<{
|
|
49
|
+
audio: "audio";
|
|
50
|
+
text: "text";
|
|
51
|
+
touch: "touch";
|
|
52
|
+
buttons: "buttons";
|
|
53
|
+
joystick: "joystick";
|
|
54
|
+
motion: "motion";
|
|
55
|
+
}>>;
|
|
56
|
+
supportedSdkRange: z.ZodString;
|
|
57
|
+
maintainer: z.ZodObject<{
|
|
58
|
+
name: z.ZodString;
|
|
59
|
+
handle: z.ZodOptional<z.ZodString>;
|
|
60
|
+
url: z.ZodOptional<z.ZodString>;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
ageRating: z.ZodOptional<z.ZodEnum<{
|
|
63
|
+
"all-ages": "all-ages";
|
|
64
|
+
teen: "teen";
|
|
65
|
+
mature: "mature";
|
|
66
|
+
}>>;
|
|
67
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
type AirJamGameMetadata = z.infer<typeof airJamGameMetadataSchema>;
|
|
70
|
+
type DefineAirJamGameMetadataInput = Omit<z.input<typeof airJamGameMetadataSchema>, "inputModalities" | "tags" | "version"> & {
|
|
71
|
+
inputModalities: readonly AirJamGameInputModality[];
|
|
72
|
+
tags?: readonly string[];
|
|
73
|
+
version?: 1;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Validate and freeze a metadata object. Throws `ZodError` on invalid input.
|
|
77
|
+
*
|
|
78
|
+
* Call this once in `airjam.config.ts` (or the equivalent entry for your game)
|
|
79
|
+
* so the shape is checked at build time instead of at catalog ingestion.
|
|
80
|
+
*/
|
|
81
|
+
declare const defineAirJamGameMetadata: (input: DefineAirJamGameMetadataInput) => AirJamGameMetadata;
|
|
82
|
+
/**
|
|
83
|
+
* Lenient parser for read-side consumption (e.g. the platform reading stored
|
|
84
|
+
* metadata). Returns a `{ ok, data } | { ok, error }` discriminated result so
|
|
85
|
+
* the caller can surface validation failures without throwing.
|
|
86
|
+
*/
|
|
87
|
+
declare const parseAirJamGameMetadata: (value: unknown) => {
|
|
88
|
+
ok: true;
|
|
89
|
+
data: AirJamGameMetadata;
|
|
90
|
+
} | {
|
|
91
|
+
ok: false;
|
|
92
|
+
error: z.ZodError;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export { type AirJamGameCategory, type AirJamGameInputModality, type AirJamGameMaintainer, type AirJamGameMetadata, type DefineAirJamGameMetadataInput, GAME_CATEGORIES, GAME_INPUT_MODALITIES, airJamGameMetadataSchema, defineAirJamGameMetadata, parseAirJamGameMetadata };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Canonical game metadata contract.
|
|
5
|
+
*
|
|
6
|
+
* This is the typed shape a creator declares once for their game. The platform
|
|
7
|
+
* and Arcade consume it to render catalog entries, validate compatibility, and
|
|
8
|
+
* (later) power filtering, moderation, and recommendation.
|
|
9
|
+
*
|
|
10
|
+
* Scope is intentionally narrow at v1. Additions require a schema change so
|
|
11
|
+
* consumers can keep assuming the shape is stable. External creators should be
|
|
12
|
+
* able to target this contract before the first third-party catalog submission.
|
|
13
|
+
*
|
|
14
|
+
* This contract is distinct from `@air-jam/sdk/capabilities` — capabilities
|
|
15
|
+
* describe what a game exposes at runtime (actions, state, evaluation seams);
|
|
16
|
+
* metadata describes what the catalog needs to present the game.
|
|
17
|
+
*/
|
|
18
|
+
/** Broad taxonomy for catalog filtering and landing-page grouping. */
|
|
19
|
+
declare const GAME_CATEGORIES: readonly ["party", "arcade", "puzzle", "music", "sports", "strategy", "creative", "showcase", "other"];
|
|
20
|
+
type AirJamGameCategory = (typeof GAME_CATEGORIES)[number];
|
|
21
|
+
/** How the controller is expected to be used. Multi-select, at least one entry. */
|
|
22
|
+
declare const GAME_INPUT_MODALITIES: readonly ["buttons", "joystick", "touch", "motion", "text", "audio"];
|
|
23
|
+
type AirJamGameInputModality = (typeof GAME_INPUT_MODALITIES)[number];
|
|
24
|
+
declare const maintainerSchema: z.ZodObject<{
|
|
25
|
+
name: z.ZodString;
|
|
26
|
+
handle: z.ZodOptional<z.ZodString>;
|
|
27
|
+
url: z.ZodOptional<z.ZodString>;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
type AirJamGameMaintainer = z.infer<typeof maintainerSchema>;
|
|
30
|
+
declare const airJamGameMetadataSchema: z.ZodObject<{
|
|
31
|
+
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
32
|
+
slug: z.ZodString;
|
|
33
|
+
name: z.ZodString;
|
|
34
|
+
tagline: z.ZodString;
|
|
35
|
+
category: z.ZodEnum<{
|
|
36
|
+
music: "music";
|
|
37
|
+
party: "party";
|
|
38
|
+
arcade: "arcade";
|
|
39
|
+
puzzle: "puzzle";
|
|
40
|
+
sports: "sports";
|
|
41
|
+
strategy: "strategy";
|
|
42
|
+
creative: "creative";
|
|
43
|
+
showcase: "showcase";
|
|
44
|
+
other: "other";
|
|
45
|
+
}>;
|
|
46
|
+
minPlayers: z.ZodNumber;
|
|
47
|
+
maxPlayers: z.ZodNumber;
|
|
48
|
+
inputModalities: z.ZodArray<z.ZodEnum<{
|
|
49
|
+
audio: "audio";
|
|
50
|
+
text: "text";
|
|
51
|
+
touch: "touch";
|
|
52
|
+
buttons: "buttons";
|
|
53
|
+
joystick: "joystick";
|
|
54
|
+
motion: "motion";
|
|
55
|
+
}>>;
|
|
56
|
+
supportedSdkRange: z.ZodString;
|
|
57
|
+
maintainer: z.ZodObject<{
|
|
58
|
+
name: z.ZodString;
|
|
59
|
+
handle: z.ZodOptional<z.ZodString>;
|
|
60
|
+
url: z.ZodOptional<z.ZodString>;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
ageRating: z.ZodOptional<z.ZodEnum<{
|
|
63
|
+
"all-ages": "all-ages";
|
|
64
|
+
teen: "teen";
|
|
65
|
+
mature: "mature";
|
|
66
|
+
}>>;
|
|
67
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
type AirJamGameMetadata = z.infer<typeof airJamGameMetadataSchema>;
|
|
70
|
+
type DefineAirJamGameMetadataInput = Omit<z.input<typeof airJamGameMetadataSchema>, "inputModalities" | "tags" | "version"> & {
|
|
71
|
+
inputModalities: readonly AirJamGameInputModality[];
|
|
72
|
+
tags?: readonly string[];
|
|
73
|
+
version?: 1;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Validate and freeze a metadata object. Throws `ZodError` on invalid input.
|
|
77
|
+
*
|
|
78
|
+
* Call this once in `airjam.config.ts` (or the equivalent entry for your game)
|
|
79
|
+
* so the shape is checked at build time instead of at catalog ingestion.
|
|
80
|
+
*/
|
|
81
|
+
declare const defineAirJamGameMetadata: (input: DefineAirJamGameMetadataInput) => AirJamGameMetadata;
|
|
82
|
+
/**
|
|
83
|
+
* Lenient parser for read-side consumption (e.g. the platform reading stored
|
|
84
|
+
* metadata). Returns a `{ ok, data } | { ok, error }` discriminated result so
|
|
85
|
+
* the caller can surface validation failures without throwing.
|
|
86
|
+
*/
|
|
87
|
+
declare const parseAirJamGameMetadata: (value: unknown) => {
|
|
88
|
+
ok: true;
|
|
89
|
+
data: AirJamGameMetadata;
|
|
90
|
+
} | {
|
|
91
|
+
ok: false;
|
|
92
|
+
error: z.ZodError;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export { type AirJamGameCategory, type AirJamGameInputModality, type AirJamGameMaintainer, type AirJamGameMetadata, type DefineAirJamGameMetadataInput, GAME_CATEGORIES, GAME_INPUT_MODALITIES, airJamGameMetadataSchema, defineAirJamGameMetadata, parseAirJamGameMetadata };
|
package/dist/metadata.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// src/metadata/manifest.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var GAME_CATEGORIES = [
|
|
4
|
+
"party",
|
|
5
|
+
"arcade",
|
|
6
|
+
"puzzle",
|
|
7
|
+
"music",
|
|
8
|
+
"sports",
|
|
9
|
+
"strategy",
|
|
10
|
+
"creative",
|
|
11
|
+
"showcase",
|
|
12
|
+
"other"
|
|
13
|
+
];
|
|
14
|
+
var GAME_INPUT_MODALITIES = [
|
|
15
|
+
"buttons",
|
|
16
|
+
"joystick",
|
|
17
|
+
"touch",
|
|
18
|
+
"motion",
|
|
19
|
+
"text",
|
|
20
|
+
"audio"
|
|
21
|
+
];
|
|
22
|
+
var slugSchema = z.string().min(2).max(64).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, {
|
|
23
|
+
message: "slug must be lowercase kebab-case (e.g. `my-cool-game`)"
|
|
24
|
+
});
|
|
25
|
+
var playerCountSchema = z.number().int().min(1).max(16);
|
|
26
|
+
var semverRangeSchema = z.string().min(1).max(64).regex(/^[\^~<>=\d][\d\w\s.\-+<>=^~|*x]*$/, {
|
|
27
|
+
message: "supportedSdkRange must be a valid semver range"
|
|
28
|
+
});
|
|
29
|
+
var maintainerSchema = z.object({
|
|
30
|
+
name: z.string().min(1).max(80),
|
|
31
|
+
handle: z.string().min(1).max(80).optional(),
|
|
32
|
+
url: z.string().url().max(500).optional()
|
|
33
|
+
});
|
|
34
|
+
var airJamGameMetadataSchema = z.object({
|
|
35
|
+
/** Fixed identifier for the contract version. Lets us evolve safely later. */
|
|
36
|
+
version: z.literal(1).default(1),
|
|
37
|
+
/** Stable URL-safe slug. */
|
|
38
|
+
slug: slugSchema,
|
|
39
|
+
/** Human-readable display name shown in the catalog. */
|
|
40
|
+
name: z.string().min(1).max(80),
|
|
41
|
+
/** One- to two-sentence description for catalog cards. Keep under ~240 chars. */
|
|
42
|
+
tagline: z.string().min(1).max(240),
|
|
43
|
+
/** Broad taxonomy category. Use `other` sparingly. */
|
|
44
|
+
category: z.enum(GAME_CATEGORIES),
|
|
45
|
+
/** Inclusive minimum player count. */
|
|
46
|
+
minPlayers: playerCountSchema,
|
|
47
|
+
/** Inclusive maximum player count. */
|
|
48
|
+
maxPlayers: playerCountSchema,
|
|
49
|
+
/** At least one input modality the controller uses. */
|
|
50
|
+
inputModalities: z.array(z.enum(GAME_INPUT_MODALITIES)).min(1).max(GAME_INPUT_MODALITIES.length),
|
|
51
|
+
/** Semver range of `@air-jam/sdk` this game is known to run against. */
|
|
52
|
+
supportedSdkRange: semverRangeSchema,
|
|
53
|
+
/** The person or team responsible for this game. */
|
|
54
|
+
maintainer: maintainerSchema,
|
|
55
|
+
/** Optional content advisory for age-sensitive catalog sorting. */
|
|
56
|
+
ageRating: z.enum(["all-ages", "teen", "mature"]).optional(),
|
|
57
|
+
/** Optional short list of keyword tags for search. */
|
|
58
|
+
tags: z.array(z.string().min(1).max(32)).max(12).optional()
|
|
59
|
+
}).refine((value) => value.minPlayers <= value.maxPlayers, {
|
|
60
|
+
message: "minPlayers must be <= maxPlayers",
|
|
61
|
+
path: ["minPlayers"]
|
|
62
|
+
});
|
|
63
|
+
var defineAirJamGameMetadata = (input) => Object.freeze(
|
|
64
|
+
airJamGameMetadataSchema.parse({
|
|
65
|
+
version: 1,
|
|
66
|
+
...input
|
|
67
|
+
})
|
|
68
|
+
);
|
|
69
|
+
var parseAirJamGameMetadata = (value) => {
|
|
70
|
+
const result = airJamGameMetadataSchema.safeParse(value);
|
|
71
|
+
if (result.success) {
|
|
72
|
+
return { ok: true, data: result.data };
|
|
73
|
+
}
|
|
74
|
+
return { ok: false, error: result.error };
|
|
75
|
+
};
|
|
76
|
+
export {
|
|
77
|
+
GAME_CATEGORIES,
|
|
78
|
+
GAME_INPUT_MODALITIES,
|
|
79
|
+
airJamGameMetadataSchema,
|
|
80
|
+
defineAirJamGameMetadata,
|
|
81
|
+
parseAirJamGameMetadata
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/metadata/manifest.ts"],"sourcesContent":["import { z } from \"zod\";\n\n/**\n * Canonical game metadata contract.\n *\n * This is the typed shape a creator declares once for their game. The platform\n * and Arcade consume it to render catalog entries, validate compatibility, and\n * (later) power filtering, moderation, and recommendation.\n *\n * Scope is intentionally narrow at v1. Additions require a schema change so\n * consumers can keep assuming the shape is stable. External creators should be\n * able to target this contract before the first third-party catalog submission.\n *\n * This contract is distinct from `@air-jam/sdk/capabilities` — capabilities\n * describe what a game exposes at runtime (actions, state, evaluation seams);\n * metadata describes what the catalog needs to present the game.\n */\n\n/** Broad taxonomy for catalog filtering and landing-page grouping. */\nexport const GAME_CATEGORIES = [\n \"party\",\n \"arcade\",\n \"puzzle\",\n \"music\",\n \"sports\",\n \"strategy\",\n \"creative\",\n \"showcase\",\n \"other\",\n] as const;\n\nexport type AirJamGameCategory = (typeof GAME_CATEGORIES)[number];\n\n/** How the controller is expected to be used. Multi-select, at least one entry. */\nexport const GAME_INPUT_MODALITIES = [\n \"buttons\",\n \"joystick\",\n \"touch\",\n \"motion\",\n \"text\",\n \"audio\",\n] as const;\n\nexport type AirJamGameInputModality = (typeof GAME_INPUT_MODALITIES)[number];\n\nconst slugSchema = z\n .string()\n .min(2)\n .max(64)\n .regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, {\n message: \"slug must be lowercase kebab-case (e.g. `my-cool-game`)\",\n });\n\nconst playerCountSchema = z.number().int().min(1).max(16);\n\n// Accept any npm-style semver range (e.g. \"^1.0.0\", \">=1.2 <2\", \"1.x\"). We do\n// not resolve it here — consumers like the platform will compare against the\n// live SDK version at listing/build time.\nconst semverRangeSchema = z\n .string()\n .min(1)\n .max(64)\n .regex(/^[\\^~<>=\\d][\\d\\w\\s.\\-+<>=^~|*x]*$/, {\n message: \"supportedSdkRange must be a valid semver range\",\n });\n\nconst maintainerSchema = z.object({\n name: z.string().min(1).max(80),\n handle: z.string().min(1).max(80).optional(),\n url: z.string().url().max(500).optional(),\n});\n\nexport type AirJamGameMaintainer = z.infer<typeof maintainerSchema>;\n\nexport const airJamGameMetadataSchema = z\n .object({\n /** Fixed identifier for the contract version. Lets us evolve safely later. */\n version: z.literal(1).default(1),\n /** Stable URL-safe slug. */\n slug: slugSchema,\n /** Human-readable display name shown in the catalog. */\n name: z.string().min(1).max(80),\n /** One- to two-sentence description for catalog cards. Keep under ~240 chars. */\n tagline: z.string().min(1).max(240),\n /** Broad taxonomy category. Use `other` sparingly. */\n category: z.enum(GAME_CATEGORIES),\n /** Inclusive minimum player count. */\n minPlayers: playerCountSchema,\n /** Inclusive maximum player count. */\n maxPlayers: playerCountSchema,\n /** At least one input modality the controller uses. */\n inputModalities: z\n .array(z.enum(GAME_INPUT_MODALITIES))\n .min(1)\n .max(GAME_INPUT_MODALITIES.length),\n /** Semver range of `@air-jam/sdk` this game is known to run against. */\n supportedSdkRange: semverRangeSchema,\n /** The person or team responsible for this game. */\n maintainer: maintainerSchema,\n /** Optional content advisory for age-sensitive catalog sorting. */\n ageRating: z.enum([\"all-ages\", \"teen\", \"mature\"]).optional(),\n /** Optional short list of keyword tags for search. */\n tags: z.array(z.string().min(1).max(32)).max(12).optional(),\n })\n .refine((value) => value.minPlayers <= value.maxPlayers, {\n message: \"minPlayers must be <= maxPlayers\",\n path: [\"minPlayers\"],\n });\n\nexport type AirJamGameMetadata = z.infer<typeof airJamGameMetadataSchema>;\n\nexport type DefineAirJamGameMetadataInput = Omit<\n z.input<typeof airJamGameMetadataSchema>,\n \"inputModalities\" | \"tags\" | \"version\"\n> & {\n inputModalities: readonly AirJamGameInputModality[];\n tags?: readonly string[];\n version?: 1;\n};\n\n/**\n * Validate and freeze a metadata object. Throws `ZodError` on invalid input.\n *\n * Call this once in `airjam.config.ts` (or the equivalent entry for your game)\n * so the shape is checked at build time instead of at catalog ingestion.\n */\nexport const defineAirJamGameMetadata = (\n input: DefineAirJamGameMetadataInput,\n): AirJamGameMetadata =>\n Object.freeze(\n airJamGameMetadataSchema.parse({\n version: 1,\n ...input,\n }),\n );\n\n/**\n * Lenient parser for read-side consumption (e.g. the platform reading stored\n * metadata). Returns a `{ ok, data } | { ok, error }` discriminated result so\n * the caller can surface validation failures without throwing.\n */\nexport const parseAirJamGameMetadata = (\n value: unknown,\n):\n | { ok: true; data: AirJamGameMetadata }\n | { ok: false; error: z.ZodError } => {\n const result = airJamGameMetadataSchema.safeParse(value);\n if (result.success) {\n return { ok: true, data: result.data };\n }\n return { ok: false, error: result.error };\n};\n"],"mappings":";AAAA,SAAS,SAAS;AAmBX,IAAM,kBAAkB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAKO,IAAM,wBAAwB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIA,IAAM,aAAa,EAChB,OAAO,EACP,IAAI,CAAC,EACL,IAAI,EAAE,EACN,MAAM,8BAA8B;AAAA,EACnC,SAAS;AACX,CAAC;AAEH,IAAM,oBAAoB,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE;AAKxD,IAAM,oBAAoB,EACvB,OAAO,EACP,IAAI,CAAC,EACL,IAAI,EAAE,EACN,MAAM,qCAAqC;AAAA,EAC1C,SAAS;AACX,CAAC;AAEH,IAAM,mBAAmB,EAAE,OAAO;AAAA,EAChC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE;AAAA,EAC9B,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,SAAS;AAAA,EAC3C,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,EAAE,SAAS;AAC1C,CAAC;AAIM,IAAM,2BAA2B,EACrC,OAAO;AAAA;AAAA,EAEN,SAAS,EAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC;AAAA;AAAA,EAE/B,MAAM;AAAA;AAAA,EAEN,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE;AAAA;AAAA,EAE9B,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA;AAAA,EAElC,UAAU,EAAE,KAAK,eAAe;AAAA;AAAA,EAEhC,YAAY;AAAA;AAAA,EAEZ,YAAY;AAAA;AAAA,EAEZ,iBAAiB,EACd,MAAM,EAAE,KAAK,qBAAqB,CAAC,EACnC,IAAI,CAAC,EACL,IAAI,sBAAsB,MAAM;AAAA;AAAA,EAEnC,mBAAmB;AAAA;AAAA,EAEnB,YAAY;AAAA;AAAA,EAEZ,WAAW,EAAE,KAAK,CAAC,YAAY,QAAQ,QAAQ,CAAC,EAAE,SAAS;AAAA;AAAA,EAE3D,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,SAAS;AAC5D,CAAC,EACA,OAAO,CAAC,UAAU,MAAM,cAAc,MAAM,YAAY;AAAA,EACvD,SAAS;AAAA,EACT,MAAM,CAAC,YAAY;AACrB,CAAC;AAmBI,IAAM,2BAA2B,CACtC,UAEA,OAAO;AAAA,EACL,yBAAyB,MAAM;AAAA,IAC7B,SAAS;AAAA,IACT,GAAG;AAAA,EACL,CAAC;AACH;AAOK,IAAM,0BAA0B,CACrC,UAGsC;AACtC,QAAM,SAAS,yBAAyB,UAAU,KAAK;AACvD,MAAI,OAAO,SAAS;AAClB,WAAO,EAAE,IAAI,MAAM,MAAM,OAAO,KAAK;AAAA,EACvC;AACA,SAAO,EAAE,IAAI,OAAO,OAAO,OAAO,MAAM;AAC1C;","names":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { a as ControllerSource, P as PlayerProfile, R as RoomCode } from './controller-DxVchfiA.js';
|
|
2
|
+
|
|
3
|
+
interface ControllerPresenceNotice {
|
|
4
|
+
controllerId: string;
|
|
5
|
+
deviceId?: string;
|
|
6
|
+
nickname?: string;
|
|
7
|
+
source: ControllerSource;
|
|
8
|
+
connected: boolean;
|
|
9
|
+
resumeLeaseExpiresAt: number | null;
|
|
10
|
+
player?: PlayerProfile;
|
|
11
|
+
}
|
|
12
|
+
interface ControllerWelcomePayload {
|
|
13
|
+
controllerId: string;
|
|
14
|
+
roomId: RoomCode;
|
|
15
|
+
resumed?: boolean;
|
|
16
|
+
player?: PlayerProfile;
|
|
17
|
+
players?: PlayerProfile[];
|
|
18
|
+
controllers?: ControllerPresenceNotice[];
|
|
19
|
+
}
|
|
20
|
+
interface ControllerJoinedNotice extends ControllerPresenceNotice {
|
|
21
|
+
resumed?: boolean;
|
|
22
|
+
}
|
|
23
|
+
interface ControllerLeftNotice {
|
|
24
|
+
controllerId: string;
|
|
25
|
+
}
|
|
26
|
+
/** Emitted when a controller updates their profile (label / avatar) after join. */
|
|
27
|
+
interface PlayerUpdatedNotice {
|
|
28
|
+
player: PlayerProfile;
|
|
29
|
+
}
|
|
30
|
+
interface RoomReadyNotice {
|
|
31
|
+
roomId: RoomCode;
|
|
32
|
+
}
|
|
33
|
+
interface HostLeftNotice {
|
|
34
|
+
roomId: RoomCode;
|
|
35
|
+
reason: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type { ControllerPresenceNotice as C, HostLeftNotice as H, PlayerUpdatedNotice as P, RoomReadyNotice as R, ControllerJoinedNotice as a, ControllerLeftNotice as b, ControllerWelcomePayload as c };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { a as ControllerSource, P as PlayerProfile, R as RoomCode } from './controller-Bod8YYr1.cjs';
|
|
2
|
+
|
|
3
|
+
interface ControllerPresenceNotice {
|
|
4
|
+
controllerId: string;
|
|
5
|
+
deviceId?: string;
|
|
6
|
+
nickname?: string;
|
|
7
|
+
source: ControllerSource;
|
|
8
|
+
connected: boolean;
|
|
9
|
+
resumeLeaseExpiresAt: number | null;
|
|
10
|
+
player?: PlayerProfile;
|
|
11
|
+
}
|
|
12
|
+
interface ControllerWelcomePayload {
|
|
13
|
+
controllerId: string;
|
|
14
|
+
roomId: RoomCode;
|
|
15
|
+
resumed?: boolean;
|
|
16
|
+
player?: PlayerProfile;
|
|
17
|
+
players?: PlayerProfile[];
|
|
18
|
+
controllers?: ControllerPresenceNotice[];
|
|
19
|
+
}
|
|
20
|
+
interface ControllerJoinedNotice extends ControllerPresenceNotice {
|
|
21
|
+
resumed?: boolean;
|
|
22
|
+
}
|
|
23
|
+
interface ControllerLeftNotice {
|
|
24
|
+
controllerId: string;
|
|
25
|
+
}
|
|
26
|
+
/** Emitted when a controller updates their profile (label / avatar) after join. */
|
|
27
|
+
interface PlayerUpdatedNotice {
|
|
28
|
+
player: PlayerProfile;
|
|
29
|
+
}
|
|
30
|
+
interface RoomReadyNotice {
|
|
31
|
+
roomId: RoomCode;
|
|
32
|
+
}
|
|
33
|
+
interface HostLeftNotice {
|
|
34
|
+
roomId: RoomCode;
|
|
35
|
+
reason: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type { ControllerPresenceNotice as C, HostLeftNotice as H, PlayerUpdatedNotice as P, RoomReadyNotice as R, ControllerJoinedNotice as a, ControllerLeftNotice as b, ControllerWelcomePayload as c };
|