Miscellaneous small changes, mostly comments and debugging.

This commit is contained in:
Fang 2017-03-30 14:17:37 +02:00
parent 718d88f3b7
commit f15a52a7f2
3 changed files with 79 additions and 43 deletions

View File

@ -1,10 +1,21 @@
:: :: ::
:::: /hoon/talk-agent/app :: ::
:: :: ::
::
::TODO guardian's todo's apply here too
::TODO if we use a new structure for sending messages broker->reader, then we
:: can be safe in not doing permission checks.
::TODO actually send update moves when needed
::TODO process reports
::TODO init, general subscribe to broker.
::TODO? do we even need multiple shells?
::TODO rename cores. pa->ta (transaction), ta->pa (partner), etc.
::
/? 310 :: hoon version
/- talk, sole :: structures
/+ talk, sole, time-to-id, twitter :: libraries
/= seed /~ !>(.)
!:
::
::::
::
@ -15,7 +26,7 @@
folks/(map ship human) :: human identities
nik/(map (set partner) char) :: bound station glyphs
nak/(jug char (set partner)) :: station glyph lookup
cli/shell :: interaction state
cli/shell :: interaction state
== ::
++ tale :: user-facing story
$: count/@ud :: (lent grams)
@ -24,6 +35,7 @@
shape/config :: configuration
known/(map serial @ud) :: messages heard
== ::
::TODO do away with most of shell state, it's largely a mirror of tale..?
++ shell :: console session
$: her/ship :: client identity
id/bone :: identifier
@ -99,7 +111,7 @@
::x moves: moves storage, added to by ++ra-emit and -emil, produced by -abed.
|_ moves/(list move)
::
++ ra-abed :: resolve core
++ ra-abet :: resolve core
::x produces the moves stored in ++ra's moves.
::x sole-effects get special treatment to become a single move.
::
@ -183,6 +195,7 @@
%= +> tales
%+ roll (~(tap by tals))
|= {t/(pair knot (unit config)) tas/_tales}
~& [%r-new-config-for p.t]
=. tas ?~(tas tales tas) ::x start with our current tales.
=+ tal=(fall (~(get by tas) p.t) *tale)
?~ q.t (~(del by tas) p.t)
@ -235,7 +248,7 @@
::x make a shell for her.
::
|= {her/ship pax/path}
~& [%ra-console her pax]
~& [%ra-console her pax ost.hid]
^+ +>
::x get story from the path, default to standard mailbox.
=/ man/knot
@ -245,12 +258,12 @@
==
=/ she/shell
%*(. *shell her her, man man, id ost.hid, active (sy [%& our.hid man] ~))
sh-abet:~(sh-peer sh ~ she)
sh-abet:~(sh-prod sh ~ she)
::
++ ra-init
::x populate state on first boot. subscribes to our broker.
::
~& %r-ra-init
~& [%r-ra-init ost.hid]
%- ra-emit
:* ost.hid
%peer
@ -355,6 +368,7 @@
^+ +>
+>(shape con)
--
::
++ sh :: per console
::x shell core, responsible for doing things with console sessions,
::x like parsing input, acting based on input, showing output, keeping
@ -556,7 +570,7 @@
|= dup/update
^+ +>
::TODO is ost.hid okay here? or do we want to store bone of broker?
~& [%update-to ost.hid]
~& [%r-update-to ost.hid]
%= +>
moves :_ moves
:* ost.hid
@ -567,16 +581,6 @@
==
==
::
++ sh-peer :: subscribe shell
::x create a shell, subscribe to default stories.
::
=< sh-prod
%_ .
+>
+>
::TODO peer susbcribe to /sole and /sole/man.she at our broker.
==
::
++ sh-prod :: show prompt
::x make and store a move to modify the cli prompt, displaying audience.
::
@ -668,7 +672,9 @@
?: (~(has in lax) pan) `pan
$(grams t.grams)
::
::TODO we have a stdlib set diff now!
::TODO can we really not do some shenanigans to make a generic maps diff?
:: that way we could do rogue- cabal- and house- diffs in one arm.
:: you want to be able to indicate return type based on map contents...
++ sh-repo-house-diff
::x calculates difference between two shelves (channel definitions).
::
@ -1341,6 +1347,7 @@
++ nick :: %nick
|= {her/(unit ship) nym/(unit cord)}
^+ ..sh-work
::x no arguments
?: ?=({$~ $~} +<)
%+ sh-fact %mor
%+ turn (~(tap by folks))
@ -1349,6 +1356,7 @@
?~ hand.q
"{<p>}:"
"{<p>}: {<u.hand.q>}"
::x unset nickname
?~ nym
?> ?=(^ her)
=+ asc=(~(get by folks) u.her)
@ -1356,6 +1364,7 @@
?~ asc "{<u.her>} unbound"
?~ hand.u.asc "{<u.her>}:"
"{<u.her>}: {<u.hand.u.asc>}"
::x get nickname
?~ her
%+ sh-fact %mor
%+ turn (reverse-folks u.nym)
@ -1394,6 +1403,12 @@
?~(woe ..sh-work work(job u.woe))
::
++ number :: %number
::TODO !!!!!
::TODO mistakes were made. turns out we need multiple shells after all!
::TODO but that seems a bit hacky, surely we can do better than it was?
::TODO ...just storing the telegrams in the order they were printed
:: doesn't seem clean enough though.
::TODO !!!!!
|= num/$@(@ud {p/@u q/@ud})
^+ ..sh-work
=+ roy=(~(got by tales) man.she)
@ -1744,7 +1759,7 @@
=+ txt=(tr-text =(who our.hid))
?: =(~ txt) ""
=+ ^= baw
:: ?: oug
:: ?: oug
:: ~(te-whom te man tr-pals)
?. (~(has in sef) %noob)
(~(sn-curt sn man [who (main who)]) |)
@ -1854,7 +1869,7 @@
$exp (tr-chow 66 '#' ' ' (trip p.sep))
$url =+ ful=(earf p.sep)
?: (gth 64 (lent ful)) ['/' ' ' ful]
:+ '/' '_'
:+ '/' '_'
=+ hok=r.p.p.p.sep
~! hok
=- (swag [a=(sub (max 64 (lent -)) 64) b=64] -)
@ -1891,7 +1906,7 @@
?. ?=({$sole *} pax)
~& [%peer-talk-reader-strange pax]
[~ +>]
::~? (~(has by shells) ost.hid) [%talk-peer-replaced ost.hid pax]
~& [%r-peer-sole ost.hid]
ra-abet:(ra-console:ra src.hid t.pax)
::
::TODO move to lib.
@ -1933,10 +1948,9 @@
++ prep
::x state adapter.
::
|= old/(unit chattel)
ra-abet:ra-init:ra
|= old/*::(unit chattel)
::^- (quip move ..prep)
::?~ old
:: ra-abet:ra-init:ra
ra-abet:ra-init:ra
::[~ ..prep(+<+ u.old)]
--

View File

@ -1,19 +1,27 @@
:: :: ::
:: :: ::
:::: /hoon/talk/app :: ::
:: :: ::
:: :: ::
::
::TODO master changes
::TODO =/ instead of =+ ^= where possible
::TODO avoid lark where possible
::TODO remove old/unused code
::TODO improve naming
::TODO tidiness
::TODO improve naming. way->wir, rad->rep, etc.
::TODO tidiness, remove unnecessary ~&, etc.
::TODO better presence notifications. typing, idle...
::
::TODO crash on pokes/peers we do not expect
::TODO send %names report when a reader first connects
::TODO merge follower groups into followers
::TODO rename cores. ra->ta (transaction), pa->to (story).
::TODO maybe ensure every arm has a mini-description at :57 too?
::TODO maybe prefix all printfs and other errors with %talk?
::
/? 310 :: hoon version
/- talk, sole :: structures
/+ talk, sole, time-to-id, twitter :: libraries
/= seed /~ !>(.)
!:
::
::::
::
@ -24,7 +32,7 @@
++ house ::
$: stories/(map knot story) :: conversations
::TODO rename to readers?
general/(set bone) :: meta-subscribe
general/(set bone) :: our message readers
outbox/(pair @ud (map @ud thought)) :: urbit outbox
log/(map knot @ud) :: logged to clay
folks/(map ship human) :: human identities
@ -70,7 +78,6 @@
$% {$repeat p/@ud q/@p r/knot} ::
{$friend p/knot q/station} ::
== ::
++ glyphs `wall`~[">=+-" "}),." "\"'`^" "$%&@"] :: station char pool'
++ strap |*({k/* v/*} (~(put by *(map _k _v)) k v))
--
|%
@ -128,7 +135,9 @@
q.nb
--
--
::
|_ {hid/bowl house}
::
++ ra :: per transaction
::x gets called when talk gets poked or otherwise prompted/needs to perform
::x an action.
@ -138,9 +147,13 @@
::
::x moves: moves storage, added to by ++ra-emit and -emil, produced by -abed.
|_ moves/(list move)
::
++ ra-abet :: resolve core
::x produces the moves stored in ++ra's moves.
::x sole-effects get special treatment to become a single move.
::TODO this shouldn't ever make sole-effects anymore, so remove that logic.
::TODO instead, we want to squash lowdown %names and %glyphs,
:: but figure out if that'll ever be needed first.
::
^+ [*(list move) +>]
:_ +>
@ -185,6 +198,7 @@
++ ra-init :: initialize talk
::x populate state on first boot. creates our main and public stories.
::
~& %ra-init
%+ roll
^- (list {posture knot cord})
:~ [%brown (main our.hid) 'default home']
@ -356,9 +370,9 @@
:+ %design man
:- ~ :- ~
:- 'letters to the editor'
[%brown ~]
[%brown ~]
%^ ra-consume & our.hid
:^ (shaf %init eny.hid)
:^ (shaf %init eny.hid)
(my [[%& our.hid (main our.hid)] *envelope %pending] ~)
now.hid
[~ %app %tree 'receiving comments, ;join %comments for details']
@ -560,7 +574,6 @@
::
|= {pub/? her/ship tay/partner tip/thought}
^+ +>
:: ~& [%ra-conduct pub her tay]
?- -.tay
$& ?: pub
=. her our.hid :: XX security!
@ -748,7 +761,7 @@
$| ~& tweet-abjure+p.p.tay
!!
::
$& ~& [%pa-abjure [our.hid man] [p.p.tay q.p.tay]]
$& ~& [%pa-abjure /[man]/(scot %p p.p.tay)/[q.p.tay]]
:_ ~
:* %pull
/friend/show/[man]/(scot %p p.p.tay)/[q.p.tay]
@ -761,7 +774,7 @@
::x for each partner, produce a %peer/subscribe move.
::
|= tal/(list partner)
%+ pa-sauce 0
%+ pa-sauce 0 ::x subscription is caused by this app
%- zing
%+ turn tal
|= tay/partner
@ -775,6 +788,7 @@
$| !!
$& :: ~& [%pa-acquire [our.hid man] [p.p.tay q.p.tay]]
:_ ~
~& [%pa-acquire /[man]/(scot %p p.p.tay)/[q.p.tay]]
:* %peer
/friend/show/[man]/(scot %p p.p.tay)/[q.p.tay]
[p.p.tay %talk-guardian]
@ -817,6 +831,7 @@
::x adds tay's loc to our remote presence map, after merging with rem.
::x if this changes anything, send update report.
::
::TODO stop using timed.
|= {tay/partner loc/atlas rem/(map partner atlas)}
::x remove this story from the presence map, since it's in local already.
=. rem (~(del by rem) %& our.hid man) :: superceded by local data
@ -972,7 +987,7 @@
|= {num/@ud gam/telegram}
=+ way=(sub count num)
?: =(gam (snag (dec way) grams))
+>.$ :: no change
+>.$ :: no change
=. grams (welp (scag (dec way) grams) [gam (slag way grams)])
(pa-refresh num gam)
--
@ -982,6 +997,7 @@
::x incoming subscription on pax.
::
|= pax/path
~& [%b-peer pax src.hid ost.hid]
^+ [*(list move) +>]
~? !(team src.hid our.hid) [%peer-talk-stranger src.hid]
ra-abet:(ra-subscribe:ra src.hid pax)
@ -1003,7 +1019,7 @@
|= dup/update
ra-abet:(ra-update:ra src.hid dup)
::
++ diff-talk-report ::
++ diff-talk-report :: accept report
::x incoming talk-report. process it and update logs.
::
|= {way/wire rad/report}
@ -1028,7 +1044,7 @@
|= way/wire
^- weir
?+ -.way !!
$friend
$friend
?> ?=({$show @ @ @ $~} t.way)
[%friend i.t.t.way (slav %p i.t.t.t.way) i.t.t.t.t.way]
::
@ -1070,7 +1086,7 @@
ra-abet:(ra-retry:ra man cuz)
::
++ pull ::
::x unsubscribe. remove from story and shells.
::x unsubscribe.
::
|= pax/path
^+ [*(list move) +>]
@ -1160,8 +1176,8 @@
::x state adapter.
::
|= old/(unit house)
^- (quip move ..prep)
?~ old
::^- (quip move ..prep)
::?~ old
ra-abet:ra-init:ra
[~ ..prep(+<+ u.old)]
::[~ ..prep(+<+ u.old)]
--

View File

@ -1,4 +1,4 @@
::
::
:::: /hoon/talk/sur
!:
|%
@ -35,7 +35,7 @@
++ envelope (pair ? (unit partner)) :: visible sender
++ flavor path :: content flavor
++ human :: human identifier
$: true/(unit (trel @t (unit @t) @t)) :: true name
$: true/(unit (trel @t (unit @t) @t)) ::TODO used? true name
hand/(unit @t) :: handle
== ::
++ passport :: foreign flow
@ -64,6 +64,7 @@
::TODO cabal, or merge its contents into tale's config
:: basically we just want to merge the ship sets, right?
{$tales (map knot (unit config))} :: changed config
::TODO merge remote and local presences.
{$precs (pair knot atlas)} :: changed presence
{$grams (pair knot (pair @ud (list telegram)))} :: new grams
== ::
@ -71,6 +72,10 @@
$% {$lan p/knot q/@t} :: local announce
{$exp p/@t} :: hoon line
{$non $~} :: no content (yo)
::TODO so, this is extensibility tacked on, rather than built-in?
:: really, talk has been two-split but the guardian is still two
:: things at once. you want base-guardian and talk-guardian.
:: ...that's probably what %gall is, but then why do we have $ext?
{$ext p/@tas q/*} :: extended action
{$fat p/torso q/speech} :: attachment
:: {$inv p/station} :: invite to station
@ -78,6 +83,7 @@
{$ire p/serial q/speech} :: in-reply-to
{$lin p/? q/@t} :: no/@ text line
{$mor p/(list speech)} :: multiplex
::TODO? what are p and q supposed to be?
{$app p/@tas q/@t} :: app message
$: $api :: api message
service/@tas :: service name