Skip to content

Commit

Permalink
Merge pull request #1316 from tloncorp/lf/hook
Browse files Browse the repository at this point in the history
final pieces before migration
  • Loading branch information
arthyn authored Dec 6, 2022
2 parents ff417c9 + a2d1e49 commit 177747f
Show file tree
Hide file tree
Showing 35 changed files with 597 additions and 175 deletions.
88 changes: 70 additions & 18 deletions desk/app/chat.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
bad=(set ship)
inv=(set ship)
voc=(map [flag:c id:c] (unit said:c))
fish=(map [flag:c @] id:c)
:: true represents imported, false pending import
imp=(map flag:c ?)
==
Expand Down Expand Up @@ -283,17 +284,20 @@
[%briefs ~] ?>(from-self cor)
[%ui ~] ?>(from-self cor)
[%dm %invited ~] ?>(from-self cor)
::
::
[%epic ~]
(give %fact ~ epic+!>(okay))
::
::
[%said host=@ name=@ %msg sender=@ time=@ ~]
=/ host=ship (slav %p host.pole)
=/ =flag:c [host name.pole]
=/ sender=ship (slav %p sender.pole)
=/ =id:c [sender (slav %ud time.pole)]
(watch-said flag id)
::
::
[%hook host=@ name=@ rest=*]
=,(pole (watch-hook [(slav %p host) name] rest))
::
[%chat ship=@ name=@ rest=*]
=/ =ship (slav %p ship.pole)
?> (ca-can-read:(ca-abed:ca-core [ship name.pole]) src.bowl)
Expand All @@ -316,6 +320,9 @@
::
[%epic ~]
(take-epic sign)
::
[%hook host=@ name=@ rest=*]
=,(pole (take-hook [(slav %p host) name] rest sign))
::
[%said host=@ name=@ %msg sender=@ time=@ ~]
=/ host=ship (slav %p host.pole)
Expand Down Expand Up @@ -358,6 +365,43 @@
(take-groups !<(=action:g q.cage.sign))
==
==
++ give-kick
|= [pas=(list path) =cage]
=. cor (give %fact pas cage)
(give %kick ~ ~)
::
++ watch-hook
|= [=flag:g wer=path]
^+ cor
?: (~(has by chats) flag)
ca-abet:(ca-hook:(ca-abed:ca-core flag) wer)
?< =(our.bowl p.flag)
?> ?=([@ ~] wer)
=/ time=@ (slav %ud i.wer)
?^ fis=(~(get by fish) [flag time])
(give-kick ~ chat-said+!>((~(got by voc) flag u.fis)))
=/ =path (welp /hook/(scot %p p.flag)/[q.flag] wer)
(emit %pass path %agent [p.flag dap.bowl] %watch path)
::
++ take-hook
|= [=flag:g wer=path =sign:agent:gall]
^+ cor
?> ?=([@ ~] wer)
=/ =path (welp /hook/(scot %p p.flag)/[q.flag] wer)
?+ -.sign cor
%kick (give %kick ~[path] ~)
%watch-ack
?~ p.sign cor
(give %kick ~[path] ~)
::
%fact
?. =(%chat-said p.cage.sign)
cor
=+ !<(=said:c q.cage.sign)
=/ time=@ (slav %ud i.wer)
=. fish (~(put by fish) [flag time] id.q.said)
(give-kick ~[path] cage.sign)
==
::
++ import-clubs
|= cus=club-imports:c
Expand Down Expand Up @@ -466,6 +510,7 @@
++ take-said
|= [=flag:c =id:c =sign:agent:gall]
^+ cor
=/ wire (said-wire flag id)
?+ -.sign !!
%watch-ack
%. cor
Expand All @@ -475,11 +520,15 @@
%kick
?: (~(has by voc) [flag id])
cor :: subscription ended politely
(proxy-said flag id)
:: XX: only versioned subscriptions should rewatch on kick
(give %kick ~[wire] ~)
:: (proxy-said flag id)
::
%fact
=. cor
(give %fact ~[(said-wire flag id)] cage.sign)
(give %fact ~[wire] cage.sign)
=. cor
(give %kick ~[wire] ~)
?+ p.cage.sign ~|(funny-mark/p.cage.sign !!)
%chat-said
=+ !<(=said:c q.cage.sign)
Expand All @@ -496,8 +545,9 @@
|= [=flag:c =id:c]
=/ =dock [p.flag dap.bowl]
=/ wire (said-wire flag id)
=/ =card [%pass wire %agent dock %watch wire]
(emit card)
?: (~(has by wex.bowl) wire dock)
cor
(emit %pass wire %agent dock %watch wire)
::
++ take-epic
|= =sign:agent:gall
Expand Down Expand Up @@ -940,21 +990,23 @@
::
==
::
++ ca-hook
|= wer=path
?> (ca-can-read src.bowl)
?> ?=([@ ~] wer)
=/ time=@ (slav %ud i.wer)
=. cor (give-kick ~ %chat-said !>([flag (got:on:writs:c wit.pact.chat time)]))
ca-core
::
++ ca-said
|= =id:c
|^ ^+ ca-core
^+ ca-core
?. (ca-can-read src.bowl)
(give-kick chat-denied+!>(~))
=/ [=time =writ:c] (got:ca-pact id)
%+ give-kick %chat-said
!> ^- said:c
[flag writ]
++ give-kick
|= =cage
=. cor (give %fact ~ cage)
=. cor (give %kick ~ ~)
=. cor (give-kick ~ chat-denied+!>(~))
ca-core
--
=/ [=time =writ:c] (got:ca-pact id)
=. cor (give-kick ~ %chat-said !>([flag writ]))
ca-core
::
++ ca-upgrade
^+ ca-core
Expand Down
56 changes: 31 additions & 25 deletions desk/app/diary.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
+$ current-state
$: %0
=shelf:d
voc=(map [flag:d time] (unit said:d))
voc=(map [flag:d plan:d] (unit said:d))
:: true represents imported, false pending import
imp=(map flag:d ?)
==
Expand Down Expand Up @@ -359,25 +359,28 @@
=/ =ship (slav %p ship.pole)
di-abet:(di-watch:(di-abed:di-core ship name.pole) rest.pole)
::
[%said host=@ name=@ %note time=@ ~]
[%said host=@ name=@ %note time=@ quip=?(~ [@ ~])]
=/ host=ship (slav %p host.pole)
=/ =flag:d [host name.pole]
=/ =time (slav %ud time.pole)
(watch-said flag time)
=/ =plan:d =,(pole [(slav %ud time) ?~(quip ~ `(slav %ud -.quip))])
(watch-said flag plan)
==
::
++ watch-said
|= [=flag:d =time]
|= [=flag:d =plan:d]
?. (~(has by shelf) flag)
(proxy-said flag time)
di-abet:(di-said:(di-abed:di-core flag) time)
(proxy-said flag plan)
di-abet:(di-said:(di-abed:di-core flag) plan)
++ said-wire
|= [=flag:d =time]
|= [=flag:d =plan:d]
^- wire
/said/(scot %p p.flag)/[q.flag]/note/(scot %ud time)
%+ welp
/said/(scot %p p.flag)/[q.flag]/note/(scot %ud p.plan)
?~(q.plan / /(scot %ud u.q.plan))
::
++ take-said
|= [=flag:d =time =sign:agent:gall]
|= [=flag:d =plan:d =sign:agent:gall]
=/ =wire (said-wire flag plan)
^+ cor
?+ -.sign !!
%watch-ack
Expand All @@ -386,31 +389,34 @@
(slog leaf/"Preview failed" u.p.sign)
::
%kick
?: (~(has by voc) [flag time])
?: (~(has by voc) [flag plan])
cor :: subscription ended politely
(proxy-said flag time)
:: XX: only versioned subscriptions should rewatch on kick
(give %kick ~[wire] ~)
:: (proxy-said flag time)
::
%fact
=. cor
(give %fact ~[(said-wire flag time)] cage.sign)
=. cor (give %fact ~[wire] cage.sign)
=. cor (give %kick ~[wire] ~)
?+ p.cage.sign ~|(funny-mark/p.cage.sign !!)
%diary-said
=+ !<(=said:d q.cage.sign)
=. voc (~(put by voc) [flag time] `said)
=. voc (~(put by voc) [flag plan] `said)
cor
::
%diary-denied
=. voc (~(put by voc) [flag time] ~)
=. voc (~(put by voc) [flag plan] ~)
cor
==
==
::
++ proxy-said
|= [=flag:d =time]
|= [=flag:d =plan:d]
=/ =dock [p.flag dap.bowl]
=/ wire (said-wire flag time)
=/ =card [%pass wire %agent dock %watch wire]
(emit card)
=/ wire (said-wire flag plan)
?: (~(has by wex.bowl) wire dock)
cor
(emit %pass wire %agent dock %watch wire)
::
++ agent
|= [=(pole knot) =sign:agent:gall]
Expand All @@ -430,11 +436,11 @@
=/ =ship (slav %p ship.pole)
di-abet:(di-agent:(di-abed:di-core ship name.pole) rest.pole sign)
::
[%said host=@ name=@ %note time=@ ~]
[%said host=@ name=@ %note time=@ quip=?(~ [@ ~])]
=/ host=ship (slav %p host.pole)
=/ =flag:d [host name.pole]
=/ id=time (slav %ud time.pole)
(take-said flag id sign)
=/ =plan:d =,(pole [(slav %ud time) ?~(quip ~ `(slav %ud -.quip))])
(take-said flag plan sign)
::
[%groups ~]
?+ -.sign !!
Expand Down Expand Up @@ -564,11 +570,11 @@
di-core
::
++ di-said
|= =time
|= =plan:d
|^ ^+ di-core
?. (di-can-read src.bowl)
(give-kick diary-denied+!>(~))
=/ [* =note:d] (got:di-notes time)
=/ [* =note:d] (got:di-notes p.plan)
=/ =outline:d (trace:di-notes note)
%+ give-kick %diary-said
!> ^- said:d
Expand Down
Loading

3 comments on commit 177747f

@vercel
Copy link

@vercel vercel bot commented on 177747f Dec 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

chatstead – ./ui

chatstead-git-master-tlon.vercel.app
chatstead-tlon.vercel.app
chatstead.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 177747f Dec 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

homestead – ./ui

tlon-homestead.vercel.app
homestead-git-master-tlon.vercel.app
homestead-tlon.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 177747f Dec 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

homestead-storybook – ./ui

homestead-storybook.vercel.app
homestead-storybook-git-master-tlon.vercel.app
homestead-storybook-tlon.vercel.app

Please sign in to comment.