mirror of
https://github.com/sigilante/sunrise.git
synced 2024-11-27 09:39:20 +03:00
Revise links.
This commit is contained in:
parent
f3867c55f1
commit
a5ddd2e85b
101
desk-ln/app/sunrise.hoon
Normal file
101
desk-ln/app/sunrise.hoon
Normal file
@ -0,0 +1,101 @@
|
||||
:: /app/sunrise
|
||||
::::
|
||||
::
|
||||
/- *sunrise
|
||||
/+ dbug,
|
||||
default-agent,
|
||||
*sunrise,
|
||||
verb
|
||||
|%
|
||||
+$ versioned-state
|
||||
$% state-0
|
||||
==
|
||||
+$ state-0
|
||||
$: %0
|
||||
values=(list @)
|
||||
==
|
||||
+$ card card:agent:gall
|
||||
--
|
||||
%+ verb &
|
||||
%- agent:dbug
|
||||
=| state-0
|
||||
=* state -
|
||||
^- agent:gall
|
||||
=<
|
||||
|_ =bowl:gall
|
||||
+* this .
|
||||
default ~(. (default-agent this %|) bowl)
|
||||
aux ~(. +> bowl)
|
||||
++ on-init
|
||||
^- [(list card) _this]
|
||||
~& > "%sunrise initialized successfully."
|
||||
:- :~ [%pass /eyre/connect %arvo %e %connect [~ /apps/[dap.bowl]] dap.bowl]
|
||||
==
|
||||
this
|
||||
++ on-save !>(state)
|
||||
++ on-load
|
||||
|= old=vase
|
||||
^- [(list card) _this]
|
||||
:- ^- (list card)
|
||||
~
|
||||
%= this
|
||||
state !<(state-0 old)
|
||||
==
|
||||
++ on-poke
|
||||
|= [=mark =vase]
|
||||
^- [(list card) _this]
|
||||
=^ cards state
|
||||
?+ mark (on-poke:default mark vase)
|
||||
%sunrise-action
|
||||
(take-action !<(action vase))
|
||||
==
|
||||
[cards this]
|
||||
::
|
||||
++ on-peek
|
||||
|= path=(pole knot)
|
||||
^- (unit (unit cage))
|
||||
?+ path (on-peek:default path)
|
||||
[%x %value idx=@ ~] [~ ~ [%noun !>((snag idx.path values))]]
|
||||
[%x %values ~] [~ ~ [%noun !>(values)]]
|
||||
==
|
||||
++ on-watch
|
||||
|= path=(pole knot)
|
||||
^- [(list card) _this]
|
||||
=^ cards state
|
||||
?+ path (on-watch:default path)
|
||||
[%values ~]
|
||||
(send-update %values)
|
||||
==
|
||||
[cards this]
|
||||
++ on-arvo
|
||||
|= [=wire =sign-arvo]
|
||||
^- (quip card _this)
|
||||
?+ sign-arvo (on-arvo:default [wire sign-arvo])
|
||||
[%eyre %bound *]
|
||||
?: accepted.sign-arvo
|
||||
%- (slog leaf+"/apps/{(trip dap.bowl)} bound successfully!" ~)
|
||||
[~ this]
|
||||
%- (slog leaf+"Binding /apps/{(trip dap.bowl)} failed!" ~)
|
||||
[~ this]
|
||||
==
|
||||
++ on-leave on-leave:default
|
||||
++ on-agent on-agent:default
|
||||
++ on-fail on-fail:default
|
||||
--
|
||||
::
|
||||
:: Helper Core
|
||||
::
|
||||
|_ =bowl:gall
|
||||
+* this .
|
||||
default ~(. (default-agent this %|) bowl)
|
||||
++ take-action
|
||||
|= act=action
|
||||
^- [(list card) _state]
|
||||
[~ state]
|
||||
++ send-update
|
||||
|= =term
|
||||
^- [(list card) _state]
|
||||
:- :~ [%give %fact ~ %sunrise-update !>(`update`[%risen values])]
|
||||
==
|
||||
state
|
||||
--
|
2
desk-ln/desk.bill
Normal file
2
desk-ln/desk.bill
Normal file
@ -0,0 +1,2 @@
|
||||
:~ %sunrise
|
||||
==
|
9
desk-ln/desk.docket-0
Normal file
9
desk-ln/desk.docket-0
Normal file
@ -0,0 +1,9 @@
|
||||
:~ title+'Sunrise'
|
||||
info+'A schematic agent to brighten your day.'
|
||||
color+0xe4.9b0f
|
||||
image+''
|
||||
version+[0 0 1]
|
||||
website+'https://urbit.org/'
|
||||
license+'MIT'
|
||||
site+/apps/sunrise
|
||||
==
|
1
desk-ln/desk.ship
Normal file
1
desk-ln/desk.ship
Normal file
@ -0,0 +1 @@
|
||||
~lagrev-nocfep
|
1
desk-ln/lib/dbug.hoon
Symbolic link
1
desk-ln/lib/dbug.hoon
Symbolic link
@ -0,0 +1 @@
|
||||
../../../urbit/pkg/arvo/lib/dbug.hoon
|
1
desk-ln/lib/default-agent.hoon
Symbolic link
1
desk-ln/lib/default-agent.hoon
Symbolic link
@ -0,0 +1 @@
|
||||
../../../urbit/pkg/arvo/lib/default-agent.hoon
|
1
desk-ln/lib/docket.hoon
Symbolic link
1
desk-ln/lib/docket.hoon
Symbolic link
@ -0,0 +1 @@
|
||||
../../../landscape/desk/lib/docket.hoon
|
1
desk-ln/lib/skeleton.hoon
Symbolic link
1
desk-ln/lib/skeleton.hoon
Symbolic link
@ -0,0 +1 @@
|
||||
../../../urbit/pkg/arvo/lib/skeleton.hoon
|
7
desk-ln/lib/sunrise.hoon
Normal file
7
desk-ln/lib/sunrise.hoon
Normal file
@ -0,0 +1,7 @@
|
||||
:: /lib/sunrise
|
||||
::::
|
||||
::
|
||||
/- *sunrise
|
||||
|%
|
||||
++ do-nothing !!
|
||||
--
|
1
desk-ln/lib/verb.hoon
Symbolic link
1
desk-ln/lib/verb.hoon
Symbolic link
@ -0,0 +1 @@
|
||||
../../../urbit/pkg/arvo/lib/verb.hoon
|
1
desk-ln/mar/atom.hoon
Symbolic link
1
desk-ln/mar/atom.hoon
Symbolic link
@ -0,0 +1 @@
|
||||
../../../urbit/pkg/arvo/mar/atom.hoon
|
1
desk-ln/mar/bill.hoon
Symbolic link
1
desk-ln/mar/bill.hoon
Symbolic link
@ -0,0 +1 @@
|
||||
../../../urbit/pkg/arvo/mar/bill.hoon
|
1
desk-ln/mar/docket-0.hoon
Symbolic link
1
desk-ln/mar/docket-0.hoon
Symbolic link
@ -0,0 +1 @@
|
||||
../../../landscape/desk/mar/docket-0.hoon
|
1
desk-ln/mar/hoon.hoon
Symbolic link
1
desk-ln/mar/hoon.hoon
Symbolic link
@ -0,0 +1 @@
|
||||
../../../urbit/pkg/arvo/mar/hoon.hoon
|
1
desk-ln/mar/kelvin.hoon
Symbolic link
1
desk-ln/mar/kelvin.hoon
Symbolic link
@ -0,0 +1 @@
|
||||
../../../urbit/pkg/arvo/mar/kelvin.hoon
|
1
desk-ln/mar/mime.hoon
Symbolic link
1
desk-ln/mar/mime.hoon
Symbolic link
@ -0,0 +1 @@
|
||||
../../../urbit/pkg/arvo/mar/mime.hoon
|
1
desk-ln/mar/noun.hoon
Symbolic link
1
desk-ln/mar/noun.hoon
Symbolic link
@ -0,0 +1 @@
|
||||
../../../urbit/pkg/arvo/mar/noun.hoon
|
1
desk-ln/mar/ship.hoon
Symbolic link
1
desk-ln/mar/ship.hoon
Symbolic link
@ -0,0 +1 @@
|
||||
../../../urbit/pkg/arvo/mar/ship.hoon
|
15
desk-ln/mar/sunrise/action.hoon
Normal file
15
desk-ln/mar/sunrise/action.hoon
Normal file
@ -0,0 +1,15 @@
|
||||
:: /mar/sunrise-action
|
||||
::::
|
||||
::
|
||||
/- sunrise
|
||||
|_ =action:sunrise
|
||||
++ grab
|
||||
|%
|
||||
++ noun action:sunrise
|
||||
--
|
||||
++ grow
|
||||
|%
|
||||
++ noun action
|
||||
--
|
||||
++ grad %noun
|
||||
--
|
15
desk-ln/mar/sunrise/update.hoon
Normal file
15
desk-ln/mar/sunrise/update.hoon
Normal file
@ -0,0 +1,15 @@
|
||||
:: /mar/sunrise-update
|
||||
::::
|
||||
::
|
||||
/- sunrise
|
||||
|_ =update:sunrise
|
||||
++ grab
|
||||
|%
|
||||
++ noun update:sunrise
|
||||
--
|
||||
++ grow
|
||||
|%
|
||||
++ noun update
|
||||
--
|
||||
++ grad %noun
|
||||
--
|
1
desk-ln/mar/txt.hoon
Symbolic link
1
desk-ln/mar/txt.hoon
Symbolic link
@ -0,0 +1 @@
|
||||
../../../urbit/pkg/arvo/mar/txt.hoon
|
1
desk-ln/sur/docket.hoon
Symbolic link
1
desk-ln/sur/docket.hoon
Symbolic link
@ -0,0 +1 @@
|
||||
../../../landscape/desk/sur/docket.hoon
|
11
desk-ln/sur/sunrise.hoon
Normal file
11
desk-ln/sur/sunrise.hoon
Normal file
@ -0,0 +1,11 @@
|
||||
:: /sur/sunrise
|
||||
::::
|
||||
::
|
||||
|%
|
||||
+$ action
|
||||
$% [%rise ~]
|
||||
==
|
||||
+$ update
|
||||
$% [%risen values=(list @)]
|
||||
==
|
||||
--
|
1
desk-ln/sur/verb.hoon
Symbolic link
1
desk-ln/sur/verb.hoon
Symbolic link
@ -0,0 +1 @@
|
||||
../../../urbit/pkg/arvo/sur/verb.hoon
|
2
desk-ln/sys.kelvin
Normal file
2
desk-ln/sys.kelvin
Normal file
@ -0,0 +1,2 @@
|
||||
[%zuse 412]
|
||||
[%zuse 411]
|
@ -1 +0,0 @@
|
||||
../../../urbit/pkg/arvo/lib/dbug.hoon
|
155
desk/lib/dbug.hoon
Normal file
155
desk/lib/dbug.hoon
Normal file
@ -0,0 +1,155 @@
|
||||
:: dbug: agent wrapper for generic debugging tools
|
||||
::
|
||||
:: usage: %-(agent:dbug your-agent)
|
||||
::
|
||||
|%
|
||||
+$ poke
|
||||
$% [%bowl ~]
|
||||
[%state grab=cord]
|
||||
[%incoming =about]
|
||||
[%outgoing =about]
|
||||
==
|
||||
::
|
||||
+$ about
|
||||
$@ ~
|
||||
$% [%ship =ship]
|
||||
[%path =path]
|
||||
[%wire =wire]
|
||||
[%term =term]
|
||||
==
|
||||
::
|
||||
++ agent
|
||||
|= =agent:gall
|
||||
^- agent:gall
|
||||
!.
|
||||
|_ =bowl:gall
|
||||
+* this .
|
||||
ag ~(. agent bowl)
|
||||
::
|
||||
++ on-poke
|
||||
|= [=mark =vase]
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
?. ?=(%dbug mark)
|
||||
=^ cards agent (on-poke:ag mark vase)
|
||||
[cards this]
|
||||
=/ dbug
|
||||
!<(poke vase)
|
||||
=; =tang
|
||||
((%*(. slog pri 1) tang) [~ this])
|
||||
?- -.dbug
|
||||
%bowl [(sell !>(bowl))]~
|
||||
::
|
||||
%state
|
||||
=? grab.dbug =('' grab.dbug) '-'
|
||||
=; product=^vase
|
||||
[(sell product)]~
|
||||
=/ state=^vase
|
||||
:: if the underlying app has implemented a /dbug/state scry endpoint,
|
||||
:: use that vase in place of +on-save's.
|
||||
::
|
||||
=/ result=(each ^vase tang)
|
||||
(mule |.(q:(need (need (on-peek:ag /x/dbug/state)))))
|
||||
?:(?=(%& -.result) p.result on-save:ag)
|
||||
%+ slap
|
||||
(slop state !>([bowl=bowl ..zuse]))
|
||||
(ream grab.dbug)
|
||||
::
|
||||
%incoming
|
||||
=; =tang
|
||||
?^ tang tang
|
||||
[%leaf "no matching subscriptions"]~
|
||||
%+ murn
|
||||
%+ sort ~(tap by sup.bowl)
|
||||
|= [[* a=[=ship =path]] [* b=[=ship =path]]]
|
||||
(aor [path ship]:a [path ship]:b)
|
||||
|= [=duct [=ship =path]]
|
||||
^- (unit tank)
|
||||
=; relevant=?
|
||||
?. relevant ~
|
||||
`>[path=path from=ship duct=duct]<
|
||||
?: ?=(~ about.dbug) &
|
||||
?- -.about.dbug
|
||||
%ship =(ship ship.about.dbug)
|
||||
%path ?=(^ (find path.about.dbug path))
|
||||
%wire %+ lien duct
|
||||
|=(=wire ?=(^ (find wire.about.dbug wire)))
|
||||
%term !!
|
||||
==
|
||||
::
|
||||
%outgoing
|
||||
=; =tang
|
||||
?^ tang tang
|
||||
[%leaf "no matching subscriptions"]~
|
||||
%+ murn
|
||||
%+ sort ~(tap by wex.bowl)
|
||||
|= [[[a=wire *] *] [[b=wire *] *]]
|
||||
(aor a b)
|
||||
|= [[=wire =ship =term] [acked=? =path]]
|
||||
^- (unit tank)
|
||||
=; relevant=?
|
||||
?. relevant ~
|
||||
`>[wire=wire agnt=[ship term] path=path ackd=acked]<
|
||||
?: ?=(~ about.dbug) &
|
||||
?- -.about.dbug
|
||||
%ship =(ship ship.about.dbug)
|
||||
%path ?=(^ (find path.about.dbug path))
|
||||
%wire ?=(^ (find wire.about.dbug wire))
|
||||
%term =(term term.about.dbug)
|
||||
==
|
||||
==
|
||||
::
|
||||
++ on-peek
|
||||
|= =path
|
||||
^- (unit (unit cage))
|
||||
?. ?=([@ %dbug *] path)
|
||||
(on-peek:ag path)
|
||||
?+ path [~ ~]
|
||||
[%u %dbug ~] ``noun+!>(&)
|
||||
[%x %dbug %state ~] ``noun+!>(on-save:ag)
|
||||
[%x %dbug %subscriptions ~] ``noun+!>([wex sup]:bowl)
|
||||
==
|
||||
::
|
||||
++ on-init
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
=^ cards agent on-init:ag
|
||||
[cards this]
|
||||
::
|
||||
++ on-save on-save:ag
|
||||
::
|
||||
++ on-load
|
||||
|= old-state=vase
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
=^ cards agent (on-load:ag old-state)
|
||||
[cards this]
|
||||
::
|
||||
++ on-watch
|
||||
|= =path
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
=^ cards agent (on-watch:ag path)
|
||||
[cards this]
|
||||
::
|
||||
++ on-leave
|
||||
|= =path
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
=^ cards agent (on-leave:ag path)
|
||||
[cards this]
|
||||
::
|
||||
++ on-agent
|
||||
|= [=wire =sign:agent:gall]
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
=^ cards agent (on-agent:ag wire sign)
|
||||
[cards this]
|
||||
::
|
||||
++ on-arvo
|
||||
|= [=wire =sign-arvo]
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
=^ cards agent (on-arvo:ag wire sign-arvo)
|
||||
[cards this]
|
||||
::
|
||||
++ on-fail
|
||||
|= [=term =tang]
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
=^ cards agent (on-fail:ag term tang)
|
||||
[cards this]
|
||||
--
|
||||
--
|
@ -1 +0,0 @@
|
||||
../../../urbit/pkg/arvo/lib/default-agent.hoon
|
69
desk/lib/default-agent.hoon
Normal file
69
desk/lib/default-agent.hoon
Normal file
@ -0,0 +1,69 @@
|
||||
/+ skeleton
|
||||
|* [agent=* help=*]
|
||||
?: ?=(%& help)
|
||||
~| %default-agent-helpfully-crashing
|
||||
skeleton
|
||||
|_ =bowl:gall
|
||||
++ on-init
|
||||
`agent
|
||||
::
|
||||
++ on-save
|
||||
!>(~)
|
||||
::
|
||||
++ on-load
|
||||
|= old-state=vase
|
||||
`agent
|
||||
::
|
||||
++ on-poke
|
||||
|= =cage
|
||||
~| "unexpected poke to {<dap.bowl>} with mark {<p.cage>}"
|
||||
!!
|
||||
::
|
||||
++ on-watch
|
||||
|= =path
|
||||
~| "unexpected subscription to {<dap.bowl>} on path {<path>}"
|
||||
!!
|
||||
::
|
||||
++ on-leave
|
||||
|= path
|
||||
`agent
|
||||
::
|
||||
++ on-peek
|
||||
|= =path
|
||||
~| "unexpected scry into {<dap.bowl>} on path {<path>}"
|
||||
!!
|
||||
::
|
||||
++ on-agent
|
||||
|= [=wire =sign:agent:gall]
|
||||
^- (quip card:agent:gall _agent)
|
||||
?- -.sign
|
||||
%poke-ack
|
||||
?~ p.sign
|
||||
`agent
|
||||
%- (slog leaf+"poke failed from {<dap.bowl>} on wire {<wire>}" u.p.sign)
|
||||
`agent
|
||||
::
|
||||
%watch-ack
|
||||
?~ p.sign
|
||||
`agent
|
||||
=/ =tank leaf+"subscribe failed from {<dap.bowl>} on wire {<wire>}"
|
||||
%- (slog tank u.p.sign)
|
||||
`agent
|
||||
::
|
||||
%kick `agent
|
||||
%fact
|
||||
~| "unexpected subscription update to {<dap.bowl>} on wire {<wire>}"
|
||||
~| "with mark {<p.cage.sign>}"
|
||||
!!
|
||||
==
|
||||
::
|
||||
++ on-arvo
|
||||
|= [=wire =sign-arvo]
|
||||
~| "unexpected system response {<-.sign-arvo>} to {<dap.bowl>} on wire {<wire>}"
|
||||
!!
|
||||
::
|
||||
++ on-fail
|
||||
|= [=term =tang]
|
||||
%- (slog leaf+"error in {<dap.bowl>}" >term< tang)
|
||||
`agent
|
||||
--
|
@ -1 +0,0 @@
|
||||
../../../landscape/desk/lib/docket.hoon
|
223
desk/lib/docket.hoon
Normal file
223
desk/lib/docket.hoon
Normal file
@ -0,0 +1,223 @@
|
||||
/- *docket
|
||||
|%
|
||||
::
|
||||
++ mime
|
||||
|%
|
||||
+$ draft
|
||||
$: title=(unit @t)
|
||||
info=(unit @t)
|
||||
color=(unit @ux)
|
||||
glob-http=(unit [=url hash=@uvH])
|
||||
glob-ames=(unit [=ship hash=@uvH])
|
||||
base=(unit term)
|
||||
site=(unit path)
|
||||
image=(unit url)
|
||||
version=(unit version)
|
||||
website=(unit url)
|
||||
license=(unit cord)
|
||||
==
|
||||
::
|
||||
++ finalize
|
||||
|= =draft
|
||||
^- (unit docket)
|
||||
?~ title.draft ~
|
||||
?~ info.draft ~
|
||||
?~ color.draft ~
|
||||
?~ version.draft ~
|
||||
?~ website.draft ~
|
||||
?~ license.draft ~
|
||||
=/ href=(unit href)
|
||||
?^ site.draft `[%site u.site.draft]
|
||||
?~ base.draft ~
|
||||
?^ glob-http.draft
|
||||
`[%glob u.base hash.u.glob-http %http url.u.glob-http]:draft
|
||||
?~ glob-ames.draft
|
||||
~
|
||||
`[%glob u.base hash.u.glob-ames %ames ship.u.glob-ames]:draft
|
||||
?~ href ~
|
||||
=, draft
|
||||
:- ~
|
||||
:* %1
|
||||
u.title
|
||||
u.info
|
||||
u.color
|
||||
u.href
|
||||
image
|
||||
u.version
|
||||
u.website
|
||||
u.license
|
||||
==
|
||||
::
|
||||
++ from-clauses
|
||||
=| =draft
|
||||
|= cls=(list clause)
|
||||
^- (unit docket)
|
||||
=* loop $
|
||||
?~ cls (finalize draft)
|
||||
=* clause i.cls
|
||||
=. draft
|
||||
?- -.clause
|
||||
%title draft(title `title.clause)
|
||||
%info draft(info `info.clause)
|
||||
%color draft(color `color.clause)
|
||||
%glob-http draft(glob-http `[url hash]:clause)
|
||||
%glob-ames draft(glob-ames `[ship hash]:clause)
|
||||
%base draft(base `base.clause)
|
||||
%site draft(site `path.clause)
|
||||
%image draft(image `url.clause)
|
||||
%version draft(version `version.clause)
|
||||
%website draft(website `website.clause)
|
||||
%license draft(license `license.clause)
|
||||
==
|
||||
loop(cls t.cls)
|
||||
::
|
||||
++ to-clauses
|
||||
|= d=docket
|
||||
^- (list clause)
|
||||
%- zing
|
||||
:~ :~ title+title.d
|
||||
info+info.d
|
||||
color+color.d
|
||||
version+version.d
|
||||
website+website.d
|
||||
license+license.d
|
||||
==
|
||||
?~ image.d ~ ~[image+u.image.d]
|
||||
?: ?=(%site -.href.d) ~[site+path.href.d]
|
||||
=/ ref=glob-reference glob-reference.href.d
|
||||
:~ base+base.href.d
|
||||
?- -.location.ref
|
||||
%http [%glob-http url.location.ref hash.ref]
|
||||
%ames [%glob-ames ship.location.ref hash.ref]
|
||||
== == ==
|
||||
::
|
||||
++ spit-clause
|
||||
|= =clause
|
||||
^- tape
|
||||
%+ weld " {(trip -.clause)}+"
|
||||
?+ -.clause "'{(trip +.clause)}'"
|
||||
%color (scow %ux color.clause)
|
||||
%site (spud path.clause)
|
||||
::
|
||||
%glob-http
|
||||
"['{(trip url.clause)}' {(scow %uv hash.clause)}]"
|
||||
::
|
||||
%glob-ames
|
||||
"[{(scow %p ship.clause)} {(scow %uv hash.clause)}]"
|
||||
::
|
||||
%version
|
||||
=, version.clause
|
||||
"[{(scow %ud major)} {(scow %ud minor)} {(scow %ud patch)}]"
|
||||
==
|
||||
::
|
||||
++ spit-docket
|
||||
|= dock=docket
|
||||
^- tape
|
||||
;: welp
|
||||
":~\0a"
|
||||
`tape`(zing (join "\0a" (turn (to-clauses dock) spit-clause)))
|
||||
"\0a=="
|
||||
==
|
||||
--
|
||||
::
|
||||
++ enjs
|
||||
=, enjs:format
|
||||
|%
|
||||
::
|
||||
++ charge-update
|
||||
|= u=^charge-update
|
||||
^- json
|
||||
%+ frond -.u
|
||||
^- json
|
||||
?- -.u
|
||||
%del-charge s+desk.u
|
||||
::
|
||||
%initial
|
||||
%- pairs
|
||||
%+ turn ~(tap by initial.u)
|
||||
|=([=desk c=^charge] [desk (charge c)])
|
||||
::
|
||||
%add-charge
|
||||
%- pairs
|
||||
:~ desk+s+desk.u
|
||||
charge+(charge charge.u)
|
||||
==
|
||||
==
|
||||
::
|
||||
++ num
|
||||
|= a=@u
|
||||
^- ^tape
|
||||
=/ p=json (numb a)
|
||||
?> ?=(%n -.p)
|
||||
(trip p.p)
|
||||
::
|
||||
++ version
|
||||
|= v=^version
|
||||
^- json
|
||||
:- %s
|
||||
%- crip
|
||||
"{(num major.v)}.{(num minor.v)}.{(num patch.v)}"
|
||||
::
|
||||
++ merge
|
||||
|= [a=json b=json]
|
||||
^- json
|
||||
?> &(?=(%o -.a) ?=(%o -.b))
|
||||
[%o (~(uni by p.a) p.b)]
|
||||
::
|
||||
++ href
|
||||
|= h=^href
|
||||
%+ frond -.h
|
||||
?- -.h
|
||||
%site s+(spat path.h)
|
||||
%glob
|
||||
%- pairs
|
||||
:~ base+s+base.h
|
||||
glob-reference+(glob-reference glob-reference.h)
|
||||
==
|
||||
==
|
||||
::
|
||||
++ glob-reference
|
||||
|= ref=^glob-reference
|
||||
%- pairs
|
||||
:~ hash+s+(scot %uv hash.ref)
|
||||
location+(glob-location location.ref)
|
||||
==
|
||||
::
|
||||
++ glob-location
|
||||
|= loc=^glob-location
|
||||
^- json
|
||||
%+ frond -.loc
|
||||
?- -.loc
|
||||
%http s+url.loc
|
||||
%ames s+(scot %p ship.loc)
|
||||
==
|
||||
::
|
||||
++ charge
|
||||
|= c=^charge
|
||||
%+ merge (docket docket.c)
|
||||
%- pairs
|
||||
:~ chad+(chad chad.c)
|
||||
==
|
||||
::
|
||||
++ docket
|
||||
|= d=^docket
|
||||
^- json
|
||||
%- pairs
|
||||
:~ title+s+title.d
|
||||
info+s+info.d
|
||||
color+s+(scot %ux color.d)
|
||||
href+(href href.d)
|
||||
image+?~(image.d ~ s+u.image.d)
|
||||
version+(version version.d)
|
||||
license+s+license.d
|
||||
website+s+website.d
|
||||
==
|
||||
::
|
||||
++ chad
|
||||
|= c=^chad
|
||||
%+ frond -.c
|
||||
?+ -.c ~
|
||||
%hung s+err.c
|
||||
==
|
||||
--
|
||||
--
|
@ -1 +0,0 @@
|
||||
../../../urbit/pkg/arvo/lib/skeleton.hoon
|
51
desk/lib/skeleton.hoon
Normal file
51
desk/lib/skeleton.hoon
Normal file
@ -0,0 +1,51 @@
|
||||
:: Similar to default-agent except crashes everywhere
|
||||
^- agent:gall
|
||||
|_ bowl:gall
|
||||
++ on-init
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
!!
|
||||
::
|
||||
++ on-save
|
||||
^- vase
|
||||
!!
|
||||
::
|
||||
++ on-load
|
||||
|~ old-state=vase
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
!!
|
||||
::
|
||||
++ on-poke
|
||||
|~ in-poke-data=cage
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
!!
|
||||
::
|
||||
++ on-watch
|
||||
|~ path
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
!!
|
||||
::
|
||||
++ on-leave
|
||||
|~ path
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
!!
|
||||
::
|
||||
++ on-peek
|
||||
|~ path
|
||||
^- (unit (unit cage))
|
||||
!!
|
||||
::
|
||||
++ on-agent
|
||||
|~ [wire sign:agent:gall]
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
!!
|
||||
::
|
||||
++ on-arvo
|
||||
|~ [wire =sign-arvo]
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
!!
|
||||
::
|
||||
++ on-fail
|
||||
|~ [term tang]
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
!!
|
||||
--
|
@ -1 +0,0 @@
|
||||
../../../urbit/pkg/arvo/lib/verb.hoon
|
182
desk/lib/verb.hoon
Normal file
182
desk/lib/verb.hoon
Normal file
@ -0,0 +1,182 @@
|
||||
:: Print what your agent is doing.
|
||||
::
|
||||
/- *verb
|
||||
::
|
||||
|= [loud=? =agent:gall]
|
||||
=| bowl-print=_|
|
||||
^- agent:gall
|
||||
|^ !.
|
||||
|_ =bowl:gall
|
||||
+* this .
|
||||
ag ~(. agent bowl)
|
||||
::
|
||||
++ on-init
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
%- (print bowl |.("{<dap.bowl>}: on-init"))
|
||||
=^ cards agent on-init:ag
|
||||
:_ this
|
||||
:_ :_ cards
|
||||
(emit-event %on-init ~)
|
||||
(emit-event-plus bowl [%on-init ~] cards)
|
||||
::
|
||||
++ on-save
|
||||
^- vase
|
||||
%- (print bowl |.("{<dap.bowl>}: on-save"))
|
||||
on-save:ag
|
||||
::
|
||||
++ on-load
|
||||
|= old-state=vase
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
%- (print bowl |.("{<dap.bowl>}: on-load"))
|
||||
=^ cards agent (on-load:ag old-state)
|
||||
:_ this
|
||||
:_ :_ cards
|
||||
(emit-event %on-load ~)
|
||||
(emit-event-plus bowl [%on-load ~] cards)
|
||||
::
|
||||
++ on-poke
|
||||
|= [=mark =vase]
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
%- (print bowl |.("{<dap.bowl>}: on-poke with mark {<mark>}"))
|
||||
?: ?=(%verb mark)
|
||||
?- !<(?(%loud %bowl) vase)
|
||||
%loud `this(loud !loud)
|
||||
%bowl `this(bowl-print !bowl-print)
|
||||
==
|
||||
=^ cards agent (on-poke:ag mark vase)
|
||||
:_ this
|
||||
:_ :_ cards
|
||||
(emit-event %on-poke mark)
|
||||
(emit-event-plus bowl [%on-poke mark (mug q.vase)] cards)
|
||||
::
|
||||
++ on-watch
|
||||
|= =path
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
%- (print bowl |.("{<dap.bowl>}: on-watch on path {<path>}"))
|
||||
=^ cards agent
|
||||
?: ?=([%verb ?(%events %events-plus) ~] path)
|
||||
[~ agent]
|
||||
(on-watch:ag path)
|
||||
:_ this
|
||||
:_ :_ cards
|
||||
(emit-event %on-watch path)
|
||||
(emit-event-plus bowl [%on-watch path] cards)
|
||||
::
|
||||
++ on-leave
|
||||
|= =path
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
%- (print bowl |.("{<dap.bowl>}: on-leave on path {<path>}"))
|
||||
?: ?=([%verb %event ~] path)
|
||||
[~ this]
|
||||
=^ cards agent (on-leave:ag path)
|
||||
:_ this
|
||||
:_ :_ cards
|
||||
(emit-event %on-leave path)
|
||||
(emit-event-plus bowl [%on-leave path] cards)
|
||||
::
|
||||
++ on-peek
|
||||
|= =path
|
||||
^- (unit (unit cage))
|
||||
%- (print bowl |.("{<dap.bowl>}: on-peek on path {<path>}"))
|
||||
(on-peek:ag path)
|
||||
::
|
||||
++ on-agent
|
||||
|= [=wire =sign:agent:gall]
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
%- (print bowl |.("{<dap.bowl>}: on-agent on wire {<wire>}, {<-.sign>}"))
|
||||
=^ cards agent (on-agent:ag wire sign)
|
||||
:_ this
|
||||
:_ :_ cards
|
||||
(emit-event %on-agent wire -.sign)
|
||||
=; =^sign
|
||||
(emit-event-plus bowl [%on-agent wire sign] cards)
|
||||
?- -.sign
|
||||
%poke-ack [%poke-ack ?=(~ p.sign)]
|
||||
%watch-ack [%watch-ack ?=(~ p.sign)]
|
||||
%kick [%kick ~]
|
||||
%fact [%fact p.cage.sign (mug q.q.cage.sign)]
|
||||
==
|
||||
::
|
||||
++ on-arvo
|
||||
|= [=wire =sign-arvo]
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
%- %+ print bowl |.
|
||||
"{<dap.bowl>}: on-arvo on wire {<wire>}, {<[- +<]:sign-arvo>}"
|
||||
=^ cards agent (on-arvo:ag wire sign-arvo)
|
||||
:_ this
|
||||
:_ :_ cards
|
||||
(emit-event %on-arvo wire [- +<]:sign-arvo)
|
||||
(emit-event-plus bowl [%on-arvo wire [- +<]:sign-arvo] cards)
|
||||
::
|
||||
++ on-fail
|
||||
|= [=term =tang]
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
%- (print bowl |.("{<dap.bowl>}: on-fail with term {<term>}"))
|
||||
=^ cards agent (on-fail:ag term tang)
|
||||
:_ this
|
||||
:_ :_ cards
|
||||
(emit-event %on-fail term)
|
||||
(emit-event-plus bowl [%on-fail term] cards)
|
||||
--
|
||||
::
|
||||
++ print
|
||||
|= [=bowl:gall render=(trap tape)]
|
||||
^+ same
|
||||
=? . bowl-print
|
||||
%- (slog >bowl< ~)
|
||||
.
|
||||
?. loud same
|
||||
%- (slog [%leaf $:render] ~)
|
||||
same
|
||||
::
|
||||
++ emit-event
|
||||
|= =event
|
||||
^- card:agent:gall
|
||||
[%give %fact ~[/verb/events] %verb-event !>(event)]
|
||||
::
|
||||
++ emit-event-plus
|
||||
|= [=bowl:gall =cause cards=(list card:agent:gall)]
|
||||
^- card:agent:gall
|
||||
=; event=event-plus
|
||||
[%give %fact ~[/verb/events-plus] %verb-event-plus !>(event)]
|
||||
=- [act.bowl now.bowl src.bowl sap.bowl cause -]
|
||||
%+ turn cards
|
||||
|= =card:agent:gall
|
||||
^- effect
|
||||
::TODO for %fact, %kick, could calculate how many ships affected
|
||||
?- card
|
||||
[%pass * %agent * ?(%poke %poke-as) *]
|
||||
=, q.card
|
||||
=/ =cage ?-(-.task.q.card %poke cage.task, %poke-as [mark.task q.cage.task])
|
||||
[%poke p.card [ship name] p.cage `@`(mug q.q.cage)]
|
||||
::
|
||||
[%pass * %agent * ?(%watch %watch-as) *]
|
||||
=, q.card
|
||||
=/ =path ?-(-.task.q.card %watch path.task, %watch-as path.task)
|
||||
[%watch p.card [ship name] path]
|
||||
::
|
||||
[%pass * %agent * %leave *]
|
||||
=, q.card
|
||||
[%leave p.card [ship name]]
|
||||
::
|
||||
[%give %fact *]
|
||||
=, p.card
|
||||
[%fact paths p.cage (mug q.q.cage)]
|
||||
::
|
||||
[%give %kick *]
|
||||
[%kick paths.p.card]
|
||||
::
|
||||
[%give ?(%poke-ack %watch-ack) *]
|
||||
~| %explicit-ack
|
||||
!! :: shouldn't be given explicitly
|
||||
::
|
||||
[%pass * %arvo *]
|
||||
[%arvo p.card -.q.card +<.q.card]
|
||||
::
|
||||
[%pass *]
|
||||
[%arvo p.card %$ -.q.card]
|
||||
::
|
||||
[%slip *]
|
||||
$(card [%pass //slip p.card])
|
||||
==
|
||||
--
|
@ -1 +0,0 @@
|
||||
../../../urbit/pkg/arvo/mar/atom.hoon
|
18
desk/mar/atom.hoon
Normal file
18
desk/mar/atom.hoon
Normal file
@ -0,0 +1,18 @@
|
||||
::
|
||||
:::: /hoon/atom/mar
|
||||
::
|
||||
/? 310
|
||||
::
|
||||
:::: A minimal atom mark
|
||||
::
|
||||
=, mimes:html
|
||||
|_ ato=@
|
||||
++ grab |%
|
||||
++ noun @
|
||||
++ mime |=([* p=octs] q.p)
|
||||
--
|
||||
++ grow |%
|
||||
++ mime [/application/x-urb-unknown (as-octs ato)]
|
||||
--
|
||||
++ grad %mime
|
||||
--
|
@ -1 +0,0 @@
|
||||
../../../urbit/pkg/arvo/mar/bill.hoon
|
34
desk/mar/bill.hoon
Normal file
34
desk/mar/bill.hoon
Normal file
@ -0,0 +1,34 @@
|
||||
|_ bil=(list dude:gall)
|
||||
++ grow
|
||||
|%
|
||||
++ mime `^mime`[/text/x-bill (as-octs:mimes:html hoon)]
|
||||
++ noun bil
|
||||
++ hoon
|
||||
^- @t
|
||||
|^ (crip (of-wall:format (wrap-lines (spit-duz bil))))
|
||||
::
|
||||
++ wrap-lines
|
||||
|= taz=wall
|
||||
^- wall
|
||||
?~ taz ["~"]~
|
||||
:- (weld ":~ " i.taz)
|
||||
%- snoc :_ "=="
|
||||
(turn t.taz |=(t=tape (weld " " t)))
|
||||
::
|
||||
++ spit-duz
|
||||
|= duz=(list dude:gall)
|
||||
^- wall
|
||||
(turn duz |=(=dude:gall ['%' (trip dude)]))
|
||||
--
|
||||
++ txt (to-wain:format hoon)
|
||||
--
|
||||
++ grab
|
||||
|%
|
||||
++ noun (list dude:gall)
|
||||
++ mime
|
||||
|= [=mite len=@ud tex=@]
|
||||
~_ tex
|
||||
!<((list dude:gall) (slap !>(~) (ream tex)))
|
||||
--
|
||||
++ grad %noun
|
||||
--
|
@ -1 +0,0 @@
|
||||
../../../landscape/desk/mar/docket-0.hoon
|
25
desk/mar/docket-0.hoon
Normal file
25
desk/mar/docket-0.hoon
Normal file
@ -0,0 +1,25 @@
|
||||
/+ dock=docket
|
||||
|_ =docket:dock
|
||||
++ grow
|
||||
|%
|
||||
++ mime
|
||||
^- ^mime
|
||||
[/text/x-docket (as-octt:mimes:html (spit-docket:mime:dock docket))]
|
||||
++ noun docket
|
||||
++ json (docket:enjs:dock docket)
|
||||
--
|
||||
++ grab
|
||||
|%
|
||||
::
|
||||
++ mime
|
||||
|= [=mite len=@ud tex=@]
|
||||
^- docket:dock
|
||||
%- need
|
||||
%- from-clauses:mime:dock
|
||||
!<((list clause:dock) (slap !>(~) (ream tex)))
|
||||
|
||||
::
|
||||
++ noun docket:dock
|
||||
--
|
||||
++ grad %noun
|
||||
--
|
@ -1 +0,0 @@
|
||||
../../../urbit/pkg/arvo/mar/hoon.hoon
|
36
desk/mar/hoon.hoon
Normal file
36
desk/mar/hoon.hoon
Normal file
@ -0,0 +1,36 @@
|
||||
:::: /hoon/hoon/mar
|
||||
::
|
||||
/? 310
|
||||
::
|
||||
=, eyre
|
||||
|_ own=@t
|
||||
::
|
||||
++ grow :: convert to
|
||||
|%
|
||||
++ mime `^mime`[/text/x-hoon (as-octs:mimes:html own)] :: convert to %mime
|
||||
++ hymn
|
||||
;html
|
||||
;head
|
||||
;title:"Source"
|
||||
;script@"//cdnjs.cloudflare.com/ajax/libs/codemirror/4.3.0/codemirror.js";
|
||||
;script@"/lib/syntax/hoon.js";
|
||||
;link(rel "stylesheet", href "//cdnjs.cloudflare.com/ajax/libs/".
|
||||
"codemirror/4.3.0/codemirror.min.css");
|
||||
;link/"/lib/syntax/codemirror.css"(rel "stylesheet");
|
||||
==
|
||||
;body
|
||||
;textarea#src:"{(trip own)}"
|
||||
;script:'CodeMirror.fromTextArea(src, {lineNumbers:true, readOnly:true})'
|
||||
==
|
||||
==
|
||||
++ txt
|
||||
(to-wain:format own)
|
||||
--
|
||||
++ grab
|
||||
|% :: convert from
|
||||
++ mime |=([p=mite q=octs] q.q)
|
||||
++ noun @t :: clam from %noun
|
||||
++ txt of-wain:format
|
||||
--
|
||||
++ grad %txt
|
||||
--
|
@ -1 +0,0 @@
|
||||
../../../urbit/pkg/arvo/mar/kelvin.hoon
|
28
desk/mar/kelvin.hoon
Normal file
28
desk/mar/kelvin.hoon
Normal file
@ -0,0 +1,28 @@
|
||||
|_ kal=waft:clay
|
||||
++ grow
|
||||
|%
|
||||
++ mime `^mime`[/text/x-kelvin (as-octs:mimes:html hoon)]
|
||||
++ noun kal
|
||||
++ hoon
|
||||
%+ rap 3
|
||||
%+ turn
|
||||
%+ sort
|
||||
~(tap in (waft-to-wefts:clay kal))
|
||||
|= [a=weft b=weft]
|
||||
?: =(lal.a lal.b)
|
||||
(gte num.a num.b)
|
||||
(gte lal.a lal.b)
|
||||
|= =weft
|
||||
(rap 3 '[%' (scot %tas lal.weft) ' ' (scot %ud num.weft) ']\0a' ~)
|
||||
::
|
||||
++ txt (to-wain:format hoon)
|
||||
--
|
||||
++ grab
|
||||
|%
|
||||
++ noun waft:clay
|
||||
++ mime
|
||||
|= [=mite len=@ud tex=@]
|
||||
(cord-to-waft:clay tex)
|
||||
--
|
||||
++ grad %noun
|
||||
--
|
@ -1 +0,0 @@
|
||||
../../../urbit/pkg/arvo/mar/mime.hoon
|
32
desk/mar/mime.hoon
Normal file
32
desk/mar/mime.hoon
Normal file
@ -0,0 +1,32 @@
|
||||
::
|
||||
:::: /hoon/mime/mar
|
||||
::
|
||||
/? 310
|
||||
::
|
||||
|_ own=mime
|
||||
++ grow
|
||||
^?
|
||||
|%
|
||||
++ jam `@`q.q.own
|
||||
--
|
||||
::
|
||||
++ grab :: convert from
|
||||
^?
|
||||
|%
|
||||
++ noun mime :: clam from %noun
|
||||
++ tape
|
||||
|=(a=_"" [/application/x-urb-unknown (as-octt:mimes:html a)])
|
||||
--
|
||||
++ grad
|
||||
^?
|
||||
|%
|
||||
++ form %mime
|
||||
++ diff |=(mime +<)
|
||||
++ pact |=(mime +<)
|
||||
++ join |=([mime mime] `(unit mime)`~)
|
||||
++ mash
|
||||
|= [[ship desk mime] [ship desk mime]]
|
||||
^- mime
|
||||
~|(%mime-mash !!)
|
||||
--
|
||||
--
|
@ -1 +0,0 @@
|
||||
../../../urbit/pkg/arvo/mar/noun.hoon
|
22
desk/mar/noun.hoon
Normal file
22
desk/mar/noun.hoon
Normal file
@ -0,0 +1,22 @@
|
||||
::
|
||||
:::: /hoon/noun/mar
|
||||
::
|
||||
/? 310
|
||||
!:
|
||||
:::: A minimal noun mark
|
||||
|_ non=*
|
||||
++ grab |%
|
||||
++ noun *
|
||||
--
|
||||
++ grow |%
|
||||
++ mime [/application/x-urb-jam (as-octs:mimes:html (jam non))]
|
||||
--
|
||||
++ grad
|
||||
|%
|
||||
++ form %noun
|
||||
++ diff |=(* +<)
|
||||
++ pact |=(* +<)
|
||||
++ join |=([* *] *(unit *))
|
||||
++ mash |=([[ship desk *] [ship desk *]] `*`~|(%noun-mash !!))
|
||||
--
|
||||
--
|
@ -1 +0,0 @@
|
||||
../../../urbit/pkg/arvo/mar/ship.hoon
|
20
desk/mar/ship.hoon
Normal file
20
desk/mar/ship.hoon
Normal file
@ -0,0 +1,20 @@
|
||||
|_ s=ship
|
||||
++ grad %noun
|
||||
++ grow
|
||||
|%
|
||||
++ noun s
|
||||
++ json s+(scot %p s)
|
||||
++ mime
|
||||
^- ^mime
|
||||
[/text/x-ship (as-octt:mimes:html (scow %p s))]
|
||||
|
||||
--
|
||||
++ grab
|
||||
|%
|
||||
++ noun ship
|
||||
++ json (su:dejs:format ;~(pfix sig fed:ag))
|
||||
++ mime
|
||||
|= [=mite len=@ tex=@]
|
||||
(slav %p (snag 0 (to-wain:format tex)))
|
||||
--
|
||||
--
|
@ -1 +0,0 @@
|
||||
../../../urbit/pkg/arvo/mar/txt.hoon
|
274
desk/mar/txt.hoon
Normal file
274
desk/mar/txt.hoon
Normal file
@ -0,0 +1,274 @@
|
||||
::
|
||||
:::: /hoon/txt/mar
|
||||
::
|
||||
/? 310
|
||||
::
|
||||
=, clay
|
||||
=, differ
|
||||
=, format
|
||||
=, mimes:html
|
||||
|_ txt=wain
|
||||
::
|
||||
++ grab :: convert from
|
||||
|%
|
||||
++ mime |=((pair mite octs) (to-wain q.q))
|
||||
++ noun wain :: clam from %noun
|
||||
--
|
||||
++ grow
|
||||
=> v=.
|
||||
|%
|
||||
++ mime => v [/text/plain (as-octs (of-wain txt))]
|
||||
--
|
||||
++ grad
|
||||
|%
|
||||
++ form %txt-diff
|
||||
++ diff
|
||||
|= tyt=wain
|
||||
^- (urge cord)
|
||||
(lusk txt tyt (loss txt tyt))
|
||||
::
|
||||
++ pact
|
||||
|= dif=(urge cord)
|
||||
~| [%pacting dif]
|
||||
^- wain
|
||||
(lurk txt dif)
|
||||
::
|
||||
++ join
|
||||
|= [ali=(urge cord) bob=(urge cord)]
|
||||
^- (unit (urge cord))
|
||||
|^
|
||||
=. ali (clean ali)
|
||||
=. bob (clean bob)
|
||||
|- ^- (unit (urge cord))
|
||||
?~ ali `bob
|
||||
?~ bob `ali
|
||||
?- -.i.ali
|
||||
%&
|
||||
?- -.i.bob
|
||||
%&
|
||||
?: =(p.i.ali p.i.bob)
|
||||
%+ bind $(ali t.ali, bob t.bob)
|
||||
|=(cud=(urge cord) [i.ali cud])
|
||||
?: (gth p.i.ali p.i.bob)
|
||||
%+ bind $(p.i.ali (sub p.i.ali p.i.bob), bob t.bob)
|
||||
|=(cud=(urge cord) [i.bob cud])
|
||||
%+ bind $(ali t.ali, p.i.bob (sub p.i.bob p.i.ali))
|
||||
|=(cud=(urge cord) [i.ali cud])
|
||||
::
|
||||
%|
|
||||
?: =(p.i.ali (lent p.i.bob))
|
||||
%+ bind $(ali t.ali, bob t.bob)
|
||||
|=(cud=(urge cord) [i.bob cud])
|
||||
?: (gth p.i.ali (lent p.i.bob))
|
||||
%+ bind $(p.i.ali (sub p.i.ali (lent p.i.bob)), bob t.bob)
|
||||
|=(cud=(urge cord) [i.bob cud])
|
||||
~
|
||||
==
|
||||
::
|
||||
%|
|
||||
?- -.i.bob
|
||||
%|
|
||||
?. =(i.ali i.bob)
|
||||
~
|
||||
%+ bind $(ali t.ali, bob t.bob)
|
||||
|=(cud=(urge cord) [i.ali cud])
|
||||
::
|
||||
%&
|
||||
?: =(p.i.bob (lent p.i.ali))
|
||||
%+ bind $(ali t.ali, bob t.bob)
|
||||
|=(cud=(urge cord) [i.ali cud])
|
||||
?: (gth p.i.bob (lent p.i.ali))
|
||||
%+ bind $(ali t.ali, p.i.bob (sub p.i.bob (lent p.i.ali)))
|
||||
|=(cud=(urge cord) [i.ali cud])
|
||||
~
|
||||
==
|
||||
==
|
||||
++ clean :: clean
|
||||
|= wig=(urge cord)
|
||||
^- (urge cord)
|
||||
?~ wig ~
|
||||
?~ t.wig wig
|
||||
?: ?=(%& -.i.wig)
|
||||
?: ?=(%& -.i.t.wig)
|
||||
$(wig [[%& (add p.i.wig p.i.t.wig)] t.t.wig])
|
||||
[i.wig $(wig t.wig)]
|
||||
?: ?=(%| -.i.t.wig)
|
||||
$(wig [[%| (welp p.i.wig p.i.t.wig) (welp q.i.wig q.i.t.wig)] t.t.wig])
|
||||
[i.wig $(wig t.wig)]
|
||||
--
|
||||
::
|
||||
++ mash
|
||||
|= $: [als=ship ald=desk ali=(urge cord)]
|
||||
[bos=ship bod=desk bob=(urge cord)]
|
||||
==
|
||||
^- (urge cord)
|
||||
|^
|
||||
=. ali (clean ali)
|
||||
=. bob (clean bob)
|
||||
|- ^- (urge cord)
|
||||
?~ ali bob
|
||||
?~ bob ali
|
||||
?- -.i.ali
|
||||
%&
|
||||
?- -.i.bob
|
||||
%&
|
||||
?: =(p.i.ali p.i.bob)
|
||||
[i.ali $(ali t.ali, bob t.bob)]
|
||||
?: (gth p.i.ali p.i.bob)
|
||||
[i.bob $(p.i.ali (sub p.i.ali p.i.bob), bob t.bob)]
|
||||
[i.ali $(ali t.ali, p.i.bob (sub p.i.bob p.i.ali))]
|
||||
::
|
||||
%|
|
||||
?: =(p.i.ali (lent p.i.bob))
|
||||
[i.bob $(ali t.ali, bob t.bob)]
|
||||
?: (gth p.i.ali (lent p.i.bob))
|
||||
[i.bob $(p.i.ali (sub p.i.ali (lent p.i.bob)), bob t.bob)]
|
||||
=/ [fic=(unce cord) ali=(urge cord) bob=(urge cord)]
|
||||
(resolve ali bob)
|
||||
[fic $(ali ali, bob bob)]
|
||||
:: ~ :: here, alice is good for a while, but not for the whole
|
||||
== :: length of bob's changes
|
||||
::
|
||||
%|
|
||||
?- -.i.bob
|
||||
%|
|
||||
=/ [fic=(unce cord) ali=(urge cord) bob=(urge cord)]
|
||||
(resolve ali bob)
|
||||
[fic $(ali ali, bob bob)]
|
||||
::
|
||||
%&
|
||||
?: =(p.i.bob (lent p.i.ali))
|
||||
[i.ali $(ali t.ali, bob t.bob)]
|
||||
?: (gth p.i.bob (lent p.i.ali))
|
||||
[i.ali $(ali t.ali, p.i.bob (sub p.i.bob (lent p.i.ali)))]
|
||||
=/ [fic=(unce cord) ali=(urge cord) bob=(urge cord)]
|
||||
(resolve ali bob)
|
||||
[fic $(ali ali, bob bob)]
|
||||
==
|
||||
==
|
||||
::
|
||||
++ annotate :: annotate conflict
|
||||
|= $: ali=(list @t)
|
||||
bob=(list @t)
|
||||
bas=(list @t)
|
||||
==
|
||||
^- (list @t)
|
||||
%- zing
|
||||
^- (list (list @t))
|
||||
%- flop
|
||||
^- (list (list @t))
|
||||
:- :_ ~
|
||||
%^ cat 3 '<<<<<<<<<<<<'
|
||||
%^ cat 3 ' '
|
||||
%^ cat 3 `@t`(scot %p bos)
|
||||
%^ cat 3 '/'
|
||||
bod
|
||||
|
||||
:- bob
|
||||
:- ~['------------']
|
||||
:- bas
|
||||
:- ~['++++++++++++']
|
||||
:- ali
|
||||
:- :_ ~
|
||||
%^ cat 3 '>>>>>>>>>>>>'
|
||||
%^ cat 3 ' '
|
||||
%^ cat 3 `@t`(scot %p als)
|
||||
%^ cat 3 '/'
|
||||
ald
|
||||
~
|
||||
::
|
||||
++ clean :: clean
|
||||
|= wig=(urge cord)
|
||||
^- (urge cord)
|
||||
?~ wig ~
|
||||
?~ t.wig wig
|
||||
?: ?=(%& -.i.wig)
|
||||
?: ?=(%& -.i.t.wig)
|
||||
$(wig [[%& (add p.i.wig p.i.t.wig)] t.t.wig])
|
||||
[i.wig $(wig t.wig)]
|
||||
?: ?=(%| -.i.t.wig)
|
||||
$(wig [[%| (welp p.i.wig p.i.t.wig) (welp q.i.wig q.i.t.wig)] t.t.wig])
|
||||
[i.wig $(wig t.wig)]
|
||||
::
|
||||
++ resolve
|
||||
|= [ali=(urge cord) bob=(urge cord)]
|
||||
^- [fic=[%| p=(list cord) q=(list cord)] ali=(urge cord) bob=(urge cord)]
|
||||
=- [[%| bac (annotate alc boc bac)] ali bob]
|
||||
|- ^- $: $: bac=(list cord)
|
||||
alc=(list cord)
|
||||
boc=(list cord)
|
||||
==
|
||||
ali=(urge cord)
|
||||
bob=(urge cord)
|
||||
==
|
||||
?~ ali [[~ ~ ~] ali bob]
|
||||
?~ bob [[~ ~ ~] ali bob]
|
||||
?- -.i.ali
|
||||
%&
|
||||
?- -.i.bob
|
||||
%& [[~ ~ ~] ali bob] :: no conflict
|
||||
%|
|
||||
=+ lob=(lent p.i.bob)
|
||||
?: =(lob p.i.ali)
|
||||
[[p.i.bob p.i.bob q.i.bob] t.ali t.bob]
|
||||
?: (lth lob p.i.ali)
|
||||
[[p.i.bob p.i.bob q.i.bob] [[%& (sub p.i.ali lob)] t.ali] t.bob]
|
||||
=+ wat=(scag (sub lob p.i.ali) p.i.bob)
|
||||
=+ ^= res
|
||||
%= $
|
||||
ali t.ali
|
||||
bob [[%| (scag (sub lob p.i.ali) p.i.bob) ~] t.bob]
|
||||
==
|
||||
:* :* (welp bac.res wat)
|
||||
(welp alc.res wat)
|
||||
(welp boc.res q.i.bob)
|
||||
==
|
||||
ali.res
|
||||
bob.res
|
||||
==
|
||||
==
|
||||
::
|
||||
%|
|
||||
?- -.i.bob
|
||||
%&
|
||||
=+ loa=(lent p.i.ali)
|
||||
?: =(loa p.i.bob)
|
||||
[[p.i.ali q.i.ali p.i.ali] t.ali t.bob]
|
||||
?: (lth loa p.i.bob)
|
||||
[[p.i.ali q.i.ali p.i.ali] t.ali [[%& (sub p.i.bob loa)] t.bob]]
|
||||
=+ wat=(slag (sub loa p.i.bob) p.i.ali)
|
||||
=+ ^= res
|
||||
%= $
|
||||
ali [[%| (scag (sub loa p.i.bob) p.i.ali) ~] t.ali]
|
||||
bob t.bob
|
||||
==
|
||||
:* :* (welp bac.res wat)
|
||||
(welp alc.res q.i.ali)
|
||||
(welp boc.res wat)
|
||||
==
|
||||
ali.res
|
||||
bob.res
|
||||
==
|
||||
::
|
||||
%|
|
||||
=+ loa=(lent p.i.ali)
|
||||
=+ lob=(lent p.i.bob)
|
||||
?: =(loa lob)
|
||||
[[p.i.ali q.i.ali q.i.bob] t.ali t.bob]
|
||||
=+ ^= res
|
||||
?: (gth loa lob)
|
||||
$(ali [[%| (scag (sub loa lob) p.i.ali) ~] t.ali], bob t.bob)
|
||||
~& [%scagging loa=loa pibob=p.i.bob slag=(scag loa p.i.bob)]
|
||||
$(ali t.ali, bob [[%| (scag (sub lob loa) p.i.bob) ~] t.bob])
|
||||
:* :* (welp bac.res ?:((gth loa lob) p.i.bob p.i.ali))
|
||||
(welp alc.res q.i.ali)
|
||||
(welp boc.res q.i.bob)
|
||||
==
|
||||
ali.res
|
||||
bob.res
|
||||
==
|
||||
==
|
||||
==
|
||||
--
|
||||
--
|
||||
--
|
@ -1 +0,0 @@
|
||||
../../../landscape/desk/sur/docket.hoon
|
82
desk/sur/docket.hoon
Normal file
82
desk/sur/docket.hoon
Normal file
@ -0,0 +1,82 @@
|
||||
|%
|
||||
::
|
||||
+$ version
|
||||
[major=@ud minor=@ud patch=@ud]
|
||||
::
|
||||
+$ glob (map path mime)
|
||||
::
|
||||
+$ url cord
|
||||
:: $glob-location: How to retrieve a glob
|
||||
::
|
||||
+$ glob-reference
|
||||
[hash=@uvH location=glob-location]
|
||||
::
|
||||
+$ glob-location
|
||||
$% [%http =url]
|
||||
[%ames =ship]
|
||||
==
|
||||
:: $href: Where a tile links to
|
||||
::
|
||||
+$ href
|
||||
$% [%glob base=term =glob-reference]
|
||||
[%site =path]
|
||||
==
|
||||
:: $chad: State of a docket
|
||||
::
|
||||
+$ chad
|
||||
$~ [%install ~]
|
||||
$% :: Done
|
||||
[%glob =glob]
|
||||
[%site ~]
|
||||
:: Waiting
|
||||
[%install ~]
|
||||
[%suspend glob=(unit glob)]
|
||||
:: Error
|
||||
[%hung err=cord]
|
||||
==
|
||||
::
|
||||
:: $charge: A realized $docket
|
||||
::
|
||||
+$ charge
|
||||
$: =docket
|
||||
=chad
|
||||
==
|
||||
::
|
||||
:: $clause: A key and value, as part of a docket
|
||||
::
|
||||
:: Only used to parse $docket
|
||||
::
|
||||
+$ clause
|
||||
$% [%title title=@t]
|
||||
[%info info=@t]
|
||||
[%color color=@ux]
|
||||
[%glob-http url=cord hash=@uvH]
|
||||
[%glob-ames =ship hash=@uvH]
|
||||
[%image =url]
|
||||
[%site =path]
|
||||
[%base base=term]
|
||||
[%version =version]
|
||||
[%website website=url]
|
||||
[%license license=cord]
|
||||
==
|
||||
::
|
||||
:: $docket: A description of JS bundles for a desk
|
||||
::
|
||||
+$ docket
|
||||
$: %1
|
||||
title=@t
|
||||
info=@t
|
||||
color=@ux
|
||||
=href
|
||||
image=(unit url)
|
||||
=version
|
||||
website=url
|
||||
license=cord
|
||||
==
|
||||
::
|
||||
+$ charge-update
|
||||
$% [%initial initial=(map desk charge)]
|
||||
[%add-charge =desk =charge]
|
||||
[%del-charge =desk]
|
||||
==
|
||||
--
|
@ -1 +0,0 @@
|
||||
../../../urbit/pkg/arvo/sur/verb.hoon
|
48
desk/sur/verb.hoon
Normal file
48
desk/sur/verb.hoon
Normal file
@ -0,0 +1,48 @@
|
||||
|%
|
||||
+$ event
|
||||
$% [%on-init ~]
|
||||
[%on-load ~]
|
||||
[%on-poke =mark]
|
||||
[%on-watch =path]
|
||||
[%on-leave =path]
|
||||
[%on-agent =wire sign=term]
|
||||
[%on-arvo =wire vane=term sign=term]
|
||||
[%on-fail =term]
|
||||
==
|
||||
::
|
||||
+$ event-plus
|
||||
$: act=@ud
|
||||
now=@da
|
||||
src=@p
|
||||
sap=path
|
||||
=cause
|
||||
effects=(list effect)
|
||||
==
|
||||
::
|
||||
+$ cause
|
||||
$% [%on-init ~]
|
||||
[%on-load ~]
|
||||
[%on-poke =mark mug=@ux]
|
||||
[%on-watch =path]
|
||||
[%on-leave =path]
|
||||
[%on-agent =wire =sign]
|
||||
[%on-arvo =wire vane=term sign=term]
|
||||
[%on-fail =term]
|
||||
==
|
||||
::
|
||||
+$ sign
|
||||
$% [%poke-ack ack=?]
|
||||
[%watch-ack ack=?]
|
||||
[%kick ~]
|
||||
[%fact =mark mug=@ux]
|
||||
==
|
||||
::
|
||||
+$ effect
|
||||
$% [%poke =wire =gill:gall =mark mug=@ux]
|
||||
[%watch =wire =gill:gall =path]
|
||||
[%leave =wire =gill:gall]
|
||||
[%fact paths=(list path) =mark mug=@ux]
|
||||
[%kick paths=(list path)]
|
||||
[%arvo =wire vane=term task=term]
|
||||
==
|
||||
--
|
Loading…
Reference in New Issue
Block a user