nandi/oripublic Fork 0
4166f8fba899b222fab287c398dcab9bf6f6e5c9
Commits
Clone
git clone https://git.rickub.com/nandi/ori.git
git clone ssh://git@rickub.com/nandi/ori.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

forked from bots-garden/ori

launch-ori.applescript · 84 lines · 3.6 KBAppleScript Blame HistoryRaw
✨ Switch the ACP adapter to @agentclientprotocol/claude-agent-acp (template 0.0.2) 5d476ff k33g 19h ago1-- launch-ori.applescript — start (or restart) the "ori" sandbox, wait for the
2-- ori server to answer on the published host port, then open ori-desktop.
3--
4-- Run from a terminal: osascript scripts/launch-ori.applescript
5-- Build a double-clickable app:
6-- osacompile -o "scripts/Launch Ori.app" scripts/launch-ori.applescript
7--
8-- The repository root is derived from this file's location (<repo>/scripts/…);
9-- set repoDirOverride if you move the script or the compiled app elsewhere.
10
11property sandboxName : "ori"
12property templateRef : "k33g/ori:0.0.2"
13property kitPath : "./kits/ori"
14property hostPort : 5555
15property sandboxPort : 8888
16property healthTimeoutSeconds : 90
17property desktopAppRelPath : "ori-desktop/build/bin/ori-desktop.app"
18property repoDirOverride : ""
19
20on run
21 set repoDir to my resolveRepoDir()
22 -- Finder / Spotlight launches get a minimal PATH without Homebrew.
23 set shellPrefix to "export PATH=/opt/homebrew/bin:/usr/local/bin:$PATH; cd " & quoted form of repoDir & "; "
24 set serverURL to "http://localhost:" & hostPort
25 set appPath to repoDir & "/" & desktopAppRelPath
26
27 try
28 do shell script "test -d " & quoted form of appPath
29 on error
30 display alert "ori-desktop.app not found" message "Expected at:" & return & appPath & return & return & "Build it first:" & return & "cd ori-desktop && wails build && xattr -cr build/bin/ori-desktop.app" as critical
31 return
32 end try
33
34 if my sandboxExists(shellPrefix) then
35 -- `sbx run -d --name ori` restarts a stopped sandbox without attaching.
36 -- If it is already running sbx may complain; the health check below
37 -- decides whether that matters, so we only notify here.
38 display notification "Restarting existing sandbox “" & sandboxName & "”…" with title "Ori"
39 try
40 do shell script shellPrefix & "sbx run -d --name " & quoted form of sandboxName
41 on error errMsg
42 display notification "sbx run --name: " & errMsg with title "Ori"
43 end try
44 else
45 display notification "Creating sandbox “" & sandboxName & "” from " & templateRef & "…" with title "Ori"
46 try
47 do shell script shellPrefix & "sbx run -d claude . --template " & quoted form of templateRef & " --kit " & quoted form of kitPath & " --name " & quoted form of sandboxName & " -p " & hostPort & ":" & sandboxPort & "/tcp"
48 on error errMsg
49 display alert "sbx run failed" message errMsg & return & return & "Is Docker Desktop running?" as critical
50 return
51 end try
52 end if
53
54 if my waitForServer(serverURL) then
55 display notification "Server ready at " & serverURL with title "Ori"
56 else
57 display notification "No answer on " & serverURL & "/healthz after " & healthTimeoutSeconds & " s — opening the app anyway. Check: sbx exec ori cat /var/log/sbx-kit-startup.log" with title "Ori"
58 end if
59
60 do shell script "open " & quoted form of appPath
61end run
62
63-- <repo>/scripts/<this file or app> → <repo>
64on resolveRepoDir()
65 if repoDirOverride is not "" then return repoDirOverride
66 set scriptPath to POSIX path of (path to me)
67 return do shell script "d=" & quoted form of scriptPath & "; d=${d%/}; cd \"$(dirname \"$d\")/..\" && pwd"
68end resolveRepoDir
69
70on sandboxExists(shellPrefix)
71 set names to do shell script shellPrefix & "sbx ls -q 2>/dev/null || true"
72 return (paragraphs of names) contains sandboxName
73end sandboxExists
74
75-- Poll GET <url>/healthz every 2 s until it answers 2xx or the budget runs out.
76on waitForServer(serverURL)
77 set attempts to healthTimeoutSeconds div 2
78 try
79 do shell script "for i in $(seq 1 " & attempts & "); do curl -sf -m 2 " & quoted form of (serverURL & "/healthz") & " >/dev/null && exit 0; sleep 2; done; exit 1"
80 return true
81 on error
82 return false
83 end try
84end waitForServer