Merge remote-tracking branch 'origin/master' into philip/mall-real

This commit is contained in:
Philip Monk 2019-11-23 23:41:46 -08:00
commit 4d1457bbaa
No known key found for this signature in database
GPG Key ID: B66E1F02604E44EC
34 changed files with 626 additions and 194 deletions

2
.gitattributes vendored
View File

@ -1,2 +1,4 @@
bin/* filter=lfs diff=lfs merge=lfs -text
bin/*/* filter=lfs diff=lfs merge=lfs -text
pkg/arvo/**/*.js binary
pkg/arvo/**/*.css binary

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0d6d8099a05a63a51e719bad90ab3148a98e3bfa6f4744e464e72de03da9bb8f
size 9959529
oid sha256:5838e7af41e323f032ed52a937a51f13bde7a0f05613c1b579001380d4076ebf
size 9964264

View File

@ -1,17 +1,5 @@
{ pkgs, urbit, pill }:
let
entrypoint = pkgs.writeScript "entrypoint.sh" ''
#!${pkgs.stdenv.shell}
set -euo pipefail
${urbit.meta.exe} "$@"
'';
in
pkgs.dockerTools.buildImage {
name = urbit.meta.name;

View File

@ -15,6 +15,7 @@
/+ sole-lib=sole, chat-eval, default-agent, verb
::
|%
+$ card card:agent:gall
+$ state
$: grams=(list mail) :: all messages
known=(set [target serial]) :: known message lookup
@ -40,12 +41,14 @@
[%say letter] :: send message
[%eval cord hoon] :: send #-message
::
[%create chat-security path (unit glyph)] :: create chat
::
:: create chat
[%create rw-security path (unit glyph) (unit ?)]
[%delete path] :: delete chat
[%invite ?(%r %w %rw) path (set ship)] :: allow
[%banish ?(%r %w %rw) path (set ship)] :: disallow
::
[%join target (unit glyph)] :: join target
[%join target (unit glyph) (unit ?)] :: join target
[%leave target] :: nuke target
::
[%bind glyph target] :: bind glyph
@ -63,7 +66,6 @@
[%help ~] :: print usage info
== ::
::
+$ card card:agent:gall
--
=| state
=* all-state -
@ -120,6 +122,7 @@
%fact
?+ p.cage.sign ~|([%chat-cli-bad-sub-mark wire p.cage.sign] !!)
%chat-update (diff-chat-update:tc wire !<(chat-update q.cage.sign))
%chat-two-update (diff-chat-two-update:tc wire !<(chat-two-update q.cage.sign))
==
==
[cards this]
@ -169,14 +172,8 @@
++ connect
^- card
[%pass /chat-store %agent [our-self %chat-store] %watch /updates]
:: +true-self: moons to planets
::
++ true-self
|= who=ship
^- ship
?. ?=(%earl (clan:title who)) who
(sein:title our.bowl now.bowl who)
++ our-self (true-self our.bowl)
++ our-self (name:title our.bowl)
:: +target-to-path: prepend ship to the path
::
++ target-to-path
@ -226,6 +223,11 @@
:- [prompt:sh-out ~]
:: start with fresh sole state
all-state(state.cli *sole-share:sole-sur)
::
++ diff-chat-two-update
|= [=wire upd=chat-two-update]
^- (quip card state)
(read-envelopes (path-to-target path.upd) envelopes.upd)
:: +diff-chat-update: get new mailboxes & messages
::
++ diff-chat-update
@ -412,13 +414,24 @@
;~ (glue ace)
(tag %create)
security
;~(plug path (punt ;~(pfix ace glyph)))
;~ plug
path
(punt ;~(pfix ace glyph))
(punt ;~(pfix ace (fuss 'y' 'n')))
==
==
;~((glue ace) (tag %delete) path)
;~((glue ace) (tag %invite) rw path ships)
;~((glue ace) (tag %banish) rw path ships)
::
;~((glue ace) (tag %join) ;~(plug targ (punt ;~(pfix ace glyph))))
;~ (glue ace)
(tag %join)
;~ plug
targ
(punt ;~(pfix ace glyph))
(punt ;~(pfix ace (fuss 'y' 'n')))
==
==
;~((glue ace) (tag %leave) targ)
::
;~((glue ace) (tag %bind) glyph targ)
@ -676,7 +689,7 @@
:: +create: new local mailbox
::
++ create
|= [security=chat-security =path gyf=(unit char)]
|= [security=rw-security =path gyf=(unit char) allow-history=(unit ?)]
^- (quip card state)
::TODO check if already exists
=/ =target [our-self path]
@ -688,18 +701,22 @@
%^ act %do-create %chat-view
:- %chat-view-action
!>
:^ %create path security
:: ensure we can read from/write to our own chats
::
:- :: read
:* %create
path
security
:: ensure we can read from/write to our own chats
::
:: read
?- security
?(%channel %journal) ~
?(%village %mailbox) [our-self ~ ~]
==
:: write
?- security
?(%channel %mailbox) ~
?(%village %journal) [our-self ~ ~]
:: write
?- security
?(%channel %mailbox) ~
?(%village %journal) [our-self ~ ~]
==
(fall allow-history %.y)
==
:: +delete: delete local chats
::
@ -761,7 +778,7 @@
:: +join: sync with remote mailbox
::
++ join
|= [=target gyf=(unit char)]
|= [=target gyf=(unit char) ask-history=(unit ?)]
^- (quip card state)
=^ moz all-state
?. ?=(^ gyf) [~ all-state]
@ -774,7 +791,7 @@
%^ act %do-join %chat-view
:- %chat-view-action
!>
[%join target]
[%join ship.target path.target (fall ask-history %.y)]
:: +leave: unsync & destroy mailbox
::
::TODO allow us to "mute" local chats using this

View File

@ -16,6 +16,7 @@
$% [%chat-initial inbox]
[%chat-configs chat-configs]
[%chat-update chat-update]
[%chat-two-update chat-two-update]
==
--
::
@ -148,10 +149,11 @@
|= action=chat-action
^- (quip card _state)
?- -.action
%create (handle-create action)
%delete (handle-delete action)
%message (handle-message action)
%read (handle-read action)
%create (handle-create action)
%delete (handle-delete action)
%message (handle-message action)
%messages (handle-messages action)
%read (handle-read action)
==
::
++ handle-create
@ -181,17 +183,34 @@
=/ mailbox=(unit mailbox) (~(get by inbox) path.act)
?~ mailbox
[~ state]
=* letter letter.envelope.act
=? letter &(?=(%code -.letter) ?=(~ output.letter))
=/ =hoon (ream expression.letter)
letter(output (eval bol hoon))
=: length.config.u.mailbox +(length.config.u.mailbox)
number.envelope.act +(length.config.u.mailbox)
envelopes.u.mailbox (snoc envelopes.u.mailbox envelope.act)
==
=. letter.envelope.act (evaluate-letter letter.envelope.act)
=. u.mailbox (append-envelope u.mailbox envelope.act)
:- (send-diff path.act act)
state(inbox (~(put by inbox) path.act u.mailbox))
::
++ handle-messages
|= act=chat-action
^- (quip card _state)
?> ?=(%messages -.act)
=/ mailbox=(unit mailbox) (~(get by inbox) path.act)
?~ mailbox
[~ state]
=/ evaluated-envelopes=(list envelope) ~
|- ^- (quip card _state)
?~ envelopes.act
:_ state(inbox (~(put by inbox) path.act u.mailbox))
%+ send-two-diff path.act
:* %messages
path.act
(sub length.config.u.mailbox (lent evaluated-envelopes))
length.config.u.mailbox
evaluated-envelopes
==
=. letter.i.envelopes.act (evaluate-letter letter.i.envelopes.act)
=. evaluated-envelopes (snoc evaluated-envelopes i.envelopes.act)
=. u.mailbox (append-envelope u.mailbox i.envelopes.act)
$(envelopes.act t.envelopes.act)
::
++ handle-read
|= act=chat-action
^- (quip card _state)
@ -203,24 +222,54 @@
:- (send-diff path.act act)
state(inbox (~(put by inbox) path.act u.mailbox))
::
++ evaluate-letter
|= =letter
^- ^letter
=? letter &(?=(%code -.letter) ?=(~ output.letter))
=/ =hoon (ream expression.letter)
letter(output (eval bol hoon))
letter
::
++ append-envelope
|= [=mailbox =envelope]
^- ^mailbox
=. number.envelope +(length.config.mailbox)
=: length.config.mailbox +(length.config.mailbox)
envelopes.mailbox (snoc envelopes.mailbox envelope)
==
mailbox
::
++ update-subscribers
|= [pax=path act=chat-action]
|= [pax=path act=chat-update]
^- (list card)
[%give %fact `pax %chat-update !>(act)]~
::
++ send-diff
|= [pax=path act=chat-action]
|= [pax=path upd=chat-update]
^- (list card)
%- zing
:~ (update-subscribers /all act)
(update-subscribers /updates act)
(update-subscribers [%mailbox pax] act)
?. |(=(%read -.act) =(%message -.act))
:~ (update-subscribers /all upd)
(update-subscribers /updates upd)
(update-subscribers [%mailbox pax] upd)
?. |(|(=(%read -.upd) =(%message -.upd)) =(%messages -.upd))
~
(update-subscribers /configs act)
?. |(=(%create -.act) =(%delete -.act))
(update-subscribers /configs upd)
?. |(=(%create -.upd) =(%delete -.upd))
~
(update-subscribers /keys act)
(update-subscribers /keys upd)
==
::
++ send-two-diff
|= [pax=path upd=chat-two-update]
^- (list card)
%- zing
:~ (update-two-subscribers /all upd)
(update-two-subscribers /updates upd)
(update-two-subscribers [%mailbox pax] upd)
==
::
++ update-two-subscribers
|= [pax=path upd=chat-two-update]
^- (list card)
[%give %fact `pax %chat-two-update !>(upd)]~
--

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,6 @@
/+ *server,
auto=language-server-complete,
lsp-parser=language-server-parser,
easy-print=language-server-easy-print,
rune-snippet=language-server-rune-snippet,
default-agent
@ -9,6 +10,8 @@
$: uri=@t
$% [%sync changes=(list change)]
[%completion position]
[%commit @ud]
[%hover position]
==
==
::
@ -67,7 +70,11 @@
==
[cards this]
::
++ on-watch on-watch:def
++ on-watch
|= =path
?. ?=([%http-response @ ~] path)
(on-watch:def path)
`this
++ on-leave on-leave:def
++ on-peek on-peek:def
++ on-agent on-agent:def
@ -95,6 +102,8 @@
%- of
:~ sync+sync
completion+position
commit+ni
hover+position
==
~
==
@ -122,6 +131,12 @@
~
==
--
::
++ json-response
|= [eyre-id=@ta jon=json]
^- (list card)
(give-simple-payload:app eyre-id (json-response:gen (json-to-octs jon)))
::
:: +handle-http-request: received on a new connection established
::
++ handle-http-request
@ -132,23 +147,90 @@
%- parser
(need (de-json:html q.u.body.request.inbound-request))
=/ buf (~(gut by bufs) uri.lsp-req *wall)
=^ out-jon buf
=^ cards buf
?- +<.lsp-req
%sync (handle-sync buf +>.lsp-req)
%completion (handle-completion buf +>.lsp-req)
%sync (handle-sync buf eyre-id +>.lsp-req)
%completion (handle-completion buf eyre-id +>.lsp-req)
%commit (handle-commit buf eyre-id uri.lsp-req)
%hover (handle-hover buf eyre-id +>.lsp-req)
==
=. bufs
(~(put by bufs) uri.lsp-req buf)
:_ state
%+ give-simple-payload:app eyre-id
%+ require-authorization:app inbound-request
|= =inbound-request:eyre
^- simple-payload:http
(json-response:gen (json-to-octs out-jon))
[cards state]
::
++ regen-diagnostics
|= buf=wall
^- json
=/ t=tape
(zing (join "\0a" buf))
=/ parse
(lily:auto t (lsp-parser *beam))
?: ?=(%| -.parse)
(format-diagnostic p.parse)
=, enjs:format
%- pairs
:~ good+b+&
==
::
++ format-diagnostic
|= [row=@ col=@]
^- json
=, enjs:format
%- pairs
:~ good+b+|
:+ %diagnostics %a :_ ~
=/ loc (pairs line+(numb (dec row)) character+(numb col) ~)
%- pairs
:~ range+(pairs start+loc end+loc ~)
severity+n+'1'
message+s+'syntax error'
==
==
::
++ handle-commit
|= [buf=wall eyre-id=@ta uri=@t]
^- [(list card) wall]
:_ buf
=/ jon
(regen-diagnostics buf)
:_ (json-response eyre-id jon)
:*
%pass
/commit
%agent
[our.bow %hood]
%poke
%kiln-commit
!>([q.byk.bow |])
==
::
++ handle-hover
|= [buf=wall eyre-id=@ta row=@ud col=@ud]
^- [(list card) wall]
=/ txt
(zing (join "\0a" buf))
=+ (get-id:auto (get-pos buf row col) txt)
?~ id
[(json-response eyre-id *json) buf]
=/ match=(unit [=term =type])
(search-exact:auto u.id (get-identifiers:auto -:!>(..zuse)))
?~ match
[(json-response eyre-id *json) buf]
=/ contents
%- crip
;: weld
"`"
~(ram re ~(duck easy-print type.u.match))
"`"
==
:_ buf
%+ json-response eyre-id
%- pairs:enjs:format
[contents+s+contents ~]
::
++ handle-sync
|= [buf=wall changes=(list change)]
:- *json
|= [buf=wall eyre-id=@ta changes=(list change)]
:- (json-response eyre-id *json)
|- ^- wall
?~ changes
buf
@ -196,8 +278,8 @@
(sub a b)
::
++ handle-completion
|= [buf=wall row=@ud col=@ud]
^- [json wall]
|= [buf=wall eyre-id=@ta row=@ud col=@ud]
^- [(list card) wall]
=/ =tape (zing (join "\0a" buf))
=/ pos (get-pos buf row col)
:_ buf
@ -205,27 +287,19 @@
::
=/ rune (swag [(safe-sub pos 2) 2] tape)
?: (~(has by runes:rune-snippet) rune)
(rune-snippet rune)
(json-response eyre-id (rune-snippet rune))
:: Don't run on large files because it's slow
::
?: (gth (lent buf) 1.000)
=, enjs:format
(pairs good+b+& result+~ ~)
(json-response eyre-id (pairs good+b+& result+~ ~))
::
=/ tl
(tab-list-tape:auto -:!>(..zuse) pos tape)
=, enjs:format
%+ json-response eyre-id
?: ?=(%| -.tl)
%- pairs
:~ good+b+|
:+ %diagnostics %a :_ ~
=/ loc (pairs line+(numb (dec row.p.tl)) character+(numb col.p.tl) ~)
%- pairs
:~ range+(pairs start+loc end+loc ~)
severity+n+'1'
message+s+'syntax error'
==
==
(format-diagnostic p.tl)
?~ p.tl
*json
%- pairs

View File

@ -0,0 +1,9 @@
:: subscribe to a publish notebook
::
:- %say
|= $: [now=@da eny=@uvJ =beak]
[[=ship name=term ~] ~]
==
:- %publish-action
[%subscribe ship name]

37
pkg/arvo/gen/trouble.hoon Normal file
View File

@ -0,0 +1,37 @@
:- %say
|= [[now=time * bec=beak] ~ ~]
=* our p.bec
=/ sponsor (sein:title our now our)
:- %noun
=<
:~
[%base-hash .^(@uv %cz (pathify ~.base ~))]
[%home-hash .^(@uv %cz (pathify ~.home ~))]
::
(info %our our)
(info %sponsor sponsor)
(info %dopzod ~dopzod)
::
["Compare lifes and rifts to values here:"]
["https://etherscan.io/address/azimuth.eth#readContract"]
[" life - getKeyRevisionNumber"]
[" rift - getContinuityNumber"]
==
|%
++ pathify
|= [a=@ta b=(unit ship)]
^- path
=/ o=@ta (scot %p our)
=/ n=@ta (scot %da now)
?~ b ~[o a n]
~[o a n (scot %p u.b)]
::
++ info
|= [=term =ship]
:* term
ship=ship
point=(crip (slag 2 (scow %ui ship)))
life=.^(* %j (pathify ~.life `ship))
rift=.^(* %j (pathify ~.rift `ship))
==
--

View File

@ -118,6 +118,25 @@
[%config (conf config.mailbox)]
==
::
++ two-update-to-json
|= upd=chat-two-update
=, enjs:format
^- json
%+ frond %chat-update
%- pairs
:~
?: =(%messages -.upd)
?> ?=(%messages -.upd)
:- %messages
%- pairs
:~ [%path (path path.upd)]
[%start (numb start.upd)]
[%end (numb end.upd)]
[%envelopes [%a (turn envelopes.upd enve)]]
==
[*@t *^json]
==
::
++ update-to-json
|= upd=chat-update
=, enjs:format
@ -166,6 +185,7 @@
:~ [%create create]
[%delete delete]
[%message message]
[%messages messages]
[%read read]
==
::
@ -184,6 +204,12 @@
[%envelope envelope]
==
::
++ messages
%- ot
:~ [%path pa]
[%envelopes (ar envelope)]
==
::
++ read
(ot [%path pa] ~)
::
@ -225,6 +251,7 @@
[%security sec]
[%read (as (su ;~(pfix sig fed:ag)))]
[%write (as (su ;~(pfix sig fed:ag)))]
[%allow-history bo]
==
::
++ delete
@ -234,11 +261,12 @@
%- ot
:~ [%ship (su ;~(pfix sig fed:ag))]
[%path pa]
[%ask-history bo]
==
::
++ sec
=, dejs:format
^- $-(json chat-security)
^- $-(json rw-security)
(su (perk %channel %village %journal %mailbox ~))
--
--

View File

@ -68,6 +68,17 @@
[%hold *] $(ty ~(repo ut ty))
==
::
++ search-exact
|= [sid=term ids=(list [term type])]
^- (unit [term type])
=/ match=(list [term type])
%+ skim ids
|= [id=term ty=type]
=(sid id)
?~ match
~
[~ i.match]
::
:: Get all the identifiers that start with sid.
::
++ search-prefix
@ -234,18 +245,14 @@
^- (unit [term type])
~
::
:: Insert magic marker in hoon source at the given position.
::
++ insert-magic
++ get-id
|= [pos=@ud txt=tape]
^- [back-pos=@ud fore-pos=@ud txt=tape]
:: Find beg-pos by searching backward to where the current term
:: begins
::
^- [forward=(unit term) backward=(unit term) id=(unit term)]
=/ forward=(unit term)
%+ scan `tape`(slag pos txt)
;~(sfix (punt sym) (star ;~(pose prn (just `@`10))))
=/ backward=(unit term)
%- (lift |=(t=@tas (swp 3 t)))
%+ scan `tape`(flop (scag pos txt))
;~(sfix (punt sym) (star ;~(pose prn (just `@`10))))
=/ id=(unit term)
@ -256,6 +263,16 @@
?~ backward
`u.forward
`(cat 3 u.backward u.forward)
[forward backward id]
::
:: Insert magic marker in hoon source at the given position.
::
++ insert-magic
|= [pos=@ud txt=tape]
^- [back-pos=@ud fore-pos=@ud txt=tape]
:: Find beg-pos by searching backward to where the current term
:: begins
=+ (get-id pos txt)
=/ back-pos
?~ backward
pos

View File

@ -20,16 +20,18 @@
%- ot
:~ [%path pa]
[%security sec]
[%allow-history bo]
==
::
++ add-synced
%- ot
:~ [%ship (su ;~(pfix sig fed:ag))]
[%path pa]
[%ask-history bo]
==
::
++ sec
^- $-(^json chat-security)
^- $-(^json rw-security)
(su (perk %channel %village %journal %mailbox ~))
::
--

View File

@ -0,0 +1,13 @@
/+ *chat-json
|_ upd=chat-two-update
++ grow
|%
++ json (two-update-to-json upd)
--
::
++ grab
|%
++ noun chat-two-update
--
::
--

View File

@ -1,23 +1,16 @@
/- *rw-security
|%
+$ chat-security
$? $channel :: black r, black w
$village :: white r, white w
$journal :: black r, white w
$mailbox :: white r, black w
==
::
+$ chat-hook-action
$% :: %add-owned: make a chatroom accessible to foreign ships
:: specified by the chat-security model
:: specified by the rw-security model
::
[%add-owned =path security=chat-security]
[%add-owned =path security=rw-security allow-history=?]
:: %add-synced: mirror a foreign chatroom to our chat-store
::
[%add-synced =ship =path]
[%add-synced =ship =path ask-history=?]
:: %remove: stop mirroring a foreign chatroom or allowing a local
:: chatroom to be mirrored
::
[%remove =path]
==
--

View File

@ -30,16 +30,26 @@
::
+$ chat-configs (map path config)
::
+$ chat-action
+$ chat-base
$% [%create =ship =path] :: %create: create a mailbox at ~ship/path
[%delete =path] :: %delete: delete a mailbox at path
[%message =path =envelope] :: %message: append a message to mailbox
[%read =path] :: %read: set mailbox to read
==
::
+$ chat-action
$% :: %messages: append a list of messages to mailbox
::
[%messages =path envelopes=(list envelope)]
chat-base
==
::
+$ chat-update
$% [%keys keys=(set path)]
[%config =path =config]
chat-action
chat-base
==
::
+$ chat-two-update
[%messages =path start=@ud end=@ud envelopes=(list envelope)]
--

View File

@ -1,14 +1,14 @@
/- *rw-security
|%
+$ chat-security
$? $channel :: black r, black w
$village :: white r, white w
$journal :: black r, white w
$mailbox :: white r, black w
==
::
+$ chat-view-action
$% [%create =path security=chat-security read=(set ship) write=(set ship)]
$% $: %create
=path
security=rw-security
read=(set ship)
write=(set ship)
allow-history=?
==
[%delete =path]
[%join =ship =path]
[%join =ship =path ask-history=?]
==
--

View File

@ -0,0 +1,8 @@
|%
+$ rw-security
$? $channel :: black r, black w
$village :: white r, white w
$journal :: black r, white w
$mailbox :: white r, black w
==
--

View File

@ -6124,47 +6124,54 @@
==
++ royl
~+
=+ ^= moo
|= a/tape
;~ pose
(stag %rh royl-rh)
(stag %rq royl-rq)
(stag %rd royl-rd)
(stag %rs royl-rs)
==
::
++ royl-rh (cook rylh ;~(pfix ;~(plug sig sig) (cook royl-cell royl-rn)))
++ royl-rq (cook rylq ;~(pfix ;~(plug sig sig sig) (cook royl-cell royl-rn)))
++ royl-rd (cook ryld ;~(pfix sig (cook royl-cell royl-rn)))
++ royl-rs (cook ryls (cook royl-cell royl-rn))
::
++ royl-rn
=/ moo
|= a=tape
:- (lent a)
(scan a (bass 10 (plus sid:ab)))
=+ ^= voy
%+ cook royl-cell
;~ pose
;~ plug
(easy %d)
;~ pose (cold | hep) (easy &) ==
;~ plug dim:ag
;~ pose
;~(pfix dot (cook moo (plus (shim '0' '9'))))
(easy [0 0])
==
;~ pose
;~ pfix
(just 'e')
;~(plug ;~(pose (cold | hep) (easy &)) dim:ag)
==
(easy [& 0])
==
;~ pose
;~ plug
(easy %d)
;~(pose (cold | hep) (easy &))
;~ plug dim:ag
;~ pose
;~(pfix dot (cook moo (plus (shim '0' '9'))))
(easy [0 0])
==
==
;~ plug
(easy %i)
;~ sfix
;~ pose (cold | hep) (easy &) ==
(jest 'inf')
;~ pose
;~ pfix
(just 'e')
;~(plug ;~(pose (cold | hep) (easy &)) dim:ag)
==
(easy [& 0])
==
==
;~ plug
(easy %n)
(cold ~ (jest 'nan'))
==
==
;~ pose
(stag %rh (cook rylh ;~(pfix ;~(plug sig sig) voy)))
(stag %rq (cook rylq ;~(pfix ;~(plug sig sig sig) voy)))
(stag %rd (cook ryld ;~(pfix sig voy)))
(stag %rs (cook ryls voy))
::
;~ plug
(easy %i)
;~ sfix
;~(pose (cold | hep) (easy &))
(jest 'inf')
==
==
::
;~ plug
(easy %n)
(cold ~ (jest 'nan'))
==
==
::
++ royl-cell

View File

@ -1370,8 +1370,8 @@
%- ~(uni by `(map path *)`cal.bob-diffs)
%- ~(uni by `(map path *)`can.bob-diffs)
`(map path *)`old.bob-diffs
?^ bof
(error:he cas %meet-conflict >(~(run by `(map path *)`bof) _~)< ~)
?. =(~ bof)
(error:he cas %meet-conflict >~(key by bof)< ~)
=/ old=(map path lobe)
%+ roll ~(tap by (~(uni by old.ali-diffs) old.bob-diffs))
=< .(old q.bas)
@ -2370,7 +2370,7 @@
?: =(0 let.dom) [~ 0] :: avoid underflow
?: %+ gte p.lok
=< t
~| [%letdom let=let.dom hit=hit.dom hut=(~(run by hut.ran) ,~)]
~| [%letdom let=let.dom hit=hit.dom hut=~(key by hut.ran)]
~| [%getdom (~(get by hit.dom) let.dom)]
%- aeon-to-yaki
let.dom

View File

@ -302,25 +302,13 @@
::
:: start subscriptions
::
:: get everything from azimuth-tracker because jael subscriptions
:: seem to be flaky for now
::
=. +>.$ (poke-watch hen %azimuth-tracker nod.own.pki)
=. +>.$
?- (clan:title our)
%czar
%- curd =< abet
(sources:~(feel su hen our pki etn) ~ [%| %azimuth-tracker])
::
*
=/ spon-ship
?> ?=(^ spon.tac)
ship.i.spon.tac
=. +>.$
%- curd =< abet
%+ sources:~(feel su hen our pki etn)
(silt spon-ship ~)
[%| %azimuth-tracker]
%- curd =< abet
(sources:~(feel su hen our pki etn) ~ [%& spon-ship])
==
%- curd =< abet
(sources:~(feel su hen our pki etn) ~ [%| %azimuth-tracker])
::
=. moz
%+ weld moz

View File

@ -8,15 +8,16 @@
:: or classes).
::
:: each of these stages is split into cores for each of
:: arvo's eight major vanes (kernel modules). these are:
:: arvo's nine major vanes (kernel modules). these are:
::
:: - %ames: networking (rhymes with "games")
:: - %behn: scheduling ("bane")
:: - %clay: revision control ("play")
:: - %dill: console ("pill")
:: - %eyre: web ("fair")
:: - %eyre: http server ("fair")
:: - %ford: build ("lord")
:: - %gall: application ("ball")
:: - %iris: http client ("virus")
:: - %jael: security ("jail")
::
:: with %zuse in your core, the engines of any vane are
@ -6888,6 +6889,12 @@
?> (lte wid 16) %pawn
:: :: ++rank:title
+$ rank ?(%czar %king %duke %earl %pawn) :: ship width class
:: :: ++name:title
++ name :: identity
|= who=ship
^- ship
?. ?=(%earl (clan who)) who
(sein who)
:: :: ++saxo:title
++ saxo :: autocanon
|= who=ship

