Merge branch 'radio' of https://github.com/urbit/urbit into radio

This commit is contained in:
Philip C Monk 2014-12-17 15:38:38 -05:00
commit 83c8d0c278
5 changed files with 198 additions and 44 deletions

View File

@ -18,12 +18,13 @@
general=(set bone) :: meta-subscribe
outbox=(pair ,@ud (map ,@ud thought)) :: urbit outbox
sent=(map tid:twit serial) :: own tweets
folks=(map ship human) :: human identities
== ::
++ party :: a conversation
$: count=@ud :: (lent grams)
grams=(list telegram) :: all history
locals=(map ship (pair ,@da presence)) :: local presence
remotes=(map station (map ship status)) :: remote presence
locals=(map ship (pair ,@da status)) :: local presence
remotes=(map station atlas) :: remote presence
sequence=(map station ,@ud) :: stations heard
shape=config :: configuration
known=(map serial ,@ud) :: messages heard
@ -49,7 +50,10 @@
$% [%mean p=ares] :: cancel
[%nice ~] :: acknowledge
[%rust %radio-report report] :: refresh
== == == ::
== == ::
$: %t ::
$% [%wake ~] :: timer wakeup
== == ==
++ move ,[p=bone q=(mold note gift)] :: all actions
++ hapt ,[p=ship q=path] :: app instance
++ note :: requests
@ -60,6 +64,9 @@
$% [%mess p=hapt q=ship r=cage] :: message
[%nuke p=hapt q=ship] :: cancel
[%show p=hapt q=ship r=path] :: subscribe
== ==
$: %t ::
$% [%wait p=@da] ::
== == == ::
++ twim :: twitter endpoints
$%([%mine p=span] [%stat p=@uv])
@ -143,12 +150,7 @@
::
%review ra-ever:(ra-think | her +.cod)
%publish ra-ever:(ra-think & her +.cod)
%ping
=+ pur=(~(get by parties) p.cod)
?~ pur
(ra-evil %radio-no-party)
=< ra-ever =< pa-abet
(~(pa-notify pa p.cod u.pur) her q.cod)
%ping (ra-notice her +.cod)
==
::
++ ra-config :: configure party
@ -166,9 +168,21 @@
?~ pur ~& [%ra-friend-none man] +>.$
pa-abet:(~(pa-friend pa man u.pur) sih)
::
++ ra-stalk :: %stalk response
|= [man=span tay=station sih=sign]
^+ +>
=+ pur=(~(get by parties) man)
?~ pur ~& [%ra-stalk-none man] +>.$
pa-abet:(~(pa-stalk pa man u.pur) tay sih)
::
++ ra-timer :: timeout
|- ^+ +
!!
^+ .
=+ paz=parties
|- ^+ +>
?~ paz +>.$
=. +>.$ $(paz l.paz)
=. +>.$ $(paz r.paz)
pa-abet:~(pa-timer pa p.n.paz q.n.paz)
::
++ ra-twitter :: %twitter response
|= [met=twim sih=sign]
@ -271,6 +285,47 @@
?~ aud +>.^$
$(aud t.aud, +>.^$ (ra-conduct pub her p.i.aud tip))
::
++ ra-notice :: declare presence
|= [her=ship vig=(map station presence)]
^+ +>
=+ sul=(~(tap by vig) ~)
|- ^+ +>.^$
?~ sul ra-ever
=. +>.^$ $(sul t.sul)
?- -.p.i.sul
%| +>.^$
%& ?: =(`ship`p.p.p.i.sul our.hid)
(ra-appear her q.p.p.i.sul q.i.sul)
?: =(her our.hid)
(ra-provoke p.p.p.i.sul i.sul)
(ra-evil %radio-unauthorized-presence)
==
::
++ ra-appear :: review presence
|= [her=ship man=span per=presence]
=^ who folks
=+ who=(~(get by folks) her)
?^ who [u.who folks]
=+ who=*human :: XX do right
[who (~(put by folks) her who)]
=+ pur=(~(get by parties) man)
?~ pur
~& [%bad-appear man]
(ra-evil %radio-no-party)
pa-abet:(~(pa-notify pa man u.pur) her per who)
::
++ ra-provoke :: forward presence
|= [him=ship tay=station per=presence]
%+ ra-emit ost
:* %pass
/provoke
%g
%mess
[him /rodeo]
our.hid
[%radio-command !>(`command`[%ping [[tay per] ~ ~]])]
==
::
++ ra-conduct :: thought to station
|= [pub=? her=ship tay=station tip=thought]
^+ +>
@ -341,16 +396,23 @@
::==
&
::
++ pa-present :: XX
^- (map ship status)
~
++ pa-timer :: timer expire
^+ .
=+ cul=(~(tap by locals) ~)
=+ ^= hay
%+ skim cul
|= [a=ship b=@da c=status]
(lte lat.hid (add ~m2 b))
?: =(cul hay) +>
%. viewers
pa-display(locals (~(gas by *(map ship (pair ,@da status))) hay))
::
++ pa-watch :: watch presence
|= her=ship
?. (pa-admire her)
(pa-sauce ost [[%mean ~ %radio-watch-unauthorized ~] ~])
=. viewers (~(put in viewers) ost)
(pa-sauce ost [[%rust %radio-report %group pa-present] ~])
(pa-display ost ~ ~)
::
++ pa-master :: hear config
|= her=ship
@ -361,12 +423,17 @@
(pa-sauce ost [[%rust %radio-report %config shape] ~])
::
++ pa-display :: update presence
=+ vew=viewers
|- ^+ +>
?~ vew +>
=. +> $(vew l.vew)
=. +> $(vew r.vew)
(pa-sauce n.vew [[%rust %radio-report %group pa-present] ~])
|= vew=(set bone)
=+ ^= reg
:_ remotes
|- ^- atlas
?~ locals ~
[[p.n.locals q.q.n.locals] $(locals l.locals) $(locals r.locals)]
|- ^+ +>.^$
?~ vew +>.^$
=. +>.^$ $(vew l.vew)
=. +>.^$ $(vew r.vew)
(pa-sauce n.vew [[%rust %radio-report %group reg] ~])
::
++ pa-monitor :: update config
=+ owe=owners
@ -393,6 +460,22 @@
==
==
::
++ pa-stalk :: subscribed present
|= [tay=station sih=sign]
^+ +>
?+ sih ~&([%radio-bad-friend sih] !!)
[%g %nice ~]
~& %pa-friend-nice
+>.$
::
[%g %rust %radio-report *]
~& [%pa-friend-report +>+.sih]
?+ -.+>+.sih ~&([%radio-odd-friend sih] !!)
%group
(pa-remind tay +.+>+.sih)
==
==
::
++ pa-scrub :: pass forward
|= [ost=bone bub=(list (pair path note))]
%_ +>.$
@ -410,17 +493,22 @@
++ pa-abjure :: unsubscribe move
|= tal=(list station)
%+ pa-scrub 0
%- zing
%+ turn tal
|= tay=station
?- -.tay
%| ~& tweet-abjure/p.p.tay
:_ ~
:- /twitter/mine/[p.p.tay]/[man]
?> =(me:ti p.p.tay)
[%e %them ~]
::
%& ~& [%pa-abjure [our.hid man] [p.p.tay q.p.tay]]
:- /friend/nuke/[man]
[%g %nuke [p.p.tay /rodeo] our.hid]
:~ :- /friend/nuke/[man]
[%g %nuke [p.p.tay /rodeo] our.hid]
:- /stalk/nuke/[man]
[%g %nuke [p.p.tay /rodeo] our.hid]
==
==
::
++ pa-acquire :: subscribe to
@ -441,7 +529,7 @@
%& ~& [%pa-acquire [our.hid man] [p.p.tay q.p.tay]]
:~ :- /friend/show/[man]
[%g %show [p.p.tay /rodeo] our.hid /fm/[q.p.tay]/(scot %ud num)]
:- /friend/view/[man]
:- /stalk/show/[man]/(scot %p p.p.tay)/[q.p.tay]
[%g %show [p.p.tay /rodeo] our.hid /am/[q.p.tay]]
==
==
@ -464,11 +552,38 @@
=. guests (~(del in guests) ost)
(pa-sauce ost [[%mean ~] ~])
::
++ pa-notify :: new presence
|= [her=ship per=presence]
++ pa-notify :: local presence
|= [her=ship saz=status]
^+ +>
!!
:: pa-display(present (~(put by present) her [per lat.hid *human]))
=+ guz=(~(get by locals) her)
=. locals (~(put by locals) her lat.hid saz)
?. |(?=(~ guz) !=(per q.u.guz))
+>.$
(pa-display viewers)
::
++ pa-remind :: remote presence
|= [tay=station loc=atlas rem=(map station atlas)]
=+ ^= buk
=+ mer=(turn (~(tap by rem) ~) |=([* a=atlas] a))
|- ^- atlas
?~ mer loc
=. loc $(mer t.mer)
=+ dur=`(list (pair ship status))`(~(tap by i.mer) ~)
|- ^- atlas
?~ dur loc
=. loc $(dur t.dur)
=+ fuy=(~(get by loc) p.i.dur)
?~ fuy (~(put by loc) p.i.dur q.i.dur)
?: =(`presence`p.q.i.dur `presence`p.u.fuy)
loc
?- p.u.fuy
%talk loc
%hear (~(put by loc) p.i.dur q.i.dur)
==
=+ gub=(~(get by remotes) tay)
?. |(?=(~ gub) =(buk u.gub))
+>.$
(pa-display(remotes (~(put by remotes) tay buk)) viewers)
::
++ pa-start :: start stream
|= riv=river
@ -524,12 +639,12 @@
=+ lef=$(guests l.guests)
=+ rit=$(guests r.guests)
=+ old=[p=(welp p.lef p.rit) q=(welp q.lef q.rit)]
?: ?- -.q.q.n.guests :: after the end
?: ?- -.q.q.n.guests :: after the end
%ud (lte p.q.q.n.guests num)
%da (lte p.q.q.n.guests p.r.q.gam)
==
[[p.n.guests p.old] [[p.n.guests %give %mean ~] q.old]]
?: ?- -.p.q.n.guests :: before the start
?: ?- -.p.q.n.guests :: before the start
%ud (gth p.p.q.n.guests num)
%da (gth p.p.q.n.guests p.r.q.gam)
==
@ -596,6 +711,13 @@
:: ~& sih=sih
=+ sih=((hard sign) sih)
?+ pax ~& [%rodeo-strange-path pax] !!
::
[%provoke ~] [~ +>.$]
[%time ~]
?> ?=(0 ost)
=^ moz +>.$ ra-abet:~(ra-timer ra 0 ~)
:_(+>.$ :_(moz [0 %pass /time %t %wait (add ~s10 lat.hid)]))
::
[%twitter *]
=- ra-abet:(~(ra-twitter ra ost ~) met sih)
^= met
@ -605,12 +727,21 @@
[%stat @ ~]
[i.t.pax (slav %uv i.t.t.pax)]
==
::
[%friend *]
?> ?=([@ @ ~] t.pax)
?. =(%show i.t.pax)
~& [%pour-friend-nuke-nuke pax]
[~ +>.$]
ra-abet:(~(ra-friend ra ost ~) i.t.t.pax sih)
::
[%stalk *]
?> ?=([@ @ @ @ ~] t.pax)
?. =(%show i.t.pax)
~& [%pour-friend-nuke-nuke pax]
[~ +>.$]
=+ [man tay]=[i.t.t.pax `station`[%& (slav %p i.t.t.t.pax) i.t.t.t.t.pax]]
ra-abet:(~(ra-stalk ra ost ~) man tay sih)
::
[%repeat *]
?> ?=([@ @ @ ~] t.pax)
@ -621,12 +752,13 @@
++ prep
|= old=(unit (unit house))
^- [(list move) _+>]
:- [0 %pass /time %t %wait (add ~s10 lat.hid)]~
?> ?=(^ old)
?^ u.old
~& %rodeo-prep-old
[~ +>(+<+ u.u.old)]
+>(+<+ u.u.old)
~& %rodeo-prep-new
[~ +:ra-abet:(~(ra-apply ra 0 ~) our.hid %design %main `[~ [%| ~]])]
+:ra-abet:(~(ra-apply ra 0 ~) our.hid %design %main `[~ [%| ~]])
::
++ pull
|= ost=bone

View File

@ -53,7 +53,10 @@
$% [%mess p=hapt q=ship r=cage]
[%nuke p=hapt q=ship]
[%show p=hapt q=ship r=path]
== == ==
== ==
$: %t ::
$% [%wait p=@da] ::
== == == ::
++ sign
$? $: %g
$% [%mean p=ares]
@ -68,6 +71,9 @@
$% [%txt p=cord]
[%radio-report p=report]
== ==
== ==
$: %t ::
$% [%wake ~] :: timer wakeup
== == ==
--
!:
@ -353,13 +359,13 @@
[~ +>.$(parties (~(put by parties) man u.pur(shape `cof)))]
::
++ pour-group
|= [ost=bone man=span lup=(map ship status)]
|= [ost=bone man=span reg=(pair atlas (map station atlas))]
^- [(list move) _+>]
=+ pur=(~(get by parties) man)
?~ pur
~& [%no-party man]
[~ +>.$]
[~ +>.$(parties (~(put by parties) man u.pur(present lup)))]
[~ +>.$(parties (~(put by parties) man u.pur(present p.reg)))]
::
++ prompt
^- cord
@ -386,16 +392,29 @@
?~ pax ~& talk-pour-strange-path/pax !!
?+ i.pax ~& talk-pour-strange-path/pax !!
%cmd-in
?- +<.sih
?+ +<.sih !!
%nice [~ +>.$]
%mean [(send /out %give +.sih) +>.$]
?(%rush %rust)
?> ?=(%txt -.p.sih)
(pour-shell ost p.p.sih)
==
::
%time
:_ +>.$
:* [0 %pass /time %t %wait (add ~s10 lat.hid)]
?~ targets
~
:_ ~
%+ send-rodeo 0
:- %ping
%- ~(gas by *(map station presence))
%+ turn (~(tap in u.targets) ~)
|=(a=station [a %hear])
==
::
%cmd-ac
?- +<.sih
?+ +<.sih !!
%nice [~ +>.$]
%mean [(send /out %give +.sih) +>.$]
?(%rush %rust)
@ -424,7 +443,7 @@
%mean ~&(%am-mean [~ +>.$])
%rust
?> ?=([%radio-report %group *] +>.sih)
(pour-group ost i.t.pax `(map ship status)`+>.+>.sih)
(pour-group ost i.t.pax +>.+>.sih)
==
::
%xm
@ -453,6 +472,7 @@
^- [(list move) _+>]
:_ +>
:~ [ost %pass /cmd-in %g %show [our.hid +.imp.hid] you /in/[-.imp.hid]]
[0 %pass /time %t %wait (add ~s10 lat.hid)]
[ost %pass /cmd-ac %g %show [our.hid +.imp.hid] you /active/[-.imp.hid]]
^- move
:* ost %pass /server

View File

@ -16,7 +16,7 @@
=< :~ publish/(ar thot)
review/(ar thot)
design/(ot party/so config/(mu conf) ~)
ping/(ot party/so presence/(ci (soft presence) so) ~)
ping/auri
==
|%
++ op :: parse keys of map
@ -58,6 +58,7 @@
==
::
++ audi (op stati (ci (soft delivery) so)) :: audience
++ auri (op stati (ci (soft presence) so))
::
++ stati
^- $+(nail (like station))

View File

@ -20,8 +20,8 @@
%config ~! rep (conf +.rep)
%house [%a (turn (~(tap by +.rep)) joce)]
%grams (jobe num/(jone p.rep) tele/[%a (turn q.rep gram)] ~)
%group (grop +.rep)
:: (jobe global/(grop p.rep) local/%.(q.rep (jome stan grop)) ~)
::%group (grop +.rep)
%group (jobe local/(grop p.rep) global/%.(q.rep (jome stan grop)) ~)
==
++ joce |=(a=span [%s a])
++ jope |=(a=ship (jape +:<a>)) ::[%s (crip +:(scow %p a))])

View File

@ -3,18 +3,19 @@
::
|%
++ audience (map station delivery) :: destination/state
++ atlas (map ship status) :: presence map
++ command :: effect on party
$% [%design (pair span (unit config))] :: configure/destroy
[%publish (list thought)] :: originate
[%review (list thought)] :: deliver
[%ping (pair span presence)] :: declare status
[%ping (map station presence)] :: declare status
== ::
++ config :: party configuration
$: sources=(set station) :: pulls from
cordon=(each (set ship) (set ship)) :: white/blacklist
== ::
++ cousin (pair ship span) :: domestic flow
++ delivery ?(%pending %received %rejected) :: delivery state
++ delivery ?(%pending %received %rejected %released) :: delivery state
++ human :: human identifier
$: true=(unit (trel ,@t (unit ,@t) ,@t)) :: true name
hand=(unit ,@t) :: handle
@ -26,7 +27,7 @@
++ report :: unified rush/rust
$% [%house (set span)] :: meta-changes
[%grams (pair ,@ud (list telegram))] :: thoughts
[%group (map ship status)] :: presence
[%group (pair atlas (map station atlas))] :: presence
[%config config] :: reconfigure
== ::
++ serial ,@uvH :: unique identity