@tora-editor/tora 0.1.0 → 0.3.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.
Files changed (131) hide show
  1. package/README.md +107 -58
  2. package/assets/free-audio/arcade-pop/audio/loss.wav +0 -0
  3. package/assets/free-audio/arcade-pop/audio/reward.wav +0 -0
  4. package/assets/free-audio/arcade-pop/audio/win.wav +0 -0
  5. package/assets/free-audio/arcade-pop/source/INFO.txt +11 -11
  6. package/assets/kenney-food-starter/License.txt +28 -0
  7. package/assets/kenney-food-starter/burger.glb +0 -0
  8. package/assets/kenney-food-starter/frying-pan.glb +0 -0
  9. package/assets/kenney-food-starter/plan.json +61 -0
  10. package/assets/kenney-food-starter/plate.glb +0 -0
  11. package/assets/kenney-food-starter/pot.glb +0 -0
  12. package/assets/kenney-harvest/audio/victory.wav +0 -0
  13. package/assets/kenney-harvest/source/music-jingles/OGG/jingles_NES/jingles_NES03.ogg +0 -0
  14. package/assets/kenney-harvest/source/music-jingles/OGG/jingles_PIZZA/jingles_PIZZA03.ogg +0 -0
  15. package/assets/kenney-harvest/source/music-jingles/license.txt +14 -0
  16. package/bin/tora.mjs +322 -28
  17. package/crates/packer/trusted/native-3d-meta.json +4 -3
  18. package/crates/packer/trusted/native-3d.js +181 -181
  19. package/crates/packer/trusted/native-meta.json +3 -3
  20. package/crates/packer/trusted/native.js +5 -5
  21. package/crates/packer/trusted/release-manifest.json +17 -17
  22. package/crates/packer/trusted/review-runtime-meta.json +4 -3
  23. package/crates/packer/trusted/review-runtime.js +182 -182
  24. package/docs/MIGRATION_0_3.md +39 -0
  25. package/docs/NATIVE_AGENT_TOOLS.md +12 -363
  26. package/docs/TORA_AGENT_SETUP.md +24 -95
  27. package/docs/TORA_CREATION_API.md +63 -348
  28. package/docs/reference/CORE_AUTHORING.md +10 -3
  29. package/docs/reference/PLAYABLE_STARTERS.md +20 -0
  30. package/docs/reference/packs/3d.md +11 -3
  31. package/network-rules/mintegral-appgrowth-single-html.json +10 -10
  32. package/package.json +6 -6
  33. package/packages/creative-project/project-v21.schema.json +372 -9
  34. package/scripts/lean/editor/entry.js +11 -6
  35. package/scripts/lean/editor/project-launcher.js +116 -0
  36. package/scripts/lean/editor/quick-edit-panel.js +479 -0
  37. package/scripts/lean/editor/review-editor.css +256 -68
  38. package/scripts/lean/editor/review-editor.js +1834 -1086
  39. package/scripts/lean/editor-state.mjs +6 -0
  40. package/scripts/lean/editor.mjs +6 -3
  41. package/scripts/lean/matrix.mjs +5 -0
  42. package/scripts/lean/native/agent-tools.mjs +39 -62
  43. package/scripts/lean/native/api.mjs +161 -136
  44. package/scripts/lean/native/asset-catalog.mjs +7 -6
  45. package/scripts/lean/native/asset-lineage.mjs +54 -0
  46. package/scripts/lean/native/asset-prep.mjs +173 -40
  47. package/scripts/lean/native/assets.mjs +107 -11
  48. package/scripts/lean/native/audio-assets.mjs +30 -0
  49. package/scripts/lean/native/browser-pool.mjs +34 -0
  50. package/scripts/lean/native/build-cache.mjs +38 -7
  51. package/scripts/lean/native/cc0-inputs.mjs +24 -0
  52. package/scripts/lean/native/cc0-staging.mjs +28 -8
  53. package/scripts/lean/native/compiler.mjs +9 -3
  54. package/scripts/lean/native/contracts.mjs +16 -11
  55. package/scripts/lean/native/creative-qa.mjs +365 -128
  56. package/scripts/lean/native/demos.mjs +53 -18
  57. package/scripts/lean/native/document.mjs +50 -12
  58. package/scripts/lean/native/export-budget.mjs +75 -0
  59. package/scripts/lean/native/local-bundle.mjs +7 -3
  60. package/scripts/lean/native/mcp-server.mjs +42 -74
  61. package/scripts/lean/native/media-validate.mjs +124 -0
  62. package/scripts/lean/native/modules/harvest-restore.mjs +3 -284
  63. package/scripts/lean/native/modules/sort-puzzle.mjs +51 -0
  64. package/scripts/lean/native/modules/star-salvage.mjs +3 -368
  65. package/scripts/lean/native/native-bin.mjs +3 -3
  66. package/scripts/lean/native/outcome-playthrough.mjs +97 -0
  67. package/scripts/lean/native/project-bundle.mjs +6 -5
  68. package/scripts/lean/native/project-index.mjs +0 -2
  69. package/scripts/lean/native/qa-adapters.mjs +10 -0
  70. package/scripts/lean/native/quick-edit.mjs +328 -0
  71. package/scripts/lean/native/remote-cc0-fetcher.mjs +403 -197
  72. package/scripts/lean/native/review.mjs +205 -571
  73. package/scripts/lean/native/schema-vocabulary.mjs +10 -0
  74. package/scripts/lean/native/schema.mjs +7 -5
  75. package/scripts/lean/native/scope.mjs +45 -0
  76. package/scripts/lean/native/service.mjs +378 -79
  77. package/scripts/lean/native/starters.mjs +563 -0
  78. package/scripts/lean/native/variant-adapters.mjs +8 -0
  79. package/scripts/lean/native/variants-core.mjs +186 -0
  80. package/scripts/lean/native/variants.mjs +63 -0
  81. package/scripts/lean/native/win-cues.mjs +96 -0
  82. package/skills/tora-playables/SKILL.md +1 -1
  83. package/scripts/lean/editor/review-intake.js +0 -837
  84. package/scripts/lean/model-client.mjs +0 -119
  85. package/scripts/lean/native/author-expansion-proofs.mjs +0 -240
  86. package/scripts/lean/native/author-games.mjs +0 -160
  87. package/scripts/lean/native/author-harvest.mjs +0 -74
  88. package/scripts/lean/native/author-primitive-proofs.mjs +0 -874
  89. package/scripts/lean/native/author-salvage.mjs +0 -71
  90. package/scripts/lean/native/chat-compose.mjs +0 -287
  91. package/scripts/lean/native/check-harvest-outcome-audio.mjs +0 -191
  92. package/scripts/lean/native/check-salvage.mjs +0 -197
  93. package/scripts/lean/native/compatibility.mjs +0 -34
  94. package/scripts/lean/native/concept.mjs +0 -633
  95. package/scripts/lean/native/draw-stroke.mjs +0 -26
  96. package/scripts/lean/native/erase-mask.mjs +0 -18
  97. package/scripts/lean/native/harvest-recipe.mjs +0 -21
  98. package/scripts/lean/native/instance-steering.mjs +0 -24
  99. package/scripts/lean/native/intake-creator-agent.mjs +0 -98
  100. package/scripts/lean/native/intake-creator-tools.mjs +0 -165
  101. package/scripts/lean/native/interaction-gestures.mjs +0 -45
  102. package/scripts/lean/native/match-board.mjs +0 -138
  103. package/scripts/lean/native/modules/index.mjs +0 -54
  104. package/scripts/lean/native/modules/tap-collect.mjs +0 -54
  105. package/scripts/lean/native/path-network.mjs +0 -132
  106. package/scripts/lean/native/physics-2d.mjs +0 -154
  107. package/scripts/lean/native/physics-3d.mjs +0 -259
  108. package/scripts/lean/native/prepare-audio-collections.mjs +0 -112
  109. package/scripts/lean/native/prepare-game-audio.mjs +0 -372
  110. package/scripts/lean/native/prepare-golf-3d-assets.py +0 -177
  111. package/scripts/lean/native/prepare-golf-assets.py +0 -211
  112. package/scripts/lean/native/prepare-harvest-audio.mjs +0 -83
  113. package/scripts/lean/native/prepare-harvest-images.mjs +0 -31
  114. package/scripts/lean/native/prepare-primitive-images.py +0 -25
  115. package/scripts/lean/native/prepare-space-salvage-images.mjs +0 -89
  116. package/scripts/lean/native/prepare-traffic-assets.py +0 -329
  117. package/scripts/lean/native/presentation.mjs +0 -335
  118. package/scripts/lean/native/review-agent-tools.mjs +0 -561
  119. package/scripts/lean/native/review-connection.mjs +0 -303
  120. package/scripts/lean/native/review-fields.mjs +0 -24
  121. package/scripts/lean/native/review-intake.mjs +0 -385
  122. package/scripts/lean/native/review-intents.mjs +0 -217
  123. package/scripts/lean/native/review-provider.mjs +0 -580
  124. package/scripts/lean/native/review-receipts.mjs +0 -76
  125. package/scripts/lean/native/review-resolver.mjs +0 -429
  126. package/scripts/lean/native/review-targets.mjs +0 -35
  127. package/scripts/lean/native/runtime.mjs +0 -1623
  128. package/scripts/lean/native/salvage-recipe.mjs +0 -20
  129. package/scripts/lean/native/stage-3d.mjs +0 -818
  130. package/scripts/lean/native/verify.mjs +0 -4
  131. package/scripts/lean/scene-document.mjs +0 -48
