Repository navigation
Expand file tree
/
Copy pathopenapi.yaml
More file actions
4310 lines (4310 loc) · 179 KB
/
Copy pathopenapi.yaml
File metadata and controls
4310 lines (4310 loc) · 179 KB
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
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.1.0
info:
title: RDK Robot Learning Platform API
version: 1.0.0
description: >-
Versioned control-plane contract for the standalone MicroDuck/RDK Duck
Sim2Real workflow. The legacy /api/sim2real paths are aliases.
servers:
- url: https://example.invalid
description: Replace with the deployment origin.
tags:
- name: service
- name: sso
- name: workspace
- name: runs
- name: telemetry
- name: deployments
- name: devices
- name: board-station
- name: agent
security:
- cookieAuth: []
paths:
/healthz:
get:
tags: [service]
summary: Liveness and dependency summary
operationId: getHealth
security: []
responses:
"200":
description: Service is alive (it may be degraded).
content:
application/json:
schema: { $ref: "#/components/schemas/Health" }
/readyz:
get:
tags: [service]
summary: Readiness probe
operationId: getReadiness
security: []
responses:
"200": { $ref: "#/components/responses/Ready" }
"503": { $ref: "#/components/responses/NotReady" }
/api/sso/session:
get:
tags: [sso]
summary: Current cookie identity or an auth-required challenge
operationId: getSsoSession
security: []
description: >-
Returns 200 with the identity when the site-wide Studio session cookie
is present and valid, otherwise 401 with login-relay availability
(loginRelay.configured and optionally loginRelay.loginPageUrl) so the
workbench can render a direct login form or a redirect.
responses:
"200":
description: Verified identity.
content:
application/json:
schema: { $ref: "#/components/schemas/SsoSessionResponse" }
"401":
description: >-
No valid session; body carries loginRelay availability.
content:
application/json:
schema: { $ref: "#/components/schemas/Error" }
/api/sso/login:
post:
tags: [sso]
summary: Relay credentials to the Studio account center and adopt its cookie
operationId: ssoLogin
security: []
description: >-
Relays a whitelist of login fields to POST /api/sso/direct/login on
the Studio main shell, then adopts only the web-cloud session cookie
it can verify (legacy cookies are dropped). In same-origin
deployments nginx may route the browser directly to the Studio shell
instead, in which case this endpoint is unused. Failed by
sim2RealCsrfMiddleware for cross-site submissions.
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/SsoLoginRequest" }
responses:
"200":
description: Login accepted; session cookie set on the response.
content:
application/json:
schema: { $ref: "#/components/schemas/SsoSessionResponse" }
"400": { description: Login method missing or not in account/sms/email. }
"409": { description: Credentials rejected by the account center. }
"502": { description: Relay transport failure or unusable cookie. }
"503": { description: Cookie secret or relay target not configured. }
/api/sso/logout:
post:
tags: [sso]
summary: Clear the shared session cookie
operationId: ssoLogout
security: []
description: Expires the site-wide session cookie for this service only.
responses:
"200":
description: Cookie cleared.
content:
application/json:
schema:
type: object
required: [ok]
properties:
ok: { const: true }
/api/v1/duck/task-packs/{taskId}/failure-cases:
get:
tags: [workspace]
summary: Read the public seed failure-case pack for a task pack
description: >
Public, immutable seed assets for the first task-pack flywheel. Only
goal-navigation-clear-arena is served today; the route is
unauthenticated so demos can cite it without credentials.
operationId: getTaskPackFailureCases
parameters:
- in: path
name: taskId
required: true
schema: { type: string }
responses:
"200": { description: Failure-case seed entries, content: { application/json: { schema: { type: object } } } }
"404": { description: "Unknown task pack: { ok: false, error: TASK_PACK_NOT_FOUND }" }
"503": { description: "Seed asset unavailable: { ok: false, error: TASK_PACK_ASSET_UNAVAILABLE }" }
/api/v1/duck/overview:
get:
tags: [workspace]
summary: Read the account-scoped workspace snapshot
operationId: getOverview
parameters:
- $ref: "#/components/parameters/ProductId"
responses:
"200":
description: Products, contracts, models, runs, devices and integrations.
content:
application/json:
schema: { $ref: "#/components/schemas/OverviewResponse" }
"401": { $ref: "#/components/responses/AuthRequired" }
/api/v1/duck/workspace-summary:
get:
tags: [workspace]
summary: Read a lightweight workspace summary
operationId: getWorkspaceSummary
description: >-
Returns account-scoped counts and the latest run/deployment projection
for dashboards and assistants. It intentionally omits model manifests,
telemetry layouts and integration probes so it is safe to poll often.
responses:
"200":
description: Lightweight workspace summary.
content:
application/json:
schema:
$ref: "#/components/schemas/WorkspaceSummaryResponse"
"401": { $ref: "#/components/responses/AuthRequired" }
/api/v1/duck/research-loop/summary:
get:
tags: [workspace]
summary: Read aggregate research feedback-loop metrics
operationId: getResearchLoopSummary
description: >-
Returns owner-scoped aggregate metrics for experiment-to-evidence
cycle latency, agent-attributed work, approval-free chains, marginal
returns and current queue/resource walls. It is read-only, excludes
mock runs from cycle measurements, and is never a release gate.
parameters:
- in: query
name: days
schema: { type: integer, minimum: 1, maximum: 365, default: 30 }
description: Look-back window for run-scoped metrics; current walls are not windowed.
responses:
"200":
description: Aggregate research-loop metrics.
content:
application/json:
schema:
type: object
required: [ok, summary]
properties:
ok: { const: true }
summary:
type: object
description: Stable aggregate shape; fields may be extended additively.
"401": { $ref: "#/components/responses/AuthRequired" }
/api/v1/duck/golden-path:
get:
tags: [workspace]
summary: Read the canonical RDK Golden Path state
operationId: getRdkGoldenPath
description: >-
Returns one account-scoped read model for task selection, dataset
readiness, training, evaluation, RDK deployment and board feedback.
The response is read-only and safe to poll while a worker is running.
parameters:
- in: query
name: projectId
schema: { type: string, maxLength: 160 }
- in: query
name: modelId
schema: { type: string, maxLength: 160 }
- in: query
name: taskId
schema: { type: string, maxLength: 160 }
responses:
"200":
description: Canonical six-stage RDK workflow state.
content:
application/json:
schema:
type: object
required: [ok, goldenPath]
properties:
ok: { type: boolean }
goldenPath: { type: object }
"401": { $ref: "#/components/responses/AuthRequired" }
"404": { $ref: "#/components/responses/NotFound" }
/api/v1/duck/audit:
get:
tags: [workspace]
summary: Read the owner-scoped mutation audit trail
operationId: listAuditEvents
parameters:
- in: query
name: limit
schema: { type: integer, minimum: 1, maximum: 2000, default: 200 }
- in: query
name: resourceType
schema: { type: string, maxLength: 80 }
- in: query
name: outcome
schema: { type: string, enum: [succeeded, failed, denied] }
responses:
"200": { description: Audit events, content: { application/json: { schema: { $ref: "#/components/schemas/AuditResponse" } } } }
"401": { $ref: "#/components/responses/AuthRequired" }
/api/v1/duck/audit/health:
get:
tags: [workspace]
summary: Check audit stream availability
operationId: getAuditHealth
responses:
"200": { description: Audit health, content: { application/json: { schema: { $ref: "#/components/schemas/AuditHealthResponse" } } } }
"401": { $ref: "#/components/responses/AuthRequired" }
/api/v1/duck/projects:
get:
tags: [workspace]
summary: List account-scoped learning projects
operationId: listProjects
responses:
"200": { description: Projects, content: { application/json: { schema: { $ref: "#/components/schemas/ProjectsResponse" } } } }
"401": { $ref: "#/components/responses/AuthRequired" }
post:
tags: [workspace]
summary: Create a learning project
operationId: createProject
requestBody:
required: true
content: { application/json: { schema: { $ref: "#/components/schemas/ProjectInput" } } }
responses:
"201": { description: Created, content: { application/json: { schema: { $ref: "#/components/schemas/ProjectResponse" } } } }
"400": { $ref: "#/components/responses/BadRequest" }
"409": { description: Duplicate slug. }
/api/v1/duck/projects/{id}:
parameters: [{ $ref: "#/components/parameters/ProjectId" }]
get:
tags: [workspace]
summary: Read a project with linked datasets and runs
operationId: getProject
responses:
"200": { description: Project detail, content: { application/json: { schema: { $ref: "#/components/schemas/ProjectDetailResponse" } } } }
"404": { $ref: "#/components/responses/NotFound" }
patch:
tags: [workspace]
summary: Update project metadata and asset links
operationId: updateProject
requestBody:
required: true
content: { application/json: { schema: { $ref: "#/components/schemas/ProjectInput" } } }
responses:
"200": { description: Updated, content: { application/json: { schema: { $ref: "#/components/schemas/ProjectResponse" } } } }
"400": { $ref: "#/components/responses/BadRequest" }
/api/v1/duck/projects/{id}/runs/compare:
get:
tags: [runs]
summary: Compare experiment runs in a project
operationId: compareProjectRuns
parameters:
- $ref: "#/components/parameters/ProjectId"
- in: query
name: runIds
schema: { type: string, maxLength: 1024 }
description: Comma-separated run ids; omitted returns the latest 20.
responses:
"200": { description: Comparison rows, content: { application/json: { schema: { $ref: "#/components/schemas/RunComparisonResponse" } } } }
"404": { $ref: "#/components/responses/NotFound" }
/api/v1/duck/datasets:
get:
tags: [workspace]
summary: List dataset metadata references
operationId: listDatasets
responses:
"200": { description: Datasets, content: { application/json: { schema: { $ref: "#/components/schemas/DatasetsResponse" } } } }
post:
tags: [workspace]
summary: Register a dataset metadata reference
operationId: createDataset
requestBody:
required: true
content: { application/json: { schema: { $ref: "#/components/schemas/DatasetInput" } } }
responses:
"201": { description: Created, content: { application/json: { schema: { $ref: "#/components/schemas/DatasetResponse" } } } }
"400": { $ref: "#/components/responses/BadRequest" }
/api/v1/duck/models/validate:
post:
tags: [workspace]
summary: Validate a manifest without persisting it
operationId: validateModelManifest
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/ManifestEnvelope" }
responses:
"200":
description: Validation result (valid may be false).
content:
application/json:
schema: { $ref: "#/components/schemas/ValidationResponse" }
"401": { $ref: "#/components/responses/AuthRequired" }
/api/v1/duck/models:
get:
tags: [workspace]
summary: List account-scoped model manifests
operationId: listModels
responses:
"200":
description: Registered models, including the built-in MicroDuck contract.
content:
application/json:
schema:
type: object
required: [ok, models]
properties:
ok: { const: true }
models: { type: array, items: { $ref: "#/components/schemas/Model" } }
"401": { $ref: "#/components/responses/AuthRequired" }
post:
tags: [workspace]
summary: Register an immutable model manifest
operationId: createModel
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/ManifestEnvelope" }
responses:
"201":
description: Model registered.
content:
application/json:
schema: { $ref: "#/components/schemas/ModelResponse" }
"400": { $ref: "#/components/responses/BadRequest" }
"409": { description: Model version already exists. }
/api/v1/duck/models/{modelId}:
parameters:
- $ref: "#/components/parameters/ModelId"
get:
tags: [workspace]
summary: Read one registered model
operationId: getModel
responses:
"200":
description: Model.
content:
application/json:
schema: { $ref: "#/components/schemas/ModelResponse" }
"404": { $ref: "#/components/responses/NotFound" }
/api/v1/duck/runs:
get:
tags: [runs]
summary: List account-scoped runs
operationId: listRuns
responses:
"200":
description: Recent runs with product and contract provenance.
content:
application/json:
schema:
type: object
required: [ok, runs]
properties:
ok: { const: true }
runs: { type: array, items: { $ref: "#/components/schemas/Run" } }
"401": { $ref: "#/components/responses/AuthRequired" }
post:
tags: [runs]
summary: Start or register a browser, local, RoboGo or contract run
operationId: createRun
parameters:
- $ref: "#/components/parameters/IdempotencyKey"
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/RunRequest" }
responses:
"201":
description: New run.
content: { application/json: { schema: { $ref: "#/components/schemas/RunResponse" } } }
"200":
description: Idempotent replay.
content: { application/json: { schema: { $ref: "#/components/schemas/RunResponse" } } }
"400": { $ref: "#/components/responses/BadRequest" }
"401": { $ref: "#/components/responses/AuthRequired" }
"429": { description: Per-account active-run quota reached. }
/api/v1/duck/runs/{runId}:
parameters:
- $ref: "#/components/parameters/RunId"
get:
tags: [runs]
summary: Read a run and refresh remote status when applicable
operationId: getRun
responses:
"200":
description: Run.
content: { application/json: { schema: { $ref: "#/components/schemas/RunResponse" } } }
"404": { $ref: "#/components/responses/NotFound" }
"503": { description: Status lookup is retryable; last known state is preserved. }
/api/v1/duck/runs/{runId}/reconcile:
post:
tags: [runs]
summary: Attach a confirmed external id without relaunching work
operationId: reconcileRun
parameters:
- $ref: "#/components/parameters/RunId"
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [externalRunId, confirm]
properties:
externalRunId: { type: string }
confirm: { const: true }
responses:
"200":
description: Reconciled run.
content: { application/json: { schema: { $ref: "#/components/schemas/RunResponse" } } }
"400": { $ref: "#/components/responses/BadRequest" }
"409": { description: Run is not reconcilable or the id does not match. }
/api/v1/duck/runs/{runId}/relay/claim:
post:
tags: [runs]
summary: Claim a run submitted by the user's browser Local GPU Agent
operationId: claimRelayRun
parameters:
- $ref: "#/components/parameters/RunId"
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [externalRunId]
properties:
externalRunId: { type: string, maxLength: 120 }
responses:
"200": { description: Relay run claimed. }
"409": { description: Another browser already claimed the run. }
/api/v1/duck/runs/{runId}/relay/sync:
post:
tags: [runs]
summary: Sync status from a browser Local GPU Agent
operationId: syncRelayRun
parameters:
- $ref: "#/components/parameters/RunId"
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [status]
properties:
status: { type: string, enum: [queued, running, completed, failed] }
message: { type: string, maxLength: 500 }
responses:
"200": { description: Relay status accepted. }
"400": { $ref: "#/components/responses/BadRequest" }
/api/v1/duck/runs/{runId}/relay/artifact:
post:
tags: [runs]
summary: Upload a digest-verified artifact from a browser Local GPU Agent
operationId: uploadRelayArtifact
parameters:
- $ref: "#/components/parameters/RunId"
- name: X-Artifact-Sha256
in: header
required: true
schema: { type: string, pattern: "^[a-f0-9]{64}$" }
requestBody:
required: true
content:
application/octet-stream:
schema: { type: string, format: binary }
responses:
"200": { description: Artifact stored after SHA-256 verification. }
"400": { $ref: "#/components/responses/BadRequest" }
"413": { description: Artifact exceeds 50 MiB. }
/api/v1/duck/runs/{runId}/policy.onnx:
get:
tags: [runs]
summary: Download the completed run's ONNX policy bytes for the browser trial
operationId: getRunPolicyOnnx
description: >-
Serves the digest-verified ONNX artifact of a completed, real (non-mock)
local run so the browser trial runs the exact bytes that would be
staged to a board. The browser trial is an operator aid and never
release evidence. The response carries the worker-recomputed
X-Artifact-Sha256 header and is rejected when it diverges from the
ledger's recorded digest.
parameters:
- $ref: "#/components/parameters/RunId"
responses:
"200":
description: ONNX policy bytes.
content:
application/octet-stream:
schema: { type: string, format: binary }
"401": { $ref: "#/components/responses/AuthRequired" }
"404": { description: Run not found or not owned by the account. }
"409":
description: >-
Trial not available: run unfinished, mock, wrong backend, no ONNX
artifact, artifact bytes unreadable, or digest mismatch
(SIM2REAL_POLICY_TRIAL_*).
/api/v1/duck/telemetry:
post:
tags: [telemetry]
summary: Append one ordered telemetry chunk
operationId: appendTelemetry
security:
- cookieAuth: []
- telemetryBearer: []
parameters:
- $ref: "#/components/parameters/IdempotencyKey"
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/TelemetryRequest" }
responses:
"201":
description: Chunk accepted.
content: { application/json: { schema: { $ref: "#/components/schemas/TelemetryResponse" } } }
"200":
description: Idempotent replay.
content: { application/json: { schema: { $ref: "#/components/schemas/TelemetryResponse" } } }
"400": { $ref: "#/components/responses/BadRequest" }
"413": { description: Telemetry quota exceeded. }
"401": { $ref: "#/components/responses/AuthRequired" }
"403": { description: Bearer attestation owner, binding, or source mismatch. }
"409": { description: Idempotency or telemetry sequence conflict. }
/api/v1/duck/runs/{runId}/telemetry:
parameters:
- $ref: "#/components/parameters/RunId"
get:
tags: [telemetry]
summary: List accepted telemetry chunks
operationId: listTelemetry
responses:
"200":
description: Telemetry chunks.
content: { application/json: { schema: { $ref: "#/components/schemas/TelemetryListResponse" } } }
"404": { $ref: "#/components/responses/NotFound" }
post:
tags: [telemetry]
summary: Append a chunk using the run id in the path
operationId: appendRunTelemetry
security:
- cookieAuth: []
- telemetryBearer: []
parameters:
- $ref: "#/components/parameters/IdempotencyKey"
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/TelemetryRequestWithoutRunId" }
responses:
"201":
description: Chunk accepted.
content: { application/json: { schema: { $ref: "#/components/schemas/TelemetryResponse" } } }
"400": { $ref: "#/components/responses/BadRequest" }
"401": { $ref: "#/components/responses/AuthRequired" }
"403": { description: Bearer attestation owner, binding, or source mismatch. }
"409": { description: Idempotency or telemetry sequence conflict. }
/api/v1/duck/runs/{runId}/replay:
get:
tags: [telemetry]
summary: Read the replay summary
operationId: getReplay
parameters:
- $ref: "#/components/parameters/RunId"
responses:
"200":
description: Replay and evaluation summary.
content: { application/json: { schema: { $ref: "#/components/schemas/ReplayResponse" } } }
"404": { $ref: "#/components/responses/NotFound" }
/api/v1/duck/runs/{runId}/logs:
get:
tags: [runs]
summary: Read incremental engine stdout/stderr log lines
operationId: getRunLogs
description: >-
Proxies the local training worker's bounded line ring (scrubbed
stdout/stderr, newest 600 lines / 64 KiB) for a local-backend run.
Lines carry worker-assigned sequence numbers; the `after` query
parameter is a cursor so a poll returns only the new tail. Any job
status may be read — queued runs have no lines yet and terminal runs
keep their final log for post-mortem inspection. RoboGo or mock runs
answer 409: there is no log channel to serve, and the platform never
fabricates one.
parameters:
- $ref: "#/components/parameters/RunId"
- name: after
in: query
required: false
schema: { type: integer, minimum: 0, default: 0 }
description: Only lines with a sequence number greater than this cursor are returned.
responses:
"200":
description: >-
Log lines plus cursor state (`total`, `retainedFrom`, and
`truncated` when the cursor predates the retention window).
content:
application/json:
schema:
type: object
required: [ok, runId, status, total, retainedFrom, lines]
properties:
ok: { type: boolean }
runId: { type: string }
status: { type: string }
total: { type: integer }
retainedFrom: { type: integer }
truncated: { type: boolean }
lines:
type: array
items:
type: object
required: [n, stream, text]
properties:
n: { type: integer, minimum: 1 }
stream: { type: string, enum: [stdout, stderr] }
text: { type: string, maxLength: 2000 }
"401": { $ref: "#/components/responses/AuthRequired" }
"404": { $ref: "#/components/responses/NotFound" }
"409":
description: No log channel (remote runner, mock run, or no external run id).
"503":
description: Worker temporarily unreachable; retryable.
/api/v1/duck/runs/{runId}/replay-video:
parameters:
- $ref: "#/components/parameters/RunId"
post:
tags: [telemetry]
summary: Render the run's camera frames into an MP4 artifact
operationId: renderReplayVideo
description: >-
Encodes the aligned camera frames already accepted in the run's
telemetry into a shareable MP4 (server-side ffmpeg, raw rgb8/bgr8/
mono8 piped in). The video is a rendering of accepted evidence, not
new evidence: only a single-source, fully attested board run
qualifies — mixed or imported runs fail closed with the reason. The
digest and frame count are recorded in the run's metrics; the bytes
are digest-re-verified on every serve. A geometry mismatch across
frames or a missing ffmpeg is refused, never substituted.
responses:
"200":
description: Video rendered; digest, size, frame count, fps, and duration.
content:
application/json:
schema:
type: object
required: [ok, runId, video]
properties:
ok: { type: boolean }
runId: { type: string }
video:
type: object
required: [sha256, sizeBytes, frameCount, fps, durationSeconds, url]
properties:
sha256: { type: string }
sizeBytes: { type: integer }
frameCount: { type: integer }
fps: { type: number }
durationSeconds: { type: number }
url: { type: string }
"401": { $ref: "#/components/responses/AuthRequired" }
"404": { $ref: "#/components/responses/NotFound" }
"409":
description: Not eligible (mixed sources, not attested, no camera frames, or geometry mismatch).
"503":
description: ffmpeg render failed or is unavailable; retryable.
get:
tags: [telemetry]
summary: Download the rendered replay video bytes
operationId: downloadReplayVideo
description: >-
Streams the MP4 rendered by the POST of the same path. Served only
when the run's metrics record a replay video whose sha256 matches the
bytes on disk; a stale or tampered file answers 404 instead of
unverified content.
responses:
"200":
description: MP4 bytes (digest in X-Replay-Video-Sha256).
content:
video/mp4:
schema: { type: string, format: binary }
"401": { $ref: "#/components/responses/AuthRequired" }
"404":
description: Run not found, or no digest-matching rendered video.
/api/v1/duck/runs/{runId}/retraining-advice:
get:
tags: [telemetry]
summary: Read-only drift analysis and optional retraining suggestion
description: >-
Analyzes board telemetry drift (action MAE, done ratio, stale
observation ratio) and returns an advisory verdict plus a pre-filled
training request when retraining is recommended. Read-only: the
flywheel never submits a run; the operator must POST /runs explicitly.
operationId: getRetrainingAdvice
parameters:
- $ref: "#/components/parameters/RunId"
responses:
"200":
description: Advisory verdict, per-signal evidence, and optional suggested training request.
content:
application/json:
schema:
type: object
properties:
ok: { type: boolean }
advice:
type: object
properties:
verdict: { type: string, enum: [retrain-recommended, healthy, insufficient-evidence] }
checkedAt: { type: string, format: date-time }
runId: { type: string }
taskId: { type: string }
boardSamples: { type: integer, minimum: 0 }
summary: { type: string }
note: { type: string }
signals:
type: array
items:
type: object
properties:
id: { type: string }
label: { type: string }
value: { type: [number, "null"] }
threshold: { type: number }
breached: { type: boolean }
evidence: { type: string }
suggestedTraining:
type: object
description: Present only on retrain-recommended; a request body for the operator to submit, never auto-fired.
properties:
taskId: { type: string }
backend: { type: string, enum: [local] }
training:
type: object
properties:
profile: { type: string }
algorithm: { type: string }
"404": { $ref: "#/components/responses/NotFound" }
/api/v1/duck/runs/{runId}/board-sessions:
get:
tags: [telemetry]
summary: Reconstruct board policy sessions from lifecycle events
description: >-
Aggregates the session-started / session-stopped lifecycle markers
carried in board-agent telemetry chunks into one summary per policy
motion session: start/stop times, stop reason, inference statistics,
and the model fingerprint that was active. A session whose stop marker
never arrived (process killed mid-motion) keeps an absent stoppedAt
and is reported as interrupted, never as a clean stop. Sessions are
attested only when every contributing chunk was server-attested;
otherwise they are review-only evidence.
operationId: listBoardSessions
parameters:
- $ref: "#/components/parameters/RunId"
responses:
"200":
description: Board sessions reconstructed from accepted telemetry chunks.
content:
application/json:
schema:
type: object
required: [ok, runId, sessions, count]
properties:
ok: { const: true }
runId: { type: string }
count: { type: integer, minimum: 0 }
sessions:
type: array
items: { $ref: "#/components/schemas/BoardSessionSummary" }
"404": { $ref: "#/components/responses/NotFound" }
/api/v1/duck/runs-correlation:
get:
tags: [telemetry]
summary: SimplerEnv-style sim-real correlation across runs
description: >-
Pairs each non-mock run's simulation-side metric (task-pack nominal
envelope successRate, falling back to the final training progress
recentSuccess) with its real-side telemetry evaluation actionMae, then
reports Pearson r, Spearman rho and the MMRV summary of the signed
relative error. Degenerate inputs (too few pairs, zero variance, no
relative-error pairs) are reported as null with a reason — never as a
fabricated coefficient. Evidence about the evidence chain, not a
release gate. Direction: the sim channel is higher-is-better while the
real channel is lower-is-better, so a NEGATIVE coefficient means the
sim metric preserves the real ranking.
operationId: getRunsCorrelation
responses:
"200":
description: >-
Pair list plus the correlation report; skipped runs are counted by
reason (mock-run, missing-channel).
content:
application/json:
schema:
type: object
required: [ok, methodology, channels, pairs, report]
properties:
ok: { const: true }
methodology: { type: string }
channels:
type: object
properties:
sim: { type: string }
real: { type: string }
directionNote: { type: string }
runCount: { type: integer, minimum: 0 }
skipped:
type: object
additionalProperties: { type: integer, minimum: 0 }
pairs:
type: array
items:
type: object
required: [runId, simValue, realValue]
properties:
runId: { type: string }
simValue: { type: number }
realValue: { type: number }
report:
type: object
required: [pairCount, excludedPairCount, exclusionReasons, minPairs, pearson, spearman, mmrv]
properties:
pairCount: { type: integer, minimum: 0 }
excludedPairCount: { type: integer, minimum: 0 }
exclusionReasons:
type: object
additionalProperties: { type: integer, minimum: 0 }
minPairs: { type: integer, minimum: 2 }
pearson: { $ref: "#/components/schemas/CorrelationStatistic" }
spearman: { $ref: "#/components/schemas/CorrelationStatistic" }
mmrv:
oneOf:
- type: object
required: [mean, median, rms, variance, count]
properties:
mean: { type: number }
median: { type: number }
rms: { type: number }
variance: { type: number }
count: { type: integer, minimum: 1 }
- type: object
required: [value, reason]
properties:
value: { const: null }
reason: { type: string }
/api/v1/duck/runs/{runId}/evaluate:
post:
tags: [telemetry]
summary: Evaluate accepted telemetry against an optional reference
operationId: evaluateRun
parameters:
- $ref: "#/components/parameters/RunId"
requestBody:
content:
application/json:
schema:
type: object
properties:
referenceSamples: { type: array, maxItems: 5000, items: { $ref: "#/components/schemas/TelemetrySample" } }
referenceJsonl: { type: string, maxLength: 2000000 }
responses:
"200":
description: Evaluation.
content: { application/json: { schema: { $ref: "#/components/schemas/EvaluationResponse" } } }
"400": { $ref: "#/components/responses/BadRequest" }
/api/sim2real/agent/plan:
post:
tags: [agent]
summary: Parse a Chinese task into a guarded Sim2Real tool plan
operationId: createSim2RealAgentPlan
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [message]
properties:
message: { type: string, minLength: 1, maxLength: 2000 }
context: { type: object, additionalProperties: true }
responses:
"200": { description: Agent plan. }
"400": { $ref: "#/components/responses/BadRequest" }
/api/sim2real/agent/execute:
post:
tags: [agent]
summary: Start an asynchronous guarded Agent run
operationId: executeSim2RealAgentPlan
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [plan]
properties:
plan: { type: object, additionalProperties: true }
approved: { type: boolean, default: false }
responses:
"202": { description: Run accepted. }
"409": { description: Explicit approval required. }
"429": { description: Per-account or process-wide active Agent run quota reached; retry after completion. }
/api/sim2real/agent/runs/{runId}:
get:
tags: [agent]
summary: Read Agent run status, tool events and evidence
operationId: getSim2RealAgentRun
parameters:
- $ref: "#/components/parameters/RunId"
responses:
"200": { description: Agent run snapshot. }
"404": { $ref: "#/components/responses/NotFound" }
/api/sim2real/agent/capabilities:
get:
tags: [agent]
summary: Discover the capabilities exposed by this deployment
operationId: listSim2RealAgentCapabilities
security: []
description: >-
Public metadata for clients that need to render the Agent surface. The
legacy planner atoms and the DSH catalog are reported separately;
`dsh.capabilities[].bound` is false when a deployment has not supplied a real
product handler. Discovery never grants permission to execute an
operation.
responses:
"200":
description: Capability catalogs and runtime state.
content:
application/json:
schema:
type: object
required: [ok, runtime, capabilities, dsh]
properties:
ok: { const: true }
runtime: { type: string, enum: [legacy, dsh, dsh-configured] }
capabilities:
type: array
items:
type: object
required: [id, description, readOnly]
properties:
id: { type: string }
description: { type: string }
readOnly: { type: boolean }
dsh:
type: object
required: [configured, initialized, capabilities]
properties:
configured: { type: boolean }
initialized: { type: boolean }
imageInput:
type: object
required: [enabled, models, maxImageBytes, maxImageDimension, maxImagePixels, mediaTypes]
properties:
enabled: { type: boolean }