TiGa-RCE commited on
Commit
ed1475b
·
verified ·
1 Parent(s): 66e5842

Beta r2: traceable run receipts and focused UI fixes

Browse files
Files changed (11) hide show
  1. BETA_TESTING.md +17 -0
  2. FEEDBACK.md +24 -0
  3. FRONTEND_SOURCE.json +3 -3
  4. RELEASE_MANIFEST.json +10 -8
  5. app.py +2 -1
  6. build_info.py +20 -0
  7. client.js +31 -15
  8. index.html +10 -9
  9. server.py +4 -1
  10. training_config.py +1 -1
  11. worker.py +2 -1
BETA_TESTING.md CHANGED
@@ -75,3 +75,20 @@ expected/actual behavior and a redacted screenshot or receipt. Do not attach a
75
  private trained network, a proprietary game-extracted track, tokens, job access
76
  keys, or full unrelated logs to an ordinary bug report. Use public/generated
77
  fixtures or describe the network shape and sensor/output contract.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  private trained network, a proprietary game-extracted track, tokens, job access
76
  keys, or full unrelated logs to an ordinary bug report. Use public/generated
77
  fixtures or describe the network shape and sensor/output contract.
78
+
79
+ ## Local 2026-10-13 candidate (not deployed)
80
+
81
+ Content-addressed build IDs now appear in capabilities and exported run/batch receipts;
82
+ reports include upstream simulator revision and packaged binary SHA-256 values.
83
+ A single run has its own receipt export. `/feedback` supplies a private-feedback
84
+ template; no public issue destination or invitation is activated.
85
+
86
+ The native train-scratch adapter requires positive mutation even when continuing an
87
+ uploaded network. The form and server now reject zero before native dispatch.
88
+ Any GPU dispatch error attempts to discard its pending ticket; a missing ticket
89
+ is not evidence that an already dispatched run stopped.
90
+
91
+ This candidate requires an explicitly approved deployment followed by hosted
92
+ CPU/GPU and real-account checks before tester invitations. Local checks and
93
+ training experiments against the previous live build are recorded outside this
94
+ package in the sibling sprint receipt. They do not qualify this candidate as deployed.
FEEDBACK.md ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Supervised beta feedback draft
2
+
3
+ This form is a local template. It does not submit a message or upload files.
4
+ Share a completed copy with the person who invited you, using the agreed private channel.
5
+ A public issue destination has not been activated for this candidate.
6
+
7
+ - App URL:
8
+ - Build ID (from an exported run or batch receipt):
9
+ - Browser and version:
10
+ - Operating system:
11
+ - CPU or GPU:
12
+ - Track name, network shape, and sensor/output types:
13
+ - Exact steps to reproduce:
14
+ - Expected behavior:
15
+ - Observed behavior:
16
+ - Did a retry work? Did the page confirm server-copy deletion?
17
+
18
+ Attach the exported receipt only after reviewing it. It contains settings, file hashes,
19
+ metrics, and build identity; no network weights or job access keys. Batch receipts also
20
+ contain your recipe and batch names. Redact those names if they are private.
21
+ Do not attach tokens, job keys, private networks, proprietary tracks, or unrelated logs.
22
+ A cropped screenshot and a generated example are usually sufficient.
23
+
24
+ For a GPU rejection, include the visible error and cleanup message; never paste a token.
FRONTEND_SOURCE.json CHANGED
@@ -1,10 +1,10 @@
1
  {
2
  "source": "Runner r14 single-engine browser UI; selected .track tile renderer added from simulator atlas",
3
  "source_sha256": "65d1e5f2c4e19b4951b828e82510005ab99a5270cf3dcb9f4eaa0fa1af8c40f8",
4
- "output_sha256": "dea8ee713484a551421883599af8ffbcd91cab7a31087699e6711c5bd1fc5412",
5
  "scope": "Frontend only; no engine, private data, track assets, API calls or storage copied",
6
- "status": "Hosted single-engine UI audited; star evaluation remains unconnected",
7
  "track_atlas_sha256": "d97c8900e3e5fb17734b5bd61d1f4f4b196d9be30af9848e2e273ae7e4079ae4",
8
- "client_sha256": "ee070dcb67d62c9ee7905ecdd744192a7b35f0925c17f7235c7b50fe5ca463ca",
9
  "track_map_sha256": "ab5374aa49c7ccec90a787ee8c56cd71beb56b903bf2bbc322783e6f43c009f0"
10
  }
 
1
  {
2
  "source": "Runner r14 single-engine browser UI; selected .track tile renderer added from simulator atlas",
3
  "source_sha256": "65d1e5f2c4e19b4951b828e82510005ab99a5270cf3dcb9f4eaa0fa1af8c40f8",
4
+ "output_sha256": "315058a08c31ec512108473904f559087080edb684c02f4d594cbe5032c77791",
5
  "scope": "Frontend only; no engine, private data, track assets, API calls or storage copied",
6
+ "status": "Local beta sprint candidate; not deployed",
7
  "track_atlas_sha256": "d97c8900e3e5fb17734b5bd61d1f4f4b196d9be30af9848e2e273ae7e4079ae4",
8
+ "client_sha256": "cc18e5ce4405ccc7cecc3ab6cc6d7b2abddcc6cfac69f47825c546b8d7c1bcf1",
9
  "track_map_sha256": "ab5374aa49c7ccec90a787ee8c56cd71beb56b903bf2bbc322783e6f43c009f0"
10
  }
RELEASE_MANIFEST.json CHANGED
@@ -2,10 +2,11 @@
2
  "backend": "cpu+zerogpu",