@@ -1,379 +1,94 @@
1
- # Tora native authoring API
1
+ # Tora native authoring contract
2
2
 
3
- Native authoring creates an empty Creative Project 2.1 scene. The HTTP API and the
4
- local editor use the same `NativeService`, `ProjectStore`, `EditorState` commit
5
- lock, atomic history-pointer writer, validator, asset lowering, and compiler.
6
- Manual authoring and the supplied clients make zero model calls.
3
+ Tora 0.3 is a local, MCP-first authoring framework. External AI clients own reasoning, models, credentials, and execution. Tora provides deterministic native transactions, asset preparation, starters, scoped review candidates, QA, exports, and revision history. No Tora workflow calls a model provider.
7
4
 
8
- Run `npm run setup` to build the bounded PNG/JPEG decoder and optimizer entry points
9
- (`inspect_native` and `optimize_native`). Start `npm run dev:editor` and open
10
- <http://127.0.0.1:8001/?project=tiny-harvest-win-cta>. The default store is
11
- `.tora/native-projects`. `EDITOR_PORT`, `EDITOR_STORE`, and
12
- `EDITOR_PROJECT` override the defaults. The project URL opens its playable preview and review workspace.
5
+ Start the local editor with `npx @tora-editor/tora editor`, or `npm run dev:editor` from a source checkout. The default is `http://127.0.0.1:8001/?view=new`; projects live in `.tora/native-projects`. `EDITOR_PORT`, `EDITOR_STORE`, and `EDITOR_PROJECT` override source-checkout defaults.
13
6
 
14
- The supplied projects are unaccepted drafts with an example Google Play URL.
15
- Configure the intended store destination before creative approval or campaign use.
16
- Standalone export is not network qualification. The native compiler also supports
17
- `unity-ads-ua-playable`, `applovin-growth-playable`, `meta-audience-playable`,
18
- `google-ads-app-playable`, `ironsource-levelplay-playable`, `mintegral-appgrowth-zip`,
19
- and `tiktok-ads-playable`; their output is `ASSEMBLED_UNVERIFIED` until the exact HTML
20
- or ZIP passes static inspection. Official network preview and device acceptance remain
21
- separate gates. Unsupported network exports fail explicitly.
7
+ ## Native projects and transactions
22
8
 
23
- ## Asset sourcing
9
+ Projects remain Creative Project `2.1.0` documents. Scenes, components, variables, gameplay behaviors, events, event bindings, assets, variants, and revision identities use the existing serialized format. Do not rewrite stored projects when changing authoring clients.
24
10
 
25
- Studio intake retains authorized game assets with source hashes and a rights
26
- declaration. Sourced packs use free third-party artwork and audio with verified
27
- commercial-use licenses. Select one visual pack or style family for the whole
28
- playable. Audio may use a separate compatible pack. Record source URLs, authors,
29
- license identifiers and texts, attribution requirements, and original file hashes.
30
- Preserve downloaded source files through faithful asset preparation. Creating or
31
- generating replacement artwork and sound is outside this workflow.
11
+ Every edit is a `tora-transaction-1` envelope:
32
12
 
