| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <pstm-uri>/tasks/{task_id}</pstm-uri>
- <pstm-template>main</pstm-template>
- <script>
- // Live updates: the page subscribes to the global pulse (see the
- // entrypoint); whenever task or saddle state changes anywhere in
- // the app, the sealed refresh action rehydrates the task slot —
- // no fixed-interval polling. RFC bodies get the shared
- // text-highlight -> comment popover (see main.html). Design-task
- // plan reviews collect inline comments on the plan and submit them
- // as the block answer.
- if (window.statum) {
- (function () {
- 'use strict';
- function refreshTask(source) {
- var task = statum.read('task');
- if (!task || !task.refresh) return;
- statum.act(task.refresh).catch(function (error) {
- // Never silently: a failed refresh means the page is
- // drifting from the server (e.g. the realtime channel
- // starved by the browser's per-origin SSE cap).
- console.warn('[task] live refresh (' + source + ') failed:', error);
- });
- }
- statum.addStateListener('pulse', function () {
- refreshTask('pulse');
- });
- // Belt and braces for SSE starvation: browsers cap ~6
- // connections per origin over HTTP/1.1, and every open
- // terminal tab holds a /terminal-stream EventSource — when
- // the budget is exhausted the pulse channel is silently
- // starved. Refreshing on focus recovers without a manual
- // reload.
- document.addEventListener('visibilitychange', function () {
- if (document.visibilityState === 'visible') refreshTask('focus');
- });
- if (window.initQuoteComments) {
- window.initQuoteComments({
- matches: function (node) {
- return node.closest && node.closest('.rfc-body') != null
- && node.closest('[data-plan-body]') == null;
- },
- action: function () {
- var task = statum.read('task');
- return task && task.comment;
- }
- });
- }
- // Plan-review feedback: collected comments live in these maps
- // (keyed by block id) so statum re-renders never lose them;
- // the DOM list is rebuilt after every render cycle.
- var feedbackByBlock = {};
- var modeByBlock = {};
- var planPopover = null;
- statum.afterEvaluate(syncPlanFeedback);
- document.addEventListener('click', function (event) {
- if (!event.target.closest) return;
- var toggle = event.target.closest('[data-plan-toggle]');
- if (toggle) {
- hidePlanPopover();
- var review = toggle.closest('[data-plan-review]');
- var id = review && review.getAttribute('data-block-id');
- if (id) modeByBlock[id] = !modeByBlock[id];
- syncPlanFeedback();
- return;
- }
- var submit = event.target.closest('[data-plan-submit]');
- if (submit) {
- submitPlanFeedback(submit.closest('[data-plan-review]'));
- return;
- }
- var remove = event.target.closest('[data-plan-remove]');
- if (remove) {
- var entry = remove.closest('[data-plan-comment-id]');
- var blockId = remove.closest('[data-plan-review]').getAttribute('data-block-id');
- var list = feedbackByBlock[blockId] || [];
- var index = parseInt(entry.getAttribute('data-plan-comment-id'), 10);
- if (!isNaN(index) && list[index]) list.splice(index, 1);
- feedbackByBlock[blockId] = list;
- syncPlanFeedback();
- }
- });
- document.addEventListener('mouseup', function (event) {
- if (!event.target.closest) return;
- if (planPopover && planPopover.contains(event.target)) return;
- var body = event.target.closest('[data-plan-body]');
- if (!body) {
- hidePlanPopover();
- return;
- }
- var review = body.closest('[data-plan-review]');
- if (!review || review.getAttribute('data-plan-open') !== '1') return;
- var selection = window.getSelection();
- var text = selection ? String(selection.toString()).trim() : '';
- if (text.length === 0) {
- hidePlanPopover();
- return;
- }
- showPlanPopover(event.pageX, event.pageY, text, review);
- });
- document.addEventListener('mousedown', function (event) {
- if (planPopover && event.target.closest && event.target.closest('.plan-popover')) return;
- hidePlanPopover();
- });
- function showPlanPopover(x, y, quote, review) {
- hidePlanPopover();
- planPopover = document.createElement('div');
- planPopover.className = 'plan-popover';
- planPopover.style.left = Math.min(x, window.innerWidth - 140) + 'px';
- planPopover.style.top = y + 'px';
- var quoted = document.createElement('blockquote');
- quoted.textContent = quote;
- planPopover.appendChild(quoted);
- var body = document.createElement('textarea');
- body.placeholder = 'Your comment on the selected plan text';
- planPopover.appendChild(body);
- var actions = document.createElement('div');
- actions.className = 'actions';
- var add = document.createElement('button');
- add.type = 'button';
- add.className = 'primary';
- add.textContent = 'Add comment';
- add.addEventListener('click', function () {
- if (body.value.trim().length === 0) return;
- var id = review.getAttribute('data-block-id');
- var list = feedbackByBlock[id] || [];
- list.push({ quote: quote, body: body.value.trim() });
- feedbackByBlock[id] = list;
- hidePlanPopover();
- syncPlanFeedback();
- });
- var cancel = document.createElement('button');
- cancel.type = 'button';
- cancel.textContent = 'Cancel';
- cancel.addEventListener('click', hidePlanPopover);
- actions.appendChild(add);
- actions.appendChild(cancel);
- planPopover.appendChild(actions);
- document.body.appendChild(planPopover);
- body.focus();
- }
- function hidePlanPopover() {
- if (planPopover) {
- planPopover.remove();
- planPopover = null;
- }
- }
- function submitPlanFeedback(review) {
- if (!review) return;
- var id = review.getAttribute('data-block-id');
- var list = feedbackByBlock[id] || [];
- if (list.length === 0) {
- if (window.showToast) window.showToast('Highlight some plan text and add a comment first', 'error');
- return;
- }
- var task = statum.read('task');
- var block = null;
- (task && task.blocks || []).forEach(function (candidate) {
- if (String(candidate.id) === String(id)) block = candidate;
- });
- if (!block || !block.answer_action) return;
- var answer = list.map(function (item) {
- return item.quote
- ? '> ' + item.quote.replace(/\n/g, '\n> ') + '\n\n' + item.body
- : item.body;
- }).join('\n\n');
- // Free-text feedback rides the `feedback` field so the
- // action wraps it in the stable verdict wording (the
- // answer IS the resume_notice the daemon reads).
- var extra = review.querySelector('[data-plan-feedback] textarea[name="feedback"]');
- if (extra && extra.value.trim().length > 0) {
- answer += '\n\n' + extra.value.trim();
- }
- feedbackByBlock[id] = [];
- modeByBlock[id] = false;
- statum.act(block.answer_action, { feedback: answer }).catch(function () { });
- }
- function syncPlanFeedback() {
- document.querySelectorAll('[data-plan-review]').forEach(function (review) {
- var id = review.getAttribute('data-block-id');
- var open = modeByBlock[id] ? '1' : '0';
- review.setAttribute('data-plan-open', open);
- var feedback = review.querySelector('[data-plan-feedback]');
- if (feedback) {
- if (modeByBlock[id]) feedback.removeAttribute('hidden');
- else feedback.setAttribute('hidden', '');
- }
- var list = review.querySelector('[data-plan-comments]');
- if (!list) return;
- while (list.firstChild) list.removeChild(list.firstChild);
- (feedbackByBlock[id] || []).forEach(function (item, index) {
- var entry = document.createElement('li');
- entry.setAttribute('data-plan-comment-id', String(index));
- if (item.quote) {
- var quoted = document.createElement('blockquote');
- quoted.textContent = item.quote;
- entry.appendChild(quoted);
- }
- var body = document.createElement('div');
- body.textContent = item.body;
- entry.appendChild(body);
- var remove = document.createElement('button');
- remove.type = 'button';
- remove.className = 'inline';
- remove.setAttribute('data-plan-remove', '');
- remove.textContent = 'Remove';
- entry.appendChild(remove);
- list.appendChild(entry);
- });
- });
- }
- })();
- }
- </script>
- </head>
- <body>
- <section>
- <h2 stm-if="task != null && task.exists">#<span stm-text="task.id">id</span> —
- <span stm-text="task.title">title</span></h2>
- <p stm-if="task != null && !task.exists" class="muted">Task not found.</p>
- <div stm-if="task != null && task.exists">
- <p><a href="/tasks">All tasks</a> · project
- <a stm-attribute.href="'/projects/' + task.project_id" stm-text="task.project_name">project</a>
- <span stm-if="task.enqueue_after_task_id > 0"> · auto-enqueues after
- <a stm-attribute.href="'/tasks/' + task.enqueue_after_task_id"
- stm-text="'#' + task.enqueue_after_task_id">after</a></span></p>
- <!-- Progress feed ABOVE the status card (plan 11 task D):
- the agent's newest line leads the page, its history
- behind the "Show history" expander. -->
- <h3>Progress</h3>
- <div stm-if="task.progress.length > 0">
- <p class="progress-latest" stm-text="task.progress[0].summary">latest</p>
- <p class="muted" stm-text="'reported ' + task.progress[0].when_display">when</p>
- <details class="history-expander" stm-if="task.progress.length > 1">
- <summary>Show history (<span stm-text="task.progress.length">0</span> updates)</summary>
- <ul class="progress-history">
- <li stm-for-item-in="task.progress">
- <span class="muted" stm-text="item.when_display">when</span> —
- <span stm-text="item.summary">summary</span>
- </li>
- </ul>
- </details>
- </div>
- <p stm-if="task.progress.length == 0" class="muted">No progress reports yet — the agent reports via
- <code>saddle progress-update</code>.</p>
- <!-- Agent celebrations (`saddle yeehaw <message>`): the task's
- newest entries as one festive card — distinct 🤠 styling,
- the message + when, capped at the last 3 with a "+N more"
- hint. Absent entirely while the task has none. -->
- <section class="card yeehaw-card" stm-if="task.yeehaw">
- <h3>🤠 Yeehaw!</h3>
- <ul class="yeehaw-list">
- <li stm-for-yeehaw-in="task.yeehaws">
- <span class="yeehaw-message" stm-text="yeehaw.message">message</span>
- <span class="muted" stm-text="yeehaw.when_display">when</span>
- </li>
- </ul>
- <p class="muted" stm-if="task.yeehaw_more > 0">+<span stm-text="task.yeehaw_more">0</span>
- more yeehaw<span stm-text="task.yeehaw_more == 1 ? '' : 's'"></span> on the
- <a stm-attribute.href="'/tasks/' + task.id + '/terminal'"
- target="_blank" rel="noopener">terminal log</a></p>
- </section>
- <!-- Status + description side by side in a 50/50 grid (plan
- 11 task D), collapsing to stacked
- status-then-description on small screens. The
- lifecycle buttons ride the status card (plan 11): new
- tasks are drafts — Enqueue and Delete in draft (delete
- guarded by dependents), Cancel in non-draft
- non-terminal; completion is agent-only. -->
- <div class="grid-2">
- <section class="card status-head">
- <h3>Status <span class="badge badge-yeehaw status-corner" stm-if="task.yeehaw"
- title="The agent celebrated this task (saddle yeehaw)">🤠</span></h3>
- <p><span stm-attribute.class="'badge badge-' + task.status" stm-text="task.display">status</span>
- <span stm-attribute.class="'badge badge-mode-' + task.mode" stm-text="task.mode">mode</span>
- · priority <strong stm-text="task.priority">5</strong></p>
- <p class="muted" stm-if="task.enqueue_after_task_id > 0">Auto-enqueues after
- <a stm-attribute.href="'/tasks/' + task.enqueue_after_task_id"
- stm-text="'#' + task.enqueue_after_task_id + ' ' + task.enqueue_after_title">after</a></p>
- <p class="muted">Created <span stm-text="task.created_display">when</span></p>
- <p class="muted" stm-if="task.started_display.length > 0">Started <span stm-text="task.started_display">when</span></p>
- <p class="muted" stm-if="task.completed_display.length > 0">Completed <span stm-text="task.completed_display">when</span></p>
- <p stm-if="task.task_branch.length > 0">Branch: <strong stm-text="task.task_branch">branch</strong>
- <span class="muted" stm-if="task.branch_from.length > 0"> from <span stm-text="task.branch_from">base</span></span></p>
- <p stm-if="task.working_branch.length > 0" class="muted">Working branch: <span stm-text="task.working_branch">branch</span></p>
- <p stm-if="task.status == 'suspended'" class="muted">Parked (`saddle suspend`) —
- the goal agent resumes on its goal's task events, with the
- batched status report riding the resume.</p>
- <form class="inline">
- <input type="hidden" name="task_id" stm-attribute.value="task.id">
- <button type="button" stm-if="task.draft" class="primary"
- stm-action="task.enqueue">Enqueue task</button>
- <button type="button" stm-if="task.draft"
- stm-action="task.delete"
- stm-confirm="Delete this draft task? This cannot be undone.">Delete</button>
- <button type="button" stm-if="task.status == 'failed'" class="primary"
- stm-action="task.retry">Retry task</button>
- <button type="button" stm-if="task.resume_available"
- stm-action="task.resume"
- stm-confirm="Requeue this task? The daemon restores its workspace context on the next dispatch.">Requeue to resume</button>
- <button type="button" stm-if="!task.draft && !task.terminal"
- stm-action="task.cancel" stm-confirm="Cancel this task?">Cancel task</button>
- </form>
- <form class="inline">
- <input type="hidden" name="task_id" stm-attribute.value="task.id">
- <button type="button" stm-action="task.toggle_notify"
- stm-text="task.notify_me ? 'Don't notify me' : 'Notify me'">Notify me</button>
- <span class="muted">— this task's first start, failure and completion
- (questions and reviews always notify subscribed users)</span>
- </form>
- </section>
- <!-- Plan 12: the goal reference — a goal task or the
- goal agent's own run links back to its goal. -->
- <section class="card" stm-if="task.goal_id > 0">
- <h3>Goal</h3>
- <p><span stm-attribute.class="'badge badge-' + task.goal_status"
- stm-text="task.goal_status.replace('_', ' ')">status</span>
- <a stm-attribute.href="'/goals/' + task.goal_id" stm-text="task.goal_title">goal</a></p>
- <p class="muted">Goal branch <code stm-text="task.goal_branch">branch</code>
- <span stm-if="task.is_goal_run">— this task IS the goal agent's run
- (orchestrate mode; the goal page owns its lifecycle)</span>
- <span stm-if="!task.is_goal_run">— this task runs under the goal agent's
- supervision on an ephemeral branch</span></p>
- </section>
- <!-- Plan 12: the mandate — the plan-11 "Description"
- card, framed as the binding work order. -->
- <section class="card">
- <h3>Mandate</h3>
- <div stm-if="task.description.length > 0" class="md" stm-markdown="task.description">description</div>
- <p class="muted" stm-if="task.description.length == 0">No mandate.</p>
- </section>
- </div>
- <!-- The heredoc completion report (`cat << 'EOF' | saddle
- done`): terminal tasks render tasks.summary as
- markdown (XSS-safe via stm-markdown) in this
- full-width card directly below the status/description
- grid — "Completion report" when done, "Failure
- summary" when failed; an empty summary renders no
- card. -->
- <section class="card completion-report"
- stm-if="task.terminal && task.summary.length > 0">
- <h3 stm-text="task.report_title">Completion report</h3>
- <div class="md" stm-markdown="task.summary">summary</div>
- </section>
- <!-- The edit expander sits UNDER the "Show history" expander
- (plan 11 task D): draft tasks edit every field except
- status; non-draft non-terminal tasks edit priority
- only; terminal tasks edit nothing. The description
- arrives pre-filled whenever it is editable. -->
- <details class="edit-expander" stm-if="task.editable_all || task.editable_priority">
- <summary><strong>Edit task</strong>
- <span class="muted" stm-if="task.editable_all">— every field except status while in draft</span>
- <span class="muted" stm-if="!task.editable_all && task.editable_priority">— priority only once work has begun</span></summary>
- <form stm-action="task.update" stm-if="task.editable_all">
- <input type="hidden" name="task_id" stm-attribute.value="task.id">
- <div class="form-row"><label>Title</label>
- <input type="text" name="title" stm-attribute.value="task.title"></div>
- <div class="form-row"><label>Mandate</label>
- <textarea name="description" rows="4" stm-attribute.value="task.description"></textarea></div>
- <div class="form-row" stm-if="!task.is_goal_run"><label>Mode</label>
- <select name="mode" stm-attribute.value="task.mode">
- <option value="implement">implement — build the change on a task branch</option>
- <option value="investigate">investigate — explore and report, no code changes</option>
- <option value="review">review — read and critique existing work</option>
- <option value="test">test — write and run tests</option>
- </select></div>
- <div class="form-row" stm-if="task.creator == 'human' && !task.is_goal_run"><label>Auto-enqueue after
- <span class="muted">(enqueues itself when the predecessor is done; none clears it)</span></label>
- <select name="enqueue_after_task_id">
- <option value="">none</option>
- <option stm-for-option-in="task.enqueue_after_options" stm-attribute.value="option.id"
- stm-text="'#' + option.id + ' ' + option.title">task</option>
- </select></div>
- <div class="form-row"><label>Priority (1–9)</label>
- <input type="number" name="priority" min="1" max="9" stm-attribute.value="task.priority"></div>
- <div class="form-row"><label>Task branch</label>
- <input type="text" name="task_branch" stm-attribute.value="task.task_branch" placeholder="task/<id>-<slug>"></div>
- <div class="form-row"><label>Branch from</label>
- <input type="text" name="branch_from" stm-attribute.value="task.branch_from"></div>
- <button type="submit">Save</button>
- </form>
- <form stm-action="task.update" stm-if="!task.editable_all && task.editable_priority">
- <input type="hidden" name="task_id" stm-attribute.value="task.id">
- <div class="form-row"><label>Priority (1–9)</label>
- <input type="number" name="priority" min="1" max="9" stm-attribute.value="task.priority"></div>
- <button type="submit">Save</button>
- </form>
- </details>
- <!-- Current blocks render in full (plan 11 task D);
- answered ones fold behind the history expander. -->
- <h3>Blocks <span class="muted" stm-if="task.open_blocks.length > 0">(<span stm-text="task.open_blocks.length">0</span> open)</span></h3>
- <div stm-for-block-in="task.open_blocks" stm-key="block.id"
- stm-attribute.class="'block-card ' + block.block_type + (block.answered ? ' answered' : '')">
- <div stm-if="!block.answered && block.block_type == 'review'" class="review-banner">
- <h3>Review requested</h3>
- <div class="md" stm-markdown="block.body.length > 0 ? block.body : block.question">summary</div>
- <p>Branch <strong stm-text="task.task_branch">branch</strong>
- <a stm-if="task.review_diff_url.length > 0" stm-attribute.href="task.review_diff_url"
- target="_blank" rel="noopener">· compare changes</a></p>
- <div class="actions">
- <form stm-action="block.answer_action" class="inline">
- <input type="hidden" name="answer" value="Review approved. Continue with the task.">
- <button type="submit" class="approve">Approve</button>
- </form>
- <form stm-action="block.answer_action" class="inline">
- <textarea name="feedback" rows="2" placeholder="What should change?"></textarea>
- <button type="submit" class="reject">Request changes</button>
- </form>
- </div>
- </div>
- <div stm-if="!block.answered && block.is_plan_review" class="plan-review"
- data-plan-review stm-attribute.data-block-id="block.id">
- <div class="md rfc-body" stm-markdown="block.body" data-plan-body>plan</div>
- <div class="actions">
- <form stm-action="block.answer_action" class="inline">
- <input type="hidden" name="answer" value="Plan approved. Proceed with implementation.">
- <button type="submit" class="approve">Accept plan</button>
- </form>
- <button type="button" data-plan-toggle>Reject with feedback</button>
- </div>
- <div data-plan-feedback hidden>
- <p class="muted">Highlight plan text to attach a comment to it, then submit everything
- as feedback — the agent revises the plan and asks again.</p>
- <ul class="plan-comments" data-plan-comments></ul>
- <textarea name="feedback" rows="2" placeholder="Additional feedback (optional)"></textarea>
- <button type="button" class="primary" data-plan-submit>Submit feedback</button>
- </div>
- </div>
- <p><span stm-attribute.class="'badge badge-' + block.block_type" stm-text="block.block_type">type</span>
- <span class="muted" stm-text="block.created_display">when</span></p>
- <div stm-if="block.show_body && block.body.length > 0" class="md rfc-body"
- stm-markdown="block.body">body</div>
- <div stm-if="block.answered">
- <p>Answer: <strong stm-text="block.answer">answer</strong>
- <span class="muted" stm-text="block.answered_display">when</span>
- <span class="badge" stm-if="block.answered_by == 'auto'">auto</span></p>
- </div>
- <form stm-if="!block.answered && block.block_type == 'question'" stm-action="block.answer_action">
- <div class="options">
- <label stm-for-option-in="block.options" stm-key="option" class="option-card">
- <input type="radio" name="option" stm-attribute.value="option">
- <span stm-text="option">option</span>
- </label>
- <label>
- <input type="radio" name="option" value="__other__">
- <span>Other:</span>
- <textarea name="other" rows="2"></textarea>
- </label>
- </div>
- <button type="submit" class="primary">Answer</button>
- </form>
- <form stm-if="!block.answered && block.block_type != 'question' && block.block_type != 'review' && !block.is_plan_review"
- stm-action="block.answer_action" class="inline">
- <textarea name="answer" rows="3" placeholder="Your reply (delivered to the agent)"></textarea>
- <button type="submit" class="primary">Reply</button>
- </form>
- </div>
- <p stm-if="task.open_blocks.length == 0 && task.answered_blocks.length == 0" class="muted">No blocks — the agent has no open questions.</p>
- <!-- Historical (answered) blocks behind an expander, the
- current ones in full above (plan 11 task D). -->
- <details class="blocks-history" stm-if="task.answered_blocks.length > 0">
- <summary>Answered blocks (<span stm-text="task.answered_blocks.length">0</span>)</summary>
- <div stm-for-block-in="task.answered_blocks" stm-key="block.id"
- stm-attribute.class="'block-card answered ' + block.block_type">
- <p><span stm-attribute.class="'badge badge-' + block.block_type" stm-text="block.block_type">type</span>
- <span stm-text="block.question">question</span>
- <span class="muted" stm-text="block.created_display">when</span></p>
- <div stm-if="block.show_body && block.body.length > 0" class="md rfc-body"
- stm-markdown="block.body">body</div>
- <p>Answer: <strong stm-text="block.answer">answer</strong>
- <span class="muted" stm-text="block.answered_display">when</span>
- <span class="badge" stm-if="block.answered_by == 'auto'">auto</span></p>
- </div>
- </details>
- <h3>Comments</h3>
- <div stm-for-comment-in="task.comments" stm-attribute.class="'comment' + (comment.from_agent ? ' agent' : '')">
- <strong stm-text="comment.author">author</strong>
- <span class="muted" stm-text="comment.when_display">when</span>
- <div stm-text="comment.body">body</div>
- <blockquote stm-if="comment.quote.length > 0" stm-text="comment.quote">quote</blockquote>
- </div>
- <p stm-if="task.comments.length == 0" class="muted">No comments yet.</p>
- <form stm-action="task.comment">
- <input type="hidden" name="task_id" stm-attribute.value="task.id">
- <div class="form-row"><label for="comment-body">Add comment</label>
- <textarea id="comment-body" name="body" rows="3" placeholder="A comment for the agent"></textarea></div>
- <button type="submit" class="primary">Comment</button>
- </form>
- <!-- The highlight-to-comment popover (main.html) fills and opens
- this dialog; it went missing in a template rework, which broke
- quoting on RFC bodies. -->
- <dialog id="quote-comment-dialog">
- <h3>Comment on selected text</h3>
- <blockquote id="quote-text" class="term-comment-quote"></blockquote>
- <form stm-action="task.comment">
- <input type="hidden" name="task_id" stm-attribute.value="task.id">
- <input type="hidden" name="quote">
- <input type="hidden" name="return_to">
- <textarea name="body" rows="4" placeholder="Your comment…" style="width:100%; margin:0.5em 0;"></textarea>
- <button type="submit" class="primary">Send comment</button>
- <button type="button" onclick="document.getElementById('quote-comment-dialog').close()">Cancel</button>
- </form>
- </dialog>
- <h3>Rules</h3>
- <p class="muted">Task rules lead the effective set dispatched with this task.</p>
- <div stm-for-rule-in="task.rules" stm-key="rule.link_id" class="card">
- <h3 stm-text="rule.name">name</h3>
- <div class="md" stm-markdown="rule.body">body</div>
- <form class="inline">
- <button type="button" stm-action="rule.detach" stm-confirm="Detach this rule?">Detach</button>
- </form>
- </div>
- <p stm-if="task.rules.length == 0" class="muted">No task-specific rules.</p>
- <form class="inline" stm-action="task.attach_rule" stm-if="task.rule_options.length > 0">
- <label for="task-rule-target">Attach rule</label>
- <select id="task-rule-target" name="rule_id" required>
- <option stm-for-option-in="task.rule_options" stm-attribute.value="option.id"
- stm-text="option.name">rule</option>
- </select>
- <button type="submit">Attach</button>
- </form>
- <h3>Required capabilities</h3>
- <p class="muted">The dispatcher only assigns this task to a saddle carrying all of these tags.</p>
- <p stm-if="task.capabilities.length > 0">
- <span stm-for-capability-in="task.capabilities" stm-key="capability.link_id">
- <span class="badge"><span stm-text="capability.name">tag</span>
- <button type="button" class="inline chip-remove"
- stm-action="capability.detach" stm-confirm="Remove this requirement?">×</button></span>
- </span>
- </p>
- <p stm-if="task.capabilities.length == 0" class="muted">No requirements — any idle saddle may run it.</p>
- <form class="inline" stm-action="task.attach_capability" stm-if="task.capability_options.length > 0">
- <label for="task-capability-target">Require capability</label>
- <select id="task-capability-target" name="capability_id" required>
- <option stm-for-option-in="task.capability_options" stm-attribute.value="option.id"
- stm-text="option.name">capability</option>
- </select>
- <button type="submit">Require</button>
- </form>
- <h3>Sessions</h3>
- <p stm-if="task.saddle_health.length > 0" class="muted"
- stm-text="task.saddle_health">saddle health</p>
- <table>
- <thead><tr><th>#</th><th>Saddle</th><th>Started</th><th>Ended</th><th>Outcome</th><th></th></tr></thead>
- <tbody>
- <tr stm-for-session-in="task.sessions">
- <td stm-text="session.id">id</td>
- <td stm-text="session.saddle_name">saddle</td>
- <td stm-text="session.started_display">started</td>
- <td stm-text="session.ended_display">ended</td>
- <td stm-if="session.open"><span class="badge badge-working">open</span></td>
- <td stm-if="!session.open" stm-text="session.outcome">outcome</td>
- <td><a stm-attribute.href="'/tasks/' + task.id + '/terminal?session_id=' + session.id"
- target="_blank" rel="noopener">Terminal</a></td>
- </tr>
- <tr stm-if="task.sessions.length == 0"><td colspan="6" class="muted">No sessions yet.</td></tr>
- </tbody>
- </table>
- </div>
- </section>
- </body>
- </html>
|