Merge branch 'pipe' into web-stream

pull :pipe event->talk multiplexer
This commit is contained in:
Anton Dyudin 2016-03-31 14:35:01 -07:00
commit 492718f5db
20 changed files with 606 additions and 31 deletions

View File

@ -2,7 +2,7 @@
:::: /hoon/dojo/app :: ::::
:: :: ::
/? 314 :: arvo kelvin
/- sole :: console structures
/- sole, lens :: console structures
/+ sole :: console library
[. sole]
:: :: ::
@ -165,7 +165,7 @@
++ dp-sink
;~ pose
;~(plug (cold %file tar) dp-beam)
;~(plug (cold %flat pat) (most fas qut))
;~(plug (cold %flat pat) (most fas sym))
;~(plug (cold %pill dot) (most fas sym))
;~(plug (cold %http lus) (stag %post dp-iden-url))
;~(plug (cold %http hep) (stag %put dp-iden-url))
@ -970,6 +970,88 @@
$clr he-pine(buf "")
==
::
++ he-lens
|= com/command:lens
^+ +>
=+ ^- source/dojo-source
=| num/@
=- ?. ?=($send-api -.sink.com) :: XX num is incorrect
sor
:- 0
:+ %as `mark`(cat 3 api.sink.com '-poke')
:- 1
:+ %do
:+ %gill [%base %noun]
:^ %cont [%rock %tas %post]
[%rock %$ endpoint.sink.com]
[%make ~[[%.y 6]] ~]
sor
^= sor
|- ^- dojo-source
:- num
?- -.source.com
$data [%ex %sand %t data.source.com]
$dojo (rash command.source.com dp-build:dp)
$clay
:- %ex
:* %wish
[%base %noun]
:+ %cons
[%rock %tas %cx]
%+ rash pax.source.com
rood:(vang | /(scot %p our.hid)/home/(scot %da now.hid))
==
::
$url [%ur `~. url.source.com]
$api !!
$get-api
:* %ex
%wish
[%wing ~[%json]]
:* %conl
[%rock %tas %gx]
[%sand %ta (scot %p our.hid)]
[%sand %tas api.source.com]
[%sand %ta (scot %da now.hid)]
(turn endpoint.source.com |=(a/@t [%sand %ta a]))
==
==
::
$listen-api !!
$as
:* %as mar.source.com
$(num +(num), source.com next.source.com)
==
::
$hoon
:* %do
%+ rash code.source.com
tall:(vang | /(scot %p our.hid)/home/(scot %da now.hid))
$(num +(num), source.com next.source.com)
==
::
$tuple
:- %tu
|- ^- (list dojo-source)
?~ next.source.com
~
=. num +(num)
:- ^$(source.com i.next.source.com)
$(next.source.com t.next.source.com)
==
=+ |- ^- sink/dojo-sink
?- -.sink.com
$stdout [%show %0]
$output-file $(sink.com [%command (cat 3 '@' pax.sink.com)])
$output-clay [%file (need (tome pax.sink.com))]
$url [%http %post `~. url.sink.com]
$to-api !!
$send-api [%poke our.hid api.sink.com]
$command (rash command.sink.com dp-sink:dp)
$app [%poke our.hid app.sink.com]
==
(he-plan sink source)
::
++ he-lame :: handle error
|= {wut/term why/tang}
^+ +>
@ -1021,6 +1103,17 @@
++ poke-sole-action
|= act/sole-action ~| poke+act %. act
(wrap he-span):arm
::
++ poke-lens-command
|= com/command:lens ~| poke-lens+com %. com
(wrap he-lens):arm
::
++ poke-json
|= jon/json
^- {(list move) _+>.$}
~& jon=jon
[~ +>.$]
::
++ made (wrap he-made):arm
++ sigh-httr (wrap he-sigh):arm
++ sigh-tang |=({a/wire b/tang} ~|(`term`(cat 3 'sigh-' -.a) (mean b)))

View File