33
- `assets/free-assets/catalog.json` also exposes `audioCollections` for **Casual Warm**
34
- (`casual-warm`) and **Arcade Pop** (`arcade-pop`). Each maps `ambient`, `tap`,
35
- `match`, `reject`, `reward`, `win`, and `loss` to a distinct catalog cue ID. Ambient
36
- music comes from the retained CC0 Tarush Singhal and 3xBlast downloads; other cues
37
- retain their individual Kenney Interface Sounds or Music Jingles provenance rather
38
- than claiming to come from one archive. `audio-conversion.json` beside each family
39
- records source/output hashes and Web Audio conversion settings. Metadata is
40
- `auditionStatus:"analyzed"`: PCM measurements and licensing checks are complete,
41
- but human speaker/headphone audition and creative suitability remain separate.
42
-
43
- The BYOK creator uses the same validated transaction and media pipeline. Its three
44
- asset-source modes are enforced server-side: uploads only, uploads plus verified
45
- CC0, or verified CC0 only. The local catalog records dimensions/durations, style
46
- families, hashes, authors, source URLs, and license evidence. Live fetching is
47
- limited to HTTPS Kenney and CC0-filtered OpenGameArt sources, with public-DNS and
48
- redirect checks, streaming/ZIP limits, media normalization, and immutable cache
49
- receipts under `.tora/remote-asset-cache/`. Offline or unverifiable remote results
50
- fall back to local matches and are never staged as verified remote media. A build
51
- is capped at 12 model turns and four minutes, supports cancellation/retry, and
52
- persists progress in the intake's `build.json`. Provider use remains billable to
53
- the creator's connected key.
54
-
55
- ## HTTP boundary
56
-
57
- Mutations require the exact local Origin and Host, `Content-Type: application/json`,
58
- and a body no larger than 1 MiB, except project/intake asset uploads, which allow
59
- 12 MiB to carry an 8 MiB raw file in base64 JSON. IDs are local identifiers, never filesystem paths.
60
- Project IDs use lowercase letters, digits, and hyphens, start with a letter, and
61
- contain 2–48 characters. Object/record IDs permit lowercase letters, digits,
62
- underscores, dots, and hyphens, start with a letter, and contain at most 96 characters.
63
- `constructor`, `prototype`, and `__proto__` are reserved IDs; project ID `compose` is reserved for the legacy composer route.
64
-
65
- | Endpoint | Result |
66
- |---|---|
67
- | `POST /api/review/connection` | Local editor only. Accepts `{apiKey}`, checks it using the authenticated OrcaRouter model catalog, stores a valid key and returns `{configured:true}` |
68
- | `GET /api/projects/:id/review` | Feedback, candidate status, and configured feedback models |
69
- | `POST /api/projects/:id/review` | `action:"request"` saves notes with their expected revision and runs DeepSeek when configured. Set `paid:true` to opt that request into DeepSeek Pro. With the local `TORA_DETERMINISTIC_REVIEW=1` pilot, complete literal CTA commands and explicit typed outcome-cue controls instead use the same candidate service with zero provider calls. `action:"resolve"` resumes a saved request by ID. `action:"answer"` accepts `{requestId,answer}` for a clarification. Candidates await creator approval. |
70
- | `GET /api/creation/capabilities` | Registered visual/behavior contracts, typed defaults, constraints, units, operations, limits, conditions, and actual targets |
71
- | `POST /api/projects` | `{id,name,kind:"native-scene",androidUrl?}` → empty default scene and working revision |
72
- | `GET /api/projects` | Valid projects, kind, and native working revision |
73
- | `GET /api/projects/:id?revision=ID` | Chosen immutable revision, or the working head when the query is absent |
74
- | `POST /api/projects/:id/transactions/preview` | Validate a transaction; return its digest, affected records, dependencies, asset references, and warnings |
75
- | `POST /api/projects/:id/transactions` | Build and atomically commit the exact previewed transaction |
76
- | `POST /api/projects/:id/history` | `{expected:{revisionId,contentHash},action:"save"\|"undo"\|"redo"}` |
77
- | `POST /api/projects/:id/accept` | Explicit `{revisionId,contentHash}` approval; no automatic acceptance |
78
- | `POST /api/projects/:id/export` | Explicit `{revisionId,target}` for standalone or any of the seven network profiles → HTML and manifest, plus `archiveBase64`/`archiveFilename` for ZIP targets |
79
- | `POST /api/review-intakes/:id/submit` | `{}` or `{mode:"auto"\|"byok"\|"mcp"}`. A verified Gemini/OpenAI/Anthropic connection starts an asynchronous BYOK build; otherwise the existing `$0` MCP handoff is queued. |
80
- | `POST /api/review-intakes/:id/cancel` | `{}` aborts the active BYOK build and preserves its uploads and partial draft. |
81
- | `POST /api/review-intakes/:id/retry` | `{}` resumes a failed/cancelled BYOK build without re-uploading assets. |
82
- | `POST /api/projects/:id/assets` | `{expected,asset:{id,mime,data,rights,optimize?,preserveResolution?}}`; raw base64 up to 8 MiB, non-destructive optimization, real delivery decode validation, then one revision. A retained `sourceHash` may replace `data` when re-optimizing an existing asset |
83
- | `GET /api/projects/:id/assets/:assetId` | Asset hash, MIME, byte count, rights declaration, and provenance |
84
- | `GET /api/projects/:id/render?revision=ID` | Verified, lowered asset bytes and artifact identity for editor rendering |
85
-
86
- The review workspace uses the public project and revision endpoints directly.
87
-
88
- Successful transaction responses include `revisionId`, `contentHash`,
89
- `previousRevisionId`, artifact identity, actual effects, capabilities, and editor URL.
90
-
91
- Errors are JSON objects containing a stable `E_*` code, without stack traces or
92
- filesystem paths: 400 malformed input, 403 origin/protection failure, 404 missing
93
- project/revision/asset, 409 stale revision/preview or duplicate project, 413 limits,
94
- and 422 invalid references, contracts, resulting documents, or unsupported targets.
95
-
96
- ## Creative QA and review providers
97
-
98
- HTML export runs deterministic Creative QA before returning an artifact. It checks
99
- audio semantics/acoustics and pixel text statically, then reuses one Playwright
100
- browser across 320×568, 390×844, 768×1024, and 844×390 for layout and primary-input
101
- response within 150 ms. Blockers return `E_CREATIVE_QA` with a `tora-creative-qa-1`
102
- report; successful export manifests include QA evidence. Review candidates must pass
103
- the same gate before staging. MCP `tora_qa` runs it on demand and writes labeled PNGs.
104
- The CLI equivalent is:
105
-
106
- ```sh
107
- node scripts/lean/native/creative-qa.mjs path/to/index.html --output reports/creative-qa
108
- ```
109
-
110
- Opening and first-input states are covered by the integrated service. Generic
111
- end-card/timeout states require `--state-hook <globalFunction>` and are honestly
112
- reported as skipped or unavailable otherwise. This gate is not full-loop human
113
- playtesting, audio audition, device certification, or ad-network acceptance.
114
-
115
- OrcaRouter/DeepSeek remains the review default. `TORA_REVIEW_PROVIDER` also accepts
116
- `openai`, `anthropic`, `gemini`, and `openai-compatible`. Configure
117
- `TORA_REVIEW_MODEL` plus `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GEMINI_API_KEY`, or
118
- `TORA_REVIEW_API_KEY` respectively. `TORA_REVIEW_ENDPOINT` overrides the HTTPS URL
119
- (and is required for compatible endpoints); `TORA_REVIEW_PAID_MODEL` sets the paid
120
- route. Provider screenshots require explicit `TORA_REVIEW_VISION=1` and a suitable
121
- vision model. Otherwise they are omitted and counted in the textual request. No
122
- provider route bypasses typed edits, QA, candidate review, or explicit approval.
123
-
124
- ## Transaction example
125
-
126
- ```js
127
- const origin = 'http://127.0.0.1:8001';
128
- async function post(path, body) {
129
- const response = await fetch(origin + path, {
130
- method: 'POST', headers: {'Content-Type': 'application/json', Origin: origin},
131
- body: JSON.stringify(body),
132
- });
133
- const result = await response.json();
134
- if (!response.ok) throw Error(result.error);
135
- return result;
13
+ ```json
14
+ {
15
+ "format": "tora-transaction-1",
16
+ "expected": {"revisionId": "initial", "contentHash": "sha256:..."},
17
+ "operations": [
18
+ {"kind": "createComponent", "component": {
19
+ "id": "cta", "contract": "native.button.v1", "sceneId": "scene.play",
20
+ "transform": [1, 0, 0, 1, 80, 250], "parameters": {"width": 180, "height": 80}
21
+ }}
22
+ ]
136
23
  }