3
  "files": {
4
  ".gitattributes": "c2ad16718fc51c888d32efc88c8f6e23ebe5fcf6f48e2954f896ba9770f24d72",
5
- "BETA_TESTING.md": "4868acab039a805b659c3830ebf96bc9427c6d3b5d2a911ff00e22762483ea22",
6
  "BINARY_PROVENANCE.json": "1116e1757afc6c8629cb2d957e3d77380fe4f7e3186c3832d16a5a08abce6aa8",
7
  "DATA_POLICY.md": "0daf1b835bf829c0974e6b566cb5a605c6f52dba4517cfd54bed044e8eaf4264",
8
- "FRONTEND_SOURCE.json": "4c82ae314b7fafe7cca76f4f0f0c2d80a4a5d46d6b761bd2c908c512de1a178e",
 
9
  "GODOT_LICENSE": "fb2b3bb82c60f1e76841ba2122eb902f8e39c151476fe21ce10c9a05d1045304",
10
  "IMPORTER_BUILD_RECEIPT.json": "4ba5c533cc617105478e4d85c83f456a7dfa68b1388049624619871ba9e42e9d",
11
  "LICENSE": "53d5851b6440feeae36f72a5f57fcab37858c48b7084765ece4b0c54b9a28ed8",
@@ -13,13 +14,14 @@
13
  "STORAGE_BOUNDARY.md": "9a1ffb5854230690dba3f0895f9a8e570716de47be2c553de13a6892dd740015",
14
  "TRACK_LIBRARY.md": "7e4829c5e0933bfb317c21d7441ad0ba2ee00ab7f9f1635549452d504aa0777b",
15
  "UPSTREAM.json": "40a2f31fa9abc11e47e247c56909b93b587d1f5be524ab158b24f1f9eed93765",
16
- "app.py": "f0aacacfcd68ac3223e215af691e84f01c7c1983505088b768d38500f258d56b",
17
  "app_release.py": "7482559c667a665fd3cb6aa8af6c78422a822b515e14589db8306f7fd4860a8b",
18
  "assets/formula_template.json": "80f745df82bb7be45af52785fd582460bcddc63c5a4e1d8375d85b3122db4c6b",
19
  "assets/track-atlas.json": "d97c8900e3e5fb17734b5bd61d1f4f4b196d9be30af9848e2e273ae7e4079ae4",
20
  "bin/altd-sim": "2f2f2144ae14b0ef599ca8510f95712da00243c6875881491d384b394e7499f7",
21
  "bin/extract_saved_track": "3a7733c45b4301a786fcbfe92660a1c484749272da5f608d62f34878bd4ff31a",
22
  "bin/libaltd_gpu.so": "279d6353b4c691686d6aeeae6abfd4a82b959e9b604f079a6c45f9823b48a87a",
 
23
  "builtin_tracks.py": "2ecc2b1d00fe15701b0271d71e1e68d2e7e59c596330879494055f9b2a99c242",
24
  "builtin_tracks/catalog.json": "65006e70a87a5a53e3738166b0895bc4db9f99767dd891d917b68029abb4e80a",
25
  "builtin_tracks/tracks/Replica A01 Beginner.track": "ca5749537450430794e2eade2e0ac72fa141a4f225e13e2f8ef842abb948ff15",
@@ -50,24 +52,24 @@
50
  "builtin_tracks/tracks/Replica R08 Demolition Derby.track": "6f11a9ffbcb477c9d19964566b1b612d2a94675605246e93e21f27bbbdb357ef",
51
  "builtin_tracks/tracks/Replica R09 Eau Noir.track": "3ec0a78478cca1a4f0d2d98ac81f40783928adf271b70f0c32d295a6da2cdaa9",
52
  "builtin_tracks/tracks/Replica The Champions Trial.track": "a3bfb76422affc774b44c739b0636d08acb901fa7615b9adcb52c069f79834e1",
53
- "client.js": "ee070dcb67d62c9ee7905ecdd744192a7b35f0925c17f7235c7b50fe5ca463ca",
54
  "delivery.py": "07453999c3831a16e8b1fcc2b4ae5fb28beb7d3952a3fae8de65d16eb6f11e5b",
55
  "gpu_tickets.py": "b81aadb5ed42cec9212d44da7e7bbb7b413c5bd517383cac0b49ec9b4d659c92",
56
  "hf-auth.js": "b59691ce2c517f193a5d5141538ebe61c961bb163cefa1fcf09b414c388984c1",
57
  "hf_identity.py": "6993d0238ada835606dbdc3275c17a3fe5a5cac5ad2156ab78230acf2d051eba",
58
- "index.html": "dea8ee713484a551421883599af8ffbcd91cab7a31087699e6711c5bd1fc5412",
59
  "requirements.txt": "9b532747e51bd052e82090ece860d6dafe027407f4512dc74272c148ea104c22",
60
- "server.py": "91cb5f18442fe38ed5cbd35b74faa326596a0c9d1cf197276ed89657a55d1fbd",
61
  "track-library.js": "351ec4c026b49420ce963f4310cb000d9e987fd28e6dac5ecd0176509340f6e6",
62
  "track-map.js": "ab5374aa49c7ccec90a787ee8c56cd71beb56b903bf2bbc322783e6f43c009f0",
63
- "training_config.py": "2b9768876fdc60b16afb45b98023c6c31666e30f7c56f1292f6071775e6da0c5",
64
  "vendor/gradio-client/LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4",
65
  "vendor/gradio-client/dist/index.min.js": "fdd776db8633354f118fe2908c980592283968737e6b91dc3aa86d648da5c3fd",
66
  "vendor/gradio-client/package.json": "96c5b9e6d3587fb7bd8e5bb28775ece222de1043045afc4e6389c88db137ad0e",
67
  "vendor/hf-oauth/LICENSE": "d6e7b19451c1b3d1d66353bb4b1274138953b3bfd9ae60c56e77b1f548796982",
68
  "vendor/hf-oauth/index.js": "53282844000a171011e547f6472a3846bb4cecb5071adafea079fcac3a2aee7e",
69
  "vendor/hf-oauth/package.json": "fafd4d8891023a1961546a7d3bc25cd24f64923a2ebfc449fe6d516a2949bda8",
70
- "worker.py": "934fb941a7f73a82c9bbcff5f3290103d4dd55e66542e71d56ae8fe7101f0e57"
71
  },
72
  "interface": "single-engine-runner-with-map",
73
  "upstream_revision": "d8ab74c25df70b6a86ed101080e33d5fb785ea6f"
 
2
  "backend": "cpu+zerogpu",
3
  "files": {
4
  ".gitattributes": "c2ad16718fc51c888d32efc88c8f6e23ebe5fcf6f48e2954f896ba9770f24d72",
5
+ "BETA_TESTING.md": "9d6447c876a2b2b1d3dbb7637858c79a4c669d8582d8cc2a6a335ea8cc4297c1",
6
  "BINARY_PROVENANCE.json": "1116e1757afc6c8629cb2d957e3d77380fe4f7e3186c3832d16a5a08abce6aa8",
7
  "DATA_POLICY.md": "0daf1b835bf829c0974e6b566cb5a605c6f52dba4517cfd54bed044e8eaf4264",
8
+ "FEEDBACK.md": "17127b693eb52cccf1707be24b9bced82b77c0eec174b1f696cc9a3feb33dd67",
9
+ "FRONTEND_SOURCE.json": "d9bf9402693f514956ec99432b6da2ccf73f17c7c26dd400123b6b9fb27bf31e",
10
  "GODOT_LICENSE": "fb2b3bb82c60f1e76841ba2122eb902f8e39c151476fe21ce10c9a05d1045304",
11
  "IMPORTER_BUILD_RECEIPT.json": "4ba5c533cc617105478e4d85c83f456a7dfa68b1388049624619871ba9e42e9d",
12
  "LICENSE": "53d5851b6440feeae36f72a5f57fcab37858c48b7084765ece4b0c54b9a28ed8",
 
14
  "STORAGE_BOUNDARY.md": "9a1ffb5854230690dba3f0895f9a8e570716de47be2c553de13a6892dd740015",
15
  "TRACK_LIBRARY.md": "7e4829c5e0933bfb317c21d7441ad0ba2ee00ab7f9f1635549452d504aa0777b",
16
  "UPSTREAM.json": "40a2f31fa9abc11e47e247c56909b93b587d1f5be524ab158b24f1f9eed93765",
17
+ "app.py": "271c13c152e916c704c9c311a4a2800ef98e3787e6557be9eab8c851de0e1fb4",
18
  "app_release.py": "7482559c667a665fd3cb6aa8af6c78422a822b515e14589db8306f7fd4860a8b",
19
  "assets/formula_template.json": "80f745df82bb7be45af52785fd582460bcddc63c5a4e1d8375d85b3122db4c6b",
20
  "assets/track-atlas.json": "d97c8900e3e5fb17734b5bd61d1f4f4b196d9be30af9848e2e273ae7e4079ae4",
21
  "bin/altd-sim": "2f2f2144ae14b0ef599ca8510f95712da00243c6875881491d384b394e7499f7",
22
  "bin/extract_saved_track": "3a7733c45b4301a786fcbfe92660a1c484749272da5f608d62f34878bd4ff31a",
23
  "bin/libaltd_gpu.so": "279d6353b4c691686d6aeeae6abfd4a82b959e9b604f079a6c45f9823b48a87a",
24
+ "build_info.py": "93d331c0405cd10076a544f87761bb4a00f6556bbbdab8abc12e070c4661bd78",
25
  "builtin_tracks.py": "2ecc2b1d00fe15701b0271d71e1e68d2e7e59c596330879494055f9b2a99c242",
26
  "builtin_tracks/catalog.json": "65006e70a87a5a53e3738166b0895bc4db9f99767dd891d917b68029abb4e80a",
27
  "builtin_tracks/tracks/Replica A01 Beginner.track": "ca5749537450430794e2eade2e0ac72fa141a4f225e13e2f8ef842abb948ff15",
 
52
  "builtin_tracks/tracks/Replica R08 Demolition Derby.track": "6f11a9ffbcb477c9d19964566b1b612d2a94675605246e93e21f27bbbdb357ef",
53
  "builtin_tracks/tracks/Replica R09 Eau Noir.track": "3ec0a78478cca1a4f0d2d98ac81f40783928adf271b70f0c32d295a6da2cdaa9",
54
  "builtin_tracks/tracks/Replica The Champions Trial.track": "a3bfb76422affc774b44c739b0636d08acb901fa7615b9adcb52c069f79834e1",
55
+ "client.js": "cc18e5ce4405ccc7cecc3ab6cc6d7b2abddcc6cfac69f47825c546b8d7c1bcf1",
56
  "delivery.py": "07453999c3831a16e8b1fcc2b4ae5fb28beb7d3952a3fae8de65d16eb6f11e5b",
57
  "gpu_tickets.py": "b81aadb5ed42cec9212d44da7e7bbb7b413c5bd517383cac0b49ec9b4d659c92",
58
  "hf-auth.js": "b59691ce2c517f193a5d5141538ebe61c961bb163cefa1fcf09b414c388984c1",
59
  "hf_identity.py": "6993d0238ada835606dbdc3275c17a3fe5a5cac5ad2156ab78230acf2d051eba",
60
+ "index.html": "315058a08c31ec512108473904f559087080edb684c02f4d594cbe5032c77791",
61
  "requirements.txt": "9b532747e51bd052e82090ece860d6dafe027407f4512dc74272c148ea104c22",
62
+ "server.py": "de98db424b96a4fbab7ce5b98ee42a94e846e2b3f317593e2346c5f87489ede8",
63
  "track-library.js": "351ec4c026b49420ce963f4310cb000d9e987fd28e6dac5ecd0176509340f6e6",
64
  "track-map.js": "ab5374aa49c7ccec90a787ee8c56cd71beb56b903bf2bbc322783e6f43c009f0",
65
+ "training_config.py": "a0dd095e0de8c5a964ace66954f346e5d7b861db3d34cd2feaceedc5ecb80bad",
66
  "vendor/gradio-client/LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4",
67
  "vendor/gradio-client/dist/index.min.js": "fdd776db8633354f118fe2908c980592283968737e6b91dc3aa86d648da5c3fd",
68
  "vendor/gradio-client/package.json": "96c5b9e6d3587fb7bd8e5bb28775ece222de1043045afc4e6389c88db137ad0e",
69
  "vendor/hf-oauth/LICENSE": "d6e7b19451c1b3d1d66353bb4b1274138953b3bfd9ae60c56e77b1f548796982",
70
  "vendor/hf-oauth/index.js": "53282844000a171011e547f6472a3846bb4cecb5071adafea079fcac3a2aee7e",
71
  "vendor/hf-oauth/package.json": "fafd4d8891023a1961546a7d3bc25cd24f64923a2ebfc449fe6d516a2949bda8",
72
+ "worker.py": "b30e12135f27f870a5094d98c19039262fcb5498f7582bdf4dce89cf11db520e"
73
  },
