summaryrefslogtreecommitdiff
path: root/desk/sur/tlon-chat.hoon
diff options
context:
space:
mode:
Diffstat (limited to 'desk/sur/tlon-chat.hoon')
-rw-r--r--desk/sur/tlon-chat.hoon1268
1 files changed, 1268 insertions, 0 deletions
diff --git a/desk/sur/tlon-chat.hoon b/desk/sur/tlon-chat.hoon
new file mode 100644
index 0000000..dd82833
--- /dev/null
+++ b/desk/sur/tlon-chat.hoon
@@ -0,0 +1,1268 @@
+|%
+++ meta
+|%
++$ data
+ $: title=cord
+ description=cord
+ image=cord
+ cover=cord
+ ==
++$ diff
+ $% [%title =cord]
+ [%description =cord]
+ [%image =cord]
+ [%cover =cord]
+ ==
+--
+++ d
+|%
+:: $flag: identifier for a diary channel
++$ flag (pair ship term)
+:: $feel: either an emoji identifier like :diff or a URL for custom
++$ feel @ta
+:: $view: the persisted display format for a diary
++$ view ?(%grid %list)
+:: $sort: the persisted sort type for a diary
++$ sort ?(%alpha %time)
+:: $shelf: my ship's diaries
++$ shelf (map flag diary)
+:: $said: used for references
++$ said (pair flag outline)
+:: $plan: index into diary state
+:: p: Note being referred to
+:: q: Quip being referred to, if any
+::
++$ plan
+ (pair time (unit time))
+::
+:: $diary: written longform communication
+::
+:: net: an indicator of whether I'm a host or subscriber
+:: log: the history of all modifications
+:: perm: holds the diary's permissions
+:: view: what format to display
+:: sort: how to order posts
+:: notes: the actual contents of the diary
+:: remark: what is the last thing we've read
+:: banter: comments organized by post
+::
++$ diary
+ $: =net
+ =log
+ =perm
+ =view
+ =sort
+ =notes
+ =remark
+ ==
+::
+:: $notes: a set of time ordered diary posts
+::
+++ notes
+ =< rock
+ |%
+ +$ rock
+ ((mop time note) lte)
+ ++ on
+ ((^on time note) lte)
+ +$ diff
+ (pair time delta)
+ +$ delta
+ $% [%add p=essay]
+ [%edit p=essay]
+ [%del ~]
+ [%quips p=diff:quips]
+ [%add-feel p=ship q=feel]
+ [%del-feel p=ship]
+ ==
+ --
+::
+:: $quips: a set of time ordered note comments
+::
+++ quips
+ =< rock
+ |%
+ +$ rock
+ ((mop time quip) lte)
+ ++ on
+ ((^on time quip) lte)
+ +$ diff
+ (pair time delta)
+ +$ delta
+ $% [%add p=memo]
+ [%del ~]
+ [%add-feel p=ship q=feel]
+ [%del-feel p=ship]
+ ==
+ --
+::
+:: $outline: abridged $note
+:: .quips: number of comments
+::
++$ outline
+ [quips=@ud quippers=(set ship) essay]
+::
+++ outlines
+ =< outlines
+ |%
+ +$ outlines ((mop time outline) lte)
+ ++ on ((^on time outline) lte)
+ --
+::
+:: $note: a diary post
+::
++$ note [seal essay]
+:: $quip: a post comment
+::
++$ quip [cork memo]
+::
+:: $seal: host-side data for a note
+::
++$ seal
+ $: =time
+ =quips
+ feels=(map ship feel)
+ ==
+::
+:: $cork: host-side data for a quip
+::
++$ cork
+ $: =time
+ feels=(map ship feel)
+ ==
+:: $essay: the post data itself
+::
+:: title: the name of the post
+:: image: a visual displayed as a header
+:: content: the body of the post
+:: author: the ship that wrote the post
+:: sent: the client-side time the post was made
+::
++$ essay
+ $: title=@t
+ image=@t
+ content=(list verse)
+ author=ship
+ sent=time
+ ==
++$ story (pair (list block) (list inline))
+:: $memo: the comment data itself
+::
+:: content: the body of the comment
+:: author: the ship that wrote the comment
+:: sent: the client-side time the comment was made
+::
++$ memo
+ $: content=story
+ author=ship
+ sent=time
+ ==
+:: $verse: a chunk of post content
+::
+:: blocks stand on their own. inlines come in groups and get wrapped
+:: into a paragraph
+::
++$ verse
+ $% [%block p=block]
+ [%inline p=(list inline)]
+ ==
+:: $listing: recursive type for infinitely nested <ul> or <ol>
++$ listing
+ $% [%list p=?(%ordered %unordered) q=(list listing) r=(list inline)]
+ [%item p=(list inline)]
+ ==
+:: $block: post content that sits outside of the normal text
+::
+:: %image: a visual, we record dimensions for better rendering
+:: %cite: an Urbit reference
+:: %header: a traditional HTML heading, h1-h6
+:: %listing: a traditional HTML list, ul and ol
+::
++$ block
+ $% [%image src=cord height=@ud width=@ud alt=cord]
+ [%cite =cite:c]
+ [%header p=?(%h1 %h2 %h3 %h4 %h5 %h6) q=(list inline)]
+ [%listing p=listing]
+ [%rule ~]
+ ==
+:: $inline: post content that flows within a paragraph
+::
+:: @t: plain text
+:: %italics: italic text
+:: %bold: bold text
+:: %strike: strikethrough text
+:: %inline-code: code formatting for small snippets
+:: %blockquote: blockquote surrounded content
+:: %block: link/reference to blocks
+:: %code: code formatting for large snippets
+:: %tag: tag gets special signifier
+:: %link: link to a URL with a face
+:: %break: line break
+::
++$ inline
+ $@ @t
+ $% [%italics p=(list inline)]
+ [%bold p=(list inline)]
+ [%strike p=(list inline)]
+ [%blockquote p=(list inline)]
+ [%inline-code p=cord]
+ [%ship p=ship]
+ [%block p=@ud q=cord]
+ [%code p=cord]
+ [%tag p=cord]
+ [%link p=cord q=cord]
+ [%break ~]
+ ==
+:: $log: a time ordered history of modifications to a diary
+::
++$ log
+ ((mop time diff) lte)
+++ log-on
+ ((on time diff) lte)
+::
+:: $action: the complete set of data required to modify a diary
+::
++$ action
+ (pair flag:g update)
+::
+:: $update: a representation in time of a modification to a diary
+::
++$ update
+ (pair time diff)
+::
+:: $diff: the full suite of modifications that can be made to a diary
+::
++$ diff
+ $% [%notes p=diff:notes]
+ ::
+ [%add-sects p=(set sect:g)]
+ [%del-sects p=(set sect:g)]
+ ::
+ [%create p=perm q=notes]
+ [%view p=view]
+ [%sort p=sort]
+ ::
+ ==
+::
+:: $net: an indicator of whether I'm a host or subscriber
+::
+:: %pub: am publisher/host with fresh log
+:: %sub: subscribed to the ship at saga
+::
++$ net
+ $% [%sub p=ship load=_| =saga:e]
+ [%pub ~] :: TODO: permissions?
+ ==
+::
+:: $briefs: a map of diary unread information
+::
+:: brief: the last time a diary was read, how many posts since,
+:: and the id of the last read note
+::
+++ briefs
+ =< briefs
+ |%
+ +$ briefs
+ (map flag brief)
+ +$ brief
+ [last=time count=@ud read-id=(unit time)]
+ +$ update
+ (pair flag brief)
+ --
+:: $remark: a marker representing the last note I've read
+::
++$ remark
+ [last-read=time watching=_| ~]
+::
++$ remark-action
+ (pair flag remark-diff)
+::
++$ remark-diff
+ $% [%read ~]
+ [%read-at p=time]
+ [?(%watch %unwatch) ~]
+ ==
+::
+:: $perm: represents the permissions for a diary channel and gives a
+:: pointer back to the group it belongs to.
+::
++$ perm
+ $: writers=(set sect:g)
+ group=flag:g
+ ==
+:: $leave: a flag to pass for a channel leave
+::
++$ leave flag:g
+::
+:: $create: represents a request to create a channel
+::
+:: The name will be used as part of the flag which represents the
+:: channel. $create is consumed by the diary agent first and then
+:: passed to the groups agent to register the channel with the group.
+::
+:: Write permission is stored with the specific agent in the channel,
+:: read permission is stored with the group's data.
+::
++$ create
+ $: group=flag:g
+ name=term
+ title=cord
+ description=cord
+ readers=(set sect:g)
+ writers=(set sect:g)
+ ==
+--
+++ c
+|%
++$ writ [seal memo]
+:: $id: an identifier for chat messages
++$ id (pair ship time)
+:: $feel: either an emoji identifier like :wave: or a URL for custom
++$ feel @ta
++$ said (pair flag writ)
+::
+:: $seal: the id of a chat and its meta-responses
+::
+:: id: the id of the message
+:: feels: reactions to a message
+:: replied: set of replies to a message
+::
++$ seal
+ $: =id
+ feels=(map ship feel)
+ replied=(set id)
+ ==
+::
+:: $whom: a polymorphic identifier for chats
+::
++$ whom
+ $% [%flag p=flag]
+ [%ship p=ship]
+ [%club p=id:club]
+ ==
+::
+:: $briefs: a map of chat/club/dm unread information
+::
+:: brief: the last time a message was read, how many messages since,
+:: and the id of the last read message
+::
+++ briefs
+ =< briefs
+ |%
+ +$ briefs
+ (map whom brief)
+ +$ brief
+ [last=time count=@ud read-id=(unit id)]
+ +$ update
+ (pair whom brief)
+ --
+::
++$ remark-action
+ (pair whom remark-diff)
+::
++$ remark-diff
+ $% [%read ~]
+ [%read-at p=time]
+ [?(%watch %unwatch) ~]
+ ==
+::
+:: $flag: an identifier for a $chat channel
+::
++$ flag (pair ship term)
+::
+:: $diff: represents an update to state
+::
+:: %writs: a chat message update
+:: %add-sects: add sects to writer permissions
+:: %del-sects: delete sects from writers
+:: %create: create a new chat
+::
++$ diff
+ $% [%writs p=diff:writs]
+ ::
+ [%add-sects p=(set sect:g)]
+ [%del-sects p=(set sect:g)]
+ ::
+ [%create p=perm q=pact]
+ ==
+:: $index: a map of chat message id to server received message time
+::
++$ index (map id time)
+::
+:: $pact: a double indexed map of chat messages, id -> time -> message
+::
++$ pact
+ $: wit=writs
+ dex=index
+ ==
+::
+:: $club: a direct line of communication between multiple parties
+::
+:: uses gossip to ensure all parties keep in sync
+::
+++ club
+ =< club
+ |%
+ :: $id: an identification signifier for a $club
+ ::
+ +$ id @uvH
+ :: $net: status of club
+ ::
+ +$ net ?(%archive %invited %done)
+ +$ club [=pact crew]
+ ::
+ :: $crew: a container for the metadata for the club
+ ::
+ :: team: members that have accepted an invite
+ :: hive: pending members that have been invited
+ :: met: metadata representing club
+ :: net: status
+ :: pin: should the $club be pinned to the top
+ ::
+ +$ crew
+ $: team=(set ship)
+ hive=(set ship)
+ met=data:meta
+ =net
+ pin=_|
+ ==
+ :: $rsvp: a $club invitation response
+ ::
+ +$ rsvp [=id =ship ok=?]
+ :: $create: a request to create a $club with a starting set of ships
+ ::
+ +$ create
+ [=id hive=(set ship)]
+ :: $invite: the contents to send in an invitation to someone
+ ::
+ +$ invite [=id team=(set ship) hive=(set ship) met=data:meta]
+ :: $echo: number of times diff has been echoed
+ ::
+ +$ echo @ud
+ +$ diff (pair echo delta)
+ ::
+ +$ delta
+ $% [%writ =diff:writs]
+ [%meta meta=data:meta]
+ [%team =ship ok=?]
+ [%hive by=ship for=ship add=?]
+ [%init team=(set ship) hive=(set ship) met=data:meta]
+ ==
+ ::
+ +$ action (pair id diff)
+ --
+::
+:: $writs: a set of time ordered chat messages
+::
+++ writs
+ =< writs
+ |%
+ +$ writs
+ ((mop time writ) lte)
+ ++ on
+ ((^on time writ) lte)
+ +$ diff
+ (pair id delta)
+ +$ delta
+ $% [%add p=memo]
+ [%del ~]
+ [%add-feel p=ship q=feel]
+ [%del-feel p=ship]
+ ==
+ --
+::
+:: $dm: a direct line of communication between two ships
+::
+:: net: status of dm
+:: id: a message identifier
+:: action: an update to the dm
+:: rsvp: a response to a dm invitation
+::
+++ dm
+ =< dm
+ |%
+ +$ dm
+ $: =pact
+ =remark
+ =net
+ pin=_|
+ ==
+ +$ net ?(%inviting %invited %archive %done)
+ +$ id (pair ship time)
+ +$ diff diff:writs
+ +$ action (pair ship diff)
+ +$ rsvp [=ship ok=?]
+ --
+::
+:: $log: a time ordered map of all modifications to groups
+::
++$ log
+ ((mop time diff) lte)
+++ log-on
+ ((on time diff) lte)
++$ remark
+ [last-read=time watching=_| ~]
+::
+:: $chat: a group based channel for communicating
+::
++$ chat
+ [=net =remark =log =perm =pact]
+::
+:: $notice: the contents of an automated message
+::
+:: pfix: text preceding ship name
+:: sfix: text following ship name
+::
++$ notice [pfix=@t sfix=@t]
+::
+:: $content: the contents of a message whether handwritten or automated
+::
++$ content
+ $% [%story p=story]
+ [%notice p=notice]
+ ==
+::
+:: $draft: the contents of an unsent message at a particular $whom
+::
++$ draft
+ (pair whom story)
+::
+:: $story: handwritten contents of a message
+::
+:: blocks precede inline content
+::
++$ story
+ (pair (list block) (list inline))
+::
+:: $block: content which stands on it's own outside of inline content
+::
++$ block
+ $% [%image src=cord height=@ud width=@ud alt=cord]
+ [%cite =cite]
+ ==
+::
+:: $inline: a representation of text with or without formatting
+::
+:: @t: plain text
+:: %italics: italic text
+:: %bold: bold text
+:: %strike: strikethrough text
+:: %blockquote: blockquote surrounded content
+:: %inline-code: code formatting for small snippets
+:: %ship: a mention of a ship
+:: %block: link/reference to blocks
+:: %code: code formatting for large snippets
+:: %tag: tag gets special signifier
+:: %link: link to a URL with a face
+:: %break: line break
+::
++$ inline
+ $@ @t
+ $% [%italics p=(list inline)]
+ [%bold p=(list inline)]
+ [%strike p=(list inline)]
+ [%blockquote p=(list inline)]
+ [%inline-code p=cord]
+ [%ship p=ship]
+ [%block p=@ud q=cord]
+ [%code p=cord]
+ [%tag p=cord]
+ [%link p=cord q=cord]
+ [%break ~]
+ ==
+::
+:: $memo: a chat message with metadata
+::
+:: replying: what message we're replying to
+:: author: writer of the message
+:: sent: time (from sender) when the message was sent
+:: content: body of the message
+::
++$ memo
+ $: replying=(unit id)
+ author=ship
+ sent=time
+ =content
+ ==
+::
+:: $net: an indicator of whether I'm a host or subscriber
+::
+:: %load: iniating chat join
+:: %pub: am publisher/host with fresh log
+:: %sub: subscribed to the ship
+::
++$ net
+ $% [%sub host=ship load=_| =saga:e]
+ [%pub ~]
+ ==
+::
+:: $action: the complete set of data required to edit a chat
+::
++$ action
+ (pair flag update)
+::
+:: $update: a representation in time of a modification of a chat
+::
++$ update
+ (pair time diff)
+::
+:: $logs: a time ordered map of all modifications to groups
+::
++$ logs
+ ((mop time diff) lte)
+::
+:: $perm: represents the permissions for a channel and gives a pointer
+:: back to the group it belongs to.
+::
++$ perm
+ $: writers=(set sect:g)
+ group=flag:g
+ ==
+::
+:: $leave: a flag to pass for a channel leave
+::
++$ leave flag:g
+::
+:: $create: represents a request to create a channel
+::
+:: The name will be used as part of the flag which represents the
+:: channel. $create is consumed by the chat agent first
+:: and then passed to the groups agent to register the channel with
+:: the group.
+::
+:: Write permission is stored with the specific agent in the channel,
+:: read permission is stored with the group's data.
+::
++$ create
+ $: group=flag:g
+ name=term
+ title=cord
+ description=cord
+ readers=(set sect:g)
+ writers=(set sect:g)
+ ==
+--
+++ cite
+=< cite
+|%
+++ purse
+ |= =(pole knot)
+ ^- (unit cite)
+ ?. =(~.1 -.pole) ~
+ =. pole +.pole
+ ?+ pole ~
+ [%chan agent=@ ship=@ name=@ rest=*]
+ =/ ship (slaw %p ship.pole)
+ ?~ ship ~
+ `[%chan [agent.pole u.ship name.pole] rest.pole]
+ ::
+ [%desk ship=@ name=@ rest=*]
+ =/ ship (slaw %p ship.pole)
+ ?~ ship ~
+ `[%desk [u.ship name.pole] rest.pole]
+ ::
+ [%group ship=@ name=@ ~]
+ =/ ship (slaw %p ship.pole)
+ ?~ ship ~
+ `[%group u.ship name.pole]
+ ==
+++ parse
+ |= =path
+ ^- cite
+ (need (purse path))
+::
+++ print
+ |= c=cite
+ |^ ^- path
+ :- (scot %ud 1)
+ ?- -.c
+ %chan chan/(welp (nest nest.c) wer.c)
+ %desk desk/(welp (flag flag.c) wer.c)
+ %group group/(flag flag.c)
+ %bait bait/:(welp (flag grp.c) (flag gra.c) wer.c)
+ ==
+ ++ flag
+ |= f=flag:g
+ ~[(scot %p p.f) q.f]
+ ++ nest
+ |= n=nest:g
+ [p.n (flag q.n)]
+ --
+::
++$ cite
+ $% [%chan =nest:g wer=path]
+ [%group =flag:g]
+ [%desk =flag:g wer=path]
+ [%bait grp=flag:g gra=flag:g wer=path]
+ :: scry into groups when you receive a bait for a chat that doesn't exist yet
+ :: work out what app
+ ==
+--
+++ e
+|%
+:: $saga: version synchronisation state
+:: %dex: publisher is ahead
+:: %lev: we are ahead
+:: %chi: full sync
+::
++$ saga
+ $% [%dex ver=@ud]
+ [%lev ~]
+ [%chi ~]
+ ==
+
++$ epic @ud
+::
+--
+++ h
+|%
+:: $flag: identifier for a heap channel
++$ flag (pair ship term)
+:: $feel: either an emoji identifier like :wave or a URL for custom
++$ feel @ta
+:: $view: the persisted display format for a heap
++$ view ?(%grid %list)
+:: $stash: heaps I've joined
++$ stash (map flag heap)
+:: $said: used for curio references
++$ said (pair flag curio)
+::
+:: $heap: a collection of curiosities
+::
+:: net: an indicator of whether I'm a host or subscriber
+:: log: the history of all modifications
+:: perm: holds the heap's permissions
+:: view: what format to display
+:: curios: the actual contents of the heap
+:: remark: what is the last thing we've seen/read
+::
++$ heap
+ $: =net
+ =log
+ =perm
+ =view
+ =curios
+ =remark
+ ==
+:: $curios: a set of time ordered heap items
+::
+++ curios
+ =< curios
+ |%
+ +$ curios
+ ((mop time curio) lte)
+ ++ on
+ ((^on time curio) lte)
+ +$ diff
+ (pair time delta)
+ +$ delta
+ $% [%add p=heart]
+ [%edit p=heart]
+ [%del ~]
+ [%add-feel p=ship q=feel]
+ [%del-feel p=ship]
+ ==
+ --
+:: $curio: an item in the collection or a comment about an item
+::
++$ curio [seal heart]
+::
+:: $seal: the id of a curio and its meta-responses
+::
+:: time: the id of the curio
+:: feels: reactions to a curio
+:: replied: set of replies to a curio
+::
++$ seal
+ $: =time
+ feels=(map ship feel)
+ replied=(set time)
+ ==
+:: $heart: the curio data itself
+::
+:: title: name of the curio
+:: content: body of the curio
+:: author: writer of the curio
+:: sent: the client-side time the curio was made
+:: replying: what curio we're commenting on
+::
++$ heart
+ $: title=(unit @t)
+ =content
+ author=ship
+ sent=time
+ replying=(unit time)
+ ==
+:: $content: curio content
+::
++$ content
+ (pair (list block) (list inline))
+:: $block: block-level curio content
++$ block
+ $% [%image src=cord height=@ud width=@ud alt=cord]
+ [%cite =cite]
+ ==
+:: $inline: curio content that flows within a paragraph
+::
+:: @t: plain text
+:: %italics: italic text
+:: %bold: bold text
+:: %strike: strikethrough text
+:: %inline-code: code formatting for small snippets
+:: %blockquote: blockquote surrounded content
+:: %code: code formatting for large snippets
+:: %tag: tag gets special signifier
+:: %link: link to a URL with a face
+:: %break: line break
+::
++$ inline
+ $@ @t
+ $% [%italics p=(list inline)]
+ [%bold p=(list inline)]
+ [%strike p=(list inline)]
+ [%blockquote p=(list inline)]
+ [%inline-code p=cord]
+ [%ship p=ship]
+ [%code p=cord]
+ [%block p=@ud q=cord]
+ [%tag p=cord]
+ [%link p=cord q=cord]
+ [%break ~]
+ ==
+:: $log: a time ordered history of modifications to a heap
+::
++$ log
+ ((mop time diff) lte)
+++ log-on
+ ((on time diff) lte)
+::
+:: $action: the complete set of data required to modify a heap
+::
++$ action
+ (pair flag:g update)
+::
+:: $update: a representation in time of a modification to a heap
+::
++$ update
+ (pair time diff)
+::
+:: $diff: the full suite of modifications that can be made to a heap
+::
++$ diff
+ $% [%curios p=diff:curios]
+ ::
+ [%add-sects p=(set sect:g)]
+ [%del-sects p=(set sect:g)]
+ ::
+ [%create p=perm q=curios]
+ [%view p=view]
+ ==
+:: $net: an indicator of whether I'm a host or subscriber
+::
+:: %pub: am publisher/host with fresh log
+:: %sub: subscribed to the ship
+::
++$ net
+ $% [%sub p=ship load=_| =saga:e]
+ [%pub ~]
+ ==
+::
+:: $briefs: a map of heap unread information
+::
+:: brief: the last time a heap was read, how many items since,
+:: and the id of the last seen curio
+::
+++ briefs
+ =< briefs
+ |%
+ +$ briefs
+ (map flag brief)
+ +$ brief
+ [last=time count=@ud read-id=(unit time)]
+ +$ update
+ (pair flag brief)
+ --
+:: $remark: a marker representing the last note I've read
+::
++$ remark
+ [last-read=time watching=_| ~]
+::
++$ remark-action
+ (pair flag remark-diff)
+::
++$ remark-diff
+ $% [%read ~]
+ [%read-at p=time]
+ [?(%watch %unwatch) ~]
+ ==
+:: $perm: represents the permissions for a heap channel and gives a
+:: pointer back to the group it belongs to.
+::
++$ perm
+ $: writers=(set sect:g)
+ group=flag:g
+ ==
+:: $leave: a flag to pass for a channel leave
+::
++$ leave flag:g
+::
+:: $create: represents a request to create a channel
+::
+:: The name will be used as part of the flag which represents the
+:: channel. $create is consumed by the heap agent first and then
+:: passed to the groups agent to register the channel with the group.
+::
+:: Write permission is stored with the specific agent in the channel,
+:: read permission is stored with the group's data.
+::
++$ create
+ $: group=flag:g :: TODO: unmanaged-style group chats
+ name=term
+ title=cord
+ description=cord
+ readers=(set sect:g)
+ writers=(set sect:g)
+ ==
+--
+++ g
+|%
+:: $flag: ID for a group
+::
++$ flag (pair ship term)
+::
+:: $nest: ID for a channel, {app}/{ship}/{name}
+::
++$ nest (pair dude:gall flag)
+::
+:: $sect: ID for cabal, similar to a role
+::
++$ sect term
+::
+:: $zone: channel grouping
+::
+:: includes its own metadata for display and keeps the order of
+:: channels within.
+::
+:: zone: the term that represents the ID of a zone
+:: realm: the metadata representing the zone and the order of channels
+:: delta: the set of actions that can be taken on a zone
+:: %add: create a zone
+:: %del: delete the zone
+:: %edit: modify the zone metadata
+:: %mov: reorders the zone in the group
+:: %mov-nest: reorders a channel within the zone
+::
+++ zone
+ =< zone
+ |%
+ +$ zone @tas
+ +$ realm
+ $: met=data:meta
+ ord=(list nest)
+ ==
+ +$ diff (pair zone delta)
+ +$ delta
+ $% [%add meta=data:meta]
+ [%del ~]
+ [%edit meta=data:meta]
+ [%mov idx=@ud]
+ [%mov-nest =nest idx=@ud]
+ ==
+ --
+::
+:: $fleet: group members and their associated metadata
+::
+:: vessel: a user's set of sects or roles and the time that they joined
+:: @da default represents an admin added member that has yet to join
+::
+++ fleet
+ =< fleet
+ |%
+ +$ fleet (map ship vessel)
+ +$ vessel
+ $: sects=(set sect)
+ joined=time
+ ==
+ +$ diff
+ $% [%add ~]
+ [%del ~]
+ [%add-sects sects=(set sect)]
+ [%del-sects sects=(set sect)]
+ ==
+ --
+::
+:: $channel: a medium for interaction
+::
+++ channel
+ =< channel
+ |%
+ +$ preview
+ $: =nest
+ meta=data:meta
+ group=^preview
+ ==
+ ::
+ +$ channels (map nest channel)
+ ::
+ :: $channel: a collection of metadata about a specific agent integration
+ ::
+ :: meta: title, description, image, cover
+ :: added: when the channel was created
+ :: zone: what zone or section to bucket in
+ :: join: should the channel be joined by new members
+ :: readers: what sects can see the channel, empty means anyone
+ ::
+ +$ channel
+ $: meta=data:meta
+ added=time
+ =zone
+ join=?
+ readers=(set sect)
+ ==
+ ::
+ :: $diff: represents the set of actions you can take on a channel
+ ::
+ :: add: create a channel, should be called from agent
+ :: del: delete a channel
+ :: add-sects: add sects to readers
+ :: del-sects: delete sects from readers
+ :: zone: change the zone of the channel
+ :: join: toggle default join
+ ::
+ +$ diff
+ $% [%add =channel]
+ [%del ~]
+ ::
+ [%add-sects sects=(set sect)]
+ [%del-sects sects=(set sect)]
+ ::
+ [%zone =zone]
+ ::
+ [%join join=_|]
+ ==
+ --
+::
+:: $group: collection of people and the pathways in which they interact
+::
+:: group holds all data around members, permissions, channel
+:: organization, and its own metadata to represent the group
+::
++$ group
+ $: =fleet
+ cabals=(map sect cabal)
+ zones=(map zone realm:zone)
+ zone-ord=(list zone)
+ =bloc
+ =channels:channel
+ imported=(set nest)
+ =cordon
+ secret=?
+ meta=data:meta
+ ==
+::
+:: $cabal: metadata representing a $sect or role
+::
+++ cabal
+ =< cabal
+ |%
+ ::
+ +$ cabal
+ [meta=data:meta ~]
+ ::
+ +$ diff
+ $% [%add meta=data:meta]
+ [%del ~]
+ ==
+ --
+::
+:: $cordon: group entry and visibility permissions
+::
+++ cordon
+ =< cordon
+ |%
+ ::
+ :: $open: a group with open entry, only bans are barred entry
+ ::
+ ++ open
+ |%
+ :: $ban: set of ships and ranks/classes that are not allowed entry
+ ::
+ :: bans can either be done at the individual ship level or by the
+ :: rank level (comet/moon/etc.)
+ ::
+ +$ ban [ships=(set ship) ranks=(set rank:title)]
+ +$ diff
+ $% [%add-ships p=(set ship)]
+ [%del-ships p=(set ship)]
+ ::
+ [%add-ranks p=(set rank:title)]
+ [%del-ranks p=(set rank:title)]
+ ==
+ --
+ ::
+ :: $shut: a group with closed entry, everyone barred entry
+ ::
+ :: a shut cordon means that the group is closed, but still visible.
+ :: people may request entry and either be accepted or denied or
+ :: they may be invited directly
+ ::
+ :: ask: represents those requesting entry
+ :: pending: represents those who've been invited
+ ::
+ ++ shut
+ |%
+ +$ state [pend=(set ship) ask=(set ship)]
+ +$ kind ?(%ask %pending)
+ +$ diff
+ $% [%add-ships p=kind q=(set ship)]
+ [%del-ships p=kind q=(set ship)]
+ ==
+ --
+ ::
+ :: $cordon: a set of metadata to represent the entry policy for a group
+ ::
+ :: open: a group with open entry, only bans barred entry
+ :: shut: a group with closed entry, everyone barred entry
+ :: afar: a custom entry policy defined by another agent
+ ::
+ +$ cordon
+ $% [%shut state:shut]
+ [%afar =flag =path desc=@t]
+ [%open =ban:open]
+ ==
+ ::
+ :: $diff: the actions you can take on a cordon
+ ::
+ +$ diff
+ $% [%shut p=diff:shut]
+ [%open p=diff:open]
+ [%swap p=cordon]
+ ==
+ --
+::
+:: $bloc: superuser sects
+::
+:: sects in the bloc set are allowed to make modifications to the group
+:: and its various metadata and permissions
+::
+++ bloc
+ =< bloc
+ |%
+ +$ bloc (set sect)
+ +$ diff
+ $% [%add p=(set sect)]
+ [%del p=(set sect)]
+ ==
+ --
+::
+:: $diff: the general set of changes that can be made to a group
+::
++$ diff
+ $% [%fleet p=(set ship) q=diff:fleet]
+ [%cabal p=sect q=diff:cabal]
+ [%channel p=nest q=diff:channel]
+ [%bloc p=diff:bloc]
+ [%cordon p=diff:cordon]
+ [%zone p=diff:zone]
+ [%meta p=data:meta]
+ [%secret p=?]
+ [%create p=group]
+ [%del ~]
+ ==
+::
+:: $action: the complete set of data required to edit a group
+::
++$ action
+ (pair flag update)
+::
+:: $update: a representation in time of a modification of a group
+::
++$ update
+ (pair time diff)
+::
+:: $create: a request to make a group
+::
++$ create
+ $: name=term
+ title=cord
+ description=cord
+ image=cord
+ cover=cord
+ =cordon
+ members=(jug ship sect)
+ secret=?
+ ==
+::
++$ init [=time =group]
+::
++$ groups
+ (map flag group)
++$ net-groups
+ (map flag [net group])
+::
+:: $log: a time ordered map of all modifications to groups
+::
++$ log
+ ((mop time diff) lte)
+::
+++ log-on
+ ((on time diff) lte)
+::
+:: $net: an indicator of whether I'm a host or subscriber
+::
++$ net
+ $~ [%pub ~]
+ $% [%pub p=log]
+ [%sub p=time load=_| =saga:e]
+ ==
+::
+:: $join: a join request, can elect to join all channels
+::
++$ join
+ $: =flag
+ join-all=?
+ ==
+::
+:: $knock: a request to enter a closed group
+::
++$ knock flag
+::
+:: $progress: the state of a group join
+::
++$ progress
+ ?(%knocking %adding %watching %done %error)
+::
+:: $claim: a mark for gangs to represent a join in progress
+::
++$ claim
+ $: join-all=?
+ =progress
+ ==
+::
+:: $preview: the metadata and entry policy for a group
+::
++$ preview
+ $: =flag
+ meta=data:meta
+ =cordon
+ =time
+ secret=?
+ ==
+::
++$ previews (map flag preview)
+::
+:: $invite: a marker to show you've been invited to a group
+::
++$ invite (pair flag ship)
+::
+:: $gang: view of foreign group
+::
++$ gang
+ $: cam=(unit claim)
+ pev=(unit preview)
+ vit=(unit invite)
+ ==
+::
++$ gangs (map flag gang)
+--
+-- \ No newline at end of file