137
- const project = await post('/api/projects', {
138
- id: 'my-native-game', name: 'My native game', kind: 'native-scene',
139
- });
140
- const envelope = {
141
- format: 'tora-transaction-1',
142
- expected: {revisionId: project.revisionId, contentHash: project.contentHash},
143
- operations: [
144
- {kind: 'createComponent', component: {
145
- id: 'target', contract: 'native.button.v1', sceneId: 'scene.play',
146
- transform: [1, 0, 0, 1, 100, 250], parameters: {width: 180, height: 100},
147
- }},
148
- {kind: 'putVariable', variable: {
149
- id: 'score', label: 'Score', type: 'number', initial: 0,
150
- }},
151
- {kind: 'putEvent', event: {id: 'tap', kind: 'click', componentId: 'target'}},
152
- {kind: 'putBinding', binding: {
153
- id: 'award', eventId: 'tap', actions: [{kind: 'add', variableId: 'score', value: 1}],
154
- }},
155
- ],
156
- };
157
- const preview = await post('/api/projects/my-native-game/transactions/preview', envelope);
158
- // Review preview.effects, particularly dependency removals and shared references.
159
- const committed = await post('/api/projects/my-native-game/transactions', {
160
- ...envelope, previewDigest: preview.previewDigest,
161
- });
162
24
  ```
163
25
 
164
- The preview digest binds the base revision/hash, operation order, resulting
165
- content, and effects. Caller-supplied owner, protection, approval, or scope fields
166
- are rejected. Stale clients get a conflict rather than a silent rebase. The final
167
- candidate is validated and built before the locked head check and atomic publish.
168
- A failed operation or build leaves the previous revision and artifact usable.
169
-
170
- ## Document ownership
171
-
172
- The 2.1 schema is `packages/creative-project/project-v21.schema.json`. Structural
173
- TypeScript types and Rust schema identity are generated from the contract registry
174
- with `node scripts/m2/generate-project-v21.mjs`. `parseCreativeProject` recognizes
175
- both 2.0 and 2.1; the existing `parseProjectV2` entry point retains its 2.0 behavior.
176
- Rust `parse_project` recognizes both. The existing canonical content codec and hash
177
- domain are reused, with `revisionId` excluded from content identity.
26
+ Preview first, inspect actual changed records and dependency cascades, then commit the exact `previewDigest`. `scope` lists every intended changed record. `$project.base` authorizes project settings such as the Store URL and start scene. With `scopeCreates:true`, new records are allowed only when all their pre-existing component, behavior, event, binding, and variable references are also in scope. New assets and project settings are never implicitly authorized.
178
27
 
179
- Native documents have `base.kind="native-scene"`, runtime `tora-native/1.0.0`, and
180
- no Merge runtime spec or bundle reference. Components own their `sceneId`, optional
181
- `parentId`, numeric sibling `order`, local six-number affine `transform`, typed
182
- `parameters`, and asset slots. Scene membership and world transforms are derived.
183
- No editable scene tree is kept in extension data. Raster images are atomic leaves.
28
+ Operations cover scene creation/rename/deletion, component creation/rename/duplication/deletion, parameters, transforms, prototypes, ordering, reparenting, grouping, variables, behaviors, events, bindings, registered assets, asset replacement, start scene, and Store URL. Discover the exact operation and property vocabulary with `tora_capabilities`; do not rely on prose as the schema.
184
29
 
185
- `variables`, `gameplay`, `events`, and `eventBindings` are first-class collections.
186
- Bindings reference shared event sources by `eventId`, with typed conditions and
187
- ordered actions. `putBinding` also accepts an inline `event` as convenience input;
188
- the executor expands it to the stable ID `BINDING_ID.event`. The stored binding
189
- contains only the reference. Use explicit event IDs for long binding identifiers
190
- or intentionally shared sources.
30
+ Preview and commit use the same `NativeService`, validator, asset lowering, compiler, commit lock, and atomic history guards over MCP, HTTP, and the small CLI. A stale revision or digest fails without rebasing. Each commit is one undoable revision and does not itself grant creative approval.
191
31
 
192
- ## Operations and semantics
32
+ ## MCP authoring
193
33
 
194
- - Scenes: `createScene`, `renameScene`, `deleteScene`, `setStartScene`.
195
- - Objects: `createComponent`, `renameComponent`, `duplicateComponent`,
196
- `deleteComponent`, `setParameter`, `setTransform`, `setPrototype`,
197
- `reorderComponent`, `reparentComponent`, `group`, `ungroup`.
198
- - Gameplay: `putVariable`, `deleteVariable`, `putBehavior`, `deleteBehavior`,
199
- `putEvent`, `deleteEvent`, `putBinding`, `deleteBinding`.
200
- - Assets/store: `registerAsset`, `updateAsset` (replace the record for the same asset ID), `replaceAsset` (rewire a component), `setStore`.
34
+ Call `tora_brief` before authoring, then use `tora_capabilities({summary:true})` and scoped compact capability discovery. The 0.3 surface contains 20 tools:
201
35
 
202
- Read the capabilities response for the current contract/property vocabulary.
203
- Registered contracts are group, rectangle, ellipse, bounded vector path, image,
204
- sprite, walk sprite, text, and button. `native.sprite.v1` uses an image atlas in
205
- its `source` slot; `frameCount`, `frameColumns`, and `frameRate` select frames at
206
- runtime, while edit mode shows the first frame. `native.walk-sprite.v1` uses the
207
- same atlas properties, advances frames only when its world position changes, and
208
- returns to frame zero after movement stops. A text object can interpolate a
209
- declared variable as `{{score}}`.
210
- Buttons provide enabled/hover/pressed/disabled visual states and child visuals.
211
- Authors can set a button's optional `presentation` to `pixel-cta` for a beveled
212
- pixel face and a single reveal glint beneath its child label. Use the button's
213
- fill, hover fill, pressed fill, and stroke color to match the scene's palette.
36
+ - Discovery: `tora_brief`, `tora_capabilities`, `tora_inspect`, `tora_starters`.
37
+ - Projects: `tora_create`, `tora_compose_starter`, `tora_edit`, `tora_history`.
38
+ - Assets: `tora_list_assets`, `tora_fetch_cc0_pack`, `tora_stage_cc0_assets`, `tora_prep_assets`, `tora_upload_assets`.
39
+ - Delivery: `tora_render`, `tora_qa`, `tora_export`, `tora_variants`.
40
+ - External review: `tora_review_claim`, `tora_review_propose`, `tora_review_needs_scope`.
214
41
 
215
- `deleteComponent` takes `ids` and mode `subtree` or `retainChildren`. Ancestor and
216
- descendant selections are normalized. The preview lists dependency removals,
217
- including behaviors, event sources, and bindings. The reviewed digest is required
218
- for commit. Shared assets
219
- are retained. Deleting a variable still referenced by text requires an explicit
220
- text edit in the transaction; it cannot leave a dangling interpolation.
42
+ Use `tora_create` for an empty native project and `tora_edit` for generic scene authoring. The three starters are `stack-and-serve` (3D burger), `tap-targets` (2D racing), and `tap-targets-3d` (3D multi-target tap with `ui-anchor-3d`). `tora_starters` is also the source of browser card metadata. `deliver:true` writes the draft, editable bundle, and QA evidence.
221
43
 
222
- Reparenting accepts optional `parentId` and/or destination `sceneId`. It preserves
223
- the full world affine matrix, rejects singular destination transforms and cycles,
224
- and warns about changed inherited clipping, opacity, or lifecycle. Grouping uses
225
- the nearest common parent. Sibling order drives painting and reverse hit-testing.
226
- Duplication remaps subtree objects, behaviors, event sources, and bindings; external
227
- references remain external and are listed in the preview.
44
+ `tora_upload_assets` handles one or up to 32 assets; use a one-item batch for a single file. Prefer workspace `filePath` values to avoid MCP frame limits. PNG/JPEG/WAV/MP3 uploads accept up to 8 MB; workspace GLB/glTF/OBJ inputs accept up to 32 MiB. Delivery assets are bounded to 700,000 bytes and original masters and license evidence are retained. Use `tora_prep_assets` for mechanical image work and dependency-aware 3D preparation.
228
45
 
229
- Each transaction is one history entry. Save persists the shared working pointer;
230
- it does not approve content. Undo/redo move that pointer. Accepted snapshots remain
231
- immutable; subsequent edits produce new working revisions. Native history lives in
232
- the existing `.tora/editor-state` service, not a rescue-specific save directory.
46
+ `tora_inspect({id,tree:true})` returns a compact scene outline. `includeReview:true` adds compact pending review summaries. `tora_variants` manages locale and creative overlays. External clients supply translations through `upsert`; there is no automatic translation operation.
233
47
 
234
- ## Runtime and asset bounds
235
-
236
- | Resource | Limit |
237
- |---|---:|
238
- | Authored objects / scenes | 384 / 16 |
239
- | Behavior + binding records | 384 combined |
240
- | Event sources / variables | 256 / 64 |
241
- | Operations / transaction bytes | 256 / 1 MiB |
242
- | Authored document / parsed nodes / nesting | 4 MiB / 100,000 / 64 |
243
- | Spawned root instances / runtime nodes | 128 / 4,096 |
244
- | Particles / colliders / narrow-phase pairs per frame | 256 / 256 / 4,096 |
245
- | Physics bodies / adaptive substeps | 64 / 16 |
246
- | Path nodes / edges / agents per network document | 64 / 128 / 64 |
247
- | Processed events / actions per frame | 256 / 1,024 |
248
- | Raw image/audio upload / optimized delivery asset | 8,000,000 / 700,000 bytes |
249
- | Other individual assets (including Tora meshes) | 700,000 bytes |
250
-
251
- The simulation uses a 1/60-second fixed step and at most five catch-up steps per
252
- animation frame. Pause/visibility changes reset accumulated time. Replay resets
253
- runtime variables, instances, contacts, animations, particles, and audio without
254
- rewriting authored data. Instances have runtime IDs and refer back to authored
255
- prototype subtrees. They never enter authoring history.
256
-
257
- Behaviors implement axis/both-axis dragging, velocity/gravity, timers and authored
258
- spawn schedules, box/circle colliders, property animation, particle emitters, and
259
- audio. Colliders use the same world transforms and inherited visibility/clipping
260
- as rendering. Circle collision uses a bounded 32-sided approximation after affine
261
- transformation. Execution budgets terminate the offending chain and expose a
262
- runtime diagnostic.
263
-
264
- ### Physics, paths, economy, and camera primitives
265
-
266
- All packs remain additive Creative Project 2.1 JSON; authors never supply functions, property paths, or executable simulation code. Discover the exact descriptors through `/api/creation/capabilities`.
267
-
268
- - `physics-body`: `dynamic`, `static`, or `kinematic` circles/boxes with bounded restitution, rolling `friction`, `linearDamping`, `gravity`, speed/rest thresholds, optional `wallBounce`, and optional `spinToRotation`. Dynamic bodies use at most 16 adaptive substeps per fixed tick. Linear `motion` cannot share a component with a physics body.
269
- - `aim-launch`: pullback (`invert:true`) or direct aiming on the body or anywhere, bounded pull/speed ranges, rest gating, 3–16 trajectory dots with up to two predicted bounces, and optional numeric `powerVariableId`. It requires a dynamic `physics-body` on the same component. Release emits `launch`.
270
- - `capture-zone`: speed-gated radial capture with optional rim `pullStrength`, body stopping, and captured-object hiding. `oscillate` provides deterministic sinusoidal kinematic gates on x/y with analytical velocity.
271
- - `path-network`: attached to a group; contains 2–64 unique `{id,x,y,holdSeconds?,cost?}` nodes and 1–128 unique `{id,from,to,speedScale?,enabled?,bidirectional?,cost?}` edges. Routing is deterministic Dijkstra with lexical ID tie-breaking. `path-agent` selects network/start/target, speed and optional numeric speed multiplier, headway `spacing`, rounded corners, orientation, loop mode, and active state. `path-gate` provides open/closed/cycle control, phase offsets, and per-agent holds. Edge/gate edits replan live agents from their next node without teleporting.
272
- - `value-meter`: scales a visual on x/y from a numeric variable between `min < max`, in either direction with deterministic smoothing. `camera-follow` belongs on a root world group and follows a same-scene target within world bounds using bounded smoothing and zoom. Camera-world children may extend beyond the stage without a false stage-overflow finding.
273
-
274
- Physics events are `launch`, `bodyBounce`, `bodyRest`, and `zoneCapture`; path events are `pathArrive` and `pathBlocked`. They use `componentId`, optional `otherId`, or optional `nodeId` as described by the generated schema.
275
-
276
- New actions are `setVelocity`, `applyImpulse`, `setPosition`, `stopBody`, `setPathEdge`, `setPathTarget`, `setPathGate`, `spawnOnPath`, and `spawnAt`. `compute` applies `add | sub | mul | div | min | max | set` to a numeric variable using either `value` or `operandVariableId`, with optional integer `round`. Results must remain finite and within the runtime variable bound. Conditions accept either a literal `value` or `compareVariableId`, for example `{variableId:'cash',op:'gte',compareVariableId:'upgradeCost'}`.
277
-
278
- `spawnOnPath` requires a path-agent prototype and an existing network/start/target. `setPathEdge` takes the network behavior ID and optional non-negative `cost`; `setPathGate` takes the gate behavior ID. Runtime `state()` exposes read-only `physics` body/aim snapshots and `paths` network, route, active-agent, and queued-agent snapshots. Generic editor review supports `opening`, `first-input`, `end-card`, and `timeout` for the new genres while retaining the dedicated Harvest and Salvage replay paths.
279
-
280
- Use emitter shape `pixel-confetti` for stepped pieces with varied size, turn, and
281
- timing. Optional `color2` and `color3` add to the base `color`. Use
282
- `origin: "anchor"` for the component's local origin or omit it for the
283
- component's center. Set optional `direction` in degrees to aim the spread (up
284
- is -90 and left is -180). Confetti within a clipping group stays inside
285
- that group. The runtime honors reduced motion by suppressing pixel confetti and
286
- the CTA glint while retaining the static button treatment. Set pixel-confetti
287
- `coverage: "screen"` for a shower distributed across the canvas.
288
-
289
- Edit mode does not advance simulation or execute scene-entry actions. Inspection
290
- of another scene cannot unlock audio or invoke the store. Audio requires permitted
291
- interaction; store actions additionally require a current trusted interaction.
292
- Store opening requires a trusted pointer release over the original target.
293
- Store destinations are HTTPS Google Play/App Store URLs.
294
-
295
- Network exports bind the exact host adapter: Unity Ads requires MRAID 3.0, AppLovin
296
- requires MRAID 2.0, Meta calls `FbPlayableAd.onCTAClick()`, Google Ads calls
297
- `ExitApi.exit()`, ironSource uses DAPI, Mintegral uses its gameReady/gameStart/install
298
- lifecycle, and TikTok calls `openAppStore()`. Only the declared Google ExitApi and
299
- TikTok SDK script URLs are embedded; all other hosts are injected and no navigation
300
- fallback exists. Simulation starts only after host readiness, visibility, and the
301
- first trusted interaction. Hidden/closed hosts cancel input and suspend or stop audio.
302
- Only a deliberate CTA invokes the vendor store method. Network builds use the pinned
303
- `crates/packer/trusted/native.js` or `native-3d.js` bundle and fail if it is stale.
304
- Google/Mintegral/TikTok produce deterministic ZIPs with fixed timestamps, sorted paths,
305
- CRC32 checks, and exact profile-specific layouts.
306
-
307
- Check the exact exported `index.html` before review:
308
-
309
- ```sh
310
- cargo run -p playable-cli -- artifact check index.html \
311
- --network unity-ads-ua-playable --confirm-reviewed 2026-11-20 --json
312
- cargo run -p playable-cli -- artifact check index.html \
313
- --network applovin-growth-playable --confirm-reviewed 2026-11-24 --json
314
- cargo run -p playable-cli -- artifact check my-game-tiktok.zip \
315
- --network tiktok-ads-playable --confirm-reviewed 2026-11-26 --json
316
- ```
48
+ ## HTTP boundary
317
49
 
318
- Use each profile's current `reviewedAt` date for confirmation. Mintegral requires
319
- `project-id.zip` containing `project-id/project-id.html`; TikTok ZIPs contain root
320
- `index.html` and `config.json`; Google ZIPs contain root `index.html`.
50
+ Mutations require the exact local Origin and Host, `Content-Type: application/json`, and the documented body limits. Project IDs use 2–48 lowercase letters, digits, and hyphens and start with a letter. Record IDs permit lowercase letters, digits, underscores, dots, and hyphens, start with a letter, and are at most 96 characters.
321
51
 
322
- `STATIC_PASS` covers the reviewed rules, fixed shell/runtime, schema, inline assets,
323
- hashes, size, responsive orientation, and destination. It does not establish human
324
- creative approval, physical-device behavior, official network acceptance, or campaign
325
- effectiveness.
52
+ | Endpoint | Behavior |
53
+ |---|---|
54
+ | `GET /api/creation/capabilities` | Canonical contracts, operations, limits, and network targets |
55
+ | `GET/POST /api/projects` | List or create empty native projects |
56
+ | `POST /api/projects/import` | Import an editable `.tora.json` bundle |
57
+ | `GET /api/starters`, `POST /api/starters/compose` | Discover or instantiate the two starters |
58
+ | `GET /api/demos`, `POST /api/demos/open` | List available showcases or import their preserved native fixture |
59
+ | `GET /api/projects/:id` | Read the working or requested immutable revision; `tree=1` returns an outline |
60
+ | `POST /api/projects/:id/transactions/preview` | Validate operations and return effects and digest |
61
+ | `POST /api/projects/:id/transactions` | Commit the exact preview atomically |
62
+ | `POST /api/projects/:id/history` | Save, undo, or redo against the expected identity |
63
+ | `POST /api/projects/:id/accept` | Explicitly approve a revision |
64
+ | `POST /api/projects/:id/assets` | Upload one asset or `{assets:[...]}` in one revision |
65
+ | `GET /api/assets/catalog`, `POST /api/assets/fetch-cc0`, `POST /api/assets/prep` | Discover, fetch, and prepare verified assets |
66
+ | `POST /api/projects/:id/stage-cc0` | Stage verified CC0 assets atomically |
67
+ | `GET/POST /api/projects/:id/variants` | List, materialize, upsert, delete, or preset variants |
68
+ | `POST /api/projects/:id/export` | Export standalone or one of seven network profiles |
69
+ | `POST /api/projects/:id/export-matrix` | Start a pinned target/variant matrix; poll its job URL |
70
+ | `POST /api/projects/:id/qa` | Run Creative QA on a revision |
71
+ | `GET /api/projects/:id/render` | Lower assets and return preview identity |
72
+ | `GET/POST /api/projects/:id/review` | Create/read scoped requests and candidates, promote, or discard |
326
73
 
327
- PNG/JPEG uploads use a separate bounded Rust optimizer that accepts benign color
328
- metadata and normalizes uploaded pixels without weakening strict artifact inspection.
329
- Auto mode searches exact PNG encodings, selects JPEG for suitable opaque photo-like
330
- images, quantizes when needed, and uses bounded proportional downscaling only to meet
331
- limits. Lossless mode never quantizes or resizes; `none` retains exact bytes only when
332
- they already fit delivery constraints. WAV/MP3 optimization uses local GStreamer or
333
- FFmpeg when available and otherwise falls back to deterministic PCM WAV downsampling.
334
- SVG/HTML uploads are rejected. Decode staging is removed on failure. Untouched original
335
- uploads are content-addressed under `sources/assets/originals/`; delivery bytes and
336
- optimization receipts live under `sources/assets/`. Authored asset records retain the
337
- same six schema fields, rights, and provenance. Preview and export lower the same
338
- verified delivery bytes. Object deletion does
339
- not remove shared source assets. No automatic unreferenced-asset cleanup runs.
74
+ Removed provider, intake, free-pack/chat composition, automatic translation, and legacy composition routes return the normal unknown-route response. Store changes use ordinary native transactions.
340
75
 
341
- ## Reproduce and verify
76
+ ## Scoped external review
342
77
 
343
- Use new IDs when reproducing; existing projects are never overwritten:
78
+ A new request uses journal format `tora-review-journal-2` and contains a request UUID, exact baseline, and one to eight notes. Each note has its own UUID, text, optional captured JPEG frame and scene/moment context, explicit record scopes, and `allowCreates`. General notes must choose a scope. `$project.base` explicitly authorizes project settings.
344
79
 
345
- ```sh
346
- node scripts/lean/native/author-games.mjs http://127.0.0.1:8001 rescue-copy rescue reports/rescue-copy
347
- node scripts/lean/native/author-games.mjs http://127.0.0.1:8001 tap-copy tap reports/tap-copy
348
- npm run test:native
349
- ```
80
+ The external client calls `tora_review_claim`, inspects the baseline, then calls `tora_review_propose` with native `operations`, a proposal UUID, summary, and every note UUID in `addressedNoteIds`. It does not submit a scope; effective authorization comes only from the stored request. Use `tora_review_needs_scope` when broader authorization is required.
350
81
 
351
- The client reads capabilities, creates an empty project, uploads sourced audio with verified license evidence,
352
- authors all objects and gameplay through transactions, and exports the identified
353
- revision. It writes downloaded HTML/manifests only. It never edits project storage,
354
- injects scripts, or modifies compiled HTML.
82
+ Tora previews the operations, enforces scope against the actual diff including cascades and deletions, builds an isolated candidate, and runs standalone-browser QA. The working revision does not move. Proposals may reference registered project assets but cannot ingest asset bytes. Failed QA remains diagnostic and cannot be promoted. Duplicate proposal UUIDs are idempotent only for identical payloads.
355
83
 
356
- Packaged-game evidence in `docs/evidence/native-authoring` covers offline
357
- playback of both exported concepts, win and loss, replay, and trusted CTA activation.
358
- Native tests also cover transaction conflicts, execution budgets and asset rejection. Browser and agent
359
- visual checks do not constitute human creative approval, physical-device testing,
360
- official network acceptance, or advertising-effectiveness evidence.
84
+ The browser presents baseline/candidate previews and accept/discard controls. Acceptance rechecks baseline and digest and commits one undoable revision. Stale or failed candidates cannot be promoted. Previous review journals remain read-only history; create a fresh scoped request to reuse their notes.
361
85
 
362
- ## Verification dependencies
86
+ ## QA, exports, and saved content
363
87
 
364
- `npm run verify:native` checks only the native SaaS stack, including the Creative QA
365
- unit gate, trusted runtime parity, native browser tests, and the relevant Rust crates.
366
- Native composition and native browser tests use the native asset decoder and optimizer.
88
+ Creative QA checks static audio/text rules and exercises 320×568, 390×844, 768×1024, and 844×390 layouts and primary input. Review candidates use standalone-browser QA; network acceptance remains an export concern. `tora_qa` can also capture motion filmstrips and optional WebM footage. Inspect real full-size screenshots and playback, not only contact sheets.
367
89
 
368
- ## Legacy compatibility
90
+ The seven network targets are Unity Ads, AppLovin, Meta, Google Ads, ironSource/LevelPlay, Mintegral, and TikTok. Network exports run Creative QA and independent Rust artifact inspection on the exact delivered bytes. Google, Mintegral, and TikTok use deterministic ZIPs. `fitTargetBudget:true` re-optimizes from retained masters without changing the stored revision. `confirmReviewed` is forwarded only when explicitly supplied.
369
91
 
370
- `POST /api/projects` with `kind:"legacy-template"` explicitly selects the existing
371
- legacy initializer. `/api/projects/compose` retains its merge-grid creative-plan
372
- vocabulary, expected `revision/contentDigest`, and existing request bounds. It does
373
- not compose native mechanics. Existing 2.0 projects are not migrated on open.
92
+ Showcase demos import preserved editable native fixtures from `source/showcase`; large fixtures and asset packs are excluded from the lean package and unavailable demos stay hidden. Existing saved projects, legacy gameplay behaviors, specialized QA playthroughs, and supported variant overlays remain intact. The Rust verifier remains an independent offline check even where JS has equivalent validation.
374
93
 
375
- Legacy shared artwork definitions are separated from their visual instances for
376
- parenting/deletion and preview restoration. The fixed Ding & Dang runtime, model,
377
- compiler, workspace, bridge, fixtures, tests, obsolete saves, and generated outputs
378
- were removed using the explicit inventory in
379
- `reports/native-production/retirement-inventory.json`. No archive was created.
94
+ Engineering verification, AI visual inspection, human approval, physical-device testing, and official ad-network acceptance are separate statuses.
@@ -5,18 +5,19 @@ Native projects are editable Creative Project `2.1.0` documents running on `tora
5
5
  ## Required workflow
