@@ -13,7 +13,7 @@ import type {
1313 StudioWorkspaceView ,
1414} from "@ignitionrl/sdk" ;
1515import { App } from "./App" ;
16- import type { NativeStudioApi } from "./native" ;
16+ import type { NativeIgnitionProjectDirectory , NativeStudioApi } from "./native" ;
1717import { sampleWorkspace } from "./sample-workspace" ;
1818
1919( globalThis as { IS_REACT_ACT_ENVIRONMENT ?: boolean } ) . IS_REACT_ACT_ENVIRONMENT = true ;
@@ -222,6 +222,7 @@ describe("Studio app shell", () => {
222222 } ;
223223 const nativeApi : NativeStudioApi = {
224224 isAvailable : ( ) => true ,
225+ openIgnitionProjectDirectory : async ( ) => undefined ,
225226 openStudioArtifactFile : async ( ) => ( {
226227 path : "/tmp/native-workspace.json" ,
227228 fileName : "native-workspace.json" ,
@@ -253,6 +254,73 @@ describe("Studio app shell", () => {
253254 act ( ( ) => renderer ?. unmount ( ) ) ;
254255 } ) ;
255256
257+ test ( "opens a local IgnitionRL project directory through the native Tauri API" , async ( ) => {
258+ let renderer : ReactTestRenderer | undefined ;
259+ const nativeApi : NativeStudioApi = {
260+ isAvailable : ( ) => true ,
261+ openIgnitionProjectDirectory : async ( ) => nativeProjectDirectory ( ) ,
262+ openStudioArtifactFile : async ( ) => undefined ,
263+ } ;
264+
265+ act ( ( ) => {
266+ renderer = create ( React . createElement ( App , {
267+ initialWorkspace : sampleWorkspace ,
268+ nativeApi,
269+ } ) ) ;
270+ } ) ;
271+
272+ const openButton = renderer ?. root . findByProps ( {
273+ "aria-label" : "Open native project directory" ,
274+ } ) ;
275+
276+ await act ( async ( ) => {
277+ await openButton ?. props . onClick ( ) ;
278+ } ) ;
279+
280+ const text = JSON . stringify ( renderer ?. toJSON ( ) ) ;
281+
282+ expect ( text ) . toContain ( "Native Project Directory" ) ;
283+ expect ( text ) . toContain ( "native-run" ) ;
284+ expect ( text ) . toContain ( "Target2D-v0" ) ;
285+ expect ( text ) . toContain ( "final" ) ;
286+ expect ( text ) . toContain ( "project.ignitionrl" ) ;
287+
288+ act ( ( ) => renderer ?. unmount ( ) ) ;
289+ } ) ;
290+
291+ test ( "shows native project directory validation errors" , async ( ) => {
292+ let renderer : ReactTestRenderer | undefined ;
293+ const nativeApi : NativeStudioApi = {
294+ isAvailable : ( ) => true ,
295+ openIgnitionProjectDirectory : async ( ) => {
296+ throw new Error ( "Selected folder is not an IgnitionRL project: missing ignitionrl.project.json." ) ;
297+ } ,
298+ openStudioArtifactFile : async ( ) => undefined ,
299+ } ;
300+
301+ act ( ( ) => {
302+ renderer = create ( React . createElement ( App , {
303+ initialWorkspace : sampleWorkspace ,
304+ nativeApi,
305+ } ) ) ;
306+ } ) ;
307+
308+ const openButton = renderer ?. root . findByProps ( {
309+ "aria-label" : "Open native project directory" ,
310+ } ) ;
311+
312+ await act ( async ( ) => {
313+ await openButton ?. props . onClick ( ) ;
314+ } ) ;
315+
316+ const text = JSON . stringify ( renderer ?. toJSON ( ) ) ;
317+
318+ expect ( text ) . toContain ( "missing ignitionrl.project.json" ) ;
319+ expect ( text ) . toContain ( "DroneTarget Demo" ) ;
320+
321+ act ( ( ) => renderer ?. unmount ( ) ) ;
322+ } ) ;
323+
256324 test ( "loads another run episode artifact and switches replay plus reward views" , async ( ) => {
257325 let renderer : ReactTestRenderer | undefined ;
258326 const episodeOneView = secondEpisodeRunView ( ) ;
@@ -591,6 +659,115 @@ describe("Studio app shell", () => {
591659 } ) ;
592660} ) ;
593661
662+ function nativeProjectDirectory ( ) : NativeIgnitionProjectDirectory {
663+ const createdAt = "2026-05-28T00:00:00.000Z" ;
664+ const runUpdatedAt = "2026-05-28T00:01:00.000Z" ;
665+
666+ return {
667+ path : "/tmp/project.ignitionrl" ,
668+ directoryName : "project.ignitionrl" ,
669+ byteLength : 2048 ,
670+ manifest : {
671+ schemaVersion : 1 ,
672+ id : "native-project" ,
673+ name : "Native Project Directory" ,
674+ createdAt,
675+ updatedAt : runUpdatedAt ,
676+ environments : [ {
677+ id : "Target2D-v0" ,
678+ packageName : "@ignitionrl/examples" ,
679+ exportName : "Target2D" ,
680+ metadata : {
681+ observationLabels : [ "agent.x" , "agent.y" , "target.x" , "target.y" ] ,
682+ actionLabels : [ "up" , "down" , "left" , "right" ] ,
683+ } ,
684+ } ] ,
685+ } ,
686+ runs : [ {
687+ id : "native-run" ,
688+ path : "runs/native-run" ,
689+ run : {
690+ schemaVersion : 1 ,
691+ id : "native-run" ,
692+ projectId : "native-project" ,
693+ envId : "Target2D-v0" ,
694+ algorithm : "random" ,
695+ status : "completed" ,
696+ createdAt,
697+ updatedAt : runUpdatedAt ,
698+ summary : {
699+ episodes : 1 ,
700+ totalSteps : 1 ,
701+ totalReward : 1 ,
702+ successRate : 1 ,
703+ bestReward : 1 ,
704+ lastReward : 1 ,
705+ } ,
706+ } ,
707+ metrics : [ {
708+ t : 0 ,
709+ episode : 0 ,
710+ values : {
711+ totalReward : 1 ,
712+ success : 1 ,
713+ } ,
714+ createdAt : runUpdatedAt ,
715+ } ] ,
716+ traces : [ {
717+ path : "runs/native-run/traces/episode-0.json" ,
718+ episodeId : "episode-0" ,
719+ contents : {
720+ runId : "native-run" ,
721+ episodeId : "episode-0" ,
722+ envId : "Target2D-v0" ,
723+ seed : 7 ,
724+ startedAt : createdAt ,
725+ steps : [ {
726+ t : 0 ,
727+ observation : [ 0 , 0 , 1 , 0 ] ,
728+ nextObservation : [ 1 , 0 , 1 , 0 ] ,
729+ action : "right" ,
730+ encodedAction : [ 3 ] ,
731+ reward : 1 ,
732+ rewardTerms : {
733+ target_reached : 1 ,
734+ } ,
735+ done : true ,
736+ reason : "target_reached" ,
737+ } ] ,
738+ summary : {
739+ totalReward : 1 ,
740+ length : 1 ,
741+ success : true ,
742+ terminated : true ,
743+ truncated : false ,
744+ reason : "target_reached" ,
745+ } ,
746+ } ,
747+ } ] ,
748+ checkpoints : [ {
749+ path : "runs/native-run/checkpoints/final.json" ,
750+ entry : {
751+ id : "final" ,
752+ runId : "native-run" ,
753+ envId : "Target2D-v0" ,
754+ algorithm : "random" ,
755+ path : "runs/native-run/checkpoints/final.json" ,
756+ createdAt : runUpdatedAt ,
757+ } ,
758+ } ] ,
759+ } ] ,
760+ artifacts : [ {
761+ kind : "episode-replay" ,
762+ path : "exports/runs/native-run/replays/episode-0.json" ,
763+ fileName : "episode-0.json" ,
764+ sizeBytes : 512 ,
765+ modifiedAt : runUpdatedAt ,
766+ runId : "native-run" ,
767+ } ] ,
768+ } ;
769+ }
770+
594771function secondEpisodeRunView ( ) : StudioRunView {
595772 const base = sampleWorkspace . selectedRun ! ;
596773 const episodeId = "drone-target-linear-policy-search-inference:episode:1" ;
0 commit comments