@tora-editor/tora 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +108 -58
- package/assets/free-audio/arcade-pop/audio/loss.wav +0 -0
- package/assets/free-audio/arcade-pop/audio/reward.wav +0 -0
- package/assets/free-audio/arcade-pop/audio/win.wav +0 -0
- package/assets/free-audio/arcade-pop/source/INFO.txt +11 -11
- package/assets/kenney-food-starter/License.txt +28 -0
- package/assets/kenney-food-starter/burger.glb +0 -0
- package/assets/kenney-food-starter/frying-pan.glb +0 -0
- package/assets/kenney-food-starter/plan.json +61 -0
- package/assets/kenney-food-starter/plate.glb +0 -0
- package/assets/kenney-food-starter/pot.glb +0 -0
- package/assets/kenney-harvest/audio/victory.wav +0 -0
- package/assets/kenney-harvest/source/music-jingles/OGG/jingles_NES/jingles_NES03.ogg +0 -0
- package/assets/kenney-harvest/source/music-jingles/OGG/jingles_PIZZA/jingles_PIZZA03.ogg +0 -0
- package/assets/kenney-harvest/source/music-jingles/license.txt +14 -0
- package/bin/tora.mjs +77 -9
- package/crates/packer/trusted/native-3d-meta.json +3 -2
- package/crates/packer/trusted/native-3d.js +181 -181
- package/crates/packer/trusted/native-meta.json +2 -2
- package/crates/packer/trusted/native.js +5 -5
- package/crates/packer/trusted/release-manifest.json +17 -17
- package/crates/packer/trusted/review-runtime-meta.json +3 -2
- package/crates/packer/trusted/review-runtime.js +182 -182
- package/docs/TORA_AGENT_SETUP.md +24 -13
- package/docs/TORA_CREATION_API.md +29 -12
- package/docs/reference/CORE_AUTHORING.md +2 -1
- package/docs/reference/PLAYABLE_STARTERS.md +20 -0
- package/docs/reference/packs/3d.md +9 -3
- package/network-rules/mintegral-appgrowth-single-html.json +10 -10
- package/package.json +6 -6
- package/packages/creative-project/project-v21.schema.json +264 -8
- package/scripts/lean/editor/review-editor.css +10 -0
- package/scripts/lean/editor/review-editor.js +117 -1
- package/scripts/lean/native/agent-tools.mjs +7 -7
- package/scripts/lean/native/api.mjs +16 -5
- package/scripts/lean/native/asset-catalog.mjs +7 -6
- package/scripts/lean/native/asset-lineage.mjs +54 -0
- package/scripts/lean/native/asset-prep.mjs +173 -40
- package/scripts/lean/native/assets.mjs +107 -11
- package/scripts/lean/native/author-expansion-proofs.mjs +2 -99
- package/scripts/lean/native/author-fps.mjs +545 -0
- package/scripts/lean/native/author-primitive-proofs.mjs +5 -4
- package/scripts/lean/native/build-cache.mjs +2 -2
- package/scripts/lean/native/cc0-inputs.mjs +24 -0
- package/scripts/lean/native/cc0-staging.mjs +28 -8
- package/scripts/lean/native/check-harvest-outcome-audio.mjs +7 -8
- package/scripts/lean/native/check-salvage.mjs +8 -5
- package/scripts/lean/native/compiler.mjs +9 -3
- package/scripts/lean/native/contracts.mjs +11 -8
- package/scripts/lean/native/creative-qa.mjs +305 -122
- package/scripts/lean/native/demos.mjs +47 -3
- package/scripts/lean/native/document.mjs +36 -10
- package/scripts/lean/native/export-budget.mjs +75 -0
- package/scripts/lean/native/glb-loader.mjs +468 -0
- package/scripts/lean/native/intake-creator-tools.mjs +83 -30
- package/scripts/lean/native/local-bundle.mjs +5 -3
- package/scripts/lean/native/mcp-server.mjs +33 -46
- package/scripts/lean/native/media-validate.mjs +124 -0
- package/scripts/lean/native/native-bin.mjs +3 -3
- package/scripts/lean/native/outcome-playthrough.mjs +97 -0
- package/scripts/lean/native/prepare-fps-assets.mjs +330 -0
- package/scripts/lean/native/project-bundle.mjs +3 -3
- package/scripts/lean/native/remote-cc0-fetcher.mjs +403 -197
- package/scripts/lean/native/review-agent-tools.mjs +2 -2
- package/scripts/lean/native/review.mjs +3 -0
- package/scripts/lean/native/runtime.mjs +242 -56
- package/scripts/lean/native/schema.mjs +7 -5
- package/scripts/lean/native/service.mjs +159 -32
- package/scripts/lean/native/stage-3d.mjs +343 -40
- package/scripts/lean/native/starters.mjs +436 -0
- package/scripts/lean/native/verify.mjs +1 -1
- package/scripts/lean/native/win-cues.mjs +96 -0
- package/skills/tora-playables/SKILL.md +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {Buffer} from 'node:buffer';
|
|
1
2
|
import {assertStorePath} from './store-path.mjs';
|
|
2
3
|
import {mkdir,mkdtemp,writeFile,readFile,rename,rm,rmdir,access} from 'node:fs/promises';
|
|
3
4
|
import {resolve} from 'node:path';
|
|
@@ -5,18 +6,19 @@ import {execFile} from 'node:child_process';
|
|
|
5
6
|
import {promisify} from 'node:util';
|
|
6
7
|
import {randomUUID,createHash} from 'node:crypto';
|
|
7
8
|
import {projectBundle,readProjectBundle} from './project-bundle.mjs';
|
|
8
|
-
import {lowerAssets,
|
|
9
|
+
import {lowerAssets,storeVerifiedDeliveryAsset} from './assets.mjs';
|
|
10
|
+
import {saveRevisionLineage} from './asset-lineage.mjs';
|
|
9
11
|
import {resolveNativeTool} from './native-bin.mjs';
|
|
10
12
|
import {IS_SOURCE_CHECKOUT,PACKAGE_ROOT} from '../runtime-paths.mjs';
|
|
11
13
|
const run=promisify(execFile);
|
|
12
|
-
export async function exportProjectFile(service,id){const current=await service.read(id),assets=await lowerAssets(resolve(service.store.root,id),current.project.assets);return projectBundle(current.project,Object.fromEntries(assets.map(a=>[a.hash,a.data])));}
|
|
14
|
+
export async function exportProjectFile(service,id,revisionId){const current=await service.read(id,revisionId),assets=await lowerAssets(resolve(service.store.root,id),current.project.assets);return projectBundle(current.project,Object.fromEntries(assets.map(a=>[a.hash,a.data])));}
|
|
13
15
|
export async function importProjectFile(service,text,{copy=false}={}){
|
|
14
16
|
await assertStorePath(service.store.root);await mkdir(service.store.root,{recursive:true});const stage=await mkdtemp(resolve(service.store.root,'.import-'));let reserved;
|
|
15
17
|
try{
|
|
16
18
|
const decodeImage=async(bytes,mime)=>{let tool=resolveNativeTool('inspect');if(!tool&&IS_SOURCE_CHECKOUT){await run('cargo',['build','--locked','-p','playable-cli'],{cwd:PACKAGE_ROOT});tool=resolveNativeTool('inspect');}if(!tool)throw Error('E_NATIVE_BIN_UNAVAILABLE');await writeFile(resolve(stage,'image'),bytes);const result=JSON.parse((await run(tool.command,[...tool.prefixArgs,stage,'image'],{timeout:10000})).stdout)[0];if(result.source_mime!==mime)throw Error('E_NATIVE_ASSET_MIME');};
|
|
17
19
|
const bundle=await readProjectBundle(text,{decodeImage});if(copy)bundle.project.projectId=bundle.project.projectId.slice(0,32)+'-import-'+randomUUID().slice(0,8);const id=bundle.project.projectId,target=resolve(service.store.root,id);
|
|
18
20
|
const journal=resolve(service.history.directory,createHash('sha256').update(service.store.root+'\0'+id).digest('hex')+'.json');try{await access(journal);throw Error('E_PROJECT_EXISTS');}catch(e){if(e.code!=='ENOENT')throw e;}
|
|
19
|
-
const folder=resolve(stage,id);await mkdir(folder);await mkdir(resolve(folder,'revisions'));await writeFile(resolve(folder,'workspace.json'),JSON.stringify({format:'tora-local-workspace-1',id,kind:'native-scene',status:'DRAFT',activeRevision:'initial'}));for(const asset of bundle.project.assets)await
|
|
21
|
+
const folder=resolve(stage,id);await mkdir(folder);await mkdir(resolve(folder,'revisions'));await writeFile(resolve(folder,'workspace.json'),JSON.stringify({format:'tora-local-workspace-1',id,kind:'native-scene',status:'DRAFT',activeRevision:'initial'}));for(const asset of bundle.project.assets)await storeVerifiedDeliveryAsset(folder,{...asset,bytes:Buffer.from(bundle.assets[asset.hash],'base64'),expectedHash:asset.hash});await saveRevisionLineage(folder,bundle.project,null);await writeFile(resolve(folder,'project.json'),JSON.stringify(bundle.project));
|
|
20
22
|
// Reserving the ID prevents concurrent creators from being overwritten.
|
|
21
23
|
try{await mkdir(target);reserved=target;}catch(e){if(e.code==='EEXIST')throw Error('E_PROJECT_EXISTS',{cause:e});throw e;}await rename(folder,target);reserved=undefined;return {status:'IMPORTED',projectId:id,accepted:false};
|
|
22
24
|
}finally{if(reserved)await rmdir(reserved);await rm(stage,{recursive:true,force:true});}
|
|
@@ -10,44 +10,46 @@ import {ProjectStore} from '../project-store.mjs';
|
|
|
10
10
|
import {EditorState} from '../editor-state.mjs';
|
|
11
11
|
import {NativeService} from './service.mjs';
|
|
12
12
|
import {NativeAgentTools} from './agent-tools.mjs';
|
|
13
|
+
import {packageVersion} from './native-bin.mjs';
|
|
14
|
+
import {fetchCc0Properties,pivotMode,stageCc0ItemSchema} from './cc0-inputs.mjs';
|
|
13
15
|
import {availablePacks,capabilities,capabilitiesForPacks,capabilitySummary,compactCapabilities} from './contracts.mjs';
|
|
14
16
|
import {NativeReview} from './review.mjs';
|
|
15
17
|
import {reviewRoutingFlags} from './review-resolver.mjs';
|
|
16
18
|
import {ReviewIntake} from './review-intake.mjs';
|
|
17
19
|
import {targets} from './network-targets.mjs';
|
|
18
|
-
import {readOriginal,readUploadFile} from './assets.mjs';
|
|
19
20
|
import {AssetCatalog} from './asset-catalog.mjs';
|
|
20
21
|
import {RemoteCc0Fetcher} from './remote-cc0-fetcher.mjs';
|
|
21
22
|
import {stageVerifiedCc0Assets} from './cc0-staging.mjs';
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
23
|
+
import {composeStarter,listStarters,starterInputProperties} from './starters.mjs';
|
|
24
|
+
import {prepAssets} from './asset-prep.mjs';
|
|
24
25
|
import {closeSharedBrowser,getSharedBrowser} from './browser-pool.mjs';
|
|
25
26
|
import {PACKAGE_ROOT,defaultStoreRoot,resolveWorkspaceRoot} from '../runtime-paths.mjs';
|
|
26
27
|
|
|
27
28
|
const string={type:'string'},boolean={type:'boolean'},integer={type:'integer'},strings={type:'array',items:string};
|
|
28
29
|
const expected={type:'object',properties:{revisionId:string,contentHash:string},required:['revisionId','contentHash'],additionalProperties:false};
|
|
29
|
-
const assetSchema={type:'object',properties:{id:string,mime:{type:'string',enum:['image/png','image/jpeg','audio/wav','audio/mpeg','model/tora-mesh']},data:string,sourceHash:string,rights:string,optimize:{type:'string',enum:['auto','lossless','none']},preserveResolution:boolean},required:['id','mime','rights'],additionalProperties:false};
|
|
30
|
+
const assetSchema={type:'object',properties:{id:string,mime:{type:'string',enum:['image/png','image/jpeg','audio/wav','audio/mpeg','model/tora-mesh','model/gltf-binary','model/gltf+json','model/obj']},data:string,sourceHash:string,useOriginal:boolean,maxTextureSide:integer,preserveGeometry:boolean,targetTriangles:integer,rights:string,optimize:{type:'string',enum:['auto','lossless','none']},preserveResolution:boolean},required:['id','mime','rights'],additionalProperties:false};
|
|
30
31
|
const sliceGridSchema={type:'object',properties:{cols:integer,rows:integer,margin:integer,spacing:integer,trimCells:boolean,skipEmpty:boolean,maxFrames:integer,outputMode:{type:'string',enum:['frames','strip']}},required:['cols','rows'],additionalProperties:false};
|
|
31
|
-
const prepItemSchema={type:'object',properties:{filePath:string,sourceId:string,outputPrefix:string,rights:string,styleFamily:string,crop:{type:'array',items:integer},trim:boolean,alphaThreshold:integer,paddingPx:integer,resize:{type:'array',items:integer},maxSide:integer,allowDeform:boolean,sliceGrid:sliceGridSchema},additionalProperties:false};
|
|
32
|
-
const stageCc0ItemSchema={type:'object',properties:{sourceId:string,assetId:string,optimize:{type:'string',enum:['auto','lossless','none']},preserveResolution:boolean},required:['sourceId'],additionalProperties:false};
|
|
32
|
+
const prepItemSchema={type:'object',properties:{filePath:string,sourceId:string,outputPrefix:string,rights:string,styleFamily:string,mode:{type:'string',enum:['auto','lossless','none']},maxTextureSide:integer,preserveGeometry:boolean,preserveResolution:boolean,preserveNamedNodes:boolean,preserveNodes:strings,targetTriangles:integer,targetBytes:integer,targetHeightMeters:{type:'number'},pivotMode,upAxis:{type:'string',enum:['auto','y','z']},crop:{type:'array',items:integer},trim:boolean,alphaThreshold:integer,paddingPx:integer,resize:{type:'array',items:integer},maxSide:integer,allowDeform:boolean,sliceGrid:sliceGridSchema},additionalProperties:false};
|
|
33
33
|
|
|
34
34
|
export const tools=[];
|
|
35
35
|
function define(name,description,properties={},required=[],readOnly=false){tools.push({name:'tora_'+name,description,inputSchema:{type:'object',properties,required,additionalProperties:false},annotations:{readOnlyHint:readOnly,destructiveHint:!readOnly,openWorldHint:false}});}
|
|
36
36
|
define('brief','Read current production instructions and core authoring documentation. Load domain guides with packs or legacy full references with full:true. Pass alreadyRead:[{name,sha256}] on re-reads to omit unchanged docs.',{packs:strings,full:boolean,alreadyRead:{type:'array',items:{type:'object',properties:{name:string,sha256:string},required:['name','sha256'],additionalProperties:false}}},[],true);
|
|
37
37
|
define('capabilities','Discover supported contracts. Use packs for domains, names for exact descriptors, summary for the pack index, format:"compact" for concise schema with units, or omit all for the full registry.',{names:strings,packs:strings,summary:boolean,format:{type:'string',enum:['full','compact']}},[],true);
|
|
38
38
|
define('compose','Compose an editable playable from a structured creative concept and prepared artwork. Read tora_brief and discover creative-concept capabilities first. Returns creative review status and requirement trace.',{id:string,name:string,concept:{type:'object'}},['id','concept']);
|
|
39
|
+
define('starters','List tested editable playable starters and their visual asset roles. Use for simple requests that match a starter.',{},[],true);
|
|
40
|
+
define('compose_starter','Create a new editable playable draft with a complete win, timeout and Store CTA. Pick a starter using tora_starters, use its bundled CC0 assets or verified source IDs, and set deliver:true to write the draft, editable bundle, and QA evidence together.',starterInputProperties,['id','starter']);
|
|
39
41
|
define('create','Create an empty editable native project. Read tora_brief first.',{id:string,name:string,androidUrl:string},['id','name']);
|
|
40
42
|
define('inspect','Inspect current state and revision identity. Use tree:true for a compact scene outline, narrow with ids/search, or full:true for the complete project.',{id:string,revisionId:string,ids:strings,fields:strings,search:string,full:boolean,tree:boolean,sceneId:string},['id'],true);
|
|
41
43
|
define('edit','Preview and commit native operations against expected revision. Supply operations or commitPreviewDigest (not both). Scope lists intended changed IDs; scopeCreates:true auto-allows brand-new records whose pre-existing targets are in scope.',{id:string,expected,operations:{type:'array',items:{type:'object'}},scope:strings,previewOnly:boolean,previewDigest:string,commitPreviewDigest:string,scopeCreates:boolean},['id','expected','scope']);
|
|
42
|
-
define('list_assets','Search verified local and cached CC0 assets with dimensions and style families. Set includeRemote:true to also search allowlisted Kenney
|
|
43
|
-
define('fetch_cc0_pack','Fetch, license-verify, and cache one allowlisted Kenney or OpenGameArt CC0 pack into the active workspace cache.
|
|
44
|
+
define('list_assets','Search verified local and cached CC0 assets with dimensions, 3D facts, and style families. Set includeRemote:true to also search allowlisted Kenney, Quaternius, and OpenGameArt CC0 packs.',{query:string,kind:{type:'string',enum:['sprite','audio','mesh']},styleFamily:string,includeRemote:boolean,limit:integer},[],true);
|
|
45
|
+
define('fetch_cc0_pack','Fetch, license-verify, optimize, and cache one allowlisted Kenney, Quaternius, or OpenGameArt CC0 pack into the active workspace cache. Supports 2D, audio, and bounded 3D model preparation.',fetchCc0Properties,['sourceUrl']);
|
|
44
46
|
define('stage_cc0_assets','Stage up to 32 verified local or cached remote CC0 assets into a project in one atomic revision with server-enforced provenance and single visual style family.',{id:string,expected,items:{type:'array',items:stageCc0ItemSchema}},['id','expected','items']);
|
|
45
|
-
define('prep_assets','
|
|
46
|
-
define('upload_asset','Upload and
|
|
47
|
+
define('prep_assets','Prepare directory-based OBJ/glTF/GLB models with local dependencies, or prepare PNG/JPEG assets mechanically (crop, trim transparent padding, aspect-safe resize, or grid slice) into .tora/prepared-assets with hash-bound provenance receipts for tora_upload_assets.',{items:{type:'array',items:prepItemSchema}},['items']);
|
|
48
|
+
define('upload_asset','Upload images, audio and 3D models. Local GLB, OBJ and glTF file paths support 32 MiB. Use prep_assets for multi-file models. Supply base64 data, a workspace filePath, or sourceHash from a retained original. Auto is default; lossless/none and preserveResolution are optional.',{id:string,expected,filePath:string,asset:assetSchema},['id','expected','asset']);
|
|
47
49
|
define('upload_assets','Batch upload and optimize up to 32 PNG/JPEG/WAV/MP3/mesh assets in one atomic revision. Prefer workspace filePath (avoids the 12 MiB MCP frame limit) or supply base64 data / retained sourceHash.',{id:string,expected,items:{type:'array',items:{type:'object',properties:{filePath:string,asset:assetSchema},required:['asset'],additionalProperties:false}}},['id','expected','items']);
|
|
48
50
|
define('render','Write an HTML scene preview to output. Open it in a browser for visual inspection; this tool does not capture screenshots.',{id:string,revisionId:string,sceneId:string,output:string},['id','output']);
|
|
49
|
-
define('qa','Run deterministic static, acoustic, four-viewport layout, primary-interaction, and motion filmstrip QA on a native revision. Pass recordVideo:true for an opt-in WebM clip. A pass is engineering verification, not creative, device, or network acceptance.',{id:string,revisionId:string,output:string,target:{type:'string',enum:[...targets]},motionFilmstrip:boolean,recordVideo:boolean},['id']);
|
|
50
|
-
define('export','Write standalone HTML, any of seven ad-network HTML/ZIP artifacts, a batch of targets to outputDir, or an editable project bundle. Network exports must pass Creative QA; project format exports the current working head. Passing QA is not visual, device, or network approval.',{id:string,revisionId:string,output:string,format:{type:'string',enum:['project']},target:{type:'string',enum:[...targets]},targets:{type:'array',items:{type:'string',enum:[...targets]}},outputDir:string},['id']);
|
|
51
|
+
define('qa','Run deterministic static, acoustic, four-viewport layout, primary-interaction, and motion filmstrip QA on a native revision. Pass recordVideo:true for an opt-in WebM clip or fitTargetBudget:true to verify a target-fitted export variant. A pass is engineering verification, not creative, device, or network acceptance.',{id:string,revisionId:string,output:string,target:{type:'string',enum:[...targets]},motionFilmstrip:boolean,recordVideo:boolean,fitTargetBudget:boolean},['id']);
|
|
52
|
+
define('export','Write standalone HTML, any of seven ad-network HTML/ZIP artifacts, a batch of targets to outputDir, or an editable project bundle. Set fitTargetBudget:true to opt in to deterministic export-time budget fitting without mutating stored revisions. Network exports must pass Creative QA on the exact delivered artifact; project format exports the current working head. Passing QA is not visual, device, or network approval.',{id:string,revisionId:string,output:string,format:{type:'string',enum:['project']},target:{type:'string',enum:[...targets]},targets:{type:'array',items:{type:'string',enum:[...targets]}},outputDir:string,fitTargetBudget:boolean},['id']);
|
|
51
53
|
define('history','Save, undo or redo against expected revision.',{id:string,expected,action:{type:'string',enum:['save','undo','redo']}},['id','expected','action']);
|
|
52
54
|
define('review_claim','Claim an editor review request and read its authorized fields. Inspect the baseline and follow the selected scope.',{id:string,requestId:string},['id','requestId']);
|
|
53
55
|
define('review_propose','Submit one creative revision against the claimed review request. For a note list, key changes by scoped note ID and then by authorized field ID. For older single-note requests, key changes directly by field ID. Each unique proposalId (UUID) counts as one pass. Wait for creator review before another proposal.',{id:string,requestId:string,proposalId:string,changes:{type:'object'},summary:string},['id','requestId','proposalId','changes','summary']);
|
|
@@ -61,6 +63,7 @@ function valid(value,schema){
|
|
|
61
63
|
if(schema.type==='object'){if(!value||typeof value!=='object'||Array.isArray(value))return false;if(schema.required?.some(k=>!Object.hasOwn(value,k)))return false;if(schema.additionalProperties===false&&Object.keys(value).some(k=>!Object.hasOwn(schema.properties,k)))return false;return Object.entries(schema.properties??{}).every(([k,s])=>!Object.hasOwn(value,k)||valid(value[k],s));}
|
|
62
64
|
if(schema.type==='array')return Array.isArray(value)&&value.every(v=>valid(v,schema.items));
|
|
63
65
|
if(schema.type==='integer')return Number.isInteger(value);
|
|
66
|
+
if(schema.type==='number')return typeof value==='number'&&Number.isFinite(value);
|
|
64
67
|
return typeof value===schema.type&&(!schema.enum||schema.enum.includes(value));
|
|
65
68
|
}
|
|
66
69
|
|
|
@@ -151,15 +154,18 @@ export function createMcpServer({
|
|
|
151
154
|
remotePacks:result.remotePacks,
|
|
152
155
|
};
|
|
153
156
|
}
|
|
157
|
+
if(name==='tora_starters')return listStarters();
|
|
154
158
|
if(!['tora_inspect'].includes(name)&&!briefRead)throw Error('E_MCP_READ_BRIEF_FIRST');
|
|
159
|
+
if(name==='tora_compose_starter')return composeStarter(args,{service,catalog:assetCatalog,remoteFetcher:cc0Fetcher,workspaceRoot:ws});
|
|
155
160
|
if(name==='tora_fetch_cc0_pack'){
|
|
156
|
-
const receipt=await cc0Fetcher.fetchPackWithFallback(
|
|
161
|
+
const receipt=await cc0Fetcher.fetchPackWithFallback(args);
|
|
157
162
|
return {
|
|
158
163
|
online:receipt.online!==false,
|
|
159
164
|
...(receipt.warning?{warning:receipt.warning}:{}),
|
|
160
165
|
...(receipt.error?{error:receipt.error}:{}),
|
|
161
166
|
...(receipt.sourceId?{sourceId:receipt.sourceId,provider:receipt.provider,packTitle:receipt.packTitle,author:receipt.author,license:receipt.license,sourceUrl:receipt.sourceUrl,cached:Boolean(receipt.cached)}:{}) ,
|
|
162
|
-
files:(receipt.files??[]).map(({
|
|
167
|
+
files:(receipt.files??[]).map(({storedPath,masterStoredPath,...file})=>{void storedPath;void masterStoredPath;return file;}),
|
|
168
|
+
skippedModels:receipt.skippedModels??[],totalMatchingModels:receipt.totalMatchingModels??0,truncated:Boolean(receipt.truncated),remainingModelPaths:receipt.remainingModelPaths??[],
|
|
163
169
|
...(receipt.fallbackLocalMatches?{fallbackLocalMatches:receipt.fallbackLocalMatches}:{}),
|
|
164
170
|
};
|
|
165
171
|
}
|
|
@@ -183,41 +189,18 @@ export function createMcpServer({
|
|
|
183
189
|
if(name==='tora_intake_build')return intakes.build(args.id,args.concept?{concept:args.concept}:{});
|
|
184
190
|
if(name==='tora_upload_asset'){
|
|
185
191
|
const current=await service.read(args.id);if(current.revisionId!==args.expected.revisionId||current.contentHash!==args.expected.contentHash)throw Error('E_NATIVE_STALE');
|
|
186
|
-
const asset={...args.asset}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
const prepared=await resolvePreparedProvenance(ws,args.filePath,bytes);
|
|
191
|
-
if(prepared){
|
|
192
|
-
provenance=prepared.provenance;
|
|
193
|
-
if(prepared.rights&&!prepared.provenance.includes('"studio-original"'))asset.rights=prepared.rights;
|
|
194
|
-
}
|
|
195
|
-
asset.data=bytes.toString('base64');
|
|
196
|
-
}
|
|
197
|
-
if(asset.sourceHash){asset.data=(await readOriginal(resolve(store.root,args.id),asset.sourceHash)).toString('base64');delete asset.sourceHash;}
|
|
198
|
-
const r=await service.upload(args.id,{...args,asset,...(provenance?{provenance}:{})});return {status:'UPLOADED',asset:r.asset,expected:{revisionId:r.revisionId,contentHash:r.contentHash}};
|
|
192
|
+
const asset={...args.asset};
|
|
193
|
+
if([args.filePath,asset.data,asset.sourceHash,asset.useOriginal].filter(Boolean).length!==1)throw Error('E_MCP_ARGUMENT');
|
|
194
|
+
const r=await service.upload(args.id,{expected:args.expected,asset},{workspaceRoot:ws,filePaths:[args.filePath]});
|
|
195
|
+
return {status:'UPLOADED',asset:r.asset,expected:{revisionId:r.revisionId,contentHash:r.contentHash}};
|
|
199
196
|
}
|
|
200
197
|
if(name==='tora_upload_assets'){
|
|
201
198
|
if(!Array.isArray(args.items)||args.items.length<1||args.items.length>32)throw Error('E_MCP_ARGUMENT');
|
|
202
|
-
const current=await service.read(args.id);if(current.revisionId!==args.expected.revisionId||current.contentHash!==args.expected.contentHash)throw Error('E_NATIVE_STALE');
|
|
203
199
|
for(const item of args.items){
|
|
204
|
-
|
|
205
|
-
if(sources.filter(Boolean).length!==1)throw Error('E_MCP_ARGUMENT');
|
|
200
|
+
if([item.filePath,item.asset?.data,item.asset?.sourceHash,item.asset?.useOriginal].filter(Boolean).length!==1)throw Error('E_MCP_ARGUMENT');
|
|
206
201
|
}
|
|
207
|
-
const assets=
|
|
208
|
-
|
|
209
|
-
if(item.filePath){
|
|
210
|
-
const bytes=await readUploadFile(ws,item.filePath);
|
|
211
|
-
const prepared=await resolvePreparedProvenance(ws,item.filePath,bytes);
|
|
212
|
-
if(prepared){
|
|
213
|
-
asset.provenance=prepared.provenance;
|
|
214
|
-
if(prepared.rights&&!prepared.provenance.includes('"studio-original"'))asset.rights=prepared.rights;
|
|
215
|
-
}
|
|
216
|
-
asset.data=bytes.toString('base64');
|
|
217
|
-
}
|
|
218
|
-
return asset;
|
|
219
|
-
});
|
|
220
|
-
const r=await service.uploadBatch(args.id,{expected:args.expected,assets});
|
|
202
|
+
const assets=args.items.map(item=>item.asset);
|
|
203
|
+
const r=await service.uploadBatch(args.id,{expected:args.expected,assets},{workspaceRoot:ws,filePaths:args.items.map(item=>item.filePath)});
|
|
221
204
|
return {status:'UPLOADED',assets:r.assets,expected:{revisionId:r.revisionId,contentHash:r.contentHash}};
|
|
222
205
|
}
|
|
223
206
|
if(name==='tora_export'&&args.format==='project'&&args.revisionId)throw Error('E_MCP_PROJECT_EXPORT_HEAD_ONLY');
|
|
@@ -226,7 +209,11 @@ export function createMcpServer({
|
|
|
226
209
|
if(isBatch&&(args.output||args.target||args.format||!args.outputDir))throw Error('E_MCP_ARGUMENT');
|
|
227
210
|
if(!isBatch&&(!args.output||args.outputDir))throw Error('E_MCP_ARGUMENT');
|
|
228
211
|
}
|
|
229
|
-
|
|
212
|
+
const input={...args,command:name.slice(5)};
|
|
213
|
+
for(const key of ['output','outputDir']){
|
|
214
|
+
if(typeof input[key]==='string'&&input[key].length)input[key]=resolve(ws,input[key]);
|
|
215
|
+
}
|
|
216
|
+
return agent.run(input);
|
|
230
217
|
}
|
|
231
218
|
|
|
232
219
|
async function dispatch(request){
|
|
@@ -234,7 +221,7 @@ export function createMcpServer({
|
|
|
234
221
|
const notification=!Object.hasOwn(request,'id');
|
|
235
222
|
if(notification){if(request.method==='notifications/initialized'&&initialized)ready=true;return;}
|
|
236
223
|
const {id,method}=request;
|
|
237
|
-
if(method==='initialize'){if(initialized)return error(id,-32600,'Already initialized');if(!request.params?.protocolVersion)return error(id,-32602,'Missing protocolVersion');initialized=true;return {jsonrpc:'2.0',id,result:{protocolVersion:'2025-11-25',serverInfo:{name:'tora',version:
|
|
224
|
+
if(method==='initialize'){if(initialized)return error(id,-32600,'Already initialized');if(!request.params?.protocolVersion)return error(id,-32602,'Missing protocolVersion');initialized=true;return {jsonrpc:'2.0',id,result:{protocolVersion:'2025-11-25',serverInfo:{name:'tora',version:packageVersion(PACKAGE_ROOT)},capabilities:{tools:{}},instructions:'Use tora_brief before authoring. Follow current production rules and inspect actual visual output. Use tora_capabilities for supported contracts. This local service shares Tora native project storage; no HTTP endpoint is needed.'}};}
|
|
238
225
|
if(method==='ping')return {jsonrpc:'2.0',id,result:{}};
|
|
239
226
|
if(!ready)return error(id,-32000,'Initialize first');
|
|
240
227
|
if(method==='tools/list')return {jsonrpc:'2.0',id,result:{tools}};
|
|
@@ -93,3 +93,127 @@ export function validateToraMesh(bytes, code = 'E_NATIVE_MESH_MALFORMED') {
|
|
|
93
93
|
}
|
|
94
94
|
return {vertexCount, indexCount};
|
|
95
95
|
}
|
|
96
|
+
|
|
97
|
+
const ALLOWED_GLTF_EXTENSIONS = new Set([
|
|
98
|
+
'KHR_mesh_quantization',
|
|
99
|
+
'KHR_materials_unlit',
|
|
100
|
+
'KHR_texture_transform',
|
|
101
|
+
'KHR_materials_emissive_strength',
|
|
102
|
+
]);
|
|
103
|
+
|
|
104
|
+
/** Pure Uint8Array validator for Tora's strict glTF 2.0 binary (.glb) delivery subset. */
|
|
105
|
+
export function validateGlbHeader(bytes, code = 'E_MODEL_CORRUPT', maxBytes = 700000) {
|
|
106
|
+
if (!(bytes instanceof Uint8Array) || bytes.length < 28 || bytes.length > maxBytes) fail(code);
|
|
107
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
108
|
+
if (view.getUint32(0, true) !== 0x46546c67 || view.getUint32(4, true) !== 2 || view.getUint32(8, true) !== bytes.length) fail(code);
|
|
109
|
+
const jsonLen = view.getUint32(12, true);
|
|
110
|
+
if (jsonLen === 0 || jsonLen % 4 !== 0 || view.getUint32(16, true) !== 0x4e4f534a || 20 + jsonLen > bytes.length) fail(code);
|
|
111
|
+
let gltf;
|
|
112
|
+
try {
|
|
113
|
+
gltf = JSON.parse(new globalThis.TextDecoder('utf-8', {fatal: true}).decode(bytes.subarray(20, 20 + jsonLen)));
|
|
114
|
+
} catch {
|
|
115
|
+
fail(code);
|
|
116
|
+
}
|
|
117
|
+
const binAt = 20 + jsonLen;
|
|
118
|
+
let binLen = 0;
|
|
119
|
+
if (binAt < bytes.length) {
|
|
120
|
+
if (binAt + 8 > bytes.length || view.getUint32(binAt + 4, true) !== 0x004e4942) fail(code);
|
|
121
|
+
binLen = view.getUint32(binAt, true);
|
|
122
|
+
if (binLen % 4 !== 0 || binAt + 8 + binLen !== bytes.length) fail(code);
|
|
123
|
+
}
|
|
124
|
+
if (!gltf || typeof gltf !== 'object' || gltf.asset?.version !== '2.0') fail(code);
|
|
125
|
+
if (gltf.cameras?.length) fail(code);
|
|
126
|
+
const skins = gltf.skins ?? [];
|
|
127
|
+
const gltfAnimations = gltf.animations ?? [];
|
|
128
|
+
if (!Array.isArray(skins) || skins.length > 4) fail(code);
|
|
129
|
+
if (!Array.isArray(gltfAnimations) || gltfAnimations.length > 16) fail(code);
|
|
130
|
+
for (const ext of [...(gltf.extensionsUsed ?? []), ...(gltf.extensionsRequired ?? [])]) {
|
|
131
|
+
if (!ALLOWED_GLTF_EXTENSIONS.has(ext)) fail(code);
|
|
132
|
+
}
|
|
133
|
+
const stack = [gltf];
|
|
134
|
+
while (stack.length) {
|
|
135
|
+
const cur = stack.pop();
|
|
136
|
+
if (!cur || typeof cur !== 'object') continue;
|
|
137
|
+
if (!Array.isArray(cur)) {
|
|
138
|
+
if (Object.hasOwn(cur, 'uri')) fail(code);
|
|
139
|
+
for (const [k, v] of Object.entries(cur)) {
|
|
140
|
+
if (k !== 'extras' && v && typeof v === 'object') stack.push(v);
|
|
141
|
+
}
|
|
142
|
+
} else {
|
|
143
|
+
for (const item of cur) if (item && typeof item === 'object') stack.push(item);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (!Array.isArray(gltf.meshes) || gltf.meshes.length === 0 || !Array.isArray(gltf.scenes) || gltf.scenes.length === 0) fail(code);
|
|
147
|
+
if (!Array.isArray(gltf.buffers) || gltf.buffers.length !== 1 || gltf.buffers[0].byteLength > binLen) fail(code);
|
|
148
|
+
const accessors = gltf.accessors ?? [];
|
|
149
|
+
const nodes = gltf.nodes ?? [];
|
|
150
|
+
for (const skin of skins) {
|
|
151
|
+
if (!Array.isArray(skin?.joints) || skin.joints.length < 1 || skin.joints.length > 64) fail(code);
|
|
152
|
+
for (const jointIdx of skin.joints) {
|
|
153
|
+
if (!Number.isInteger(jointIdx) || jointIdx < 0 || jointIdx >= nodes.length) fail(code);
|
|
154
|
+
}
|
|
155
|
+
if (skin.inverseBindMatrices !== undefined) {
|
|
156
|
+
const ibmAcc = accessors[skin.inverseBindMatrices];
|
|
157
|
+
if (!ibmAcc || ibmAcc.type !== 'MAT4' || ibmAcc.componentType !== 5126 || !Number.isInteger(ibmAcc.count) || ibmAcc.count < skin.joints.length) fail(code);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
let keyframes = 0;
|
|
161
|
+
const animations = [];
|
|
162
|
+
for (let i = 0; i < gltfAnimations.length; i++) {
|
|
163
|
+
const anim = gltfAnimations[i];
|
|
164
|
+
const samplers = anim?.samplers ?? [];
|
|
165
|
+
const channels = anim?.channels ?? [];
|
|
166
|
+
if (!Array.isArray(samplers) || !Array.isArray(channels)) fail(code);
|
|
167
|
+
for (const sampler of samplers) {
|
|
168
|
+
const interp = sampler?.interpolation ?? 'LINEAR';
|
|
169
|
+
if (interp !== 'LINEAR' && interp !== 'STEP') fail(code);
|
|
170
|
+
const inAcc = accessors[sampler?.input];
|
|
171
|
+
const outAcc = accessors[sampler?.output];
|
|
172
|
+
if (!inAcc || !outAcc || inAcc.type !== 'SCALAR' || inAcc.componentType !== 5126 || !Number.isInteger(inAcc.count) || inAcc.count < 1 || outAcc.count !== inAcc.count) fail(code);
|
|
173
|
+
keyframes += inAcc.count;
|
|
174
|
+
}
|
|
175
|
+
for (const ch of channels) {
|
|
176
|
+
if (!Number.isInteger(ch?.sampler) || ch.sampler < 0 || ch.sampler >= samplers.length) fail(code);
|
|
177
|
+
const targetNode = ch?.target?.node;
|
|
178
|
+
if (targetNode !== undefined && (!Number.isInteger(targetNode) || targetNode < 0 || targetNode >= nodes.length)) fail(code);
|
|
179
|
+
}
|
|
180
|
+
animations.push(typeof anim?.name === 'string' && anim.name.length > 0 ? anim.name : `clip_${i}`);
|
|
181
|
+
}
|
|
182
|
+
if (keyframes > 8192) fail(code);
|
|
183
|
+
let triangles = 0, vertices = 0, drawCalls = 0;
|
|
184
|
+
for (const mesh of gltf.meshes) {
|
|
185
|
+
for (const prim of mesh.primitives ?? []) {
|
|
186
|
+
drawCalls++;
|
|
187
|
+
const posAcc = accessors[prim.attributes?.POSITION];
|
|
188
|
+
if (!posAcc || !Number.isInteger(posAcc.count) || posAcc.count < 1 || posAcc.count > 65535) fail(code);
|
|
189
|
+
vertices += posAcc.count;
|
|
190
|
+
if (prim.indices !== undefined) {
|
|
191
|
+
const idxAcc = accessors[prim.indices];
|
|
192
|
+
if (!idxAcc || !Number.isInteger(idxAcc.count) || idxAcc.count < 3 || idxAcc.count % 3 !== 0) fail(code);
|
|
193
|
+
triangles += idxAcc.count / 3;
|
|
194
|
+
} else {
|
|
195
|
+
if (posAcc.count < 3 || posAcc.count % 3 !== 0) fail(code);
|
|
196
|
+
triangles += posAcc.count / 3;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
if (triangles < 1 || triangles > 50000) fail(code);
|
|
201
|
+
const subNodes = [];
|
|
202
|
+
const seenNames = new Set();
|
|
203
|
+
for (const node of gltf.nodes ?? []) {
|
|
204
|
+
if (typeof node?.name === 'string' && node.name.length > 0 && !seenNames.has(node.name)) {
|
|
205
|
+
seenNames.add(node.name);
|
|
206
|
+
subNodes.push(node.name);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return {
|
|
210
|
+
triangles,
|
|
211
|
+
vertices,
|
|
212
|
+
drawCalls,
|
|
213
|
+
materials: (gltf.materials ?? []).length,
|
|
214
|
+
textures: (gltf.images ?? []).length,
|
|
215
|
+
skins: skins.length,
|
|
216
|
+
animations,
|
|
217
|
+
subNodes,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
@@ -21,9 +21,9 @@ export const PLATFORM_TARGETS=Object.freeze({
|
|
|
21
21
|
export function packageVersion(packageRoot=PACKAGE_ROOT){
|
|
22
22
|
try{
|
|
23
23
|
const parsed=JSON.parse(readFileSync(resolve(packageRoot,'package.json'),'utf8'));
|
|
24
|
-
return typeof parsed.version==='string'&&parsed.version?parsed.version:'0.
|
|
24
|
+
return typeof parsed.version==='string'&&parsed.version?parsed.version:'0.2.0';
|
|
25
25
|
}catch{
|
|
26
|
-
return '0.
|
|
26
|
+
return '0.2.0';
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -33,7 +33,7 @@ export function platformTarget(platform=process.platform,arch=process.arch){
|
|
|
33
33
|
|
|
34
34
|
function unifiedPrefix(kind){
|
|
35
35
|
if(kind==='cli')return [];
|
|
36
|
-
if(
|
|
36
|
+
if(['inspect','optimize','prep','inspect-3d','optimize-3d','prep-3d'].includes(kind))return ['assets',kind];
|
|
37
37
|
throw Error('E_NATIVE_BIN_KIND');
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// Trusted browser inputs for built-in demos whose mechanics require a specific gesture.
|
|
2
|
+
async function reachedScene(page,scene,timeout){
|
|
3
|
+
return Boolean(await page.waitForFunction(id=>globalThis.toraRuntime?.state?.()?.scene===id,scene,{timeout}).catch(()=>null));
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
async function playMiniGolf(page){
|
|
7
|
+
// The first shot banks off the rail, the second crosses the moving gate,
|
|
8
|
+
// and the third climbs the short ramp.
|
|
9
|
+
const shots=[{dx:-54,dy:19,next:'scene.hole2'},{dx:-25,dy:34,next:'scene.hole3'},{dx:-34,dy:46,next:'scene.win'}];
|
|
10
|
+
await page.waitForTimeout(1600);
|
|
11
|
+
for(const [index,{dx,dy,next}] of shots.entries()){
|
|
12
|
+
if(index===1){
|
|
13
|
+
const positioned=await page.waitForFunction(()=>{
|
|
14
|
+
const gate=globalThis.toraRuntime.state().physics3d.bodies.find(body=>body.id==='h2.gate');
|
|
15
|
+
return gate&&gate.x>-.55&&gate.x<-.1&&gate.vx>0;
|
|
16
|
+
},undefined,{timeout:6000}).catch(()=>null);
|
|
17
|
+
if(!positioned)return false;
|
|
18
|
+
}
|
|
19
|
+
const {width,height}=page.viewportSize();
|
|
20
|
+
const scale=Math.min(width/390,height/700),x=width/2+5*scale,y=height/2;
|
|
21
|
+
await page.mouse.move(x,y);
|
|
22
|
+
await page.mouse.down();
|
|
23
|
+
await page.mouse.move(x+dx*scale,y+dy*scale,{steps:5});
|
|
24
|
+
await page.mouse.up();
|
|
25
|
+
if(!await reachedScene(page,next,14000))return false;
|
|
26
|
+
await page.waitForTimeout(300);
|
|
27
|
+
}
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async function playSkyBlaster(page,project,controller){
|
|
32
|
+
const stageId=controller.componentId;
|
|
33
|
+
const targets=project.components.filter(component=>/^fps\.drone\.[1-6]$/.test(component.id));
|
|
34
|
+
const {lookSensitivity,invertAimY}=controller.parameters;
|
|
35
|
+
const {width,height}=page.viewportSize();
|
|
36
|
+
const x=width/2,y=height/2;
|
|
37
|
+
for(let attempt=0;attempt<52;attempt++){
|
|
38
|
+
const target=await page.evaluate(({stageId,targets})=>{
|
|
39
|
+
const state=globalThis.toraRuntime.state();
|
|
40
|
+
if(state.scene==='scene.win'||state.variables['fps.won'])return {won:true};
|
|
41
|
+
if(state.scene!=='scene.play')return null;
|
|
42
|
+
const camera=state.physics3d.fps[stageId];
|
|
43
|
+
const model=targets.map(component=>({...component.parameters,...state.components[component.id]?.parameters}))
|
|
44
|
+
.filter(parameters=>parameters.visible);
|
|
45
|
+
const directions=model.map(({x,y,z})=>{
|
|
46
|
+
const dx=x-camera.x,dy=y-camera.y,dz=z-camera.z;
|
|
47
|
+
return {yaw:Math.atan2(-dx,-dz),pitch:Math.atan2(dy,Math.hypot(dx,dz))};
|
|
48
|
+
});
|
|
49
|
+
directions.sort((a,b)=>Math.abs(a.yaw-camera.yaw)-Math.abs(b.yaw-camera.yaw));
|
|
50
|
+
const nearest=directions[0];
|
|
51
|
+
return nearest?{dx:camera.yaw-nearest.yaw,dy:camera.pitch-nearest.pitch,scale:Math.min(globalThis.innerWidth/state.viewport.width,globalThis.innerHeight/state.viewport.height)}:null;
|
|
52
|
+
},{stageId,targets});
|
|
53
|
+
if(target?.won)return reachedScene(page,'scene.win',2500);
|
|
54
|
+
if(!target)return false;
|
|
55
|
+
const sx=Math.max(-x+10,Math.min(x-10,target.dx*target.scale/lookSensitivity));
|
|
56
|
+
const sy=Math.max(-y+10,Math.min(y-10,target.dy*target.scale/lookSensitivity*(invertAimY?-1:1)));
|
|
57
|
+
await page.mouse.move(x,y);
|
|
58
|
+
await page.mouse.down();
|
|
59
|
+
if(Math.abs(sx)+Math.abs(sy)>1)await page.mouse.move(x+sx,y+sy,{steps:2});
|
|
60
|
+
await page.mouse.up();
|
|
61
|
+
await page.waitForTimeout(75);
|
|
62
|
+
}
|
|
63
|
+
return reachedScene(page,'scene.win',2500);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async function playDingDang(page){
|
|
67
|
+
const {width,height}=page.viewportSize(),scale=Math.min(width/390,height/700);
|
|
68
|
+
const screen=(x,y)=>[(width-390*scale)/2+x*scale,(height-700*scale)/2+y*scale];
|
|
69
|
+
await page.mouse.move(...screen(141,610));
|
|
70
|
+
await page.mouse.down();
|
|
71
|
+
try{
|
|
72
|
+
const deadline=Date.now()+27000;
|
|
73
|
+
while(Date.now()<deadline){
|
|
74
|
+
const state=await page.evaluate(()=>globalThis.toraRuntime.state());
|
|
75
|
+
if(state.scene!=='scene.play')return state.scene==='scene.success';
|
|
76
|
+
const residents=state.instances.filter(instance=>instance.prototypeId!=='prototype.hazard').sort((a,b)=>b.y-a.y);
|
|
77
|
+
const next=residents[0];
|
|
78
|
+
if(next){
|
|
79
|
+
let desired=Math.max(0,Math.min(232,next.x+14-79));
|
|
80
|
+
const blocked=state.instances.some(instance=>instance.prototypeId==='prototype.hazard'&&instance.y>430&&instance.x+28>desired+40&&instance.x<desired+118);
|
|
81
|
+
if(blocked)desired=desired>130?0:232;
|
|
82
|
+
await page.mouse.move(...screen(desired+25,610),{steps:2});
|
|
83
|
+
}
|
|
84
|
+
await page.waitForTimeout(80);
|
|
85
|
+
}
|
|
86
|
+
return false;
|
|
87
|
+
}finally{await page.mouse.up();}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function builtInPlaythrough(project){
|
|
91
|
+
const has=id=>project.gameplay.some(behavior=>behavior.id===id);
|
|
92
|
+
if(has('ball.aim')&&has('h2.gate.osc')&&has('h3.ball.aim'))return page=>playMiniGolf(page);
|
|
93
|
+
const controller=project.gameplay.find(behavior=>behavior.id==='fps.controller'&&behavior.kind==='fps-controller-3d');
|
|
94
|
+
if(controller&&has('fps.drone.1.state')&&has('fps.drone.6.state'))return page=>playSkyBlaster(page,project,controller);
|
|
95
|
+
if(has('team.drag')&&has('prototype.resident.collider'))return page=>playDingDang(page);
|
|
96
|
+
return null;
|
|
97
|
+
}
|