6
6
 
7
7
  1. Read the production, playable, win/CTA, and UI briefs returned with this guide. They remain authoritative.
8
- 2. Discover exact contracts before editing. Use `tora_capabilities({packs:[...]})` or BYOK `discover_contracts({packs:[...]})` for only the mechanics you need. Use `tora_brief({packs:[...]})` for the matching guides. `full:true` returns the complete legacy authoring references.
8
+ 2. Discover exact contracts before editing. Use `tora_capabilities({packs:[...]})` for only the mechanics you need. Use `tora_brief({packs:[...]})` for the matching guides. `full:true` returns the complete authoring reference.
9
9
  3. Create or inspect a project and retain its exact `{revisionId,contentHash}`. Build edits as `tora-transaction-1` operations. Preview them, review effects and dependency removals, list every intended changed record in `scope`, then commit the exact preview digest. Reinspect stale revisions rather than replaying edits.
10
- 4. Use sourced assets with verified commercial-use rights. Keep one visual style family per playable; audio may use a separate compatible family. Preserve source URLs, authors, licenses, original paths, and hashes. Upload through the asset operation or BYOK `stage_assets`.
10
+ 4. Use sourced assets with verified commercial-use rights. Keep one visual style family per playable; audio may use a separate compatible family. Preserve source URLs, authors, licenses, original paths, and hashes. Upload through the asset operation.
11
11
  5. Render, run Creative QA, export, and inspect actual packaged screenshots and motion. Automated QA is not human visual approval, device testing, campaign-effectiveness evidence, or official network acceptance.
