mirror of
https://github.com/urbit/shrub.git
synced 2025-01-04 10:32:34 +03:00
qualified library names in userspace
This commit is contained in:
parent
4a911fd279
commit
8ee93321de
@ -63,7 +63,7 @@ $: cred=(unit ,[app-secret=@t client-id=@t])
|
||||
++ old-api
|
||||
|= [pour-path=wire end-point=path req=$|(%get [%post p=json])]
|
||||
^- move
|
||||
%^ httpreq ost.hid pour-path
|
||||
%^ send:http ost.hid pour-path
|
||||
[/com/coinbase/api v1/end-point req ~ ['access_token' access:(need auth.vat)]~]
|
||||
::
|
||||
++ api-call
|
||||
|
@ -4,8 +4,6 @@
|
||||
::
|
||||
/? 314
|
||||
/- talk
|
||||
/+ talk, sole, http
|
||||
|
||||
::
|
||||
::
|
||||
:::: sivtyv-barnel
|
||||
|
@ -4,10 +4,10 @@
|
||||
/? 314 :: arvo kelvin
|
||||
/- sole :: console structures
|
||||
/+ sole :: console library
|
||||
[. sole]
|
||||
:: :: ::
|
||||
:::: :: ::::
|
||||
!: :: ::
|
||||
[sole .]
|
||||
=> |% :: external structures
|
||||
++ house :: all state
|
||||
$: hoc=(map bone session) :: conversations
|
||||
@ -361,7 +361,7 @@
|
||||
!&(?=(%del -.u.per) =(+(p.u.per) (lent buf.say)))
|
||||
==
|
||||
dy-abet(per ~)
|
||||
=^ lic say (~(transmit cs say) u.per)
|
||||
=^ lic say (~(transmit sole say) u.per)
|
||||
(dy-diff(per ~) %mor [%det lic] [%err q.q.cag] ~)
|
||||
::
|
||||
++ dy-done :: dialog submit
|
||||
@ -404,10 +404,10 @@
|
||||
++ dy-edit :: handle edit
|
||||
|= cal=sole-change
|
||||
^+ +>+>
|
||||
=^ dat say (~(transceive cs say) cal)
|
||||
=^ dat say (~(transceive sole say) cal)
|
||||
?: |(?=(^ per) ?=(^ pux) ?=(~ pro))
|
||||
~& %dy-edit-busy
|
||||
=^ lic say (~(transmit cs say) dat)
|
||||
=^ lic say (~(transmit sole say) dat)
|
||||
(dy-diff %mor [%det lic] [%bel ~] ~)
|
||||
(dy-slam(per `dat) /edit u.pro !>((tufa buf.say)))
|
||||
::
|
||||
@ -567,7 +567,7 @@
|
||||
::
|
||||
++ he-pone :: clear prompt
|
||||
^+ .
|
||||
=^ cal say (~(transmit cs say) [%set ~])
|
||||
=^ cal say (~(transmit sole say) [%set ~])
|
||||
(he-diff %mor [%det cal] ~)
|
||||
::
|
||||
++ he-prom :: send prompt
|
||||
@ -612,7 +612,7 @@
|
||||
^+ +>
|
||||
:: ~& [%his-clock ler.cal]
|
||||
:: ~& [%our-clock ven.say]
|
||||
=^ dat say (~(transceive cs say) cal)
|
||||
=^ dat say (~(transceive sole say) cal)
|
||||
?. ?& ?=(%del -.dat)
|
||||
=(+(p.dat) (lent buf.say))
|
||||
==
|
||||
@ -620,7 +620,7 @@
|
||||
=+ foy=(he-dope (tufa buf.say))
|
||||
?: ?=(%& -.foy) +>.$
|
||||
:: ~& [%bad-change dat ted.cal]
|
||||
=^ lic say (~(transmit cs say) dat)
|
||||
=^ lic say (~(transmit sole say) dat)
|
||||
:: ~& [%our-leg leg.say]
|
||||
(he-diff %mor [%det lic] [%err q.p.foy] ~)
|
||||
::
|
||||
@ -644,7 +644,7 @@
|
||||
%| (he-diff [%err p.doy])
|
||||
%&
|
||||
=+ old=(weld "> " (tufa buf.say))
|
||||
=^ cal say (~(transmit cs say) [%set ~])
|
||||
=^ cal say (~(transmit sole say) [%set ~])
|
||||
%. p.doy
|
||||
=< he-plan
|
||||
%- he-diff
|
||||
|
@ -59,7 +59,7 @@
|
||||
++ coup-helm-hi (wrap coup-hi):from-helm
|
||||
++ diff-sole-effect-drum-phat (wrap diff-sole-effect-phat):from-drum
|
||||
++ from-lib
|
||||
|* _[%helm ..$ ,_abet]:(helm-work)
|
||||
|* _[%helm ..$ ,_abet]:(helm)
|
||||
=> .(+< [identity start finish]=+<)
|
||||
=- [wrap=- *start] :: usage (wrap handle-arm):from-foo
|
||||
|* handle=_finish
|
||||
@ -67,9 +67,9 @@
|
||||
=. +>.handle (start hid (able identity))
|
||||
(ably (handle +<))
|
||||
::
|
||||
++ from-drum (from-lib %drum [..$ ,_se-abet]:(drum-work))
|
||||
++ from-helm (from-lib %helm [..$ ,_abet]:(helm-work))
|
||||
++ from-kiln (from-lib %kiln [..$ ,_abet]:(kiln-work))
|
||||
++ from-drum (from-lib %drum [..$ ,_se-abet]:(drum))
|
||||
++ from-helm (from-lib %helm [..$ ,_abet]:(helm))
|
||||
++ from-kiln (from-lib %kiln [..$ ,_abet]:(kiln))
|
||||
::
|
||||
++ init-helm |=([way=wire *] [~ +>])
|
||||
++ made-kiln (wrap take-made):from-kiln
|
||||
|
@ -66,12 +66,12 @@
|
||||
|^ ?:(?=(%det -.act) (delt +.act) dive) ::
|
||||
++ abet ..work(eye (~(put by eye) ost say)) :: resolve
|
||||
++ delt |= cal=sole-change :: edit command line
|
||||
=^ cul say (~(remit cs say) cal good) ::
|
||||
=^ cul say (~(remit sole say) cal good) ::
|
||||
?~(cul abet fail:(fect:abet det/u.cul)) ::
|
||||
++ dive =+ (rust (tufa buf.say) (punt come)) :: apply command line
|
||||
?~(- fail ?~(-> show (kick:wipe ->+))) ::
|
||||
++ good |=((list ,@c) -:(rose (tufa +<) come)) :: validate input
|
||||
++ wipe =^ cal say (~(transmit cs say) set/~) :: clear line
|
||||
++ wipe =^ cal say (~(transmit sole say) set/~) :: clear line
|
||||
(fect:abet %det cal) ::
|
||||
-- ::
|
||||
:: :: ::
|
||||
|
@ -84,12 +84,12 @@
|
||||
++ abet ..work(eye (~(put by eye) ost say)) :: resolve
|
||||
++ cusp (cope !ept:here) :: parsing rule
|
||||
++ delt |= cal=sole-change :: edit command line
|
||||
=^ cul say (~(remit cs say) cal good) ::
|
||||
=^ cul say (~(remit sole say) cal good) ::
|
||||
?~(cul abet fail:(fect:abet det/u.cul)) ::
|
||||
++ dive =+ (rust (tufa buf.say) (punt come)) :: apply command line
|
||||
?~(- fail ?~(-> show (kick:wipe ->+))) ::
|
||||
++ good |=((list ,@c) -:(rose (tufa +<) cusp)) :: validate input
|
||||
++ wipe =^ cal say (~(transmit cs say) set/~) :: clear line
|
||||
++ wipe =^ cal say (~(transmit sole say) set/~) :: clear line
|
||||
(fect:abet %det cal) ::
|
||||
-- ::
|
||||
:: :: ::
|
||||
|
@ -94,12 +94,12 @@
|
||||
++ abet ..work(eye (~(put by eye) ost say)) :: resolve
|
||||
++ cusp (cope !ept:here) :: parsing rule
|
||||
++ delt |= cal=sole-change :: edit command line
|
||||
=^ cul say (~(remit cs say) cal good) ::
|
||||
=^ cul say (~(remit sole say) cal good) ::
|
||||
?~(cul abet fail:(fect:abet det/u.cul)) ::
|
||||
++ dive =+ (rust (tufa buf.say) (punt come)) :: apply command line
|
||||
?~(- fail ?~(-> show (kick:wipe ->+))) ::
|
||||
++ good |=((list ,@c) -:(rose (tufa +<) cusp)) :: validate input
|
||||
++ wipe =^ cal say (~(transmit cs say) set/~) :: clear line
|
||||
++ wipe =^ cal say (~(transmit sole say) set/~) :: clear line
|
||||
(fect:abet %det cal) ::
|
||||
-- ::
|
||||
:: :: ::
|
||||
|
@ -114,12 +114,12 @@
|
||||
++ abet ..work(eye (~(put by eye) ost say)) :: resolve
|
||||
++ cusp (cope !ept:here) :: parsing rule
|
||||
++ delt |= cal=sole-change :: edit command line
|
||||
=^ cul say (~(remit cs say) cal good) ::
|
||||
=^ cul say (~(remit sole say) cal good) ::
|
||||
?~(cul abet fail:(fect:abet det/u.cul)) ::
|
||||
++ dive =+ (rust (tufa buf.say) (punt comb)) :: apply command line
|
||||
?~(- fail ?~(-> show (plot:wipe ->+))) ::
|
||||
++ good |=((list ,@c) -:(rose (tufa +<) cusp)) :: validate input
|
||||
++ wipe =^ cal say (~(transmit cs say) set/~) :: clear line
|
||||
++ wipe =^ cal say (~(transmit sole say) set/~) :: clear line
|
||||
(fect:abet %det cal) ::
|
||||
-- ::
|
||||
:: :: ::
|
||||
|
@ -11,7 +11,7 @@
|
||||
!:
|
||||
::::
|
||||
::
|
||||
[talk sole .]
|
||||
[. talk sole]
|
||||
=> |% :: data structures
|
||||
++ house ,[%1 house-1] :: full state
|
||||
++ house-any :: app history
|
||||
@ -741,13 +741,13 @@
|
||||
^+ +>
|
||||
?~ lit +>
|
||||
=^ lic say.she
|
||||
(~(transmit cs say.she) `sole-edit`?~(t.lit i.lit [%mor lit]))
|
||||
(~(transmit sole say.she) `sole-edit`?~(t.lit i.lit [%mor lit]))
|
||||
(sh-fact [%mor [%det lic] ~])
|
||||
::
|
||||
++ sh-stir :: apply edit
|
||||
|= cal=sole-change
|
||||
^+ +>
|
||||
=^ inv say.she (~(transceive cs say.she) cal)
|
||||
=^ inv say.she (~(transceive sole say.she) cal)
|
||||
=+ lit=(sh-sane inv buf.say.she)
|
||||
?~ lit
|
||||
+>.$
|
||||
@ -896,7 +896,7 @@
|
||||
?~ jub (sh-fact %bel ~)
|
||||
=. +> (sh-work u.jub)
|
||||
=+ buf=buf.say.she
|
||||
=^ cal say.she (~(transmit cs say.she) [%set ~])
|
||||
=^ cal say.she (~(transmit sole say.she) [%set ~])
|
||||
%- sh-fact
|
||||
:* %mor
|
||||
[%nex ~]
|
||||
|
@ -625,7 +625,7 @@
|
||||
++ fair :: hood parsing rule
|
||||
|= bem=beam
|
||||
?> ?=([%ud 0] r.bem) :: XX sentinel
|
||||
=+ vez=(vang | (tope bem))
|
||||
=+ vez=(vang & (tope bem))
|
||||
=< hood
|
||||
|%
|
||||
++ case
|
||||
|
@ -8,15 +8,13 @@
|
||||
[markdown .]
|
||||
// /%/parse :: inli donp parse
|
||||
// /%/rend :: sing sung sang flat into-inner
|
||||
~% %down ..is ~
|
||||
|%
|
||||
++ down-jet
|
||||
~% %down ..is ~
|
||||
|%
|
||||
++ mark
|
||||
~/ %mark
|
||||
|= p=@t
|
||||
(normalize (rash p parse))
|
||||
::
|
||||
++ print sing
|
||||
--
|
||||
++ mark
|
||||
~/ %mark
|
||||
|= p=@t
|
||||
(normalize (rash p parse))
|
||||
::
|
||||
++ print sing
|
||||
--
|
||||
=*(down-jet . .)
|
||||
|
1387
lib/drum.hoon
1387
lib/drum.hoon
File diff suppressed because it is too large
Load Diff
271
lib/helm.hoon
271
lib/helm.hoon
@ -2,6 +2,9 @@
|
||||
:::: /hoon/helm/lib :: ::
|
||||
:: :: ::
|
||||
/? 310 :: version
|
||||
/- sole
|
||||
/+ talk
|
||||
[. sole]
|
||||
:: :: ::
|
||||
:::: :: ::
|
||||
:: :: ::
|
||||
@ -37,140 +40,138 @@
|
||||
:: :: ::
|
||||
:::: :: ::
|
||||
!: :: ::
|
||||
|% :: helm library
|
||||
++ helm-work :: work in helm
|
||||
|= [bowl helm-part]
|
||||
=+ sez=(fall (~(get by hoc) ost) *helm-session)
|
||||
=> |% :: arvo structures
|
||||
++ card ::
|
||||
$% [%cash wire p=@p q=buck] ::
|
||||
[%conf wire dock %load ship term] ::
|
||||
[%flog wire flog] ::
|
||||
[%poke wire dock pear] ::
|
||||
[%wont wire sock path *] :: send message
|
||||
== ::
|
||||
++ move (pair bone card) :: user-level move
|
||||
++ pear :: poke fruit
|
||||
$% [%hood-unsync desk ship desk] ::
|
||||
[%talk-command command:talk] ::
|
||||
[%helm-hi cord] ::
|
||||
== ::
|
||||
--
|
||||
|_ moz=(list move)
|
||||
++ abet :: resolve
|
||||
[(flop moz) %_(+>+>+<+ hoc (~(put by hoc) ost sez))]
|
||||
::
|
||||
++ emit |=(card %_(+> moz [[ost +<] moz])) :: return card
|
||||
++ emil :: return cards
|
||||
|= (list card)
|
||||
^+ +>
|
||||
?~(+< +> $(+< t.+<, +> (emit i.+<)))
|
||||
::
|
||||
++ poke-begin :: make/send keypair
|
||||
|= hood-begin =< abet
|
||||
?> ?=(~ bur)
|
||||
=+ buz=(shax :(mix (jam ges) eny))
|
||||
=+ loy=(bruw 2.048 buz)
|
||||
%- emit(bur `[his [0 sec:ex:loy]~])
|
||||
[%wont /helm/ticket [our (sein his)] /a/ta his tic ges pub:ex:loy]
|
||||
::
|
||||
++ poke-init :: initialize
|
||||
|= him=ship =< abet
|
||||
(emit %flog /helm %crud %hax-init leaf/(scow %p him) ~)
|
||||
::
|
||||
++ poke-mass
|
||||
|= ~ =< abet
|
||||
(emit %flog /heft %crud %hax-heft ~)
|
||||
::
|
||||
++ poke-send-hi
|
||||
|= [her=ship mes=(unit tape)] =< abet
|
||||
%^ emit %poke /helm/hi/(scot %p her)
|
||||
[[her %hood] %helm-hi ?~(mes '' (crip u.mes))]
|
||||
::
|
||||
++ poke-hi |=(mes=@t abet:(emit %flog /di %text "< {<src>}: {(trip mes)}"))
|
||||
++ coup-hi
|
||||
|= [pax=path cop=(unit tang)] =< abet
|
||||
?> ?=([@t ~] pax)
|
||||
(emit %flog ~ %text "hi {(trip i.pax)} {?~(cop "" "un")}succesful")
|
||||
::
|
||||
++ poke-reload |=(all=(list term) (poke-reload-desk %home all))
|
||||
++ poke-reload-desk :: reload vanes
|
||||
|= [syd=desk all=(list term)] =< abet
|
||||
%- emil
|
||||
%- flop
|
||||
%+ turn all
|
||||
=+ top=`path`/(scot %p our)/[syd]/(scot %da now)/arvo
|
||||
=+ ark=(arch .^(%cy top))
|
||||
=+ van=(~(tap by r.ark))
|
||||
|= nam=@tas
|
||||
=. nam
|
||||
?. =(1 (met 3 nam))
|
||||
nam
|
||||
=+ ^- zaz=(list ,[p=span ~])
|
||||
(skim van |=([a=term ~] =(nam (end 3 1 a))))
|
||||
?> ?=([[@ ~] ~] zaz)
|
||||
`term`p.i.zaz
|
||||
=+ tip=(end 3 1 nam)
|
||||
=+ way=(welp top /[nam])
|
||||
=+ fil=(,@ .^(%cx (welp way /hoon)))
|
||||
[%flog /reload [%veer ?:(=('z' tip) %$ tip) way fil]]
|
||||
::
|
||||
++ poke-invite :: send invite; fake
|
||||
|= [who=@p myl=@t] =< abet
|
||||
%^ emit %poke /helm/invite
|
||||
:- [our %talk]
|
||||
(said our %helm now eny [%leaf "invited: {<who>} at {(trip myl)}"]~)
|
||||
::
|
||||
++ poke-reset :: reset system
|
||||
|= hood-reset =< abet
|
||||
%- emil
|
||||
%- flop ^- (list card)
|
||||
=+ top=`path`/(scot %p our)/home/(scot %da now)/arvo
|
||||
:- [%flog /reset %vega (weld top `path`/hoon)]
|
||||
%+ turn
|
||||
^- (list ,[p=@tas q=@tas])
|
||||
:~ [%$ %zuse]
|
||||
[%a %ames]
|
||||
[%b %behn]
|
||||
[%c %clay]
|
||||
[%d %dill]
|
||||
[%e %eyre]
|
||||
[%f %ford]
|
||||
[%g %gall]
|
||||
==
|
||||
|= [p=@tas q=@tas]
|
||||
=+ way=`path`(welp top /[q])
|
||||
=+ txt=((hard ,@) .^(%cx (welp way /hoon)))
|
||||
[%flog /reset %veer p way txt]
|
||||
::
|
||||
++ poke-will :: hear certificate
|
||||
|= wil=(unit will)
|
||||
?> ?=(^ bur)
|
||||
?> ?=(^ wil)
|
||||
=< abet
|
||||
%- emil(bur ~)
|
||||
:~ [%cash /helm p.u.bur q.u.bur u.wil]
|
||||
[%poke /helm [our %hood] %hood-unsync %base (sein our) %kids]
|
||||
|= [bowl helm-part] :: main helm work
|
||||
=+ sez=(fall (~(get by hoc) ost) *helm-session)
|
||||
=> |% :: arvo structures
|
||||
++ card ::
|
||||
$% [%cash wire p=@p q=buck] ::
|
||||
[%conf wire dock %load ship term] ::
|
||||
[%flog wire flog] ::
|
||||
[%poke wire dock pear] ::
|
||||
[%wont wire sock path *] :: send message
|
||||
== ::
|
||||
++ move (pair bone card) :: user-level move
|
||||
++ pear :: poke fruit
|
||||
$% [%hood-unsync desk ship desk] ::
|
||||
[%talk-command command:talk] ::
|
||||
[%helm-hi cord] ::
|
||||
== ::
|
||||
--
|
||||
|_ moz=(list move)
|
||||
++ abet :: resolve
|
||||
[(flop moz) %_(+>+>+<+ hoc (~(put by hoc) ost sez))]
|
||||
::
|
||||
++ emit |=(card %_(+> moz [[ost +<] moz])) :: return card
|
||||
++ emil :: return cards
|
||||
|= (list card)
|
||||
^+ +>
|
||||
?~(+< +> $(+< t.+<, +> (emit i.+<)))
|
||||
::
|
||||
++ poke-begin :: make/send keypair
|
||||
|= hood-begin =< abet
|
||||
?> ?=(~ bur)
|
||||
=+ buz=(shax :(mix (jam ges) eny))
|
||||
=+ loy=(bruw 2.048 buz)
|
||||
%- emit(bur `[his [0 sec:ex:loy]~])
|
||||
[%wont /helm/ticket [our (sein his)] /a/ta his tic ges pub:ex:loy]
|
||||
::
|
||||
++ poke-init :: initialize
|
||||
|= him=ship =< abet
|
||||
(emit %flog /helm %crud %hax-init leaf/(scow %p him) ~)
|
||||
::
|
||||
++ poke-mass
|
||||
|= ~ =< abet
|
||||
(emit %flog /heft %crud %hax-heft ~)
|
||||
::
|
||||
++ poke-send-hi
|
||||
|= [her=ship mes=(unit tape)] =< abet
|
||||
%^ emit %poke /helm/hi/(scot %p her)
|
||||
[[her %hood] %helm-hi ?~(mes '' (crip u.mes))]
|
||||
::
|
||||
++ poke-hi |=(mes=@t abet:(emit %flog /di %text "< {<src>}: {(trip mes)}"))
|
||||
++ coup-hi
|
||||
|= [pax=path cop=(unit tang)] =< abet
|
||||
?> ?=([@t ~] pax)
|
||||
(emit %flog ~ %text "hi {(trip i.pax)} {?~(cop "" "un")}succesful")
|
||||
::
|
||||
++ poke-reload |=(all=(list term) (poke-reload-desk %home all))
|
||||
++ poke-reload-desk :: reload vanes
|
||||
|= [syd=desk all=(list term)] =< abet
|
||||
%- emil
|
||||
%- flop
|
||||
%+ turn all
|
||||
=+ top=`path`/(scot %p our)/[syd]/(scot %da now)/arvo
|
||||
=+ ark=(arch .^(%cy top))
|
||||
=+ van=(~(tap by r.ark))
|
||||
|= nam=@tas
|
||||
=. nam
|
||||
?. =(1 (met 3 nam))
|
||||
nam
|
||||
=+ ^- zaz=(list ,[p=span ~])
|
||||
(skim van |=([a=term ~] =(nam (end 3 1 a))))
|
||||
?> ?=([[@ ~] ~] zaz)
|
||||
`term`p.i.zaz
|
||||
=+ tip=(end 3 1 nam)
|
||||
=+ way=(welp top /[nam])
|
||||
=+ fil=(,@ .^(%cx (welp way /hoon)))
|
||||
[%flog /reload [%veer ?:(=('z' tip) %$ tip) way fil]]
|
||||
::
|
||||
++ poke-invite :: send invite; fake
|
||||
|= [who=@p myl=@t] =< abet
|
||||
%^ emit %poke /helm/invite
|
||||
:- [our %talk]
|
||||
(said:talk our %helm now eny [%leaf "invited: {<who>} at {(trip myl)}"]~)
|
||||
::
|
||||
++ poke-reset :: reset system
|
||||
|= hood-reset =< abet
|
||||
%- emil
|
||||
%- flop ^- (list card)
|
||||
=+ top=`path`/(scot %p our)/home/(scot %da now)/arvo
|
||||
:- [%flog /reset %vega (weld top `path`/hoon)]
|
||||
%+ turn
|
||||
^- (list ,[p=@tas q=@tas])
|
||||
:~ [%$ %zuse]
|
||||
[%a %ames]
|
||||
[%b %behn]
|
||||
[%c %clay]
|
||||
[%d %dill]
|
||||
[%e %eyre]
|
||||
[%f %ford]
|
||||
[%g %gall]
|
||||
==
|
||||
::
|
||||
++ poke-verb :: toggle verbose
|
||||
|= ~ =< abet
|
||||
(emit %flog /helm %verb ~)
|
||||
::
|
||||
++ take-onto :: result of %conf
|
||||
|= saw=(each suss tang) =< abet
|
||||
%- emit
|
||||
?- -.saw
|
||||
%| [%flog ~ %crud %onto `tang`p.saw]
|
||||
%& [%flog ~ %text "<{<p.saw>}>"]
|
||||
==
|
||||
::
|
||||
++ take-note :: result of %init
|
||||
|= [way=wire chr=@tD tan=tank] =< abet
|
||||
(emit %flog ~ %text chr ' ' ~(ram re tan))
|
||||
::
|
||||
++ take-woot :: result of %wont
|
||||
|= [way=wire her=ship cop=coop] =< abet
|
||||
(emit %flog ~ %text "woot: {<[way cop]>}")
|
||||
--
|
||||
|= [p=@tas q=@tas]
|
||||
=+ way=`path`(welp top /[q])
|
||||
=+ txt=((hard ,@) .^(%cx (welp way /hoon)))
|
||||
[%flog /reset %veer p way txt]
|
||||
::
|
||||
++ poke-will :: hear certificate
|
||||
|= wil=(unit will)
|
||||
?> ?=(^ bur)
|
||||
?> ?=(^ wil)
|
||||
=< abet
|
||||
%- emil(bur ~)
|
||||
:~ [%cash /helm p.u.bur q.u.bur u.wil]
|
||||
[%poke /helm [our %hood] %hood-unsync %base (sein our) %kids]
|
||||
==
|
||||
::
|
||||
++ poke-verb :: toggle verbose
|
||||
|= ~ =< abet
|
||||
(emit %flog /helm %verb ~)
|
||||
::
|
||||
++ take-onto :: result of %conf
|
||||
|= saw=(each suss tang) =< abet
|
||||
%- emit
|
||||
?- -.saw
|
||||
%| [%flog ~ %crud %onto `tang`p.saw]
|
||||
%& [%flog ~ %text "<{<p.saw>}>"]
|
||||
==
|
||||
::
|
||||
++ take-note :: result of %init
|
||||
|= [way=wire chr=@tD tan=tank] =< abet
|
||||
(emit %flog ~ %text chr ' ' ~(ram re tan))
|
||||
::
|
||||
++ take-woot :: result of %wont
|
||||
|= [way=wire her=ship cop=coop] =< abet
|
||||
(emit %flog ~ %text "woot: {<[way cop]>}")
|
||||
--
|
||||
=*(helm . .)
|
||||
|
@ -6,31 +6,27 @@
|
||||
/? 310
|
||||
!:
|
||||
|%
|
||||
++ httpreq
|
||||
|= $: ost=bone pour-path=wire
|
||||
$= params
|
||||
$: domain=(list cord) end-point=path
|
||||
req-type=$?(%get [%post json]) headers=math
|
||||
queries=quay
|
||||
==
|
||||
==
|
||||
:^ ost %them pour-path
|
||||
`(unit hiss)`[~ (httpreq-to-hiss params)]
|
||||
++ request
|
||||
$: domain=(list cord) end-point=path
|
||||
req-type=$?(%get [%post p=json]) headers=math
|
||||
queries=quay
|
||||
==
|
||||
++ send
|
||||
|= [ost=bone pour-path=wire params=request]
|
||||
:^ ost %them pour-path
|
||||
`(unit hiss)`[~ (request-to-hiss params)]
|
||||
::
|
||||
++ httpreq-to-hiss
|
||||
|= $: domain=(list cord) end-point=path
|
||||
req-type=$?(%get [%post p=json]) headers=math
|
||||
queries=quay
|
||||
==
|
||||
^- hiss :: cast to hiss
|
||||
=- ~& hiss=- -
|
||||
:- ^- parsed-url=purl
|
||||
:+ :+ security=%.y
|
||||
port=~
|
||||
host=[%.y [path=domain]]
|
||||
endpoint=[extensions=~ point=end-point] :: ++pork,
|
||||
q-strings=queries :: ++quay
|
||||
?@ req-type
|
||||
[%get headers ~]
|
||||
[%post headers ~ (tact (pojo p.req-type))]
|
||||
++ request-to-hiss
|
||||
|= request ^- hiss
|
||||
=- ~& hiss=- -
|
||||
:- ^- parsed-url=purl
|
||||
:+ :+ security=%.y
|
||||
port=~
|
||||
host=[%.y [path=domain]]
|
||||
endpoint=[extensions=~ point=end-point] :: ++pork,
|
||||
q-strings=queries :: ++quay
|
||||
?@ req-type
|
||||
[%get headers ~]
|
||||
[%post headers ~ (tact (pojo p.req-type))]
|
||||
--
|
||||
=*(http . .)
|
||||
|
846
lib/kiln.hoon
846
lib/kiln.hoon
@ -49,441 +49,439 @@
|
||||
:: :: ::
|
||||
:::: :: ::
|
||||
!: :: ::
|
||||
|% :: kiln library
|
||||
++ kiln-work :: work in kiln
|
||||
|= [bowl kiln-part]
|
||||
?> =(src our)
|
||||
=> |% :: arvo structures
|
||||
++ card ::
|
||||
$% [%exec wire @p ~ [beak silk]] ::
|
||||
[%info wire @p @tas nori] ::
|
||||
[%mont wire @tas @p @tas path] ::
|
||||
[%ogre wire $|(@tas beam)] ::
|
||||
[%merg wire @p @tas @p @tas germ] ::
|
||||
[%poke wire dock pear] ::
|
||||
[%warp wire sock riff] ::
|
||||
== ::
|
||||
++ pear :: poke fruit
|
||||
$% [%talk-command command:talk] ::
|
||||
[%kiln-merge kiln-merge] ::
|
||||
== ::
|
||||
++ move (pair bone card) :: user-level move
|
||||
--
|
||||
|_ moz=(list move)
|
||||
++ abet :: resolve
|
||||
[(flop moz) `kiln-part`+>+>->]
|
||||
::
|
||||
++ emit |=(card %_(+> moz [[ost +<] moz])) :: return card
|
||||
++ emil :: return cards
|
||||
|= (list card)
|
||||
^+ +>
|
||||
?~(+< +> $(+< t.+<, +> (emit i.+<)))
|
||||
::
|
||||
++ render
|
||||
|= [mez=tape sud=desk who=ship syd=desk]
|
||||
:^ %palm [" " ~ ~ ~] leaf/mez
|
||||
~[leaf/"from {<sud>}" leaf/"on {<who>}" leaf/"to {<syd>}"]
|
||||
::
|
||||
++ poke-mount
|
||||
|= kiln-mount
|
||||
=+ bem=(tome pax)
|
||||
|= [bowl kiln-part] :: main kiln work
|
||||
?> =(src our)
|
||||
=> |% :: arvo structures
|
||||
++ card ::
|
||||
$% [%exec wire @p ~ [beak silk]] ::
|
||||
[%info wire @p @tas nori] ::
|
||||
[%mont wire @tas @p @tas path] ::
|
||||
[%ogre wire $|(@tas beam)] ::
|
||||
[%merg wire @p @tas @p @tas germ] ::
|
||||
[%poke wire dock pear] ::
|
||||
[%warp wire sock riff] ::
|
||||
== ::
|
||||
++ pear :: poke fruit
|
||||
$% [%talk-command command:talk] ::
|
||||
[%kiln-merge kiln-merge] ::
|
||||
== ::
|
||||
++ move (pair bone card) :: user-level move
|
||||
--
|
||||
|_ moz=(list move)
|
||||
++ abet :: resolve
|
||||
[(flop moz) `kiln-part`+>+>->]
|
||||
::
|
||||
++ emit |=(card %_(+> moz [[ost +<] moz])) :: return card
|
||||
++ emil :: return cards
|
||||
|= (list card)
|
||||
^+ +>
|
||||
?~(+< +> $(+< t.+<, +> (emit i.+<)))
|
||||
::
|
||||
++ render
|
||||
|= [mez=tape sud=desk who=ship syd=desk]
|
||||
:^ %palm [" " ~ ~ ~] leaf/mez
|
||||
~[leaf/"from {<sud>}" leaf/"on {<who>}" leaf/"to {<syd>}"]
|
||||
::
|
||||
++ poke-mount
|
||||
|= kiln-mount
|
||||
=+ bem=(tome pax)
|
||||
?~ bem
|
||||
=+ "can't mount bad path: {<pax>}"
|
||||
abet:(spam leaf/- ~)
|
||||
abet:(emit %mont /mount pot p.u.bem q.u.bem (flop s.u.bem))
|
||||
::
|
||||
++ poke-unmount
|
||||
|= mon=kiln-unmount
|
||||
?^ mon
|
||||
=+ bem=(tome mon)
|
||||
?~ bem
|
||||
=+ "can't mount bad path: {<pax>}"
|
||||
=+ "can't unmount bad path: {<mon>}"
|
||||
abet:(spam leaf/- ~)
|
||||
abet:(emit %mont /mount pot p.u.bem q.u.bem (flop s.u.bem))
|
||||
::
|
||||
++ poke-unmount
|
||||
|= mon=kiln-unmount
|
||||
?^ mon
|
||||
=+ bem=(tome mon)
|
||||
?~ bem
|
||||
=+ "can't unmount bad path: {<mon>}"
|
||||
abet:(spam leaf/- ~)
|
||||
abet:(emit %ogre /unmount-beam [[p q %ud 0] s]:u.bem)
|
||||
abet:(emit %ogre /unmount-point mon)
|
||||
::
|
||||
++ poke-sync ::
|
||||
|= hos=kiln-sync
|
||||
?: (~(has by syn) hos)
|
||||
abet:(spam (render "already syncing" [sud her syd]:hos) ~)
|
||||
abet:abet:start:(auto hos)
|
||||
::
|
||||
++ poke-unsync ::
|
||||
|= hus=kiln-unsync
|
||||
?. (~(has by syn) hus)
|
||||
abet:(spam (render "not syncing" [sud her syd]:hus) ~)
|
||||
%* . abet:abet:stop:(auto hus)
|
||||
syn (~(del by syn) hus)
|
||||
==
|
||||
::
|
||||
++ poke-merge ::
|
||||
|= kiln-merge
|
||||
abet:abet:(merge:(work syd) ali sud gim)
|
||||
::
|
||||
++ do-info
|
||||
|= [mez=tape tor=toro]
|
||||
abet:(emit:(spam leaf/mez ~) %info /kiln our tor)
|
||||
::
|
||||
++ poke-rm |=(a=path (do-info "removed" (fray a)))
|
||||
++ poke-cp
|
||||
|= [input=path output=path]
|
||||
%+ do-info "copied"
|
||||
?> =(-:(flop input) -:(flop output))
|
||||
(foal output -:(flop input) atom/%t .^(%cx input)) :: XX type
|
||||
::
|
||||
++ poke-mv
|
||||
|= [input=path output=path]
|
||||
%+ do-info "moved"
|
||||
?> =(-:(flop input) -:(flop output))
|
||||
%+ furl (fray output)
|
||||
(foal output -:(flop input) %noun .^(%cx input))
|
||||
::
|
||||
++ poke-label
|
||||
|= [syd=desk lab=@tas]
|
||||
=+ pax=/(scot %p our)/[syd]/[lab]
|
||||
(do-info "labeled {(spud pax)}" [syd %| lab])
|
||||
::
|
||||
++ poke-schedule
|
||||
|= [where=path tym=@da eve=@t]
|
||||
=. where (welp where /sched)
|
||||
%+ do-info "scheduled"
|
||||
=+ old=;;((map ,@da cord) (fall (file where) ~))
|
||||
(foal where %sched !>((~(put by old) tym eve)))
|
||||
::
|
||||
++ take |=(way=wire ?>(?=([@ ~] way) (work i.way))) :: general handler
|
||||
++ take-mere ::
|
||||
|= [way=wire are=(each (set path) (pair term tang))]
|
||||
abet:abet:(mere:(take way) are)
|
||||
::
|
||||
++ take-made ::
|
||||
|= [way=wire dep=@uvH reg=gage]
|
||||
abet:abet:(made:(take way) dep reg)
|
||||
::
|
||||
++ take-coup-fancy ::
|
||||
|= [way=wire saw=(unit tang)]
|
||||
abet:abet:(coup-fancy:(take way) saw)
|
||||
::
|
||||
++ take-mere-sync ::
|
||||
|= [way=wire mes=(each (set path) (pair term tang))]
|
||||
?> ?=([@ @ @ ~] way)
|
||||
=+ ^- hos=kiln-sync
|
||||
:* syd=(slav %tas i.way)
|
||||
her=(slav %p i.t.way)
|
||||
sud=(slav %tas i.t.t.way)
|
||||
==
|
||||
abet:abet:(mere:(auto hos) mes)
|
||||
::
|
||||
++ take-writ ::
|
||||
|= [way=wire rot=riot]
|
||||
?> ?=([@ @ @ ~] way)
|
||||
=+ ^- hos=kiln-sync
|
||||
:* syd=(slav %tas i.way)
|
||||
her=(slav %p i.t.way)
|
||||
sud=(slav %tas i.t.t.way)
|
||||
==
|
||||
abet:abet:(writ:(auto hos) rot)
|
||||
::
|
||||
++ spam
|
||||
|= mes=(list tank)
|
||||
((slog mes) ..spam)
|
||||
abet:(emit %ogre /unmount-beam [[p q %ud 0] s]:u.bem)
|
||||
abet:(emit %ogre /unmount-point mon)
|
||||
::
|
||||
++ poke-sync ::
|
||||
|= hos=kiln-sync
|
||||
?: (~(has by syn) hos)
|
||||
abet:(spam (render "already syncing" [sud her syd]:hos) ~)
|
||||
abet:abet:start:(auto hos)
|
||||
::
|
||||
++ poke-unsync ::
|
||||
|= hus=kiln-unsync
|
||||
?. (~(has by syn) hus)
|
||||
abet:(spam (render "not syncing" [sud her syd]:hus) ~)
|
||||
%* . abet:abet:stop:(auto hus)
|
||||
syn (~(del by syn) hus)
|
||||
==
|
||||
::
|
||||
++ poke-merge ::
|
||||
|= kiln-merge
|
||||
abet:abet:(merge:(work syd) ali sud gim)
|
||||
::
|
||||
++ do-info
|
||||
|= [mez=tape tor=toro]
|
||||
abet:(emit:(spam leaf/mez ~) %info /kiln our tor)
|
||||
::
|
||||
++ poke-rm |=(a=path (do-info "removed" (fray a)))
|
||||
++ poke-cp
|
||||
|= [input=path output=path]
|
||||
%+ do-info "copied"
|
||||
?> =(-:(flop input) -:(flop output))
|
||||
(foal output -:(flop input) atom/%t .^(%cx input)) :: XX type
|
||||
::
|
||||
++ poke-mv
|
||||
|= [input=path output=path]
|
||||
%+ do-info "moved"
|
||||
?> =(-:(flop input) -:(flop output))
|
||||
%+ furl (fray output)
|
||||
(foal output -:(flop input) %noun .^(%cx input))
|
||||
::
|
||||
++ poke-label
|
||||
|= [syd=desk lab=@tas]
|
||||
=+ pax=/(scot %p our)/[syd]/[lab]
|
||||
(do-info "labeled {(spud pax)}" [syd %| lab])
|
||||
::
|
||||
++ poke-schedule
|
||||
|= [where=path tym=@da eve=@t]
|
||||
=. where (welp where /sched)
|
||||
%+ do-info "scheduled"
|
||||
=+ old=;;((map ,@da cord) (fall (file where) ~))
|
||||
(foal where %sched !>((~(put by old) tym eve)))
|
||||
::
|
||||
++ take |=(way=wire ?>(?=([@ ~] way) (work i.way))) :: general handler
|
||||
++ take-mere ::
|
||||
|= [way=wire are=(each (set path) (pair term tang))]
|
||||
abet:abet:(mere:(take way) are)
|
||||
::
|
||||
++ take-made ::
|
||||
|= [way=wire dep=@uvH reg=gage]
|
||||
abet:abet:(made:(take way) dep reg)
|
||||
::
|
||||
++ take-coup-fancy ::
|
||||
|= [way=wire saw=(unit tang)]
|
||||
abet:abet:(coup-fancy:(take way) saw)
|
||||
::
|
||||
++ take-mere-sync ::
|
||||
|= [way=wire mes=(each (set path) (pair term tang))]
|
||||
?> ?=([@ @ @ ~] way)
|
||||
=+ ^- hos=kiln-sync
|
||||
:* syd=(slav %tas i.way)
|
||||
her=(slav %p i.t.way)
|
||||
sud=(slav %tas i.t.t.way)
|
||||
==
|
||||
abet:abet:(mere:(auto hos) mes)
|
||||
::
|
||||
++ take-writ ::
|
||||
|= [way=wire rot=riot]
|
||||
?> ?=([@ @ @ ~] way)
|
||||
=+ ^- hos=kiln-sync
|
||||
:* syd=(slav %tas i.way)
|
||||
her=(slav %p i.t.way)
|
||||
sud=(slav %tas i.t.t.way)
|
||||
==
|
||||
abet:abet:(writ:(auto hos) rot)
|
||||
::
|
||||
++ spam
|
||||
|= mes=(list tank)
|
||||
((slog mes) ..spam)
|
||||
:: %- emit :: XX not displayed/immediately
|
||||
:: [%poke /kiln/spam [our %talk] (said our %kiln now eny mes)]
|
||||
::
|
||||
++ auto
|
||||
|= kiln-sync
|
||||
=+ (fall (~(get by syn) syd her sud) [let=*@ud ust=ost])
|
||||
|%
|
||||
++ abet
|
||||
..auto(syn (~(put by syn) [syd her sud] let ust))
|
||||
::
|
||||
++ auto
|
||||
|= kiln-sync
|
||||
=+ (fall (~(get by syn) syd her sud) [let=*@ud ust=ost])
|
||||
|%
|
||||
++ abet
|
||||
..auto(syn (~(put by syn) [syd her sud] let ust))
|
||||
::
|
||||
++ blab
|
||||
|= new=(list move)
|
||||
^+ +>
|
||||
+>.$(moz (welp new moz))
|
||||
::
|
||||
++ spam |*(* %_(+> ..auto (^spam +<)))
|
||||
++ stop
|
||||
=> (spam (render "ended autosync" sud her syd) ~)
|
||||
%- blab :_ ~
|
||||
:* ust %warp
|
||||
/kiln/sync/[syd]/(scot %p her)/[sud]
|
||||
[our her] sud ~
|
||||
==
|
||||
::
|
||||
++ start
|
||||
=> (spam (render "activated sync" sud her syd) ~)
|
||||
%- blab
|
||||
:~ :: [ost %mont /mount syd our syd /]
|
||||
:* ost %warp
|
||||
/kiln/sync/[syd]/(scot %p her)/[sud]
|
||||
[our her] sud ~ %sing %w [%da now] /
|
||||
== ==
|
||||
::
|
||||
++ writ
|
||||
|= rot=riot
|
||||
?~ rot
|
||||
%^ spam
|
||||
leaf/"bad %writ response"
|
||||
(render "on sync" sud her syd)
|
||||
~
|
||||
=. let ?. ?=(%w p.p.u.rot) let ((hard ,@ud) q.q.r.u.rot)
|
||||
%- blab :_ ~
|
||||
:* ost %merg
|
||||
/kiln/sync/[syd]/(scot %p her)/[sud]
|
||||
our syd her sud
|
||||
?: =(0 .^(%cw /(scot %p our)/[syd]/(scot %da now)))
|
||||
%init
|
||||
%mate
|
||||
==
|
||||
::
|
||||
++ mere
|
||||
|= mes=(each (set path) (pair term tang))
|
||||
=. let +(let)
|
||||
=. +>.$
|
||||
%- spam
|
||||
?: ?=(%& -.mes)
|
||||
[(render "sync succeeded" sud her syd) ~]
|
||||
?+ p.p.mes
|
||||
:* (render "sync failed" sud her syd)
|
||||
leaf/"please manually merge the desks with"
|
||||
leaf/":+merge %{(trip syd)} {(scow %p her)} %{(trip sud)}"
|
||||
leaf/""
|
||||
leaf/"error code: {<p.p.mes>}"
|
||||
q.p.mes
|
||||
==
|
||||
::
|
||||
%no-ali-desk
|
||||
:~ (render "sync activated" sud her syd)
|
||||
leaf/"note: blank desk {<sud>} on {<her>}"
|
||||
==
|
||||
==
|
||||
%- blab :_ ~
|
||||
:* ost %warp
|
||||
/kiln/sync/[syd]/(scot %p her)/[sud]
|
||||
[our her] sud ~ %sing %y [%ud let] /
|
||||
==
|
||||
--
|
||||
++ blab
|
||||
|= new=(list move)
|
||||
^+ +>
|
||||
+>.$(moz (welp new moz))
|
||||
::
|
||||
++ work :: state machine
|
||||
|= syd=desk
|
||||
=+ ^- kiln-desk
|
||||
%+ fall (~(get by rem) syd)
|
||||
=+ *kiln-desk
|
||||
%_(- cas [%da now])
|
||||
|%
|
||||
++ abet :: resolve
|
||||
..work(rem (~(put by rem) syd auto gem her sud cas))
|
||||
::
|
||||
++ blab
|
||||
|= new=(list move)
|
||||
^+ +>
|
||||
+>.$(moz (welp new moz))
|
||||
::
|
||||
++ win . :: successful poke
|
||||
++ lose
|
||||
^+ .
|
||||
~| %kiln-work-fail
|
||||
.
|
||||
::
|
||||
++ ford-fail
|
||||
|=(tan=tang ~|(%ford-fail (mean tan)))
|
||||
::
|
||||
++ unwrap-tang
|
||||
|* res=(each ,* tang)
|
||||
?: ?=(%& -.res)
|
||||
p.res
|
||||
(ford-fail p.res)
|
||||
::
|
||||
++ gage-to-cages
|
||||
|= gag=gage ^- (list (pair cage cage))
|
||||
(unwrap-tang (gage-to-tage gag))
|
||||
::
|
||||
++ gage-to-tage
|
||||
|= gag=gage
|
||||
^- (each (list (pair cage cage)) tang)
|
||||
?. ?=(%tabl -.gag)
|
||||
(mule |.(`~`(ford-fail >%strange-gage< ~)))
|
||||
=< ?+(. [%& .] [@ *] .)
|
||||
|- ^- ?((list ,[cage cage]) (each ,~ tang))
|
||||
?~ p.gag ~
|
||||
=* hed i.p.gag
|
||||
?- -.p.hed
|
||||
%tabl (mule |.(`~`(ford-fail >%strange-gage< ~)))
|
||||
%| (mule |.(`~`(ford-fail p.p.hed)))
|
||||
%& ?- -.q.hed
|
||||
%tabl (mule |.(`~`(ford-fail >%strange-gage< ~)))
|
||||
%| (mule |.(`~`(ford-fail p.q.hed)))
|
||||
%& =+ $(p.gag t.p.gag)
|
||||
?+(- [[p.p p.q]:hed -] [@ *] -)
|
||||
== ==
|
||||
::
|
||||
++ perform ::
|
||||
^+ .
|
||||
(blab [ost %merg /kiln/[syd] our syd her sud gem] ~)
|
||||
::
|
||||
++ fancy-merge :: send to self
|
||||
|= [syd=desk her=@p sud=desk gem=?(%auto germ)]
|
||||
^+ +>
|
||||
%- blab :_ ~
|
||||
[ost %poke /kiln/fancy/[^syd] [our %hood] %kiln-merge [syd her sud gem]]
|
||||
::
|
||||
++ spam ::|=(tang ((slog +<) ..spam))
|
||||
|*(* +>(..work (^spam +<)))
|
||||
++ merge
|
||||
|= [her=@p sud=@tas gim=?(%auto germ)]
|
||||
^+ +>
|
||||
=. cas [%da now]
|
||||
?. ?=(%auto gim)
|
||||
perform(auto |, gem gim, her her, sud sud)
|
||||
?: =(0 .^(%cw /(scot %p our)/[syd]/(scot %da now)))
|
||||
=> $(gim %init)
|
||||
.(auto &)
|
||||
=> $(gim %fine)
|
||||
.(auto &)
|
||||
::
|
||||
++ coup-fancy
|
||||
|= saw=(unit tang)
|
||||
?~ saw
|
||||
=> (spam leaf/"%melding %{(trip sud)} into scratch space" ~)
|
||||
%- blab :_ ~
|
||||
[ost %merg /kiln/[syd] our (cat 3 syd '-scratch') her sud gem]
|
||||
=+ :- "failed to set up conflict resolution scratch space"
|
||||
"I'm out of ideas"
|
||||
lose:(spam leaf/-< leaf/-> u.saw)
|
||||
::
|
||||
++ mere
|
||||
|= are=(each (set path) (pair term tang))
|
||||
^+ +>
|
||||
?: =(%meld gem)
|
||||
?: ?=(%& -.are)
|
||||
?. auto
|
||||
=+ "merged with strategy {<gem>}"
|
||||
win:(spam leaf/- ?~(p.are ~ [>`(set path)`p.are< ~]))
|
||||
:: ~? > =(~ p.are) [%mere-no-conflict syd]
|
||||
=+ "mashing conflicts"
|
||||
=> .(+>.$ (spam leaf/- ~))
|
||||
=+ tic=(cat 3 syd '-scratch')
|
||||
%- blab :_ ~
|
||||
:* ost %exec /kiln/[syd]
|
||||
our ~ [our tic %da now] %tabl
|
||||
^- (list (pair silk silk))
|
||||
:: ~& > kiln-mashing/[p.are syd=syd +<.abet]
|
||||
%+ turn (~(tap in p.are))
|
||||
|= pax=path
|
||||
^- (pair silk silk)
|
||||
:- [%$ %path -:!>(*path) pax]
|
||||
=+ base=[%file [our tic %da now] (flop pax)]
|
||||
=+ alis=[%file [her sud cas] (flop pax)]
|
||||
=+ bobs=[%file [our syd %da now] (flop pax)]
|
||||
=+ dali=[%diff base alis]
|
||||
=+ dbob=[%diff base bobs]
|
||||
=+ ^- for=mark
|
||||
=+ (slag (dec (lent pax)) pax)
|
||||
?~(- %$ i.-)
|
||||
[%mash for [her sud dali] [our syd dbob]]
|
||||
==
|
||||
=+ "failed to merge with strategy meld"
|
||||
lose:(spam leaf/- >p.p.are< q.p.are)
|
||||
?: ?=(%& -.are)
|
||||
=+ "merged with strategy {<gem>}"
|
||||
win:(spam leaf/- ?~(p.are ~ [>`(set path)`p.are< ~]))
|
||||
?. auto
|
||||
=+ "failed to merge with strategy {<gem>}"
|
||||
lose:(spam leaf/- >p.p.are< q.p.are)
|
||||
?+ gem
|
||||
(spam leaf/"strange auto" >gem< ~)
|
||||
::
|
||||
++ spam |*(* %_(+> ..auto (^spam +<)))
|
||||
++ stop
|
||||
=> (spam (render "ended autosync" sud her syd) ~)
|
||||
%- blab :_ ~
|
||||
:* ust %warp
|
||||
/kiln/sync/[syd]/(scot %p her)/[sud]
|
||||
[our her] sud ~
|
||||
==
|
||||
::
|
||||
++ start
|
||||
=> (spam (render "activated sync" sud her syd) ~)
|
||||
%- blab
|
||||
:~ :: [ost %mont /mount syd our syd /]
|
||||
:* ost %warp
|
||||
/kiln/sync/[syd]/(scot %p her)/[sud]
|
||||
[our her] sud ~ %sing %w [%da now] /
|
||||
== ==
|
||||
::
|
||||
++ writ
|
||||
|= rot=riot
|
||||
?~ rot
|
||||
%^ spam
|
||||
leaf/"bad %writ response"
|
||||
(render "on sync" sud her syd)
|
||||
~
|
||||
=. let ?. ?=(%w p.p.u.rot) let ((hard ,@ud) q.q.r.u.rot)
|
||||
%- blab :_ ~
|
||||
:* ost %merg
|
||||
/kiln/sync/[syd]/(scot %p her)/[sud]
|
||||
our syd her sud
|
||||
?: =(0 .^(%cw /(scot %p our)/[syd]/(scot %da now)))
|
||||
%init
|
||||
=+ :- "auto merge failed on strategy %init"
|
||||
"I'm out of ideas"
|
||||
lose:(spam leaf/-< leaf/-> [>p.p.are< q.p.are])
|
||||
%mate
|
||||
==
|
||||
::
|
||||
++ mere
|
||||
|= mes=(each (set path) (pair term tang))
|
||||
=. let +(let)
|
||||
=. +>.$
|
||||
%- spam
|
||||
?: ?=(%& -.mes)
|
||||
[(render "sync succeeded" sud her syd) ~]
|
||||
?+ p.p.mes
|
||||
:* (render "sync failed" sud her syd)
|
||||
leaf/"please manually merge the desks with"
|
||||
leaf/":+merge %{(trip syd)} {(scow %p her)} %{(trip sud)}"
|
||||
leaf/""
|
||||
leaf/"error code: {<p.p.mes>}"
|
||||
q.p.mes
|
||||
==
|
||||
::
|
||||
%fine
|
||||
?. ?=(%bad-fine-merge p.p.are)
|
||||
=+ "auto merge failed on strategy %fine"
|
||||
lose:(spam leaf/- >p.p.are< q.p.are)
|
||||
=> (spam leaf/"%fine merge failed, trying %meet" ~)
|
||||
perform(gem %meet)
|
||||
::
|
||||
%meet
|
||||
?. ?=(%meet-conflict p.p.are)
|
||||
=+ "auto merge failed on strategy %meet"
|
||||
lose:(spam leaf/- >p.p.are< q.p.are)
|
||||
=> (spam leaf/"%meet merge failed, trying %mate" ~)
|
||||
perform(gem %mate)
|
||||
::
|
||||
%mate
|
||||
?. ?=(%mate-conflict p.p.are)
|
||||
=+ "auto merge failed on strategy %mate"
|
||||
lose:(spam leaf/- >p.p.are< q.p.are)
|
||||
=> .(gem %meld)
|
||||
%no-ali-desk
|
||||
:~ (render "sync activated" sud her syd)
|
||||
leaf/"note: blank desk {<sud>} on {<her>}"
|
||||
==
|
||||
==
|
||||
%- blab :_ ~
|
||||
:* ost %warp
|
||||
/kiln/sync/[syd]/(scot %p her)/[sud]
|
||||
[our her] sud ~ %sing %y [%ud let] /
|
||||
==
|
||||
--
|
||||
::
|
||||
++ work :: state machine
|
||||
|= syd=desk
|
||||
=+ ^- kiln-desk
|
||||
%+ fall (~(get by rem) syd)
|
||||
=+ *kiln-desk
|
||||
%_(- cas [%da now])
|
||||
|%
|
||||
++ abet :: resolve
|
||||
..work(rem (~(put by rem) syd auto gem her sud cas))
|
||||
::
|
||||
++ blab
|
||||
|= new=(list move)
|
||||
^+ +>
|
||||
+>.$(moz (welp new moz))
|
||||
::
|
||||
++ win . :: successful poke
|
||||
++ lose
|
||||
^+ .
|
||||
~| %kiln-work-fail
|
||||
.
|
||||
::
|
||||
++ ford-fail
|
||||
|=(tan=tang ~|(%ford-fail (mean tan)))
|
||||
::
|
||||
++ unwrap-tang
|
||||
|* res=(each ,* tang)
|
||||
?: ?=(%& -.res)
|
||||
p.res
|
||||
(ford-fail p.res)
|
||||
::
|
||||
++ gage-to-cages
|
||||
|= gag=gage ^- (list (pair cage cage))
|
||||
(unwrap-tang (gage-to-tage gag))
|
||||
::
|
||||
++ gage-to-tage
|
||||
|= gag=gage
|
||||
^- (each (list (pair cage cage)) tang)
|
||||
?. ?=(%tabl -.gag)
|
||||
(mule |.(`~`(ford-fail >%strange-gage< ~)))
|
||||
=< ?+(. [%& .] [@ *] .)
|
||||
|- ^- ?((list ,[cage cage]) (each ,~ tang))
|
||||
?~ p.gag ~
|
||||
=* hed i.p.gag
|
||||
?- -.p.hed
|
||||
%tabl (mule |.(`~`(ford-fail >%strange-gage< ~)))
|
||||
%| (mule |.(`~`(ford-fail p.p.hed)))
|
||||
%& ?- -.q.hed
|
||||
%tabl (mule |.(`~`(ford-fail >%strange-gage< ~)))
|
||||
%| (mule |.(`~`(ford-fail p.q.hed)))
|
||||
%& =+ $(p.gag t.p.gag)
|
||||
?+(- [[p.p p.q]:hed -] [@ *] -)
|
||||
== ==
|
||||
::
|
||||
++ perform ::
|
||||
^+ .
|
||||
(blab [ost %merg /kiln/[syd] our syd her sud gem] ~)
|
||||
::
|
||||
++ fancy-merge :: send to self
|
||||
|= [syd=desk her=@p sud=desk gem=?(%auto germ)]
|
||||
^+ +>
|
||||
%- blab :_ ~
|
||||
[ost %poke /kiln/fancy/[^syd] [our %hood] %kiln-merge [syd her sud gem]]
|
||||
::
|
||||
++ spam ::|=(tang ((slog +<) ..spam))
|
||||
|*(* +>(..work (^spam +<)))
|
||||
++ merge
|
||||
|= [her=@p sud=@tas gim=?(%auto germ)]
|
||||
^+ +>
|
||||
=. cas [%da now]
|
||||
?. ?=(%auto gim)
|
||||
perform(auto |, gem gim, her her, sud sud)
|
||||
?: =(0 .^(%cw /(scot %p our)/[syd]/(scot %da now)))
|
||||
=> $(gim %init)
|
||||
.(auto &)
|
||||
=> $(gim %fine)
|
||||
.(auto &)
|
||||
::
|
||||
++ coup-fancy
|
||||
|= saw=(unit tang)
|
||||
?~ saw
|
||||
=> (spam leaf/"%melding %{(trip sud)} into scratch space" ~)
|
||||
%- blab :_ ~
|
||||
[ost %merg /kiln/[syd] our (cat 3 syd '-scratch') her sud gem]
|
||||
=+ :- "failed to set up conflict resolution scratch space"
|
||||
"I'm out of ideas"
|
||||
lose:(spam leaf/-< leaf/-> u.saw)
|
||||
::
|
||||
++ mere
|
||||
|= are=(each (set path) (pair term tang))
|
||||
^+ +>
|
||||
?: =(%meld gem)
|
||||
?: ?=(%& -.are)
|
||||
?. auto
|
||||
=+ "merged with strategy {<gem>}"
|
||||
win:(spam leaf/- ?~(p.are ~ [>`(set path)`p.are< ~]))
|
||||
:: ~? > =(~ p.are) [%mere-no-conflict syd]
|
||||
=+ "mashing conflicts"
|
||||
=> .(+>.$ (spam leaf/- ~))
|
||||
=+ tic=(cat 3 syd '-scratch')
|
||||
=> =+ :- "%mate merge failed with conflicts,"
|
||||
"setting up scratch space at %{(trip tic)}"
|
||||
[tic=tic (spam leaf/-< leaf/-> q.p.are)]
|
||||
(fancy-merge tic our syd %that)
|
||||
==
|
||||
%- blab :_ ~
|
||||
:* ost %exec /kiln/[syd]
|
||||
our ~ [our tic %da now] %tabl
|
||||
^- (list (pair silk silk))
|
||||
:: ~& > kiln-mashing/[p.are syd=syd +<.abet]
|
||||
%+ turn (~(tap in p.are))
|
||||
|= pax=path
|
||||
^- (pair silk silk)
|
||||
:- [%$ %path -:!>(*path) pax]
|
||||
=+ base=[%file [our tic %da now] (flop pax)]
|
||||
=+ alis=[%file [her sud cas] (flop pax)]
|
||||
=+ bobs=[%file [our syd %da now] (flop pax)]
|
||||
=+ dali=[%diff base alis]
|
||||
=+ dbob=[%diff base bobs]
|
||||
=+ ^- for=mark
|
||||
=+ (slag (dec (lent pax)) pax)
|
||||
?~(- %$ i.-)
|
||||
[%mash for [her sud dali] [our syd dbob]]
|
||||
==
|
||||
=+ "failed to merge with strategy meld"
|
||||
lose:(spam leaf/- >p.p.are< q.p.are)
|
||||
?: ?=(%& -.are)
|
||||
=+ "merged with strategy {<gem>}"
|
||||
win:(spam leaf/- ?~(p.are ~ [>`(set path)`p.are< ~]))
|
||||
?. auto
|
||||
=+ "failed to merge with strategy {<gem>}"
|
||||
lose:(spam leaf/- >p.p.are< q.p.are)
|
||||
?+ gem
|
||||
(spam leaf/"strange auto" >gem< ~)
|
||||
::
|
||||
++ tape-to-tanks
|
||||
|= a=tape ^- (list tank)
|
||||
(scan a (more (just '\0a') (cook |=(a=tape leaf/a) (star prn))))
|
||||
%init
|
||||
=+ :- "auto merge failed on strategy %init"
|
||||
"I'm out of ideas"
|
||||
lose:(spam leaf/-< leaf/-> [>p.p.are< q.p.are])
|
||||
::
|
||||
++ tanks-if-any
|
||||
|= [a=tape b=(list path) c=tape] ^- (list tank)
|
||||
?: =(~ b) ~
|
||||
(welp (tape-to-tanks "\0a{c}{a}") >b< ~)
|
||||
%fine
|
||||
?. ?=(%bad-fine-merge p.p.are)
|
||||
=+ "auto merge failed on strategy %fine"
|
||||
lose:(spam leaf/- >p.p.are< q.p.are)
|
||||
=> (spam leaf/"%fine merge failed, trying %meet" ~)
|
||||
perform(gem %meet)
|
||||
::
|
||||
++ made
|
||||
|= [dep=@uvH reg=gage]
|
||||
^+ +>
|
||||
?: ?=(%| -.reg)
|
||||
=+ "failed to mash"
|
||||
lose:(spam leaf/- p.reg)
|
||||
=+ ^- can=(list (pair path (unit miso)))
|
||||
%+ turn (gage-to-cages reg)
|
||||
|= [pax=cage dif=cage]
|
||||
^- (pair path (unit miso))
|
||||
?. ?=(%path p.pax)
|
||||
~| "strange path mark: {<p.pax>}"
|
||||
!!
|
||||
[((hard path) q.q.pax) ?:(?=(%null p.dif) ~ `[%dif dif])]
|
||||
:: ~& > kiln-made/[(turn can head) syd=syd +<.abet]
|
||||
=+ notated=(skid can |=([path a=(unit miso)] ?=(^ a)))
|
||||
=+ annotated=(turn `(list (pair path ,*))`-.notated head)
|
||||
=+ unnotated=(turn `(list (pair path ,*))`+.notated head)
|
||||
=+ `desk`(cat 3 syd '-scratch')
|
||||
=+ ^- tan=(list tank)
|
||||
%- zing
|
||||
^- (list (list tank))
|
||||
:~ %- tape-to-tanks
|
||||
"""
|
||||
done setting up scratch space in {<[-]>}
|
||||
please resolve the following conflicts and run
|
||||
:+merge {<syd>} our {<[-]>}
|
||||
"""
|
||||
%^ tanks-if-any
|
||||
"annotated conflicts in:" annotated
|
||||
""
|
||||
%^ tanks-if-any
|
||||
"unannotated conflicts in:" unnotated
|
||||
"""
|
||||
some conflicts could not be annotated.
|
||||
for these, the scratch space contains
|
||||
the most recent common ancestor of the
|
||||
conflicting content.
|
||||
|
||||
"""
|
||||
==
|
||||
=< win
|
||||
%- blab:(spam tan)
|
||||
:_ ~
|
||||
:* ost %info /kiln/[syd]
|
||||
our (cat 3 syd '-scratch')
|
||||
%& *cart
|
||||
%+ murn can
|
||||
|= [p=path q=(unit miso)]
|
||||
`(unit (pair path miso))`?~(q ~ `[p u.q])
|
||||
==
|
||||
--
|
||||
%meet
|
||||
?. ?=(%meet-conflict p.p.are)
|
||||
=+ "auto merge failed on strategy %meet"
|
||||
lose:(spam leaf/- >p.p.are< q.p.are)
|
||||
=> (spam leaf/"%meet merge failed, trying %mate" ~)
|
||||
perform(gem %mate)
|
||||
::
|
||||
%mate
|
||||
?. ?=(%mate-conflict p.p.are)
|
||||
=+ "auto merge failed on strategy %mate"
|
||||
lose:(spam leaf/- >p.p.are< q.p.are)
|
||||
=> .(gem %meld)
|
||||
=+ tic=(cat 3 syd '-scratch')
|
||||
=> =+ :- "%mate merge failed with conflicts,"
|
||||
"setting up scratch space at %{(trip tic)}"
|
||||
[tic=tic (spam leaf/-< leaf/-> q.p.are)]
|
||||
(fancy-merge tic our syd %that)
|
||||
==
|
||||
::
|
||||
++ tape-to-tanks
|
||||
|= a=tape ^- (list tank)
|
||||
(scan a (more (just '\0a') (cook |=(a=tape leaf/a) (star prn))))
|
||||
::
|
||||
++ tanks-if-any
|
||||
|= [a=tape b=(list path) c=tape] ^- (list tank)
|
||||
?: =(~ b) ~
|
||||
(welp (tape-to-tanks "\0a{c}{a}") >b< ~)
|
||||
::
|
||||
++ made
|
||||
|= [dep=@uvH reg=gage]
|
||||
^+ +>
|
||||
?: ?=(%| -.reg)
|
||||
=+ "failed to mash"
|
||||
lose:(spam leaf/- p.reg)
|
||||
=+ ^- can=(list (pair path (unit miso)))
|
||||
%+ turn (gage-to-cages reg)
|
||||
|= [pax=cage dif=cage]
|
||||
^- (pair path (unit miso))
|
||||
?. ?=(%path p.pax)
|
||||
~| "strange path mark: {<p.pax>}"
|
||||
!!
|
||||
[((hard path) q.q.pax) ?:(?=(%null p.dif) ~ `[%dif dif])]
|
||||
:: ~& > kiln-made/[(turn can head) syd=syd +<.abet]
|
||||
=+ notated=(skid can |=([path a=(unit miso)] ?=(^ a)))
|
||||
=+ annotated=(turn `(list (pair path ,*))`-.notated head)
|
||||
=+ unnotated=(turn `(list (pair path ,*))`+.notated head)
|
||||
=+ `desk`(cat 3 syd '-scratch')
|
||||
=+ ^- tan=(list tank)
|
||||
%- zing
|
||||
^- (list (list tank))
|
||||
:~ %- tape-to-tanks
|
||||
"""
|
||||
done setting up scratch space in {<[-]>}
|
||||
please resolve the following conflicts and run
|
||||
:+merge {<syd>} our {<[-]>}
|
||||
"""
|
||||
%^ tanks-if-any
|
||||
"annotated conflicts in:" annotated
|
||||
""
|
||||
%^ tanks-if-any
|
||||
"unannotated conflicts in:" unnotated
|
||||
"""
|
||||
some conflicts could not be annotated.
|
||||
for these, the scratch space contains
|
||||
the most recent common ancestor of the
|
||||
conflicting content.
|
||||
|
||||
"""
|
||||
==
|
||||
=< win
|
||||
%- blab:(spam tan)
|
||||
:_ ~
|
||||
:* ost %info /kiln/[syd]
|
||||
our (cat 3 syd '-scratch')
|
||||
%& *cart
|
||||
%+ murn can
|
||||
|= [p=path q=(unit miso)]
|
||||
`(unit (pair path miso))`?~(q ~ `[p u.q])
|
||||
==
|
||||
--
|
||||
--
|
||||
=*(kiln . .)
|
||||
|
@ -41,3 +41,4 @@
|
||||
++ voy ": {<~[(icon who)]>} (row/col): " :: print prompt
|
||||
--
|
||||
--
|
||||
=*(oct1 . .)
|
||||
|
@ -57,3 +57,4 @@
|
||||
?.(ept " ({-}'s turn) " ": {-} (row/col): ")::
|
||||
--
|
||||
--
|
||||
=*(oct2 . .)
|
||||
|
@ -58,3 +58,4 @@
|
||||
?.(ept " ({-}'s turn) " ": {-} (row/col): ")::
|
||||
--
|
||||
--
|
||||
=*(oct3 . .)
|
||||
|
@ -58,3 +58,4 @@
|
||||
?.(ept " ({-}'s turn) " ": {-} (row/col): ")::
|
||||
--
|
||||
--
|
||||
=*(oct4 . .)
|
||||
|
@ -129,3 +129,4 @@
|
||||
")"
|
||||
==
|
||||
--
|
||||
=*(react . .)
|
||||
|
@ -105,3 +105,4 @@
|
||||
^- [(list ,_mof) _con]
|
||||
(ref +<)
|
||||
--
|
||||
=*(sh-utils . .)
|
||||
|
264
lib/sole.hoon
264
lib/sole.hoon
@ -3,142 +3,140 @@
|
||||
::
|
||||
/? 310
|
||||
/- sole
|
||||
[. sole]
|
||||
!:
|
||||
::::
|
||||
::
|
||||
[sole .]
|
||||
|%
|
||||
++ cs :: shared-state engine
|
||||
|_ sole-share
|
||||
++ abet +<
|
||||
++ apply
|
||||
|= ted=sole-edit
|
||||
^+ +>
|
||||
?- -.ted
|
||||
%del +>.$(buf (weld (scag p.ted buf) (slag +(p.ted) buf)))
|
||||
%ins +>.$(buf (weld (scag p.ted buf) `_buf`[q.ted (slag p.ted buf)]))
|
||||
%mor |- ^+ +>.^$
|
||||
?~ p.ted
|
||||
+>.^$
|
||||
$(p.ted t.p.ted, +>.^$ ^$(ted i.p.ted))
|
||||
%nop +>.$
|
||||
%set +>.$(buf p.ted)
|
||||
|_ sole-share :: shared-state engine
|
||||
++ abet +<
|
||||
++ apply
|
||||
|= ted=sole-edit
|
||||
^+ +>
|
||||
?- -.ted
|
||||
%del +>.$(buf (weld (scag p.ted buf) (slag +(p.ted) buf)))
|
||||
%ins +>.$(buf (weld (scag p.ted buf) `_buf`[q.ted (slag p.ted buf)]))
|
||||
%mor |- ^+ +>.^$
|
||||
?~ p.ted
|
||||
+>.^$
|
||||
$(p.ted t.p.ted, +>.^$ ^$(ted i.p.ted))
|
||||
%nop +>.$
|
||||
%set +>.$(buf p.ted)
|
||||
==
|
||||
::
|
||||
::::
|
||||
:: ++transmute: symmetric operational transformation.
|
||||
::
|
||||
:: for any sole state +>, obeys
|
||||
::
|
||||
:: =+ [x=(transmute a b) y=(transmute b a)]
|
||||
:: .= (apply:(apply a) x)
|
||||
:: (apply:(apply b) y)
|
||||
::
|
||||
++ transmute :: dex as after sin
|
||||
|= [sin=sole-edit dex=sole-edit]
|
||||
~| [%transmute sin dex]
|
||||
^- sole-edit
|
||||
?: ?=(%mor -.sin)
|
||||
|- ^- sole-edit
|
||||
?~ p.sin dex
|
||||
$(p.sin t.p.sin, dex ^$(sin i.p.sin))
|
||||
::
|
||||
?: ?=(%mor -.dex)
|
||||
:- %mor
|
||||
|- ^- (list sole-edit)
|
||||
?~ p.dex ~
|
||||
[^$(dex i.p.dex) $(p.dex t.p.dex)]
|
||||
::
|
||||
?: |(?=(%nop -.sin) ?=(%nop -.dex)) dex
|
||||
?: ?=(%set -.sin) [%nop ~]
|
||||
?: ?=(%set -.dex) dex
|
||||
::
|
||||
?- -.sin
|
||||
%del
|
||||
?- -.dex
|
||||
%del ?: =(p.sin p.dex) [%nop ~]
|
||||
?:((lth p.sin p.dex) dex(p (dec p.dex)) dex)
|
||||
%ins ?:((lth p.sin p.dex) dex(p (dec p.dex)) dex)
|
||||
==
|
||||
::
|
||||
::::
|
||||
:: ++transmute: symmetric operational transformation.
|
||||
::
|
||||
:: for any sole state +>, obeys
|
||||
::
|
||||
:: =+ [x=(transmute a b) y=(transmute b a)]
|
||||
:: .= (apply:(apply a) x)
|
||||
:: (apply:(apply b) y)
|
||||
::
|
||||
++ transmute :: dex as after sin
|
||||
|= [sin=sole-edit dex=sole-edit]
|
||||
~| [%transmute sin dex]
|
||||
^- sole-edit
|
||||
?: ?=(%mor -.sin)
|
||||
|- ^- sole-edit
|
||||
?~ p.sin dex
|
||||
$(p.sin t.p.sin, dex ^$(sin i.p.sin))
|
||||
::
|
||||
?: ?=(%mor -.dex)
|
||||
:- %mor
|
||||
|- ^- (list sole-edit)
|
||||
?~ p.dex ~
|
||||
[^$(dex i.p.dex) $(p.dex t.p.dex)]
|
||||
::
|
||||
?: |(?=(%nop -.sin) ?=(%nop -.dex)) dex
|
||||
?: ?=(%set -.sin) [%nop ~]
|
||||
?: ?=(%set -.dex) dex
|
||||
::
|
||||
?- -.sin
|
||||
%del
|
||||
?- -.dex
|
||||
%del ?: =(p.sin p.dex) [%nop ~]
|
||||
?:((lth p.sin p.dex) dex(p (dec p.dex)) dex)
|
||||
%ins ?:((lth p.sin p.dex) dex(p (dec p.dex)) dex)
|
||||
==
|
||||
::
|
||||
%ins
|
||||
?- -.dex
|
||||
%del ?:((lte p.sin p.dex) dex(p +(p.dex)) dex)
|
||||
%ins ?: =(p.sin p.dex)
|
||||
?:((lth q.sin q.dex) dex dex(p +(p.dex)))
|
||||
?:((lte p.sin p.dex) dex(p +(p.dex)) dex)
|
||||
==
|
||||
==
|
||||
::
|
||||
++ commit :: local change
|
||||
|= ted=sole-edit
|
||||
^- sole-share
|
||||
abet:(apply(own.ven +(own.ven), leg [ted leg]) ted)
|
||||
::
|
||||
::::
|
||||
:: ++inverse: inverse of change in context.
|
||||
::
|
||||
:: for any sole state +>, obeys
|
||||
::
|
||||
:: =(+> (apply:(apply a) (inverse a)))
|
||||
::
|
||||
++ inverse :: relative inverse
|
||||
|= ted=sole-edit
|
||||
^- sole-edit
|
||||
=. ted ?.(?=([%mor * ~] ted) ted i.p.ted)
|
||||
?- -.ted
|
||||
%del [%ins p.ted (snag p.ted buf)]
|
||||
%ins [%del p.ted]
|
||||
%mor :- %mor
|
||||
%- flop
|
||||
|- ^- (list sole-edit)
|
||||
?~ p.ted ~
|
||||
:- ^$(ted i.p.ted)
|
||||
$(p.ted t.p.ted, +>.^$ (apply i.p.ted))
|
||||
%nop [%nop ~]
|
||||
%set [%set buf]
|
||||
::
|
||||
%ins
|
||||
?- -.dex
|
||||
%del ?:((lte p.sin p.dex) dex(p +(p.dex)) dex)
|
||||
%ins ?: =(p.sin p.dex)
|
||||
?:((lth q.sin q.dex) dex dex(p +(p.dex)))
|
||||
?:((lte p.sin p.dex) dex(p +(p.dex)) dex)
|
||||
==
|
||||
::
|
||||
++ receive :: naturalize event
|
||||
|= sole-change
|
||||
^- [sole-edit sole-share]
|
||||
?. &(=(his.ler his.ven) (lte own.ler own.ven))
|
||||
~& [%receive-sync his/[his.ler his.ven] own/[own.ler own.ven]]
|
||||
!!
|
||||
?> &(=(his.ler his.ven) (lte own.ler own.ven))
|
||||
?> |(!=(own.ler own.ven) =(0 haw) =(haw (sham buf)))
|
||||
=. leg (scag (sub own.ven own.ler) leg)
|
||||
:: ~? !=(own.ler own.ven) [%miss-leg leg]
|
||||
=+ dat=(transmute [%mor leg] ted)
|
||||
:: ~? !=(~ leg) [%transmute from/ted to/dat ~]
|
||||
[dat abet:(apply(his.ven +(his.ven)) dat)]
|
||||
::
|
||||
++ remit :: conditional accept
|
||||
|= [cal=sole-change ask=$+((list ,@c) ?)]
|
||||
^- [(unit sole-change) sole-share]
|
||||
=+ old=buf
|
||||
=^ dat +>+<.$ (receive cal)
|
||||
?: (ask buf)
|
||||
[~ +>+<.$]
|
||||
=^ lic +>+<.$ (transmit (inverse(buf old) dat))
|
||||
[`lic +>+<.$]
|
||||
::
|
||||
++ transmit :: outgoing change
|
||||
|= ted=sole-edit
|
||||
^- [sole-change sole-share]
|
||||
[[[his.ven own.ven] (sham buf) ted] (commit ted)]
|
||||
::
|
||||
++ transceive :: receive and invert
|
||||
|= sole-change
|
||||
^- [sole-edit sole-share]
|
||||
=+ old=buf
|
||||
=^ dat +>+<.$ (receive +<.$)
|
||||
[(inverse(buf old) dat) +>+<.$]
|
||||
::
|
||||
++ transpose :: adjust position
|
||||
|= pos=@ud
|
||||
=+ dat=(transmute [%mor leg] [%ins pos `@c`0])
|
||||
?> ?=(%ins -.dat)
|
||||
p.dat
|
||||
--
|
||||
==
|
||||
::
|
||||
++ commit :: local change
|
||||
|= ted=sole-edit
|
||||
^- sole-share
|
||||
abet:(apply(own.ven +(own.ven), leg [ted leg]) ted)
|
||||
::
|
||||
::::
|
||||
:: ++inverse: inverse of change in context.
|
||||
::
|
||||
:: for any sole state +>, obeys
|
||||
::
|
||||
:: =(+> (apply:(apply a) (inverse a)))
|
||||
::
|
||||
++ inverse :: relative inverse
|
||||
|= ted=sole-edit
|
||||
^- sole-edit
|
||||
=. ted ?.(?=([%mor * ~] ted) ted i.p.ted)
|
||||
?- -.ted
|
||||
%del [%ins p.ted (snag p.ted buf)]
|
||||
%ins [%del p.ted]
|
||||
%mor :- %mor
|
||||
%- flop
|
||||
|- ^- (list sole-edit)
|
||||
?~ p.ted ~
|
||||
:- ^$(ted i.p.ted)
|
||||
$(p.ted t.p.ted, +>.^$ (apply i.p.ted))
|
||||
%nop [%nop ~]
|
||||
%set [%set buf]
|
||||
==
|
||||
::
|
||||
++ receive :: naturalize event
|
||||
|= sole-change
|
||||
^- [sole-edit sole-share]
|
||||
?. &(=(his.ler his.ven) (lte own.ler own.ven))
|
||||
~& [%receive-sync his/[his.ler his.ven] own/[own.ler own.ven]]
|
||||
!!
|
||||
?> &(=(his.ler his.ven) (lte own.ler own.ven))
|
||||
?> |(!=(own.ler own.ven) =(0 haw) =(haw (sham buf)))
|
||||
=. leg (scag (sub own.ven own.ler) leg)
|
||||
:: ~? !=(own.ler own.ven) [%miss-leg leg]
|
||||
=+ dat=(transmute [%mor leg] ted)
|
||||
:: ~? !=(~ leg) [%transmute from/ted to/dat ~]
|
||||
[dat abet:(apply(his.ven +(his.ven)) dat)]
|
||||
::
|
||||
++ remit :: conditional accept
|
||||
|= [cal=sole-change ask=$+((list ,@c) ?)]
|
||||
^- [(unit sole-change) sole-share]
|
||||
=+ old=buf
|
||||
=^ dat +>+<.$ (receive cal)
|
||||
?: (ask buf)
|
||||
[~ +>+<.$]
|
||||
=^ lic +>+<.$ (transmit (inverse(buf old) dat))
|
||||
[`lic +>+<.$]
|
||||
::
|
||||
++ transmit :: outgoing change
|
||||
|= ted=sole-edit
|
||||
^- [sole-change sole-share]
|
||||
[[[his.ven own.ven] (sham buf) ted] (commit ted)]
|
||||
::
|
||||
++ transceive :: receive and invert
|
||||
|= sole-change
|
||||
^- [sole-edit sole-share]
|
||||
=+ old=buf
|
||||
=^ dat +>+<.$ (receive +<.$)
|
||||
[(inverse(buf old) dat) +>+<.$]
|
||||
::
|
||||
++ transpose :: adjust position
|
||||
|= pos=@ud
|
||||
=+ dat=(transmute [%mor leg] [%ins pos `@c`0])
|
||||
?> ?=(%ins -.dat)
|
||||
p.dat
|
||||
--
|
||||
=*(sole . .)
|
||||
|
@ -8,7 +8,7 @@
|
||||
!:
|
||||
::::
|
||||
::
|
||||
[talk .]
|
||||
[. talk]
|
||||
|%
|
||||
++ main :: main story
|
||||
|= our=ship ^- cord
|
||||
@ -56,3 +56,4 @@
|
||||
==
|
||||
--
|
||||
--
|
||||
=*(talk . .)
|
||||
|
@ -62,3 +62,4 @@
|
||||
acc(r $(acc r.acc))
|
||||
--
|
||||
--
|
||||
=*(tree . .)
|
||||
|
@ -4,11 +4,10 @@
|
||||
::
|
||||
/? 314
|
||||
/- twitter
|
||||
=+ twit
|
||||
=+ twit:twitter
|
||||
!:
|
||||
:::: functions
|
||||
::
|
||||
[twitter .]
|
||||
|%
|
||||
++ fass :: rewrite path
|
||||
|= a=path
|
||||
@ -543,3 +542,4 @@
|
||||
(mold %get /statuses/lookup ,[us ~])
|
||||
--
|
||||
--
|
||||
=*(twitter . .)
|
||||
|
@ -9,6 +9,7 @@
|
||||
::
|
||||
++ grow
|
||||
|% ++ httpreq
|
||||
^- request:http
|
||||
=- [/com/coinbase/sandbox /oauth/token [%post ~] ~ `quay`-]
|
||||
:~ ['grant_type' 'authorization_code']
|
||||
['code' oat.req]
|
||||
|
@ -5,5 +5,5 @@
|
||||
/+ http
|
||||
|_ hiss
|
||||
::
|
||||
++ grab |% ++ httpreq httpreq-to-hiss
|
||||
++ grab |% ++ httpreq request-to-hiss:http
|
||||
-- --
|
||||
|
@ -4,6 +4,6 @@
|
||||
/? 314
|
||||
/+ http
|
||||
::
|
||||
|_ req=_+<.httpreq-to-hiss
|
||||
|_ req=request:http
|
||||
++ grow |% ++ tank >req<
|
||||
-- --
|
||||
|
@ -6,6 +6,7 @@
|
||||
!:
|
||||
::::
|
||||
::
|
||||
[react .]
|
||||
|_ [hed=marl tal=marl]
|
||||
::
|
||||
++ grow :: convert to
|
||||
|
@ -6,6 +6,7 @@
|
||||
!:
|
||||
::::
|
||||
::
|
||||
[react .]
|
||||
|_ own=manx
|
||||
::
|
||||
++ grow :: convert to
|
||||
|
Loading…
Reference in New Issue
Block a user