@craft_eco/craft-mcp 0.1.25 → 0.1.26
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 +31 -10
- package/bin/craft-mcp.mjs +10 -8
- package/dist-server/game-workflow/bundle-files.mjs +43 -0
- package/dist-server/game-workflow/engines.mjs +13 -6
- package/dist-server/game-workflow/project-bundles.mjs +90 -0
- package/dist-server/game-workflow/project-context.mjs +91 -0
- package/dist-server/game-workflow/projects.mjs +16 -4
- package/dist-server/game-workflow/publication-materials.mjs +18 -20
- package/dist-server/game-workflow/publications.mjs +15 -17
- package/dist-server/game-workflow/publish-capture.mjs +21 -57
- package/dist-server/integrations/config.mjs +71 -0
- package/dist-server/integrations/files.mjs +54 -0
- package/dist-server/integrations/hosts.mjs +30 -0
- package/dist-server/integrations/install.mjs +86 -0
- package/dist-server/integrations/runtime.mjs +71 -0
- package/dist-server/mcp/publication-page.mjs +18 -50
- package/dist-server/mcp/publish-panel.mjs +28 -35
- package/dist-server/mcp/server.mjs +17 -14
- package/dist-server/preview/preview-launcher.mjs +9 -2
- package/dist-server/preview/preview-start.mjs +2 -2
- package/dist-server/upstream/publication-transport.mjs +19 -19
- package/package.json +10 -2
- package/resources/craft-create/SKILL.md +14 -0
- package/resources/craft-game-maker/SKILL.md +77 -71
- package/resources/craft-game-maker/js.md +10 -10
- package/resources/craft-game-maker/js3d.md +13 -13
- package/resources/game_visual_qa.mjs +1149 -1149
- package/resources/js/bundle.json +93 -0
- package/resources/js/context/AGENTS.md +15 -102
- package/resources/js/context/knowledge/AigcWiring.md +5 -196
- package/resources/js/context/knowledge/AssetUrl.md +5 -20
- package/resources/js/context/knowledge/Layout.md +7 -0
- package/resources/js/context/knowledge/Lifecycle.md +6 -27
- package/resources/js/context/skills/aigc-generate/SKILL.md +6 -141
- package/resources/js/context/skills/asset-search/SKILL.md +5 -62
- package/resources/js/context/skills/asset-search/references/resource-config.md +9 -0
- package/resources/js/context/skills/export-config/SKILL.md +7 -19
- package/resources/js/context/skills/export-config/scripts/export-config.mjs +3 -45
- package/resources/js/context/skills/index.json +30 -0
- package/resources/js/context/skills/visual-qa/SKILL.md +6 -28
- package/resources/js/project/README.md +4 -96
- package/resources/js/project/package.json +1 -2
- package/resources/js/project/scripts/config-export/panel-resource-path.mjs +106 -0
- package/resources/js/{context/skills/export-config/scripts → project/scripts/config-export}/sync-asset-controls.mjs +1 -37
- package/resources/js/project/scripts/config-export.mjs +10 -34
- package/resources/js3d/bundle.json +104 -0
- package/resources/js3d/context/AGENTS.md +16 -85
- package/resources/js3d/context/knowledge/AigcWiring.md +9 -0
- package/resources/js3d/context/knowledge/AssetUrl.md +9 -0
- package/resources/js3d/context/knowledge/CodingGuide/Pitfalls.md +9 -67
- package/resources/js3d/context/knowledge/Layout.md +7 -0
- package/resources/js3d/context/knowledge/Runtime.md +5 -30
- package/resources/js3d/context/skills/aigc-integration/SKILL.md +6 -164
- package/resources/js3d/context/skills/asset-search/SKILL.md +5 -171
- package/resources/js3d/context/skills/asset-search/references/resource-config.md +6 -94
- package/resources/js3d/context/skills/asset-usage-audit/SKILL.md +6 -82
- package/resources/js3d/context/skills/export-config/SKILL.md +7 -11
- package/resources/js3d/context/skills/export-config/scripts/export-config.mjs +3 -55
- package/resources/js3d/context/skills/index.json +42 -0
- package/resources/js3d/context/skills/performance-audit/SKILL.md +8 -153
- package/resources/js3d/context/skills/visual-qa/SKILL.md +14 -0
- package/resources/js3d/project/README.md +4 -103
- package/resources/js3d/project/package.json +1 -2
- package/resources/js3d/project/scripts/config-export/panel-resource-path.mjs +106 -0
- package/resources/js3d/{context/skills/export-config/scripts → project/scripts/config-export}/sync-scene-assets.mjs +3 -28
- package/resources/js3d/project/scripts/config-export.mjs +12 -34
- package/vendor/agent-cli/dist/src/artifacts/build-failure.d.ts +8 -0
- package/vendor/agent-cli/dist/src/artifacts/build-failure.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/artifacts/build-failure.js +39 -0
- package/vendor/agent-cli/dist/src/artifacts/build-failure.js.map +1 -0
- package/vendor/agent-cli/dist/src/artifacts/dependency-toolchain.d.ts +5 -0
- package/vendor/agent-cli/dist/src/artifacts/dependency-toolchain.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/artifacts/dependency-toolchain.js +45 -0
- package/vendor/agent-cli/dist/src/artifacts/dependency-toolchain.js.map +1 -0
- package/vendor/agent-cli/dist/src/artifacts/preinstalled-dependencies.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/preinstalled-dependencies.js +2 -1
- package/vendor/agent-cli/dist/src/artifacts/preinstalled-dependencies.js.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/prepare.d.ts +2 -0
- package/vendor/agent-cli/dist/src/artifacts/prepare.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/prepare.js +7 -2
- package/vendor/agent-cli/dist/src/artifacts/prepare.js.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/process-artifacts.d.ts +2 -0
- package/vendor/agent-cli/dist/src/artifacts/process-artifacts.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/process-artifacts.js +27 -16
- package/vendor/agent-cli/dist/src/artifacts/process-artifacts.js.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/scene-asset-references.d.ts +14 -0
- package/vendor/agent-cli/dist/src/artifacts/scene-asset-references.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/artifacts/scene-asset-references.js +119 -0
- package/vendor/agent-cli/dist/src/artifacts/scene-asset-references.js.map +1 -0
- package/vendor/agent-cli/dist/src/artifacts/static.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/static.js +20 -6
- package/vendor/agent-cli/dist/src/artifacts/static.js.map +1 -1
- package/vendor/agent-cli/dist/src/cli/process-protocol.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/cli/process-protocol.js +24 -2
- package/vendor/agent-cli/dist/src/cli/process-protocol.js.map +1 -1
- package/vendor/agent-cli/dist/src/cli/process-steering.d.ts +21 -0
- package/vendor/agent-cli/dist/src/cli/process-steering.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/cli/process-steering.js +66 -0
- package/vendor/agent-cli/dist/src/cli/process-steering.js.map +1 -0
- package/vendor/agent-cli/dist/src/context/user-skill-bundle.js +1 -1
- package/vendor/agent-cli/dist/src/context/user-skill-bundle.js.map +1 -1
- package/vendor/agent-cli/dist/src/index.d.ts +4 -1
- package/vendor/agent-cli/dist/src/index.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/index.js +3 -0
- package/vendor/agent-cli/dist/src/index.js.map +1 -1
- package/vendor/agent-cli/dist/src/protocol/messages/messages.gen.d.ts +29 -1
- package/vendor/agent-cli/dist/src/protocol/messages/messages.gen.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/protocol/messages/messages.gen.js +18 -1
- package/vendor/agent-cli/dist/src/protocol/messages/messages.gen.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/client.d.ts +10 -0
- package/vendor/agent-cli/dist/src/session/client.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/client.js +15 -5
- package/vendor/agent-cli/dist/src/session/client.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/link-session.d.ts +3 -0
- package/vendor/agent-cli/dist/src/session/link-session.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/link-session.js +14 -1
- package/vendor/agent-cli/dist/src/session/link-session.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/process-observability.d.ts +3 -0
- package/vendor/agent-cli/dist/src/session/process-observability.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/process-observability.js +11 -0
- package/vendor/agent-cli/dist/src/session/process-observability.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/process-request.d.ts +3 -2
- package/vendor/agent-cli/dist/src/session/process-request.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/process-request.js +27 -9
- package/vendor/agent-cli/dist/src/session/process-request.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/run-start-body.d.ts +1 -0
- package/vendor/agent-cli/dist/src/session/run-start-body.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/run-start-body.js +8 -3
- package/vendor/agent-cli/dist/src/session/run-start-body.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/run-steer.d.ts +42 -0
- package/vendor/agent-cli/dist/src/session/run-steer.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/session/run-steer.js +205 -0
- package/vendor/agent-cli/dist/src/session/run-steer.js.map +1 -0
- package/vendor/agent-cli/dist/src/shared/types.d.ts +6 -0
- package/vendor/agent-cli/dist/src/shared/types.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/tools/context-program-receipt.d.ts +21 -0
- package/vendor/agent-cli/dist/src/tools/context-program-receipt.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/tools/context-program-receipt.js +102 -0
- package/vendor/agent-cli/dist/src/tools/context-program-receipt.js.map +1 -0
- package/vendor/agent-cli/dist/src/tools/context-program.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/tools/context-program.js +3 -0
- package/vendor/agent-cli/dist/src/tools/context-program.js.map +1 -1
- package/resources/js/context/.role/AGENTS_DESIGN.md +0 -9
- package/resources/js/context/agents/aigc-asset.md +0 -168
- package/resources/js/context/knowledge/AigcEnabled.md +0 -49
- package/resources/js/context/knowledge/FrontendComponents.md +0 -17
- package/resources/js/context/knowledge/MobileAdaptation.md +0 -73
- package/resources/js/context/knowledge/MobileAdapted.md +0 -36
- package/resources/js/context/knowledge/Multiplayer/GameplaySystemKnowledge.md +0 -114
- package/resources/js/context/knowledge/Multiplayer/OverviewKnowledge.md +0 -115
- package/resources/js/context/knowledge/Multiplayer/StateSyncKnowledge.md +0 -392
- package/resources/js/context/knowledge/PlatformServices.md +0 -190
- package/resources/js/context/knowledge/ProjectDisplayConfig.md +0 -35
- package/resources/js/context/knowledge/Subsystems/Optional/MultiplayerManagerKnowledge.md +0 -242
- package/resources/js/context/knowledge/Ui.md +0 -11
- package/resources/js/context/knowledge/UiEditorCompat.md +0 -21
- package/resources/js/context/rules/MultiplayerCapability.md +0 -23
- package/resources/js/context/rules/MultiplayerRoomEntryUX.md +0 -63
- package/resources/js/context/rules/PlatformBoundaryModules.md +0 -44
- package/resources/js/context/rules/preview_ready.md +0 -8
- package/resources/js/context/skills/aigc-generate/knowledge/audio.md +0 -39
- package/resources/js/context/skills/aigc-generate/knowledge/batch-replace.md +0 -26
- package/resources/js/context/skills/aigc-generate/knowledge/character2d.md +0 -132
- package/resources/js/context/skills/aigc-generate/knowledge/non-stepwise-aigc.md +0 -53
- package/resources/js/context/skills/aigc-generate/knowledge/texture-prop.md +0 -52
- package/resources/js/context/skills/aigc-generate/knowledge/texture-scene.md +0 -191
- package/resources/js/context/skills/aigc-generate/knowledge/texture-ui.md +0 -55
- package/resources/js/context/skills/asset-search/scripts/asset_display.mjs +0 -62
- package/resources/js/context/skills/asset-search/scripts/config.json +0 -5
- package/resources/js/context/skills/asset-search/scripts/provided_assets.mjs +0 -125
- package/resources/js/context/skills/asset-search/scripts/search.mjs +0 -760
- package/resources/js/context/skills/asset-search/scripts/sprite_source_materializer.mjs +0 -657
- package/resources/js/context/skills/asset-search/strategies/anim2d.md +0 -42
- package/resources/js/context/skills/asset-search/strategies/audio.md +0 -34
- package/resources/js/context/skills/asset-search/strategies/effect2d.md +0 -31
- package/resources/js/context/skills/asset-search/strategies/texture-prop.md +0 -22
- package/resources/js/context/skills/asset-search/strategies/ui-common.md +0 -40
- package/resources/js/context/skills/asset-search/strategies/ui-style.md +0 -28
- package/resources/js/context/skills/export-config/scripts/translate-asset-titles.mjs +0 -161
- package/resources/js/context/skills/lightgame-runtime-adapt/SKILL.md +0 -93
- package/resources/js/context/skills/lightgame-runtime-adapt/project/game-runtime.json +0 -7
- package/resources/js/context/skills/lightgame-runtime-adapt/project/package.json +0 -22
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/identity/qq-ai-game-sdk.min.js +0 -5
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/identity/qq-session.mjs +0 -208
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/identity/shared.mjs +0 -37
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/platform-capture-video.mjs +0 -227
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/platform-service.d.mts +0 -31
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/platform-service.mjs +0 -272
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/platform.d.mts +0 -79
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/platform.mjs +0 -29
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/release.json +0 -22
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tooling/cli.mjs +0 -16
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tooling/project.d.mts +0 -4
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tooling/project.mjs +0 -50
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tooling/vite.d.mts +0 -3
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tooling/vite.mjs +0 -72
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tools/assets.d.mts +0 -24
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tools/assets.mjs +0 -2
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tools/astc.d.mts +0 -10
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tools/astc.mjs +0 -1
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/config-export.mjs +0 -37
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/refresh-runtime.mjs +0 -50
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/cli.mjs +0 -20
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/config.d.mts +0 -19
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/config.mjs +0 -1
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/installed.json +0 -6
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/project.d.mts +0 -6
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/project.mjs +0 -77
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/vite.d.mts +0 -2
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/vite.mjs +0 -34
- package/resources/js/context/skills/lightgame-runtime-adapt/project/src/display/ui-stage.ts +0 -156
- package/resources/js/context/skills/lightgame-runtime-adapt/project/src/display/viewport.ts +0 -249
- package/resources/js/context/skills/lightgame-runtime-adapt/project/src/main.ts +0 -87
- package/resources/js/context/skills/lightgame-runtime-adapt/project/src/platform.ts +0 -2
- package/resources/js/context/skills/lightgame-runtime-adapt/project/src/screenUi.ts +0 -185
- package/resources/js/context/skills/lightgame-runtime-adapt/project/src/style.css +0 -294
- package/resources/js/context/skills/lightgame-runtime-adapt/project/tsconfig.json +0 -20
- package/resources/js/context/skills/lightgame-runtime-adapt/project/vite.config.ts +0 -5
- package/resources/js/context/skills/lightgame-runtime-adapt/scripts/install-template.mjs +0 -159
- package/resources/js/context/skills/mobile-adaptation/SKILL.md +0 -277
- package/resources/js/context/skills/mobile-adaptation/assets/example/src/input/input-config.json +0 -50
- package/resources/js/context/skills/mobile-adaptation/assets/example/src/input/input-layer.ts +0 -862
- package/resources/js/context/skills/mobile-adaptation/assets/example/src/input/input-platform.ts +0 -92
- package/resources/js/context/skills/mobile-adaptation/assets/example/src/input/input-primitives.ts +0 -254
- package/resources/js/context/skills/mobile-adaptation/assets/example/src/input/look-pad.ts +0 -245
- package/resources/js/context/skills/mobile-adaptation/assets/example/src/ui/touch-controls.css +0 -135
- package/resources/js/context/skills/mobile-adaptation/references/input-config.md +0 -342
- package/resources/js/context/skills/mobile-adaptation/references/verification.md +0 -140
- package/resources/js/context/skills/mobile-adaptation/references/web-audio.md +0 -11
- package/resources/js/context/skills/mobile-compat-qa/SKILL.md +0 -53
- package/resources/js/context/skills/mobile-compat-qa/references/startup-diagnosis.md +0 -23
- package/resources/js/context/skills/mobile-compat-qa/references/web-lifecycle.md +0 -20
- package/resources/js/context/skills/mobile-compat-qa/references/web-performance.md +0 -19
- package/resources/js/context/skills/optimization-suggestions/SKILL.md +0 -89
- package/resources/js/context/skills/platform-services/SKILL.md +0 -101
- package/resources/js/context/skills/platform-services/assets/modules/MultiplayerManager.ts +0 -465
- package/resources/js/context/skills/platform-services/assets/modules/eventBus.ts +0 -57
- package/resources/js/context/skills/platform-services/assets/modules/identity/qq-ai-game-sdk.min.js +0 -5
- package/resources/js/context/skills/platform-services/assets/modules/identity/qq-session.mjs +0 -208
- package/resources/js/context/skills/platform-services/assets/modules/identity/shared.mjs +0 -37
- package/resources/js/context/skills/platform-services/assets/modules/leaderboard.d.mts +0 -39
- package/resources/js/context/skills/platform-services/assets/modules/leaderboard.mjs +0 -1
- package/resources/js/context/skills/platform-services/assets/modules/log.ts +0 -35
- package/resources/js/context/skills/platform-services/assets/modules/multiplayer/clockSync.ts +0 -61
- package/resources/js/context/skills/platform-services/assets/modules/multiplayer/dsClient.ts +0 -52
- package/resources/js/context/skills/platform-services/assets/modules/multiplayer/payloadCodec.ts +0 -30
- package/resources/js/context/skills/platform-services/assets/modules/multiplayer/roomHttp.ts +0 -89
- package/resources/js/context/skills/platform-services/assets/modules/multiplayer/types.ts +0 -47
- package/resources/js/context/skills/platform-services/assets/modules/platform-service.d.mts +0 -31
- package/resources/js/context/skills/platform-services/assets/modules/platform-service.mjs +0 -272
- package/resources/js/context/skills/platform-services/assets/modules/save.d.mts +0 -49
- package/resources/js/context/skills/platform-services/assets/modules/save.mjs +0 -1
- package/resources/js/context/skills/platform-services/assets/scaffold/ds/main.mjs +0 -7
- package/resources/js/context/skills/platform-services/assets/scaffold/ds/rooms/SyncRoom.mjs +0 -264
- package/resources/js/context/skills/platform-services/assets/scaffold/ds/rooms/syncSchema.mjs +0 -39
- package/resources/js/context/skills/platform-services/references/SERVER_GUIDE.md +0 -139
- package/resources/js/context/skills/platform-services/references/api_reference.md +0 -18
- package/resources/js/context/skills/platform-services/references/leaderboard_playbook.md +0 -96
- package/resources/js/context/skills/platform-services/scripts/install.mjs +0 -148
- package/resources/js/context/skills/resolution-adaptation/SKILL.md +0 -47
- package/resources/js/context/skills/resolution-adaptation/assets/display/ui-stage.ts +0 -156
- package/resources/js/context/skills/resolution-adaptation/assets/display/viewport.ts +0 -249
- package/resources/js/context/skills/resolution-adaptation/assets/example/main.ts +0 -98
- package/resources/js/context/skills/resolution-adaptation/assets/example/ui-tokens.css +0 -200
- package/resources/js/context/skills/resolution-adaptation/references/audit.md +0 -31
- package/resources/js/context/skills/resolution-adaptation/references/device-safe-area.md +0 -40
- package/resources/js/context/skills/resolution-adaptation/references/game-ui-occlusion.md +0 -18
- package/resources/js/context/skills/resolution-adaptation/references/layout-rules.md +0 -15
- package/resources/js/context/skills/resolution-adaptation/references/troubleshooting.md +0 -34
- package/resources/js/context/skills/resolution-adaptation/references/viewport-api.md +0 -38
- package/resources/js/context/skills/resolution-adaptation/references/world-resize.md +0 -55
- package/resources/js/context/skills/resolution-adaptation/scripts/aspect_audit.mjs +0 -448
- package/resources/js/context/skills/scene-editor-compat/SKILL.md +0 -94
- package/resources/js/context/skills/scene-editor-compat/assets/example/localcraft.assets.json +0 -13
- package/resources/js/context/skills/scene-editor-compat/assets/example/localcraft.scene-editor.json +0 -6
- package/resources/js/context/skills/scene-editor-compat/assets/example/src/game/sceneAdapter.ts +0 -25
- package/resources/js/context/skills/scene-editor-compat/assets/example/src/scenes/main.scene.json +0 -18
- package/resources/js/context/skills/scene-editor-compat/assets/runtime/release.json +0 -7
- package/resources/js/context/skills/scene-editor-compat/assets/runtime/scene.d.mts +0 -42
- package/resources/js/context/skills/scene-editor-compat/assets/runtime/scene.mjs +0 -144
- package/resources/js/context/skills/scene-editor-compat/docs/contract.md +0 -330
- package/resources/js/context/skills/scene-editor-compat/docs/resource-sync.md +0 -64
- package/resources/js/context/skills/scene-editor-compat/docs/runtime-state.md +0 -28
- package/resources/js/context/skills/scene-editor-compat/docs/terrain-contract.md +0 -47
- package/resources/js/context/skills/scene-editor-compat/docs/visual-contract.md +0 -64
- package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/localcraft.assets.json +0 -38
- package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/localcraft.scene-editor.json +0 -9
- package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/src/game/sceneAdapter.ts +0 -59
- package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/src/game/sceneBlockers.ts +0 -30
- package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/src/game/sceneFileAssets.ts +0 -66
- package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/src/scenes/Main.Scene.ts +0 -20
- package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/src/scenes/SceneTypes.ts +0 -26
- package/resources/js/context/skills/scene-editor-compat/references/contract.md +0 -73
- package/resources/js/context/skills/scene-editor-compat/scripts/apply_scene_marker.py +0 -162
- package/resources/js/context/skills/scene-editor-compat/scripts/check_scene_contract.py +0 -853
- package/resources/js/context/skills/scene-editor-compat/scripts/check_scene_resource_urls.py +0 -173
- package/resources/js/context/skills/scene-editor-compat/scripts/scene-editor.mjs +0 -427
- package/resources/js/context/skills/scene-editor-compat/version.json +0 -1
- package/resources/js/context/skills/ui-editor-compat/SKILL.md +0 -48
- package/resources/js/context/skills/ui-editor-compat/assets/example/hud/WidgetLayout_Hud.ts +0 -35
- package/resources/js/context/skills/ui-editor-compat/assets/example/hud/WidgetLogic_Hud.ts +0 -74
- package/resources/js/context/skills/ui-editor-compat/assets/example/hud/hud.css +0 -60
- package/resources/js/context/skills/ui-editor-compat/assets/runtime/dom-ui.d.mts +0 -45
- package/resources/js/context/skills/ui-editor-compat/assets/runtime/dom-ui.mjs +0 -265
- package/resources/js/context/skills/ui-editor-compat/assets/runtime/release.json +0 -7
- package/resources/js/context/skills/ui-editor-compat/references/contract.md +0 -132
- package/resources/js/context/skills/ui-editor-compat/scripts/editor-contract.mjs +0 -327
- package/resources/js/context/skills/ui-editor-compat/scripts/project-files.mjs +0 -80
- package/resources/js/context/skills/ui-editor-compat/scripts/ui-editor.mjs +0 -84
- package/resources/js/context/skills/version-update/SKILL.md +0 -192
- package/resources/js/context/skills/version-update/scripts/check_runtime_refs.mjs +0 -129
- package/resources/js/context/skills/version-update/scripts/feature_snapshot.mjs +0 -159
- package/resources/js/context/skills/version-update/scripts/update_feature_version.mjs +0 -157
- package/resources/js/context/skills/version-update/upgrade_diffs/.gitkeep +0 -0
- package/resources/js/context/version/version.json +0 -1
- package/resources/js/project/SPEC/assist/.gitkeep +0 -0
- package/resources/js/project/SPEC/guide/.gitkeep +0 -0
- package/resources/js/project/SPEC/plan/.gitkeep +0 -0
- package/resources/js/project/SPEC/readme.md +0 -6
- package/resources/js/project/SPEC/res/.gitkeep +0 -0
- package/resources/js/project/SPEC/task-item/.gitkeep +0 -0
- package/resources/js/project/runtime/lightgame/1.0.0/platform/config.d.mts +0 -19
- package/resources/js/project/runtime/lightgame/1.0.0/platform/config.mjs +0 -1
- package/resources/js/project/runtime/lightgame/1.0.0/platform/leaderboard.d.mts +0 -39
- package/resources/js/project/runtime/lightgame/1.0.0/platform/leaderboard.mjs +0 -1
- package/resources/js/project/runtime/lightgame/1.0.0/platform/platform-capture-video.mjs +0 -227
- package/resources/js/project/runtime/lightgame/1.0.0/platform/platform-service.d.mts +0 -25
- package/resources/js/project/runtime/lightgame/1.0.0/platform/platform-service.mjs +0 -1
- package/resources/js/project/runtime/lightgame/1.0.0/platform/platform.d.mts +0 -79
- package/resources/js/project/runtime/lightgame/1.0.0/platform/platform.mjs +0 -29
- package/resources/js/project/runtime/lightgame/1.0.0/platform/save.d.mts +0 -49
- package/resources/js/project/runtime/lightgame/1.0.0/platform/save.mjs +0 -1
- package/resources/js/project/runtime/lightgame/1.0.0/release.json +0 -37
- package/resources/js/project/runtime/lightgame/1.0.0/tooling/cli.mjs +0 -2
- package/resources/js/project/runtime/lightgame/1.0.0/tooling/project.d.mts +0 -8
- package/resources/js/project/runtime/lightgame/1.0.0/tooling/project.mjs +0 -2
- package/resources/js/project/runtime/lightgame/1.0.0/tooling/vite.d.mts +0 -3
- package/resources/js/project/runtime/lightgame/1.0.0/tooling/vite.mjs +0 -8
- package/resources/js/project/runtime/lightgame/1.0.0/tools/assets.d.mts +0 -24
- package/resources/js/project/runtime/lightgame/1.0.0/tools/assets.mjs +0 -2
- package/resources/js/project/runtime/lightgame/1.0.0/tools/astc.d.mts +0 -10
- package/resources/js/project/runtime/lightgame/1.0.0/tools/astc.mjs +0 -1
- package/resources/js/project/runtime/lightgame/1.0.0/tools/audio.d.mts +0 -20
- package/resources/js/project/runtime/lightgame/1.0.0/tools/audio.mjs +0 -1
- package/resources/js/project/runtime/lightgame/1.0.0/tools/canvas.d.mts +0 -21
- package/resources/js/project/runtime/lightgame/1.0.0/tools/canvas.mjs +0 -1
- package/resources/js/project/runtime/lightgame/1.0.0/tools/input.d.mts +0 -17
- package/resources/js/project/runtime/lightgame/1.0.0/tools/input.mjs +0 -1
- package/resources/js/project/runtime/lightgame/1.0.0/tools/three.d.mts +0 -40
- package/resources/js/project/runtime/lightgame/1.0.0/tools/three.mjs +0 -1
- package/resources/js/project/runtime/lightgame/1.0.0/tools/ui.d.mts +0 -10
- package/resources/js/project/runtime/lightgame/1.0.0/tools/ui.mjs +0 -1
- package/resources/js/project/runtime/lightgame/1.0.0/tools/video.d.mts +0 -8
- package/resources/js/project/runtime/lightgame/1.0.0/tools/video.mjs +0 -1
- package/resources/js/project/scripts/refresh-runtime.mjs +0 -50
- package/resources/js/project/vendor/core-manager-js/package.json +0 -33
- package/resources/js/project/vendor/core-manager-js/src/.versions.json +0 -42
- package/resources/js/project/vendor/core-manager-js/src/CoreManagerPlugin.ts +0 -41
- package/resources/js/project/vendor/core-manager-js/src/assetManager/AssetRef.ts +0 -93
- package/resources/js/project/vendor/core-manager-js/src/assetManager/AstcFirstImageFile.ts +0 -203
- package/resources/js/project/vendor/core-manager-js/src/assetManager/AstcTextureLoader.ts +0 -106
- package/resources/js/project/vendor/core-manager-js/src/assetManager/resolveAssetUrl.test.ts +0 -25
- package/resources/js/project/vendor/core-manager-js/src/assetManager/resolveAssetUrl.ts +0 -21
- package/resources/js/project/vendor/core-manager-js/src/audioManager/AudioManager.test.ts +0 -65
- package/resources/js/project/vendor/core-manager-js/src/audioManager/AudioManager.ts +0 -340
- package/resources/js/project/vendor/core-manager-js/src/configManager/FeatureConfig.ts +0 -87
- package/resources/js/project/vendor/core-manager-js/src/configManager/tuneRuntime.d.mts +0 -92
- package/resources/js/project/vendor/core-manager-js/src/configManager/tuneRuntime.mjs +0 -271
- package/resources/js/project/vendor/core-manager-js/src/index.ts +0 -31
- package/resources/js/project/vendor/core-manager-js/src/inputManager/InputConfig.ts +0 -81
- package/resources/js/project/vendor/core-manager-js/src/inputManager/InputManager.test.ts +0 -43
- package/resources/js/project/vendor/core-manager-js/src/inputManager/InputManager.ts +0 -32
- package/resources/js/project/vendor/core-manager-js/src/inputManager/InputRuntime.test.ts +0 -141
- package/resources/js/project/vendor/core-manager-js/src/inputManager/InputRuntime.ts +0 -20
- package/resources/js/project/vendor/core-manager-js/src/inputManager/KeyboardProvider.ts +0 -183
- package/resources/js/project/vendor/core-manager-js/src/inputManager/TouchProvider.ts +0 -304
- package/resources/js/project/vendor/core-manager-js/src/inputManager/VirtualJoystick.ts +0 -351
- package/resources/js/project/vendor/core-manager-js/src/inputManager/_internal/InputManagerImpl.ts +0 -180
- package/resources/js/project/vendor/core-manager-js/src/inputManager/icons.b64 +0 -13
- package/resources/js/project/vendor/core-manager-js/src/inputManager/icons.b64.d.ts +0 -14
- package/resources/js/project/vendor/core-manager-js/src/inputManager/input_config.example.json +0 -68
- package/resources/js/project/vendor/core-manager-js/src/logManager/DebugConsole.ts +0 -433
- package/resources/js/project/vendor/core-manager-js/src/logManager/LogCapture.ts +0 -118
- package/resources/js/project/vendor/core-manager-js/src/logManager/LogManager.ts +0 -444
- package/resources/js/project/vendor/core-manager-js/src/logManager/ScreenCapture.ts +0 -485
- package/resources/js/project/vendor/core-manager-js/src/logManager/ScreenCaptureVideo.test.ts +0 -66
- package/resources/js/project/vendor/core-manager-js/src/logManager/ScreenCaptureVideo.ts +0 -149
- package/resources/js/project/vendor/core-manager-js/src/logManager/icons.b64 +0 -9
- package/resources/js/project/vendor/core-manager-js/src/resourceManager/AssetUrlResolver.ts +0 -29
- package/resources/js/project/vendor/core-manager-js/src/resourceManager/ResourceManager.test.ts +0 -88
- package/resources/js/project/vendor/core-manager-js/src/resourceManager/ResourceManager.ts +0 -122
- package/resources/js/project/vendor/core-manager-js/src/runtime.ts +0 -24
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/CharacterEntity.ts +0 -318
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/CharacterPhysicsBinding.test.ts +0 -151
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/CharacterPhysicsBinding.ts +0 -235
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/EffectComposite.test.ts +0 -98
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/EffectComposite.ts +0 -94
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/EffectEntity.ts +0 -209
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/FxManager.test.ts +0 -106
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/FxManager.ts +0 -341
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/FxRecipe.test.ts +0 -68
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/FxRecipe.ts +0 -236
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/SpriteAnimManager.test.ts +0 -22
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/SpriteAnimManager.ts +0 -29
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/SpriteEntity.test.ts +0 -197
- package/resources/js/project/vendor/core-manager-js/src/uiManager/DomUiContracts.ts +0 -9
- package/resources/js/project/vendor/core-manager-js/src/uiManager/DomUiKit.ts +0 -555
- package/resources/js/project/vendor/core-manager-js/src/uiManager/UIFacadePlugin.test.ts +0 -112
- package/resources/js/project/vendor/core-manager-js/src/uiManager/UIFacadePlugin.ts +0 -178
- package/resources/js/project/vendor/core-manager-js/src/uiManager/ui-base.css +0 -246
- package/resources/js/project/vendor/core-manager-js/src/videoManager/VideoManager.ts +0 -139
- package/resources/js/project/vendor/core-manager-js/tsconfig.json +0 -15
- package/resources/js/project/vendor/run.sh +0 -4
- package/resources/js/project/version/craft_feature_version.json +0 -42
- package/resources/js/project/version/project_feature_version.json +0 -11
- package/resources/js3d/context/.role/AGENTS_DESIGN.md +0 -9
- package/resources/js3d/context/knowledge/3D/PoseInterpolationKnowledge.md +0 -75
- package/resources/js3d/context/knowledge/CodingGuide/SceneEditableGuide.md +0 -42
- package/resources/js3d/context/knowledge/FrontendComponents.md +0 -19
- package/resources/js3d/context/knowledge/MobileAdaptation.md +0 -73
- package/resources/js3d/context/knowledge/MobileAdapted.md +0 -36
- package/resources/js3d/context/knowledge/Multiplayer/GameplaySystemKnowledge.md +0 -114
- package/resources/js3d/context/knowledge/Multiplayer/OverviewKnowledge.md +0 -117
- package/resources/js3d/context/knowledge/Multiplayer/StateSyncKnowledge.md +0 -430
- package/resources/js3d/context/knowledge/PlatformServices.md +0 -190
- package/resources/js3d/context/knowledge/ProjectDisplayConfig.md +0 -35
- package/resources/js3d/context/knowledge/SceneEditorCompat.md +0 -35
- package/resources/js3d/context/knowledge/StepByStep.md +0 -21
- package/resources/js3d/context/knowledge/Subsystems/Optional/MultiplayerManagerKnowledge.md +0 -242
- package/resources/js3d/context/knowledge/UiEditorCompat.md +0 -21
- package/resources/js3d/context/rules/MultiplayerCapability.md +0 -27
- package/resources/js3d/context/rules/MultiplayerRoomEntryUX.md +0 -63
- package/resources/js3d/context/rules/PlatformBoundaryModules.md +0 -44
- package/resources/js3d/context/rules/preview_ready.md +0 -8
- package/resources/js3d/context/skills/aigc-integration/assets/sprite-sheet-player.mjs +0 -70
- package/resources/js3d/context/skills/aigc-integration/callback.md +0 -77
- package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/README.md +0 -23
- package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/audio-aigc-knowledge.md +0 -38
- package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/character2d-aigc-knowledge.md +0 -72
- package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/staticmesh-aigc-knowledge.md +0 -33
- package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/texture-prop-aigc-knowledge.md +0 -36
- package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/texture-scene-aigc-knowledge.md +0 -37
- package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/texture-ui-aigc-knowledge.md +0 -35
- package/resources/js3d/context/skills/asset-search/references/sprite-sheets.md +0 -58
- package/resources/js3d/context/skills/asset-search/scripts/asset_display.mjs +0 -62
- package/resources/js3d/context/skills/asset-search/scripts/config.json +0 -235
- package/resources/js3d/context/skills/asset-search/scripts/manifest_pipeline.mjs +0 -905
- package/resources/js3d/context/skills/asset-search/scripts/preflight.mjs +0 -79
- package/resources/js3d/context/skills/asset-search/scripts/provided_assets.mjs +0 -74
- package/resources/js3d/context/skills/asset-search/scripts/search.mjs +0 -637
- package/resources/js3d/context/skills/asset-search/scripts/sprite_source_materializer.mjs +0 -667
- package/resources/js3d/context/skills/asset-search/strategies/anim2d.md +0 -42
- package/resources/js3d/context/skills/asset-search/strategies/effect2d.md +0 -31
- package/resources/js3d/context/skills/asset-usage-audit/references/case-tidewater-zoo.md +0 -89
- package/resources/js3d/context/skills/asset-usage-audit/references/optimization-playbook.md +0 -143
- package/resources/js3d/context/skills/asset-usage-audit/references/usage-model.md +0 -90
- package/resources/js3d/context/skills/export-config/scripts/translate-asset-titles.mjs +0 -161
- package/resources/js3d/context/skills/game-art-style/SKILL.md +0 -60
- package/resources/js3d/context/skills/game-art-style/assets/previews/cartoon.png +0 -0
- package/resources/js3d/context/skills/game-art-style/assets/previews/comic.png +0 -0
- package/resources/js3d/context/skills/game-art-style/assets/previews/cozy.png +0 -0
- package/resources/js3d/context/skills/game-art-style/assets/previews/cyber.png +0 -0
- package/resources/js3d/context/skills/game-art-style/assets/previews/horror.png +0 -0
- package/resources/js3d/context/skills/game-art-style/assets/previews/lowpoly.png +0 -0
- package/resources/js3d/context/skills/game-art-style/assets/previews/paper.png +0 -0
- package/resources/js3d/context/skills/game-art-style/assets/previews/voxel.png +0 -0
- package/resources/js3d/context/skills/game-art-style/references/art-parameters-lite.md +0 -38
- package/resources/js3d/context/skills/game-art-style/references/construction.md +0 -111
- package/resources/js3d/context/skills/game-art-style/references/materials-textures.md +0 -105
- package/resources/js3d/context/skills/game-art-style/references/sources.md +0 -25
- package/resources/js3d/context/skills/game-art-style/references/styles/cartoon.md +0 -175
- package/resources/js3d/context/skills/game-art-style/references/styles/comic.md +0 -168
- package/resources/js3d/context/skills/game-art-style/references/styles/cozy.md +0 -191
- package/resources/js3d/context/skills/game-art-style/references/styles/cyber.md +0 -165
- package/resources/js3d/context/skills/game-art-style/references/styles/horror.md +0 -173
- package/resources/js3d/context/skills/game-art-style/references/styles/lowpoly.md +0 -185
- package/resources/js3d/context/skills/game-art-style/references/styles/paper.md +0 -181
- package/resources/js3d/context/skills/game-art-style/references/styles/voxel.md +0 -189
- package/resources/js3d/context/skills/game-art-style/references/user-style-document.md +0 -88
- package/resources/js3d/context/skills/mobile-adaptation/SKILL.md +0 -301
- package/resources/js3d/context/skills/mobile-adaptation/assets/example/src/input/input-config.json +0 -104
- package/resources/js3d/context/skills/mobile-adaptation/assets/example/src/input/input-layer.ts +0 -933
- package/resources/js3d/context/skills/mobile-adaptation/assets/example/src/input/input-platform.ts +0 -92
- package/resources/js3d/context/skills/mobile-adaptation/assets/example/src/input/input-primitives.ts +0 -254
- package/resources/js3d/context/skills/mobile-adaptation/assets/example/src/input/look-pad.ts +0 -245
- package/resources/js3d/context/skills/mobile-adaptation/assets/example/src/ui/touch-controls.css +0 -257
- package/resources/js3d/context/skills/mobile-adaptation/references/input-config.md +0 -342
- package/resources/js3d/context/skills/mobile-adaptation/references/verification.md +0 -140
- package/resources/js3d/context/skills/mobile-adaptation/references/web-audio.md +0 -11
- package/resources/js3d/context/skills/mobile-compat-qa/SKILL.md +0 -53
- package/resources/js3d/context/skills/mobile-compat-qa/references/startup-diagnosis.md +0 -23
- package/resources/js3d/context/skills/mobile-compat-qa/references/web-form-input.md +0 -10
- package/resources/js3d/context/skills/mobile-compat-qa/references/web-lifecycle.md +0 -20
- package/resources/js3d/context/skills/mobile-compat-qa/references/web-performance.md +0 -19
- package/resources/js3d/context/skills/optimization-suggestions/SKILL.md +0 -74
- package/resources/js3d/context/skills/performance-audit/references/case-notes.md +0 -93
- package/resources/js3d/context/skills/performance-audit/references/rules.md +0 -183
- package/resources/js3d/context/skills/platform-services/SKILL.md +0 -101
- package/resources/js3d/context/skills/platform-services/assets/modules/MultiplayerManager.ts +0 -465
- package/resources/js3d/context/skills/platform-services/assets/modules/eventBus.ts +0 -57
- package/resources/js3d/context/skills/platform-services/assets/modules/identity/qq-ai-game-sdk.min.js +0 -5
- package/resources/js3d/context/skills/platform-services/assets/modules/identity/qq-session.mjs +0 -208
- package/resources/js3d/context/skills/platform-services/assets/modules/identity/shared.mjs +0 -37
- package/resources/js3d/context/skills/platform-services/assets/modules/leaderboard.d.mts +0 -39
- package/resources/js3d/context/skills/platform-services/assets/modules/leaderboard.mjs +0 -1
- package/resources/js3d/context/skills/platform-services/assets/modules/log.ts +0 -35
- package/resources/js3d/context/skills/platform-services/assets/modules/multiplayer/clockSync.ts +0 -61
- package/resources/js3d/context/skills/platform-services/assets/modules/multiplayer/dsClient.ts +0 -52
- package/resources/js3d/context/skills/platform-services/assets/modules/multiplayer/payloadCodec.ts +0 -30
- package/resources/js3d/context/skills/platform-services/assets/modules/multiplayer/roomHttp.ts +0 -89
- package/resources/js3d/context/skills/platform-services/assets/modules/multiplayer/types.ts +0 -47
- package/resources/js3d/context/skills/platform-services/assets/modules/platform-service.d.mts +0 -31
- package/resources/js3d/context/skills/platform-services/assets/modules/platform-service.mjs +0 -272
- package/resources/js3d/context/skills/platform-services/assets/modules/save.d.mts +0 -49
- package/resources/js3d/context/skills/platform-services/assets/modules/save.mjs +0 -1
- package/resources/js3d/context/skills/platform-services/assets/scaffold/ds/main.mjs +0 -7
- package/resources/js3d/context/skills/platform-services/assets/scaffold/ds/rooms/SyncRoom.mjs +0 -264
- package/resources/js3d/context/skills/platform-services/assets/scaffold/ds/rooms/syncSchema.mjs +0 -39
- package/resources/js3d/context/skills/platform-services/references/SERVER_GUIDE.md +0 -139
- package/resources/js3d/context/skills/platform-services/references/api_reference.md +0 -18
- package/resources/js3d/context/skills/platform-services/references/leaderboard_playbook.md +0 -96
- package/resources/js3d/context/skills/platform-services/scripts/install.mjs +0 -148
- package/resources/js3d/context/skills/resolution-adaptation/SKILL.md +0 -46
- package/resources/js3d/context/skills/resolution-adaptation/assets/display/ui-stage.ts +0 -156
- package/resources/js3d/context/skills/resolution-adaptation/assets/display/viewport.ts +0 -239
- package/resources/js3d/context/skills/resolution-adaptation/assets/example/main.ts +0 -129
- package/resources/js3d/context/skills/resolution-adaptation/assets/example/ui-tokens.css +0 -188
- package/resources/js3d/context/skills/resolution-adaptation/references/audit.md +0 -31
- package/resources/js3d/context/skills/resolution-adaptation/references/device-safe-area.md +0 -40
- package/resources/js3d/context/skills/resolution-adaptation/references/game-ui-occlusion.md +0 -18
- package/resources/js3d/context/skills/resolution-adaptation/references/layout-rules.md +0 -15
- package/resources/js3d/context/skills/resolution-adaptation/references/troubleshooting.md +0 -34
- package/resources/js3d/context/skills/resolution-adaptation/references/viewport-api.md +0 -38
- package/resources/js3d/context/skills/resolution-adaptation/scripts/aspect_audit.mjs +0 -448
- package/resources/js3d/context/skills/scene-editor-compat/SKILL.md +0 -599
- package/resources/js3d/context/skills/scene-editor-compat/references/bundle-contract.md +0 -141
- package/resources/js3d/context/skills/scene-editor-compat/references/editor-integration.md +0 -92
- package/resources/js3d/context/skills/scene-editor-compat/references/scene-data-format.md +0 -125
- package/resources/js3d/context/skills/scene-editor-compat/references/slots-rules.md +0 -113
- package/resources/js3d/context/skills/scene-editor-compat/scripts/scene-editor.mjs +0 -1187
- package/resources/js3d/context/skills/threejs-game-quality/SKILL.md +0 -53
- package/resources/js3d/context/skills/threejs-game-quality/agents/openai.yaml +0 -4
- package/resources/js3d/context/skills/threejs-game-quality/references/01-build.md +0 -94
- package/resources/js3d/context/skills/threejs-game-quality/references/02-avoid.md +0 -50
- package/resources/js3d/context/skills/threejs-game-quality/references/03-detect.md +0 -105
- package/resources/js3d/context/skills/threejs-game-quality/references/camera-by-genre.md +0 -147
- package/resources/js3d/context/skills/threejs-game-quality/references/camera-distance.md +0 -79
- package/resources/js3d/context/skills/threejs-game-quality/references/camera-sources.md +0 -56
- package/resources/js3d/context/skills/threejs-game-quality/references/character-motion-face.md +0 -51
- package/resources/js3d/context/skills/threejs-game-quality/references/parameter-contract.md +0 -55
- package/resources/js3d/context/skills/threejs-game-quality/references/refine-existing.md +0 -78
- package/resources/js3d/context/skills/threejs-game-quality/references/rendering-stability.md +0 -84
- package/resources/js3d/context/skills/threejs-game-quality/references/runtime-tools.md +0 -120
- package/resources/js3d/context/skills/threejs-game-quality/scripts/package.json +0 -4
- package/resources/js3d/context/skills/threejs-game-quality/scripts/runtime-audit.js +0 -238
- package/resources/js3d/context/skills/ui-editor-compat/SKILL.md +0 -59
- package/resources/js3d/context/skills/ui-editor-compat/assets/example/hud/WidgetLayout_Hud.ts +0 -35
- package/resources/js3d/context/skills/ui-editor-compat/assets/example/hud/WidgetLogic_Hud.ts +0 -61
- package/resources/js3d/context/skills/ui-editor-compat/assets/example/hud/hud.css +0 -60
- package/resources/js3d/context/skills/ui-editor-compat/assets/runtime/dom-ui.d.mts +0 -45
- package/resources/js3d/context/skills/ui-editor-compat/assets/runtime/dom-ui.mjs +0 -265
- package/resources/js3d/context/skills/ui-editor-compat/assets/runtime/release.json +0 -7
- package/resources/js3d/context/skills/ui-editor-compat/references/contract.md +0 -110
- package/resources/js3d/context/skills/ui-editor-compat/scripts/editor-contract.mjs +0 -327
- package/resources/js3d/context/skills/ui-editor-compat/scripts/project-files.mjs +0 -80
- package/resources/js3d/context/skills/ui-editor-compat/scripts/ui-editor.mjs +0 -84
- package/resources/js3d/context/skills/version-update/SKILL.md +0 -191
- package/resources/js3d/context/skills/version-update/scripts/check_runtime_refs.mjs +0 -129
- package/resources/js3d/context/skills/version-update/scripts/feature_snapshot.mjs +0 -159
- package/resources/js3d/context/skills/version-update/scripts/update_feature_version.mjs +0 -157
- package/resources/js3d/context/skills/version-update/upgrade_diffs/.gitkeep +0 -0
- package/resources/js3d/context/version/version.json +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/config.d.mts +0 -19
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/config.mjs +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/leaderboard.d.mts +0 -39
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/leaderboard.mjs +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/platform-capture-video.mjs +0 -227
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/platform-service.d.mts +0 -25
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/platform-service.mjs +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/platform.d.mts +0 -79
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/platform.mjs +0 -30
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/save.d.mts +0 -49
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/save.mjs +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/release.json +0 -39
- package/resources/js3d/project/runtime/lightgame/1.0.0/tooling/cli.mjs +0 -2
- package/resources/js3d/project/runtime/lightgame/1.0.0/tooling/project.d.mts +0 -8
- package/resources/js3d/project/runtime/lightgame/1.0.0/tooling/project.mjs +0 -2
- package/resources/js3d/project/runtime/lightgame/1.0.0/tooling/vite.d.mts +0 -3
- package/resources/js3d/project/runtime/lightgame/1.0.0/tooling/vite.mjs +0 -7
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/assets.d.mts +0 -24
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/assets.mjs +0 -2
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/astc.d.mts +0 -10
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/astc.mjs +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/audio.d.mts +0 -20
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/audio.mjs +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/canvas.d.mts +0 -21
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/canvas.mjs +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/glb.d.mts +0 -26
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/glb.mjs +0 -351
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/input.d.mts +0 -17
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/input.mjs +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/three.d.mts +0 -40
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/three.mjs +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/ui.d.mts +0 -10
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/ui.mjs +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/video.d.mts +0 -8
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/video.mjs +0 -1
- package/resources/js3d/project/scripts/refresh-runtime.mjs +0 -50
- package/resources/js3d/project/vendor/core-manager-three/package.json +0 -12
- package/resources/js3d/project/vendor/core-manager-three/src/index.ts +0 -2
- package/resources/js3d/project/vendor/run.sh +0 -4
- package/resources/js3d/project/version/craft_feature_version.json +0 -42
- package/resources/js3d/project/version/project_feature_version.json +0 -11
- package/vendor/agent-cli/dist/src/artifacts/scene-asset-delivery.d.ts +0 -7
- package/vendor/agent-cli/dist/src/artifacts/scene-asset-delivery.d.ts.map +0 -1
- package/vendor/agent-cli/dist/src/artifacts/scene-asset-delivery.js +0 -145
- package/vendor/agent-cli/dist/src/artifacts/scene-asset-delivery.js.map +0 -1
- /package/resources/js/{context/skills/export-config/scripts → project/scripts/config-export}/assert-asset-wiring.mjs +0 -0
- /package/resources/js3d/{context/skills/export-config/scripts → project/scripts/config-export}/assert-asset-wiring.mjs +0 -0
- /package/resources/js3d/{context/skills/export-config/scripts → project/scripts/config-export}/sync-asset-controls.mjs +0 -0
|
@@ -30,7 +30,7 @@ export class Publications {
|
|
|
30
30
|
async #record(name, id, owner) {
|
|
31
31
|
const record = await this.store.read(id);
|
|
32
32
|
if (this.platform.account().user_id !== owner || record.name !== name || record.owner !== owner || record.platform !== this.platform.base || record.revision !== publicationRevision(record)) {
|
|
33
|
-
throw new Error('
|
|
33
|
+
throw new Error('Publication belongs to a different project, account, platform or material revision');
|
|
34
34
|
}
|
|
35
35
|
return record;
|
|
36
36
|
}
|
|
@@ -47,15 +47,13 @@ export class Publications {
|
|
|
47
47
|
|
|
48
48
|
async prepare(check, project, input, owner, signal, stagedCover, previousCover) {
|
|
49
49
|
const materials = publicationMaterials(input);
|
|
50
|
-
if (stagedCover && materials.cover_path) throw new Error('
|
|
50
|
+
if (stagedCover && materials.cover_path) throw new Error('Choose one publication cover source');
|
|
51
51
|
const source = await this.drafts.publicationSource(check.name,check.task_id,owner,signal);
|
|
52
|
-
if (source.state !== 'draft_ready' || !/^[0-9a-f]{64}$/.test(source.external_manifest_sha256 ?? '')) throw new Error('
|
|
52
|
+
if (source.state !== 'draft_ready' || !/^[0-9a-f]{64}$/.test(source.external_manifest_sha256 ?? '')) throw new Error('Upload this checked build with craft_game_upload before preparing publication; the Web runtime must return its manifest SHA');
|
|
53
53
|
const existing = await this.platform.publicationSession(owner)('status',{ version_id:source.version_id },signal);
|
|
54
|
-
if (existing.state !== 'not_submitted' && (existing.conversation_id !== source.conversation_id || existing.external_manifest_sha256 !== source.external_manifest_sha256)) throw new Error('
|
|
55
|
-
if (existing.state === 'share_completed') throw
|
|
56
|
-
|
|
57
|
-
if (['sharing','share_repacking'].includes(existing.state)) throw Object.assign(new Error('当前版本正在审核或发布处理中。请回到 WorkBuddy 查看原发布记录,等待处理结果。'),
|
|
58
|
-
{ detail:{ reason:'publication_review_in_progress' } });
|
|
54
|
+
if (existing.state !== 'not_submitted' && (existing.conversation_id !== source.conversation_id || existing.external_manifest_sha256 !== source.external_manifest_sha256)) throw new Error('Publication status differs from the uploaded build');
|
|
55
|
+
if (existing.state === 'share_completed') throw new Error('This version is already published. Run a new game check and upload a new version under the same appid before changing its publication materials. Reuse the original publication_id only for an identical retry.');
|
|
56
|
+
if (['sharing','share_repacking'].includes(existing.state)) throw new Error('This version already has a review in progress; query the original publication_id before preparing another submission');
|
|
59
57
|
let reusedCover;
|
|
60
58
|
if (previousCover && !stagedCover && !materials.cover_path) {
|
|
61
59
|
if (previousCover.conversation_id !== source.conversation_id || previousCover.version_id === source.version_id ||
|
|
@@ -66,7 +64,7 @@ export class Publications {
|
|
|
66
64
|
const capture = await this.capture(check,this.evidence,signal);
|
|
67
65
|
if (capture.archive_sha256 !== source.archive_sha256 || !Number.isInteger(capture.playtest_seconds) || capture.playtest_seconds < 30 ||
|
|
68
66
|
!Array.isArray(capture.screenshots) || capture.screenshots.length < 1 || capture.screenshots.length > 5 ||
|
|
69
|
-
!Array.isArray(capture.audit_screenshots) || capture.audit_screenshots.length < 3 || capture.audit_screenshots.length > 30) throw new Error('
|
|
67
|
+
!Array.isArray(capture.audit_screenshots) || capture.audit_screenshots.length < 3 || capture.audit_screenshots.length > 30) throw new Error('Publication capture does not match the uploaded frozen build');
|
|
70
68
|
const id = randomUUID(), directory = path.join(this.store.directory,id);
|
|
71
69
|
await mkdir(directory,{ mode:0o700 });
|
|
72
70
|
const images = [];
|
|
@@ -83,7 +81,7 @@ export class Publications {
|
|
|
83
81
|
signal.throwIfAborted();
|
|
84
82
|
// Capture paths are produced inside the private evidence directory by our browser worker.
|
|
85
83
|
const relative = path.relative(this.evidence,file);
|
|
86
|
-
if (relative === '..' || relative.startsWith('..' + path.sep) || path.isAbsolute(relative)) throw new Error('
|
|
84
|
+
if (relative === '..' || relative.startsWith('..' + path.sep) || path.isAbsolute(relative)) throw new Error('Capture image escaped private evidence');
|
|
87
85
|
const source = await readMaterial(path.dirname(file),path.basename(file),metadata?.[index]);
|
|
88
86
|
if (purpose === 'screenshot' && seen.has(source.sha256)) continue;
|
|
89
87
|
seen.add(source.sha256);
|
|
@@ -92,7 +90,7 @@ export class Publications {
|
|
|
92
90
|
}
|
|
93
91
|
delete materials.cover_path;
|
|
94
92
|
signal.throwIfAborted();
|
|
95
|
-
if (this.platform.account().user_id !== owner) throw new Error('Craft
|
|
93
|
+
if (this.platform.account().user_id !== owner) throw new Error('Craft account changed');
|
|
96
94
|
const record = await this.store.create({ request_id:id,name:check.name,owner,platform:this.platform.base,engine:check.result.engine,
|
|
97
95
|
check_task_id:check.task_id,conversation_id:source.conversation_id,version_id:source.version_id,
|
|
98
96
|
external_manifest_sha256:source.external_manifest_sha256,archive_sha256:source.archive_sha256,
|
|
@@ -110,25 +108,25 @@ export class Publications {
|
|
|
110
108
|
}
|
|
111
109
|
record.reviewed_revision = record.revision;
|
|
112
110
|
await this.store.save(record);
|
|
113
|
-
if (this.platform.account().user_id !== owner) throw new Error('
|
|
111
|
+
if (this.platform.account().user_id !== owner) throw new Error('Craft account changed during publication review');
|
|
114
112
|
return { content:[{ type:'text',text:JSON.stringify({ ...view(record),review:'Show these final materials to the user. Confirm the exact revision, game version, public image uploads and open_to_recreate choice before submitting to ACE.' }) },...content] };
|
|
115
113
|
}
|
|
116
114
|
|
|
117
115
|
async #status(record, request, signal) {
|
|
118
116
|
const remote = await request('status',{ version_id:record.version_id },signal);
|
|
119
117
|
if (remote.state !== 'not_submitted' && (remote.version_id !== record.version_id || remote.conversation_id !== record.conversation_id ||
|
|
120
|
-
remote.external_manifest_sha256 !== record.external_manifest_sha256)) throw new Error('
|
|
118
|
+
remote.external_manifest_sha256 !== record.external_manifest_sha256)) throw new Error('Publication status changed its project or build manifest');
|
|
121
119
|
return remote;
|
|
122
120
|
}
|
|
123
121
|
|
|
124
122
|
async submit(name, id, revision, confirmed, owner, signal) {
|
|
125
123
|
const record = await this.#record(name,id,owner);
|
|
126
|
-
if (confirmed !== true || revision !== record.revision || record.reviewed_revision !== revision) throw new Error('
|
|
124
|
+
if (confirmed !== true || revision !== record.revision || record.reviewed_revision !== revision) throw new Error('Review the publication images and obtain user confirmation for this exact revision before submitting');
|
|
127
125
|
const request = this.platform.publicationSession(owner);
|
|
128
126
|
const previous = await this.#status(record,request,signal);
|
|
129
127
|
if (previous.client_request_id === record.request_id && previous.state !== 'external_draft') {
|
|
130
128
|
if (!previous.finalization_retry_required) return view(record,previous);
|
|
131
|
-
if (!record.share_input) throw new Error('
|
|
129
|
+
if (!record.share_input) throw new Error('The original immutable submission payload is required to retry finalization');
|
|
132
130
|
await request('submit',{ input:record.share_input },signal);
|
|
133
131
|
record.state = 'submitted';
|
|
134
132
|
await this.store.save(record);
|
|
@@ -141,7 +139,7 @@ export class Publications {
|
|
|
141
139
|
const receipt = await request('image',{ image:data,purpose:image.purpose,conversation_id:record.conversation_id,
|
|
142
140
|
version_id:record.version_id,external_manifest_sha256:record.external_manifest_sha256 },signal);
|
|
143
141
|
if (receipt.sha256 !== image.sha256 || receipt.bytes !== image.bytes ||
|
|
144
|
-
(record.image_receipts[image.file] && record.image_receipts[image.file].cover_url !== receipt.cover_url)) throw new Error('
|
|
142
|
+
(record.image_receipts[image.file] && record.image_receipts[image.file].cover_url !== receipt.cover_url)) throw new Error('Platform changed an immutable publication image receipt');
|
|
145
143
|
record.image_receipts[image.file] = receipt;
|
|
146
144
|
await this.store.save(record);
|
|
147
145
|
}
|
|
@@ -149,7 +147,7 @@ export class Publications {
|
|
|
149
147
|
const input = { client_request_id:record.request_id,conversation_id:record.conversation_id,version_id:record.version_id,
|
|
150
148
|
external_manifest_sha256:record.external_manifest_sha256,...record.materials,
|
|
151
149
|
cover_image_url:urls('cover')[0],screenshots:urls('screenshot'),audit_screenshot_urls:urls('audit-shot'),playtest_seconds:record.playtest_seconds };
|
|
152
|
-
if (record.share_input && JSON.stringify(record.share_input) !== JSON.stringify(input)) throw new Error('
|
|
150
|
+
if (record.share_input && JSON.stringify(record.share_input) !== JSON.stringify(input)) throw new Error('Publication submission changed after confirmation');
|
|
153
151
|
record.share_input = input; record.state = 'submitting';
|
|
154
152
|
await this.store.save(record);
|
|
155
153
|
await request('submit',{ input },signal);
|
|
@@ -11,11 +11,6 @@ import { validateSteps } from './check.mjs';
|
|
|
11
11
|
const environmentKeys = new Set(['PATH','HOME','USERPROFILE','APPDATA','LOCALAPPDATA','SYSTEMROOT','WINDIR',
|
|
12
12
|
'COMSPEC','TEMP','TMP','TMPDIR','XDG_CACHE_HOME','NODE_PATH','PLAYWRIGHT_PACKAGE_ROOT',
|
|
13
13
|
'PLAYWRIGHT_BROWSERS_PATH','CRAFT_BROWSER_EXECUTABLE','CRAFT_RUNTIME_POLICY']);
|
|
14
|
-
const captureReasons = new Set([
|
|
15
|
-
'加载层未在采集期限内收起,首屏可能仍是进度条',
|
|
16
|
-
'截图时仍有资源请求未完成,加载相关画面未验证',
|
|
17
|
-
'字体或界面过渡未在采集期限内完成',
|
|
18
|
-
]);
|
|
19
14
|
|
|
20
15
|
// The SDK browser preparer merges the parent environment. Undefined overrides
|
|
21
16
|
// deliberately erase every other inherited key, including unknown credentials.
|
|
@@ -24,87 +19,56 @@ export function publishCaptureEnvironment(source = process.env) {
|
|
|
24
19
|
}
|
|
25
20
|
|
|
26
21
|
async function ordinaryJson(file, maximum = 256 * 1024) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return JSON.parse(await readFile(file,'utf8'));
|
|
31
|
-
} catch (cause) {
|
|
32
|
-
throw new Error('无法读取发布采集记录。',{ cause });
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
async function captureFailure(directory, timedOut) {
|
|
37
|
-
if (timedOut) return '发布试玩采集超时。';
|
|
38
|
-
// The private capture record may also include browser errors and game data.
|
|
39
|
-
// Only share the exact built-in reasons, never raw worker output.
|
|
40
|
-
const capture = await ordinaryJson(path.join(directory,'capture.json')).catch(()=>undefined);
|
|
41
|
-
const reasons = Array.isArray(capture?.unverified) ? [...new Set(capture.unverified.filter(reason=>captureReasons.has(reason)))] : [];
|
|
42
|
-
if (reasons.length) return '发布试玩采集未通过。' + reasons.join(';') + '。';
|
|
43
|
-
if (Array.isArray(capture?.errors) && capture.errors.length) return '发布试玩时游戏出现运行错误,请回到 WorkBuddy 检查游戏运行情况。';
|
|
44
|
-
return '未能完成发布试玩采集,请确认游戏可以正常运行。';
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
async function captureArchive(evidence, result, signal) {
|
|
48
|
-
try { return await checkedDraftArchive(evidence,result.snapshot_id,result.artifacts,signal); }
|
|
49
|
-
catch (cause) {
|
|
50
|
-
signal.throwIfAborted();
|
|
51
|
-
throw new Error('验收产物已变更或无法读取,请回到 WorkBuddy 重新验收游戏。',{ cause });
|
|
52
|
-
}
|
|
22
|
+
const stat = await lstat(file);
|
|
23
|
+
if (!stat.isFile() || stat.isSymbolicLink() || stat.size > maximum) throw new Error('Invalid publish capture record');
|
|
24
|
+
return JSON.parse(await readFile(file,'utf8'));
|
|
53
25
|
}
|
|
54
26
|
|
|
55
27
|
async function checkedImage(image, directory) {
|
|
56
28
|
if (!image || typeof image.path !== 'string' || path.dirname(image.path) !== directory ||
|
|
57
|
-
!/^shot-[0-8]\.jpg$/.test(path.basename(image.path))) throw new Error('
|
|
29
|
+
!/^shot-[0-8]\.jpg$/.test(path.basename(image.path))) throw new Error('Invalid publish screenshot path');
|
|
58
30
|
const stat = await lstat(image.path);
|
|
59
|
-
if (!stat.isFile() || stat.isSymbolicLink() || stat.size < 4 || stat.size > 2 * 1024 * 1024) throw new Error('
|
|
31
|
+
if (!stat.isFile() || stat.isSymbolicLink() || stat.size < 4 || stat.size > 2 * 1024 * 1024) throw new Error('Invalid publish screenshot size');
|
|
60
32
|
const data = await readFile(image.path);
|
|
61
33
|
if (data[0] !== 0xff || data[1] !== 0xd8 || data[2] !== 0xff ||
|
|
62
|
-
data.length !== image.bytes || createHash('sha256').update(data).digest('hex') !== image.sha256) throw new Error('
|
|
34
|
+
data.length !== image.bytes || createHash('sha256').update(data).digest('hex') !== image.sha256) throw new Error('Publish screenshot changed');
|
|
63
35
|
}
|
|
64
36
|
|
|
65
37
|
export async function capturePublishMaterial(check, evidence, signal) {
|
|
66
38
|
signal.throwIfAborted();
|
|
67
39
|
const result = check?.result;
|
|
68
40
|
if (check?.kind !== 'check' || check.status !== 'completed' || !result?.gate?.passed ||
|
|
69
|
-
!/^[0-9a-f-]{36}$/.test(check.task_id)) throw new Error('
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const archive = await captureArchive(evidence,result,signal);
|
|
41
|
+
!/^[0-9a-f-]{36}$/.test(check.task_id)) throw new Error('A completed passing game check is required for publish capture');
|
|
42
|
+
engineDefinition(result.engine);
|
|
43
|
+
const archive = await checkedDraftArchive(evidence,result.snapshot_id,result.artifacts,signal);
|
|
73
44
|
const evidenceRoot = await realpath(evidence), snapshot = path.join(evidenceRoot,result.snapshot_id);
|
|
74
45
|
const original = await ordinaryJson(path.join(snapshot,'request.json'));
|
|
75
|
-
if (original.engine !== result.engine) throw new Error('
|
|
76
|
-
|
|
77
|
-
catch (cause) { throw new Error('验收结果中的试玩步骤无效,请回到 WorkBuddy 重新验收游戏。',{ cause }); }
|
|
46
|
+
if (original.engine !== result.engine) throw new Error('Publish capture engine differs from its check');
|
|
47
|
+
validateSteps(original.steps);
|
|
78
48
|
const directory = path.join(snapshot,'publish-' + randomUUID());
|
|
79
49
|
await mkdir(directory,{ mode:0o700 });
|
|
80
50
|
const requestFile = path.join(directory,'request.json');
|
|
81
51
|
await atomicJson(requestFile,{ check_task_id:check.task_id, snapshot_id:result.snapshot_id, engine:result.engine,
|
|
82
52
|
evidence:evidenceRoot, artifacts:result.artifacts, archive_sha256:archive.sha256, steps:original.steps });
|
|
53
|
+
const safe = publishCaptureEnvironment();
|
|
54
|
+
const browser = await prepareBrowserEnvironment({ cwd:snapshot,env:safe,signal });
|
|
55
|
+
const env = Object.fromEntries(Object.entries({ ...safe,...browser }).filter(([,value])=>value !== undefined));
|
|
83
56
|
const resources = process.env.CRAFT_MCP_RESOURCES_DIR || fileURLToPath(new URL('../../resources/',import.meta.url));
|
|
84
57
|
const runner = path.join(resources,'game_visual_qa.mjs');
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const browser = await prepareBrowserEnvironment({ cwd:snapshot,env:safe,signal });
|
|
89
|
-
const env = Object.fromEntries(Object.entries({ ...safe,...browser }).filter(([,value])=>value !== undefined));
|
|
90
|
-
run = await runProcess(process.execPath,[fileURLToPath(new URL('./publish-capture-worker.mjs',import.meta.url)),runner,requestFile],{
|
|
91
|
-
cwd:snapshot,env,signal,timeoutMs:200000,
|
|
92
|
-
});
|
|
93
|
-
} catch (cause) {
|
|
94
|
-
signal.throwIfAborted();
|
|
95
|
-
throw new Error('无法启动发布试玩采集,请确认本机浏览器可以正常使用。',{ cause });
|
|
96
|
-
}
|
|
58
|
+
const run = await runProcess(process.execPath,[fileURLToPath(new URL('./publish-capture-worker.mjs',import.meta.url)),runner,requestFile],{
|
|
59
|
+
cwd:snapshot,env,signal,timeoutMs:200000,
|
|
60
|
+
});
|
|
97
61
|
signal.throwIfAborted();
|
|
98
|
-
if (run.exitCode !== 0 || run.timedOut || run.aborted) throw new Error(
|
|
62
|
+
if (run.exitCode !== 0 || run.timedOut || run.aborted) throw new Error('Publish playtest capture failed: ' + (run.stderr || run.stdout).slice(-1500));
|
|
99
63
|
const receipt = await ordinaryJson(path.join(directory,'receipt.json'));
|
|
100
64
|
if (receipt.check_task_id !== check.task_id || receipt.snapshot_id !== result.snapshot_id ||
|
|
101
65
|
receipt.engine !== result.engine || receipt.archive_sha256 !== archive.sha256 ||
|
|
102
66
|
!Number.isFinite(receipt.playtest_seconds) || receipt.playtest_seconds < 30 ||
|
|
103
67
|
!Array.isArray(receipt.screenshots) || receipt.screenshots.length !== 4 ||
|
|
104
|
-
!Array.isArray(receipt.audit_screenshots) || receipt.audit_screenshots.length !== 9) throw new Error('
|
|
68
|
+
!Array.isArray(receipt.audit_screenshots) || receipt.audit_screenshots.length !== 9) throw new Error('Invalid publish capture receipt');
|
|
105
69
|
for (const image of [...receipt.screenshots,...receipt.audit_screenshots]) await checkedImage(image,directory);
|
|
106
|
-
const after = await
|
|
107
|
-
if (after.sha256 !== archive.sha256) throw new Error('
|
|
70
|
+
const after = await checkedDraftArchive(evidenceRoot,result.snapshot_id,result.artifacts,signal);
|
|
71
|
+
if (after.sha256 !== archive.sha256) throw new Error('Frozen build changed during publish capture');
|
|
108
72
|
return { ...receipt, screenshot_files:receipt.screenshots,audit_screenshot_files:receipt.audit_screenshots,
|
|
109
73
|
screenshots:receipt.screenshots.map(image=>image.path),audit_screenshots:receipt.audit_screenshots.map(image=>image.path),
|
|
110
74
|
receipt_path:path.join(directory,'receipt.json') };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { parse, stringify } from 'smol-toml';
|
|
2
|
+
import { isDeepStrictEqual } from 'node:util';
|
|
3
|
+
|
|
4
|
+
export function readConfig(text, ide) {
|
|
5
|
+
const config = text.trim() ? (ide === 'codex' ? parse(text) : JSON.parse(text)) : {};
|
|
6
|
+
if (!config || typeof config !== 'object' || Array.isArray(config)) throw new Error('Expected an object config');
|
|
7
|
+
const servers = config[ide === 'codex' ? 'mcp_servers' : 'mcpServers'];
|
|
8
|
+
if (servers !== undefined && (!servers || typeof servers !== 'object' || Array.isArray(servers))) throw new Error('Invalid MCP server table');
|
|
9
|
+
return config;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function craftConfig(text, ide) {
|
|
13
|
+
return readConfig(text, ide)[ide === 'codex' ? 'mcp_servers' : 'mcpServers']?.craft;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Track strings and value arrays so apparent headers inside multiline values stay untouched.
|
|
17
|
+
function sections(text) {
|
|
18
|
+
const found = []; let offset = 0, quote = null, multiline = false, depth = 0;
|
|
19
|
+
for (const line of text.match(/[^\n]*\n|[^\n]+$/g) ?? []) {
|
|
20
|
+
if (!quote && depth === 0 && /^\s*\[/.test(line)) {
|
|
21
|
+
const header = parse(line), keys = []; let child = header;
|
|
22
|
+
while (child && typeof child === 'object' && !Array.isArray(child) && Object.keys(child).length === 1) {
|
|
23
|
+
const key = Object.keys(child)[0]; keys.push(key); child = child[key];
|
|
24
|
+
}
|
|
25
|
+
found.push({ start: offset, keys });
|
|
26
|
+
} else {
|
|
27
|
+
for (let i = 0; i < line.length; i++) {
|
|
28
|
+
const c = line[i];
|
|
29
|
+
if (quote) {
|
|
30
|
+
if (quote === '"' && c === '\\') { i++; continue; }
|
|
31
|
+
if (c === quote) {
|
|
32
|
+
if (!multiline) quote = null;
|
|
33
|
+
else if (line.slice(i, i + 3) === quote.repeat(3)) {
|
|
34
|
+
while (line[i + 3] === quote) i++;
|
|
35
|
+
i += 2; quote = null; multiline = false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
} else if (c === '#') break;
|
|
39
|
+
else if (c === '"' || c === "'") { quote = c; multiline = line.slice(i, i + 3) === c.repeat(3); if (multiline) i += 2; }
|
|
40
|
+
else if (c === '[' || c === '{') depth++;
|
|
41
|
+
else if (c === ']' || c === '}') depth--;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
offset += line.length;
|
|
45
|
+
}
|
|
46
|
+
return found.map((section, i) => ({ ...section, end: found[i + 1]?.start ?? text.length }));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function mergeConfig(text, ide, connection) {
|
|
50
|
+
const before = readConfig(text, ide), table = ide === 'codex' ? 'mcp_servers' : 'mcpServers';
|
|
51
|
+
const previous = before[table]?.craft ?? {};
|
|
52
|
+
if (typeof previous !== 'object' || Array.isArray(previous)) throw new Error('Invalid craft server entry');
|
|
53
|
+
// Preserve host-specific options and user environment; replace only connection identity.
|
|
54
|
+
const next = { ...previous, ...connection, env: { ...previous.env, ...connection.env } };
|
|
55
|
+
for (const key of ['url', 'http_headers', 'env_http_headers', 'bearer_token_env_var']) delete next[key];
|
|
56
|
+
if (ide === 'codex') { delete next.disabled; next.enabled = true; }
|
|
57
|
+
else { delete next.enabled; next.disabled = false; }
|
|
58
|
+
const normalizedNext = ide === 'codex' ? parse(stringify({ value: next })).value : next;
|
|
59
|
+
if (isDeepStrictEqual(previous, normalizedNext)) return text;
|
|
60
|
+
const expected = { ...before, [table]: { ...before[table], craft: next } };
|
|
61
|
+
if (ide !== 'codex') return JSON.stringify(expected, null, 2) + '\n';
|
|
62
|
+
const owned = sections(text).filter(({ keys }) => keys[0] === 'mcp_servers' && keys[1] === 'craft');
|
|
63
|
+
if (before.mcp_servers?.craft && !owned.length) throw new Error('Inline/dotted craft TOML entry: move it to [mcp_servers.craft] before installing; config was preserved');
|
|
64
|
+
let kept = '', from = 0;
|
|
65
|
+
for (const section of owned) { kept += text.slice(from, section.start); from = section.end; }
|
|
66
|
+
kept += text.slice(from);
|
|
67
|
+
const output = kept + (kept.endsWith('\n') || !kept ? '' : '\n') + '\n' + stringify({ mcp_servers: { craft: next } });
|
|
68
|
+
// This also rejects unsupported inline parent tables without changing the user's file.
|
|
69
|
+
if (!isDeepStrictEqual(parse(output), parse(stringify(expected)))) throw new Error('TOML merge changed unrelated settings; config was preserved');
|
|
70
|
+
return output;
|
|
71
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { lstat, readFile, mkdir, writeFile, rename, unlink } from 'node:fs/promises';
|
|
3
|
+
import { randomUUID } from 'node:crypto';
|
|
4
|
+
|
|
5
|
+
export async function optionalFile(file) {
|
|
6
|
+
try { return await readFile(file, 'utf8'); }
|
|
7
|
+
catch (error) { if (error.code !== 'ENOENT') throw error; return null; }
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export async function assertPlainPath(file) {
|
|
11
|
+
let current = path.resolve(file);
|
|
12
|
+
for (;;) {
|
|
13
|
+
try {
|
|
14
|
+
const info = await lstat(current);
|
|
15
|
+
if (info.isSymbolicLink() || (current === path.resolve(file) ? !info.isFile() : !info.isDirectory())) throw new Error('Refusing linked or invalid install path: ' + current);
|
|
16
|
+
} catch (error) { if (error.code !== 'ENOENT') throw error; }
|
|
17
|
+
const parent = path.dirname(current); if (parent === current) break; current = parent;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async function replace(file, text) {
|
|
22
|
+
await mkdir(path.dirname(file), { recursive: true });
|
|
23
|
+
const temporary = file + '.' + randomUUID() + '.tmp';
|
|
24
|
+
try { await writeFile(temporary, text, { mode: 0o600, flag: 'wx' }); await rename(temporary, file); }
|
|
25
|
+
finally { await unlink(temporary).catch(error => { if (error.code !== 'ENOENT') throw error; }); }
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Preflight all destinations, keep private backups, and roll back only our unchanged writes.
|
|
29
|
+
export async function commitFiles(changes) {
|
|
30
|
+
const pending = changes.filter(change => change.before !== change.after), committed = [], backups = [];
|
|
31
|
+
for (const change of pending) {
|
|
32
|
+
await assertPlainPath(change.file);
|
|
33
|
+
if (await optionalFile(change.file) !== change.before) throw new Error('File changed during installation: ' + change.file);
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
for (const change of pending) {
|
|
37
|
+
await assertPlainPath(change.file);
|
|
38
|
+
if (await optionalFile(change.file) !== change.before) throw new Error('File changed during installation: ' + change.file);
|
|
39
|
+
if (change.before !== null) {
|
|
40
|
+
const backup = change.file + '.craft-backup-' + randomUUID();
|
|
41
|
+
await writeFile(backup, change.before, { flag: 'wx', mode: 0o600 }); backups.push(backup);
|
|
42
|
+
}
|
|
43
|
+
await replace(change.file, change.after); committed.push(change);
|
|
44
|
+
}
|
|
45
|
+
} catch (error) {
|
|
46
|
+
for (const change of committed.reverse()) {
|
|
47
|
+
if (await optionalFile(change.file) === change.after) {
|
|
48
|
+
if (change.before === null) await unlink(change.file); else await replace(change.file, change.before);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
return { changed: pending.map(change => change.file), backups };
|
|
54
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
|
|
3
|
+
export const hosts = Object.freeze({
|
|
4
|
+
codex: { config: '.codex/config.toml', skills: '.agents/skills', projectSkills: '.agents/skills', format: 'toml' },
|
|
5
|
+
workbuddy: { config: '.workbuddy/mcp.json', skills: '.workbuddy/skills', projectSkills: '.codebuddy/skills', format: 'json' },
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export function clientIde(value) {
|
|
9
|
+
if (value === undefined || value === '' || value === 'generic') return 'generic';
|
|
10
|
+
if (!Object.hasOwn(hosts, value)) throw new Error('Unsupported Craft IDE: ' + value);
|
|
11
|
+
return value;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function installTargets(value) {
|
|
15
|
+
const targets = value?.split(',');
|
|
16
|
+
if (!targets?.length || targets.some(ide => !Object.hasOwn(hosts, ide))) throw new Error('--ide must explicitly select codex, workbuddy, or codex,workbuddy');
|
|
17
|
+
return [...new Set(targets)];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function hostPaths(home, ide, codexHome) {
|
|
21
|
+
const host = hosts[clientIde(ide)];
|
|
22
|
+
if (!host) throw new Error('Select a host before installing');
|
|
23
|
+
if (codexHome && !path.isAbsolute(codexHome)) throw new Error('CODEX_HOME must be absolute');
|
|
24
|
+
return { config: ide === 'codex' && codexHome ? path.join(codexHome, 'config.toml') : path.join(home, host.config), skill: path.join(home, host.skills, 'craft-create', 'SKILL.md') };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function projectSkillPath(ide) {
|
|
28
|
+
const host = hosts[clientIde(ide)];
|
|
29
|
+
return host ? host.projectSkills + '/craft-project/SKILL.md' : null;
|
|
30
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import { readFile, mkdir } from 'node:fs/promises';
|
|
4
|
+
import lockfile from 'proper-lockfile';
|
|
5
|
+
import { getAppDataRoot } from '../core/app-paths.mjs';
|
|
6
|
+
import { hostPaths, installTargets } from './hosts.mjs';
|
|
7
|
+
import { craftConfig, mergeConfig } from './config.mjs';
|
|
8
|
+
import { optionalFile, assertPlainPath, commitFiles } from './files.mjs';
|
|
9
|
+
import { stageRuntime, probeRuntime } from './runtime.mjs';
|
|
10
|
+
|
|
11
|
+
const bootstrapMarker = '<!-- craft-mcp:bootstrap:v1 -->';
|
|
12
|
+
function platformOrigin(value) {
|
|
13
|
+
const url = new URL(value);
|
|
14
|
+
if (url.protocol !== 'https:' || url.username || url.password || url.pathname !== '/' || url.search || url.hash) throw new Error('--platform must be a credential-free HTTPS origin');
|
|
15
|
+
return url.origin;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export async function installHosts({ ide, workspace, platform, packageRoot, home = os.homedir(), codexHome,
|
|
19
|
+
runtimeRoot = path.join(getAppDataRoot(), 'runtimes'), materialize = stageRuntime, probe = probeRuntime }) {
|
|
20
|
+
const targets = installTargets(ide);
|
|
21
|
+
if (workspace !== undefined && !path.isAbsolute(workspace)) throw new Error('--workspace must be absolute');
|
|
22
|
+
if (platform !== undefined) platform = platformOrigin(platform);
|
|
23
|
+
const pkg = JSON.parse(await readFile(path.join(packageRoot, 'package.json'), 'utf8'));
|
|
24
|
+
const desiredSkill = await readFile(path.join(packageRoot, 'resources/craft-create/SKILL.md'), 'utf8');
|
|
25
|
+
if (!desiredSkill.includes(bootstrapMarker)) throw new Error('Craft bootstrap Skill missing from distribution');
|
|
26
|
+
await mkdir(runtimeRoot, { recursive: true });
|
|
27
|
+
const release = await lockfile.lock(runtimeRoot, { stale: 120000, retries: 0 });
|
|
28
|
+
try {
|
|
29
|
+
const plans = [];
|
|
30
|
+
for (const host of targets) {
|
|
31
|
+
const paths = hostPaths(home, host, codexHome);
|
|
32
|
+
await assertPlainPath(paths.config); await assertPlainPath(paths.skill);
|
|
33
|
+
const original = await optionalFile(paths.config), existingSkill = await optionalFile(paths.skill);
|
|
34
|
+
if (existingSkill && !existingSkill.includes(bootstrapMarker)) throw new Error('User-owned craft-create Skill preserved; rename it before installing: ' + paths.skill);
|
|
35
|
+
const old = craftConfig(original ?? '', host);
|
|
36
|
+
const workspaceIndex = old?.args?.indexOf('--workspace') ?? -1;
|
|
37
|
+
const games = workspace ?? (workspaceIndex >= 0 ? old.args[workspaceIndex + 1] : old?.env?.CLIENT_WORKSPACE_ROOT) ?? path.join(home, 'CraftGames');
|
|
38
|
+
if (!path.isAbsolute(games)) throw new Error('Configured Craft workspace must be absolute');
|
|
39
|
+
const origin = platformOrigin(platform ?? old?.env?.CRAFT_WEB_URL ?? pkg.craft?.platform);
|
|
40
|
+
plans.push({ host, paths, original, existingSkill, workspace: path.resolve(games), platform: origin });
|
|
41
|
+
}
|
|
42
|
+
const runtime = await materialize(packageRoot, runtimeRoot), changes = [], results = [];
|
|
43
|
+
for (const plan of plans) {
|
|
44
|
+
const connection = { command: process.execPath, args: [runtime.entry, '--workspace', plan.workspace],
|
|
45
|
+
env: { CRAFT_CLIENT_IDE: plan.host, CRAFT_WEB_URL: plan.platform, CLIENT_WORKSPACE_ROOT: plan.workspace },
|
|
46
|
+
...(plan.host === 'codex' ? { startup_timeout_sec: 120 } : { type: 'stdio', timeout: 120000 }) };
|
|
47
|
+
const updated = mergeConfig(plan.original ?? '', plan.host, connection);
|
|
48
|
+
const verified = await probe(craftConfig(updated, plan.host), { version: runtime.version, host: plan.host, workspace: plan.workspace, platform: plan.platform });
|
|
49
|
+
changes.push({ file: plan.paths.config, before: plan.original, after: updated },
|
|
50
|
+
{ file: plan.paths.skill, before: plan.existingSkill, after: desiredSkill });
|
|
51
|
+
results.push({ host: plan.host, ...plan.paths, verified });
|
|
52
|
+
}
|
|
53
|
+
const written = await commitFiles(changes);
|
|
54
|
+
return { runtime, hosts: results, ...written,
|
|
55
|
+
next: 'Open a new host session (restart/reconnect MCP if cached). Confirm craft-create discovery, then create a game and reopen its project to check craft-project discovery and context recovery.' };
|
|
56
|
+
} finally { await release(); }
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export async function doctorHosts({ ide, home = os.homedir(), codexHome, probe = probeRuntime }) {
|
|
60
|
+
const results = [];
|
|
61
|
+
for (const host of installTargets(ide)) {
|
|
62
|
+
const paths = hostPaths(home, host, codexHome);
|
|
63
|
+
const connection = craftConfig(await optionalFile(paths.config) ?? '', host);
|
|
64
|
+
if (!connection?.command || connection.env?.CRAFT_CLIENT_IDE !== host) throw new Error(host + ': Craft installation missing or host marker incorrect; run install --ide ' + host);
|
|
65
|
+
if (connection.disabled === true || connection.enabled === false) throw new Error(host + ': Craft MCP is disabled');
|
|
66
|
+
const skill = await optionalFile(paths.skill);
|
|
67
|
+
if (!skill?.includes(bootstrapMarker)) throw new Error(host + ': Craft bootstrap Skill missing or not managed by installer');
|
|
68
|
+
const expectedSkill = await readFile(path.resolve(path.dirname(connection.args[0]), '../resources/craft-create/SKILL.md'), 'utf8');
|
|
69
|
+
if (skill !== expectedSkill) throw new Error(host + ': Craft bootstrap Skill differs from installed runtime; run install again');
|
|
70
|
+
const verified = await probe(connection, { host });
|
|
71
|
+
results.push({ host, ...paths, entry: connection.args[0], verified });
|
|
72
|
+
}
|
|
73
|
+
return { hosts: results, note: 'MCP protocol and installed files verified. Host trust, Skill discovery and session recovery require a new session in the host.' };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export async function runIntegrationCommand(args, packageRoot) {
|
|
77
|
+
const [command, ...rest] = args, options = {};
|
|
78
|
+
for (let i = 0; i < rest.length; i += 2) {
|
|
79
|
+
const name = rest[i].replace(/^--/, '');
|
|
80
|
+
if (!rest[i].startsWith('--') || !['ide', ...(command === 'install' ? ['workspace', 'platform'] : [])].includes(name) || !rest[i + 1] || Object.hasOwn(options, name)) throw new Error('Invalid or repeated option. Use craft-mcp --help.');
|
|
81
|
+
options[name] = rest[i + 1];
|
|
82
|
+
}
|
|
83
|
+
options.codexHome = process.env.CODEX_HOME;
|
|
84
|
+
const result = command === 'install' ? await installHosts({ ...options, packageRoot }) : await doctorHosts(options);
|
|
85
|
+
process.stdout.write(JSON.stringify(result, null, 2) + '\n');
|
|
86
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import { existsSync } from 'node:fs';
|
|
4
|
+
import { mkdir, mkdtemp, readFile, writeFile, rename, rm } from 'node:fs/promises';
|
|
5
|
+
import { createHash } from 'node:crypto';
|
|
6
|
+
import { execFile } from 'node:child_process';
|
|
7
|
+
import { promisify } from 'node:util';
|
|
8
|
+
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
9
|
+
import { StdioClientTransport, getDefaultEnvironment } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
10
|
+
|
|
11
|
+
const execute = promisify(execFile);
|
|
12
|
+
function npmEntry() {
|
|
13
|
+
for (const dir of [path.dirname(process.execPath), ...(process.env.PATH || process.env.Path || '').split(path.delimiter)]) {
|
|
14
|
+
for (const candidate of ['node_modules/npm/bin/npm-cli.js', '../lib/node_modules/npm/bin/npm-cli.js', '../share/nodejs/npm/bin/npm-cli.js']) {
|
|
15
|
+
const file = path.resolve(dir, candidate); if (existsSync(file)) return file;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
throw new Error('Node.js must include npm');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export async function stageRuntime(packageRoot, runtimeRoot) {
|
|
22
|
+
const pkg = JSON.parse(await readFile(path.join(packageRoot, 'package.json'), 'utf8'));
|
|
23
|
+
if (!pkg.bin?.['craft-mcp'] || !pkg.files?.includes('resources')) throw new Error('Install from the built npm distribution, not the source/kit directory');
|
|
24
|
+
const temp = await mkdtemp(path.join(os.tmpdir(), 'craft-runtime-'));
|
|
25
|
+
try {
|
|
26
|
+
const npm = async (args, cwd) => {
|
|
27
|
+
try { return await execute(process.execPath, [npmEntry(), ...args], { cwd, windowsHide: true, maxBuffer: 8 * 1024 * 1024 }); }
|
|
28
|
+
catch { throw new Error('Could not materialize Craft runtime with npm; check Node/npm and registry connectivity'); }
|
|
29
|
+
};
|
|
30
|
+
const packed = JSON.parse((await npm(['pack', '--ignore-scripts', '--json', '--pack-destination', temp], packageRoot)).stdout);
|
|
31
|
+
const archive = path.join(temp, packed[0].filename);
|
|
32
|
+
const hash = createHash('sha256').update(await readFile(archive)).digest('hex');
|
|
33
|
+
const target = path.join(runtimeRoot, pkg.version + '-' + hash.slice(0, 16));
|
|
34
|
+
const entry = path.join(target, 'node_modules', ...pkg.name.split('/'), 'bin/craft-mcp.mjs');
|
|
35
|
+
if (!existsSync(path.join(target, 'craft-runtime.json'))) {
|
|
36
|
+
await mkdir(runtimeRoot, { recursive: true });
|
|
37
|
+
const staging = await mkdtemp(path.join(runtimeRoot, '.staging-'));
|
|
38
|
+
try {
|
|
39
|
+
await writeFile(path.join(staging, 'package.json'), '{"private":true}\n');
|
|
40
|
+
await npm(['install', '--ignore-scripts', '--no-audit', '--no-fund', '--omit=dev',
|
|
41
|
+
...(pkg.publishConfig?.registry ? ['--registry=' + pkg.publishConfig.registry] : []), archive], staging);
|
|
42
|
+
await writeFile(path.join(staging, 'craft-runtime.json'), JSON.stringify({ version: pkg.version, package: pkg.name, sha256: hash }) + '\n');
|
|
43
|
+
await rename(staging, target);
|
|
44
|
+
} finally { await rm(staging, { recursive: true, force: true }); }
|
|
45
|
+
}
|
|
46
|
+
return { entry, version: pkg.version, sha256: hash, directory: target };
|
|
47
|
+
} finally { await rm(temp, { recursive: true, force: true }); }
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export async function probeRuntime(connection, expected = {}) {
|
|
51
|
+
const state = await mkdtemp(path.join(os.tmpdir(), 'craft-probe-'));
|
|
52
|
+
const env = { ...getDefaultEnvironment(), ...connection.env, CLIENT_DATA_DIR: state };
|
|
53
|
+
delete env.CRAFT_TOKEN; delete env.NODE_OPTIONS; delete env.CRAFT_MCP_RESOURCES_DIR;
|
|
54
|
+
const transport = new StdioClientTransport({ command: connection.command, args: connection.args, env, stderr: 'pipe' });
|
|
55
|
+
// Consume diagnostics without exposing config values or credentials in installer reports.
|
|
56
|
+
transport.stderr?.resume();
|
|
57
|
+
const client = new Client({ name: 'craft-install-check', version: '1.0.0' });
|
|
58
|
+
try {
|
|
59
|
+
await client.connect(transport, { timeout: 120000 });
|
|
60
|
+
const listed = await client.listTools();
|
|
61
|
+
const response = await client.callTool({ name: 'craft_game_info', arguments: {} });
|
|
62
|
+
if (response.isError) throw new Error('craft_game_info failed');
|
|
63
|
+
const info = response.structuredContent ?? JSON.parse(response.content.find(item => item.type === 'text').text);
|
|
64
|
+
if (!listed.tools.some(tool => tool.name === 'craft_game_prepare') || !listed.tools.some(tool => tool.name === 'craft_game_review')) throw new Error('Craft tools missing');
|
|
65
|
+
if (expected.version && info.version !== expected.version) throw new Error('Runtime version mismatch');
|
|
66
|
+
if (expected.host && info.host !== expected.host) throw new Error('Runtime host mismatch');
|
|
67
|
+
if (expected.workspace && path.resolve(info.workspace) !== path.resolve(expected.workspace)) throw new Error('Runtime workspace mismatch');
|
|
68
|
+
if (expected.platform && info.platform !== expected.platform) throw new Error('Runtime platform mismatch');
|
|
69
|
+
return { version: info.version, host: info.host, workspace: info.workspace, platform: info.platform, tools: listed.tools.length, engines: info.supported_engines };
|
|
70
|
+
} finally { await client.close(); await rm(state, { recursive: true, force: true }); }
|
|
71
|
+
}
|