From 782fecef585c7410f8f61ffbae17d12e09b67cea Mon Sep 17 00:00:00 2001 From: Philip C Monk Date: Wed, 19 Aug 2015 18:40:03 -0400 Subject: [PATCH] work stuff --- ape/work.hoon | 171 ++++++++++++++++++++++++++++++++++++++++++++++++++ sur/talk.hoon | 40 ++++++++++++ sur/work.hoon | 2 +- 3 files changed, 212 insertions(+), 1 deletion(-) create mode 100644 ape/work.hoon diff --git a/ape/work.hoon b/ape/work.hoon new file mode 100644 index 000000000..b17532b77 --- /dev/null +++ b/ape/work.hoon @@ -0,0 +1,171 @@ +:: +:::: + :: +/? 314 +/- *talk, *work +/+ talk +!: +:::: + :: +|% +++ move (pair bone card) :: all actions +++ card :: general card + $% [%diff lime] :: + [%peer wire dock path] :: + [%poke wire dock pear] :: + == :: +++ pear :: poke fruit + $% [%talk-command command] :: + == :: +-- +!: +:::: + :: +|_ [hid=bowl client] +++ at + |= [task audience=(set station)] + =| moves=(list move) + |% + ++ abet + ^- [(list move) _+>.$] + [(flop moves) +>.$(tasks (~(put by tasks) tax))] + ++ send + |= action=duty + ^+ +> + %_ +>.$ + eny (sham eny action) + moves + :* ost %poke + /sending/(scot %uw id)/(scot %ud version) + [our %talk] + %talk-command + ^- command + :- %publish + |- ^- (list thought) + :_ ~ + :+ (shaf %task eny) + [[[%& our %tasks] [*envelope %pending]] ~ ~] + [now *bouquet [%tax action]] + == + == + ++ update |*(* (send %update id +(version) +<)) + ++ announce (update %announce ~) + ++ release (cury update %announce) + ++ accept (update %accept ~) + ++ delete (update %delete ~) + ++ set-due-date (cury update %set-due-date) + ++ set-tags (cury update %set-tags) + ++ set-title (cury update %set-title) + ++ set-description (cury update %set-description) + ++ set-complete (update %set-complete ~) + ++ add-comment (cury update %add-comment) + -- +:: +++ initialize + ^- [(list move) _.] + :_ . :_ ~ + [ost %peer /peering [our %talk] /f/tasks/0] +:: +++ process-duty + |= [when=@da her=ship from=(set station) action=duty] + ^- [(list move) _+>.$] + =< mirror-to-web + ?- -.action + %proclaim + :- ~ + =+ existing-task=(~(get by tasks) id.p.action) + ~? !=(p.action u.existing-task) + $: %new-task-with-old-id + her=her + from=from + new-task=p.action + existing-task=u.existing-task + == + =. tasks + %^ ~(put by tasks) id.p.action p.action + ?~ existing-task from + (~(uni in audience.u.existing-task) from) + =. sort ?~(existing-task sort [id.p.action sort]) + +>.$ + :: + %update + =+ tax=(~(get by tasks) id.action) + ?~ tax + ~& $: %update-for-nonexistent-task + her=her + from=from + action=action + == + [~ +>.$] + ?. =(version.action +(version.u.tax)) + ~& $: %update-bad-version + her + from=from + action=action + tax=tax + == + [~ +>.$] + =. tasks + %^ ~(put by tasks) id.action + ?: $& ?=(?(%announce %release %accept) -.meat.action) + !=(her owner.task.u.tax)) + == + ~& $: %not-owner + her=her + from=from + action=action + tax=tax + == + task.u.tax + ?- -.meat.action + %announce task.u.tax(status %announced) + %release task.u.tax(owner p.meat.action, status %released) + %accept task.u.tax(status %accepted) + %delete !! + %set-due-date task.u.tax(date-due p.meat.action) + %set-tags task.u.tax(tags p.meat.action) + %set-title task.u.tax(title p.meat.action) + %set-description task.u.tax(description p.meat.action) + %set-complete task.u.tax(complete `when) + %add-comment + task.u.tax(discussion [[when her p.meat.action] discussion) + == + (~(uni in audience.u.tax) from) + +>.$ + == +:: +++ mirror-to-web + ^- [(list move) _.] + :_ . + %+ turn (~(tap by sup.hid)) + |= [ust=bone *] + [ust %diff %work-report tasks sort] +:: +++ reap-peering + |= [way=wire saw=(unit tang)] + ^- [(list move) _+>.$] + ?> ?=([~ ~] +<) + [~ +>.$] +:: +:: XX maybe need to check that we haven't received this message before +:: by keeping a counter of last message received +++ diff-peering + |= [way=wire %talk-report rep=report] + ^- [(list move) _+>.$] + ?> ?=(%grams -.rep) + |- ^- [(list move) _+>.^$] + ?~ q.rep [~ +>.^$] + =* her p.i.q.rep + =* when p.r.q.i.q.rep + =* said r.r.q.i.q.rep + =+ ^- from=(set station) + %- sa + %+ murn (~(tap by q.q.i.q.rep)) + |= par=partner + `(unit station)`?.(?=(%& -.par) ~ `par) + ?. ?=(%tax -.said) + $(p.rep +(p.rep), q.rep t.q.rep) + =^ mos +>.^$ (process-duty her when from said) + =^ mof +>.^$ $(p.rep +(p.rep), q.rep t.q.rep) + [(weld mos mof) +>.^$] +-- diff --git a/sur/talk.hoon b/sur/talk.hoon index 062fb1825..51d1148d1 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -64,6 +64,7 @@ [%lin p=? q=@t] :: no=@, text line [%mor p=(list speech)] :: multiplex [%app p=@tas q=@t] :: app message + [%tax p=duty] :: == :: ++ serial ,@uvH :: unique identity ++ partner (each station passport) :: interlocutor @@ -77,6 +78,45 @@ [%text (list ,@t)] :: text lines [%tank (list tank)] :: tank list == :: +:: work stuff :: +++ duty :: + $% [%proclaim p=task] :: create new task + $: %update :: operate on task + id=@uvH :: which task + version=@u :: version + $= meat :: + $% [%announce ~] :: make available + [%release p=ship] :: pass to new owner + [%accept ~] :: accept pass + [%delete ~] :: delete task + [%set-due-date p=@da] :: set due date + [%set-tags p=(set ,@t)] :: set tags + [%set-title p=@t] :: set title + [%set-description p=@t] :: set description + [%set-complete ~] :: set complete + [%add-comment p=@t] :: add comment + == :: + == :: + == :: +++ task :: + $: id=@uvH :: + date-created=@da :: + version=@u :: + date-modified=@da :: + owner=@p :: + status=status :: + tags=(set @t) :: + date-due=@da :: + title=@t :: + description=@t :: + discussion=(list comment) :: + == :: +++ comment :: + $: date=@da :: + ship=@p :: + body=@t :: + == :: +++ status ?(%announced %released %accepted) :: :: markdown :: image :: mime object diff --git a/sur/work.hoon b/sur/work.hoon index c6224725e..8be8a4a04 100644 --- a/sur/work.hoon +++ b/sur/work.hoon @@ -26,7 +26,7 @@ ship=@p body=@t == -++ status ?(%took %gave %left) +++ status ?(%announced %released %accepted) ++ command $% [%new task] [%old id=@uvH dif=update]