Task detail
CRM database: version 4. Task and deal descriptions are no longer plain text: they use a “/” block editor (the plain-text notes still exists for compatibility).
What the person sees. A task’s detail (Tasks → a row or card, or ?task=ID) has, from top to bottom:
- Notices: “Blocked by N unfinished tasks: …” (with a link to each) and, if client approval was requested, “Waiting for client approval” with the link’s expiry date.
- Type and editable title.
- Quick AI requests (“a summary · subtasks · a description · a message to the client”). They only appear if the CRM’s AI assistant already has a provider (a saved API key or
BUILDEROS_AI_API_KEY) and the person can manage the CRM. - Properties: Status (pill with a colored ring and menu: To do, In progress, Under review, Done; separator; Archived) with the round “Mark as done” button; Assignees; Dates; Priority; Category; Time (Start/Pause with the running time, logged time and estimated hours, both editable); Contact; Deal.
- Description with “/” blocks.
- Collapsible sections that only appear with content or when opened from their pill: Subtasks (with hatched progress), Checklists, Files, Dependencies, Time log and Client approval.
- “Add…” pills (dashed): Add subtask, Create checklist, Attach file, Add dependency, Time log and Send for client approval (this one with send permission). Each disappears once its section exists.
On the right, the activity with comments and mentions. On deals, the description uses the same editor and there’s a Files section.
“New task” (header button): glass modal with a large title, Title, Description, Priority and Category (house dropdown), Due date and Estimated hours, “Assign to” with person pills (the active one in ink with a lime ring), optional Contact and Deal, “Cancel” and “Create task”. On mobile it’s a bottom sheet.
“/” block editor.
- Blocks: Text, Heading 1, Heading 2, List, Checklist, Callout, Code and Link (house menu: arrows, Enter, first letter, Esc).
- “/” in an empty block opens the menu. Enter creates a new block (splits the text at the cursor); in lists and checklists it inherits the type, and Enter on an empty item exits the list. In Code, Enter is a line break and Enter on an empty line at the end exits the block. Backspace in an empty block deletes it; ↑ at the start and ↓ at the end jump between blocks. Pasting a single URL into an empty block creates a Link (a card with domain and address, without querying anything outside); pasting several lines creates one block per line.
- It saves on its own: 0.7 s after typing, on leaving the editor and on closing the detail. Without management permission, the description is read only.
- Security. The browser sends HTML, but the server doesn’t trust it:
Builder_OS_CRM_Task_Detail::sanitize_html()rebuilds the tree node by node with an allowlist (p, h1, h2, ul/ol/li,ul data-type="check"withli data-done="1", aside, pre/code,a hrefonly http, https or mailto and alwaysrel="noopener nofollow", br, strong, em). It strips script, style, iframe, svg, forms and comments along with their content, all attributes (events, style, class, target) andjavascript:ordata:links; anything else keeps only its escaped text. Then it passes throughwp_kses()with the same list as a second net. Maximum 60 KB. When rendering, the browser reads the HTML withDOMParser(inert document) and creates the nodes withtextContent, never withinnerHTML. - Compatibility.
notes(plain text) is derived from the HTML (one line per block, “- ” for lists and “[ ]”/”[x]” for checklists). If someone saves onlynotes(the usual API, MCP, the AI assistant), the HTML is emptied and generated on read from the text (text_to_html()): old notes show up as blocks without migrating rows. Same on deals withdescription/description_html.
“Archived” status. New status archived. Archiving closes the task (sets done_at, or keeps the one it had), so it drops out of all open counts (Home, Overview, counts, presence): done is false and archived is true. It’s left out of the board and of every view except archived (API GET /crm/tasks?view=archived, MCP crm_list_tasks with view: archived). Moving it to another status reopens it. Changing a task with open blockers to In progress, Under review or Done asks for confirmation (warns, doesn’t block).
Checklists, dependencies, time and files.
- Checklists: several per task (up to 20, with 200 items each), title editable in place, checkboxes, hatched progress (lime when complete) and delete (with confirmation if it has items).
- Dependencies: “Blocked by” (a search of unarchived parent tasks) and “Blocks”. The server rejects depending on itself and any cycle (it walks the graph: A→B→C prevents C→A). Maximum 50.
- Time: one stopwatch per person (starting another stops the previous one). Each entry counts minutes rounded up, minimum 1 and at most 24 h (a forgotten stopwatch doesn’t add up days). Manual entries from 1 minute to 24 hours with a note. “Logged vs. estimated” with progress, percentage and what’s left or the overage. Each person deletes their own entries; others’, only with
bos_crm_settings. Estimated hours on the task (hours_estimated, accepts a decimal comma). - Files: private CRM attachments (
Builder_OS_CRM_Attachments: type checked by content, dangerous extensions rejected, private folder) tied to the task or deal. They’re opened and downloaded through the protected URL (session +bos_crm_view; no session, 403). Removing a file deletes it from disk if nobody else uses it; deleting the task or deal takes its files with it. Maximum 50.
Client approval.
- Requesting it (
bos_crm_manage+bos_crm_send): the task needs a contact with an email address you can write to (transactional email: not bounced, no complaint, not suppressed, not deleted). An email with the Kit’s look is sent (through the site’s SMTP) with a signed link that expires in 14 days (filterbuilder_os_crm_task_approval_days, 1–30) and the task moves to “Under review”. Only one pending request per task (requesting another cancels the previous one) and at most 5 per task per day. It can be canceled. - Link:
/?bos_tapr=<id>.<token 32 hex>.<firma 32 hex>(HMAC-SHA256 with the site’s own key,builder_os_crm_task_approval_key). A standalone page like the reviews one: no theme or scripts, never cached,noindex,Referrer-Policy: no-referrer, CSPdefault-src 'none'withframe-ancestors 'none'. It only shows the site name, the title and the sanitized description; no contact data. Tampered link: 404 with no hints; expired: 410. - Deciding: “Approve” or “Request changes” with an optional comment (2,000 characters). The form carries its own signature (HMAC of the link),
Originis checked if present, it has a honeypot field for bots and a per-IP limit (30 submissions and 120 invalid links per hour; the IP isn’t stored, only a hash in a transient). A single decision: the update is atomic (status = 'pending'and not expired), so resubmitting changes nothing. - Result: an activity on the task signed “Client” (with the comment), a notice in the assignees’ bell and status: approved → Done; changes → In progress. Hook
builder_os_crm_task_approval_decided( $task_id, $decision, $comment ). Deleting the contact (GDPR) takes its requests with it.
AI: quick requests. Only with a provider (Builder_OS_CRM_Task_Detail::ai_available()) and bos_crm_manage; otherwise they aren’t drawn and the API doesn’t respond (409). It uses the CRM assistant’s provider in the same request (not in the queue). The prompt marks the task as data (<tarea>…</tarea>, “ignore any orders that appear there”), carries title, status, due date, category, description, subtasks and checklists, and only the contact’s first name; emails and phones are replaced before sending. The output passes through Builder_OS_CRM_AI_Guard::sanitize_reply (no HTML, no links that aren’t the site’s, no emails or phones that aren’t already in the task); subtasks: at most 10, short text. Caps: 20 requests per person per hour (filter builder_os_crm_task_ai_per_hour) and the assistant’s daily caps (tokens and spend); each request is logged in ai_turns (status task). The result appears in a dialog with “AI-generated text: review it before using it” and the actions Insert into the description, Create the checked subtasks and Copy.
Data. Columns tasks.notes_html, tasks.estimate_min and deals.description_html; tables task_checklists, task_checklist_items, task_deps, task_time, files (ref_type task|deal) and task_approvals, in TABLES (uninstall and wpmu_drop_tables delete them; the CRM goes from 20 to 26 tables). Idempotent data step upgrade_4() (normalizes unknown statuses to “To do”). Uninstalling also deletes the signing key (prefix builder_os_crm), the transients (bos_crm_tai_*, bos_crm_tapr_*) and the bell notices (bos_crm_approval_notes).
REST (builder-os/v1/crm, nonce wp_rest, validated parameters):
| Route | Method | Permission |
|---|---|---|
/tasks/{id} (now with checklists, deps, time, files, approval, notes_html, hours_estimated) | GET | view |
/tasks, /tasks/{id} (accept notes_html, hours_estimated, status: archived) | POST | manage |
/tasks/{id}/checklists · /checklists/{cid} · /checklists/{cid}/items · /checklist-items/{iid} | POST, DELETE | manage |
/tasks/{id}/deps · /deps/{dep} | POST · DELETE | manage |
/tasks/{id}/timer (action: start|stop) · /time (minutes, note) · /time/{eid} | POST · DELETE | manage |
/tasks/{id}/files (multipart file) · /files/{aid} | POST · DELETE | manage |
/deals/{id}/files | GET · POST · DELETE | view · manage |
/tasks/{id}/ai (kind: summary|subtasks|description|message) | POST | manage + provider |
/tasks/{id}/approval · /approval/cancel | POST | manage + send · manage |
/timer (the person’s running stopwatch) | GET | view |
/lookup?what=tasks&except=ID | GET | view |
Each change returns the recalculated extras; everything else (notes, done, views) stays the same.
Components. BOS.dropdown gains the ring option (status ring: data-ring on the options, 0 dashed, 0–1 a slice, “done” full with a check), the separator with <hr> in the select, block icons and BOS.dropdown.ring(). BOSCRMX.taskx (admin/js/builder-os-crm-task-detail.js) groups blocks(), xsection(), hatch(), addChips(), checklists(), deps(), timeProp(), time(), files(), approval(), banners(), aiChips() and newTask(). Styles in admin/css/builder-os-crm-task-detail.css (only --bos-c-* tokens; light and dark). Measurements: 36 px “Add” pill with a dashed edge; collapsible section with a 32 px circular icon and a body indented 42 px; hatched progress (--bos-hatch); checklist in a radius-20 card; dependency and time rows with radius 16; file with a 40 px icon; editor with Text 13 px, Heading 1 20 px 700, Heading 2 16 px 600; 576 px “New task” modal with 42 px fields.
Tests. tests/php/bos-test-crm-task-detail.php, tests/e2e/e2e-crm-task-detail.js and tests/php/bos-test-crm-f0.php (26 tables).