From e96b66df40f09b23f16025b77945c774820c6050 Mon Sep 17 00:00:00 2001 From: Hunter Miller Date: Wed, 27 Nov 2024 12:22:34 -0600 Subject: [PATCH 1/8] hooks: updating type names pt1 --- desk/app/channels-server.hoon | 76 +++++++++++------------ desk/gen/hooks/confirm.hoon | 19 ------ desk/gen/hooks/truncate.hoon | 97 ----------------------------- desk/lib/hooks-json.hoon | 32 +++++----- desk/sur/hooks.hoon | 112 ++++++++++++++++++---------------- desk/ted/hook/schedule.hoon | 6 +- 6 files changed, 116 insertions(+), 226 deletions(-) delete mode 100644 desk/gen/hooks/confirm.hoon delete mode 100644 desk/gen/hooks/truncate.hoon diff --git a/desk/app/channels-server.hoon b/desk/app/channels-server.hoon index edf10cdfec..2e5c5dbf57 100644 --- a/desk/app/channels-server.hoon +++ b/desk/app/channels-server.hoon @@ -360,7 +360,7 @@ =/ seq %+ skim seq.action - |= =id:h + |= id=id-hook:h (~(has by hooks.hooks) id) =. order.hooks (~(put by order.hooks) nest.action seq) (give-hook-response %order nest.action seq) @@ -368,8 +368,8 @@ %config ho-abet:(ho-configure:(ho-abed:ho-core id.action) +>.action) :: - %wait - ho-abet:(ho-wait:(ho-abed:ho-core id.action) +>.action) + %cron + ho-abet:(ho-cron:(ho-abed:ho-core id.action) +>.action) :: %rest ho-abet:(ho-rest:(ho-abed:ho-core id.action) origin.action) @@ -1033,7 +1033,7 @@ ^+ cor (give %fact ~[/v0/hooks] hook-response-0+!>(response)) ++ ho-core - |_ [=id:h =hook:h gone=_|] + |_ [id=id-hook:h =hook:h gone=_|] ++ ho-core . ++ emit |=(=card ho-core(cor (^emit card))) ++ emil |=(caz=(list card) ho-core(cor (^emil caz))) @@ -1045,7 +1045,7 @@ == :: ++ ho-abed - |= i=id:h + |= i=id-hook:h ho-core(id i, hook (~(got by hooks.hooks) i)) :: ++ ho-add @@ -1095,15 +1095,15 @@ =. order.hooks %+ roll ~(tap by order.hooks) - |= [[=nest:c ids=(list id:h)] or=(map nest:c (list id:h))] + |= [[=nest:c ids=(list id-hook:h)] or=(map nest:c (list id-hook:h))] =- (~(put by or) nest -) - (skip ids |=(i=id:h =(id i))) - =. delayed.hooks + (skip ids |=(i=id-hook:h =(id i))) + =. waiting.hooks %+ roll - ~(tap by delayed.hooks) - |= [[=delay-id:h d=[* delayed-hook:h]] dh=_delayed.hooks] - ?. =(id hook.d) dh - (~(del by dh) delay-id) + ~(tap by waiting.hooks) + |= [[=id-wait:h d=[* waiting-hook:h]] wh=_waiting.hooks] + ?. =(id hook.d) wh + (~(del by wh) id-wait) =. cor (give-hook-response [%gone id]) ho-core ++ ho-configure @@ -1112,7 +1112,7 @@ =. config.hook (~(put by config.hook) nest config) =. cor (give-hook-response [%config id nest config]) ho-core - ++ ho-wait + ++ ho-cron |= [=origin:h schedule=$@(@dr schedule:h) =config:h] ^+ ho-core =/ schedule @@ -1124,7 +1124,7 @@ =- (~(put by crons.hooks) id.hook -) (~(put by crons) origin cron) =. cor (schedule-cron origin cron) - =. cor (give-hook-response [%wait id origin schedule config]) + =. cor (give-hook-response [%cron id origin schedule config]) ho-core ++ ho-rest |= =origin:h @@ -1177,27 +1177,27 @@ =. hooks.hooks (~(put by hooks.hooks) i.order hook(state new-state.u.return)) ?: ?=(%denied -.result) [|+~[(fall msg.result default)] effects] - =. current-event new.result + =. current-event event.result next ++ wakeup-hook |= =(pole knot) ^+ cor ?+ pole ~|(bad-arvo-take/pole !!) - [%delayed id=@ ~] - =/ =id:h (slav %uv id.pole) - ?~ delay=(~(get by delayed.hooks) id) cor + [%waiting id=@ ~] + =/ id=id-hook:h (slav %uv id.pole) + ?~ wh=(~(get by waiting.hooks) id) cor :: make sure we clean up - =. delayed.hooks (~(del by delayed.hooks) id) + =. waiting.hooks (~(del by waiting.hooks) id) :: ignore premature fires - ?: (lth now.bowl fires-at.u.delay) cor - =* origin origin.u.delay - =/ hook (~(got by hooks.hooks) hook.u.delay) + ?: (lth now.bowl fires-at.u.wh) cor + =* origin origin.u.wh + =/ hook (~(got by hooks.hooks) hook.u.wh) =/ config ?@(origin ~ (~(gut by config.hook) origin ~)) - =/ args [[%wake +.u.delay] "delayed hook" origin config] - ho-abet:(ho-run-single:(ho-abed:ho-core hook.u.delay) args) + =/ args [[%wake +.u.wh] "waiting hook" origin config] + ho-abet:(ho-run-single:(ho-abed:ho-core hook.u.wh) args) :: [%cron id=@ kind=?(%chat %diary %heap) ship=@ name=@ ~] - =/ =id:h (slav %uv id.pole) + =/ id=id-hook:h (slav %uv id.pole) =/ =origin:h [kind.pole (slav %p ship.pole) name.pole] :: if unscheduled, ignore ?~ crons=(~(get by crons.hooks) id) cor @@ -1235,15 +1235,15 @@ ?@ origin ~ /[kind.origin]/(scot %p ship.origin)/[name.origin] (emit [%pass wire %arvo %b %rest next.schedule.cron]) -++ schedule-delay - |= dh=delayed-hook:h - =/ =wire /hooks/delayed/(scot %uv id.dh) - (emit [%pass wire %arvo %b %wait fires-at.dh]) -++ unschedule-delay - |= =id:h +++ schedule-waiting + |= wh=waiting-hook:h + =/ =wire /hooks/waiting/(scot %uv id.wh) + (emit [%pass wire %arvo %b %wait fires-at.wh]) +++ unschedule-waiting + |= id=id-hook:h ^+ cor - ?~ previous=(~(get by delayed.hooks) id) cor - =/ =wire /hooks/delayed/(scot %uv id.u.previous) + ?~ previous=(~(get by waiting.hooks) id) cor + =/ =wire /hooks/waiting/(scot %uv id.u.previous) (emit [%pass wire %arvo %b %rest fires-at.u.previous]) ++ run-hook-effects |= [effects=(list effect:h) =origin:h] @@ -1281,10 +1281,10 @@ (emit [%pass /hooks/effect %agent [our.bowl %contacts] %poke cage]) :: %wait - =/ =wire /hooks/delayed/(scot %uv id.effect) - =. cor (unschedule-delay id.effect) - =. delayed.hooks - (~(put by delayed.hooks) id.effect [origin +.effect]) - (schedule-delay +.effect) + =/ =wire /hooks/waiting/(scot %uv id.effect) + =. cor (unschedule-waiting id.effect) + =. waiting.hooks + (~(put by waiting.hooks) id.effect [origin +.effect]) + (schedule-waiting +.effect) == -- diff --git a/desk/gen/hooks/confirm.hoon b/desk/gen/hooks/confirm.hoon deleted file mode 100644 index ea6c1f228c..0000000000 --- a/desk/gen/hooks/confirm.hoon +++ /dev/null @@ -1,19 +0,0 @@ -/- h=hooks, c=channels -:- %say -|= $: [now=@da eny=@uvJ =beak] - [[=event:h =context:h ~] ~] - == -:- %noun -^- outcome:h -=- &+[[[%allowed event] -] state.hook.context] -^- (list effect:h) -?. ?=(?(%delay %on-post) -.event) ~ -?: ?=(%delay -.event) - =/ =nest:c [%chat ~bospur-davmyl-nocsyx-lassul %welcome-8458] - =+ !<(trigger=event:h data.event) - ?. ?=([%on-post %add *] trigger) ~ - =* post post.trigger - =/ =c-react:c [%add-react id.post author.post ':thumbs-up:'] - ~[[%channels %channel nest %post c-react]] -=/ id (rsh [3 48] eny.context) -~[[%delay id id.hook.context ~s30 !>(event)]] \ No newline at end of file diff --git a/desk/gen/hooks/truncate.hoon b/desk/gen/hooks/truncate.hoon deleted file mode 100644 index 538738a432..0000000000 --- a/desk/gen/hooks/truncate.hoon +++ /dev/null @@ -1,97 +0,0 @@ -/- h=hooks, c=channels -:- %say -|= $: [now=@da eny=@uvJ =beak] - [[=event:h ~] ~] - == -:- %noun -^- outcome:h -=| count=@ud -=/ max 140 -=/ new-content=story:c ~ -=* no-op &+[[[%allowed event] ~] !>(~)] -?. ?=(%on-post -.event) no-op -=* on-post +.event -?. ?=(?(%add %edit) -.on-post) no-op -=/ verses - ?- -.on-post - %add content.essay.post.on-post - %edit content.essay.on-post - == -|^ -:: made it to the end -=* return - =- &+[[[%allowed -] ~] !>(~)] - ?- event - [%on-post %add *] event(content.essay.post new-content) - [%on-post %edit *] event(content.essay new-content) - == -?~ verses return -?: (gte count max) return -=* next $(verses t.verses) -=/ verse i.verses -:: remove blocks -?: ?=(%block -.verse) next -=/ [new-inlines=(list inline:c) new-count=@ud] - (run-list p.verse count) -$(new-content (snoc new-content [%inline new-inlines]), verses t.verses, count new-count) -++ run-list - |= [inlines=(list inline:c) count=@ud] - ^- [(list inline:c) @ud] - =/ new-inlines=(list inline:c) ~ - |- - ?~ inlines - :: made it all the way through - [new-inlines count] - =* next $(inlines t.inlines) - =/ inline i.inlines - ?: (gte count max) - [new-inlines count] - ?@ inline - =/ new-string (trim-cord inline count) - ?~ new-string $(inlines ~) ::done - $(new-inlines (snoc new-inlines u.new-string), inlines t.inlines, count (add count (met 3 u.new-string))) - =/ [new-inline=(unit inline:c) new-count=@ud] - (run-special-inlines inline count) - ?~ new-inline $(inlines ~) ::done - $(new-inlines (snoc new-inlines u.new-inline), inlines t.inlines, count new-count) -++ run-special-inlines - |= [=inline:c count=@ud] - ^- [(unit inline:c) @ud] - ?+ -.inline [~ count] - %break [`inline +(count)] - :: - %ship - ?: (gth (add count 14) max) [~ count] - [`inline (add count 14)] - :: - %link - =/ new-string=(unit cord) (trim-cord q.inline count) - ?~ new-string [~ count] - =/ new-inline=inline:c inline(q u.new-string) - [(some new-inline) (add count (met 3 u.new-string))] - :: - %inline-code - =/ new-string=(unit cord) (trim-cord p.inline count) - ?~ new-string [~ count] - [(some inline(p u.new-string)) (add count (met 3 u.new-string))] - :: - ?(%italics %bold %strike %blockquote) - =/ [new-inlines=(list inline:c) new-count=@ud] (run-list p.inline count) - ?~ new-inlines [~ count] - [(some inline(p new-inlines)) new-count] - == -++ trim-cord - |= [=cord count=@ud] - ^- (unit ^cord) - =/ string (trip cord) - =/ length (lent string) - =/ total (add length count) - ?: (gth total max) - :: truncate - =/ remainder (sub total max) - :: no room for anything - ?: =(length remainder) ~ - =/ new-length (sub length remainder) - `(crip (scag new-length string)) - `cord --- \ No newline at end of file diff --git a/desk/lib/hooks-json.hoon b/desk/lib/hooks-json.hoon index ece631a223..3af6644113 100644 --- a/desk/lib/hooks-json.hoon +++ b/desk/lib/hooks-json.hoon @@ -6,7 +6,7 @@ =, enjs:format |% ++ id - |= i=id:h + |= i=id-hook:h s+(scot %uv i) ++ hooks |= hks=hooks:h @@ -17,11 +17,11 @@ == :: ++ hook-map - |= hks=(map id:h hook:h) + |= hks=(map id-hook:h hook:h) %- pairs %+ turn ~(tap by hks) - |= [=id:h hk=hook:h] + |= [id=id-hook:h hk=hook:h] [(scot %uv id) (hook hk)] :: ++ hook @@ -51,18 +51,18 @@ |= [key=@t noun=*] [key s+(scot %uw `@uw`(jam noun))] ++ order - |= ord=(map nest:c (list id:h)) + |= ord=(map nest:c (list id-hook:h)) %- pairs %+ turn ~(tap by ord) - |= [=nest:c seq=(list id:h)] + |= [=nest:c seq=(list id-hook:h)] [(nest-cord:enjs:cj nest) a+(turn seq id)] ++ crons - |= crs=(map id:h (map origin:h cron:h)) + |= crs=(map id-hook:h (map origin:h cron:h)) %- pairs %+ turn ~(tap by crs) - |= [=id:h cr=(map origin:h cron:h)] + |= [id=id-hook:h cr=(map origin:h cron:h)] [(scot %uv id) (cron-map cr)] ++ cron-map |= cr=(map origin:h cron:h) @@ -93,11 +93,11 @@ %gone (id id.r) %order (order-rsp +.r) %config (config-rsp +.r) - %wait (wait-rsp +.r) + %cron (cron-rsp +.r) %rest (rest-rsp +.r) == ++ set-rsp - |= [i=id:h name=@t src=@t meta=data:m error=(unit ^tang)] + |= [i=id-hook:h name=@t src=@t meta=data:m error=(unit ^tang)] %- pairs :~ id+(id i) name+s+name @@ -106,20 +106,20 @@ error+?~(error ~ (tang u.error)) == ++ order-rsp - |= [=nest:c seq=(list id:h)] + |= [=nest:c seq=(list id-hook:h)] %- pairs :~ nest+(nest:enjs:cj nest) seq+a+(turn seq id) == ++ config-rsp - |= [i=id:h =nest:c con=config:h] + |= [i=id-hook:h =nest:c con=config:h] %- pairs :~ id+(id i) nest+(nest:enjs:cj nest) config+(config con) == - ++ wait-rsp - |= [i=id:h or=origin:h sch=$@(@dr schedule:h) con=config:h] + ++ cron-rsp + |= [i=id-hook:h or=origin:h sch=$@(@dr schedule:h) con=config:h] %- pairs :~ id+(id i) origin+s+?~(or 'global' (nest-cord:enjs:cj or)) @@ -127,7 +127,7 @@ config+(config con) == ++ rest-rsp - |= [i=id:h or=origin:h] + |= [i=id-hook:h or=origin:h] %- pairs :~ id+(id i) origin+s+?~(or 'global' (nest-cord:enjs:cj or)) @@ -154,7 +154,7 @@ del/id order/order config/config - wait/wait + cron/cron rest/rest == ++ add @@ -186,7 +186,7 @@ ++ origin |= j=json ?~(j ~ (nest:dejs:cj j)) - ++ wait + ++ cron %- ot :~ id/id origin/origin diff --git a/desk/sur/hooks.hoon b/desk/sur/hooks.hoon index 984c08f4d1..e3f0b97119 100644 --- a/desk/sur/hooks.hoon +++ b/desk/sur/hooks.hoon @@ -1,20 +1,22 @@ /- *channels, g=groups, a=activity, ch=chat, co=contacts, m=meta |% -:: $id: a unique identifier for a hook -+$ id @uv +:: $id-hook: a unique identifier for a hook ++$ id-hook @uv :: -:: $hook: a pure function that runs on triggers in a channel +:: $hook: a function that runs on triggers in a channel, can produce +:: effects, and change its own state :: -:: $id: a unique identifier for the hook -:: $name: a human-readable name for the hook -:: $version: the version the hook was compiled with -:: $src: the source code of the hook -:: $compiled: the compiled version of the hook -:: $state: the current state of the hook -:: $config: any configuration data for the hook +:: .id: a unique identifier for the hook +:: .name: a human-readable name for the hook +:: .version: the version the hook was compiled with +:: .src: the source code of the hook +:: .compiled: the compiled hook +:: .state: the current state of the hook +:: .config: any configuration data for the instance of the hook +:: running on a channel :: ++ hook - $: =id + $: id=id-hook version=%0 name=@t meta=data:m @@ -23,60 +25,64 @@ state=vase config=(map nest config) == -:: $hooks: collection of hooks, the order they should be run in, and -:: any delayed hooks that need to be run +:: $hooks: collection of hooks, the order they should be run in, hooks +:: running on a schedule, and any hooks waiting to run ++ hooks - $: hooks=(map id hook) - order=(map nest (list id)) - crons=(map id (map origin cron)) - delayed=(map delay-id [=origin delayed-hook]) + $: hooks=(map id-hook hook) + order=(map nest (list id-hook)) + crons=(map id-hook (map origin cron)) + waiting=(map id-wait [=origin waiting-hook]) == +$ origin $@(~ nest) -+$ delay-id id -+$ schedule [next=@da repeat=@dr] +$ cron - $: hook=id + $: hook=id-hook =schedule =config == -:: $delayed-hook: metadata for when a delayed hook fires from the timer -+$ delayed-hook - $: id=delay-id - hook=id ++$ schedule [next=@da repeat=@dr] ++$ id-wait @uv +:: $waiting-hook: metadata for when a waiting hook fires from the timer ++$ waiting-hook + $: id=id-wait + hook=id-hook data=vase fires-at=time == -:: +:: $config: configuration data for a hook instance +$ config (map @t *) +:: +:: $action: what we can do with a hook +$ action $% [%add name=@t src=@t] - [%edit =id name=(unit @t) src=(unit @t) meta=(unit data:m)] - [%del =id] - [%order =nest seq=(list id)] - [%config =id =nest =config] - [%wait =id =origin schedule=$@(@dr schedule) =config] - [%rest =id =origin] + [%edit id=id-hook name=(unit @t) src=(unit @t) meta=(unit data:m)] + [%del id=id-hook] + [%order =nest seq=(list id-hook)] + [%config id=id-hook =nest =config] + [%cron id=id-hook =origin schedule=$@(@dr schedule) =config] + [%rest id=id-hook =origin] == +:: +:: $response: the result of an action on a hook +$ response - $% [%set =id name=@t src=@t meta=data:m error=(unit tang)] - [%gone =id] - [%order =nest seq=(list id)] - [%config =id =nest =config] - [%wait =id =origin schedule=$@(@dr schedule) =config] - [%rest =id =origin] + $% [%set id=id-hook name=@t src=@t meta=data:m error=(unit tang)] + [%gone id=id-hook] + [%order =nest seq=(list id-hook)] + [%config id=id-hook =nest =config] + [%cron id=id-hook =origin schedule=$@(@dr schedule) =config] + [%rest id=id-hook =origin] == :: $context: ambient state that a hook should know about not :: necessarily tied to a specific event :: -:: $channel: the channel that the hook is operating on -:: $group: the group that the channel belongs to -:: $channels: all the channels in the group -:: $hook: the hook that's running -:: $config: the configuration data for this instance of the hook -:: $now: the current time -:: $our: the ship that the hook is running on -:: $src: the ship that triggered the hook -:: $eny: entropy for random number generation or key derivation +:: .channel: the channel that the hook is operating on +:: .group: the group that the channel belongs to +:: .channels: all the channels in the group +:: .hook: the hook that's running +:: .config: the configuration data for this instance of the hook +:: .now: the current time +:: .our: the ship that the hook is running on +:: .src: the ship that triggered the hook +:: .eny: entropy for random number generation or key derivation :: +$ context $: channel=(unit [=nest v-channel]) @@ -102,7 +108,7 @@ $% [%on-post on-post] [%on-reply on-reply] [%cron ~] - [%wake delayed-hook] + [%wake waiting-hook] == :: :: $on-post: a hook event that fires when posts are interacted with @@ -133,17 +139,17 @@ :: :: $result: whether the action was allowed or denied and any :: transformed values -:: $actions: any actions that should be taken on other agents or delay +:: $effects: any actions that should be taken on other agents or wait :: $new-state: the new state of the hook after running :: +$ return - $: $: =result + $: $: result=event-result effects=(list effect) == new-state=vase == :: -:: $result: whether to allow the action, and any transformations to +:: $event-result: whether to allow the action, and any transformations to :: the event :: :: $allowed: represents the action being allowed to go through, and @@ -151,8 +157,8 @@ :: $denied: represents the action being denied along with the reason :: that the action was denied :: -+$ result - $% [%allowed new=event] ++$ event-result + $% [%allowed =event] [%denied msg=(unit cord)] == :: @@ -166,7 +172,7 @@ [%dm =action:dm:ch] [%club =action:club:ch] [%contacts =action:co] - [%wait delayed-hook] + [%wait waiting-hook] == :: -- \ No newline at end of file diff --git a/desk/ted/hook/schedule.hoon b/desk/ted/hook/schedule.hoon index be3a15225a..863f28758e 100644 --- a/desk/ted/hook/schedule.hoon +++ b/desk/ted/hook/schedule.hoon @@ -14,12 +14,12 @@ !> ^- action:h ?: ?=(%stop -.action) [%rest id origin] - [%wait id origin +.action] + [%cron id origin +.action] ;< ~ bind:m (poke-our:s %channels-server cage) ;< =^cage bind:m (take-fact:s /responses) ?> ?=(%hook-response-0 p.cage) =+ !<(=response:h q.cage) -?> ?=(?(%wait %rest) -.response) +?> ?=(?(%cron %rest) -.response) ?: ?=(%rest -.response) %- (slog (crip "stopped scheduled hook {} running on {}") ~) (pure:m !>(~)) @@ -33,4 +33,4 @@ $% [%stop ~] [%start schedule=$@(@dr schedule:h) =config:h] == --- \ No newline at end of file +-- From ea6ba9ff604508799d52eb3bb76ee67cdf00c889 Mon Sep 17 00:00:00 2001 From: Hunter Miller Date: Wed, 27 Nov 2024 16:03:44 -0600 Subject: [PATCH 2/8] hooks: syntax cleanup --- desk/app/channels-server.hoon | 98 ++++++++++++++--------------------- desk/lib/hooks-json.hoon | 2 +- desk/sur/hooks.hoon | 2 +- desk/ted/hook/add.hoon | 2 +- desk/ted/hook/configure.hoon | 2 +- desk/ted/hook/del.hoon | 2 +- desk/ted/hook/edit.hoon | 2 +- desk/ted/hook/order.hoon | 2 +- 8 files changed, 47 insertions(+), 65 deletions(-) diff --git a/desk/app/channels-server.hoon b/desk/app/channels-server.hoon index 2e5c5dbf57..7b0a9c1c40 100644 --- a/desk/app/channels-server.hoon +++ b/desk/app/channels-server.hoon @@ -360,10 +360,10 @@ =/ seq %+ skim seq.action - |= id=id-hook:h - (~(has by hooks.hooks) id) + ~(has by hooks.hooks) =. order.hooks (~(put by order.hooks) nest.action seq) - (give-hook-response %order nest.action seq) + =/ =response:h [%order nest.action seq] + (give %fact ~[/v0/hooks] hook-response-0+!>(response)) :: %config ho-abet:(ho-configure:(ho-abed:ho-core id.action) +>.action) @@ -542,7 +542,7 @@ ^+ cor ?+ pole ~|(bad-arvo-take/pole !!) [%hooks rest=*] - (wakeup-hook rest.pole) + (wake-hook rest.pole) == :: ++ watch-groups (safe-watch /groups [our.bowl %groups] /groups) @@ -725,7 +725,6 @@ %post =^ update=(unit u-channel:c) ca-core (ca-c-post c-post.c-channel) - ~& "received post update {}" ?~ update ca-core (ca-update u.update) == @@ -734,11 +733,9 @@ |= =c-post:c ^- [(unit u-channel:c) _ca-core] ?> (can-write:ca-perms src.bowl writers.perm.perm.channel) - ~& "running post command" =* no-op `ca-core ?- -.c-post %add - ~& "adding post" ?> |(=(src.bowl our.bowl) =(src.bowl author.essay.c-post)) ?> =(kind.nest -.kind-data.essay.c-post) =/ id=id-post:c @@ -749,7 +746,6 @@ =/ new=v-post:c [[id ~ ~] 0 essay.c-post] =^ result=(each event:h tang) cor =/ =event:h [%on-post %add new] - ~& "running post hooks" (run-hooks event nest 'post blocked') ?: ?=(%.n -.result) ((slog p.result) [~ ca-core]) @@ -803,17 +799,16 @@ (run-hooks event nest 'react action blocked') ?: ?=(%.n -.result) ((slog p.result) no-op) - =/ new=c-post:c + =/ new=$>(?(%add-react %del-react) c-post:c) ?> ?=([%on-post %react *] p.result) - ?~ react.p.result [%del-react id.c-post ship.p.result] + ?~ react.p.result + [%del-react id.c-post ship.p.result] [%add-react id.c-post [ship u.react]:p.result] =/ [update=? reacts=v-reacts:c] - %+ ca-c-react reacts.u.u.post - ?>(?=(?(%add-react %del-react) -.new) new) + (ca-c-react reacts.u.u.post new) ?. update no-op :- `[%post id.c-post %reacts reacts] - %= ca-core - posts.channel + %= ca-core posts.channel (put:on-v-posts:c posts.channel id.c-post ~ u.u.post(reacts reacts)) == :: @@ -825,8 +820,7 @@ (ca-c-reply u.u.post c-reply.c-post) ?~ update no-op :- `[%post id.c-post u.update] - %= ca-core - posts.channel + %= ca-core posts.channel (put:on-v-posts:c posts.channel id.c-post ~ u.u.post) == == @@ -899,13 +893,12 @@ (run-hooks event nest 'delete blocked') ?: ?=(%.n -.result) ((slog p.result) [~ replies]) - =/ new=c-reply:c + =/ new=$>(?(%add-react %del-react) c-reply:c) ?> ?=([%on-reply %react *] p.result) ?~ react.p.result [%del-react id.c-reply ship.p.result] [%add-react id.c-reply [ship u.react]:p.result] =/ [update=? reacts=v-reacts:c] - %+ ca-c-react reacts.u.u.reply - ?>(?=(?(%add-react %del-react) -.new) new) + (ca-c-react reacts.u.u.reply new) ?. update `replies :- `[%reply id.c-reply %reacts reacts] (put:on-v-replies:c replies id.c-reply ~ u.u.reply(reacts reacts)) @@ -1028,10 +1021,6 @@ [now our src eny]:bowl == :: -++ give-hook-response - |= =response:h - ^+ cor - (give %fact ~[/v0/hooks] hook-response-0+!>(response)) ++ ho-core |_ [id=id-hook:h =hook:h gone=_|] ++ ho-core . @@ -1061,28 +1050,22 @@ ((slog 'compilation result:' p.result) ~) `p.result =. hook [id %0 name *data:m src compiled !>(~) ~] - =. cor - =/ error=(unit tang) - ?:(?=(%& -.result) ~ `p.result) - (give-hook-response [%set id name src meta.hook error]) - ho-core + =/ error=(unit tang) + ?:(?=(%& -.result) ~ `p.result) + (ho-give-response [%set id name src meta.hook error]) ++ ho-edit |= [name=(unit @t) src=(unit @t) meta=(unit data:m)] =? src.hook ?=(^ src) u.src =/ result=(each vase tang) (compile:utils src.hook) ?: ?=(%| -.result) - =. cor - %- give-hook-response - [%set id name.hook src.hook meta.hook `p.result] - ho-core + %- ho-give-response + [%set id name.hook src.hook meta.hook `p.result] =? name.hook ?=(^ name) u.name =? meta.hook ?=(^ meta) u.meta =. compiled.hook `p.result - =. cor - %- give-hook-response - [%set id name.hook src.hook meta.hook ~] - ho-core + %- ho-give-response + [%set id name.hook src.hook meta.hook ~] :: ++ ho-del =. gone & @@ -1101,31 +1084,28 @@ =. waiting.hooks %+ roll ~(tap by waiting.hooks) - |= [[=id-wait:h d=[* waiting-hook:h]] wh=_waiting.hooks] - ?. =(id hook.d) wh + |= [[=id-wait:h w=[* waiting-hook:h]] wh=_waiting.hooks] + ?. =(id hook.w) wh (~(del by wh) id-wait) - =. cor (give-hook-response [%gone id]) - ho-core + (ho-give-response [%gone id]) ++ ho-configure |= [=nest:c =config:h] ^+ ho-core =. config.hook (~(put by config.hook) nest config) - =. cor (give-hook-response [%config id nest config]) - ho-core + (ho-give-response [%config id nest config]) ++ ho-cron |= [=origin:h schedule=$@(@dr schedule:h) =config:h] ^+ ho-core - =/ schedule - ?: ?=(@ schedule) [now.bowl schedule] - schedule + =? schedule ?=(@ schedule) + [now.bowl schedule] + ?> ?=(^ schedule) =/ crons (~(gut by crons.hooks) id *(map origin:h cron:h)) =/ =cron:h [id schedule config] =. crons.hooks =- (~(put by crons.hooks) id.hook -) (~(put by crons) origin cron) =. cor (schedule-cron origin cron) - =. cor (give-hook-response [%cron id origin schedule config]) - ho-core + (ho-give-response [%cron id origin schedule config]) ++ ho-rest |= =origin:h ^+ ho-core @@ -1134,8 +1114,7 @@ =. crons.hooks (~(put by crons.hooks) id (~(del by crons) origin)) =. cor (unschedule-cron origin cron) - =. cor (give-hook-response [%rest id origin]) - ho-core + (ho-give-response [%rest id origin]) ++ ho-run-single |= [=event:h prefix=tape =origin:h =config:h] =/ channel @@ -1152,37 +1131,39 @@ =. hook hook(state new-state.u.return) =. cor (run-hook-effects effects.u.return origin) ho-core + ++ ho-give-response + |= =response:h + (give %fact ~[/v0/hooks] hook-response-0+!>(response)) -- ++ run-hooks |= [=event:h =nest:c default=cord] ^- [(each event:h tang) _cor] =; [result=(each event:h tang) effects=(list effect:h)] [result (run-hook-effects effects nest)] - =/ current-event event =| effects=(list effect:h) =/ order (~(got by order.hooks) nest) =/ channel `[nest (~(got by v-channels) nest)] =/ =context:h (get-hook-context channel *config:h) |- ?~ order - [&+current-event effects] + [&+event effects] =* next $(order t.order) =/ hook (~(got by hooks.hooks) i.order) =/ ctx context(hook hook, config (~(gut by config.hook) nest ~)) =/ return=(unit return:h) - (run-hook:utils [current-event ctx] hook) + (run-hook:utils [event ctx] hook) ?~ return next =* result result.u.return =. effects (weld effects effects.u.return) =. hooks.hooks (~(put by hooks.hooks) i.order hook(state new-state.u.return)) ?: ?=(%denied -.result) [|+~[(fall msg.result default)] effects] - =. current-event event.result + =. event event.result next -++ wakeup-hook +++ wake-hook |= =(pole knot) ^+ cor - ?+ pole ~|(bad-arvo-take/pole !!) + ?+ pole ~|(bad-arvo-take+pole !!) [%waiting id=@ ~] =/ id=id-hook:h (slav %uv id.pole) ?~ wh=(~(get by waiting.hooks) id) cor @@ -1205,6 +1186,7 @@ :: ignore premature fires ?: (lth now.bowl next.schedule.u.cron) cor =. next.schedule.u.cron + :: :: we don't want to run the cron for every iteration it would :: have run 'offline', so we check here to make sure that the :: next fire time is in the future @@ -1218,20 +1200,20 @@ =. cor (schedule-cron origin u.cron) =/ args [[%cron ~] "cron job" origin config.u.cron] - ho-abet:(ho-run-single:(ho-abed:ho-core hook.u.cron) args) + ho-abet:(ho-run-single:(ho-abed:ho-core id-hook.u.cron) args) == ++ schedule-cron |= [=origin:h =cron:h] ^+ cor =/ wire - %+ welp /hooks/cron/(scot %uv hook.cron) + %+ welp /hooks/cron/(scot %uv id-hook.cron) ?@ origin ~ /[kind.origin]/(scot %p ship.origin)/[name.origin] (emit [%pass wire %arvo %b %wait next.schedule.cron]) ++ unschedule-cron |= [=origin:h =cron:h] =/ wire - %+ welp /hooks/cron/(scot %uv hook.cron) + %+ welp /hooks/cron/(scot %uv id-hook.cron) ?@ origin ~ /[kind.origin]/(scot %p ship.origin)/[name.origin] (emit [%pass wire %arvo %b %rest next.schedule.cron]) diff --git a/desk/lib/hooks-json.hoon b/desk/lib/hooks-json.hoon index 3af6644113..51868d233f 100644 --- a/desk/lib/hooks-json.hoon +++ b/desk/lib/hooks-json.hoon @@ -75,7 +75,7 @@ ++ cron |= crn=cron:h %- pairs - :~ hook+(id hook.crn) + :~ hook+(id id-hook.crn) schedule+(schedule schedule.crn) config+(config config.crn) == diff --git a/desk/sur/hooks.hoon b/desk/sur/hooks.hoon index e3f0b97119..178ddcc980 100644 --- a/desk/sur/hooks.hoon +++ b/desk/sur/hooks.hoon @@ -35,7 +35,7 @@ == +$ origin $@(~ nest) +$ cron - $: hook=id-hook + $: =id-hook =schedule =config == diff --git a/desk/ted/hook/add.hoon b/desk/ted/hook/add.hoon index 2e66c7b2ed..b743a0ff85 100644 --- a/desk/ted/hook/add.hoon +++ b/desk/ted/hook/add.hoon @@ -17,4 +17,4 @@ %- (slog (crip "hook {} added with id {}") ~) ?~ error.response (pure:m !>(~)) %- (slog 'compilation error:' u.error.response) -(pure:m !>(~)) \ No newline at end of file +(pure:m !>(~)) diff --git a/desk/ted/hook/configure.hoon b/desk/ted/hook/configure.hoon index 20927f9f85..574666a24f 100644 --- a/desk/ted/hook/configure.hoon +++ b/desk/ted/hook/configure.hoon @@ -15,4 +15,4 @@ =+ !<(=response:h q.cage) ?> ?=(%config -.response) %- (slog (crip "hook {} running on {} configured") ~) -(pure:m !>(~)) \ No newline at end of file +(pure:m !>(~)) diff --git a/desk/ted/hook/del.hoon b/desk/ted/hook/del.hoon index b955c86621..04d5cbafad 100644 --- a/desk/ted/hook/del.hoon +++ b/desk/ted/hook/del.hoon @@ -16,4 +16,4 @@ ?> ?=(%gone -.response) ?> =(id id.response) %- (slog (crip "hook {} deleted") ~) -(pure:m !>(~)) \ No newline at end of file +(pure:m !>(~)) diff --git a/desk/ted/hook/edit.hoon b/desk/ted/hook/edit.hoon index 04fbbdc369..dd3b7e6eb2 100644 --- a/desk/ted/hook/edit.hoon +++ b/desk/ted/hook/edit.hoon @@ -19,4 +19,4 @@ (pure:m !>(~)) %- (slog (crip "hook {} edited") ~) %- (slog 'compilation error:' u.error.response) -(pure:m !>(~)) \ No newline at end of file +(pure:m !>(~)) diff --git a/desk/ted/hook/order.hoon b/desk/ted/hook/order.hoon index d31736f891..7f44547200 100644 --- a/desk/ted/hook/order.hoon +++ b/desk/ted/hook/order.hoon @@ -16,4 +16,4 @@ ?> ?=(%order -.response) %- (slog (crip "new hook order for {}") ~) ~& seq.response -(pure:m !>(~)) \ No newline at end of file +(pure:m !>(~)) From 14b6e27a9e6ae71dfc5623221575074a2cead439 Mon Sep 17 00:00:00 2001 From: Hunter Miller Date: Wed, 27 Nov 2024 16:06:31 -0600 Subject: [PATCH 3/8] hooks: missing newline EOF --- desk/sur/hooks.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desk/sur/hooks.hoon b/desk/sur/hooks.hoon index 178ddcc980..3f2af394c8 100644 --- a/desk/sur/hooks.hoon +++ b/desk/sur/hooks.hoon @@ -175,4 +175,4 @@ [%wait waiting-hook] == :: --- \ No newline at end of file +-- From ba8f6940fdef0b2c6c1eea60d9ac893791afdc53 Mon Sep 17 00:00:00 2001 From: Hunter Miller Date: Mon, 2 Dec 2024 11:10:07 -0600 Subject: [PATCH 4/8] hooks: cron renaming --- desk/app/channels-server.hoon | 60 +++++++++++++++++------------------ desk/lib/channel-utils.hoon | 4 +-- desk/lib/hooks-json.hoon | 24 +++++++------- desk/sur/hooks.hoon | 17 +++++----- 4 files changed, 53 insertions(+), 52 deletions(-) diff --git a/desk/app/channels-server.hoon b/desk/app/channels-server.hoon index 7b0a9c1c40..2dcb961045 100644 --- a/desk/app/channels-server.hoon +++ b/desk/app/channels-server.hoon @@ -1002,9 +1002,9 @@ %+ welp /(scot %p our.bowl)/[dude]/(scot %da now.bowl) path -++ get-hook-context +++ get-hook-bowl |= [channel=(unit [nest:c v-channel:c]) =config:h] - ^- context:h + ^- bowl:h =/ group ?~ channel ~ =* flag group.perm.perm.+.u.channel @@ -1071,9 +1071,9 @@ =. gone & =. cor %+ roll - ~(tap by (~(gut by crons.hooks) id *(map origin:h cron:h))) - |= [[=origin:h =cron:h] cr=_cor] - (unschedule-cron:cr origin cron) + ~(tap by (~(gut by crons.hooks) id *cron:h)) + |= [[=origin:h =job:h] cr=_cor] + (unschedule-cron:cr origin job) =. crons.hooks (~(del by crons.hooks) id) =. order.hooks %+ roll @@ -1099,12 +1099,12 @@ =? schedule ?=(@ schedule) [now.bowl schedule] ?> ?=(^ schedule) - =/ crons (~(gut by crons.hooks) id *(map origin:h cron:h)) - =/ =cron:h [id schedule config] + =/ crons (~(gut by crons.hooks) id *cron:h) + =/ =job:h [id schedule config] =. crons.hooks =- (~(put by crons.hooks) id.hook -) - (~(put by crons) origin cron) - =. cor (schedule-cron origin cron) + (~(put by crons) origin job) + =. cor (schedule-cron origin job) (ho-give-response [%cron id origin schedule config]) ++ ho-rest |= =origin:h @@ -1121,9 +1121,9 @@ ?@ origin ~ ?~ ch=(~(get by v-channels) origin) ~ `[origin u.ch] - =/ =context:h (get-hook-context channel config) + =/ =bowl:h (get-hook-bowl channel config) =/ return=(unit return:h) - (run-hook:utils [event context(hook hook)] hook) + (run-hook:utils [event bowl(hook hook)] hook) ?~ return %- (slog (crip "{prefix} {} failed, running on {}") ~) ho-core @@ -1143,15 +1143,15 @@ =| effects=(list effect:h) =/ order (~(got by order.hooks) nest) =/ channel `[nest (~(got by v-channels) nest)] - =/ =context:h (get-hook-context channel *config:h) + =/ =bowl:h (get-hook-bowl channel *config:h) |- ?~ order [&+event effects] =* next $(order t.order) =/ hook (~(got by hooks.hooks) i.order) - =/ ctx context(hook hook, config (~(gut by config.hook) nest ~)) + =. bowl bowl(hook hook, config (~(gut by config.hook) nest ~)) =/ return=(unit return:h) - (run-hook:utils [event ctx] hook) + (run-hook:utils [event bowl] hook) ?~ return next =* result result.u.return =. effects (weld effects effects.u.return) @@ -1181,42 +1181,42 @@ =/ id=id-hook:h (slav %uv id.pole) =/ =origin:h [kind.pole (slav %p ship.pole) name.pole] :: if unscheduled, ignore - ?~ crons=(~(get by crons.hooks) id) cor - ?~ cron=(~(get by u.crons) origin) cor + ?~ cron=(~(get by crons.hooks) id) cor + ?~ job=(~(get by u.cron) origin) cor :: ignore premature fires - ?: (lth now.bowl next.schedule.u.cron) cor - =. next.schedule.u.cron + ?: (lth now.bowl next.schedule.u.job) cor + =. next.schedule.u.job :: :: we don't want to run the cron for every iteration it would :: have run 'offline', so we check here to make sure that the :: next fire time is in the future - =/ next (add [next repeat]:schedule.u.cron) + =/ next (add [next repeat]:schedule.u.job) |- ?: (gte next now.bowl) next - $(next (add next repeat.schedule.u.cron)) + $(next (add next repeat.schedule.u.job)) =. crons.hooks %+ ~(put by crons.hooks) id - (~(put by u.crons) origin u.cron) + (~(put by u.cron) origin u.job) =. cor - (schedule-cron origin u.cron) - =/ args [[%cron ~] "cron job" origin config.u.cron] - ho-abet:(ho-run-single:(ho-abed:ho-core id-hook.u.cron) args) + (schedule-cron origin u.job) + =/ args [[%cron ~] "cron job" origin config.u.job] + ho-abet:(ho-run-single:(ho-abed:ho-core id-hook.u.job) args) == ++ schedule-cron - |= [=origin:h =cron:h] + |= [=origin:h =job:h] ^+ cor =/ wire - %+ welp /hooks/cron/(scot %uv id-hook.cron) + %+ welp /hooks/cron/(scot %uv id-hook.job) ?@ origin ~ /[kind.origin]/(scot %p ship.origin)/[name.origin] - (emit [%pass wire %arvo %b %wait next.schedule.cron]) + (emit [%pass wire %arvo %b %wait next.schedule.job]) ++ unschedule-cron - |= [=origin:h =cron:h] + |= [=origin:h =job:h] =/ wire - %+ welp /hooks/cron/(scot %uv id-hook.cron) + %+ welp /hooks/cron/(scot %uv id-hook.job) ?@ origin ~ /[kind.origin]/(scot %p ship.origin)/[name.origin] - (emit [%pass wire %arvo %b %rest next.schedule.cron]) + (emit [%pass wire %arvo %b %rest next.schedule.job]) ++ schedule-waiting |= wh=waiting-hook:h =/ =wire /hooks/waiting/(scot %uv id.wh) diff --git a/desk/lib/channel-utils.hoon b/desk/lib/channel-utils.hoon index 7bdcc0987b..5d6b11c68d 100644 --- a/desk/lib/channel-utils.hoon +++ b/desk/lib/channel-utils.hoon @@ -694,8 +694,8 @@ |= [=args:h =hook:h] ^- (unit return:h) %- (slog (crip "running hook: {} {}") ~) - %- ?~ channel.context.args same - (slog (crip "on channel: {}") ~) + %- ?~ channel.bowl.args same + (slog (crip "on channel: {}") ~) ?~ compiled.hook ~ =/ gate [p.u.compiled.hook .*(q:subject q.u.compiled.hook)] =+ !<(=outcome:h (slam gate !>(args))) diff --git a/desk/lib/hooks-json.hoon b/desk/lib/hooks-json.hoon index 51868d233f..dabca9af5d 100644 --- a/desk/lib/hooks-json.hoon +++ b/desk/lib/hooks-json.hoon @@ -58,26 +58,26 @@ |= [=nest:c seq=(list id-hook:h)] [(nest-cord:enjs:cj nest) a+(turn seq id)] ++ crons - |= crs=(map id-hook:h (map origin:h cron:h)) + |= crs=(map id-hook:h cron:h) %- pairs %+ turn ~(tap by crs) - |= [id=id-hook:h cr=(map origin:h cron:h)] - [(scot %uv id) (cron-map cr)] - ++ cron-map - |= cr=(map origin:h cron:h) + |= [id=id-hook:h cr=cron:h] + [(scot %uv id) (cron cr)] + ++ cron + |= cr=cron:h %- pairs %+ turn ~(tap by cr) - |= [=origin:h crn=cron:h] - :_ (cron crn) + |= [=origin:h jb=job:h] + :_ (job jb) ?@(origin 'global' (nest-cord:enjs:cj origin)) - ++ cron - |= crn=cron:h + ++ job + |= jb=job:h %- pairs - :~ hook+(id id-hook.crn) - schedule+(schedule schedule.crn) - config+(config config.crn) + :~ hook+(id id-hook.jb) + schedule+(schedule schedule.jb) + config+(config config.jb) == ++ schedule |= sch=schedule:h diff --git a/desk/sur/hooks.hoon b/desk/sur/hooks.hoon index 3f2af394c8..93a6aa3344 100644 --- a/desk/sur/hooks.hoon +++ b/desk/sur/hooks.hoon @@ -30,11 +30,12 @@ ++ hooks $: hooks=(map id-hook hook) order=(map nest (list id-hook)) - crons=(map id-hook (map origin cron)) + crons=(map id-hook cron) waiting=(map id-wait [=origin waiting-hook]) == +$ origin $@(~ nest) -+$ cron ++$ cron (map origin job) ++$ job $: =id-hook =schedule =config @@ -71,7 +72,7 @@ [%cron id=id-hook =origin schedule=$@(@dr schedule) =config] [%rest id=id-hook =origin] == -:: $context: ambient state that a hook should know about not +:: $bowl: ambient state that a hook should know about not :: necessarily tied to a specific event :: :: .channel: the channel that the hook is operating on @@ -84,7 +85,7 @@ :: .src: the ship that triggered the hook :: .eny: entropy for random number generation or key derivation :: -+$ context ++$ bowl $: channel=(unit [=nest v-channel]) group=(unit group-ui:g) channels=v-channels @@ -130,17 +131,17 @@ :: $args: the arguments passed to a hook +$ args $: =event - =context + =bowl == :: $outcome: the result of a hook running +$ outcome (each return tang) :: :: $return: the data returned from a hook :: -:: $result: whether the action was allowed or denied and any +:: .result: whether the action was allowed or denied and any :: transformed values -:: $effects: any actions that should be taken on other agents or wait -:: $new-state: the new state of the hook after running +:: .effects: any actions that should be taken on other agents or wait +:: .new-state: the new state of the hook after running :: +$ return $: $: result=event-result From 7c215f1dd7108151a25cbe109875d7e53ebdda0a Mon Sep 17 00:00:00 2001 From: Hunter Miller Date: Mon, 2 Dec 2024 11:13:29 -0600 Subject: [PATCH 5/8] channels-server: removing errant sigpam --- desk/app/channels-server.hoon | 1 - 1 file changed, 1 deletion(-) diff --git a/desk/app/channels-server.hoon b/desk/app/channels-server.hoon index 2dcb961045..8f12886f47 100644 --- a/desk/app/channels-server.hoon +++ b/desk/app/channels-server.hoon @@ -686,7 +686,6 @@ |= =c-channel:c ^+ ca-core ?> am-host:ca-perms - ~& "received command {}" ?- -.c-channel %view ?> (is-admin:ca-perms src.bowl) From d3a83f1e37d4537b54e93e24304bec9d936ce1a7 Mon Sep 17 00:00:00 2001 From: Hunter Miller Date: Mon, 2 Dec 2024 11:16:13 -0600 Subject: [PATCH 6/8] hooks: little more cron naming cleanup --- desk/app/channels-server.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/desk/app/channels-server.hoon b/desk/app/channels-server.hoon index 8f12886f47..154f855d7b 100644 --- a/desk/app/channels-server.hoon +++ b/desk/app/channels-server.hoon @@ -1098,11 +1098,11 @@ =? schedule ?=(@ schedule) [now.bowl schedule] ?> ?=(^ schedule) - =/ crons (~(gut by crons.hooks) id *cron:h) + =/ =cron:h (~(gut by crons.hooks) id *cron:h) =/ =job:h [id schedule config] =. crons.hooks =- (~(put by crons.hooks) id.hook -) - (~(put by crons) origin job) + (~(put by cron) origin job) =. cor (schedule-cron origin job) (ho-give-response [%cron id origin schedule config]) ++ ho-rest From ed83c2324f7322de90160c2059f14e834f87e64a Mon Sep 17 00:00:00 2001 From: Hunter Miller Date: Wed, 4 Dec 2024 11:39:03 -0600 Subject: [PATCH 7/8] hooks: pr cleanup --- desk/lib/hooks-json.hoon | 12 ++++++------ desk/sur/hooks.hoon | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/desk/lib/hooks-json.hoon b/desk/lib/hooks-json.hoon index dabca9af5d..10946c0d81 100644 --- a/desk/lib/hooks-json.hoon +++ b/desk/lib/hooks-json.hoon @@ -69,15 +69,15 @@ %- pairs %+ turn ~(tap by cr) - |= [=origin:h jb=job:h] - :_ (job jb) + |= [=origin:h =job:h] + :_ (^job job) ?@(origin 'global' (nest-cord:enjs:cj origin)) ++ job - |= jb=job:h + |= =job:h %- pairs - :~ hook+(id id-hook.jb) - schedule+(schedule schedule.jb) - config+(config config.jb) + :~ hook+(id id-hook.job) + schedule+(schedule schedule.job) + config+(config config.job) == ++ schedule |= sch=schedule:h diff --git a/desk/sur/hooks.hoon b/desk/sur/hooks.hoon index 93a6aa3344..02875011de 100644 --- a/desk/sur/hooks.hoon +++ b/desk/sur/hooks.hoon @@ -73,7 +73,7 @@ [%rest id=id-hook =origin] == :: $bowl: ambient state that a hook should know about not -:: necessarily tied to a specific event +:: necessarily tied to a specific event :: :: .channel: the channel that the hook is operating on :: .group: the group that the channel belongs to From 7b8beeb17397becbf3ea228ea485b551d3cd27c2 Mon Sep 17 00:00:00 2001 From: Hunter Miller Date: Wed, 4 Dec 2024 14:29:40 -0600 Subject: [PATCH 8/8] channels-server: wrong side spacer --- desk/app/channels-server.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desk/app/channels-server.hoon b/desk/app/channels-server.hoon index 154f855d7b..142f725ec1 100644 --- a/desk/app/channels-server.hoon +++ b/desk/app/channels-server.hoon @@ -1185,10 +1185,10 @@ :: ignore premature fires ?: (lth now.bowl next.schedule.u.job) cor =. next.schedule.u.job - :: :: we don't want to run the cron for every iteration it would :: have run 'offline', so we check here to make sure that the :: next fire time is in the future + :: =/ next (add [next repeat]:schedule.u.job) |- ?: (gte next now.bowl) next