74
  "interface": "single-engine-runner-with-map",
75
  "upstream_revision": "d8ab74c25df70b6a86ed101080e33d5fb785ea6f"
app.py CHANGED
@@ -19,6 +19,7 @@ from gpu_tickets import InputTickets
19
  from server import create_app
20
  from worker import run_native,track_input,network_input
21
  from training_config import validate_config
 
22
  from hf_identity import visitor_identity
23
 
24
  def build_app(cuda_call):
@@ -54,7 +55,7 @@ def build_app(cuda_call):
54
 
55
  @app.get('/api/capabilities')
56
  def capabilities():
57
- return {'cpu':True,'gpu':True,'default':'cpu','gpu_transport':'gradio-ticket','configurable_training':True}
58
 
59
  @app.get('/gradio-client.js')
60
  def javascript_client():
 
19
  from server import create_app
20
  from worker import run_native,track_input,network_input
21
  from training_config import validate_config
22
+ from build_info import build_identity
23
  from hf_identity import visitor_identity
24
 
25
  def build_app(cuda_call):
 
55
 
56
  @app.get('/api/capabilities')
57
  def capabilities():
58
+ return {'cpu':True,'gpu':True,'default':'cpu','gpu_transport':'gradio-ticket','configurable_training':True,'build':build_identity()}
59
 
60
  @app.get('/gradio-client.js')
61
  def javascript_client():
