Monkey (%monkey) is an app and agent that binds to eyre and intercepts/relays requests to allow you to:
- inject your code into http responses from other apps (poor man's chrome extension, but for Urbit)
- define and handle custom
web+urbitgraph://
links, so you can actually redirect to your app and then render something relevant
Monkey is used in the background by other apps. For now, there's nothing to do with Monkey as a user, but hopefully one day it will have an app store and management UI for extensions.
You can read the proposal and discuss in the dedicated group on Urbit: ~poster-hoster-midlev-mindyr/monkey
The desk
folder contains all monkey-specific files. base-desk
contains other hoon files from various places.
Tests go in desk/tests
. To run a test, use the test
thread in dojo, e.g.:
-test %%%/monkey/=/tests/lib/monkey ~
Monkey is built primarily using Svelte, Typescript, and Tailwind CSS. Vite ensures that all code and assets are loaded appropriately, bundles the application for distribution and provides a functional dev environment.
To get started using Monkey first you need to run npm install
inside the ui
directory.
To develop you'll need a running ship to point to. If it's running somewhere other than http://localhost:8081
, make a copy of .env
in the ui
directory and name it .env.local
. This file will not be committed. Change VITE_SHIP_URL
to the URL of the ship you would like to point to.
Once your URL is correctly configured, you can run npm run dev
. This will proxy all requests to the ship except for those powering the interface, allowing you to see live data.
Regardless of what you run to develop, Vite will hot-reload code changes as you work so you don't have to constantly refresh.
- Spin up a comet or distribution ship.
- Mount an
%monkey
desk. In Dojo:|merge %monkey our %base
to create a new desk.|mount %monkey
to mount it.- Set
MONKEY_DESK
in.env.local
if the path to your desk is different.
- Create and upload
glob-http
, if applicable (see below) - Install the desk
- From the
ui
folder:npm run install:desk
- From the distribution ship's dojo:
:treaty|unpublish %monkey
- From middleman or distribution ship's dojo:
|commit %monkey
- (if using a comet as a middleman)
|public %monkey
- (if using a comet as a middleman) from the actual distribution ship:
|install ~comet-name %monkey
or|resume %monkey
- (if using a comet as a middleman) from the actual distribution ship:
|pause %monkey
- From the
- Build UI and upload
glob-ames
- Publish the desk from dojo:
:treaty|publish %monkey
Initial Setup:
- Put the line
glob-ames+[~dister-midlev-mindyr 0v0]
indesk.docket-0
if it's not there, where~dister-midlevi-mindyr
is the@p
of the distribution ship.
Every Time:
4. Build the UI with npm run build
in the ui
directory which will bundle all the code and assets into the dist/
folder.
5. Upload the dist/
folder as a glob to your distribution ship. Example url: https://distribution.urbit-ship.com/docket/upload
Initial Setup:
- Spin up a globber ship (comet or fakezod) (or just reuse your dev ship for this).
- Mount an
%globber
desk. In Dojo:|merge %globber our %base
to create a new desk.|mount %globber
to mount it.- Set
GLOBBER_DESK
in.env.local
if the path to your globber desk is different.
Every Time:
3. From the ui
directory, run npm run release
to build the ui, make the glob, and copy it to the globs
folder. The command will also print out the glob hash/id.
4. Copy the string printed by the last step, and paste it into desk.docket-0
.
5. Upload the glob in /globs/
to any publicly available HTTP endpoint that can serve files. This allows the glob to be distributed over HTTP.
6. Once you've uploaded the glob, paste the url into desk/desk.docket-0
. Both the full URL and the hash should be updated to match the glob we just created, on the line that looks like this:
hoon glob-http+['https://bootstrap.urbit.org/glob-0v5.fdf99.nph65.qecq3.ncpjn.q13mb.glob' 0v5.fdf99.nph65.qecq3.ncpjn.q13mb]