| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <pstm-uri>/goals/{goal_id}</pstm-uri>
- <pstm-template>main</pstm-template>
- <script>
- // The goal page (goal 41 T6): the state strip leads — the
- // one-glance verdict (status badge, the open-item line, the
- // primary lifecycle button) — then the anchor sub-nav, then the
- // Act|Consult two-column layout (spry .with-sidebar): the acting
- // surfaces (state, blocks/questions, plan review, completion
- // review, comments) on the left, the consulting ones (tasks with
- // the filter strip, initial brief, involved projects, rules,
- // narrative, runs) on the right, stacking Act-then-Consult under
- // the framework breakpoint. Below the fold the page keeps its
- // established surfaces: the agent's live progress feed, the
- // attention blocks (the goal agent's answerable questions/RFCs
- // and the completion review), the locked brief, the effective
- // rules, the approved plan (revision history behind the
- // expander), the supervision narrative (events at full weight,
- // comment events as footnotes), the comment thread with
- // selection-quoting, and the goal agent's runs. Every long-form
- // body (brief, plans, reports, blocks, comments, events) renders
- // as markdown via stm-markdown. The plan review collects REMARKS
- // through the shared initPlanReviews engine (main.html, plan 16
- // R3/arch 15): a per-block queue that renders at the bottom of
- // the plan, persists across pulse refreshes (the maps live
- // outside statum re-renders), rides the rejection numbered, and
- // clears on accept. The tasks card's filter lives client-side in
- // window.goalTaskFilter; clicking a strip button re-runs the
- // sealed refresh action, and the filter rides the re-render.
- if (window.statum) {
- (function () {
- 'use strict';
- window.goalTaskFilter = window.goalTaskFilter || null;
- window.goalFilterClass = function (status) {
- return window.goalTaskFilter === status ? 'goal-filter active'
- : 'goal-filter';
- };
- window.goalTaskVisible = function (task) {
- return window.goalTaskFilter == null
- || window.goalTaskFilter === false
- || window.goalTaskFilter === ''
- || window.goalTaskFilter === task.status;
- };
- window.goalSetFilter = function (status) {
- window.goalTaskFilter = window.goalTaskFilter === status ? null : status;
- refreshGoal('filter');
- };
- function refreshGoal(source) {
- var goal = statum.read('goal');
- if (!goal || !goal.refresh) return;
- statum.act(goal.refresh).catch(function (error) {
- console.warn('[goal] live refresh (' + source + ') failed:', error);
- });
- }
- statum.addStateListener('pulse', function () {
- refreshGoal('pulse');
- });
- document.addEventListener('visibilitychange', function () {
- if (document.visibilityState === 'visible') refreshGoal('focus');
- });
- // Goal 41 T6 (bet 2): the anchor sub-nav. Statum re-renders
- // replace the DOM, so the listener binds ONCE on document
- // and the highlight pass re-runs after every evaluate —
- // the same rebound pattern as the filter strip (the
- // seals survive because nothing page-scoped is captured).
- var SUBNAV = 'goal-subnav';
- var SECTIONS = 'goal-section';
- function goalHighlightSubnav() {
- var nav = document.getElementsByClassName(SUBNAV)[0];
- if (!nav) return;
- var links = nav.querySelectorAll('a[href^="#"]');
- var sections = document.getElementsByClassName(SECTIONS);
- if (!links.length || !sections.length) return;
- // Two columns share the viewport, so "the last section
- // that crossed the line" (the single-column rule) can
- // pick a consult-column card while the reader looks at
- // an act-column one. The section whose top sits
- // CLOSEST to the nav's bottom edge (just below it)
- // is the one the reader entered; ties go to the later
- // DOM node (the deeper scroll).
- var mark = nav.getBoundingClientRect().bottom + 24;
- var current = null;
- var best = Infinity;
- for (var i = 0; i < sections.length; i++) {
- var distance = sections[i].getBoundingClientRect().top - mark;
- if (distance > 0) continue; // still below the fold line
- if (-distance <= best) {
- best = -distance;
- current = sections[i].id;
- }
- }
- for (var j = 0; j < links.length; j++) {
- var active = links[j].getAttribute('href') === '#' + current;
- links[j].classList.toggle('active', active);
- if (active) links[j].setAttribute('aria-current', 'true');
- else links[j].removeAttribute('aria-current');
- }
- }
- document.addEventListener('click', function (event) {
- var link = event.target.closest
- && event.target.closest('.' + SUBNAV + ' a[href^="#"]');
- if (!link) return;
- var target = document.getElementById(
- link.getAttribute('href').slice(1));
- if (!target) return;
- event.preventDefault();
- target.scrollIntoView();
- // scrollIntoView respects the sticky nav only through
- // scroll-margin-top (app.css); the highlight lands on
- // the raf after the scroll settles.
- requestAnimationFrame(goalHighlightSubnav);
- });
- window.addEventListener('scroll', goalHighlightSubnav,
- { passive: true });
- window.addEventListener('resize', goalHighlightSubnav,
- { passive: true });
- statum.afterEvaluate(goalHighlightSubnav);
- if (window.initQuoteComments) {
- window.initQuoteComments({
- matches: function (node) {
- // The pending plan body feeds the REMARKS
- // popover instead (below) - everything else
- // long-form on the goal quote-comments.
- return node.closest && node.closest('.goal-body') != null
- && node.closest('[data-plan-body]') == null;
- },
- action: function () {
- var goal = statum.read('goal');
- return goal && goal.comment;
- }
- });
- }
- // The goal's plan-review remarks ride the SHARED
- // engine (main.html's initPlanReviews, plan 16 R3/arch
- // 15 - the duplicated ~180-line collect-remarks pattern
- // now lives once); only the block resolution is page
- // state.
- // Plan 16 S2: the block for a review container resolves
- // from the ACTUAL [data-plan-review] element — the
- // pending completion review renders as a LEADING review
- // card (goal 41 T6), so goal.plan_pending_block alone
- // never resolves it; the slot's three review shapes plus
- // every open block are all candidates.
- function resolveReviewBlock(id) {
- var goal = statum.read('goal');
- if (!goal) return null;
- var block = null;
- (goal.open_blocks || []).forEach(function (candidate) {
- if (String(candidate.id) === String(id)) block = candidate;
- });
- if (!block && goal.completion_pending_block
- && String(goal.completion_pending_block.id) === String(id)) {
- block = goal.completion_pending_block;
- }
- if (!block && goal.plan_pending_block
- && String(goal.plan_pending_block.id) === String(id)) {
- block = goal.plan_pending_block;
- }
- return block;
- }
- if (window.initPlanReviews) {
- window.initPlanReviews({
- resolveBlock: function (id) { return resolveReviewBlock(id); }
- });
- }
- // The brief card's in-place editor (task 12).
- if (window.initLongFormEditors) {
- window.initLongFormEditors();
- }
- })();
- }
- </script>
- </head>
- <body>
- <div class="page goal-page">
- <pstm-fragment name="breadcrumb" crumbs="goal.crumbs"/>
- <h2 stm-if="goal.exists"><span class="goal-icon">🎯</span> #<span stm-text="goal.id">id</span> —
- <span stm-text="goal.title">title</span></h2>
- <p stm-if="!goal.exists" class="text-muted">Goal not found.</p>
- <div stm-if="goal.exists">
- <!-- GOAL 41 T6 (quick win 7): the one-line STATE STRIP —
- the verdict without parsing the Status card: status
- badge, the open-item line ("2 questions waiting · plan
- revision 3 pending"), the PRIMARY lifecycle button
- (the one matching the current state; the full ladder
- keeps living on the Status card). Nothing else — the
- strip is one glance. -->
- <div class="goal-state-strip" data-goal-state-strip>
- <span stm-attribute.class="'badge badge-' + goal.status"
- stm-text="goal.display">status</span>
- <span class="goal-state-verdict">
- <span stm-if="goal.open_blocks.length == 0
- && (goal.plan_pending_block == null
- || goal.plan_pending_block == false)
- && !goal.completion_pending"
- class="text-muted">No open items — nothing waits on
- you.</span>
- <span stm-if="goal.plan_pending_block != null
- && goal.plan_pending_block != false">
- Plan revision #<span stm-text="goal.plan_pending_block.id">n</span>
- pending</span>
- <span stm-if="goal.completion_pending">Completion review
- pending</span>
- <span stm-if="goal.open_blocks.length == 1"
- stm-text="'1 ' + (goal.open_blocks[0].block_type == 'question'
- ? 'question' : goal.open_blocks[0].block_type)
- + ' waiting'">1 waiting</span>
- <span stm-if="goal.open_blocks.length > 1"
- stm-text="goal.open_blocks.length + ' items waiting'">n waiting</span>
- </span>
- <span class="goal-state-actions">
- <button type="button" class="btn-primary btn-sm"
- stm-if="goal.start != null" stm-action="goal.start">Start
- goal</button>
- <button type="button" class="btn-primary btn-sm"
- stm-if="goal.resume != null" stm-action="goal.resume">Resume</button>
- <button type="button" class="btn-primary btn-sm"
- stm-if="goal.retry_run != null" stm-action="goal.retry_run">Retry
- supervision</button>
- <button type="button" class="btn-primary btn-sm"
- stm-if="goal.pause != null" stm-action="goal.pause">Pause</button>
- <button type="button" class="btn-primary btn-sm"
- stm-if="goal.requeue_run != null" stm-action="goal.requeue_run"
- stm-confirm="Requeue the agent's run? The daemon restores its workspace context on the next dispatch.">Requeue
- to resume</button>
- <button type="button" class="btn-primary btn-sm"
- stm-if="goal.force_wake != null" stm-action="goal.force_wake"
- stm-confirm="Force-woke this goal's parked agent? It resumes immediately on its saddle - one wake per press.">Force
- wake</button>
- </span>
- </div>
- <!-- GOAL 41 T6 (bet 2): the anchor sub-nav — Status ·
- Blocks · Plan · Tasks · Brief · Narrative · Comments.
- Sticky under the topbar (app.css reads its height);
- the highlight listener lives in the page script
- (rebound through statum.afterEvaluate). -->
- <nav class="goal-subnav" aria-label="Sections" data-goal-subnav>
- <a href="#goal-sec-status">Status</a>
- <a href="#goal-sec-blocks">Blocks</a>
- <a href="#goal-sec-plan">Plan</a>
- <a href="#goal-sec-tasks">Tasks</a>
- <a href="#goal-sec-brief">Brief</a>
- <a href="#goal-sec-narrative">Narrative</a>
- <a href="#goal-sec-comments">Comments</a>
- </nav>
- <!-- GOAL 41 T6 (bet 1): Act|Consult — spry's
- .with-sidebar grid with the proportions flipped (the
- acting column is the wide one; app.css owns the
- columns + the sub-55rem stack). ACT carries the
- attention order the page already had: pending
- reviews lead (actions surface), then state, blocks,
- plan, comments. CONSULT carries the reference
- surfaces the reader jumps to. -->
- <div class="goal-columns with-sidebar" data-goal-columns>
- <div class="stack" data-goal-act>
- <!-- GOAL 41 T6 ("actions surface"): while a plan review is
- pending, the review surface LEADS the acting column
- (stm-if ordering by state) — the reader answers before
- anything else. The plan-history card below renders
- only when nothing is pending. -->
- <section class="card plan-review-card goal-section"
- stm-if="goal.plan_pending_block != null && goal.plan_pending_block != false"
- id="goal-sec-plan-review">
- <h3>Plan review</h3>
- <div class="plan-review" data-plan-review
- stm-attribute.data-block-id="goal.plan_pending_block.id">
- <h4>Plan submitted for review</h4>
- <div class="md rfc-body goal-body" data-plan-body
- stm-markdown="goal.plan_pending_block.body">revision</div>
- <div class="actions">
- <form stm-action="goal.plan_pending_block.answer_action" class="cluster">
- <input type="hidden" name="verdict" value="accept">
- <button type="submit" class="btn-primary" data-plan-accept>Approve plan</button>
- </form>
- <button type="button" data-plan-toggle>Reject with feedback</button>
- </div>
- <div data-plan-feedback hidden>
- <p class="text-muted">Highlight plan text to attach a remark to it — the queue
- rides the rejection numbered, then clears. Approving ignores the queue.</p>
- <ul class="plan-comments" data-plan-remarks></ul>
- <textarea name="feedback" rows="2"
- placeholder="Additional feedback (optional)"></textarea>
- <button type="button" class="btn-primary" data-plan-submit>Submit feedback</button>
- </div>
- </div>
- </section>
- <!-- GOAL 41 T6 ("actions surface"): the pending completion
- review leads the acting column the same way — hoisted
- out of the blocks loop (which skips review rows) and
- keyed on the slot's completion_pending_block. -->
- <section class="card plan-review-card goal-section"
- stm-if="goal.completion_pending_block != null && goal.completion_pending_block != false"
- id="goal-sec-completion-review">
- <h3>Completion review</h3>
- <div class="plan-review" data-plan-review
- stm-attribute.data-block-id="goal.completion_pending_block.id">
- <pstm-fragment name="goal-branches"/>
- <pstm-fragment name="goal-compare"/>
- <div class="md rfc-body goal-body" data-plan-body
- stm-markdown="goal.completion_pending_block.body">report</div>
- <div class="actions">
- <form stm-action="goal.completion_pending_block.answer_action" class="cluster">
- <input type="hidden" name="verdict" value="accept">
- <button type="submit" class="btn-primary" data-plan-accept>Accept goal</button>
- </form>
- <button type="button" data-plan-toggle>Reject with feedback</button>
- </div>
- <div data-plan-feedback hidden>
- <p class="text-muted">Highlight report text to attach a remark to it — the queue
- rides the rejection numbered, then clears. Accepting ignores the queue.</p>
- <ul class="plan-comments" data-plan-remarks></ul>
- <textarea name="feedback" rows="2"
- placeholder="Additional feedback (optional)"></textarea>
- <button type="button" class="btn-primary" data-plan-submit>Submit feedback</button>
- </div>
- </div>
- </section>
- <!-- Status head (first in the ACT column while no review
- awaits): lifecycle badge, branch pair with the
- daemon-reported push-state chips, priority,
- timestamps, the assigned/parking agent saddle and
- the FULL lifecycle ladder — with run control parity
- (plan 14 B1): Retry supervision for a failed goal,
- Requeue-to-resume for a run stale/parked on a dead
- saddle, Cancel. NO notify-me toggle — goals notify
- unconditionally by design. Yeehaw stays on task
- rows only. The strip above carries the one-glance
- verdict; this card keeps the detail. -->
- <section class="card goal-head goal-section" id="goal-sec-status">
- <div class="card-head">
- <h3>Status</h3>
- </div>
- <p><span stm-attribute.class="'badge badge-' + goal.status" stm-text="goal.display">status</span>
- · goal branch <code stm-text="goal.branch_name">branch</code>
- <span class="text-muted">from</span> <code stm-text="goal.base_branch">base</code>
- <a stm-if="goal.compare_url.length > 0" stm-attribute.href="goal.compare_url"
- target="_blank" rel="noopener">· compare
- changes</a>
- · priority <strong stm-text="goal.priority">3</strong>
- <span stm-if="goal.agent_saddle.length > 0"> · agent saddle
- <strong stm-text="goal.agent_saddle">saddle</strong></span></p>
- <pstm-fragment name="goal-branches"
- note=""(the daemon's /status report)""/>
- <p class="text-muted">Project:
- <a stm-attribute.href="'/projects/' + goal.project_id" stm-text="goal.project_name">project</a>
- · Created <span stm-text="goal.created_display">when</span>
- <span stm-if="goal.started_display.length > 0"> · Started
- <span stm-text="goal.started_display">when</span></span>
- <span stm-if="goal.completed_display.length > 0"> · Finished
- <span stm-text="goal.completed_display">when</span></span></p>
- <p>
- <button type="button" class="btn-primary" stm-if="goal.start != null"
- stm-action="goal.start">Start goal</button>
- <button type="button" stm-if="goal.pause != null"
- stm-action="goal.pause">Pause</button>
- <button type="button" stm-if="goal.resume != null"
- stm-action="goal.resume">Resume</button>
- <button type="button" class="btn-primary" stm-if="goal.retry_run != null"
- stm-action="goal.retry_run">Retry supervision</button>
- <button type="button" stm-if="goal.requeue_run != null"
- stm-action="goal.requeue_run"
- stm-confirm="Requeue the agent's run? The daemon restores its workspace context on the next dispatch.">Requeue to resume</button>
- <!-- Goal 4 task 1: Force wake — the parked-agent
- recovery for the no-pending-wake stall. -->
- <button type="button" stm-if="goal.force_wake != null"
- stm-action="goal.force_wake"
- stm-confirm="Force-woke this goal's parked agent? It resumes immediately on its saddle - one wake per press.">Force wake</button>
- <button type="button" class="danger" stm-if="goal.cancel != null"
- stm-action="goal.cancel"
- stm-confirm="Cancel this goal? Its tasks are cancelled with it.">Cancel goal</button>
- </p>
- <p class="text-muted" stm-if="goal.status == 'draft'">Starting locks the brief and
- hands the goal to its agent (an orchestrate-mode run task, priority 3).</p>
- <p class="text-muted" stm-if="goal.status == 'paused'">Paused — supervision frozen;
- task events queue and coalesce into the resume.</p>
- <!-- Plan 15 C4: the ONE muted activity line (the
- Current-activity card is gone) — what the run is
- doing right now, folded into the status head. -->
- <p class="text-muted" stm-if="goal.current_activity.length > 0"
- stm-text="goal.current_activity">activity</p>
- <p class="text-muted" stm-if="goal.saddle_health.length > 0"
- stm-text="goal.saddle_health">health</p>
- <!-- S5: the goal's aggregate LLM usage across its tasks
- (the run plus the workers) — empty renders nothing. -->
- <p class="text-muted" stm-if="goal.usage_line.length > 0"
- stm-text="goal.usage_line">LLM: 1,234 calls · 45.2M in / 1.1M out tok · 3h 12m</p>
- </section>
- <!-- The agent's live progress feed (task-page pattern):
- the newest line leads, its history behind the
- expander. Plan 15 C4: a CARD again (the goalui
- restyle regression — every section rides the same
- card rhythm). -->
- <section class="card">
- <h3>Agent progress</h3>
- <pstm-fragment name="progress-feed" entries="goal.progress"/>
- <p stm-if="goal.progress.length == 0" class="text-muted">No progress reports yet — the goal
- agent reports via <code>saddle progress-update</code>.</p>
- </section>
- <!-- ATTENTION (plan 14 B5 order; plan 15 C4): the goal
- agent's OPEN blocks lead — questions and RFCs with
- full markdown bodies and inline answer forms — and
- the historic answered ones fold behind the
- answered-blocks expander (the task page's pattern);
- the completion review follows when one awaits. -->
- <section class="card goal-section"
- stm-if="goal.open_blocks.length > 0 || goal.answered_blocks.length > 0"
- id="goal-sec-blocks">
- <h3>Goal agent blocks</h3>
- <div stm-for-block-in="goal.open_blocks" class="goal-block">
- <!-- A pending completion review renders in the
- LEADING completion-review card above (goal 41
- T6 "actions surface"); the loop shows every
- other open block — questions and RFCs with
- full markdown bodies and inline answer forms. -->
- <p stm-if="!block.is_completion_review"><span stm-attribute.class="'badge badge-block-' + block.block_type"
- stm-text="block.block_type">kind</span>
- <strong stm-text="block.question">question</strong>
- <span class="text-muted" stm-text="block.created_display">when</span></p>
- <div stm-if="!block.is_completion_review">
- <div stm-if="block.show_body && block.body.length > 0"
- class="md rfc-body goal-body" stm-markdown="block.body">body</div>
- <pstm-fragment name="block-answer"/>
- <pstm-fragment name="block-reply"/>
- </div>
- </div>
- <details class="history-expander" stm-if="goal.answered_blocks.length > 0">
- <summary>Answered blocks (<span stm-text="goal.answered_blocks.length">0</span>)</summary>
- <div stm-for-block-in="goal.answered_blocks" class="goal-block">
- <p><span stm-attribute.class="'badge badge-block-' + block.block_type"
- stm-text="block.block_type">kind</span>
- <strong stm-text="block.question">question</strong>
- <span class="text-muted" stm-text="block.created_display">when</span></p>
- <div stm-if="block.show_body && block.body.length > 0"
- class="md rfc-body goal-body" stm-markdown="block.body">body</div>
- <blockquote stm-if="block.answered" class="term-comment-quote">
- <span stm-text="block.answered_by">who</span>:
- <span stm-text="block.answer">answer</span></blockquote>
- </div>
- </details>
- </section>
- <!-- Completion review card: the TERMINAL summary — shown
- once the goal is complete/failed, with the report and
- the compare link. While PENDING, the review lives in
- the attention blocks above (the rich review form). -->
- <section class="card goal-section" stm-if="goal.terminal && goal.completion_report.length > 0">
- <h3>Completion review</h3>
- <pstm-fragment name="goal-branches"/>
- <pstm-fragment name="goal-compare"/>
- <div class="md rfc-body goal-body" stm-markdown="goal.completion_report">report</div>
- </section>
- <!-- The plan history (plan 15 C4): the approved plan and
- the revision history (approved + rejected) sit behind
- a collapsed expander — the goal page leads with what
- needs a human, not with settled history. While a plan
- review is open the LEADING plan-review card above
- carries it (this card waits below). -->
- <section class="card goal-section" id="goal-sec-plan">
- <h3>Plan</h3>
- <details class="history-expander">
- <summary>Approved plan & revisions (<span
- stm-text="goal.plan_revisions.length">0</span>)</summary>
- <div stm-if="goal.plan.length > 0" class="md rfc-body goal-body" data-plan-body
- stm-markdown="goal.plan">plan</div>
- <p stm-if="goal.plan.length == 0" class="text-muted">No approved plan yet.</p>
- <div stm-for-revision-in="goal.plan_revisions" class="plan-revision">
- <p><span stm-attribute.class="'badge ' + (revision.approved ? 'badge-done' : (revision.answered ? 'badge-failed' : 'badge-plan'))"
- stm-text="revision.approved ? 'approved' : (revision.answered ? 'rejected' : 'pending')">verdict</span>
- <span class="text-muted">Revision #<span stm-text="revision.id">n</span> — <span stm-text="revision.created_display">when</span></span></p>
- <details>
- <summary>Submitted markdown</summary>
- <div class="md rfc-body" stm-markdown="revision.body">body</div>
- </details>
- <blockquote stm-if="revision.answered" class="term-comment-quote">
- <span stm-text="revision.answered_by">who</span>:
- <span stm-text="revision.answer">answer</span></blockquote>
- </div>
- </details>
- </section>
- <!-- Comments with selection-quoting (markdown bodies).
- Plan 15 C2: the thread IS the goal-run task's own
- task_comments — the agent's pushes and the human's
- composer land on the same rows; harness-authored
- bookkeeping renders as distinct muted system rows,
- never agent comment rows. The composer opens with
- the run (a draft goal has no thread to inject into). -->
- <section class="card goal-section" id="goal-sec-comments">
- <h3>Comments</h3>
- <!-- Plan 15 C4: timeless-comment footnote styling —
- the BODY leads; the author and time read as a
- muted footnote (status belongs in progress
- updates). System rows keep their labelled style. -->
- <div stm-for-comment-in="goal.comments"
- stm-attribute.class="'comment' + (comment.from_agent ? ' agent' : '') + (comment.is_system ? ' system' : '')">
- <div class="md" stm-markdown="comment.body">body</div>
- <blockquote stm-if="comment.quote.length > 0" stm-text="comment.quote">quote</blockquote>
- <p class="comment-meta">
- <strong stm-if="!comment.is_system" stm-text="comment.author">author</strong>
- <span stm-if="comment.is_system" class="system-label">system</span>
- <span class="text-muted" stm-text="comment.created_display">when</span>
- </p>
- </div>
- <p stm-if="goal.comments.length == 0" class="text-muted">No comments yet.</p>
- <p stm-if="goal.run_task_id == 0" class="text-muted">The goal agent has not started
- yet — comments open with its run.</p>
- <!-- Goal 8 task 4: the composer stays OPEN on terminal
- goals — a comment there re-opens the goal and
- re-offers its agent's run with the comment riding
- the resume (cancelled goals stay closed: their
- composer keeps the run gate alone). -->
- <form stm-if="goal.run_task_id > 0" stm-action="goal.comment">
- <div class="field"><label for="goal-comment-body">Add comment</label>
- <textarea id="goal-comment-body" name="body" rows="3"
- placeholder="A timeless note for a future reader — status belongs in progress updates (markdown)"></textarea></div>
- <p stm-if="goal.terminal && goal.status != 'cancelled'" class="text-muted">
- This goal is terminal — commenting re-opens it: the agent resumes
- with your comment and submits a fresh completion report.</p>
- <button type="submit" class="btn-primary">Comment</button>
- </form>
- <dialog id="quote-comment-dialog">
- <h3>Comment on selected text</h3>
- <blockquote id="quote-text" class="term-comment-quote"></blockquote>
- <form stm-action="goal.comment">
- <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="btn-primary">Send comment</button>
- <button type="button"
- onclick="document.getElementById('quote-comment-dialog').close()">Cancel</button>
- </form>
- </dialog>
- </section>
- </div><!-- /data-goal-act -->
- <div class="stack" data-goal-consult>
- <!-- Task status strip + the goal's task list (plan 14 B5:
- tasks above the brief; capability badges per row —
- no editing here; yeehaw on rows only). -->
- <section class="card goal-section" id="goal-sec-tasks">
- <h3>Tasks</h3>
- <p class="goal-strip">
- <button type="button" stm-attribute.class="window.goalFilterClass('draft')"
- onclick="window.goalSetFilter('draft')"
- stm-text="'draft ' + goal.draft_tasks">draft</button>
- <button type="button" stm-attribute.class="window.goalFilterClass('queued')"
- onclick="window.goalSetFilter('queued')"
- stm-text="'queued ' + goal.queued_tasks">queued</button>
- <button type="button" stm-attribute.class="window.goalFilterClass('working')"
- onclick="window.goalSetFilter('working')"
- stm-text="'running ' + goal.running_tasks">running</button>
- <button type="button" stm-attribute.class="window.goalFilterClass('done')"
- onclick="window.goalSetFilter('done')"
- stm-text="'done ' + goal.done_tasks">done</button>
- <button type="button" stm-attribute.class="window.goalFilterClass('failed')"
- onclick="window.goalSetFilter('failed')"
- stm-text="'failed ' + goal.failed_tasks">failed</button>
- <span class="text-muted">— click a status to filter</span>
- </p>
- <table>
- <thead><tr><th>#</th><th>Title</th><th>Status</th><th>Mode</th><th>Requires</th><th>Created by</th></tr></thead>
- <tbody>
- <tr stm-for-goal_task-in="goal.goal_tasks"
- stm-if="window.goalTaskVisible(goal_task)">
- <td stm-text="goal_task.id">id</td>
- <td><a stm-attribute.href="'/tasks/' + goal_task.id"
- stm-text="goal_task.title">title</a></td>
- <td><span stm-attribute.class="'badge badge-' + goal_task.status"
- stm-text="goal_task.display">status</span>
- </td>
- <td><span stm-attribute.class="'badge badge-mode-' + goal_task.mode"
- stm-text="goal_task.mode">mode</span></td>
- <td><span stm-for-capability-in="goal_task.capabilities">
- <span class="badge badge-capability"
- stm-text="capability">tag</span> </span></td>
- <td class="text-muted" stm-text="goal_task.creator">who</td>
- </tr>
- <tr stm-if="goal.goal_tasks.length == 0">
- <td colspan="6" class="text-muted">No tasks yet — the goal agent fans
- them out once the plan is approved.</td></tr>
- </tbody>
- </table>
- </section>
- <!-- The locked brief. Task 12: DRAFT goals swap the
- rendered markdown for an in-place editor
- (initLongFormEditors in main.html) carrying title,
- brief and priority — a draft goal has no other edit
- surface (this also unblocks the draft priority, which
- nothing else could change). Starting locks the brief:
- the editor's stm-if wrapper disappears with the
- update action and the card stays the plain read view. -->
- <section class="card goal-section" id="goal-sec-brief" data-long-form data-field="goal"
- data-lf-open="0">
- <h3>Initial brief
- <button type="button" class="btn-ghost" stm-if="goal.update != null"
- data-lf-toggle>Edit</button>
- <span class="text-muted" stm-if="goal.started_display.length > 0">(locked)</span></h3>
- <div data-lf-view>
- <div class="md rfc-body goal-body" data-brief-body stm-markdown="goal.brief">brief</div>
- </div>
- <div stm-if="goal.update != null">
- <form data-lf-edit hidden stm-action="goal.update">
- <div class="field"><label>Title</label>
- <input type="text" name="title" data-lf-src="goal.title"></div>
- <div class="field"><label>Brief (markdown)</label>
- <textarea name="brief" rows="8"
- data-lf-src="goal.brief">brief</textarea></div>
- <div class="field"><label>Priority (1–9)</label>
- <input type="number" name="priority" min="1" max="9"
- data-lf-src="goal.priority"></div>
- <button type="submit">Save</button>
- <button type="button" data-lf-toggle>Cancel</button>
- </form>
- </div>
- </section>
- <!-- Involved projects. -->
- <section class="card">
- <h3>Involved projects</h3>
- <p stm-if="goal.links.length > 0"><span stm-for-link-in="goal.links">
- <span stm-attribute.class="'badge badge-' + link.relationship"
- stm-text="link.name + ' (' + link.relationship + ')'">link</span>
- <button type="button" class="btn-ghost" stm-action="link.remove"
- stm-confirm="Remove this link?">×</button>
- <input type="hidden" name="link_id" stm-attribute.value="link.id">
- </span></p>
- <p stm-if="goal.links.length == 0" class="text-muted">Only the primary project.</p>
- <details stm-if="!goal.terminal">
- <summary>Link a project</summary>
- <form class="cluster" stm-action="goal.add_link">
- <select name="linked_project_id" required>
- <option stm-for-project-in="goal.project_options" stm-attribute.value="project.id"
- stm-text="project.name">project</option>
- </select>
- <select name="relationship">
- <option value="co-developed">co-developed</option>
- <option value="reference">reference</option>
- </select>
- <button type="submit">Link</button>
- </form>
- <form class="cluster" stm-action="goal.apply_stack"
- stm-if="goal.stack_options.length > 0" style="margin-top: 0.5em;">
- <label for="goal-stack">Apply stack</label>
- <select id="goal-stack" name="stack_id" required>
- <option stm-for-stack-in="goal.stack_options" stm-attribute.value="stack.id"
- stm-text="stack.name + ' (' + stack.member_count + ')'">stack</option>
- </select>
- <button type="submit">Apply</button>
- </form>
- </details>
- </section>
- <!-- Plan 14 B5: the goal's effective rules — they govern
- the agent and every worker it fans out. -->
- <section class="card">
- <h3>Rules</h3>
- <p class="text-muted">The effective set dispatched with this goal's work — task rules,
- the primary project's, then co-developed projects' in link order.</p>
- <div stm-for-rule-in="goal.rules" class="rule-card">
- <h4 stm-text="rule.name">name</h4>
- <div class="md" stm-markdown="rule.body">body</div>
- </div>
- <p stm-if="goal.rules.length == 0" class="text-muted">No rules apply to this goal.</p>
- </section>
- <!-- The supervision narrative (plan 14 B6): state events
- at full weight, comment events as .footnote — the
- feed reads as events-with-occasional-footnotes. -->
- <section class="card goal-section" id="goal-sec-narrative">
- <h3>Supervision narrative</h3>
- <p stm-if="goal.events.length == 0" class="text-muted">Nothing yet — start the goal.</p>
- <div stm-for-event-in="goal.events"
- stm-attribute.class="'goal-event' + (event.kind == 'comment' ? ' footnote' : '')">
- <span class="text-muted" stm-text="event.at_display">when</span>
- <span stm-attribute.class="'badge badge-goal-' + event.kind"
- stm-text="event.kind.replace('-', ' ')">kind</span>
- <!-- Comment events render as footnotes (plan 13 B4
- + 14 B6): the whole row is muted and smaller,
- the body-first text leading. -->
- <div class="md goal-event-text" stm-markdown="event.text">text</div>
- <a stm-if="event.task_id > 0"
- stm-attribute.href="'/tasks/' + event.task_id">task</a>
- </div>
- </section>
- <!-- Goal agent runs: every round with its host saddle; the
- event log links open in a new tab. -->
- <section class="card" stm-if="goal.runs.length > 0">
- <h3>Goal agent runs</h3>
- <p><a stm-attribute.href="'/tasks/' + goal.run_task_id + '/log'"
- target="_blank" rel="noopener">Event log</a>
- <span class="text-muted">— run task
- #<span stm-text="goal.run_task_id">id</span></span></p>
- <table>
- <thead><tr><th>Run</th><th>Saddle</th><th>Started</th><th>Ended</th><th>Outcome</th></tr></thead>
- <tbody>
- <tr stm-for-run-in="goal.runs">
- <td><a stm-attribute.href="run.terminal_url" target="_blank" rel="noopener"
- stm-text="'session ' + run.id">run</a></td>
- <td class="text-muted" stm-text="run.saddle_name">saddle</td>
- <td class="text-muted" stm-text="run.started_display">when</td>
- <td class="text-muted" stm-text="run.ended_display">when</td>
- <td><span stm-if="run.open" class="badge badge-working">open</span>
- <span stm-if="!run.open" stm-text="run.outcome">outcome</span></td>
- </tr>
- </tbody>
- </table>
- </section>
- </div><!-- /data-goal-consult -->
- </div><!-- /goal-columns -->
- </div>
- </div>
- </body>
- </html>
|