12
12
 
13
13
  ## Transaction and delivery essentials
14
14
 
15
15
  - Native documents contain scenes, components, variables, gameplay behaviors, shared event sources, ordered event bindings, assets, and a store destination. Component transforms are local affine matrices; scene membership and world transforms are derived.
16
16
  - Preview and commit enforce exact revision identity. Deleting shared records can remove dependent records; inspect `preview.effects` before commit.
17
- - Creative QA checks static audio/text rules and exercises opening and primary input at `320×568`, `390×844`, `768×1024`, and `844×390`, with a 150 ms primary-response limit. End-card and timeout coverage requires an available state hook.
17
+ - Creative QA checks static audio/text rules and exercises opening and primary input at `320×568`, `390×844`, `768×1024`, and `844×390`, with a 150 ms primary-response limit. It follows normal inputs to declared end cards, checks the Store CTA in a mock host, and exercises declared timeouts from a fresh load. A manually selected scene or state hook provides layout evidence only.
18
18
  - Standalone HTML is a draft. Unity Ads and AppLovin exports use host-injected MRAID and the pinned trusted runtime. Run `playable-cli artifact check` on each exact exported file; static success is not official network acceptance.
19
19
  - Configure a real HTTPS Google Play or App Store destination before campaign use. Only a deliberate trusted CTA release may open the store. Audio starts muted until permitted interaction.