build_info.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Content-addressed package identity; no environment or credentials in reports."""
2
+ import hashlib
3
+ import json
4
+ from pathlib import Path
5
+
6
+ ROOT = Path(__file__).resolve().parent
7
+
8
+ def build_identity():
9
+ manifest = json.loads((ROOT / 'RELEASE_MANIFEST.json').read_text())
10
+ upstream = json.loads((ROOT / 'UPSTREAM.json').read_text())
11
+ members = json.dumps(manifest['files'], sort_keys=True, separators=(',', ':')).encode()
12
+ return {
13
+ 'schema_version': 1,
14
+ 'build_id': 'ald-beta-' + hashlib.sha256(members).hexdigest(),
15
+ 'source_repository': upstream['repository'],
16
+ 'simulator_source_revision': upstream['commit'],
17
+ 'math_profile': upstream['math_profile'],
18
+ 'package_role': upstream['role'],
19
+ 'binary_sha256': {name: digest for name, digest in manifest['files'].items() if name.startswith('bin/')},
20
+ }
client.js CHANGED
@@ -10,6 +10,8 @@ let stagedNetwork = null;
10
  let batchActive = false;
11
  let batchStopRequested = false;
12
  let batchReceipt = null;
 
 
13
  // Display context affects quota guidance, never whether GPU can be selected.
14
  const hostedStandalone = location.hostname.endsWith('.hf.space') && window.self === window.top;
15
  const say = text => { $('status').textContent = text; };
@@ -27,7 +29,7 @@ function buttons() {
27
  window.HFAuth?.setBusy(busy || !!job);
28
  window.setTrainingBusy?.(busy || !!job);
29
  window.setEditorBusy?.(busy || !!job);
30
- $('run').disabled = busy || !!job || !capabilitiesReady;
31
  $('backend').disabled = busy || !!job || !capabilitiesReady;
32
  $('download').disabled = busy || !job;
33
  $('erase').disabled = busy || !job;
@@ -38,6 +40,7 @@ function buttons() {
38
  $('network').disabled=busy || !!job;
39
  if($('batch_start'))$('batch_start').disabled=busy || !!job || !capabilitiesReady;
40
  if($('batch_stop'))$('batch_stop').disabled=!batchActive || batchStopRequested;
 
41
  if($('batch_export'))$('batch_export').disabled=busy || !batchReceipt;
42
  }
43
  function saveLocal() {
@@ -64,13 +67,14 @@ async function encoded(file) {
64
  }
65
  const headers = () => ({'X-Job-Key':job.key});
66
  const networkSource=()=>stagedNetwork || $('network').files[0];
67
- $('network').onchange=()=>{stagedNetwork=null;if($('networkChoice'))$('networkChoice').textContent='Uploaded file selected.';};
68
  window.TrainingClient={
69
  isBusy:()=>busy||!!job,
70
  useNetwork(file){
71
  if(busy||job)throw Error('Finish or delete the current result before changing the network');
72
  stagedNetwork=file;$('network').value='';
73
  if($('networkChoice'))$('networkChoice').textContent='Browser editor input: '+file.name+'. Not uploaded yet.';
 
74
  }
75
  };
76
  async function submit(body){
@@ -81,17 +85,14 @@ async function submit(body){
81
  const result=await gradioClient.predict('/gpu_train',[prepared.ticket]);
82
  return result.data[0];
83
  } catch(error) {
84
- if(isGpuQuotaError(error)){
85
- let cleanup='If dispatch did not start, staged inputs expire within two minutes.';
86
- try {
87
- const response=await request('/api/gpu/prepare/'+encodeURIComponent(prepared.ticket),{method:'DELETE'});
88
- cleanup=(await response.json()).deleted===true
89
- ? 'Staged inputs were deleted.'
90
- : 'No pending upload remains for this request.';
91
- } catch {}
92
- throw Error(displayError(error)+' '+cleanup);
93
- }
94
- throw error;
95
  }
96
  }
97
  return (await request('/api/process',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(body)})).json();
@@ -137,6 +138,7 @@ $('run').onclick = async () => {
137
  const started=performance.now();
138
  $('runState').textContent='RUNNING — waiting for server confirmation';
139
  $('runState').style.color='#ffd073';
 
140
  showDetails(null);
141
  const tick=()=>{$('runSummary').textContent='Backend: '+$('backend').value.toUpperCase()+'\nElapsed: '+((performance.now()-started)/1000).toFixed(1)+' s\nCompletion is not yet confirmed.';};
142
  tick(); const progress=setInterval(tick,250);
@@ -150,8 +152,10 @@ $('run').onclick = async () => {
150
  $('runState').textContent='COMPLETE — candidate ready to download';
151
  $('runState').style.color='#62dfb1';
152
  const r=job.report;
 
153
  const metric=n=>typeof n==='number'?n.toFixed(3):'Not reported';
154
  $('runSummary').textContent=r?[
 
155
  'Backend: '+job.backend.toUpperCase(),
156
  'Track: '+(trackInfo?.source==='builtin'?trackInfo.display_name:'Custom upload'),
157
  'Generations: '+r.generations_completed+' / '+r.generations_requested+' · Population: '+r.population,
@@ -186,6 +190,7 @@ $('download').onclick = async () => {
186
  // The browser has the complete validated result. Disk-save success cannot be observed.
187
  localResult=new Blob([bytes]); saveLocal();
188
  const acknowledgment=await acknowledge(job,receipt);
 
189
  if (acknowledgment.deleted) { $('runState').textContent='COMPLETE — result received; server copy deleted'; job=null; say('Result received by browser. Server result deleted. Save your local download; server retrieval is no longer available.'); }
190
  else say('Result received by browser. The server copy is available for another download until its five-minute deadline; use Delete now to remove it sooner.');
191
  } catch (error) { say(error.message+' If receipt acknowledgment failed, use Delete now; automatic expiry still applies.'); }
@@ -233,14 +238,14 @@ if($('batch_start')){
233
  line.textContent='Step '+step.step+' · '+step.slot+' · '+step.name+' · completed · '+step.report.generations_completed+' generations · server copy deleted';
234
  $('batch_history').append(line);
235
  }});
236
- batchReceipt={version:1,state:result.state,plan,track:trackLibrary?.info()??{source:'upload'},history,elapsed_seconds:(Date.now()-started)/1000};
237
  $('batch_status').textContent=result.state.toUpperCase()+' · '+history.length+' / '+plan.runs.length+' runs. '+(localResult?'Last received candidate is available on Drive & view.':'No candidate received.');
238
  $('runState').textContent='BATCH '+result.state.toUpperCase()+' — '+history.length+' / '+plan.runs.length+' runs; server copies deleted';
239
  $('runState').style.color=result.state==='completed'?'#62dfb1':'#ffd073';
240
  $('runSummary').textContent='Backend: '+backend.toUpperCase()+'\nCompleted steps: '+history.length+'\nUse Save received result again for the last candidate. A completed batch does not establish improved driving.';
241
  say('Batch results are in browser memory only; no server result remains for completed steps.');
242
  }catch(error){
243
- batchReceipt={version:1,state:'error',plan:plan??null,history,error:error.message,elapsed_seconds:(Date.now()-started)/1000};
244
  $('batch_status').textContent='ERROR · '+history.length+' confirmed steps. '+displayError(error);
245
  $('runState').textContent='BATCH ERROR — '+history.length+' completed steps';
246
  $('runState').style.color='#ffb5a2';
@@ -276,6 +281,11 @@ async function connect(){
276
  try {
277
  const capabilities=await (await request('/api/capabilities',{signal:controller.signal})).json();
278
  if(capabilities.cpu!==true)throw new Error('CPU unavailable');
 
 
 
 
 
279
  gpuTransport=capabilities.gpu_transport??null;
280
  $('gpuOption').disabled=!capabilities.gpu;
281
  $('backendNote').textContent=capabilities.gpu?(hostedStandalone?'CPU is anonymous. GPU may use a limited anonymous allowance or your optional HF account allowance.':'CPU is anonymous. GPU requires an available HF allowance.'):'CPU training is ready; no sign-in or GPU allowance needed.';
@@ -292,3 +302,9 @@ async function connect(){
292
  }
293
  $('retry').onclick=()=>{if(!busy&&!job)connect();};
294
  connect();
 
 
 
 
 
 
 
10
  let batchActive = false;
11
  let batchStopRequested = false;
12
  let batchReceipt = null;
13
+ let runReceipt = null;
14
+ let appBuild = null;
15
  // Display context affects quota guidance, never whether GPU can be selected.
16
  const hostedStandalone = location.hostname.endsWith('.hf.space') && window.self === window.top;
17
  const say = text => { $('status').textContent = text; };
 
29
  window.HFAuth?.setBusy(busy || !!job);
30
  window.setTrainingBusy?.(busy || !!job);
31
  window.setEditorBusy?.(busy || !!job);
32
+ $('run').disabled = busy || !!job || !capabilitiesReady || !networkSource();
33
  $('backend').disabled = busy || !!job || !capabilitiesReady;
34
  $('download').disabled = busy || !job;
35
  $('erase').disabled = busy || !job;
 
40
  $('network').disabled=busy || !!job;
41
  if($('batch_start'))$('batch_start').disabled=busy || !!job || !capabilitiesReady;
42
  if($('batch_stop'))$('batch_stop').disabled=!batchActive || batchStopRequested;
43
+ if($('run_export'))$('run_export').disabled=busy || !runReceipt;
44
  if($('batch_export'))$('batch_export').disabled=busy || !batchReceipt;
45
  }
46
  function saveLocal() {
 
67
  }
68
  const headers = () => ({'X-Job-Key':job.key});
69
  const networkSource=()=>stagedNetwork || $('network').files[0];
70
+ $('network').onchange=()=>{stagedNetwork=null;if($('networkChoice'))$('networkChoice').textContent='Uploaded file selected.';buttons();};
71
  window.TrainingClient={
72
  isBusy:()=>busy||!!job,
73
  useNetwork(file){
74
  if(busy||job)throw Error('Finish or delete the current result before changing the network');
75
  stagedNetwork=file;$('network').value='';
76
  if($('networkChoice'))$('networkChoice').textContent='Browser editor input: '+file.name+'. Not uploaded yet.';
77
+ buttons();
78
  }
79
  };
80
  async function submit(body){
 
85
  const result=await gradioClient.predict('/gpu_train',[prepared.ticket]);
86
  return result.data[0];
87
  } catch(error) {
88
+ let cleanup='Pending inputs expire within two minutes. A connection error does not confirm whether training started.';
89
+ try {
90
+ const response=await request('/api/gpu/prepare/'+encodeURIComponent(prepared.ticket),{method:'DELETE'});
91
+ cleanup=(await response.json()).deleted===true
92
+ ? 'Pending inputs were deleted before dispatch.'
93
+ : 'No pending inputs remain. This does not confirm that a dispatched run stopped.';
94
+ } catch {}
95
+ throw Error(displayError(error)+' '+cleanup);
 
 
 
96
  }
97
  }
98
  return (await request('/api/process',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(body)})).json();
 
138
  const started=performance.now();
139
  $('runState').textContent='RUNNING — waiting for server confirmation';
140
  $('runState').style.color='#ffd073';
141
+ runReceipt=null;
142
  showDetails(null);
143
  const tick=()=>{$('runSummary').textContent='Backend: '+$('backend').value.toUpperCase()+'\nElapsed: '+((performance.now()-started)/1000).toFixed(1)+' s\nCompletion is not yet confirmed.';};
144
  tick(); const progress=setInterval(tick,250);
 
152
  $('runState').textContent='COMPLETE — candidate ready to download';
153
  $('runState').style.color='#62dfb1';
154
  const r=job.report;
155
+ runReceipt={version:1,state:'completed',build:r?.build??appBuild,backend:job.backend,output_sha256:job.sha256,report:r};
156
  const metric=n=>typeof n==='number'?n.toFixed(3):'Not reported';
157
  $('runSummary').textContent=r?[
158
+ 'Build: '+(r.build?.build_id??'Not reported'),
159
  'Backend: '+job.backend.toUpperCase(),
160
  'Track: '+(trackInfo?.source==='builtin'?trackInfo.display_name:'Custom upload'),
161
  'Generations: '+r.generations_completed+' / '+r.generations_requested+' · Population: '+r.population,
 
190
  // The browser has the complete validated result. Disk-save success cannot be observed.
191
  localResult=new Blob([bytes]); saveLocal();
192
  const acknowledgment=await acknowledge(job,receipt);
193
+ if(runReceipt)runReceipt.delivery={received_and_hash_verified:true,server_copy_deleted:acknowledgment.deleted===true};
194
  if (acknowledgment.deleted) { $('runState').textContent='COMPLETE — result received; server copy deleted'; job=null; say('Result received by browser. Server result deleted. Save your local download; server retrieval is no longer available.'); }
195
  else say('Result received by browser. The server copy is available for another download until its five-minute deadline; use Delete now to remove it sooner.');
196
  } catch (error) { say(error.message+' If receipt acknowledgment failed, use Delete now; automatic expiry still applies.'); }
 
238
  line.textContent='Step '+step.step+' · '+step.slot+' · '+step.name+' · completed · '+step.report.generations_completed+' generations · server copy deleted';
239
  $('batch_history').append(line);
240
  }});
241
+ batchReceipt={version:1,build:appBuild,state:result.state,plan,track:trackLibrary?.info()??{source:'upload'},history,elapsed_seconds:(Date.now()-started)/1000};
242
  $('batch_status').textContent=result.state.toUpperCase()+' · '+history.length+' / '+plan.runs.length+' runs. '+(localResult?'Last received candidate is available on Drive & view.':'No candidate received.');
243
  $('runState').textContent='BATCH '+result.state.toUpperCase()+' — '+history.length+' / '+plan.runs.length+' runs; server copies deleted';
244
  $('runState').style.color=result.state==='completed'?'#62dfb1':'#ffd073';
245
  $('runSummary').textContent='Backend: '+backend.toUpperCase()+'\nCompleted steps: '+history.length+'\nUse Save received result again for the last candidate. A completed batch does not establish improved driving.';
246
  say('Batch results are in browser memory only; no server result remains for completed steps.');
247
  }catch(error){
248
+ batchReceipt={version:1,build:appBuild,state:'error',plan:plan??null,history,error:error.message,elapsed_seconds:(Date.now()-started)/1000};
249
  $('batch_status').textContent='ERROR · '+history.length+' confirmed steps. '+displayError(error);
250
  $('runState').textContent='BATCH ERROR — '+history.length+' completed steps';
251
  $('runState').style.color='#ffb5a2';
 
281
  try {
282
  const capabilities=await (await request('/api/capabilities',{signal:controller.signal})).json();
283
  if(capabilities.cpu!==true)throw new Error('CPU unavailable');
284
+ appBuild=capabilities.build??null;
285
+ if($('buildLabel')){
286
+ $('buildLabel').textContent='Build: '+(appBuild?.build_id?.slice(0,25)??'Unavailable — include the app URL in feedback');
287
+ $('buildLabel').title=appBuild?.build_id??'';
288
+ }
289
  gpuTransport=capabilities.gpu_transport??null;
290
  $('gpuOption').disabled=!capabilities.gpu;
291
  $('backendNote').textContent=capabilities.gpu?(hostedStandalone?'CPU is anonymous. GPU may use a limited anonymous allowance or your optional HF account allowance.':'CPU is anonymous. GPU requires an available HF allowance.'):'CPU training is ready; no sign-in or GPU allowance needed.';
 
302
  }
303
  $('retry').onclick=()=>{if(!busy&&!job)connect();};
304
  connect();
305
+
306
+ if($('run_export'))$('run_export').onclick=()=>{
307
+ if(!runReceipt)return;
308
+ const url=URL.createObjectURL(new Blob([JSON.stringify(runReceipt,null,2)],{type:'application/json'}));
309
+ const a=document.createElement('a');a.href=url;a.download='ald-run-receipt.json';a.click();setTimeout(()=>URL.revokeObjectURL(url),1000);
310
+ };
index.html CHANGED
@@ -1,29 +1,30 @@
1
  <!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>AI Learns To Drive</title>
2
  <style>
3
- :root{color-scheme:dark;font:16px system-ui;background:#0c1420;color:#e5edf5}body{max-width:1400px;margin:auto;padding:22px}h1{font-size:32px;margin:0}h2{font-size:21px;margin:0 0 14px}small,.hint{color:#a2b4c8;line-height:1.6}.grid{display:grid;grid-template-columns:minmax(360px,.9fr) minmax(0,1.25fr);gap:24px}.card{background:#152233;border:1px solid #2a3d52;border-radius:16px;padding:22px;margin-top:20px}label{display:block;margin:12px 0 5px}input,select,button{font:inherit;background:#0c1725;color:#e5edf5;border:1px solid #49627c;border-radius:7px;padding:9px}input[type=number],select{width:100%;box-sizing:border-box}input[type=file]{max-width:100%;box-sizing:border-box}button{cursor:pointer}button.primary{background:#62dfb1;color:#102522;font-weight:700}button:disabled{opacity:.4;cursor:default}.row{display:grid;grid-template-columns:1fr 1fr;gap:15px}.reward{display:grid;grid-template-columns:1.7fr 1fr 70px 30px;gap:5px;margin:8px 0}.reward input{width:70px;box-sizing:border-box}a{color:#7ce4c3}canvas{width:100%;background:#09111b;border-radius:10px}#status{white-space:pre-wrap;line-height:1.7}table{width:100%;text-align:left;border-collapse:collapse;font-size:14px}td,th{padding:9px;border-bottom:1px solid #2a3d52}.pill{display:inline-block;background:#284539;border-radius:20px;padding:5px 12px;color:#91efc6;margin:6px 0}#error{color:#ffb5a2;white-space:pre-wrap}.toolbar{display:flex;gap:12px;align-items:center;flex-wrap:wrap;padding-bottom:16px;border-bottom:1px solid #2a3d52;margin-bottom:15px}.run-card{position:sticky;top:20px}details{margin-top:18px;border-top:1px solid #2a3d52;padding-top:14px}summary{cursor:pointer;font-weight:600;color:#c6d9e9}details[open]>summary{margin-bottom:12px}[hidden]{display:none!important}#map_note{font-size:14px}#runs{max-height:380px;overflow:auto}.table-scroll{overflow:auto}@media(max-width:850px){.grid{grid-template-columns:1fr}#drive .grid>section:nth-child(2){order:-1}.run-card{position:static}body{padding:16px}}
4
- .tabs{display:flex;flex-wrap:wrap;gap:10px;margin:20px 0}.tabs button[aria-selected=true]{background:#62dfb1;color:#102522}.library{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:20px}.library input[type=text]{width:100%;box-sizing:border-box}.queue-row{display:flex;gap:8px;margin:8px 0}.queue-row select{flex:1}.pane{min-width:0}.map{min-height:300px;background:#09111b;border-radius:12px;padding:10px}.map canvas{display:block;width:100%;height:auto;max-height:320px;object-fit:contain}.map-legend{display:flex;gap:18px;flex-wrap:wrap;margin:10px 0;color:#c6d9e9;font-size:14px}pre{white-space:pre-wrap;overflow-wrap:anywhere}input[type=text]{width:100%;box-sizing:border-box}#libraries .row label>input,#libraries .row label>select{display:block;margin-top:6px}#editor_parameters input{max-width:240px} .eyebrow{color:#62dfb1;font-size:12px;letter-spacing:.18em;font-weight:800}.intro{font-size:19px;color:#b9cddd;max-width:820px;margin:10px 0 0}header{padding:12px 0 4px}header h1{font-size:clamp(30px,4vw,45px);letter-spacing:-.03em;margin-top:7px}.about{max-width:850px;font-size:14px;margin-top:15px}.about p{line-height:1.65}.card{box-shadow:0 10px 35px #050a1280}.tabs{position:sticky;top:0;z-index:3;background:#0c1420eF;padding:12px 0;border-bottom:1px solid #2a3d52}.tabs button{border-radius:12px;padding:11px 15px}.map-status{margin:7px 0;color:#dbe9f1;font-size:14px}#run{background:#62dfb1;color:#102522;font-weight:800;width:100%;margin-top:12px;padding:13px}.privacy-note{font-size:13px;line-height:1.5;color:#a2b4c8}.keep-result{display:flex;gap:10px;align-items:flex-start;padding:12px;border:1px solid #3b566b;border-radius:10px;background:#102030;line-height:1.4}.keep-result input{margin:3px 0 0;flex:none} .terrain{display:inline-block;width:11px;height:11px;border-radius:3px;margin-right:4px;background:#607e96}.terrain.dirt{background:#b89561}.terrain.ice{background:#b9d9ed}.terrain.start{background:#66e5aa}</style>
5
- <header><div class="eyebrow">AI LEARNS TO DRIVE · TRAINING LAB</div><h1>Train, inspect, repeat.</h1><p class="intro">Pick a track and network, run a bounded training session, and keep your recipes in this browser.</p><details class="about"><summary>About this beta and its data handling</summary><p>Simulator by <a href="https://github.com/Zorro909/driving_sim_rs">Zorro909</a>; interface and hosting by <a href="https://github.com/seeker-cyber-maker/driving_sim_rs">TiGa</a>. Inspired by the <a href="https://store.steampowered.com/app/3312030/AI_Learns_To_Drive/">game by ActivationFunction</a>. Built-in tracks are reconstructed replicas. Star challenges are not evaluated here.</p><p>Uploaded files are used for the requested run. Results are held briefly in application memory and deleted after verified download or expiry. Browser recipes contain settings only. <a href="/policy" target="_blank" rel="noopener">Read the data policy</a>.</p></details></header>
6
- <nav class="tabs" aria-label="Lab sections"><button data-tab="drive" aria-selected="true">1 · Drive & view</button><button data-tab="training" aria-selected="false">2 · Training runs & presets</button><button data-tab="batch" aria-selected="false">3 · Batches</button><button data-tab="editor" aria-selected="false">4 · Network editor</button></nav><div id="drive" class="pane"><div class="grid"><section class="card"><h2>Simulation</h2><p>Training uses the settings on the Training runs & presets tab. Formula networks, steering and acceleration; speed and raycast sensors. Supported networks: Formula, steering and acceleration, speed/raycast sensors, 2–4 layers with up to 16 nodes.</p>
7
  <p id="computeBlock"><label for="backend">Compute</label><select id="backend" disabled><option value="cpu">CPU — no GPU allowance</option><option id="gpuOption" value="gpu" disabled>GPU — uses GPU allowance</option></select></p><p id="backendNote" class="hint">Checking available backends…</p>
8
  <div id="connectionRecovery" hidden><button id="retry" type="button">Reconnect to app</button><p class="hint">Checks server availability. Does not restart training, sign you in, or reset GPU allowance.</p></div>
9
  <div id="gpuAccount" aria-label="Optional GPU account"><p><button id="hfSignIn" type="button" disabled>Sign in with HF for account GPU allowance</button><span id="hfAccount" hidden></span> <button id="hfSignOut" type="button" disabled hidden>Disconnect account</button></p><p id="hfIdentity" role="status" class="hint">CPU needs no sign-in. Checking optional GPU account connection…</p>
10
  <details><summary>Account help &amp; troubleshooting</summary><p>CPU works without an account. HF sign-in identifies GPU requests; it does not guarantee available allowance. Sign in before choosing files: sign-in reloads this page and clears selected files and unsaved edits. Saved recipes remain.</p><p>Your account token stays in page memory. Refreshing or closing this page disconnects the app. Disconnecting here does not sign you out of the HF website or delete job data.</p><button id="hfVerify" type="button" disabled hidden>Check account connection — no GPU used</button><p class="hint">Checks which account the GPU submission service sees. Runs automatically before GPU training; it does not check your remaining allowance.</p></details></div>
11
  <p><label for="trackPresetDrive">Track selection</label><select id="trackPresetDrive" data-track-library disabled><option value="">Upload a custom track</option></select></p>
12
  <p data-track-status role="status" class="hint">Loading built-in replica tracks…</p>
13
- <p class="hint">Built-in replicas are reconstructed editor-format layouts, not editor-authored or official packaged files. Star conditions are not evaluated.</p>
14
  <p><label>Track (.track) <input id="track" type="file" accept=".track"></label></p>
15
  <p><label>Formula network (.evolution) <input id="network" type="file" accept=".evolution"></label></p>
16
- <p id="networkChoice" role="status">Choose an uploaded file or use a network from the browser editor.</p><p class="privacy-note">Uploads are processed for this run. By default, the server copy is deleted after the browser verifies the download.</p><label class="keep-result"><input id="keepServer" type="checkbox"> Keep this result on the server for up to five minutes so I can download it again</label><p class="privacy-note">This is optional and resets after each run. All results expire after five minutes. <a href="/policy" target="_blank" rel="noopener">Data policy</a></p>
17
- <button id="run" disabled>Run training</button></section><section class="card"><h2>Selected track &amp; terrain</h2><p id="mapStatus" class="map-status" role="status">Loading selected track…</p><div class="map"><canvas id="trackMap" width="1000" height="500" role="img" aria-label="Selected track tile layout and terrain"></canvas></div><div class="map-legend"><span><i class="terrain asphalt"></i> Asphalt</span><span><i class="terrain dirt"></i> Dirt</span><span><i class="terrain ice"></i> Ice</span><span><i class="terrain start"></i> Start</span></div><p id="mapLegend" class="hint"></p><h2>Run &amp; results</h2><button id="download" disabled>Download result</button> <button id="erase" disabled>Delete server-side job data now</button>
18
  <p><button id="saveLocal" disabled>Save received result again (browser only)</button> <button id="forgetLocal" disabled>Discard browser result</button></p>
19
  <p>The browser keeps the received result in memory until discarded, replaced by a new run, or this page is closed. It is not saved to browser storage.</p>
20
  <h3 id="runState" role="status" aria-live="polite">READY — no run started</h3>
21
  <pre id="runSummary" style="white-space:pre-wrap;line-height:1.7" aria-live="polite"></pre>
 
22
  <p id="deadline"></p><p id="status" role="status">Ready. Inputs remain on this device until you run the test.</p>
23
  <details><summary>Effective training settings</summary><pre id="effectiveSettings"></pre></details><details><summary>Generation results</summary><pre id="generationHistory"></pre></details><details><summary>Star challenges — not evaluated</summary><p>The current runner has star-challenge reporting. Its evaluator and required statistics have not been ported to HF; no star result is inferred from a completed test.</p></details></section></div>
24
  </div><section id="training" class="pane" hidden><div class="card"><h2>Training settings</h2><p class="hint">Choose the track on Drive & view. Choose the training settings and reward mix here, then start the run on Drive & view. Recipes and batch sequences are saved in this browser.</p><p><label for="trackPresetTraining">Training track</label><select id="trackPresetTraining" data-track-library disabled><option value="">Upload a custom track</option></select></p><p data-track-status role="status" class="hint">Loading built-in replica tracks…</p><div id="training_controls"><label for="training_ticks">Simulated ticks per generation</label><input id="training_ticks" type="number" min="1" max="18000" value="60"><small>60 ticks = one simulated second. Current preview limit: population × generations × ticks ≤ 4,000,000; execution timeout 25 seconds.</small>
25
  <div class="row"><div><label for="population">Population</label><input id="population" type="number" min="1" max="128" value="8" disabled><small>1–128 cars in this beta.</small></div><div><label for="generations">Generations</label><input id="generations" type="number" min="1" max="1000" value="30" disabled><small>1–1,000; try 20–50 before review.</small></div></div>
26
- <label id="mutation_label" for="mutation">Mutation rate</label><input id="mutation" type="number" min="0" max="4.2" step="0.01" value="0.1" disabled><small>Mutation settings are passed to the upstream simulator.</small>
27
 
28
  <details id="native_settings"><summary>Native evolution settings</summary>
29
  <label for="preset">Recommended starting recipe</label><select id="preset" disabled><option value="custom">Custom / keep current settings</option><option value="starter">First laps · mutation 0.3, decay 0.0005</option><option value="explore">Wide exploration · mutation 0.5, decay 0.0005</option><option value="refine">Established driver · mutation 0.1, decay 0.0001</option><option value="speed">Lap refinement · mutation 0.05, decay 0</option></select><small>Starting hypotheses, not proven optimums. Change stages after stable improvement.</small>
@@ -71,7 +72,7 @@
71
  for(const [key,choices] of [['schedule',['fixed','linear','geometric']],['selection',['best','tournament','roulette']],['crossover',['none','single_point','uniform']],['control_hz',[60,30,15]]])if(!choices.includes(clean[key]))throw Error('Invalid '+key);
72
  for(const key of ['adaptive_mutation','collision','idle'])if(typeof clean[key]!=='boolean')throw Error('Invalid '+key);
73
  if(clean.parents>clean.population||clean.elite>clean.population)throw Error('Parents/elites exceed population');
74
- if(clean.schedule==='geometric'&&(!clean.mutation||!clean.mutation_end))throw Error('Geometric rates must be positive');
75
  if(!Array.isArray(clean.rewards)||!clean.rewards.length||clean.rewards.length>5)throw Error('Use one to five rewards');
76
  const seen=new Set();
77
  clean.rewards=clean.rewards.map(r=>{
 
1
  <!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>AI Learns To Drive</title>
2
  <style>
3
+ :root{color-scheme:dark;font:16px system-ui;background:#0c1420;color:#e5edf5}body{max-width:1400px;margin:auto;padding:22px}h1{font-size:32px;margin:0}h2{font-size:21px;margin:0 0 14px}small,.hint{color:#a2b4c8;line-height:1.6}.grid{display:grid;grid-template-columns:minmax(360px,.9fr) minmax(0,1.25fr);gap:24px}.card{background:#152233;border:1px solid #2a3d52;border-radius:16px;padding:22px;margin-top:20px}label{display:block;margin:12px 0 5px}input,select,button{font:inherit;background:#0c1725;color:#e5edf5;border:1px solid #49627c;border-radius:7px;padding:9px}input[type=number],select{width:100%;box-sizing:border-box}input[type=file]{max-width:100%;box-sizing:border-box}button{cursor:pointer}button.primary{background:#62dfb1;color:#102522;font-weight:700}button:disabled{opacity:.4;cursor:default}.row{display:grid;grid-template-columns:1fr 1fr;gap:15px}.reward{display:grid;grid-template-columns:1.7fr 1fr 70px 30px;gap:5px;margin:8px 0}.reward input{width:70px;box-sizing:border-box}a{color:#7ce4c3}canvas{width:100%;background:#09111b;border-radius:10px}#status{white-space:pre-wrap;line-height:1.7}table{width:100%;text-align:left;border-collapse:collapse;font-size:14px}td,th{padding:9px;border-bottom:1px solid #2a3d52}.pill{display:inline-block;background:#284539;border-radius:20px;padding:5px 12px;color:#91efc6;margin:6px 0}#error{color:#ffb5a2;white-space:pre-wrap}.toolbar{display:flex;gap:12px;align-items:center;flex-wrap:wrap;padding-bottom:16px;border-bottom:1px solid #2a3d52;margin-bottom:15px}.run-card{position:sticky;top:20px}details{margin-top:18px;border-top:1px solid #2a3d52;padding-top:14px}summary{cursor:pointer;font-weight:600;color:#c6d9e9}details[open]>summary{margin-bottom:12px}[hidden]{display:none!important}#map_note{font-size:14px}#runs{max-height:380px;overflow:auto}.table-scroll{overflow:auto}@media(max-width:850px){.grid{grid-template-columns:minmax(0,1fr)}.card{min-width:0}.run-card{position:static}body{padding:16px}}
4
+ .tabs{display:flex;flex-wrap:wrap;gap:10px;margin:20px 0}.tabs button[aria-selected=true]{background:#62dfb1;color:#102522}.library{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:20px}.library input[type=text]{width:100%;box-sizing:border-box}.queue-row{display:flex;gap:8px;margin:8px 0}.queue-row select{flex:1}.pane{min-width:0}.map{min-height:300px;background:#09111b;border-radius:12px;padding:10px}.map canvas{display:block;width:100%;height:auto;max-height:320px;object-fit:contain}.map-legend{display:flex;gap:18px;flex-wrap:wrap;margin:10px 0;color:#c6d9e9;font-size:14px}pre{white-space:pre-wrap;overflow-wrap:anywhere}input[type=text]{width:100%;box-sizing:border-box}#libraries .row label>input,#libraries .row label>select{display:block;margin-top:6px}#editor_parameters input{max-width:240px} .eyebrow{color:#62dfb1;font-size:12px;letter-spacing:.18em;font-weight:800}.intro{font-size:19px;color:#b9cddd;max-width:820px;margin:10px 0 0}header{padding:12px 0 4px}header h1{font-size:clamp(30px,4vw,45px);letter-spacing:-.03em;margin-top:7px}.about{max-width:850px;font-size:14px;margin-top:15px}.about p{line-height:1.65}.card{box-shadow:0 10px 35px #050a1280}.tabs{position:sticky;top:0;z-index:3;background:#0c1420eF;padding:12px 0;border-bottom:1px solid #2a3d52}.tabs button{border-radius:12px;padding:11px 15px}.map-status{margin:7px 0;color:#dbe9f1;font-size:14px}#run{background:#62dfb1;color:#102522;font-weight:800;width:100%;margin-top:12px;padding:13px}.privacy-note{font-size:13px;line-height:1.5;color:#a2b4c8}.keep-result{display:flex;gap:10px;align-items:flex-start;padding:12px;border:1px solid #3b566b;border-radius:10px;background:#102030;line-height:1.4}.keep-result input{margin:3px 0 0;flex:none} .terrain{display:inline-block;width:11px;height:11px;border-radius:3px;margin-right:4px;background:#607e96}.terrain.dirt{background:#b89561}.terrain.ice{background:#b9d9ed}.terrain.start{background:#66e5aa}@media(max-width:850px){.map{min-height:0}}</style>
5
+ <header><div class="eyebrow">AI LEARNS TO DRIVE · TRAINING LAB</div><h1>Train, inspect, repeat.</h1><p class="intro">Pick a track and network, run a bounded training session, and keep your recipes in this browser.</p><details class="about"><summary>About this beta and its data handling</summary><p>Simulator by <a href="https://github.com/Zorro909/driving_sim_rs">Zorro909</a>; interface and hosting by <a href="https://github.com/seeker-cyber-maker/driving_sim_rs">TiGa</a>. Inspired by the <a href="https://store.steampowered.com/app/3312030/AI_Learns_To_Drive/">game by ActivationFunction</a>. Built-in tracks are reconstructed replicas. Star challenges are not evaluated here.</p><p>Uploaded files are used for the requested run. Results are held briefly in application memory and deleted after verified download or expiry. Browser recipes contain settings only. <a href="/policy" target="_blank" rel="noopener">Read the data policy</a>.</p></details><p><a href="/feedback" target="_blank" rel="noopener">Beta feedback template</a> · Export a run receipt when reporting a problem.</p><p id="buildLabel" class="hint">Build: connecting…</p></header>
6
+ <nav class="tabs" aria-label="Lab sections"><button data-tab="drive" aria-selected="true">1 · Drive & view</button><button data-tab="training" aria-selected="false">2 · Training runs & presets</button><button data-tab="batch" aria-selected="false">3 · Batches</button><button data-tab="editor" aria-selected="false">4 · Network editor</button></nav><div id="drive" class="pane"><div class="grid"><section class="card"><h2>Simulation</h2><button id="run" disabled>Run training</button><p class="hint">Select or create a network below to enable training. Review settings on tab 2 before running.</p><p>Supports Formula steering/acceleration, speed/raycast sensors, and 2–4 layers of up to 16 nodes.</p>
7
  <p id="computeBlock"><label for="backend">Compute</label><select id="backend" disabled><option value="cpu">CPU — no GPU allowance</option><option id="gpuOption" value="gpu" disabled>GPU — uses GPU allowance</option></select></p><p id="backendNote" class="hint">Checking available backends…</p>
8
  <div id="connectionRecovery" hidden><button id="retry" type="button">Reconnect to app</button><p class="hint">Checks server availability. Does not restart training, sign you in, or reset GPU allowance.</p></div>
9
  <div id="gpuAccount" aria-label="Optional GPU account"><p><button id="hfSignIn" type="button" disabled>Sign in with HF for account GPU allowance</button><span id="hfAccount" hidden></span> <button id="hfSignOut" type="button" disabled hidden>Disconnect account</button></p><p id="hfIdentity" role="status" class="hint">CPU needs no sign-in. Checking optional GPU account connection…</p>
10
  <details><summary>Account help &amp; troubleshooting</summary><p>CPU works without an account. HF sign-in identifies GPU requests; it does not guarantee available allowance. Sign in before choosing files: sign-in reloads this page and clears selected files and unsaved edits. Saved recipes remain.</p><p>Your account token stays in page memory. Refreshing or closing this page disconnects the app. Disconnecting here does not sign you out of the HF website or delete job data.</p><button id="hfVerify" type="button" disabled hidden>Check account connection — no GPU used</button><p class="hint">Checks which account the GPU submission service sees. Runs automatically before GPU training; it does not check your remaining allowance.</p></details></div>
11
  <p><label for="trackPresetDrive">Track selection</label><select id="trackPresetDrive" data-track-library disabled><option value="">Upload a custom track</option></select></p>
12
  <p data-track-status role="status" class="hint">Loading built-in replica tracks…</p>
13
+
14
  <p><label>Track (.track) <input id="track" type="file" accept=".track"></label></p>
15
  <p><label>Formula network (.evolution) <input id="network" type="file" accept=".evolution"></label></p>
16
+ <p id="networkChoice" role="status">Choose an uploaded file or use a network from the browser editor.</p><p class="privacy-note">Uploads are processed for this run. By default, the server copy is deleted after the browser verifies the download.</p><details><summary>Optional repeat download</summary><label class="keep-result"><input id="keepServer" type="checkbox"> Keep this result on the server for up to five minutes so I can download it again</label><p class="privacy-note">This is optional and resets after each run. All results expire after five minutes. <a href="/policy" target="_blank" rel="noopener">Data policy</a></p>
17
+ </details></section><section class="card"><h2>Selected track &amp; terrain</h2><p id="mapStatus" class="map-status" role="status">Loading selected track…</p><div class="map"><canvas id="trackMap" width="1000" height="500" role="img" aria-label="Selected track tile layout and terrain"></canvas></div><div class="map-legend"><span><i class="terrain asphalt"></i> Asphalt</span><span><i class="terrain dirt"></i> Dirt</span><span><i class="terrain ice"></i> Ice</span><span><i class="terrain start"></i> Start</span></div><p id="mapLegend" class="hint"></p><h2>Run &amp; results</h2><button id="download" disabled>Download result</button> <button id="erase" disabled>Delete server-side job data now</button>
18
  <p><button id="saveLocal" disabled>Save received result again (browser only)</button> <button id="forgetLocal" disabled>Discard browser result</button></p>
19
  <p>The browser keeps the received result in memory until discarded, replaced by a new run, or this page is closed. It is not saved to browser storage.</p>
20
  <h3 id="runState" role="status" aria-live="polite">READY — no run started</h3>
21
  <pre id="runSummary" style="white-space:pre-wrap;line-height:1.7" aria-live="polite"></pre>
22
+ <p><button id="run_export" disabled>Export run receipt</button></p><p class="hint">Receipts include build identity, settings, metrics and file hashes. Review them before sharing; they contain no network weights or job access keys.</p>
23
  <p id="deadline"></p><p id="status" role="status">Ready. Inputs remain on this device until you run the test.</p>
24
  <details><summary>Effective training settings</summary><pre id="effectiveSettings"></pre></details><details><summary>Generation results</summary><pre id="generationHistory"></pre></details><details><summary>Star challenges — not evaluated</summary><p>The current runner has star-challenge reporting. Its evaluator and required statistics have not been ported to HF; no star result is inferred from a completed test.</p></details></section></div>
25
  </div><section id="training" class="pane" hidden><div class="card"><h2>Training settings</h2><p class="hint">Choose the track on Drive & view. Choose the training settings and reward mix here, then start the run on Drive & view. Recipes and batch sequences are saved in this browser.</p><p><label for="trackPresetTraining">Training track</label><select id="trackPresetTraining" data-track-library disabled><option value="">Upload a custom track</option></select></p><p data-track-status role="status" class="hint">Loading built-in replica tracks…</p><div id="training_controls"><label for="training_ticks">Simulated ticks per generation</label><input id="training_ticks" type="number" min="1" max="18000" value="60"><small>60 ticks = one simulated second. Current preview limit: population × generations × ticks ≤ 4,000,000; execution timeout 25 seconds.</small>
26
  <div class="row"><div><label for="population">Population</label><input id="population" type="number" min="1" max="128" value="8" disabled><small>1–128 cars in this beta.</small></div><div><label for="generations">Generations</label><input id="generations" type="number" min="1" max="1000" value="30" disabled><small>1–1,000; try 20–50 before review.</small></div></div>
27
+ <label id="mutation_label" for="mutation">Mutation rate</label><input id="mutation" type="number" min="0" max="4.2" step="0.01" value="0.1" disabled><small>Use a positive mutation rate, including when continuing an uploaded network. A one-generation run still evaluates the uploaded parent.</small>
28
 
29
  <details id="native_settings"><summary>Native evolution settings</summary>
30
  <label for="preset">Recommended starting recipe</label><select id="preset" disabled><option value="custom">Custom / keep current settings</option><option value="starter">First laps · mutation 0.3, decay 0.0005</option><option value="explore">Wide exploration · mutation 0.5, decay 0.0005</option><option value="refine">Established driver · mutation 0.1, decay 0.0001</option><option value="speed">Lap refinement · mutation 0.05, decay 0</option></select><small>Starting hypotheses, not proven optimums. Change stages after stable improvement.</small>
 
72
  for(const [key,choices] of [['schedule',['fixed','linear','geometric']],['selection',['best','tournament','roulette']],['crossover',['none','single_point','uniform']],['control_hz',[60,30,15]]])if(!choices.includes(clean[key]))throw Error('Invalid '+key);
73
  for(const key of ['adaptive_mutation','collision','idle'])if(typeof clean[key]!=='boolean')throw Error('Invalid '+key);
74
  if(clean.parents>clean.population||clean.elite>clean.population)throw Error('Parents/elites exceed population');
75
+ if(clean.mutation<=0||(clean.schedule!=='fixed'&&clean.mutation_end<=0))throw Error('This training runner requires positive mutation rates, including when continuing an uploaded network');
76
  if(!Array.isArray(clean.rewards)||!clean.rewards.length||clean.rewards.length>5)throw Error('Use one to five rewards');
77
  const seen=new Set();
78
  clean.rewards=clean.rewards.map(r=>{
server.py CHANGED
@@ -8,6 +8,7 @@ from fastapi.responses import FileResponse, Response, HTMLResponse, JSONResponse
8
  from starlette.concurrency import run_in_threadpool
9
  from delivery import create_api, CapacityExceeded
10
  from worker import run_reported
 
11
  from training_config import validate_config
12
  from hf_identity import oauth_config
13
  from builtin_tracks import TrackLibrary
@@ -42,7 +43,7 @@ def create_app(worker=run_reported,store=None,gpu_worker=None,track_library=None
42
  def oauth_script(): return FileResponse(ROOT/'vendor/hf-oauth/index.js',media_type='text/javascript')
43
  @app.get('/api/capabilities')
44
  def capabilities():
45
- return {'cpu':True,'gpu':gpu_worker is not None,'default':'cpu','configurable_training':True}
46
  @app.get('/')
47
  def index():
48
  # Deliver the bootstrap with the authenticated document: private HF
@@ -53,6 +54,8 @@ def create_app(worker=run_reported,store=None,gpu_worker=None,track_library=None
53
  headers={'Referrer-Policy':'no-referrer','Cache-Control':'no-store'})
54
  @app.get('/client.js')
55
  def script(): return FileResponse(ROOT/'client.js',media_type='text/javascript')
 
 
56
  @app.get('/policy')
57
  def policy(): return FileResponse(ROOT/'DATA_POLICY.md',media_type='text/plain')
58
  @app.post('/api/process')
 
8
  from starlette.concurrency import run_in_threadpool
9
  from delivery import create_api, CapacityExceeded
10
  from worker import run_reported
11
+ from build_info import build_identity
12
  from training_config import validate_config
13
  from hf_identity import oauth_config
14
  from builtin_tracks import TrackLibrary
 
43
  def oauth_script(): return FileResponse(ROOT/'vendor/hf-oauth/index.js',media_type='text/javascript')
44
  @app.get('/api/capabilities')
45
  def capabilities():
46
+ return {'cpu':True,'gpu':gpu_worker is not None,'default':'cpu','configurable_training':True,'build':build_identity()}
47
  @app.get('/')
48
  def index():
49
  # Deliver the bootstrap with the authenticated document: private HF
 
54
  headers={'Referrer-Policy':'no-referrer','Cache-Control':'no-store'})
55
  @app.get('/client.js')
56
  def script(): return FileResponse(ROOT/'client.js',media_type='text/javascript')
57
+ @app.get('/feedback')
58
+ def feedback(): return FileResponse(ROOT/'FEEDBACK.md',media_type='text/plain')
59
  @app.get('/policy')
60
  def policy(): return FileResponse(ROOT/'DATA_POLICY.md',media_type='text/plain')
61
  @app.post('/api/process')
training_config.py CHANGED
@@ -27,7 +27,7 @@ def validate_config(value=None):
27
  for key in ('adaptive_mutation','collision','idle'):
28
  if type(c[key]) is not bool:raise ValueError('Invalid '+key)
29
  if c['parents']>c['population'] or c['elite']>c['population']:raise ValueError('Parents/elites exceed population')
30
- if c['schedule']=='geometric' and (not c['mutation'] or not c['mutation_end']):raise ValueError('Geometric rates must be positive')
31
  # Echo the rate actually passed to the native CLI, not an unused form value.
32
  if c['schedule']=='fixed':c['mutation_end']=c['mutation']
33
  rewards=c['rewards']
 
27
  for key in ('adaptive_mutation','collision','idle'):
28
  if type(c[key]) is not bool:raise ValueError('Invalid '+key)
29
  if c['parents']>c['population'] or c['elite']>c['population']:raise ValueError('Parents/elites exceed population')
30
+ if c['mutation']<=0 or (c['schedule']!='fixed' and c['mutation_end']<=0):raise ValueError('This training runner requires positive mutation rates, including when continuing an uploaded network')
31
  # Echo the rate actually passed to the native CLI, not an unused form value.
32
  if c['schedule']=='fixed':c['mutation_end']=c['mutation']
33
  rewards=c['rewards']
worker.py CHANGED
@@ -13,6 +13,7 @@ import subprocess
13
  import tempfile
14
  import time
15
  from training_config import validate_config
 
16
 
17
  MODULE_DIR = Path(__file__).resolve().parent
18
  # Source checkout is nested; a hosted release is flat under /app. Deployment
@@ -134,7 +135,7 @@ def run_native(track_bytes,network_bytes,*,binary=None,importer=None,scene_templ
134
  network_input(result)
135
  history=[json.loads(line) for line in (out/'log.jsonl').read_text().splitlines() if line.strip()]
136
  last=history[-1] if history else {}
137
- report={'state':'completed','elapsed_seconds':time.perf_counter()-started,
138
  'generations_completed':len(history),'generations_requested':config['generations'],'population':config['population'],
139
  'best_score':last.get('best_score'),'mean_score':last.get('mean_score'),
140
  'best_lap_seconds':last.get('best_lap_s'),'lapped_cars':last.get('lapped_cars'),
 
13
  import tempfile
14
  import time
15
  from training_config import validate_config
16
+ from build_info import build_identity
17
 
18
  MODULE_DIR = Path(__file__).resolve().parent
19
  # Source checkout is nested; a hosted release is flat under /app. Deployment
 
135
  network_input(result)
136
  history=[json.loads(line) for line in (out/'log.jsonl').read_text().splitlines() if line.strip()]
137
  last=history[-1] if history else {}
138
+ report={'build':build_identity(),'state':'completed','elapsed_seconds':time.perf_counter()-started,
139
  'generations_completed':len(history),'generations_requested':config['generations'],'population':config['population'],
140
  'best_score':last.get('best_score'),'mean_score':last.get('mean_score'),
141
  'best_lap_seconds':last.get('best_lap_s'),'lapped_cars':last.get('lapped_cars'),