urbit/ape/work.hoon

255 lines
7.3 KiB
Plaintext
Raw Normal View History

2015-08-20 04:37:09 +03:00
:: XX need to deal with versions and date modified
2015-08-20 01:40:03 +03:00
::
::::
::
/? 314
2015-08-20 03:36:40 +03:00
/- *work
2015-08-20 01:40:03 +03:00
/+ talk
!:
::::
::
|%
++ move (pair bone card) :: all actions
++ card :: general card
2015-08-20 03:36:40 +03:00
$% [%diff %work-report client] ::
2015-08-20 01:40:03 +03:00
[%peer wire dock path] ::
[%poke wire dock pear] ::
== ::
++ pear :: poke fruit
2015-08-20 03:36:40 +03:00
$% [%talk-command command:talk] ::
2015-08-20 01:40:03 +03:00
== ::
--
!:
::::
::
2015-08-20 22:53:35 +03:00
|_ [bowl client connected=_| claiming=?]
2015-08-20 01:40:03 +03:00
++ at
2015-08-20 03:36:40 +03:00
|= [task audience=(set station:talk)]
=* tax +<-
2015-08-20 01:40:03 +03:00
=| moves=(list move)
|%
++ abet
^- [(list move) _+>.$]
2015-08-20 22:53:35 +03:00
[(flop moves) +>.$(tasks (~(put by tasks) id tax audience claiming))]
2015-08-20 01:40:03 +03:00
++ send
2015-08-20 03:36:40 +03:00
|= action=duty:work-stuff:talk
2015-08-20 01:40:03 +03:00
^+ +>
%_ +>.$
eny (sham eny action)
moves
2015-08-20 03:36:40 +03:00
:_ ~
^- move
2015-08-20 01:40:03 +03:00
:* ost %poke
2015-08-20 22:40:21 +03:00
/sending/(scot %uv id)/(scot %ud version)
2015-08-20 01:40:03 +03:00
[our %talk]
%talk-command
2015-08-20 03:36:40 +03:00
^- command:talk
2015-08-20 01:40:03 +03:00
:- %publish
|- ^- (list thought)
:_ ~
:+ (shaf %task eny)
2015-08-20 21:03:10 +03:00
%- mo ^- (list ,[partner envelope delivery]:talk)
%+ turn (~(tap in audience))
|=(sat=station:talk [[%& sat] [*envelope %pending]])
2015-08-20 01:40:03 +03:00
[now *bouquet [%tax action]]
==
==
2015-08-20 22:04:52 +03:00
++ claim
%_ .
eny (sham eny %direct)
moves
:_ ~
^- move
:* ost %poke
2015-08-20 22:40:21 +03:00
/claiming/(scot %uv id)
2015-08-20 22:04:52 +03:00
[our %talk]
%talk-command
^- command:talk
:- %publish
|- ^- (list thought)
:_ ~
:+ (shaf %task eny)
[[[%& owner (main owner)] [*envelope %pending]] ~ ~]
[now *bouquet [%tax %claim id]]
==
==
2015-08-20 03:36:40 +03:00
++ create (send `duty:work-stuff:talk`[%create `task`tax])
++ send-update |*(* (send %update id +(version) +<))
++ announce (send-update %announce ~)
2015-08-20 22:04:52 +03:00
++ release (cury send-update %release)
2015-08-20 03:36:40 +03:00
++ accept (send-update %accept ~)
++ delete (send-update %delete ~)
++ set-date-due (cury send-update %set-date-due)
++ set-tags (cury send-update %set-tags)
++ set-title (cury send-update %set-title)
++ set-description (cury send-update %set-description)
++ set-done (cury send-update %set-done)
++ add-comment (cury send-update %add-comment)
++ set-audience ~|(%not-implemented !!)
++ process-update
|= up=update
^+ +>
?- -.up
%add ?>(?=(%comment +<.up) (add-comment +>.up))
%own
?- +<.up
%announce announce
%claim claim
==
%set
?- +<.up
%date-due (set-date-due +>.up)
%title (set-title +>.up)
%description (set-description +>.up)
%tags (set-tags +>.up)
%done (set-done +>.up)
%audience ~|(%not-implemented !!) ::(set-audience +>.up)
==
==
2015-08-20 01:40:03 +03:00
--
::
++ initialize
^- [(list move) _.]
2015-08-20 04:37:09 +03:00
:_ .(connected %&) :_ ~
[ost %peer /peering [our %talk] /f/(main our)/0]
2015-08-20 01:40:03 +03:00
::
++ process-duty
2015-08-20 03:36:40 +03:00
|= [when=@da her=ship from=(set station:talk) action=duty:work-stuff:talk]
2015-08-20 01:40:03 +03:00
^- [(list move) _+>.$]
2015-08-20 22:04:52 +03:00
=- =^ mof con mirror-to-web:con
[(welp mos mof) con]
^- [mos=(list move) con=_+>.$]
2015-08-20 01:40:03 +03:00
?- -.action
2015-08-20 22:04:52 +03:00
%create :: XX should verify ownership
=+ existing-task=(~(get by tasks) id.p.action)
2015-08-20 03:36:40 +03:00
~? ?& ?=(^ existing-task)
!=(p.action task.u.existing-task)
2015-08-20 03:36:40 +03:00
==
:* %new-task-with-old-id
2015-08-20 01:40:03 +03:00
her=her
from=from
new-task=p.action
2015-08-20 01:40:03 +03:00
existing-task=u.existing-task
==
=. tasks
2015-08-20 22:40:21 +03:00
%^ ~(put by tasks) id.tax.action tax.action
2015-08-20 22:53:35 +03:00
:_ |
2015-08-20 01:40:03 +03:00
?~ existing-task from
(~(uni in audience.u.existing-task) from)
=. sort ?~(existing-task sort [id.p.action sort])
2015-08-20 22:04:52 +03:00
[~ +>.$]
::
%claim
abet:(release:(at (~(got by tasks) id.action)) her)
2015-08-20 01:40:03 +03:00
::
%update
=+ tax=(~(get by tasks) id.action)
?~ tax
2015-08-20 03:36:40 +03:00
~& :* %update-for-nonexistent-task
2015-08-20 01:40:03 +03:00
her=her
from=from
action=action
==
2015-08-20 22:04:52 +03:00
[~ +>.$]
2015-08-20 03:36:40 +03:00
?. =(version.action +(version.task.u.tax))
~& :* %update-bad-version
2015-08-20 01:40:03 +03:00
her
from=from
action=action
tax=tax
==
2015-08-20 22:04:52 +03:00
[~ +>.$]
2015-08-20 01:40:03 +03:00
=. tasks
%^ ~(put by tasks) id.action
2015-08-20 03:36:40 +03:00
?: ?& ?=(?(%announce %release %accept) -.meat.action)
!=(her owner.task.u.tax)
2015-08-20 01:40:03 +03:00
==
2015-08-20 03:36:40 +03:00
~& :* %not-owner
2015-08-20 01:40:03 +03:00
her=her
from=from
action=action
tax=tax
==
task.u.tax
?- -.meat.action
%announce task.u.tax(status %announced)
2015-08-20 22:04:52 +03:00
%release task.u.tax(owner her.meat.action, status %released)
2015-08-20 01:40:03 +03:00
%accept task.u.tax(status %accepted)
2015-08-20 22:04:52 +03:00
%delete ~|(%not-implemented !!)
%set-date-due task.u.tax(date-due wen.meat.action)
%set-tags task.u.tax(tags tag.meat.action)
%set-title task.u.tax(title til.meat.action)
%set-description task.u.tax(description des.meat.action)
%set-done task.u.tax(done ?.(don.meat.action ~ `when))
2015-08-20 01:40:03 +03:00
%add-comment
2015-08-20 03:36:40 +03:00
%= task.u.tax
2015-08-20 22:04:52 +03:00
discussion [[when her com.meat.action] discussion.task.u.tax]
2015-08-20 03:36:40 +03:00
==
2015-08-20 01:40:03 +03:00
==
2015-08-20 22:53:35 +03:00
:- (~(uni in audience.u.tax) from)
claiming.u.tax
2015-08-20 22:04:52 +03:00
?: =([%release our] meat.action)
abet:accept:(at (~(got by tasks) id.action))
[~ +>.$]
2015-08-20 01:40:03 +03:00
==
::
++ mirror-to-web
^- [(list move) _.]
2015-08-20 04:37:09 +03:00
~& [%mirroring tasks=tasks sort=sort]
2015-08-20 01:40:03 +03:00
:_ .
2015-08-20 04:37:09 +03:00
%+ murn (~(tap by sup))
|= [ust=bone her=ship pax=path]
^- (unit move)
?: ?=([%sole *] pax)
~
`[ust %diff %work-report tasks sort]
::
++ coup
|= [way=wire saw=(unit tang)]
^- [(list move) _+>.$]
?> ?=(~ saw)
[~ +>.$]
2015-08-20 01:40:03 +03:00
::
++ reap-peering
|= [way=wire saw=(unit tang)]
^- [(list move) _+>.$]
?> ?=([~ ~] +<)
[~ +>.$]
::
2015-08-20 03:36:40 +03:00
++ poke-work-command
|= cod=command
=^ mos +>.$
?: connected
[~ +>.$]
initialize
=^ mof +>.$
?- -.cod
%new abet:create:(at +.cod)
%old abet:(process-update:(at (~(got by tasks) id.cod)) dif.cod)
2015-08-20 04:37:09 +03:00
%sort ~|(%not-implemented !!)
2015-08-20 03:36:40 +03:00
==
[(welp mos mof) +>.$]
::
2015-08-20 01:40:03 +03:00
:: XX maybe need to check that we haven't received this message before
:: by keeping a counter of last message received
2015-08-20 04:37:09 +03:00
++ diff-talk-report
|= [way=wire rep=report:talk]
2015-08-20 01:40:03 +03:00
^- [(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
2015-08-20 03:36:40 +03:00
=+ ^- from=(set station:talk)
%- sa ^- (list station:talk)
2015-08-20 01:40:03 +03:00
%+ murn (~(tap by q.q.i.q.rep))
2015-08-20 03:36:40 +03:00
|= [par=partner *]
`(unit station:talk)`?.(?=(%& -.par) ~ `p.par)
2015-08-20 01:40:03 +03:00
?. ?=(%tax -.said)
$(p.rep +(p.rep), q.rep t.q.rep)
2015-08-20 03:36:40 +03:00
=^ mos +>.^$ (process-duty when her from +.said)
2015-08-20 01:40:03 +03:00
=^ mof +>.^$ $(p.rep +(p.rep), q.rep t.q.rep)
[(weld mos mof) +>.^$]
--