Skip to main content

Module task

Module task 

Source
Expand description

Task block: files a Kanban task for an agent, or for the backlog (the Drone real-world jobs spec §4.2).

Block config (node.data):

  • title required. The graph’s words; each {{...}} value is quoted data (§6.2).
  • body optional, the task’s text, quoted the same way.
  • target optional, the agent’s id; empty is the backlog. Written in the graph, never a {{reference}}: a value from outside must not pick who gets the work (§6.2).
  • dedupe optional, “one task per incident”: a second run with the same key adds a line to the open task instead of filing another. The key may be built from a reference (it only finds a task; it names no one). It is kept per node and target: another node, or the same node with another target, with the same text has its own task.

Output: { "filed": bool, "task": <number>, "work_id": "<id>" }; filed is false when the run added a line to an open task with the same key.

A task this block files carries the drone’s tag (created_by_uid, drone:<id>), which is what the note mode below finds it by.

Note mode: with note_task in the config the block adds a line to a task instead of filing one.

  • note_task the task’s number (12 or #12), which may be a {{reference}}: it only finds a task, and the block adds to a task this drone filed and to no other (a task filed by another drone, an agent or a person is refused, whatever number is given).
  • note required, the line’s text; each {{...}} value is quoted data (§6.2).

Output: { "updated": true, "task": <number>, "work_id": "<id>" }; any refusal fails the block.

Structs§

NoteSpec 🔒
The note a block adds to a task its drone filed.
TaskSpec 🔒
What the block files.

Constants§

FILED_BY 🔒
Who the task’s history says filed it.
KEY_PREFIX 🔒
The key line that opens a deduplicated task’s text.
OPEN_STATES 🔒
The states in which a task is still open for the dedupe: it is not done, failed or cancelled.
TASK_KIND 🔒
The tasks’ kind; the dedupe looks only at these.

Statics§

DEDUPE_LOCK 🔒
Held from looking for an open task with the key to filing one, so two runs with the same key at once can’t both find none. Never held across an await.

Functions§

add_note 🔒
Add the note to the task, which must be one this drone filed. Every refusal is an error, so a graph that tries to write on another’s task fails at that block instead of carrying on.
compose 🔒
The task the node describes. Pure, so the quoting and the rules are testable without a server.
compose_note 🔒
The note the node describes. Pure, so the number and the quoting are testable without a server.
file_or_repeat 🔒
File the task, or add a line to the open one with the same key. Synchronous end to end, so the lock covers the lookup and the insert and is never held across an await.
find_open 🔒
The open task that carries key, if there is one.
hash_key 🔒
A short stable hash of the key with the drone, the node and the target, so the stored line carries no text from outside and another drone, another node or another target doesn’t share the task (node ids are only unique inside one graph).
is_note 🔒
Whether the node adds a note instead of filing a task: it has a note_task with something in it (the editor leaves an empty one behind when the field is cleared).
line_for_repeat 🔒
The line a repeat adds to the open task.
owner_tag 🔒
The tag a task carries when the drone drone_id filed it. A scope outside a saved drone has none.
run