diff --git a/changelog.d/added-15051-waiting-presence.md b/changelog.d/added-15051-waiting-presence.md new file mode 100644 index 0000000000..622fa5d38a --- /dev/null +++ b/changelog.d/added-15051-waiting-presence.md @@ -0,0 +1 @@ +- Activity Monitor waiting-on pills and PR sub-rows show clanker presence with accessible shapes, last-seen details, and the adoption deadline; human authors remain waiting for a reply ([#15051](https://github.com/hivecommons/hive/issues/15051)). diff --git a/src/docs/dashboard-sections.md b/src/docs/dashboard-sections.md index 258a4b9761..d3fab85955 100644 --- a/src/docs/dashboard-sections.md +++ b/src/docs/dashboard-sections.md @@ -706,6 +706,17 @@ Fed by `GET /api/stage-tracker`. Every issue and pull request follows the same p **Multi-select.** The checkbox in a row's left gutter selects the row — and the checkbox in a nested PR sub-row's gutter selects that PR on its own, so one or more PRs under an issue can be picked without the issue or each other; **Shift+click** selects the range from the last clicked row (sub-rows are in the range order right after their issue), **Cmd/Ctrl+click** toggles, **Cmd/Ctrl+Shift+click** adds a range to what is selected; with a row focused, **Space** toggles it (Shift+Space extends). Cmd/Ctrl- or Shift-clicking the row itself, away from its links, selects it too. A selection bar appears above the list with the count, **Clear**, and the same actions for the whole selection — *Decide…* (opens the group as a menu, *Let hive decide* first — each selected row gets its own delegated-decision job, see below), **Let hive decide (N selected)** (one click for the whole selection: one delegated-decision job per selected item, each nested PR sub-row by its own number, with one summary toast — "3 sent · 2 decided · 1 no-op", plus "· 1 failed" when any failed — and the per-action confirm / *Don't ask again* of *Let hive decide*), *Hold*, *Release hold*, *Re-evaluate now*, *Mark needs-human…*, *Copy links* — each enabled only when it is valid for every selected row and otherwise greyed with the first reason ("Not applicable to acme/console#12", "Sign in with write access…"). Right-clicking a selected row acts on the whole selection. Bulk actions run one request per row, in list order, under a progress toast ("Hold 2/5 — acme/console#12…"); the result toast lists each failure by row and the successes stand, after which the list and the status snapshot refresh (a hive-wide rescan is sent once per batch). Selection is keyed on the row's item (repository, kind, number), not its node, so the live re-render keeps it; a row that leaves the list — merged, closed, filtered or paged out — leaves the selection. +**Waiting-on presence.** A PR at 071 (Needs author) or 072 (Returned to contributor) +shows a presence shape before the named author in its waiting-on pill, including +covering PR sub-rows. A filled dot means a registered clanker is online, a square +means it is offline, and a hollow ring means no clanker is registered (or presence +is unavailable, explicitly named in the tooltip). Human authors without a clanker +read `human · no clanker`. The tooltip and accessible label give the last heartbeat, +offline age, and the expected adoption time once a current-head nudge has started +that clock. Human PRs always wait for a reply. Named-author Needs-human popovers +repeat the indicator. Presence refreshes with the tracker; only the online dot +breathes, and reduced-motion disables that animation. + **Needs-human decision popover.** Hovering — or, by keyboard, focusing — the *Needs human decision* chevron word on a row (an issue at 045, a PR at 085, an issue whose nested PR is parked there) or a lead *needs-human* / *triage needed* pill opens an in-app popover (no native tooltip on that element) that says, in this order: **what the row is waiting on** — the reviewer's own question when the hive has one (the text the hive's "Needs a decision" comment on the PR prints after *reviewer question:*, read from the same verdict record), else a plain-words sentence for the park reason, plus the blocker in plain words ("A reviewer requested changes on b0f5f80 — needs a new commit. Approving cannot override that."); **what you can do** — one button per applicable action, *Let hive decide* first, then Approve / Give direction / Close as superseded / Close as won't fix / Hold or Release hold (an issue at 015: Accept triage, Hold, Mark needs-human), each disabled with its reason when the row's state or your role rules it out; **who asked and when** ("Asked by a reviewer · 2 hours ago"); then the chevron's stage line. The buttons run the row context menu's code path, so the same result toast and in-flight chevron apply. The popover stays open while the pointer is over it or its trigger, pins on click or focus, and closes on Esc (focus returns to the trigger), click-away, scroll or resize. The text comes from the tracker payload's `decision_needed` (`question`, `asked_by`, `since`, `blocker`, `blocker_reason`, `options[] {action, label, enabled, reason_if_disabled}`), whose `action` ids are the context menu's own (`decide:delegate`, `decide:approve`, …). **Cue tokens.** The three cues of the legend above (state pill, working spin, decision badge) share one `tracker-cues` CSS block on `.ham-row`: `--cue-state` (what the row waits on — the pill and this popover), `--cue-work` (the hive is working right now — the chevron spin), `--cue-decision` (what people and the hive decided — the ✓ badge). Nothing else blinks; motion stays in the 150–300 ms range. diff --git a/src/docs/labels-and-control-signals.md b/src/docs/labels-and-control-signals.md index b01c3d1780..fd801ef1ea 100644 --- a/src/docs/labels-and-control-signals.md +++ b/src/docs/labels-and-control-signals.md @@ -879,6 +879,18 @@ When a clanker-authored contributor PR goes red the hive does not just relabel i stage transitions and simply wait at 071 for a push or a comment: no nudge, no adoption, no extra comment ([Stage 07x by author kind](#stage-07x-by-author-kind)). +The Activity Monitor exposes the same hub presence on 071 and 072 waiting-on +pills and linked PR sub-rows, even before a nudge. Its `presence` payload names +`login`, `kind` (human/clanker), `state` (online/offline/unknown), `since`, +`last_seen`, and `next` (wait/adopt), with `adopt_at` when a current-head nudge +makes adoption predictable. `available: false` means presence could not be read; +it does not claim that the author has no registered profile. The deadline uses +the adoption engine's clock: online grace from the first nudge, `after_offline` +from the later heartbeat or nudge, or `after_unregistered` from the nudge. +Before the first nudge, after a head change, with adoption disabled or held, and +for human-authored PRs, the pill promises no adoption time. An existing adoption +hold still shows its reason and the owner's Adopt decision when applicable. + 3. If the author stays unavailable the hive adopts the PR (`governor.labels.stage.adoption.enabled`, default `true`). "Unavailable" is decided against the contributor's **live** presence on the hub at diff --git a/src/pkg/dashboard/stage_tracker.go b/src/pkg/dashboard/stage_tracker.go index 0f5d2473ad..5742382074 100644 --- a/src/pkg/dashboard/stage_tracker.go +++ b/src/pkg/dashboard/stage_tracker.go @@ -397,7 +397,8 @@ type StageTrackerItem struct { // what holds it, and the author's live presence, with the plain-words // line the row shows instead of a bare "Returned to contributor" // (hivecommons/hive#14524). - Adoption *StageTrackerAdoption `json:"adoption,omitempty"` + Adoption *StageTrackerAdoption `json:"adoption,omitempty"` + Presence *StageTrackerPersonPresence `json:"presence,omitempty"` // ClaimantKind is the author kind of whoever holds the live claim on a // claimed issue (human / clanker / hive), from the worker-claim ledger. ClaimantKind string `json:"claimant_kind,omitempty"` @@ -487,7 +488,8 @@ type StageTrackerLinkedPR struct { // sub-row can open the same "Needs human" popover. DecisionNeeded *StageTrackerDecision `json:"decision_needed,omitempty"` // Adoption mirrors the nested PR's own row field (hivecommons/hive#14524). - Adoption *StageTrackerAdoption `json:"adoption,omitempty"` + Adoption *StageTrackerAdoption `json:"adoption,omitempty"` + Presence *StageTrackerPersonPresence `json:"presence,omitempty"` // LastOperatorAction / OperatorActionCount mirror the nested PR's own // row fields so its sub-row wears the ✓ badge too. LastOperatorAction *StageTrackerOperatorAction `json:"last_operator_action,omitempty"` @@ -1543,7 +1545,7 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto } return store.Get(stagelabels.Key(repo, number)) } - presence, maintainerPolicy := s.stageTrackerPresence(), s.stageTrackerMaintainerPolicy() + presence, maintainerPolicy := cachedStageTrackerPresence(s.stageTrackerPresence()), s.stageTrackerMaintainerPolicy() finish := func(it *StageTrackerItem, labels []string, stage stagelabels.Stage, rec stagelabels.Record, hasRec bool, draft bool) { // "Needs human decision" is read from the item's current labels, not // a store record that outlived them: once the park label is gone @@ -1602,6 +1604,7 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto } it.Modifiers = slices.DeleteFunc(it.Modifiers, func(m string) bool { return m == modNeedsTriage }) } + it.Presence = s.stageTrackerPersonPresence(*it, rec, hasRec, presence) it.Caption, it.Actor = stageTrackerCaption(stage, it.Reason, it.Author, it.Kind, it.Mirrored, rec, hasRec, it.LinkedPR, it.Head) // Adoption is clanker-only (a human's PR is never adopted), so a // human-authored 072 row keeps its plain caption. @@ -2502,6 +2505,7 @@ func stageTrackerResolveLinkedPRs(items []StageTrackerItem) { lp.StageSince, lp.Caption = pr.StageSince, pr.Caption lp.SentinelAlert, lp.SentinelReason, lp.Head = pr.SentinelAlert, pr.SentinelReason, pr.Head lp.Adoption = pr.Adoption + lp.Presence = pr.Presence lp.HumanApprover, lp.ManualMerge = pr.HumanApprover, pr.ManualMerge lp.HumanMergeReason, lp.HumanMergeReasonText = pr.HumanMergeReason, pr.HumanMergeReasonText lp.BaseRef = pr.BaseRef diff --git a/src/pkg/dashboard/stage_tracker_person_presence.go b/src/pkg/dashboard/stage_tracker_person_presence.go new file mode 100644 index 0000000000..73bddc0e76 --- /dev/null +++ b/src/pkg/dashboard/stage_tracker_person_presence.go @@ -0,0 +1,115 @@ +package dashboard + +import ( + "strings" + "time" + + "github.com/hivecommons/hive/pkg/config" + "github.com/hivecommons/hive/pkg/github/automerge" + "github.com/hivecommons/hive/pkg/stagelabels" +) + +// StageTrackerPersonPresence describes the named author a PR waits on. Unknown +// means no registered clanker, or an unavailable presence source; Kind preserves +// the author classification independently of relay registration. +type StageTrackerPersonPresence struct { + Login string `json:"login"` + State string `json:"state"` + Kind string `json:"kind"` + Since *time.Time `json:"since,omitempty"` + LastSeen *time.Time `json:"last_seen,omitempty"` + Next string `json:"next"` + AdoptAt *time.Time `json:"adopt_at,omitempty"` + // Available distinguishes an unavailable hub from a known absent profile. + Available bool `json:"available"` +} + +func (s *Server) stageTrackerPersonPresence(it StageTrackerItem, rec stagelabels.Record, hasRec bool, lookup func(string) (automerge.ContributorPresence, bool)) *StageTrackerPersonPresence { + if it.Kind != "pr" || it.Author == "" || (it.Stage != trackerNumberNeedsAuthor && it.Stage != trackerNumberReturned) { + return nil + } + out := &StageTrackerPersonPresence{Login: it.Author, State: "unknown", Kind: "clanker", Next: "wait"} + if it.AuthorKind == authorKindHuman { + out.Kind = "human" + } + var p automerge.ContributorPresence + if lookup != nil { + p, out.Available = lookup(it.Author) + } + if out.Available && p.Registered { + out.State = "offline" + if p.Online { + out.State = "online" + } + } + if !p.LastSeen.IsZero() { + t := p.LastSeen + out.LastSeen = &t + } + // Offline age is counted from the later heartbeat / current-head nudge, + // just like adoptionDue. Before the first nudge only presence is known. + var start time.Time + if hasRec && rec.NudgeHead == it.Head { + start = rec.NudgeStart() + if !start.IsZero() { + out.Since = &start + } + } + if p.LastSeen.After(start) { + t := p.LastSeen + out.Since = &t + } + if it.AuthorKind != authorKindClanker || it.Stage != trackerNumberReturned || !hasRec { + return out + } + var cfg config.StageLabelsConfig + if s != nil && s.deps != nil && s.deps.Config != nil { + cfg = s.deps.Config.Governor.Labels.Stage + } + if cfg.Adoption.Enabled != nil && !*cfg.Adoption.Enabled { + return out + } + if rec.AdoptionBlocked(it.Head) != "" || stageTrackerPresenceHeld(it.Labels) { + return out + } + policy := automerge.StageLabelPolicy{ + GraceOnline: cfg.EffectiveContributorGraceOnline(), GraceOffline: cfg.EffectiveContributorGraceOffline(), + AdoptAfterOffline: cfg.Adoption.EffectiveAfterOffline(), AdoptAfterUnregistered: cfg.Adoption.EffectiveAfterUnregistered(), + } + at, _ := automerge.AdoptionDeadline(rec, it.Head, policy, p, out.Available) + if !at.IsZero() { + out.Next, out.AdoptAt = "adopt", &at + } + return out +} + +// Snapshot each login once per tracker response so adoption and the indicator +// cannot disagree when a relay connects during response construction. +func cachedStageTrackerPresence(lookup func(string) (automerge.ContributorPresence, bool)) func(string) (automerge.ContributorPresence, bool) { + if lookup == nil { + return nil + } + type result struct { + p automerge.ContributorPresence + ok bool + } + cache := map[string]result{} + return func(login string) (automerge.ContributorPresence, bool) { + if r, ok := cache[login]; ok { + return r.p, r.ok + } + p, ok := lookup(login) + cache[login] = result{p, ok} + return p, ok + } +} + +func stageTrackerPresenceHeld(labels []string) bool { + for _, label := range labels { + label = strings.ToLower(strings.TrimSpace(label)) + if label == "hold" || label == "do-not-merge" || label == "do-not-merge/hold" { + return true + } + } + return false +} diff --git a/src/pkg/dashboard/stage_tracker_person_presence_test.go b/src/pkg/dashboard/stage_tracker_person_presence_test.go new file mode 100644 index 0000000000..f0cd52ffc9 --- /dev/null +++ b/src/pkg/dashboard/stage_tracker_person_presence_test.go @@ -0,0 +1,162 @@ +package dashboard + +import ( + "strings" + "testing" + "time" + + "github.com/hivecommons/hive/pkg/github" + "github.com/hivecommons/hive/pkg/github/automerge" + "github.com/hivecommons/hive/pkg/stagelabels" +) + +func TestStageTrackerPersonPresence(t *testing.T) { + now := time.Date(2026, 10, 28, 16, 0, 0, 0, time.UTC) + s, store, _ := adoptionFixture(t, now, "adopt", nil) + rec, _ := store.Get(stagelabels.Key("hivecommons/hive", 14524)) + start := rec.NudgeStart() + for _, tc := range []struct { + name, kind, state, next string + p automerge.ContributorPresence + available bool + stage int + deadline time.Time + }{ + {"online", "clanker", "online", "adopt", automerge.ContributorPresence{Registered: true, Online: true, LastSeen: now}, true, 72, start.Add(2 * time.Hour)}, + {"offline", "clanker", "offline", "adopt", automerge.ContributorPresence{Registered: true, LastSeen: now.Add(-5 * time.Minute)}, true, 72, now.Add(10 * time.Minute)}, + {"unregistered", "clanker", "unknown", "adopt", automerge.ContributorPresence{}, true, 72, start.Add(15 * time.Minute)}, + {"unavailable", "clanker", "unknown", "adopt", automerge.ContributorPresence{}, false, 72, start.Add(15 * time.Minute)}, + {"human", "human", "unknown", "wait", automerge.ContributorPresence{}, true, 72, time.Time{}}, + {"needs-author", "clanker", "online", "wait", automerge.ContributorPresence{Registered: true, Online: true}, true, 71, time.Time{}}, + } { + t.Run(tc.name, func(t *testing.T) { + it := StageTrackerItem{Kind: "pr", Author: "hanthor", AuthorKind: tc.kind, Stage: tc.stage, Head: "feed"} + lookup := func(string) (automerge.ContributorPresence, bool) { return tc.p, tc.available } + got := s.stageTrackerPersonPresence(it, rec, true, lookup) + if got == nil || got.Login != "hanthor" || got.Kind != tc.kind || got.State != tc.state || got.Next != tc.next || got.Available != tc.available { + t.Fatalf("presence = %+v", got) + } + if tc.deadline.IsZero() { + if got.AdoptAt != nil { + t.Fatalf("unexpected deadline: %v", got.AdoptAt) + } + } else if got.AdoptAt == nil || !got.AdoptAt.Equal(tc.deadline) { + t.Fatalf("deadline = %v, want %v", got.AdoptAt, tc.deadline) + } + // Before a nudge or after the head moves there must be no promise of adoption. + it.Head = "new-head" + if p := s.stageTrackerPersonPresence(it, rec, true, lookup); p.AdoptAt != nil || p.Next != "wait" { + t.Fatalf("stale-head presence = %+v", p) + } + if p := s.stageTrackerPersonPresence(it, stagelabels.Record{}, false, lookup); p == nil || p.AdoptAt != nil { + t.Fatalf("pre-nudge presence = %+v", p) + } + }) + } + it := StageTrackerItem{Kind: "pr", Author: "hanthor", AuthorKind: "clanker", Stage: 72, Head: "feed"} + off := false + s.deps.Config.Governor.Labels.Stage.Adoption.Enabled = &off + if got := s.stageTrackerPersonPresence(it, rec, true, nil); got.Next != "wait" || got.AdoptAt != nil { + t.Fatalf("disabled: %+v", got) + } + s.deps.Config.Governor.Labels.Stage.Adoption.Enabled = nil + it.Labels = []string{"hold"} + if got := s.stageTrackerPersonPresence(it, rec, true, nil); got.Next != "wait" { + t.Fatalf("held: %+v", got) + } + it.Labels = nil + s.deps.Config.Governor.Labels.Stage.Adoption.AfterOffline = "45m" + got := s.stageTrackerPersonPresence(it, rec, true, offlinePresence(now)) + if got.AdoptAt == nil || !got.AdoptAt.Equal(now.Add(45*time.Minute)) { + t.Fatalf("configured deadline: %+v", got) + } + store.NoteAdoptionBlocked(stagelabels.Key("hivecommons/hive", 14524), "feed", stagelabels.AdoptBlockedAuthorMaintainer, now) + blocked, _ := store.Get(stagelabels.Key("hivecommons/hive", 14524)) + if got := s.stageTrackerPersonPresence(it, blocked, true, offlinePresence(now)); got.Next != "wait" || got.AdoptAt != nil { + t.Fatalf("blocked adoption: %+v", got) + } + it.Kind = "issue" + if got := s.stageTrackerPersonPresence(it, rec, true, nil); got != nil { + t.Fatalf("issue presence = %+v", got) + } +} + +func TestStageTrackerPresenceSharesSnapshot(t *testing.T) { + calls := 0 + lookup := cachedStageTrackerPresence(func(string) (automerge.ContributorPresence, bool) { + calls++ + return automerge.ContributorPresence{Registered: true, Online: calls == 1}, true + }) + first, _ := lookup("hanthor") + second, _ := lookup("hanthor") + if calls != 1 || first != second { + t.Fatalf("inconsistent snapshot: %v %v, calls=%d", first, second, calls) + } +} + +func TestStageTrackerPersonPresencePayload(t *testing.T) { + now := time.Now() + s, store, status := adoptionFixture(t, now, "adopt", offlinePresence(now)) + status.Repos[0].ActionableIssues = []any{github.Issue{Number: 15051, Title: "Covered", Author: "zoe", AuthorIsHuman: true, LinkedPRs: []github.IssueLinkedPR{{Number: 14524, State: "open"}}}} + response := s.buildStageTracker(status, store, now) + it := trackerItem(t, response, "pr", 14524) + if it.Presence == nil || it.Presence.State != "offline" || it.Presence.AdoptAt == nil { + t.Fatalf("missing presence: %+v", it) + } + issue := trackerItem(t, response, "issue", 15051) + if len(issue.LinkedPRs) != 1 || issue.LinkedPRs[0].Presence != it.Presence { + t.Fatalf("sub-row lost presence: %+v", issue.LinkedPRs) + } +} + +func TestStageTrackerPersonPresenceJS(t *testing.T) { + html := indexHTML(t) + script := strings.Join([]string{ + stageTrackerRowActionsPreamble(t, html), + "function selectedDashboardTimeZone() { return 'UTC'; } const _dashboardDateFormatters = new Map();", + jsFunc(t, html, "dashboardDateFormatter"), + jsFunc(t, html, "formatDashboardDateTime"), + jsFunc(t, html, "formatDashboardTime"), + jsFunc(t, html, "stageTrackerShortAgo"), + jsFunc(t, html, "stageTrackerPresenceTip"), + jsFunc(t, html, "stageTrackerPresenceHtml"), + jsFunc(t, html, "stageTrackerAdoptionTip"), + jsFunc(t, html, "stageTrackerAdoptOffered"), + jsFunc(t, html, "stageTrackerAdoptionChipText"), + jsFunc(t, html, "stageTrackerAdoptionChipHtml"), + ` +const now = Date.parse('2026-10-28T16:00:00Z'); +const row = {kind:'pr', presence:{login:'zoe', kind:'clanker', state:'online', available:true, next:'wait', last_seen:'2026-10-28T15:58:00Z'}}; +assert.ok(stageTrackerPresenceTip(row, now).includes("@zoe's clanker: online, last seen 2m ago")); +assert.ok(stageTrackerPresenceHtml(row, now).includes('ham-presence-online')); +assert.ok(stageTrackerPresenceHtml(row, now).includes('aria-label=')); +assert.ok(stageTrackerAdoptionChipHtml(row).includes('waiting on @zoe')); +row.presence.state = 'offline'; +row.presence.since = '2026-10-27T14:00:00Z'; +row.presence.next = 'adopt'; +row.presence.adopt_at = '2026-10-28T16:38:00Z'; +assert.ok(stageTrackerPresenceHtml(row, now).includes('ham-presence-offline')); +assert.ok(stageTrackerPresenceTip(row, now).includes('offline 26h')); +assert.ok(stageTrackerPresenceTip(row, now).includes('hive will adopt at')); +assert.ok(stageTrackerPresenceTip(row, now).includes(formatDashboardTime(Date.parse(row.presence.adopt_at)))); +assert.ok(stageTrackerPresenceTip(row, now).includes('(in 38m)')); +assert.ok(stageTrackerPresenceTip(row, now + 3600000).includes('adoption due')); +row.presence = {login:'zoe', kind:'human', state:'unknown', available:true, next:'wait'}; +assert.ok(stageTrackerPresenceTip(row, now).includes('no clanker registered — waiting for a human reply')); +assert.ok(stageTrackerPresenceHtml(row, now).includes('ham-presence-unknown')); +assert.ok(stageTrackerAdoptionChipHtml(row).includes('human · no clanker')); +row.presence.available = false; +assert.ok(stageTrackerPresenceTip(row, now).includes('presence unavailable')); +assert.ok(!stageTrackerPresenceTip(row, now).includes('no clanker registered')); +assert.strictEqual(stageTrackerPresenceHtml({}, now), ''); +row.presence.login = ''; +assert.ok(!stageTrackerPresenceHtml(row, now).includes('')); +`, + }, "\n") + runStageTrackerRowActionsScript(t, script) + for _, want := range []string{"presence: lp.presence", "stageTrackerPresenceHtml(item, nowMs)", ".ham-presence-online", ".ham-presence-offline", ".ham-presence-unknown", "prefers-reduced-motion: reduce"} { + if !strings.Contains(html, want) { + t.Errorf("missing %q", want) + } + } +} diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 3bc0eecb5b..c34df95591 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -1518,6 +1518,12 @@ status token the sentinel pill on the repo card already uses. */ .ham-badge-sentinel { color: var(--status-error); border-color: color-mix(in srgb, var(--status-error) 55%, transparent); font-weight: var(--fw-medium); } .ham-seg.active.ham-sentinel { background: var(--status-error); color: var(--surface-0); } + .ham-presence { display:inline-block; width:8px; height:8px; margin-right:5px; vertical-align:middle; flex-shrink:0; } + .ham-presence-online { border-radius:var(--r-pill); background:var(--cue-decision); animation:ham-presence-breathe 3s ease-in-out infinite; } + .ham-presence-offline { background:var(--cue-state); } + .ham-presence-unknown { border:1.5px solid var(--cue-work); border-radius:var(--r-pill); } + @keyframes ham-presence-breathe { 50% { opacity:.5; } } + @media (prefers-reduced-motion: reduce) { .ham-presence-online { animation:none; } } /* 072 adoption chip (maintainer-policy, hive PR 14524): "waiting on @author (maintainer, offline 26h) — adopt?" */ .ham-badge-adoption { color: var(--status-warn); border-color: color-mix(in srgb, var(--status-warn) 55%, transparent); font-weight: var(--fw-medium); } .ham-strip { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--sp-1); min-height: 18px; flex: 1 1 auto; min-width: 0; --ham-notch: 8px; } @@ -14190,6 +14196,32 @@

Where to get help

const STAGE_TRACKER_BLOCKED_ON_PR_MERGED = 'merged; the blocked sweep lifts the label next'; const STAGE_TRACKER_BLOCKED_ON_PR_CLOSED = 'closed unmerged; the blocked sweep re-triages it next'; + function stageTrackerPresenceTip(item, nowMs) { + const p = item && item.presence; + if (!p) return ''; + const who = '@' + p.login; + const ago = value => { + const ms = Date.parse(value || ''); + return Number.isFinite(ms) ? stageTrackerShortAgo(Math.max(0, nowMs - ms)) : ''; + }; + let text; + if (!p.available) text = who + ': clanker presence unavailable'; + else if (p.state === 'online') text = who + "'s clanker: online" + (p.last_seen ? ', last seen ' + ago(p.last_seen) + ' ago' : ''); + else if (p.state === 'offline') text = who + "'s clanker: offline" + (p.since ? ' ' + ago(p.since) : ''); + else text = who + ': no clanker registered'; + const at = Date.parse(p.adopt_at || ''); + if (p.next === 'adopt' && Number.isFinite(at)) { + text += at <= nowMs ? ' — adoption due' : ' — hive will adopt at ' + formatDashboardTime(at) + ' (in ' + stageTrackerShortAgo(at - nowMs) + ')'; + } else text += p.kind === 'human' ? ' — waiting for a human reply' : ' — hive is waiting for them'; + return text; + } + function stageTrackerPresenceHtml(item, nowMs) { + const p = item && item.presence; + if (!p) return ''; + const state = p.state === 'online' ? 'online' : p.state === 'offline' ? 'offline' : 'unknown'; + return ``; + } + // The 072 adoption line (`adoption`: {due, blocked_by, since, nudges, // author_online, action, text} — hivecommons/hive#14524): the payload's // plain-words text, '' when the row carries none. @@ -14212,15 +14244,19 @@

Where to get help

return a.blocked_by ? 'not adopted' : ('waiting on ' + (a.author ? '@' + a.author : 'author')); } function stageTrackerAdoptionChipHtml(item) { - const tip = stageTrackerAdoptionTip(item); - if (!tip) return ''; + const tip = [typeof stageTrackerPresenceTip === 'function' ? stageTrackerPresenceTip(item, Date.now()) : '', stageTrackerAdoptionTip(item)].filter(Boolean).join(' · '); + if (!tip && !(item && item.presence)) return ''; const offered = stageTrackerAdoptOffered(item); + const presenceHtml = typeof stageTrackerPresenceHtml === 'function' ? stageTrackerPresenceHtml(item, Date.now()) : ''; + const p = item && item.presence; + const label = stageTrackerAdoptionChipText(item) || (p ? 'waiting on @' + p.login : ''); + const content = presenceHtml + esc(label) + (p && p.available && p.kind === 'human' && p.state === 'unknown' ? ' · human · no clanker' : ''); const cls = 'ham-badge ham-badge-adoption' + (offered ? ' ham-badge-adoption-ask' : ''); // "adopt?" opens the Needs-human popover (its decision_needed carries // the Adopt option) when the popover helpers are present. const decision = offered && typeof stageTrackerDecisionOf === 'function' && item.decision_needed ? stageTrackerDecisionOf(item) : null; - if (decision) return stageTrackerDecisionTriggerHtml(decision, esc(stageTrackerAdoptionChipText(item)), tip, cls); - return `${esc(stageTrackerAdoptionChipText(item))}`; + if (decision) return stageTrackerDecisionTriggerHtml(decision, content, tip, cls); + return `${content}`; } // "Sentinel flagged security-relevant changes at : @@ -14854,7 +14890,7 @@

Where to get help

return { repo: issue.repo, number: lp.number, kind: 'pr', title: lp.title || '', url: lp.url || '', author: lp.author || '', author_kind: lp.author_kind || '', stage: lp.stage || 0, stage_since: lp.stage_since || '', stage_slug: lp.stage_slug || '', modifiers: lp.modifiers || [], deferred_modifiers: lp.deferred_modifiers || [], caption: lp.caption || '', reason: lp.reason || '', human_approver: lp.human_approver || '', manual_merge: !!lp.manual_merge, human_merge_reason: lp.human_merge_reason || '', human_merge_reason_text: lp.human_merge_reason_text || '', sentinel_alert: !!lp.sentinel_alert, sentinel_reason: lp.sentinel_reason || '', head: lp.head || '', decision_needed: lp.decision_needed || null, - adoption: lp.adoption || null, superseded: !!lp.superseded, parent: Number(issue.number) || 0, siblings: open.map(x => Number(x.number) || 0), + presence: lp.presence || null, adoption: lp.adoption || null, superseded: !!lp.superseded, parent: Number(issue.number) || 0, siblings: open.map(x => Number(x.number) || 0), last_operator_action: lp.last_operator_action || null, operator_action_count: lp.operator_action_count || 0 }; } // Pure: whether a linked PR is still open (not merged / closed / superseded). @@ -15048,7 +15084,7 @@

Where to get help

const who = (lp.author_kind || 'hive') + (lp.author ? ' · @' + lp.author : ''); prRefs = [STAGE_TRACKER_LINKED_GLYPH + stageTrackerPRRef(lp.number, lp.url, lp.author_kind || '', lp.author, lp.title, (lp.title ? lp.title + '\n' : '') + 'Author: ' + who + ' · ' + stageTrackerLinkedTip(item, lp.number, ctx)) + (lp.base_ref ? ` ${esc(lp.base_ref)}` : '')]; shown = Object.assign({}, item, { via_pr: true, stage: lp.stage || 40, stage_since: lp.stage_since || item.stage_since, modifiers: lp.modifiers || item.modifiers, deferred_modifiers: lp.deferred_modifiers || item.deferred_modifiers || [], caption: lp.caption || item.caption, reason: lp.reason || item.reason, - human_approver: lp.human_approver || '', manual_merge: !!lp.manual_merge, human_merge_reason: lp.human_merge_reason || '', human_merge_reason_text: lp.human_merge_reason_text || '', sentinel_alert: !!lp.sentinel_alert, sentinel_reason: lp.sentinel_reason || '', head: lp.head || '', decision_needed: lp.decision_needed || null, adoption: lp.adoption || null }); + human_approver: lp.human_approver || '', manual_merge: !!lp.manual_merge, human_merge_reason: lp.human_merge_reason || '', human_merge_reason_text: lp.human_merge_reason_text || '', sentinel_alert: !!lp.sentinel_alert, sentinel_reason: lp.sentinel_reason || '', head: lp.head || '', presence: lp.presence || null, adoption: lp.adoption || null, decision_needed: lp.decision_needed || null }); } else if (linked.length) { // Several covering PRs: the issue strip ends at Claimed, all passed // and nothing lit; one sub-row per PR carries the live chevron. @@ -16884,6 +16920,7 @@

All labels

// Order (owner): WHAT it is waiting on → WHAT you can do → WHO asked, when. return `