20
+ - Set optional `delaySeconds` (0–10 seconds) on `changeScene` to start a reveal delay from the event that executes it. The first delayed change in a scene stays scheduled through repeated input and is cleared by leaving the scene or restarting. Use a separate deadline timer for timeout.
20
21
  - Replay resets runtime state without rewriting authored data. Runtime instances never enter authoring history.
21
22
 
22
23
  ## Domain pack index
@@ -33,6 +34,12 @@ Native projects are editable Creative Project `2.1.0` documents running on `tora
33
34
 
34
35
  Pack guides are intentionally concise. Exact property descriptors, bounds, defaults, operations, limits, conditions, variable types, and targets come from the capability registry rather than prose examples.
35
36
 
37
+ ## Preserved Crop Sort projects
38
+
39
+ Existing Crop Sort projects remain editable native documents. Each crop has a `drag` tag, its matching crate has a one-capacity `drop-zone` with `acceptTags` and `onOccupied:"reject"`, correct drops snap and score through `dragDrop`, and rejected drops use `returnToOrigin`. Idle drag guidance, responsive layouts, licensed audio, win and timeout scenes, and Store CTAs are preserved in `source/fixtures/crop-sort.tora.json`.
40
+
41
+ The sorting compatibility adapter supplies overlay-compatible `shorter-hook`, `easier-win`, and `high-contrast-cta` variant pieces. The easier preset changes the timer, initial time, and meter range together. QA plays all three real pointer drags and prepares timeout with a real rejected drag. Production editing and review use generic native operations rather than concept builders or game-specific review fields.
42
+
36
43
  ## Core authoring limits and safety
37
44
 
38
45
  Discover current numeric limits programmatically. Runtime execution budgets are fixed independently of authored collection caps. Large event/action chains terminate with diagnostics rather than running unbounded. Component, variable, behavior, event, asset, scene, path, and store references must resolve and have compatible types.
@@ -0,0 +1,20 @@
1
+ # Start an editable Tora playable
2
+
3
+ Call `tora_brief`, then `tora_starters` to see the play styles. For a simple cooking brief, one call builds a complete editable draft with licensed burger models and audio, a win reveal, a timeout, and a Store CTA.
4
+
5
+ ```json
6
+ {
7
+ "id": "burger-order",
8
+ "starter": "stack-and-serve",
9
+ "name": "Burger Order",
10
+ "deliver": true
11
+ }
12
+ ```
13
+
14
+ Pass that object to `tora_compose_starter`. For a 2D tap-and-collect challenge, use `tap-targets` to start with four toy race cars arriving in different pit boxes. For a 3D direct-tap playable with multiple tappable 3D objects, projected `ui-anchor-3d` touch rings, and portrait/landscape camera framing, use `tap-targets-3d` (`art` roles `target1`–`target4` accept any valid CC0 GLB models, normalized automatically onto the counter). Choose a fresh ID for each project.
15
+
16
+ The starter can use a different palette (`background`, `surface`, `ink`, `accent` as six-digit hex colors), win or timeout title, or CTA label. Pass `durationSeconds` from 10 to 60 and `winHoldSeconds` from 0.25 to 3 to tune the timing. The win hold begins when the last goal is completed. Titles and CTA labels are up to three words and 24 characters. Headline and button text require a contrast ratio of at least 4.5:1 against their respective backgrounds.
17
+
18
+ The `art` and `audio` options accept asset IDs from Tora's verified CC0 local catalog or remote cache. Keep art in a single style family. The burger model must have the named nodes `bun-bottom`, `patty`, `cheese`, `salad`, `tomato`, and `bun-top`. The audio roles are `music`, `step`, `win`, and `loss`. Add the real Store URL via `androidUrl` when supplied with the brief.
19
+
20
+ With `deliver: true`, Tora saves the HTML, editable project bundle, and packaged QA evidence together in a new folder named after the project with a `-draft` suffix. Open the draft and review its gameplay, sound, and end cards. If you make further edits, run `tora_qa` with `recordVideo: true` and use `tora_export` to update your deliverables.
@@ -1,11 +1,19 @@
1
1
  # 3D pack
2
2
 
3
- `native.stage3d.v1` defines the WebGL stage, lighting, camera, and optional follow target. `native.mesh3d.v1` declares bounded primitive or retained mesh geometry, transforms, color/texture use, lighting flags, and presentation options. Use the exact capability descriptors: some retained fields are specific to existing golf content.
3
+ `native.stage3d.v1` defines the WebGL stage, lighting, tone mapping (`none` | `neutral` | `aces`), shadows (`shadowsEnabled`, `shadowMapSize`), studio environment reflections (`envIntensity`), `renderMaxDim`, camera, and optional follow target. `native.mesh3d.v1` declares bounded primitive, retained `model/tora-mesh`, or canonical glTF 2.0 binary (`model/gltf-binary`, `primitive: 'model'`) geometry, transforms, material presentation, and lighting flags. Use the exact capability descriptors: some retained fields are specific to existing golf content.
4
+
5
+ For verified CC0 3D sourcing, use `tora_list_assets({kind:'mesh',includeRemote:true,query})`, then `tora_fetch_cc0_pack` with optional `fileFilter`/`fileFilters` and 3D preparation options, then `tora_stage_cc0_assets`. Kenney, Quaternius, and OpenGameArt are the only remote origins. Archive licenses are resolved by nearest ancestor directory for every model and dependency; prepared variants have distinct stageable IDs and retained masters. Quaternius discovery is supported, but packs that only link to an external drive return manual-download guidance for `tora_prep_assets` / `tora_upload_assets` instead of bypassing the origin allowlist.
6
+
7
+ For general 3D assets (`model/gltf-binary`), author multi-part textured `.obj`+`.mtl` or `.gltf`+`.bin` bundles through `tora_prep_assets` (`playable assets prep-3d`) to normalize units/pivots, preserve named nodes, emit a lossless `.master.glb`, and retain a dependency manifest, or upload standalone `.glb`/`.gltf`/`.obj` files up to 32 MiB via `filePath`. Pass optional `targetTriangles` for attribute-preserving QEM polygon reduction (auto-optimization also steps down geometry when needed for tight budgets). Set `primitive: 'model'` with `assetSlots: [{slotId: 'source', assetId}]` (and optional `texture`, `normalMap`, `emissiveMap` override slots), optional `subNode` to instantiate a preserved named part from a shared kit, `pivotMode` (`origin` | `center` | `bottom-center`), `normalizeSize`, `materialMode` (`asset` | `lambert` | `standard` | `unlit`), `overrideMaterialName`, `tintColor`, `roughnessScale`, `metalnessScale`, and `castShadow`/`receiveShadow`. For rigged/animated GLB models (up to 4 skins / 64 joints per skin, 16 `LINEAR`/`STEP` animation clips), attach `animate-3d` (`clipName`, `loop: 'repeat' | 'once' | 'pingpong'`, `speed`, `autoplay`, `fadeSeconds`), trigger clip transitions with `playModelAnimation`, and listen for `modelAnimationEnd`. Set `fitColliderFromModel: true` on `physics-3d` to auto-fit `radius`/`hx`/`hz` from the rendered model bounds. Pass `useOriginal: true` on re-upload to restore or re-optimize from the revision's retained master, and opt in to `fitTargetBudget: true` on `tora_export` / `tora_qa` to fit oversized projects to tight targets (such as Meta 2 MB) while verifying Creative QA against the exact delivered artifact hash.
4
8
 
5
9
  `physics-3d` supplies bounded dynamic/static/kinematic movement. `aim-launch-3d` handles pullback or direct launch and trajectory display. `capture-zone-3d` performs speed/height-gated capture, and `oscillate-3d` moves a component sinusoidally. These are separate from 2D canvas physics and cannot be assumed interchangeable.
6
10
 
7
- For first-person 3D shooters and turret/arena games, attach `fps-controller-3d` to a `native.stage3d.v1`. Bind a `virtual-joystick` to `aimJoystickBehaviorId` to steer camera yaw/pitch aiming directly: `aimMode: 'delta'` (default) provides direct 1:1 thumb/mouse aiming (like Sniper 3D / COD Mobile — aim rotates only while moving and stops immediately when held still, using `lookSensitivity`), while `aimMode: 'rate'` pans continuously at `aimTurnSpeed` rad/s. Use `minYaw`/`maxYaw` and `minPitch`/`maxPitch` to bound the firing arc, `moveSpeed: 0` for a fixed-position turret/sniper shooter, or bind `joystickBehaviorId` (or `moveXVariableId`/`moveYVariableId`) for camera-relative movement with OBB wall-sliding against static `physics-3d` boxes; `lookMode: 'drag'` also supports multi-touch drag-to-look. Set `attachToCamera: true` on `native.mesh3d.v1` nodes for first-person viewmodels. Use `spawnAt3d` to instantiate `mesh3d` prototypes, `steer-3d` for enemy pursuit/strafe/patrol facing the player, and `raycast3d` (`mode: 'crosshair' | 'pointer'`, optional `targetTeam`) to fire hitscan shots that emit `raycastHit3d` (integrating with `instance-state` / `modifyInstanceState` / `instanceDepleted` / `despawn`) or `raycastMiss3d`, while static `physics-3d` walls occlude shots.
11
+ To attach 2D UI rings, labels, callouts, or touch buttons directly to 3D objects without manual portrait/landscape coordinates, attach `ui-anchor-3d` to a 2D component (`button`, `group`, `text`, `ellipse`, `rectangle`, `image`) with `targetId` pointing to a `native.mesh3d.v1` in the same scene. `ui-anchor-3d` projects the target's world-space 3D `Box3` across portrait and landscape cameras (including boxed and full-bleed stages, nested `mesh3d` hierarchies, and moving 3D objects) before painting 2D layers. Set `anchor` (`center` | `top` | `bottom`) and optional `offsetX`/`offsetY` for callout placement; set `fitToProjectedBounds: true` (with `paddingPx`, `minSizePx` defaulting to `48`, `maxSizePx`, and optional `squareBounds: true`) to derive touch target dimensions directly from the projected 3D bounds; set `showHighlight: true` (`highlightStyle: 'pulse-ring' | 'ring' | 'box'`, `highlightColor`) to draw a projected highlight directly around the 3D object; and keep `syncVisibility: true` so hiding the 3D mesh automatically hides its 2D overlay. Do not combine `ui-anchor-3d` with `responsive-layout`, `drag`, or `motion` on the same component. Creative QA automatically audits `ui-anchor-3d` across all four viewports for off-screen/clipped 3D targets (`anchor-3d-target-offscreen`), misaligned overlays (`anchor-3d-misaligned`), and foreground 3D mesh occlusion (`anchor-3d-occluded`), and reports compact projected bounds in `checks.browser.anchors3d`.
12
+
13
+ For a landing or impact, place a mesh origin at the contact point and attach an `emitter` with `origin: 'contact-3d'`, `coverage: 'local'`, and `shape: 'circle'` for crumbs or `shape: 'confetti'` for tumbling pieces. An invisible mesh can supply the point when the visible asset's pivot is elsewhere. Trigger `emit` when the pieces touch. The burst follows the 3D camera and respects depth and reduced motion. Speed and gravity use 100 authored units per world unit. Start with 12 particles, `speed: 145`, `gravity: 300`, `lifetime: 0.45`, and colors drawn from the artwork. Reserve screen-wide confetti for the outcome.
14
+
15
+ For first-person 3D shooters and turret/arena games, attach `fps-controller-3d` to a `native.stage3d.v1`. Bind a `virtual-joystick` to `aimJoystickBehaviorId` to steer camera yaw/pitch aiming directly: `aimMode: 'delta'` (default) provides direct 1:1 thumb/mouse aiming (like Sniper 3D / COD Mobile — aim rotates only while moving and stops immediately when held still, using `lookSensitivity`), while `aimMode: 'rate'` pans continuously at `aimTurnSpeed` rad/s. Use `minYaw`/`maxYaw` and `minPitch`/`maxPitch` to bound the firing arc, `moveSpeed: 0` for a fixed-position turret/sniper shooter, or bind `joystickBehaviorId` (or `moveXVariableId`/`moveYVariableId`) for camera-relative movement with OBB wall-sliding against static `physics-3d` boxes; `lookMode: 'drag'` also supports multi-touch drag-to-look. Set `attachToCamera: true` on `native.mesh3d.v1` nodes for first-person viewmodels. Use `spawnAt3d` to instantiate `mesh3d` prototypes — pass `fromComponentId` or `fromTeam` with local yaw-rotated `offsetX`/`offsetY`/`offsetZ` so projectiles emerge directly from a living, visible 3D actor's actual weapon muzzle (and never fire from dead/hidden actors or random world coordinates), `steer-3d` for enemy pursuit/strafe/patrol or 3D homing projectiles (`stopDistance <= 0.5`), and `raycast3d` (`mode: 'crosshair' | 'pointer'`, optional `targetTeam`) to fire hitscan shots that emit `raycastHit3d` (integrating with `instance-state` / `modifyInstanceState` / `instanceDepleted` / `despawn`) or `raycastMiss3d`, while static `physics-3d` walls occlude shots.
8
16
 
9
- 3D rendering uses the separately pinned trusted `native-3d` bundle and WebGL2. It is not a general rigged-skeletal, custom-shader, embedded-video, or unrestricted mesh pipeline. Keep geometry and effects bounded for mobile ad WebViews.
17
+ 3D rendering uses the separately pinned trusted `native-3d` bundle and WebGL2 with a strict glTF 2.0 binary profile (`KHR_mesh_quantization`, `KHR_materials_unlit`, `KHR_texture_transform`, `KHR_materials_emissive_strength`) decoded synchronously without `fetch`, `blob:`, `Worker`, or `WebAssembly`. Skeletal support is bounded to at most 4 skins, 64 joints per skin, and 16 `LINEAR`/`STEP` clips; custom shaders, embedded video, and unrestricted meshes are outside the profile. Keep geometry and effects bounded for mobile ad WebViews.
10
18
 
11
19
  Verify actual WebGL output in every aspect ratio, including reduced motion, muted play, host suspend/resume, and fallback behavior. Inspect depth, silhouettes, camera framing, shadows, launch feedback, capture celebration, and Store CTA in packaged screenshots and footage. Static compilation does not establish rendering performance or device acceptance.