View File

@ -14,6 +14,10 @@ textarea, input, button {
background-color: #fff;
}
input[type=checkbox] {
-webkit-appearance: checkbox;
}
a {
color: #000 !important;
font-weight: 400 !important;

View File

@ -128,10 +128,11 @@ class UrbitApi {
this.action("chat-view", "json", data);
}
chatViewCreate(path, security, read, write) {
chatViewCreate(path, security, read, write, allowHistory) {
this.chatViewAction({
create: {
path, security, read, write
path, security, read, write,
'allow-history': allowHistory
}
});
}
@ -140,8 +141,13 @@ class UrbitApi {
this.chatViewAction({ delete: { path } });
}
chatViewJoin(ship, path) {
this.chatViewAction({ join: { ship, path } });
chatViewJoin(ship, path, askHistory) {
this.chatViewAction({
join: {
ship, path,
'ask-history': askHistory
}
});
}
inviteAction(data) {

View File

@ -67,7 +67,7 @@ export class ChatScreen extends Component {
updateReadNumber() {
const { props, state } = this;
if (props.read < props.envelopes.length) {
if (props.read < props.length) {
props.api.chat.read(state.station);
}
}

View File

@ -47,7 +47,8 @@ export class JoinScreen extends Component {
return;
}
props.api.chatView.join(ship, station);
// TODO: askHistory setting
props.api.chatView.join(ship, station, true);
this.props.history.push('/~chat');
}

View File

@ -26,19 +26,21 @@ export class ChatInput extends Component {
// perf testing:
/*let closure = () => {
let x = 0;
for (var i = 0; i < 30; i++) {
x++;
props.api.chat.message(
props.station,
`~${window.ship}`,
Date.now(),
{
text: `${Date.now()}`
text: `${x}`
}
);
}
setTimeout(closure, 1000);
};
setTimeout(closure, 2000);*/
this.closure = closure.bind(this);*/
moment.updateLocale('en', {
relativeTime : {
@ -144,6 +146,7 @@ export class ChatInput extends Component {
Date.now(),
letter
);
// perf: setTimeout(this.closure, 2000);
this.setState({
message: '',

View File

@ -14,12 +14,14 @@ export class NewScreen extends Component {
invites: '',
security: 'village',
idError: false,
inviteError: false
inviteError: false,
allowHistory: true
};
this.idChange = this.idChange.bind(this);
this.invChange = this.invChange.bind(this);
this.securityChange = this.securityChange.bind(this);
this.allowHistoryChange = this.allowHistoryChange.bind(this);
}
componentDidUpdate(prevProps, prevState) {
@ -47,6 +49,10 @@ export class NewScreen extends Component {
this.setState({security: event.target.value});
}
allowHistoryChange(event) {
this.setState({allowHistory: !!event.target.checked});
}
onClickCreate() {
const { props, state } = this;
if (!state.idName) {
@ -114,14 +120,15 @@ export class NewScreen extends Component {
readAud = aud.slice(); // white list
writeAud = []; // black list
}
this.setState({
error: false,
success: true,
invites: ''
}, () => {
props.setSpinner(true);
props.api.chatView.create(station, state.security, readAud, writeAud);
props.api.chatView.create(
station, state.security, readAud, writeAud, state.allowHistory
);
aud.forEach((ship) => {
if (ship !== `~${window.ship}`) {
props.api.invite.invite(station, ship);
@ -194,6 +201,18 @@ export class NewScreen extends Component {
<option value="journal">Journal</option>
<option value="mailbox">Mailbox</option>
</select>
<p className="body-medium mt3 db">Chat History</p>
<div className="db mt2">
<input
type="checkbox"
checked={this.state.allowHistory}
onChange={this.allowHistoryChange.bind(this)}
className="dib mr2"
/>
<p className="body-small db mt2 mb3 dib">
Allow participants to download the chat history upon joining.
</p>
</div>
<button
onClick={this.onClickCreate.bind(this)}
className={createClasses}

View File

@ -44,7 +44,8 @@ export class Root extends Component {
messagePreviews[stat] = envelopes[envelopes.length - 1];
}
unreads[stat] = envelopes.length > state.inbox[stat].config.read;
unreads[stat] =
state.inbox[stat].config.length > state.inbox[stat].config.read;
});
let invites = '/chat' in state.invites ?
@ -113,7 +114,7 @@ export class Root extends Component {
`/${props.match.params.ship}/${props.match.params.station}`;
let mailbox = state.inbox[station] || {
config: {
read: -1,
read: 0,
length: 0
},
envelopes: []
@ -127,6 +128,7 @@ export class Root extends Component {
api={api}
subscription={subscription}
read={mailbox.config.read}
length={mailbox.config.length}
envelopes={mailbox.envelopes}
inbox={state.inbox}
group={write}

View File

@ -18,15 +18,18 @@ export class ChatUpdateReducer {
let data = _.get(json, 'message', false);
if (data) {
state.inbox[data.path].envelopes.push(data.envelope);
state.inbox[data.path].config.length
= state.inbox[data.path].config.length + 1;
}
}
messages(json, state) {
let data = _.get(json, 'messages', false);
if (data) {
console.log(data);
state.inbox[data.path].envelopes =
data.envelopes.concat(state.inbox[data.path].envelopes);
state.inbox[data.path].config.length =
state.inbox[data.path].config.length + data.envelopes.length;
}
}
@ -34,7 +37,7 @@ export class ChatUpdateReducer {
let data = _.get(json, 'read', false);
if (data) {
state.inbox[data.path].config.read =
state.inbox[data.path].envelopes.length;
state.inbox[data.path].config.length;
}
}
@ -44,8 +47,8 @@ export class ChatUpdateReducer {
state.inbox[`/~${data.ship}${data.path}`] = {
envelopes: [],
config: {
read:0,
length: 0,
read: 0,
length: 0
}
};
}

View File

@ -400,7 +400,7 @@ u3_ve_usage(c3_i argc, c3_c** argv)
"Simple Usage: \n",
" %s -c <my-comet> to create a comet (anonymous urbit)\n",
" %s -w <my-planet> -k <my-key-file> if you own a planet\n",
" %s <myplanet or mycomet> to restart an existing urbit\n",
" %s <my-planet or my-comet> to restart an existing urbit\n",
0
};

View File

@ -1601,8 +1601,8 @@ u3m_init(void)
-1, 0);
u3l_log("boot: mapping %dMB failed\r\n", (len_w / (1024 * 1024)));
u3l_log("see urbit.org/docs/getting-started/installing-urbit/#swap"
"for adding swap space\r\n");
u3l_log("see urbit.org/using/install/#about-swap-space"
" for adding swap space\r\n");
if ( -1 != (c3_ps)map_v ) {
u3l_log("if porting to a new platform, try U3_OS_LoomBase %p\r\n",
dyn_v);

72
sh/merge-and-update-solid Executable file
View File

@ -0,0 +1,72 @@
#!/usr/bin/env bash
usage() {
local error="$1"
cat >&2 <<EOF
Usage:
$0 BRANCH PULL_REQUEST
Synopsis:
Useful script for merging a GitHub pull request, resolving any (solid) pill
conflicts along the way.
Strips "origin" from branches.
Example:
$0 origin/philip/jael-fix 1953
Yields:
Merge branch 'philip/jael-fix' (#1953)
* origin/philip/jael-fix:
jael: process all ships in %full update
Signed-off-by: Jared Tobin <jared@tlon.io>
Error:
-> $error
EOF
exit 1
}
args="$@"
if [[ -z "$args" ]]; then
usage "No arguments specified."
fi
REV=$1
PR=$2
TARGET=$(echo $REV | sed s_origin/__)
MERGE_MSG="Merge branch '$TARGET' (#$PR)"
PIER="tmp_pill_zod"
cleanup () {
if [ -e ./$PIER/.vere.lock ]
then kill $(< ./$PIER/.vere.lock) || true;
fi
}
trap cleanup EXIT
git merge --no-ff --signoff --log -X ours -m "$MERGE_MSG" $REV
rm -rf $PIER
urbit -d -F zod -B bin/solid.pill -A pkg/arvo -c $PIER
herb $PIER -P solid.pill -d '+solid'
mv solid.pill bin/solid.pill
git add bin/solid.pill
git commit --amend --no-edit
cleanup
rm -rf $PIER

73
sh/test-arvo-upgrade-path Executable file
View File

@ -0,0 +1,73 @@
#!/usr/bin/env bash
usage() {
local error="$1"
cat >&2 <<EOF
Usage:
$0 FROM_REVISION TO_REVISION
Synopsis:
Test an Arvo OTA update on a fake ship.
Example:
$0 arvo.2019.11.6 arvo.2019.11.8
Error:
-> $error
EOF
exit 1
}
args="$@"
if [[ -z "$args" ]]; then
usage "No arguments specified."
fi
FROM=$1
TO=$2
SHIP="zod"
START=$(git rev-parse HEAD)
cleanup () {
if [ -e ./$PIER/.vere.lock ]
then kill $(< ./$PIER/.vere.lock) || true;
fi
}
trap cleanup EXIT
boot_ship() {
ship=$1
rev=$2
git checkout $rev
make install
urbit -d -F $ship -B bin/brass.pill
}
mount_home() {
pier=$1
herb ./$pier -p hood -d "+hood/mount /=home="
}
update_arvo() {
pier=$1
rev=$2
git checkout $rev
rsync -zr --delete ./pkg/arvo/ ./$pier/home
herb ./$pier -p hood -d "+hood/commit %home"
}
boot_ship $SHIP $FROM
mount_home $SHIP
update_arvo $SHIP $TO
cleanup
git checkout $START