@ -177,11 +177,12 @@
:: into poke semantics.
::
++ poke-gh-poke
|= {method/meth endpoint/path jon/json}
|= {method/meth endpoint/(list @t) jon/json}
^- {(list move) _+>.$}
:_ +>.$ :_ ~
:* ost.hid %hiss /poke/[method] `~ %httr %hiss
(scan "https://api.github.com{<`path`endpoint>}" auri:epur)
~| stuff="https://api.github.com{<(path endpoint)>}"
(scan "https://api.github.com{<(path endpoint)>}" auri:epur)
method ~ `(taco (crip (pojo jon)))
==
::

92
app/pipe.hoon Normal file
View File

@ -0,0 +1,92 @@
/+ talk
!:
=> |%
++ move (pair bone card)
++ card
$% {$peel wire dock mark path}
{$poke wire dock $talk-command command:talk}
==
--
::
|_ {hid/bowl connections/(set {app/term source/path station/knot})}
++ poke-noun
|= arg/*
^- {(list move) _+>.$}
?: ?=($list arg)
(poke-pipe-list ~)
=+ ((soft {$cancel app/term source/path station/knot}) arg)
?^ -
(poke-pipe-cancel app.u source.u station.u)
=+ ((hard {app/term source/path station/knot}) arg)
(poke-pipe-connect app source station)
::
++ poke-pipe-list
|= $~
^- {(list move) _+>.$}
%- %- slog
%+ turn (~(tap in connections))
|= {app/term source/path station/knot}
leaf+"{(trip app)}{<`path`source>} ---> {(trip station)}"
[~ +>.$]
::
++ poke-pipe-cancel
|= {app/term source/path station/knot}
^- {(list move) _+>.$}
?. (~(has in connections) [app source station])
%- %- slog :~
leaf+"no connection:"
leaf+"{(trip app)}{<`path`source>} ---> {(trip station)}"
==
[~ +>.$]
%- %- slog :~
leaf+"canceling:"
leaf+"{(trip app)}{<`path`source>} ---> {(trip station)}"
==
[~ +>.$(connections (~(del in connections) [app source station]))]
::
++ poke-pipe-connect
|= {app/term source/path station/knot}
^- {(list move) _+>.$}
:_ +>.$(connections (~(put in connections) [app source station]))
:_ ~
~& [%peeling app source station]
:* ost.hid %peel [%subscribe app station source]
[our.hid app] %talk-speeches source
==
::
++ diff-talk-speeches
|= {way/wire speeches/(list speech:talk)}
^- {(list move) _+>.$}
?> ?=({$subscribe @ @ *} way)
=+ app=(slav %tas i.t.way)
=+ station=i.t.t.way
=+ source=t.t.t.way
?. (~(has in connections) [app source station])
%- %- slog :~
leaf+"pipe dropping:"
leaf+"{(trip app)}{<`path`source>} ---> {(trip station)}"
==
[~ +>.$]
:_ +>.$ :_ ~
:* ost.hid %poke [%relay app station source]
[our.hid %talk] %talk-command
%publish
|- ^- (list thought:talk)
?~ speeches
~
:_ $(speeches t.speeches, eny.hid (shax (cat 3 %pipe eny.hid)))
:* `@uvH`(end (sub 'H' 'A') 1 eny.hid)
[[[%& our.hid station] *envelope:talk %pending] ~ ~]
now.hid *(set flavor:talk) i.speeches
==
==
::
++ coup-relay
|= {way/wire saw/(unit tang)}
^- {(list move) _+>.$}
?> ?=({@ @ @ *} way)
?~ saw
[~ +>.$]
%- (slog leaf+"pipe relay failure in:" >way< u.saw)
[~ +>.$]
--

View File

@ -2023,6 +2023,15 @@
$url url+(crip (earf p.sep))
$mor mor+(turn p.sep |=(speech ^$(sep +<)))
$fat [%mor $(sep q.sep) tan+(tr-rend-tors p.sep) ~]
$api
:- %tan
:_ ~
:+ %rose
[": " ~ ~]
:~ leaf+"[{(trip id.sep)} on {(trip service.sep)}]"
leaf+(trip body.sep)
leaf+(earn url.sep)
==
==
::
++ tr-rend-tors
@ -2095,6 +2104,9 @@
::
$app
(tr-chow 64 "[{(trip p.sep)}]: {(trip q.sep)}")
::
$api
(tr-chow 64 "[{(trip id.sep)}@{(trip service.sep)}]: {(trip summary.sep)}")
==
--
::

View File

@ -20,7 +20,7 @@
== == ::
$: $e :: to self
$% {$thud $~} :: proxied death
{$this p/? q/clip r/httq} :: proxied request
{$this p/? r/clip s/httq} :: proxied request
{$meta vase:{$them (unit httr)}} :: type check
== == ::
$: $f :: to %ford
@ -64,7 +64,7 @@
{$ow p/ixor $~} :: dying view
{$on $~} :: dependency
== ::
++ whir-of {p/knot:ship q/term r/wire} :: path in dock
++ whir-of {p/knot:ship q/term r/?($mess $lens) s/wire} :: path in dock
++ whir-se ?($core vi-arm) :: build/call
++ vi-arm
$? $out :: ++out mod request
@ -75,7 +75,7 @@
-- ::
|% :: models
++ bolo :: eyre state
$: $4 :: version
$: $5 :: version
gub/@t :: random identity
hov/(unit ship) :: master for remote
top/beam :: ford serve prefix
@ -178,7 +178,7 @@
?~ quy [%$ %n ~]~
[[%$ %t p.i.quy] [%$ %t q.i.quy] $(quy t.quy)]
::
++ gsig |=({a/dock b/path} [(scot %p p.a) q.a b])
++ gsig |=({a/dock b/?($mess $lens) c/path} [(scot %p p.a) q.a b c])
++ session-from-cookies
|= {nam/@t maf/math}
^- (unit hole)
@ -599,7 +599,7 @@
=. our ?~(hov p.kyz (min u.hov p.kyz))
+>.$(hov [~ our], top [[our %home ud+0] /web])
::
$this :: inbound request
?($chis $this) :: inbound request
%- emule |. ^+ ..apex
=* sec p.kyz :: ? :: https bit
=* heq r.kyz :: httq :: request content
@ -613,9 +613,11 @@
[[sec (rash i.hot thor:epur)] p.ryp q.ryp]
==
=. p.p.pul |(p.p.pul ?=(hoke r.p.pul))
?: ?=($chis -.kyz) :: IPC escape hatch
~(lens handle pul [q.+.kyz |] [p.heq maf s.heq])
=+ her=(host-to-ship r.p.pul)
?: |(?=($~ her) =(our u.her))
(handle pul [q.+.kyz |] [p.heq maf s.heq])
~(apex handle pul [q.+.kyz |] [p.heq maf s.heq])
=+ han=(sham hen)
=. pox (~(put by pox) han hen)
(ames-gram u.her [%get ~] han +.kyz)
@ -750,6 +752,7 @@
=+ cuf=`cuft`+>.sih
?- -.cuf
?($coup $reap)
~? ?=($lens r.q.tee) hen=hen^hcuf=-.cuf
(get-ack:(ire-ix p.tee) q.tee ?~(p.cuf ~ `[-.cuf u.p.cuf]))
::
$doff !!
@ -911,7 +914,7 @@
++ new-deps
|= {a/@uvH b/(each duct ixor)} ^+ +>.$
:: ~& new-deps+[a b]
?: =(`@`0 a) +>.$
?: =(`@`~ a) +>.$
=+ had=(~(has by liz) a)
=. liz (~(put ju liz) a b)
?: had +>.$
@ -983,12 +986,10 @@
::
::
++ handle
|= $: {hat/hart pok/pork quy/quay} :: purl parsed url
|_ $: {hat/hart pok/pork quy/quay} :: purl parsed url
{cip/clip aut/?} :: client ip nonymous?
{mef/meth maf/math bod/(unit octs)} :: method+headers+body
==
=< apex
|%
++ abet ..handle
++ done .
++ teba |*(a/$-(* ..handle) |*(b/* %_(done ..handle (a b))))
@ -1015,6 +1016,13 @@
?: ?=($| -.pez) p.pez
(resolve ~ p.pez)
::
++ lens
=< abet
:: (process-parsed [%mess [our %dojo] %lens-command /lens (need grab-json)])
=^ orx ..ya new-view:(logon:for-client our)
=+ vew=(ire-ix (oryx-to-ixor orx))
((teba new-lens.vew) (need grab-json))
::
++ resolve
|= {cug/(list @t) pez/pest} ^+ done
?~ pez done
@ -1268,7 +1276,7 @@
::
$mess
:- %|
=^ orx ..ya ?:(is-anon new-view:for-client [(need grab-oryx) ..ya])
=^ orx ..ya ?:(is-anon new-view:for-client [(need grab-oryx) ..ya])
=+ vew=(ire-ix (oryx-to-ixor orx))
((teba new-mess.vew) p.hem r.hem q.hem %json !>(`json`s.hem))
::
@ -1518,7 +1526,7 @@
++ give-json (teba ^give-json)
++ pass-note (teba ^pass-note)
++ hurl-note
|= {a/{dock path} b/note} ^+ ..ix
|= {a/{dock ?($mess $lens) path} b/note} ^+ ..ix
=: med (~(put to med) hen)
hen `~
==
@ -1538,40 +1546,73 @@
|= a/even ^+ eve
[+(p.eve) (~(put by q.eve) p.eve a)]
::
++ new-lens
|= jon/json ^+ ..ix
=. +>.$
%+ pass-note
[%of ire (gsig [our %dojo] lens+/)]
[%g %deal [him our] %dojo %peel %lens-json /sole]
=. +>.$
%+ pass-note
[%of ire (gsig [our %dojo] lens+/)]
[%g %deal [him our] %dojo %punk %lens-command %json !>(`json`jon)]
abet
::
++ new-mess
|= {a/dock b/wire c/mark d/cage} ^+ ..ix
(hurl-note [a b] [%g %deal [him -.a] +.a %punk c d])
(hurl-note [a mess+b] [%g %deal [him -.a] +.a %punk c d])
::
++ add-subs
|= {a/dock $json b/wire c/path} ^+ ..ix
?: (~(has in sus) +<) ~|(duplicate+c !!)
=. sus (~(put in sus) +<)
(hurl-note [a b] [%g %deal [him -.a] +.a %peel %json c])
(hurl-note [a mess+b] [%g %deal [him -.a] +.a %peel %json c])
::
++ pul-subs
|= {a/dock $json b/wire c/path} ^+ ..ix
=. sus (~(del in sus) +<)
(hurl-note [a b] [%g %deal [him -.a] +.a %pull ~])
(hurl-note [a mess+b] [%g %deal [him -.a] +.a %pull ~])
::
++ del-subs :: XX per path?
|= {a/dock $json b/wire c/path} ^+ ..ix
=. ..ix (pul-subs +<)
(nice-json:pop-duct:(ire-ix ire)) :: XX gall ack
::
++ get-lens
|= {a/whir-of fec/json} ^+ ..ix
?~ fec ..ix :: nulled event we don't care about
=. +>.$
%+ pass-note
`whir`[%of ire (gsig [our %dojo] lens+/)]
`note`[%g %deal [him our] %dojo %pull ~]
abet:(give-json 200 ~ fec)
::
++ get-rush
|= {a/whir-of b/json} ^+ ..ix
(get-even [%rush [[(slav %p p.a) q.a] r.a] (joba %json b)])
?: ?=($lens r.a)
(get-lens a b)
(get-even [%rush [[(slav %p p.a) q.a] s.a] (joba %json b)])
::
++ get-quit
|= a/whir-of ^+ ..ix
(get-even [%quit [[(slav %p p.a) q.a] r.a]])
(get-even [%quit [[(slav %p p.a) q.a] s.a]])
::
++ get-ack
|= {a/whir-of b/(unit {term tang})} ^+ ..ix
?: ?=($lens r.a)
(ack-lens b)
?: =(~ med) ~& resp-lost+ire ..ix
?~ b (nice-json:pop-duct)
(mean-json:pop-duct 500 b)
::
++ ack-lens
|= a/(unit (pair term tang)) ^+ ..ix
?~ a
..ix :: (give-json 200 ~ (joba %okey-dokey %b &))
=+ tag=(flop `tang`[>[%eyre-lens-fail p.u.a]< q.u.a])
%- (slog tag)
abet:(give-json 500 ~ (jape (wush 160 tag)))
::
++ get-even
|= ven/even ^+ ..ix
=+ num=p.eve
@ -1584,7 +1625,7 @@
++ give-even
|= {pol/? num/@u ven/even} ^+ done
=: q.eve (~(del by q.eve) (dec num)) :: TODO ponder a-2
mow ?.(?=($rush -.ven) mow mow:(pass-took p.ven))
mow ?.(?=($rush -.ven) mow mow:(pass-took [- %mess +]:p.ven))
==
?> pol :: XX eventstream
%^ give-json 200 ~
@ -1601,7 +1642,7 @@
(pass-note of+/[ire] [%b %rest era])
::
++ pass-took
|= a/{p/dock wire}
|= a/{p/dock ?($mess $lens) wire}
%+ pass-note(hen `~)
[%of ire (gsig a)]
[%g %deal [him -.p.a] +.p.a %pump ~]
@ -1879,8 +1920,12 @@
~
::
++ load :: take previous state
|= old/bolo
..^$(+>- old)
=+ bolo-4={$4 _%*(+ *bolo lyv *(map duct ^))}
|= old/?(bolo bolo-4)
?- -.old
$5 ..^$(+>- old)
$4 $(old [%5 +.old(lyv ~)]) :: minor leak
==
::
++ scry
|= {fur/(unit (set monk)) ren/@tas who/ship syd/desk lot/coin tyl/path}
@ -1925,4 +1970,3 @@
q.hin
[mos ..^$]
--

View File

@ -1,4 +1,5 @@
!: :: %gall, agent execution
!? 163
::::
|= pit/vase
@ -786,6 +787,7 @@
(ap-move-pass -.q.vax +<.q.vax cav)
$diff (ap-move-diff -.q.vax cav)
$hiss (ap-move-hiss -.q.vax cav)
$peel (ap-move-peel -.q.vax cav)
$peer (ap-move-peer -.q.vax cav)
$pull (ap-move-pull -.q.vax cav)
$poke (ap-move-poke -.q.vax cav)
@ -875,6 +877,22 @@
:- p.p.yep
[%send q.p.yep r.p.yep %poke p.q.gaw paw]
::
++ ap-move-peel :: pass %peel
|= {sto/bone vax/vase}
^- {(each cove tang) _+>}
=^ yep +>.$ (ap-move-mess vax)
:_ +>.$
?: ?=($| -.yep) yep
=+ mar=((soft mark) +>-.q.vax)
?~ mar
[%| (ap-suck "peel: malformed mark")]
=+ pux=((soft path) +>+.q.vax)
?. &(?=(^ pux) (levy u.pux (sane %ta)))
[%| (ap-suck "peel: malformed path")]
:^ %& sto %pass
:- p.p.yep
[%send q.p.yep r.p.yep %peel u.mar u.pux]
::
++ ap-move-peer :: pass %peer
|= {sto/bone vax/vase}
^- {(each cove tang) _+>}

View File

@ -2181,7 +2181,7 @@
{{$hat $~} p/hole q/hart} :: login redirect
{{$get $~} p/@uvH q/{? clip httq}} :: remote request
{{$got $~} p/@uvH q/httr} :: remote response
{{$gib $~} p/@uvH} :: remote cancel
{{$gib $~} p/@uvH} :: remote cancel
== ::
:::: ::
++ kiss-eyre :: in request ->$
@ -2192,6 +2192,7 @@
{$serv p/$@(desk beam)} :: set serving root
{$them p/(unit hiss)} :: outbound request
{$they p/@ud q/httr} :: inbound response
{$chis p/? q/clip r/httq} :: IPC inbound request
{$this p/? q/clip r/httq} :: inbound request
{$thud $~} :: inbound cancel
{$wegh $~} :: report memory

6
gen/pipe/cancel.hoon Normal file
View File

@ -0,0 +1,6 @@
!:
:- %say
|= $: {now/@da eny/@uvI bec/beak}
{{app/term source/path station/knot $~} $~}
==
[%pipe-cancel app source station]

6
gen/pipe/connect.hoon Normal file
View File

@ -0,0 +1,6 @@
!:
:- %say
|= $: {now/@da eny/@uvI bec/beak}
{{app/term source/path station/knot $~} $~}
==
[%pipe-connect app source station]

6
gen/pipe/list.hoon Normal file
View File

@ -0,0 +1,6 @@
!:
:- %say
|= $: {now/@da eny/@uvI bec/beak}
{$~ $~}
==
[%pipe-list ~]

View File

@ -1,7 +1,32 @@
:: Converts the result of an 'issues' event into a issues:gh.
/- gh
/+ gh-parse
/+ gh-parse, talk
|_ issue-comment/issue-comment:gh
++ grow
|%
++ talk-speeches
^- (list speech:talk)
:_ ~
=+ ^= txt
;: (cury cat 3)
'on issue #'
`@t`(rsh 3 2 (scot %ui number.issue.issue-comment))
': '
body.comment.issue-comment
==
:* %api %github
login.sender.issue-comment
(need (epur url.sender.issue-comment))
txt
txt
(need (epur url.comment.issue-comment))
%- jobe :~
repository+s+name.repository.issue-comment
number+(jone number.issue.issue-comment)
title+s+title.issue.issue-comment
==
==
--
++ grab
|%
++ json

View File

@ -1,7 +1,119 @@
:: Converts the result of an 'issues' event into a issues:gh.
/- gh
/+ gh-parse
/+ gh-parse, talk
|_ issues/issues:gh
++ grow
|%
++ talk-speeches
^- (list speech:talk)
:_ ~
=+ ^= txt
?- -.action.issues
$assigned
;: (cury cat 3)
'assigned issue #'
(rsh 3 2 (scot %ui number.issue.issues))
' to '
login.assignee.action.issues
' ('
title.issue.issues
')'
==
::
$unassigned
;: (cury cat 3)
'unassigned issue #'
(rsh 3 2 (scot %ui number.issue.issues))
' from '
login.assignee.action.issues
' ('
title.issue.issues
')'
==
::
$labeled
;: (cury cat 3)
'labeled issue #'
(rsh 3 2 (scot %ui number.issue.issues))
' as '
name.label.action.issues
' ('
title.issue.issues
')'
==
::
$unlabeled
;: (cury cat 3)
'unlabeled issue #'
(rsh 3 2 (scot %ui number.issue.issues))
' as '
name.label.action.issues
' ('
title.issue.issues
')'
==
::
$opened
;: (cury cat 3)
'opened issue #'
(rsh 3 2 (scot %ui number.issue.issues))
': '
title.issue.issues
==
::
$closed
;: (cury cat 3)
'closed issue #'
(rsh 3 2 (scot %ui number.issue.issues))
': '
title.issue.issues
==
::
$reopened
;: (cury cat 3)
'reopened issue #'
(rsh 3 2 (scot %ui number.issue.issues))
': '
title.issue.issues
==
==
:* %api %github
login.sender.issues
(need (epur url.sender.issues))
txt txt
(need (epur url.issue.issues))
%- jobe
%+ welp
:~ repository+s+name.repository.issues
number+(jone number.issue.issues)
title+s+title.issue.issues
action+s+-.action.issues
==
?- -.action.issues
$assigned
:~ assignee+s+login.assignee.action.issues
assignee-url+s+url.assignee.action.issues
==
::
$unassigned
:~ assignee+s+login.assignee.action.issues
assignee-url+s+url.assignee.action.issues
==
::
$labeled
:~ label+s+name.label.action.issues
==
::
$unlabeled
:~ label+s+name.label.action.issues
==
::
$opened ~
$closed ~
$reopened ~
==
==
--
++ grab
|%
++ json

View File

@ -1,6 +1,6 @@
|_ {method/meth endpoint/path jon/json}
|_ {method/meth endpoint/(list @t) jon/json}
++ grab
|%
++ noun {method/meth endpoint/path jon/json}
++ noun {method/meth endpoint/(list @t) jon/json}
--
--

60
mar/lens/command.hoon Normal file
View File

@ -0,0 +1,60 @@
/- lens
!:
|_ com/command:lens
++ grab
|%
++ noun command:lens
++ json
|= jon/^json
^- command:lens
%- need
%. jon
=> [. jo]
=< %- ot :~
source+source
sink+sink
==
|%
++ source
^- $-(^json (unit source:lens))
|= jon/^json
=+ tuple=%.(jon (ar source))
?^ tuple
`[%tuple u.tuple]
%. jon
%- of :~
data+so:jo
dojo+so:jo
clay+so:jo
url+(su auri:urlp)
api+(su ;~(plug sym ;~(pfix col prn)))
:- %get-api
%- su
;~ plug
sym
;~(pfix col (more fas (cook crip (star ;~(less fas prn)))))
==
listen-api+(su ;~(plug sym ;~(pfix col sym)))
as+(ot mark+(su sym) next+source ~)
hoon+(ot code+so:jo next+source ~)
==
++ sink
^- $-(^json (unit sink:lens))
%- of :~
stdout+|=(^json (some ~))
output-file+so:jo
output-clay+(su (easy /sentinel/path))
url+(su auri:urlp)
to-api+(su ;~(plug sym ;~(pfix col prn)))
:- %send-api
%- su
;~ plug
sym
;~(pfix col (more fas (cook crip (star ;~(less fas prn)))))
==
command+so:jo
app+(su sym)
==
--
--
--

12
mar/lens/json.hoon Normal file
View File

@ -0,0 +1,12 @@
::
:::: /hoon/json/lens/mar
::
/? 310
!:
:::: ~fyr
::
|_ jon/json
++ grab |% ++ noun json
--
++ grow |% ++ json jon
-- --

View File

@ -41,6 +41,22 @@
--
++ grow
|%
++ lens-json :: json for cli client
^- ?($~ ^json) :: null = ignore
?+ -.sef ~
$tan s+(role (turn (flop p.sef) |=(a/tank (crip ~(ram re a)))))
$txt s+(crip p.sef)
$sav
(jobe file+s+(crip <`path`p.sef>) data+s+(crip (sifo q.sef)) ~)
::
$mor
=+ all=(turn p.sef |=(a/sole-effect lens-json(sef a)))
=. all (skip all |=(a/^json ?=($~ a)))
?~ all ~
?~ t.all i.all
~|(multiple-effects+`(list ^json)`all !!)
==
::
++ json
^- ^json
?+ -.sef

View File

@ -91,6 +91,17 @@
$app (jobe txt+[%s q.a] src+[%s p.a] ~)
$fat (jobe tor+(tors p.a) taf+$(a q.a) ~)
$mor a+(turn p.a spec)
$api
%- jobe :~
service+s+service.a
id+s+id.a
~& url=`*`id-url.a
id-url+s+(crip (earn id-url.a))
summary+s+summary.a
body+s+body.a
url+s+(crip (earn url.a))
meta+meta.a
==
:: %inv (jobe ship+(jope p.a) party+[%s q.a] ~)
==
::

23
mar/talk/speeches.hoon Normal file
View File

@ -0,0 +1,23 @@
::
:::: /hoon/speeches/talk/mar
::
/? 310
/- talk
/+ talk,map-to-json
!:
=+ talk
|_ gam/(list speech)
::
++ grab
|%
++ noun (list speech)
--
::
++ grad
|%
++ form %talk-speeches
++ diff |=((list speech) +<)
++ pact |=((list speech) +<)
++ join |=({(list speech) (list speech)} `(unit mime)`~)
--
--

28
sur/lens.hoon Normal file
View File

@ -0,0 +1,28 @@
|%
++ command
$: source/source
sink/sink
==
++ source
$% {$data data/@}
{$dojo command/@t}
{$clay pax/@t}
{$url url/purl}
{$api api/term command/@t}
{$get-api api/term endpoint/(list @t)}
{$as mar/mark next/source} :: can't be at the
{$hoon code/@t next/source} :: end since they
{$tuple next/(list source)} :: don't bunt well
{$listen-api api/term event/term}
==
++ sink
$% {$stdout $~}
{$output-file pax/@t}
{$output-clay pax/path}
{$url url/purl}
{$to-api api/term command/@t}
{$send-api api/term endpoint/(list @t)}
{$command command/@t}
{$app app/term}
==
--

View File

@ -65,6 +65,15 @@
{$lin p/? q/@t} :: no/@ text line
{$mor p/(list speech)} :: multiplex
{$app p/@tas q/@t} :: app message
$: $api :: api message
service/@tas :: service name
id/@t :: id on the service
id-url/purl :: link to id
summary/@t :: summary of event
body/@t :: body of event
url/purl :: link to event
meta/json :: other data for web
== ::
== ::
++ serial @uvH :: unique identity
++ partner (each station passport) :: interlocutor