mecha10-core 0.8.0

Mecha10 core runtime and foundational types
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
{
  "$defs": {
    "ActuatorConfig": {
      "properties": {
        "joints": {
          "default": [],
          "items": {
            "$ref": "#/$defs/JointLimitConfig"
          },
          "type": "array"
        },
        "locomotion": {
          "$ref": "#/$defs/LocomotionLimitsConfig",
          "default": {
            "max_acceleration": 8.0,
            "max_angular_vel": 5.0,
            "max_linear_vel": 10.0
          }
        }
      },
      "type": "object"
    },
    "BehaviorsConfig": {
      "description": "Behavior tree configuration controlling autonomous robot behavior execution.",
      "properties": {
        "active": {
          "description": "Name of the active behavior to run (e.g. \"idle-wander\", \"patrol-simple\", \"rl\").",
          "examples": [
            "idle-wander"
          ],
          "type": "string"
        }
      },
      "required": [
        "active"
      ],
      "type": "object"
    },
    "DockerServicesConfig": {
      "description": "Docker services configuration for project-level Docker Compose management",
      "properties": {
        "auto_start": {
          "default": true,
          "description": "Whether to auto-start services in dev mode",
          "examples": [
            true
          ],
          "type": "boolean"
        },
        "compose_file": {
          "default": "docker/docker-compose.yml",
          "description": "Path to docker-compose.yml relative to project root",
          "examples": [
            "docker/docker-compose.yml"
          ],
          "type": "string"
        },
        "remote": {
          "default": [],
          "description": "Services needed for remote execution (Redis + databases, etc.)",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "robot": {
          "default": [],
          "description": "Services needed for on-robot execution (typically just Redis for message passing)",
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "type": "object"
    },
    "EnvironmentConfig": {
      "description": "Configuration for a specific environment",
      "properties": {
        "control_plane": {
          "description": "Control plane base URL for this environment (e.g. \"https://mecha.industries/api\");\ndefaults to the standard control plane URL when omitted.",
          "examples": [
            "https://mecha.industries"
          ],
          "type": [
            "string",
            "null"
          ]
        },
        "logging": {
          "anyOf": [
            {
              "$ref": "#/$defs/LoggingConfig"
            },
            {
              "type": "null"
            }
          ],
          "description": "Per-environment logging overrides, such as whether disk logging is enabled."
        }
      },
      "type": "object"
    },
    "EnvironmentsConfig": {
      "description": "Per-environment configuration (dev, staging, prod), with the active environment selected via\nthe `MECHA10_ENV` environment variable or `--env` flag.",
      "properties": {
        "dev": {
          "$ref": "#/$defs/EnvironmentConfig",
          "default": {},
          "description": "Development environment (local control plane)"
        },
        "prod": {
          "$ref": "#/$defs/EnvironmentConfig",
          "default": {},
          "description": "Production environment (cloud control plane)"
        },
        "staging": {
          "anyOf": [
            {
              "$ref": "#/$defs/EnvironmentConfig"
            },
            {
              "type": "null"
            }
          ],
          "description": "Staging environment (optional)"
        }
      },
      "type": "object"
    },
    "JointLimitConfig": {
      "additionalProperties": false,
      "description": "A single joint's angle limits, keyed by the actuator node's `joint_id` in `mecha10.json`.",
      "properties": {
        "joint_id": {
          "type": "string"
        },
        "max_angle_rad": {
          "format": "float",
          "type": "number"
        },
        "min_angle_rad": {
          "format": "float",
          "type": "number"
        }
      },
      "required": [
        "joint_id",
        "min_angle_rad",
        "max_angle_rad"
      ],
      "type": "object"
    },
    "LocomotionLimitsConfig": {
      "description": "Motion limits for a differential-drive (or similar) locomotion base.",
      "properties": {
        "max_acceleration": {
          "default": 8.0,
          "format": "float",
          "type": "number"
        },
        "max_angular_vel": {
          "default": 5.0,
          "format": "float",
          "type": "number"
        },
        "max_linear_vel": {
          "default": 10.0,
          "format": "float",
          "type": "number"
        }
      },
      "type": "object"
    },
    "LoggingConfig": {
      "description": "Logging configuration for a single environment, controlling whether node logs are written\nto local disk. Remote/network log shipping is independent of this setting.",
      "properties": {
        "disk_logging_enabled": {
          "default": true,
          "description": "Whether node stdout/stderr may be written to local disk, in addition to any remote log\nshipping.",
          "examples": [
            true
          ],
          "type": "boolean"
        }
      },
      "type": "object"
    },
    "NodeRef": {
      "anyOf": [
        {
          "description": "A node running as its default, single instance.",
          "type": "string"
        },
        {
          "description": "A node running as one of several keyed instances of the same node type, and/or with a\n`camera_id` override (video-streamer's relay/diagnostics identity). `instance_id` and\n`camera_id` are independent and either can be set without the other.",
          "properties": {
            "camera_id": {
              "description": "`video-streamer`-specific: which camera this process reports to the relay/dashboard\n(sets `MECHA10_CAMERA_ID` on the spawned process's environment).",
              "type": [
                "string",
                "null"
              ]
            },
            "instance_id": {
              "description": "Which instance of `name` this is (e.g. `real` or `sim`). Optional - a keyed entry\nmay exist purely to set `camera_id` with no need for a distinct process identity.",
              "type": [
                "string",
                "null"
              ]
            },
            "name": {
              "description": "Node identifier (e.g. `@mecha10/camera`).",
              "type": "string"
            }
          },
          "required": [
            "name"
          ],
          "type": "object"
        }
      ],
      "description": "A single entry in a target's node list, either a plain node identifier or a named instance\nfor a node that needs to run as more than one instance under the same target."
    },
    "NodesConfig": {
      "additionalProperties": {
        "type": "string"
      },
      "description": "Map of node identifiers (e.g. `@mecha10/listener`, `my-custom`) to their pinned versions.",
      "type": "object"
    },
    "ProjectSimulationConfig": {
      "description": "Project-level simulation settings, distinct from the runtime simulation config used during\nexecution.",
      "properties": {
        "environment": {
          "description": "Simulation environment name to use for interactive simulation, overriding the default\nenvironment.",
          "examples": [
            "empty_room"
          ],
          "type": [
            "string",
            "null"
          ]
        },
        "model": {
          "description": "Robot model name to use for interactive simulation, overriding the default model.",
          "examples": [
            "rover"
          ],
          "type": [
            "string",
            "null"
          ]
        },
        "preset": {
          "description": "Preset name (under the active environment's `presets/`) to layer onto `mecha10 dev`'s\nplain simulation preview/teleop session. Not consulted for RL training.",
          "examples": [
            "default"
          ],
          "type": [
            "string",
            "null"
          ]
        },
        "scenario": {
          "description": "Optional scenario name selecting which simulation config file to load.",
          "examples": [
            "warehouse"
          ],
          "type": [
            "string",
            "null"
          ]
        }
      },
      "type": "object"
    },
    "TargetEntry": {
      "description": "A single target's configuration: which nodes run on it, and (for `robot`/`remote`/`rl`) which\nRust target triple(s) `mecha10 build` compiles for.",
      "properties": {
        "nodes": {
          "default": [],
          "description": "Nodes that run on this target, either plain node identifiers or named instances of\nmulti-instance nodes.",
          "items": {
            "$ref": "#/$defs/NodeRef"
          },
          "type": "array"
        },
        "platforms": {
          "description": "Rust target triple(s) to build for (e.g. `aarch64-unknown-linux-gnu`); defaults to the\nhost machine's own architecture when unset. Only meaningful for `robot`/`remote`/`rl`.",
          "items": {
            "enum": [
              "x86_64-apple-darwin",
              "aarch64-apple-darwin",
              "x86_64-unknown-linux-gnu",
              "aarch64-unknown-linux-gnu"
            ],
            "type": "string"
          },
          "type": [
            "array",
            "null"
          ]
        }
      },
      "type": "object"
    },
    "TargetsConfig": {
      "description": "Target execution configuration: where nodes run (locally, in simulation, on the robot, or\nremotely), and, for `robot`/`remote`/`rl`, which Rust target triple(s) builds compile for.",
      "properties": {
        "dev": {
          "anyOf": [
            {
              "$ref": "#/$defs/TargetEntry"
            },
            {
              "type": "null"
            }
          ],
          "description": "Nodes that run locally on the developer's machine, in-process, via `mecha10 dev`"
        },
        "remote": {
          "anyOf": [
            {
              "$ref": "#/$defs/TargetEntry"
            },
            {
              "type": "null"
            }
          ],
          "description": "Nodes that run remotely in Docker containers, typically AI/ML nodes with\nplatform-specific dependencies"
        },
        "rl": {
          "anyOf": [
            {
              "$ref": "#/$defs/TargetEntry"
            },
            {
              "type": "null"
            }
          ],
          "description": "Nodes that run as a trained RL policy in production (excludes the simulator) -\nsee `mecha10 run rl`/`mecha10 build rl`."
        },
        "robot": {
          "anyOf": [
            {
              "$ref": "#/$defs/TargetEntry"
            },
            {
              "type": "null"
            }
          ],
          "description": "Nodes that run on the robot as local processes, typically hardware drivers and\nlow-latency control nodes"
        },
        "simulation": {
          "anyOf": [
            {
              "$ref": "#/$defs/TargetEntry"
            },
            {
              "type": "null"
            }
          ],
          "description": "Nodes that run in a simulated environment"
        }
      },
      "type": "object"
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "definitions": {
    "node": {
      "properties": {
        "auto_restart": {
          "default": true,
          "description": "Auto-restart on crash",
          "type": "boolean"
        },
        "config": {
          "description": "Path to node configuration file",
          "type": "string"
        },
        "depends_on": {
          "description": "Node dependencies (other nodes that must start first)",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "description": {
          "description": "Node description",
          "maxLength": 200,
          "type": "string"
        },
        "enabled": {
          "default": true,
          "description": "Whether node is enabled",
          "type": "boolean"
        },
        "name": {
          "description": "Node name (snake_case)",
          "pattern": "^[a-z][a-z0-9_]*$",
          "type": "string"
        },
        "path": {
          "description": "Path to node source code",
          "type": "string"
        },
        "run_target": {
          "description": "Where to run this node - a key of this project's `run_targets` map",
          "type": "string"
        }
      },
      "required": [
        "name",
        "path"
      ],
      "type": "object"
    },
    "runTarget": {
      "properties": {
        "description": {
          "description": "Target description",
          "maxLength": 200,
          "type": "string"
        },
        "includes": {
          "description": "Node groups to include",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "resources": {
          "description": "Resource requirements",
          "properties": {
            "cpu_limit": {
              "description": "CPU limit (e.g., '2.0')",
              "pattern": "^\\d+(\\.\\d+)?$",
              "type": "string"
            },
            "devices": {
              "description": "Required device files (e.g., /dev/video0)",
              "items": {
                "pattern": "^/dev/.+$",
                "type": "string"
              },
              "type": "array"
            },
            "gpu": {
              "description": "GPU requirements",
              "oneOf": [
                {
                  "type": "boolean"
                },
                {
                  "properties": {
                    "count": {
                      "minimum": 1,
                      "type": "integer"
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "optional": {
                      "type": "boolean"
                    },
                    "vendor": {
                      "enum": [
                        "nvidia",
                        "amd",
                        "intel"
                      ],
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              ]
            },
            "memory_limit": {
              "description": "Memory limit (e.g., '512M', '16G')",
              "pattern": "^\\d+(K|M|G|T)?$",
              "type": "string"
            },
            "model_cache": {
              "description": "Path to model cache directory",
              "type": "string"
            },
            "storage_size_gb": {
              "description": "Storage size in GB",
              "minimum": 1,
              "type": "integer"
            },
            "storage_type": {
              "description": "Storage type requirement",
              "enum": [
                "local",
                "ssd",
                "hdd",
                "any"
              ],
              "type": "string"
            }
          },
          "type": "object"
        }
      },
      "type": "object"
    },
    "standardNode": {
      "properties": {
        "binary": {
          "description": "Binary name within package",
          "type": "string"
        },
        "config": {
          "description": "Path to configuration file",
          "type": "string"
        },
        "package": {
          "description": "Package identifier (e.g., @mecha10/speaker)",
          "examples": [
            "@mecha10/speaker"
          ],
          "pattern": "^@[a-z0-9-]+/[a-z0-9/-]+$",
          "type": "string"
        }
      },
      "required": [
        "package",
        "binary"
      ],
      "type": "object"
    }
  },
  "properties": {
    "actuator": {
      "$ref": "#/$defs/ActuatorConfig",
      "default": {
        "joints": [],
        "locomotion": {
          "max_acceleration": 8.0,
          "max_angular_vel": 5.0,
          "max_linear_vel": 10.0
        }
      },
      "description": "Actuator motion limits (linear/angular velocity and acceleration) applied to every node."
    },
    "behaviors": {
      "anyOf": [
        {
          "$ref": "#/$defs/BehaviorsConfig"
        },
        {
          "type": "null"
        }
      ]
    },
    "docker": {
      "$ref": "#/$defs/DockerServicesConfig",
      "default": {
        "auto_start": false,
        "compose_file": "",
        "remote": [],
        "robot": []
      }
    },
    "environments": {
      "$ref": "#/$defs/EnvironmentsConfig",
      "default": {
        "dev": {},
        "prod": {}
      }
    },
    "name": {
      "description": "The project's name; lowercase letters, numbers, and hyphens only, 1-64 characters.",
      "examples": [
        "my-robot"
      ],
      "maxLength": 64,
      "minLength": 1,
      "pattern": "^[a-z0-9][a-z0-9-]*$",
      "type": "string"
    },
    "nodes": {
      "description": "Node definitions (NodesConfig in mecha10-cli-core) - typically a flat identifier -> version map, though the legacy `drivers`/`standard`/`custom` arrays below also validate (no `additionalProperties` restriction). Keys: a framework node's full package id (\"@mecha10/speaker\"), a future registry node (\"@<org>/<name>\"), or a project node's own unprefixed name (\"my-custom\"); the legacy \"@local/*\" prefix is no longer supported.",
      "examples": [
        {
          "@mecha10/motor": "latest",
          "@mecha10/speaker": "latest",
          "my-custom": "0.1.0"
        }
      ],
      "properties": {
        "custom": {
          "description": "Custom application nodes (legacy array form - see this property's own description)",
          "items": {
            "$ref": "#/definitions/node"
          },
          "type": "array"
        },
        "drivers": {
          "description": "Hardware driver nodes (legacy array form - see this property's own description)",
          "items": {
            "$ref": "#/definitions/node"
          },
          "type": "array"
        },
        "standard": {
          "description": "Standard/pre-built nodes from packages (legacy array form - see this property's own description)",
          "items": {
            "$ref": "#/definitions/standardNode"
          },
          "type": "array"
        }
      },
      "type": "object"
    },
    "robot_description": {
      "default": null,
      "type": [
        "string",
        "null"
      ]
    },
    "robot_id": {
      "default": "",
      "description": "The robot's unique identifier.",
      "examples": [
        "robot-001"
      ],
      "pattern": "^[a-zA-Z0-9_\\-${}]+$",
      "type": "string"
    },
    "robot_name": {
      "default": "",
      "description": "Human-facing name for the robot.",
      "examples": [
        "my-robot"
      ],
      "type": "string"
    },
    "robot_platform": {
      "default": null,
      "type": [
        "string",
        "null"
      ]
    },
    "run_targets": {
      "description": "Execution targets (robot, remote, dev, etc.)",
      "patternProperties": {
        "^[a-z][a-z0-9_-]*$": {
          "$ref": "#/definitions/runTarget"
        }
      },
      "type": "object"
    },
    "scripts": {
      "description": "Script shortcuts (npm scripts-like)",
      "patternProperties": {
        "^[a-z][a-z0-9:_-]*$": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "simulation": {
      "anyOf": [
        {
          "$ref": "#/$defs/ProjectSimulationConfig"
        },
        {
          "type": "null"
        }
      ]
    },
    "targets": {
      "$ref": "#/$defs/TargetsConfig",
      "default": {}
    },
    "template_version": {
      "description": "Which published templates release this project's scaffolded files were generated from.",
      "examples": [
        "1.4.0"
      ],
      "type": [
        "string",
        "null"
      ]
    },
    "version": {
      "pattern": "^\\d+\\.\\d+\\.\\d+(-.+)?$",
      "type": "string"
    }
  },
  "required": [
    "name",
    "version"
  ],
  "title": "ProjectConfig",
  "type": "object"
}