diff --git a/pkg/garden/app/hark-system-hook.hoon b/pkg/garden/app/hark-system-hook.hoon index de801d2c8e..6510210546 100644 --- a/pkg/garden/app/hark-system-hook.hoon +++ b/pkg/garden/app/hark-system-hook.hoon @@ -2,32 +2,34 @@ /+ verb, dbug, default-agent, agentio |% +$ card card:agent:gall ++$ state-0 [%0 lagging=_|] :: -:: +++ lag-interval ~m10 -- -=< %+ verb & %- agent:dbug ^- agent:gall +=| state-0 +=* state - +=< |_ =bowl:gall +* this . def ~(. (default-agent this %|) bowl) io ~(. agentio bowl) pass pass:io cc ~(. +> bowl) -++ on-init on-init:def -:: +++ on-init + ^- (quip card _this) + :_ this + [onboard watch:kiln check:lag ~]:cc :: ++ on-load |= =vase - :_ this :: TODO: move to on-init - :- onboard:cc - (drop safe-watch:kiln:cc) -++ on-save !>(~) + =+ !<(old=state-0 vase) + `this(state old) :: -++ on-poke - |= [=mark =vase] - !! +++ on-save !>(state) +++ on-poke on-poke:def ++ on-peek on-peek:def ++ on-watch on-watch:def ++ on-agent @@ -59,13 +61,24 @@ == -- :: -++ on-arvo on-arvo:def +++ on-arvo + |= [=wire sign=sign-arvo] + ^- (quip card _this) + ?. ?=([%check-lag ~] wire) (on-arvo:def wire sign) + ?> ?=([%behn %wake *] sign) + =+ .^(lag=? %$ (scry:io %$ /zen/lag)) + ?: =(lagging lag) :_(this ~[check:lag:cc]) + :_ this(lagging lag) + :_ ~[check:lag:cc] + ?:(lagging start:lag:cc stop:lag:cc) +:: ++ on-fail on-fail:def ++ on-leave on-leave:def -- |_ =bowl:gall +* io ~(. agentio bowl) pass pass:io +:: ++ onboard ^- card %- poke:ha @@ -73,7 +86,15 @@ :: We special case this in the grid UI, but should include something :: for third parties [~[text+'Welcome to urbit'] ~ now.bowl / /] - +:: +++ lag + |% + ++ check (~(wait pass /check-lag) (add now.bowl lag-interval)) + ++ place [q.byk.bowl /lag] + ++ body `body:hark`[~[text/'Runtime lagging'] ~ now.bowl / /] + ++ start (poke:ha %add-note [/ place] body) + ++ stop (poke:ha %del-place place) + -- ++ ha |% ++ pass ~(. ^pass /hark) diff --git a/pkg/garden/lib/hark/store.hoon b/pkg/garden/lib/hark/store.hoon index 3bb92c9091..492ecb9892 100644 --- a/pkg/garden/lib/hark/store.hoon +++ b/pkg/garden/lib/hark/store.hoon @@ -24,9 +24,16 @@ %all-stats (all-stats +.upd) ::%read-note (index +.upd) ::%note-read (note-read +.upd) - :: %archive (notif-ref +.upd) + %archive (archive +.upd) == :: + ++ archive + |= [t=(unit @da) b=^bin] + %- pairs + :~ time+?~(t ~ s+(scot %ud u.t)) + bin+(bin b) + == + :: ++ note-read |= * (pairs ~)