From 15747fd458e78124bdbb9ae2dbc9116c4aedec0a Mon Sep 17 00:00:00 2001 From: Andy Anderson Date: Mon, 16 Nov 2026 07:39:12 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=B1=20Inception=20(spek):=20remove=20t?= =?UTF-8?q?he=20Campaigns=20tab?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Retire the Campaigns tab of the Inception (spek) section in favour of sessions: delete static-src/js/campaigns.js and its manifest entry, drop the tab and pane from sessions.js, prune the campaign-only CSS rules (the shared list styles stay for the Experiment Lab and the sessions form), point the /spek chat hints at sessions and spec runs, remove the campaign UI guard tests, and update the docs and FAQ. The /api/campaigns API, Jam and Recheck are retired in a follow-up. Signed-off-by: Andy Anderson --- changelog.d/changed-retire-campaigns-tab.md | 1 + .../api-reference/health-status-events.md | 2 +- .../dashboard-sections/workflow-and-agents.md | 2 +- src/docs/inception.md | 34 +- src/docs/spektacular.md | 27 +- src/pkg/dashboard/api_campaigns_test.go | 32 -- .../dashboard/dashboard_history_cap_test.go | 6 - src/pkg/dashboard/sessions_ui.test.js | 17 +- .../static-src/css/review-campaigns.css | 21 +- src/pkg/dashboard/static-src/html/faq.html | 4 +- src/pkg/dashboard/static-src/js/campaigns.js | 391 --------------- src/pkg/dashboard/static-src/js/chat.js | 4 +- src/pkg/dashboard/static-src/js/sessions.js | 37 +- src/pkg/dashboard/static-src/manifest.txt | 1 - src/pkg/dashboard/static/index.html | 457 +----------------- 15 files changed, 67 insertions(+), 969 deletions(-) create mode 100644 changelog.d/changed-retire-campaigns-tab.md delete mode 100644 src/pkg/dashboard/static-src/js/campaigns.js diff --git a/changelog.d/changed-retire-campaigns-tab.md b/changelog.d/changed-retire-campaigns-tab.md new file mode 100644 index 0000000000..a68958f514 --- /dev/null +++ b/changelog.d/changed-retire-campaigns-tab.md @@ -0,0 +1 @@ +- Inception (spek): the **Campaigns** tab is removed from the Inception (spek) section, which now lists only sessions. Nothing has created inception campaigns since the wizard was removed, **Continue** had no wizard to return to, and the Spektacular rows repeated what the Runs view already shows. Start a session for new inception work and use Runs for Spektacular runs. The `/api/campaigns` endpoints, campaign Jam and campaign recheck still answer API callers for now and are retired in a follow-up change. Archived campaign files under `/data/inception/campaigns/` are not touched. diff --git a/src/docs/api-reference/health-status-events.md b/src/docs/api-reference/health-status-events.md index 0a80a12242..b8045d9eb5 100644 --- a/src/docs/api-reference/health-status-events.md +++ b/src/docs/api-reference/health-status-events.md @@ -51,7 +51,7 @@ Part of the [Dashboard REST API reference](../api-reference.md); see that page f | `POST` | `/api/runs/{key}/checkpoint` | Owner only | Resolve a compact checkpoint decision. Body `{"action":"approve"|"reject","gen":}`; refuses stale generations with 409 and non-owner callers with 403 before mutating the plan. | `pkg/dashboard/api.go:96` | | `GET` | `/api/runs/{key}` | Dashboard auth/session | One run by URL-escaped canonical run key (`owner/repo%23number`); early lease-shaped keys (`repo!run-key:stage`) and queued Wavefront run-stage keys (`owner/repo!graph:node`) are also accepted. Includes timeline-derived stage history in the same `Run` shape as `/api/runs` when a lease/timeline exists. History entries that came from an owner reset carry the owner's `reason`. When the key belongs to a wired convergence campaign, the detail response also includes an optional `burndown` block with `source`, `satisfied`, `remaining`, `unknown`, and `scope`; the list endpoint omits this block. | `pkg/dashboard/api.go:97` | | `POST` | `/api/runs/{key}/reset` | Owner only | Move a run's lease back to an earlier stage (for example `implement` to `plan` after a rejected plan). Body `{"to": "", "reason": ""}`, both required. Mints a new generation so the relay holding the old one can no longer resume, persists before answering, and records the reason on the agent audit sink, the lifecycle timeline, and the `stage_completed` hook payload (`attrs.reset = "true"`). Returns `{ok, key, stage_from, stage, gen, reason}`. 400 for the same or a later stage or a missing reason, 404 when no live staged lease holds the key, 409 when the lease expired, 500 when the registry could not be written. | `pkg/dashboard/api.go:98` | -| `GET` | `/api/campaigns` | Dashboard auth/session | List resumable campaigns from archived Inception sessions and retained Spektacular (Spek) runs. Query `search`/`q`, `repo`, `stage`, `status`, and `owner`; each campaign is keyed by stable spec/session id and includes title, source, repos, current stage/step, artifact links, linked issues/PRs, contributors, last activity, status, engine, type, run link when applicable, `superseded_by` when a newer Revise revision exists, and recheck status (`enabled`, `interval`, `last_at`, `next_at`, `in_flight`, `last_delta_count`, `external_count`, `sources_failed`). | `pkg/dashboard/api.go:99` | +| `GET` | `/api/campaigns` | Dashboard auth/session | List resumable campaigns from archived Inception sessions and retained Spektacular (Spek) runs. API only: the dashboard's Campaigns tab was retired in favour of Inception (spek) sessions, and this endpoint is being retired. Query `search`/`q`, `repo`, `stage`, `status`, and `owner`; each campaign is keyed by stable spec/session id and includes title, source, repos, current stage/step, artifact links, linked issues/PRs, contributors, last activity, status, engine, type, run link when applicable, `superseded_by` when a newer Revise revision exists, and recheck status (`enabled`, `interval`, `last_at`, `next_at`, `in_flight`, `last_delta_count`, `external_count`, `sources_failed`). | `pkg/dashboard/api.go:99` | | `GET` | `/api/campaigns/{id}` | Dashboard auth/session | Return one campaign by URL-escaped stable campaign id or run key, using the same campaign shape as `/api/campaigns`; recheck revisions may include a `drift` block with `codebase_changed`, `prior_revision`, `delta_count`, `recheck_reason`, `external[]` (`source`, `kind`, `title`, `url`, `published_at`, `summary`), `external_count`, and `sources_failed`. | `pkg/dashboard/api.go:100` | | `POST` | `/api/campaigns/{id}/resume` | Owner only | Resume or pick up a campaign. Archived Inception campaigns take a durable campaign lease, restore their saved state and wiki working files; Spek campaigns return the retained run detail plus a CLI status command that reloads state from Spek artifacts. Body may include `{ "surface": "chat"|"contributor"|"cli"|"dashboard" }`; 409 means another user holds the lease. | `pkg/dashboard/api.go:101` | | `POST` | `/api/campaigns/{id}/release` | Owner only | Release the caller's Inception campaign lease and write a `campaign_release` audit entry so another user can continue it. Run-backed Spektacular campaigns return `409 Conflict`; this endpoint never revokes their run-lifecycle stage leases. | `pkg/dashboard/api.go:102` | diff --git a/src/docs/dashboard-sections/workflow-and-agents.md b/src/docs/dashboard-sections/workflow-and-agents.md index e0015d58ca..1b50a52a10 100644 --- a/src/docs/dashboard-sections/workflow-and-agents.md +++ b/src/docs/dashboard-sections/workflow-and-agents.md @@ -176,7 +176,7 @@ There is no lab-wide progress bar. The whole-Hive snapshot count is a total, not Named terminal sessions where a command-line AI agent runs inside Hive; everyone who can see a session watches it live, one person at a time holds the keyboard, and people with write access can join in. -**What it tells you.** A tab strip lists each session, grouped under headings you choose, with the CLI it runs and how many browsers are attached; a tab's tooltip names who holds the keyboard and who is watching, and the workspace (the hive's shared checkout of the project repo, with its spek skills) the session runs in. A **Campaigns** tab keeps the campaigns and Jam view that used to live in the removed Inception wizard. The selected tab shows a live terminal; its header reads `keyboard: andy · watching: bob, carol` and offers **Take keyboard** or **Release keyboard**; a viewer without the keyboard sees `watching`. Ended sessions show their last output and a **Resume** button. +**What it tells you.** A tab strip lists each session, grouped under headings you choose, with the CLI it runs and how many browsers are attached; a tab's tooltip names who holds the keyboard and who is watching, and the workspace (the hive's shared checkout of the project repo, with its spek skills) the session runs in. The tab strip holds sessions only: the **Campaigns** tab (the campaigns and Jam view carried over from the removed Inception wizard) was retired; start a session for new inception work and use [Runs](../runs.md) for Spektacular runs. The selected tab shows a live terminal; its header reads `keyboard: andy · watching: bob, carol` and offers **Take keyboard** or **Release keyboard**; a viewer without the keyboard sees `watching`. Ended sessions show their last output and a **Resume** button. **How the numbers are worked out.** The attached count is the number of browsers currently attached to that terminal. Only the keyboard holder's terminal accepts typing (everyone else is attached read-only), so typing is attributed to the holder of record; the creator holds the keyboard first, owners and the creator can take it at any time, and another writer can take it once it is released or the holder has been idle for a minute. Text from the input bar under the terminal (Send, Send and run, Attach file) is **queued** and typed only when the CLI prompt is idle, so two people's sends never interleave; the button reads `Send · queued behind N`, the list under the bar shows whose turn it is with Cancel on your own items, and each delivery is attributed to whoever queued it in the audit log. diff --git a/src/docs/inception.md b/src/docs/inception.md index 95cab95a6d..60dc6cd122 100644 --- a/src/docs/inception.md +++ b/src/docs/inception.md @@ -11,8 +11,11 @@ see a session watches it live, one person at a time holds the keyboard, and and the [Sessions API](api-reference/sessions.md). The dashboard's old step-by-step Inception wizard was removed; Inception (spek) -replaces it. Its Campaigns and Jam view is the **Campaigns** tab of the -Inception (spek) section. +replaces it. The **Campaigns** tab that carried the wizard's campaigns and Jam +view over into Inception (spek) has been retired too: start a session for new +inception work, and find Spektacular runs in [Runs](runs.md). The +`/api/campaigns` endpoints, campaign Jam and campaign recheck are being retired +in follow-up changes. The rest of this guide covers the ACMM **L1 ("Inception")** workflow behind `/api/inception/*`, which is unchanged and still available to API callers. It @@ -113,8 +116,9 @@ owner role for state-changing calls) drives them: completion remains a no-op for run admission. 7. If anything goes wrong, `POST /api/inception/reset` first archives the current state and wiki files as an Inception campaign, then clears the - active state and state file. The Campaigns tab lists that archived - session, so a reset does not discard completed work. + active state and state file under `inception/campaigns//`, so a reset + does not discard completed work. The dashboard no longer lists these + archives. Optional wiki-management calls, usable at any point once an inception has produced wiki files: @@ -180,15 +184,19 @@ recorded as advisory beads, unrelated to any specific inception run. ## Campaigns and resume -The **Campaigns** tab of the Inception (spek) section lists campaigns. Each -row is a resumable unit of work keyed by its stable session/spec id: +The dashboard no longer shows campaigns: the **Campaigns** tab of the +Inception (spek) section was retired in favour of +[Inception (spek) sessions](dashboard-sections/workflow-and-agents.md#inception-spek). +Until the endpoints are retired, `GET /api/campaigns` still lists them for API +callers. Each entry is a unit of work keyed by its stable session/spec id: -- Archived L1 sessions have type `inception` and engine `Spec Kit`. Pressing - **Continue** calls `POST /api/campaigns/{id}/resume`, takes a durable +- Archived L1 sessions have type `inception` and engine `Spec Kit`. + `POST /api/campaigns/{id}/resume` takes a durable campaign lease and restores the saved inception state and wiki working files, so the API workflow above continues from the archived phase (the dashboard has no wizard to reopen). A second operator gets - a 409 until the holder presses **Release** or the lease expires. + a 409 until the holder calls `POST /api/campaigns/{id}/release` or the lease + expires. - Spektacular (Spek)-backed runs have type `spektacular`, engine `Spektacular`, and a `/api/runs/{key}` link. Resume returns the retained run detail and a CLI status command; Spek itself reloads state from its working files and @@ -198,12 +206,8 @@ row is a resumable unit of work keyed by its stable session/spec id: - **Revise** calls `POST /api/campaigns/{id}/revise` and creates a new campaign linked with `revision_of`/`revision`, so changed requirements branch from the shipped campaign instead of erasing its trail. The list marks the - older campaign with `superseded_by`, and the dashboard shows one row per - Revise chain — the newest revision, with a `rev N` pill and an - "N earlier revisions" disclosure that can still continue or delete each - older revision — instead of one identical row per click. -- **🗑 Delete** (icon button at the end of each row) calls - `DELETE /api/campaigns/{id}` after an in-app confirmation. It removes only + older campaign with `superseded_by`. +- `DELETE /api/campaigns/{id}` (owner only) removes only the campaign record: the saved Inception state and the archived wiki snapshot under `inception/campaigns//`. Knowledge-base facts, Jam threads, scaffolded repo files and the other revisions in the chain are diff --git a/src/docs/spektacular.md b/src/docs/spektacular.md index 2f98e63b39..f1cc46ce37 100644 --- a/src/docs/spektacular.md +++ b/src/docs/spektacular.md @@ -10,8 +10,10 @@ The runner is OFF by default. With `runs.spektacular.enabled` unset or `false` Hive never starts a Spek process and every existing lease behaviour is unchanged. -Every retained Spek run is also projected as a dashboard campaign under -`GET /api/campaigns`. The campaign id is the stable run/spec key (the same bare +Every retained Spek run is also projected as a campaign under +`GET /api/campaigns` (API only: the dashboard's Campaigns tab was retired in +favour of Inception (spek) sessions, and the run itself is listed in +[Runs](runs.md); the endpoint is being retired in a follow-up change). The campaign id is the stable run/spec key (the same bare artifact name the status verbs use), the engine is `Spektacular`, and the row links back to `/api/runs/{key}` when run detail is available. Picking up a Spek campaign does not copy spek contents into Hive; `POST @@ -21,10 +23,12 @@ spek backend. ## Jam Sessions -Each campaign also has a Jam workspace for team interaction around the spec. -The dashboard Campaigns list exposes a **Jam** action, backed by -`/api/campaigns/{id}/jam` and the `/threads`, `/suggestions`, and `/polls` -subroutes. Phase 1 is async: participants with read-write access can anchor +Each campaign also has a Jam workspace for team interaction around the spec, +backed by `/api/campaigns/{id}/jam` and the `/threads`, `/suggestions`, and +`/polls` subroutes. The dashboard no longer has a Jam view (it lived in the +retired Campaigns tab); use a shared +[Inception (spek) session](dashboard-sections/workflow-and-agents.md#inception-spek) +to work on a spec together. Phase 1 is async: participants with read-write access can anchor threads and suggestions to spec sections, vote in advisory polls, and resume the workspace after a restart. Maintainers record poll decisions with a rationale; accepted suggestions and decisions create attributed spec revisions @@ -36,11 +40,13 @@ Live spec edits carry the sender's last seen spec revision; stale edits are rejected with a conflict message instead of overwriting newer work, so reconnecting clients can refresh and merge intentionally. -Maintainers can opt a campaign into GitHub Projects sync from the Jam tab. The +Maintainers can opt a campaign into GitHub Projects sync through +`POST /api/campaigns/{id}/jam/project-sync`. The sync publishes the current spec, recorded decisions, and derived suggestion items to the linked project; inbound project status updates are recorded on the campaign without rewriting local Jam decisions. Sync failures are kept with -retry guidance so the dashboard shows what to fix before trying again. +retry guidance in the `project-sync` response so a caller can see what to fix +before trying again. Sync posts to `https://api.github.com/graphql` with the hive's `GITHUB_TOKEN`. `HIVE_JAM_PROJECT_SYNC_URL` overrides the endpoint; an override must use @@ -508,9 +514,8 @@ invoke `upstreamwatch`'s multi-page PR and release scanner. Campaign list/detail JSON includes `recheck: {enabled, interval, last_at, next_at, in_flight, last_delta_count, external_count, sources_failed}`; recheck revisions also include the `drift` -block above. The dashboard Campaigns panel renders the cadence, shows -`N external signals` with an expandable list, and provides an owner-only -Recheck action. +block above. The dashboard no longer renders campaigns (the Campaigns tab was +retired), so read the cadence and signals from the JSON. ## Defensive handling of the open questions diff --git a/src/pkg/dashboard/api_campaigns_test.go b/src/pkg/dashboard/api_campaigns_test.go index 70637b952d..1cf5276984 100644 --- a/src/pkg/dashboard/api_campaigns_test.go +++ b/src/pkg/dashboard/api_campaigns_test.go @@ -472,35 +472,3 @@ func TestCampaignDeleteRejectsRunBackedSpektacular(t *testing.T) { t.Fatalf("run-backed delete = %d body=%s, want 409", del.Code, del.Body.String()) } } - -// TestCampaignDeleteUI pins the dashboard side of hivecommons/hive#12698: an -// icon-only 🗑 button in the nous-exp-icon style with aria-label/title -// "Delete campaign", an in-app hiveConfirm (never window.confirm) that spells -// out what is removed and what is kept, and Revise chains folded to one row. -func TestCampaignDeleteUI(t *testing.T) { - html := indexHTML(t) - for _, want := range []string{ - `nousExpIconButton('deleteCampaign', escapeHtml(c.id), '', 'Delete campaign', '🗑', 'nous-exp-icon-delete campaign-delete')`, - "async function deleteCampaign(id) {", - "const CAMPAIGN_DELETE_CONFIRM_TITLE = 'Delete this campaign?';", - "await hiveConfirm({ title: CAMPAIGN_DELETE_CONFIRM_TITLE, message: campaignDeleteConfirmMessage(c), confirmLabel: 'Delete campaign', cancelLabel: 'Keep', danger: true });", - "Kept: knowledge-base facts, Jam threads, and anything already scaffolded or pushed to the repo.", - "fetch('/api/campaigns/' + encodeURIComponent(id), { method: 'DELETE', headers: _inceptionAuthHeaders() })", - "function campaignRevisionChains(campaigns) {", - `
${hist.length} earlier ${hist.length === 1 ? 'revision' : 'revisions'}`, - `class="campaign-pill campaign-revision-pill"`, - ".nous-exp-icon-delete:hover, .nous-exp-icon-delete:focus-visible { color: var(--red); }", - } { - if !strings.Contains(html, want) { - t.Errorf("index.html missing %q", want) - } - } - start := strings.Index(html, "async function deleteCampaign(id) {") - end := strings.Index(html[start:], "let _campaignJamSocket = null;") - if start < 0 || end < 0 { - t.Fatalf("could not isolate deleteCampaign block") - } - if body := html[start : start+end]; strings.Contains(body, "window.confirm(") || strings.Contains(body, " confirm(") || strings.Contains(body, "alert(") { - t.Fatalf("deleteCampaign must use the in-app dialog, not native confirm/alert") - } -} diff --git a/src/pkg/dashboard/dashboard_history_cap_test.go b/src/pkg/dashboard/dashboard_history_cap_test.go index f36fdba0c3..2caef37190 100644 --- a/src/pkg/dashboard/dashboard_history_cap_test.go +++ b/src/pkg/dashboard/dashboard_history_cap_test.go @@ -81,10 +81,4 @@ func TestDashboardLiveConnectionsCloseBeforeReconnect(t *testing.T) { t.Fatalf("connect() missing %q", want) } } - jam := jsFunctionBody(t, html, "function connectCampaignJamLive(id)") - for _, want := range []string{"prev.onclose = null", "prev.close()"} { - if !strings.Contains(jam, want) { - t.Fatalf("connectCampaignJamLive missing %q", want) - } - } } diff --git a/src/pkg/dashboard/sessions_ui.test.js b/src/pkg/dashboard/sessions_ui.test.js index a80460c1ff..c5af64a6db 100644 --- a/src/pkg/dashboard/sessions_ui.test.js +++ b/src/pkg/dashboard/sessions_ui.test.js @@ -27,23 +27,24 @@ test('sessions are grouped alphabetically with the ungrouped bucket last', () => assert.deepStrictEqual(h.sessionsGroupSessions(undefined), []); }); -test('selected tab falls back to the first session, then to Campaigns', () => { +test('selected tab falls back to the first session, then to none', () => { const list = [S('a', ''), S('b', '')]; assert.strictEqual(h.sessionsPickSelected(list, 'b'), 'b'); assert.strictEqual(h.sessionsPickSelected(list, 'gone'), 'a'); - assert.strictEqual(h.sessionsPickSelected(list, 'campaigns'), 'campaigns'); - assert.strictEqual(h.sessionsPickSelected([], 'gone'), 'campaigns'); - assert.strictEqual(h.sessionsPickSelected(null, ''), 'campaigns'); + // The retired Campaigns tab id, still remembered in some browsers, falls through. + assert.strictEqual(h.sessionsPickSelected(list, 'campaigns'), 'a'); + assert.strictEqual(h.sessionsPickSelected([], 'gone'), ''); + assert.strictEqual(h.sessionsPickSelected(null, ''), ''); }); test('arrow keys walk the visible tabs and wrap; collapsed groups keep only the selected tab', () => { const list = [S('a', 'g1'), S('b', 'g1'), S('c', 'g2')]; const order = h.sessionsTabOrder(list, { g1: true }, 'b'); - assert.deepStrictEqual(order, ['b', 'c', 'campaigns']); - assert.strictEqual(h.sessionsNextTab(order, 'campaigns', 'ArrowRight'), 'b'); - assert.strictEqual(h.sessionsNextTab(order, 'b', 'ArrowLeft'), 'campaigns'); + assert.deepStrictEqual(order, ['b', 'c']); + assert.strictEqual(h.sessionsNextTab(order, 'c', 'ArrowRight'), 'b'); + assert.strictEqual(h.sessionsNextTab(order, 'b', 'ArrowLeft'), 'c'); assert.strictEqual(h.sessionsNextTab(order, 'c', 'Home'), 'b'); - assert.strictEqual(h.sessionsNextTab(order, 'b', 'End'), 'campaigns'); + assert.strictEqual(h.sessionsNextTab(order, 'b', 'End'), 'c'); assert.strictEqual(h.sessionsNextTab(order, 'b', 'x'), ''); assert.strictEqual(h.sessionsNextTab([], 'b', 'ArrowRight'), ''); }); diff --git a/src/pkg/dashboard/static-src/css/review-campaigns.css b/src/pkg/dashboard/static-src/css/review-campaigns.css index 8f061cc450..769f410870 100644 --- a/src/pkg/dashboard/static-src/css/review-campaigns.css +++ b/src/pkg/dashboard/static-src/css/review-campaigns.css @@ -2,7 +2,6 @@ .campaigns-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-5); flex-wrap: wrap; } .campaigns-title { font-size: var(--fs-md); font-weight: 700; } .campaigns-subtitle { color: var(--muted); font-size: var(--fs-sm); margin-top: var(--sp-1); } - .campaigns-filters { display: grid; grid-template-columns: minmax(180px, 2fr) repeat(4, minmax(110px, 1fr)) auto; gap: var(--sp-3); margin-bottom: var(--sp-5); } .campaigns-input { background: var(--bg); color: var(--fg); border: 1px solid var(--border); border-radius: var(--r-sm); padding: var(--sp-3) var(--sp-4); font: inherit; font-size: var(--fs-sm); min-width: 0; } .campaigns-list { display: grid; gap: var(--sp-3); } .campaign-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-4); align-items: center; border: 1px solid var(--border); border-radius: var(--r); padding: var(--sp-4); background: color-mix(in srgb, var(--border) 8%, transparent); } @@ -10,27 +9,9 @@ .campaign-row-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .campaign-row-meta { display: flex; gap: var(--sp-3); flex-wrap: wrap; color: var(--muted); font-size: var(--fs-sm); margin-top: var(--sp-2); } .campaign-pill { border: 1px solid var(--border); border-radius: var(--r-pill); padding: var(--sp-1) var(--sp-3); color: var(--muted); } - .campaign-revision-pill { border-color: var(--accent); color: var(--accent); } - /* Revise chains fold into one row; earlier revisions live in a - disclosure with their own Continue / Delete icon buttons (#12698). */ - .campaign-history-list { display: grid; gap: var(--sp-2); margin-top: var(--sp-2); width: 100%; } - .campaign-history-row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; border-top: 1px dashed var(--border); padding-top: var(--sp-2); } - .campaign-history-row .campaign-row-actions { margin-left: auto; } .campaign-row-actions .nous-exp-icon { align-self: center; } - .nous-exp-icon-delete:hover, .nous-exp-icon-delete:focus-visible { color: var(--red); } .campaign-empty { color: var(--muted); text-align: center; padding: var(--sp-7); border: 1px dashed var(--border); border-radius: var(--r); } - .campaign-jam { margin-top: var(--sp-5); display: grid; gap: var(--sp-4); } - .campaign-jam-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); } - .campaign-jam-box { border: 1px solid var(--border); border-radius: var(--r); padding: var(--sp-4); background: color-mix(in srgb, var(--border) 6%, transparent); } - .campaign-jam-box h4 { margin: 0 0 var(--sp-3); font-size: var(--fs-sm); } - .campaign-jam-list { display: grid; gap: var(--sp-2); color: var(--muted); font-size: var(--fs-sm); } - .campaign-jam-form { display: grid; gap: var(--sp-2); margin-top: var(--sp-3); } - .campaign-jam-form textarea { min-height: 72px; resize: vertical; } - .campaign-jam-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; } - .campaign-jam-live { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; } - .campaign-jam-live-pill { border: 1px solid var(--border); border-radius: var(--r-full); padding: var(--sp-1) var(--sp-2); background: var(--bg); color: var(--fg); } - @media (max-width: 1100px) { .campaign-jam-grid { grid-template-columns: 1fr; } } - @media (max-width: 900px) { .campaigns-filters { grid-template-columns: 1fr 1fr; } .campaign-row { grid-template-columns: minmax(0, 1fr); } .campaign-row > div { min-width: 0; } .campaign-row-actions { justify-content: flex-start; } } + @media (max-width: 900px) { .campaign-row { grid-template-columns: minmax(0, 1fr); } .campaign-row > div { min-width: 0; } .campaign-row-actions { justify-content: flex-start; } } /* Review queue (#9607) */ .review-subsection { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--dash-section-header-gap, var(--sp-3)); margin: var(--sp-2) 0 var(--sp-7); } .review-subsection + .review-subsection { margin-top: var(--sp-7); } diff --git a/src/pkg/dashboard/static-src/html/faq.html b/src/pkg/dashboard/static-src/html/faq.html index b7488c847a..09ad0b0e09 100644 --- a/src/pkg/dashboard/static-src/html/faq.html +++ b/src/pkg/dashboard/static-src/html/faq.html @@ -134,7 +134,7 @@

Runs, inception and the Experiment Lab

What is Inception (spek), and where did the Inception wizard go? -

The step-by-step Inception wizard was removed; the dashboard's Inception (spek) section replaces it (on by default; an owner can turn it off in Settings, which hides the section): named terminal tabs where a command-line AI agent runs inside Hive, shared with everyone on the hive. People with the read role see a read-only scrollback. Typing in a terminal is shared and not attributed to individual people. Campaigns and Jam moved to a Campaigns tab. See Inception (spek).

+

The step-by-step Inception wizard was removed; the dashboard's Inception (spek) section replaces it (on by default; an owner can turn it off in Settings, which hides the section): named terminal tabs where a command-line AI agent runs inside Hive, shared with everyone on the hive. People with the read role see a read-only scrollback. Typing in a terminal is shared and not attributed to individual people. The Campaigns tab that briefly carried the old campaigns and Jam view was retired as well; Spektacular runs are in Runs. See Inception (spek).

@@ -159,7 +159,7 @@

Runs, inception and the Experiment Lab

Can I run more than one experiment at once? -

Yes. The Experiment Lab lists each running experiment as its own card — research question, scope pills, status and a baseline bar reading N / 672 (≈ 7 days of observations, 4 per hour) — and + New experiment adds another beside them, the same way the Inception section lists its campaigns. The one rule is that two running experiments may not share a repo target (or both be hive-wide): concurrent interventions on the same scope would confound each other's outcomes, so the lab refuses the second one and offers to pause the first or narrow the scope. Archived experiments stay read-only under Previous experiments. See running several experiments at once.

+

Yes. The Experiment Lab lists each running experiment as its own card — research question, scope pills, status and a baseline bar reading N / 672 (≈ 7 days of observations, 4 per hour) — and + New experiment adds another beside them, one card per experiment. The one rule is that two running experiments may not share a repo target (or both be hive-wide): concurrent interventions on the same scope would confound each other's outcomes, so the lab refuses the second one and offers to pause the first or narrow the scope. Archived experiments stay read-only under Previous experiments. See running several experiments at once.

Each card also says where it is: collecting baseline, ready — generate proposals (one button; the lab switches to Suggest for you), proposals awaiting your review, running or concluded. Entering a question is what creates the card — you never have to find a mode switch first.

diff --git a/src/pkg/dashboard/static-src/js/campaigns.js b/src/pkg/dashboard/static-src/js/campaigns.js deleted file mode 100644 index cef6e2beca..0000000000 --- a/src/pkg/dashboard/static-src/js/campaigns.js +++ /dev/null @@ -1,391 +0,0 @@ - // ── Campaigns + Jam (Spek / inception campaign archive) ── - // Moved out of inception.js so the Campaigns and Jam UI survives the - // Inception wizard's removal; it is the Campaigns tab of the Inception - // (spek) section (sessions.js). Plain top-level declarations, shared - // through the single concatenated dashboard script; keep this file adjacent to it in manifest.txt. - let _campaigns = []; - - async function loadCampaigns() { - try { - const params = new URLSearchParams(); - ['search', 'repo', 'stage', 'status', 'owner'].forEach(function(name) { - const el = document.getElementById('campaign-filter-' + name); - if (el && el.value.trim()) params.set(name, el.value.trim()); - }); - const qs = params.toString(); - const r = await fetch('/api/campaigns' + (qs ? '?' + qs : ''), {headers: _inceptionAuthHeaders()}); - const data = await r.json(); - if (data.ok) { - _campaigns = data.campaigns || []; - renderCampaignsList(); - } - } catch (e) { console.error('campaign load failed', e); } - } - - function renderCampaignsPanel() { - return ` -
-
-
Campaigns
Resumable Inception and Spek sessions keyed by stable spec ID.
- -
-
- - - - - - -
-
Loading campaigns…
-
-
`; - } - - // Revise chains (#12698): every Revise mints a linked `-rev-N` - // archive with the same title, so the API marks the older ones with - // `superseded_by`. Show one row per chain (the newest revision) and fold - // the earlier ones into a history disclosure under it. - function campaignRevisionChains(campaigns) { - const byId = {}; - (campaigns || []).forEach(function(c) { byId[c.id] = c; }); - const latest = (campaigns || []).filter(function(c) { return !c.superseded_by || !byId[c.superseded_by]; }); - return latest.map(function(head) { - const earlier = []; - const seen = {}; - let cur = head; - while (cur && cur.revision_of && byId[cur.revision_of] && !seen[cur.revision_of]) { - seen[cur.revision_of] = true; - cur = byId[cur.revision_of]; - earlier.push(cur); - } - return { head: head, history: earlier }; - }); - } - - function campaignDeleteButton(c) { - return nousExpIconButton('deleteCampaign', escapeHtml(c.id), '', 'Delete campaign', '🗑', 'nous-exp-icon-delete campaign-delete'); - } - - function renderCampaignRow(c, history) { - const repo = (c.repos || []).join(', ') || 'no repo'; - const activity = c.last_activity || 'no activity'; - const engine = c.engine || 'unknown engine'; - const rc = c.recheck || {}; - const recheckText = rc.enabled ? `Rechecks every ${escapeHtml(rc.interval || 'default')} · next ${escapeHtml(rc.next_at ? relativeAge(rc.next_at) : 'not scheduled')} · last delta ${Number(rc.last_delta_count || 0)}` : 'Rechecks off'; - const drift = c.drift || {}; - const external = Array.isArray(drift.external) ? drift.external : []; - const failed = Array.isArray(rc.sources_failed) ? rc.sources_failed : (Array.isArray(drift.sources_failed) ? drift.sources_failed : []); - const recheckExternal = external.length ? `
${Number(drift.external_count || external.length)} external signals
${external.map(ev => `
${escapeHtml(ev.source || '')} · ${escapeHtml(ev.kind || '')}: ${ev.url ? `${escapeHtml(ev.title || ev.url)}` : escapeHtml(ev.title || '')}${ev.summary ? `
${escapeHtml(ev.summary)}` : ''}
`).join('')}${failed.length ? `
Failed sources: ${failed.map(f => `${escapeHtml(f.name || '')} (${escapeHtml(f.reason || '')})`).join(', ')}
` : ''}
` : (Number(rc.external_count || 0) ? `
${Number(rc.external_count || 0)} external signals
` : ''); - const recheckDisabled = rc.in_flight ? ' disabled' : ''; - const revisionPill = c.revision ? `rev ${Number(c.revision)}` : ''; - const hist = Array.isArray(history) ? history : []; - const historyBlock = hist.length ? `
${hist.length} earlier ${hist.length === 1 ? 'revision' : 'revisions'}
${hist.map(function(h) { - return `
${h.revision ? 'rev ' + Number(h.revision) : 'original'}${escapeHtml(h.id)}${escapeHtml(h.status || 'parked')}${escapeHtml(h.last_activity || '')}${nousExpIconButton('resumeCampaign', escapeHtml(h.id), '', 'Continue this revision', '▶', 'nous-exp-icon-resume')}${campaignDeleteButton(h)}
`; - }).join('')}
` : ''; - return `
-
-
${escapeHtml(c.title || c.id)}
-
- ${escapeHtml(c.status || 'parked')} - ${revisionPill} - ${escapeHtml(c.current_stage || '')}${c.current_step ? ' / ' + escapeHtml(c.current_step) : ''} - ${escapeHtml(repo)} - ${escapeHtml(engine)} - ${escapeHtml(activity)} -
-
${recheckText}
- ${recheckExternal} - ${historyBlock} -
-
- - - - - - ${campaignDeleteButton(c)} -
-
`; - } - - function renderCampaignsList() { - const list = document.getElementById('campaigns-list'); - if (!list) return; - if (!_campaigns || _campaigns.length === 0) { - list.innerHTML = '
No campaigns yet. Reset or completed inception runs are archived here.
'; - return; - } - list.innerHTML = campaignRevisionChains(_campaigns).map(function(chain) { return renderCampaignRow(chain.head, chain.history); }).join(''); - } - - // Delete only removes the campaign record (saved inception state + wiki - // snapshot). KB facts, Jam threads and scaffolded repo files are kept. - // In-app hiveConfirm dialog; native browser dialogs are forbidden (#12698). - const CAMPAIGN_DELETE_CONFIRM_TITLE = 'Delete this campaign?'; - function campaignDeleteConfirmMessage(c) { - const label = (c && (c.title || c.id)) || 'this campaign'; - const rev = c && c.revision ? ` (revision ${Number(c.revision)})` : ''; - return `Removes the campaign record for "${label}"${rev}: its saved Inception state and the archived wiki snapshot. It disappears from this list and cannot be continued or revised.\n\nKept: knowledge-base facts, Jam threads, and anything already scaffolded or pushed to the repo. Other revisions in the same chain are not affected.`; - } - - async function deleteCampaign(id) { - if (!id) return; - const c = (_campaigns || []).find(function(x) { return x.id === id; }) || { id: id }; - const ok = await hiveConfirm({ title: CAMPAIGN_DELETE_CONFIRM_TITLE, message: campaignDeleteConfirmMessage(c), confirmLabel: 'Delete campaign', cancelLabel: 'Keep', danger: true }); - if (!ok) return; - try { - const r = await fetch('/api/campaigns/' + encodeURIComponent(id), { method: 'DELETE', headers: _inceptionAuthHeaders() }); - const data = await r.json().catch(function() { return {}; }); - if (!r.ok || !data.ok) { showToast(data.error || 'Failed to delete campaign', 'error'); return; } - _campaigns = (_campaigns || []).filter(function(x) { return x.id !== id; }); - renderCampaignsList(); - showToast('Campaign deleted — knowledge-base facts and Jam threads kept', 'info'); - await loadCampaigns(); - } catch (e) { showToast('Error: ' + e.message, 'error'); } - } - - let _campaignJamSocket = null; - let _campaignJamLiveRevision = ''; - - async function openCampaignJam(id) { - if (!id) return; - const panel = document.getElementById('campaign-jam-panel'); - if (panel) panel.innerHTML = '
Loading Jam…
'; - try { - const r = await fetch('/api/campaigns/' + encodeURIComponent(id) + '/jam', {headers: _inceptionAuthHeaders()}); - const data = await r.json(); - if (!data.ok) { throw new Error(data.error || 'Failed to load Jam'); } - renderCampaignJam(id, data.jam || {}); - connectCampaignJamLive(id); - } catch (e) { - if (panel) panel.innerHTML = '
Jam failed: ' + escapeHtml(e.message) + '
'; - } - } - - function renderCampaignJam(id, jam) { - const panel = document.getElementById('campaign-jam-panel'); - if (!panel) return; - const threads = jam.threads || []; - const suggestions = jam.suggestions || []; - const polls = jam.polls || []; - const revisions = jam.revisions || []; - const projectSync = jam.project_sync || {}; - _campaignJamLiveRevision = jam.spec_revision_id || ''; - panel.innerHTML = ` -
-
Jam: ${escapeHtml(id)}
Async section threads, suggestions, polls, decisions and attributed spec revisions.
- -
-
-

Live session

-
Connecting…
-
- - -
- - -
-
-
-
-
-

Threads

-
${threads.length ? threads.map(t => `
${escapeHtml(t.section || 'section')}: ${escapeHtml((t.comments && t.comments[0] && t.comments[0].body) || t.title || '')}
`).join('') : 'No threads yet.'}
-
- - - -
-
-
-

Suggestions

-
${suggestions.length ? suggestions.map(s => `
${escapeHtml(s.section || 'section')} · ${escapeHtml(s.status || 'open')}
${escapeHtml(s.proposed_text || '')}
${s.status === 'open' ? `` : ''}
`).join('') : 'No suggestions yet.'}
-
- - - -
-
-
-

Polls & decisions

-
${polls.length ? polls.map(p => `
${escapeHtml(p.question || '')}
${(p.options || []).map(o => `${escapeHtml(o.label)}: ${o.count || 0}`).join(' · ')}${p.decision ? `
Decision: ${escapeHtml(p.decision.outcome)} — ${escapeHtml(p.decision.rationale)}` : ''}
`).join('') : 'No polls yet.'}
-
- - - - -
-
-
-
-

Revision history

-
${revisions.length ? revisions.map(r => `
${escapeHtml(r.id)} by ${escapeHtml((r.author && r.author.name) || 'unknown')}${r.model ? ' · ' + escapeHtml(r.model) : ''}
${escapeHtml(r.reason || 'revision')}
`).join('') : 'No spec revisions yet.'}
-
-
-

GitHub Projects sync

-
-
Status: ${escapeHtml(projectSync.last_status || (projectSync.enabled ? 'enabled' : 'disabled'))}
- ${projectSync.project_url ? `
Project: ${escapeHtml(projectSync.project_url)}
` : ''} - ${projectSync.last_error ? `
Last error: ${escapeHtml(projectSync.last_error)}
${escapeHtml(projectSync.retry_advice || 'Retry after checking the project link and token.')}
` : ''} -
-
- -
- - - -
-
-
`; - } - - function connectCampaignJamLive(id) { - if (_campaignJamSocket) { - const prev = _campaignJamSocket; - _campaignJamSocket = null; - prev.onmessage = null; - prev.onclose = null; - prev.close(); - } - const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; - const url = protocol + '//' + window.location.host + '/api/campaigns/' + encodeURIComponent(id) + '/jam/ws'; - try { - const ws = new WebSocket(url); - _campaignJamSocket = ws; - ws.onmessage = function(event) { - const msg = JSON.parse(event.data || '{}'); - if (msg.jam && msg.jam.spec_revision_id) { _campaignJamLiveRevision = msg.jam.spec_revision_id; } - if (msg.type === 'snapshot' || msg.type === 'presence') { renderCampaignJamPresence(msg.presence || []); } - if (msg.type === 'edit_applied' && msg.jam) { renderCampaignJam(id, msg.jam); connectCampaignJamLive(id); } - if (msg.type === 'conflict') { showToast('Jam edit conflict: refresh or merge against revision ' + (msg.expected_revision_id || 'current'), 'error'); } - if (msg.type === 'error') { showToast('Jam live error: ' + (msg.error || 'unknown error'), 'error'); } - }; - ws.onclose = function() { renderCampaignJamPresence([], 'Disconnected; refresh Jam to reconnect.'); }; - } catch (e) { - renderCampaignJamPresence([], 'Live unavailable: ' + e.message); - } - } - - function renderCampaignJamPresence(presence, message) { - const el = document.getElementById('campaign-jam-live-status'); - if (!el) return; - if (message) { el.textContent = message; return; } - el.innerHTML = presence.length ? presence.map(function(p) { - const name = (p.actor && p.actor.name) || 'participant'; - return '' + escapeHtml(name) + (p.section ? ' · ' + escapeHtml(p.section) : '') + ''; - }).join('') : 'No live participants yet.'; - } - - function focusCampaignJamLive() { - if (!_campaignJamSocket || _campaignJamSocket.readyState !== WebSocket.OPEN) return; - const section = document.getElementById('jam-live-section')?.value || ''; - _campaignJamSocket.send(JSON.stringify({ type: 'focus', section })); - } - - function submitCampaignJamLiveEdit() { - if (!_campaignJamSocket || _campaignJamSocket.readyState !== WebSocket.OPEN) { showToast('Jam live socket is not connected', 'error'); return; } - const content = document.getElementById('jam-live-content')?.value || ''; - _campaignJamSocket.send(JSON.stringify({ type: 'edit', base_revision_id: _campaignJamLiveRevision, content, reason: 'live co-edit' })); - } - - async function createCampaignJamThread(id) { - const section = document.getElementById('jam-thread-section')?.value || ''; - const body = document.getElementById('jam-thread-body')?.value || ''; - await postCampaignJam(id, 'threads', { section, body }); - } - - async function inviteCampaignJamAgent(id, thread_id) { - const prompt = await promptForJamAgent(); - if (prompt === null) return; - await postCampaignJam(id, 'agents', { thread_id, agent: 'spektacular', prompt }); - } - - function promptForJamAgent() { - return hivePrompt({title: 'Prompt for Jam agent', label: 'Prompt for the Jam agent reply and suggestion', defaultValue: 'Suggest spec text for this thread.'}); - } - - async function createCampaignJamSuggestion(id) { - const section = document.getElementById('jam-suggestion-section')?.value || ''; - const proposed_text = document.getElementById('jam-suggestion-text')?.value || ''; - await postCampaignJam(id, 'suggestions', { section, proposed_text }); - } - - async function resolveCampaignJamSuggestion(id, suggestion_id, action) { - await postCampaignJam(id, 'suggestions', { action, suggestion_id }); - } - - async function createCampaignJamPoll(id) { - const section = document.getElementById('jam-poll-section')?.value || ''; - const question = document.getElementById('jam-poll-question')?.value || ''; - const options = (document.getElementById('jam-poll-options')?.value || '').split(',').map(s => s.trim()).filter(Boolean); - await postCampaignJam(id, 'polls', { section, question, options }); - } - - async function enableCampaignJamProjectSync(id) { - const value = document.getElementById('jam-project-url')?.value || ''; - const body = value.indexOf('http') === 0 ? { action: 'enable', project_url: value } : { action: 'enable', project_id: value }; - await postCampaignJam(id, 'project-sync', body); - } - - async function syncCampaignJamProject(id) { - await postCampaignJam(id, 'project-sync', { action: 'sync' }); - } - - async function disableCampaignJamProjectSync(id) { - await postCampaignJam(id, 'project-sync', { action: 'disable' }); - } - - async function postCampaignJam(id, lane, body) { - try { - const r = await fetch('/api/campaigns/' + encodeURIComponent(id) + '/jam/' + lane, { method: 'POST', headers: _inceptionAuthHeaders(), body: JSON.stringify(body) }); - const data = await r.json(); - if (!data.ok) { showToast(data.error || 'Jam update failed', 'error'); return; } - renderCampaignJam(id, data.jam || {}); - } catch (e) { showToast('Jam error: ' + e.message, 'error'); } - } - - async function resumeCampaign(id) { - if (!id) return; - try { - const r = await fetch('/api/campaigns/' + encodeURIComponent(id) + '/resume', { method: 'POST', headers: _inceptionAuthHeaders(), body: JSON.stringify({ surface: 'dashboard' }) }); - const data = await r.json(); - if (!data.ok) { showToast(data.error || 'Failed to resume campaign', 'error'); return; } - // The dashboard wizard that drove a resumed inception state is gone; - // the campaign is resumed server-side and continued from its command. - if (data.state && !data.resume_command) showToast('Campaign resumed', 'success'); - if (data.resume_command) { await hiveAlert('Resume command:\n' + data.resume_command, 'Resume command'); } - await loadCampaigns(); - } catch (e) { showToast('Error: ' + e.message, 'error'); } - } - - async function releaseCampaign(id) { - if (!id) return; - try { - const r = await fetch('/api/campaigns/' + encodeURIComponent(id) + '/release', { method: 'POST', headers: _inceptionAuthHeaders(), body: JSON.stringify({}) }); - const data = await r.json(); - if (!data.ok) { showToast(data.error || 'Failed to release campaign', 'error'); return; } - await loadCampaigns(); - } catch (e) { showToast('Error: ' + e.message, 'error'); } - } - - async function reviseCampaign(id) { - if (!id) return; - try { - const r = await fetch('/api/campaigns/' + encodeURIComponent(id) + '/revise', { method: 'POST', headers: _inceptionAuthHeaders(), body: JSON.stringify({}) }); - const data = await r.json(); - if (!data.ok) { showToast(data.error || 'Failed to revise campaign', 'error'); return; } - await loadCampaigns(); - } catch (e) { showToast('Error: ' + e.message, 'error'); } - } - - async function recheckCampaign(id) { - if (!id) return; - try { - const r = await fetch('/api/campaigns/' + encodeURIComponent(id) + '/recheck', { method: 'POST', headers: _inceptionAuthHeaders(), body: JSON.stringify({}) }); - const data = await r.json(); - if (!data.ok) { showToast(data.error || 'Failed to recheck campaign', 'error'); return; } - await loadCampaigns(); - } catch (e) { showToast('Error: ' + e.message, 'error'); } - } diff --git a/src/pkg/dashboard/static-src/js/chat.js b/src/pkg/dashboard/static-src/js/chat.js index 2f94867431..87d24c561a 100644 --- a/src/pkg/dashboard/static-src/js/chat.js +++ b/src/pkg/dashboard/static-src/js/chat.js @@ -132,7 +132,7 @@ { name:'governor', aliases:['gov'], usage:'/governor ', description:'Ask about governor cadence, kicks and policy.', example:'/governor next kick', details:'Forwards a focused governor question to Hive Chat search.', run: chatForwardCommand('governor') }, { name:'knowledge', aliases:['kb'], usage:'/knowledge ', description:'Ask the knowledge base and imported docs.', example:'/knowledge relay setup', details:'Forwards a focused knowledge-base question to Hive Chat search.', run: chatForwardCommand('knowledge') }, { name:'jam', aliases:['swarm'], usage:'/jam ', description:'Ask about jam sessions, contributors and live collaboration.', example:'/jam who is free?', details:'Presence questions (who is online / free / here / active) are answered locally from `/api/presence`; anything else is forwarded to Hive Chat search.', run: chatCommandJam }, - { name:'spek', aliases:['spectacular','spec'], usage:'/spek ', description:'Ask about Spektacular/inception campaigns and spec runs (v6/edge when unavailable).', example:'/spek active campaigns', details:'Uses v6/edge Spektacular concepts: inception campaigns, spec runs, relay and campaign state.', run: chatForwardCommand('spek') }, + { name:'spek', aliases:['spectacular','spec'], usage:'/spek ', description:'Ask about Spektacular spec runs and Inception (spek) sessions (v6/edge when unavailable).', example:'/spek spec runs', details:'Uses v6/edge Spektacular concepts: spec runs, Inception (spek) sessions and relay state.', run: chatForwardCommand('spek') }, ]; const CHAT_COMMAND_BY_NAME = new Map(); CHAT_COMMANDS.forEach(c => [c.name].concat(c.aliases || []).forEach(n => CHAT_COMMAND_BY_NAME.set(n, c))); @@ -143,7 +143,7 @@ { group:'Governor', items:['/governor next kick', 'Why is the governor paused?', 'Show recent kick failures'] }, { group:'Knowledge', items:['/knowledge work sources', 'Search docs for relay setup', 'What changed in v5?'] }, { group:'Jam', items:['/who', '/jam who is online?', 'Show contributor activity'] }, - { group:'Spek / Spektacular', spek:true, items:['!runs spec owner/repo#N', '/spek active campaigns', '/spek spec runs', 'Explain inception relay state'] }, + { group:'Spek / Spektacular', spek:true, items:['!runs spec owner/repo#N', '/spek spec runs', '/spek running sessions', 'Explain inception relay state'] }, ]; function loadChatSettings() { return safeJsonParse(localStorage.getItem(CHAT_SETTINGS_KEY) || '{}', {}); } diff --git a/src/pkg/dashboard/static-src/js/sessions.js b/src/pkg/dashboard/static-src/js/sessions.js index d2664c6b77..3f3b7ea553 100644 --- a/src/pkg/dashboard/static-src/js/sessions.js +++ b/src/pkg/dashboard/static-src/js/sessions.js @@ -12,7 +12,6 @@ const SESSIONS_LOG_LINES = 500; const SESSIONS_ASSERTION_RENEW_MS = 600000; const SESSIONS_TMUX_PREFIX = 'hive-sess-'; - const SESSIONS_CAMPAIGNS_TAB = 'campaigns'; const SESSIONS_UNGROUPED = ''; const SESSIONS_UNGROUPED_LABEL = 'Ungrouped'; const SESSIONS_SELECTED_KEY = 'hive.sessions.selected'; @@ -98,10 +97,9 @@ return sessionsGroupSessions(sessions).map(function(g) { return g.group; }).filter(Boolean); } function sessionsPickSelected(sessions, wanted) { - if (wanted === SESSIONS_CAMPAIGNS_TAB) return wanted; const list = sessions || []; if (wanted && list.some(function(s) { return s && s.id === wanted; })) return wanted; - return list.length && list[0] ? list[0].id : SESSIONS_CAMPAIGNS_TAB; + return list.length && list[0] ? list[0].id : ''; } // Flat tab order as rendered (group order, then session order), used for arrow keys. function sessionsTabOrder(sessions, collapsed, selected) { @@ -112,7 +110,6 @@ out.push(s.id); }); }); - out.push(SESSIONS_CAMPAIGNS_TAB); return out; } function sessionsNextTab(order, current, key) { @@ -421,8 +418,7 @@ + '' + esc(s.vendor || '') + '' + badge + ''; } function sessionsTabsHtml() { - const campaignsSel = _sessionsSelected === SESSIONS_CAMPAIGNS_TAB; - let html = sessionsGroupSessions(_sessionsData.sessions).map(function(g) { + return sessionsGroupSessions(_sessionsData.sessions).map(function(g) { const collapsed = !!_sessionsCollapsed[g.group]; const tabs = g.sessions.filter(function(s) { return !collapsed || s.id === _sessionsSelected; }).map(sessionsTabHtml).join(''); return ''; }).join(''); - html += ''; - return html; } function sessionsNewFormHtml() { const vendors = (_sessionsData.vendors || []).filter(function(v) { return v && v.available; }); @@ -629,15 +620,14 @@ if (!typing) chrome.innerHTML = sessionsToolbarHtml(); if (focusId) { const f = document.getElementById(focusId); if (f) f.focus(); } const empty = document.getElementById('sessions-empty'); - empty.hidden = sessions.length > 0 || _sessionsSelected !== SESSIONS_CAMPAIGNS_TAB; + empty.hidden = sessions.length > 0; empty.textContent = sessions.length ? '' : 'No sessions yet. Start one with “New session” to run a CLI agent here; everyone on this hive can watch or join it.'; const liveIds = {}; sessions.forEach(function(s) { liveIds[s.id] = true; sessionsEnsurePane(s); }); Array.prototype.forEach.call(document.querySelectorAll('#sessions-panes .sessions-pane'), function(pane) { const id = pane.id.replace('sessions-pane-', ''); - if (id !== SESSIONS_CAMPAIGNS_TAB && !liveIds[id]) { delete _sessionsFrames[id]; pane.remove(); } + if (!liveIds[id]) { delete _sessionsFrames[id]; pane.remove(); } }); - sessionsEnsureCampaignsPane(); sessionsShowSelected(); sessionsSyncPreparingPoll(sessions); } @@ -653,29 +643,12 @@ const preparing = (sessions || []).filter(function(s) { return s.status === SESSIONS_STATUS_PREPARING; }).length; return running + ' running · ' + (preparing ? preparing + ' preparing · ' : '') + (sessions || []).length + ' total'; } - function sessionsEnsureCampaignsPane() { - const host = document.getElementById('sessions-panes'); - if (!host || document.getElementById('sessions-pane-' + SESSIONS_CAMPAIGNS_TAB)) return; - const pane = document.createElement('div'); - pane.id = 'sessions-pane-' + SESSIONS_CAMPAIGNS_TAB; - pane.className = 'sessions-pane'; - pane.setAttribute('role', 'tabpanel'); - pane.setAttribute('aria-labelledby', 'sessions-tab-' + SESSIONS_CAMPAIGNS_TAB); - pane.setAttribute('data-mode', 'campaigns'); - host.appendChild(pane); - } function sessionsShowSelected() { Array.prototype.forEach.call(document.querySelectorAll('#sessions-panes .sessions-pane'), function(pane) { pane.hidden = pane.id !== 'sessions-pane-' + _sessionsSelected; }); - if (_sessionsSelected === SESSIONS_CAMPAIGNS_TAB) { - sessionsStopLogPoll(); - const pane = document.getElementById('sessions-pane-' + SESSIONS_CAMPAIGNS_TAB); - if (pane && !pane.firstChild) { pane.innerHTML = renderCampaignsPanel(); loadCampaigns(); } - return; - } const s = sessionsSelectedSession(); - if (!s) return; + if (!s) { sessionsStopLogPoll(); return; } const mode = sessionsViewMode(_sessionsRole, s); if (mode === 'preparing' || mode === 'failed') { sessionsStopLogPoll(); return; } if (mode === 'terminal' && !_sessionsFrameFailed[s.id]) { sessionsStopLogPoll(); sessionsAttachTerminal(s); } else sessionsStartLogPoll(); diff --git a/src/pkg/dashboard/static-src/manifest.txt b/src/pkg/dashboard/static-src/manifest.txt index 4257abb5f3..d036cf6f74 100644 --- a/src/pkg/dashboard/static-src/manifest.txt +++ b/src/pkg/dashboard/static-src/manifest.txt @@ -134,7 +134,6 @@ js/review-queue.js js/contributors.js js/refresh.js js/scroll-stabilizer.js -js/campaigns.js js/inception.js js/subscription-gauge.js js/sessions.js diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 5e03ac745c..ce623d44a3 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -7713,7 +7713,6 @@ .campaigns-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-5); flex-wrap: wrap; } .campaigns-title { font-size: var(--fs-md); font-weight: 700; } .campaigns-subtitle { color: var(--muted); font-size: var(--fs-sm); margin-top: var(--sp-1); } - .campaigns-filters { display: grid; grid-template-columns: minmax(180px, 2fr) repeat(4, minmax(110px, 1fr)) auto; gap: var(--sp-3); margin-bottom: var(--sp-5); } .campaigns-input { background: var(--bg); color: var(--fg); border: 1px solid var(--border); border-radius: var(--r-sm); padding: var(--sp-3) var(--sp-4); font: inherit; font-size: var(--fs-sm); min-width: 0; } .campaigns-list { display: grid; gap: var(--sp-3); } .campaign-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-4); align-items: center; border: 1px solid var(--border); border-radius: var(--r); padding: var(--sp-4); background: color-mix(in srgb, var(--border) 8%, transparent); } @@ -7721,27 +7720,9 @@ .campaign-row-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .campaign-row-meta { display: flex; gap: var(--sp-3); flex-wrap: wrap; color: var(--muted); font-size: var(--fs-sm); margin-top: var(--sp-2); } .campaign-pill { border: 1px solid var(--border); border-radius: var(--r-pill); padding: var(--sp-1) var(--sp-3); color: var(--muted); } - .campaign-revision-pill { border-color: var(--accent); color: var(--accent); } - /* Revise chains fold into one row; earlier revisions live in a - disclosure with their own Continue / Delete icon buttons (#12698). */ - .campaign-history-list { display: grid; gap: var(--sp-2); margin-top: var(--sp-2); width: 100%; } - .campaign-history-row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; border-top: 1px dashed var(--border); padding-top: var(--sp-2); } - .campaign-history-row .campaign-row-actions { margin-left: auto; } .campaign-row-actions .nous-exp-icon { align-self: center; } - .nous-exp-icon-delete:hover, .nous-exp-icon-delete:focus-visible { color: var(--red); } .campaign-empty { color: var(--muted); text-align: center; padding: var(--sp-7); border: 1px dashed var(--border); border-radius: var(--r); } - .campaign-jam { margin-top: var(--sp-5); display: grid; gap: var(--sp-4); } - .campaign-jam-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); } - .campaign-jam-box { border: 1px solid var(--border); border-radius: var(--r); padding: var(--sp-4); background: color-mix(in srgb, var(--border) 6%, transparent); } - .campaign-jam-box h4 { margin: 0 0 var(--sp-3); font-size: var(--fs-sm); } - .campaign-jam-list { display: grid; gap: var(--sp-2); color: var(--muted); font-size: var(--fs-sm); } - .campaign-jam-form { display: grid; gap: var(--sp-2); margin-top: var(--sp-3); } - .campaign-jam-form textarea { min-height: 72px; resize: vertical; } - .campaign-jam-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; } - .campaign-jam-live { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; } - .campaign-jam-live-pill { border: 1px solid var(--border); border-radius: var(--r-full); padding: var(--sp-1) var(--sp-2); background: var(--bg); color: var(--fg); } - @media (max-width: 1100px) { .campaign-jam-grid { grid-template-columns: 1fr; } } - @media (max-width: 900px) { .campaigns-filters { grid-template-columns: 1fr 1fr; } .campaign-row { grid-template-columns: minmax(0, 1fr); } .campaign-row > div { min-width: 0; } .campaign-row-actions { justify-content: flex-start; } } + @media (max-width: 900px) { .campaign-row { grid-template-columns: minmax(0, 1fr); } .campaign-row > div { min-width: 0; } .campaign-row-actions { justify-content: flex-start; } } /* Review queue (#9607) */ .review-subsection { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--dash-section-header-gap, var(--sp-3)); margin: var(--sp-2) 0 var(--sp-7); } .review-subsection + .review-subsection { margin-top: var(--sp-7); } @@ -9555,7 +9536,7 @@

Runs, inception and the Experiment Lab

What is Inception (spek), and where did the Inception wizard go? -

The step-by-step Inception wizard was removed; the dashboard's Inception (spek) section replaces it (on by default; an owner can turn it off in Settings, which hides the section): named terminal tabs where a command-line AI agent runs inside Hive, shared with everyone on the hive. People with the read role see a read-only scrollback. Typing in a terminal is shared and not attributed to individual people. Campaigns and Jam moved to a Campaigns tab. See Inception (spek).

+

The step-by-step Inception wizard was removed; the dashboard's Inception (spek) section replaces it (on by default; an owner can turn it off in Settings, which hides the section): named terminal tabs where a command-line AI agent runs inside Hive, shared with everyone on the hive. People with the read role see a read-only scrollback. Typing in a terminal is shared and not attributed to individual people. The Campaigns tab that briefly carried the old campaigns and Jam view was retired as well; Spektacular runs are in Runs. See Inception (spek).

@@ -9580,7 +9561,7 @@

Runs, inception and the Experiment Lab

Can I run more than one experiment at once? -

Yes. The Experiment Lab lists each running experiment as its own card — research question, scope pills, status and a baseline bar reading N / 672 (≈ 7 days of observations, 4 per hour) — and + New experiment adds another beside them, the same way the Inception section lists its campaigns. The one rule is that two running experiments may not share a repo target (or both be hive-wide): concurrent interventions on the same scope would confound each other's outcomes, so the lab refuses the second one and offers to pause the first or narrow the scope. Archived experiments stay read-only under Previous experiments. See running several experiments at once.

+

Yes. The Experiment Lab lists each running experiment as its own card — research question, scope pills, status and a baseline bar reading N / 672 (≈ 7 days of observations, 4 per hour) — and + New experiment adds another beside them, one card per experiment. The one rule is that two running experiments may not share a repo target (or both be hive-wide): concurrent interventions on the same scope would confound each other's outcomes, so the lab refuses the second one and offers to pause the first or narrow the scope. Archived experiments stay read-only under Previous experiments. See running several experiments at once.

Each card also says where it is: collecting baseline, ready — generate proposals (one button; the lab switches to Suggest for you), proposals awaiting your review, running or concluded. Entering a question is what creates the card — you never have to find a mode switch first.

@@ -50774,397 +50755,6 @@ } else { initScrollStabilizer(); } - // ── Campaigns + Jam (Spek / inception campaign archive) ── - // Moved out of inception.js so the Campaigns and Jam UI survives the - // Inception wizard's removal; it is the Campaigns tab of the Inception - // (spek) section (sessions.js). Plain top-level declarations, shared - // through the single concatenated dashboard script; keep this file adjacent to it in manifest.txt. - let _campaigns = []; - - async function loadCampaigns() { - try { - const params = new URLSearchParams(); - ['search', 'repo', 'stage', 'status', 'owner'].forEach(function(name) { - const el = document.getElementById('campaign-filter-' + name); - if (el && el.value.trim()) params.set(name, el.value.trim()); - }); - const qs = params.toString(); - const r = await fetch('/api/campaigns' + (qs ? '?' + qs : ''), {headers: _inceptionAuthHeaders()}); - const data = await r.json(); - if (data.ok) { - _campaigns = data.campaigns || []; - renderCampaignsList(); - } - } catch (e) { console.error('campaign load failed', e); } - } - - function renderCampaignsPanel() { - return ` -
-
-
Campaigns
Resumable Inception and Spek sessions keyed by stable spec ID.
- -
-
- - - - - - -
-
Loading campaigns…
-
-
`; - } - - // Revise chains (#12698): every Revise mints a linked `-rev-N` - // archive with the same title, so the API marks the older ones with - // `superseded_by`. Show one row per chain (the newest revision) and fold - // the earlier ones into a history disclosure under it. - function campaignRevisionChains(campaigns) { - const byId = {}; - (campaigns || []).forEach(function(c) { byId[c.id] = c; }); - const latest = (campaigns || []).filter(function(c) { return !c.superseded_by || !byId[c.superseded_by]; }); - return latest.map(function(head) { - const earlier = []; - const seen = {}; - let cur = head; - while (cur && cur.revision_of && byId[cur.revision_of] && !seen[cur.revision_of]) { - seen[cur.revision_of] = true; - cur = byId[cur.revision_of]; - earlier.push(cur); - } - return { head: head, history: earlier }; - }); - } - - function campaignDeleteButton(c) { - return nousExpIconButton('deleteCampaign', escapeHtml(c.id), '', 'Delete campaign', '🗑', 'nous-exp-icon-delete campaign-delete'); - } - - function renderCampaignRow(c, history) { - const repo = (c.repos || []).join(', ') || 'no repo'; - const activity = c.last_activity || 'no activity'; - const engine = c.engine || 'unknown engine'; - const rc = c.recheck || {}; - const recheckText = rc.enabled ? `Rechecks every ${escapeHtml(rc.interval || 'default')} · next ${escapeHtml(rc.next_at ? relativeAge(rc.next_at) : 'not scheduled')} · last delta ${Number(rc.last_delta_count || 0)}` : 'Rechecks off'; - const drift = c.drift || {}; - const external = Array.isArray(drift.external) ? drift.external : []; - const failed = Array.isArray(rc.sources_failed) ? rc.sources_failed : (Array.isArray(drift.sources_failed) ? drift.sources_failed : []); - const recheckExternal = external.length ? `
${Number(drift.external_count || external.length)} external signals
${external.map(ev => `
${escapeHtml(ev.source || '')} · ${escapeHtml(ev.kind || '')}: ${ev.url ? `${escapeHtml(ev.title || ev.url)}` : escapeHtml(ev.title || '')}${ev.summary ? `
${escapeHtml(ev.summary)}` : ''}
`).join('')}${failed.length ? `
Failed sources: ${failed.map(f => `${escapeHtml(f.name || '')} (${escapeHtml(f.reason || '')})`).join(', ')}
` : ''}
` : (Number(rc.external_count || 0) ? `
${Number(rc.external_count || 0)} external signals
` : ''); - const recheckDisabled = rc.in_flight ? ' disabled' : ''; - const revisionPill = c.revision ? `rev ${Number(c.revision)}` : ''; - const hist = Array.isArray(history) ? history : []; - const historyBlock = hist.length ? `
${hist.length} earlier ${hist.length === 1 ? 'revision' : 'revisions'}
${hist.map(function(h) { - return `
${h.revision ? 'rev ' + Number(h.revision) : 'original'}${escapeHtml(h.id)}${escapeHtml(h.status || 'parked')}${escapeHtml(h.last_activity || '')}${nousExpIconButton('resumeCampaign', escapeHtml(h.id), '', 'Continue this revision', '▶', 'nous-exp-icon-resume')}${campaignDeleteButton(h)}
`; - }).join('')}
` : ''; - return `
-
-
${escapeHtml(c.title || c.id)}
-
- ${escapeHtml(c.status || 'parked')} - ${revisionPill} - ${escapeHtml(c.current_stage || '')}${c.current_step ? ' / ' + escapeHtml(c.current_step) : ''} - ${escapeHtml(repo)} - ${escapeHtml(engine)} - ${escapeHtml(activity)} -
-
${recheckText}
- ${recheckExternal} - ${historyBlock} -
-
- - - - - - ${campaignDeleteButton(c)} -
-
`; - } - - function renderCampaignsList() { - const list = document.getElementById('campaigns-list'); - if (!list) return; - if (!_campaigns || _campaigns.length === 0) { - list.innerHTML = '
No campaigns yet. Reset or completed inception runs are archived here.
'; - return; - } - list.innerHTML = campaignRevisionChains(_campaigns).map(function(chain) { return renderCampaignRow(chain.head, chain.history); }).join(''); - } - - // Delete only removes the campaign record (saved inception state + wiki - // snapshot). KB facts, Jam threads and scaffolded repo files are kept. - // In-app hiveConfirm dialog; native browser dialogs are forbidden (#12698). - const CAMPAIGN_DELETE_CONFIRM_TITLE = 'Delete this campaign?'; - function campaignDeleteConfirmMessage(c) { - const label = (c && (c.title || c.id)) || 'this campaign'; - const rev = c && c.revision ? ` (revision ${Number(c.revision)})` : ''; - return `Removes the campaign record for "${label}"${rev}: its saved Inception state and the archived wiki snapshot. It disappears from this list and cannot be continued or revised.\n\nKept: knowledge-base facts, Jam threads, and anything already scaffolded or pushed to the repo. Other revisions in the same chain are not affected.`; - } - - async function deleteCampaign(id) { - if (!id) return; - const c = (_campaigns || []).find(function(x) { return x.id === id; }) || { id: id }; - const ok = await hiveConfirm({ title: CAMPAIGN_DELETE_CONFIRM_TITLE, message: campaignDeleteConfirmMessage(c), confirmLabel: 'Delete campaign', cancelLabel: 'Keep', danger: true }); - if (!ok) return; - try { - const r = await fetch('/api/campaigns/' + encodeURIComponent(id), { method: 'DELETE', headers: _inceptionAuthHeaders() }); - const data = await r.json().catch(function() { return {}; }); - if (!r.ok || !data.ok) { showToast(data.error || 'Failed to delete campaign', 'error'); return; } - _campaigns = (_campaigns || []).filter(function(x) { return x.id !== id; }); - renderCampaignsList(); - showToast('Campaign deleted — knowledge-base facts and Jam threads kept', 'info'); - await loadCampaigns(); - } catch (e) { showToast('Error: ' + e.message, 'error'); } - } - - let _campaignJamSocket = null; - let _campaignJamLiveRevision = ''; - - async function openCampaignJam(id) { - if (!id) return; - const panel = document.getElementById('campaign-jam-panel'); - if (panel) panel.innerHTML = '
Loading Jam…
'; - try { - const r = await fetch('/api/campaigns/' + encodeURIComponent(id) + '/jam', {headers: _inceptionAuthHeaders()}); - const data = await r.json(); - if (!data.ok) { throw new Error(data.error || 'Failed to load Jam'); } - renderCampaignJam(id, data.jam || {}); - connectCampaignJamLive(id); - } catch (e) { - if (panel) panel.innerHTML = '
Jam failed: ' + escapeHtml(e.message) + '
'; - } - } - - function renderCampaignJam(id, jam) { - const panel = document.getElementById('campaign-jam-panel'); - if (!panel) return; - const threads = jam.threads || []; - const suggestions = jam.suggestions || []; - const polls = jam.polls || []; - const revisions = jam.revisions || []; - const projectSync = jam.project_sync || {}; - _campaignJamLiveRevision = jam.spec_revision_id || ''; - panel.innerHTML = ` -
-
Jam: ${escapeHtml(id)}
Async section threads, suggestions, polls, decisions and attributed spec revisions.
- -
-
-

Live session

-
Connecting…
-
- - -
- - -
-
-
-
-
-

Threads

-
${threads.length ? threads.map(t => `
${escapeHtml(t.section || 'section')}: ${escapeHtml((t.comments && t.comments[0] && t.comments[0].body) || t.title || '')}
`).join('') : 'No threads yet.'}
-
- - - -
-
-
-

Suggestions

-
${suggestions.length ? suggestions.map(s => `
${escapeHtml(s.section || 'section')} · ${escapeHtml(s.status || 'open')}
${escapeHtml(s.proposed_text || '')}
${s.status === 'open' ? `` : ''}
`).join('') : 'No suggestions yet.'}
-
- - - -
-
-
-

Polls & decisions

-
${polls.length ? polls.map(p => `
${escapeHtml(p.question || '')}
${(p.options || []).map(o => `${escapeHtml(o.label)}: ${o.count || 0}`).join(' · ')}${p.decision ? `
Decision: ${escapeHtml(p.decision.outcome)} — ${escapeHtml(p.decision.rationale)}` : ''}
`).join('') : 'No polls yet.'}
-
- - - - -
-
-
-
-

Revision history

-
${revisions.length ? revisions.map(r => `
${escapeHtml(r.id)} by ${escapeHtml((r.author && r.author.name) || 'unknown')}${r.model ? ' · ' + escapeHtml(r.model) : ''}
${escapeHtml(r.reason || 'revision')}
`).join('') : 'No spec revisions yet.'}
-
-
-

GitHub Projects sync

-
-
Status: ${escapeHtml(projectSync.last_status || (projectSync.enabled ? 'enabled' : 'disabled'))}
- ${projectSync.project_url ? `
Project: ${escapeHtml(projectSync.project_url)}
` : ''} - ${projectSync.last_error ? `
Last error: ${escapeHtml(projectSync.last_error)}
${escapeHtml(projectSync.retry_advice || 'Retry after checking the project link and token.')}
` : ''} -
-
- -
- - - -
-
-
`; - } - - function connectCampaignJamLive(id) { - if (_campaignJamSocket) { - const prev = _campaignJamSocket; - _campaignJamSocket = null; - prev.onmessage = null; - prev.onclose = null; - prev.close(); - } - const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; - const url = protocol + '//' + window.location.host + '/api/campaigns/' + encodeURIComponent(id) + '/jam/ws'; - try { - const ws = new WebSocket(url); - _campaignJamSocket = ws; - ws.onmessage = function(event) { - const msg = JSON.parse(event.data || '{}'); - if (msg.jam && msg.jam.spec_revision_id) { _campaignJamLiveRevision = msg.jam.spec_revision_id; } - if (msg.type === 'snapshot' || msg.type === 'presence') { renderCampaignJamPresence(msg.presence || []); } - if (msg.type === 'edit_applied' && msg.jam) { renderCampaignJam(id, msg.jam); connectCampaignJamLive(id); } - if (msg.type === 'conflict') { showToast('Jam edit conflict: refresh or merge against revision ' + (msg.expected_revision_id || 'current'), 'error'); } - if (msg.type === 'error') { showToast('Jam live error: ' + (msg.error || 'unknown error'), 'error'); } - }; - ws.onclose = function() { renderCampaignJamPresence([], 'Disconnected; refresh Jam to reconnect.'); }; - } catch (e) { - renderCampaignJamPresence([], 'Live unavailable: ' + e.message); - } - } - - function renderCampaignJamPresence(presence, message) { - const el = document.getElementById('campaign-jam-live-status'); - if (!el) return; - if (message) { el.textContent = message; return; } - el.innerHTML = presence.length ? presence.map(function(p) { - const name = (p.actor && p.actor.name) || 'participant'; - return '' + escapeHtml(name) + (p.section ? ' · ' + escapeHtml(p.section) : '') + ''; - }).join('') : 'No live participants yet.'; - } - - function focusCampaignJamLive() { - if (!_campaignJamSocket || _campaignJamSocket.readyState !== WebSocket.OPEN) return; - const section = document.getElementById('jam-live-section')?.value || ''; - _campaignJamSocket.send(JSON.stringify({ type: 'focus', section })); - } - - function submitCampaignJamLiveEdit() { - if (!_campaignJamSocket || _campaignJamSocket.readyState !== WebSocket.OPEN) { showToast('Jam live socket is not connected', 'error'); return; } - const content = document.getElementById('jam-live-content')?.value || ''; - _campaignJamSocket.send(JSON.stringify({ type: 'edit', base_revision_id: _campaignJamLiveRevision, content, reason: 'live co-edit' })); - } - - async function createCampaignJamThread(id) { - const section = document.getElementById('jam-thread-section')?.value || ''; - const body = document.getElementById('jam-thread-body')?.value || ''; - await postCampaignJam(id, 'threads', { section, body }); - } - - async function inviteCampaignJamAgent(id, thread_id) { - const prompt = await promptForJamAgent(); - if (prompt === null) return; - await postCampaignJam(id, 'agents', { thread_id, agent: 'spektacular', prompt }); - } - - function promptForJamAgent() { - return hivePrompt({title: 'Prompt for Jam agent', label: 'Prompt for the Jam agent reply and suggestion', defaultValue: 'Suggest spec text for this thread.'}); - } - - async function createCampaignJamSuggestion(id) { - const section = document.getElementById('jam-suggestion-section')?.value || ''; - const proposed_text = document.getElementById('jam-suggestion-text')?.value || ''; - await postCampaignJam(id, 'suggestions', { section, proposed_text }); - } - - async function resolveCampaignJamSuggestion(id, suggestion_id, action) { - await postCampaignJam(id, 'suggestions', { action, suggestion_id }); - } - - async function createCampaignJamPoll(id) { - const section = document.getElementById('jam-poll-section')?.value || ''; - const question = document.getElementById('jam-poll-question')?.value || ''; - const options = (document.getElementById('jam-poll-options')?.value || '').split(',').map(s => s.trim()).filter(Boolean); - await postCampaignJam(id, 'polls', { section, question, options }); - } - - async function enableCampaignJamProjectSync(id) { - const value = document.getElementById('jam-project-url')?.value || ''; - const body = value.indexOf('http') === 0 ? { action: 'enable', project_url: value } : { action: 'enable', project_id: value }; - await postCampaignJam(id, 'project-sync', body); - } - - async function syncCampaignJamProject(id) { - await postCampaignJam(id, 'project-sync', { action: 'sync' }); - } - - async function disableCampaignJamProjectSync(id) { - await postCampaignJam(id, 'project-sync', { action: 'disable' }); - } - - async function postCampaignJam(id, lane, body) { - try { - const r = await fetch('/api/campaigns/' + encodeURIComponent(id) + '/jam/' + lane, { method: 'POST', headers: _inceptionAuthHeaders(), body: JSON.stringify(body) }); - const data = await r.json(); - if (!data.ok) { showToast(data.error || 'Jam update failed', 'error'); return; } - renderCampaignJam(id, data.jam || {}); - } catch (e) { showToast('Jam error: ' + e.message, 'error'); } - } - - async function resumeCampaign(id) { - if (!id) return; - try { - const r = await fetch('/api/campaigns/' + encodeURIComponent(id) + '/resume', { method: 'POST', headers: _inceptionAuthHeaders(), body: JSON.stringify({ surface: 'dashboard' }) }); - const data = await r.json(); - if (!data.ok) { showToast(data.error || 'Failed to resume campaign', 'error'); return; } - // The dashboard wizard that drove a resumed inception state is gone; - // the campaign is resumed server-side and continued from its command. - if (data.state && !data.resume_command) showToast('Campaign resumed', 'success'); - if (data.resume_command) { await hiveAlert('Resume command:\n' + data.resume_command, 'Resume command'); } - await loadCampaigns(); - } catch (e) { showToast('Error: ' + e.message, 'error'); } - } - - async function releaseCampaign(id) { - if (!id) return; - try { - const r = await fetch('/api/campaigns/' + encodeURIComponent(id) + '/release', { method: 'POST', headers: _inceptionAuthHeaders(), body: JSON.stringify({}) }); - const data = await r.json(); - if (!data.ok) { showToast(data.error || 'Failed to release campaign', 'error'); return; } - await loadCampaigns(); - } catch (e) { showToast('Error: ' + e.message, 'error'); } - } - - async function reviseCampaign(id) { - if (!id) return; - try { - const r = await fetch('/api/campaigns/' + encodeURIComponent(id) + '/revise', { method: 'POST', headers: _inceptionAuthHeaders(), body: JSON.stringify({}) }); - const data = await r.json(); - if (!data.ok) { showToast(data.error || 'Failed to revise campaign', 'error'); return; } - await loadCampaigns(); - } catch (e) { showToast('Error: ' + e.message, 'error'); } - } - - async function recheckCampaign(id) { - if (!id) return; - try { - const r = await fetch('/api/campaigns/' + encodeURIComponent(id) + '/recheck', { method: 'POST', headers: _inceptionAuthHeaders(), body: JSON.stringify({}) }); - const data = await r.json(); - if (!data.ok) { showToast(data.error || 'Failed to recheck campaign', 'error'); return; } - await loadCampaigns(); - } catch (e) { showToast('Error: ' + e.message, 'error'); } - } // Dashboard boot hooks that used to share this file with the removed // Inception wizard (the section is now Inception (spek), sessions.js). document.addEventListener('DOMContentLoaded', () => { @@ -51719,7 +51309,6 @@

GitHub Projects sync

const SESSIONS_LOG_LINES = 500; const SESSIONS_ASSERTION_RENEW_MS = 600000; const SESSIONS_TMUX_PREFIX = 'hive-sess-'; - const SESSIONS_CAMPAIGNS_TAB = 'campaigns'; const SESSIONS_UNGROUPED = ''; const SESSIONS_UNGROUPED_LABEL = 'Ungrouped'; const SESSIONS_SELECTED_KEY = 'hive.sessions.selected'; @@ -51805,10 +51394,9 @@

GitHub Projects sync

return sessionsGroupSessions(sessions).map(function(g) { return g.group; }).filter(Boolean); } function sessionsPickSelected(sessions, wanted) { - if (wanted === SESSIONS_CAMPAIGNS_TAB) return wanted; const list = sessions || []; if (wanted && list.some(function(s) { return s && s.id === wanted; })) return wanted; - return list.length && list[0] ? list[0].id : SESSIONS_CAMPAIGNS_TAB; + return list.length && list[0] ? list[0].id : ''; } // Flat tab order as rendered (group order, then session order), used for arrow keys. function sessionsTabOrder(sessions, collapsed, selected) { @@ -51819,7 +51407,6 @@

GitHub Projects sync

out.push(s.id); }); }); - out.push(SESSIONS_CAMPAIGNS_TAB); return out; } function sessionsNextTab(order, current, key) { @@ -52128,8 +51715,7 @@

GitHub Projects sync

+ '' + esc(s.vendor || '') + '' + badge + ''; } function sessionsTabsHtml() { - const campaignsSel = _sessionsSelected === SESSIONS_CAMPAIGNS_TAB; - let html = sessionsGroupSessions(_sessionsData.sessions).map(function(g) { + return sessionsGroupSessions(_sessionsData.sessions).map(function(g) { const collapsed = !!_sessionsCollapsed[g.group]; const tabs = g.sessions.filter(function(s) { return !collapsed || s.id === _sessionsSelected; }).map(sessionsTabHtml).join(''); return ''; }).join(''); - html += ''; - return html; } function sessionsNewFormHtml() { const vendors = (_sessionsData.vendors || []).filter(function(v) { return v && v.available; }); @@ -52336,15 +51917,14 @@

GitHub Projects sync

if (!typing) chrome.innerHTML = sessionsToolbarHtml(); if (focusId) { const f = document.getElementById(focusId); if (f) f.focus(); } const empty = document.getElementById('sessions-empty'); - empty.hidden = sessions.length > 0 || _sessionsSelected !== SESSIONS_CAMPAIGNS_TAB; + empty.hidden = sessions.length > 0; empty.textContent = sessions.length ? '' : 'No sessions yet. Start one with “New session” to run a CLI agent here; everyone on this hive can watch or join it.'; const liveIds = {}; sessions.forEach(function(s) { liveIds[s.id] = true; sessionsEnsurePane(s); }); Array.prototype.forEach.call(document.querySelectorAll('#sessions-panes .sessions-pane'), function(pane) { const id = pane.id.replace('sessions-pane-', ''); - if (id !== SESSIONS_CAMPAIGNS_TAB && !liveIds[id]) { delete _sessionsFrames[id]; pane.remove(); } + if (!liveIds[id]) { delete _sessionsFrames[id]; pane.remove(); } }); - sessionsEnsureCampaignsPane(); sessionsShowSelected(); sessionsSyncPreparingPoll(sessions); } @@ -52360,29 +51940,12 @@

GitHub Projects sync

const preparing = (sessions || []).filter(function(s) { return s.status === SESSIONS_STATUS_PREPARING; }).length; return running + ' running · ' + (preparing ? preparing + ' preparing · ' : '') + (sessions || []).length + ' total'; } - function sessionsEnsureCampaignsPane() { - const host = document.getElementById('sessions-panes'); - if (!host || document.getElementById('sessions-pane-' + SESSIONS_CAMPAIGNS_TAB)) return; - const pane = document.createElement('div'); - pane.id = 'sessions-pane-' + SESSIONS_CAMPAIGNS_TAB; - pane.className = 'sessions-pane'; - pane.setAttribute('role', 'tabpanel'); - pane.setAttribute('aria-labelledby', 'sessions-tab-' + SESSIONS_CAMPAIGNS_TAB); - pane.setAttribute('data-mode', 'campaigns'); - host.appendChild(pane); - } function sessionsShowSelected() { Array.prototype.forEach.call(document.querySelectorAll('#sessions-panes .sessions-pane'), function(pane) { pane.hidden = pane.id !== 'sessions-pane-' + _sessionsSelected; }); - if (_sessionsSelected === SESSIONS_CAMPAIGNS_TAB) { - sessionsStopLogPoll(); - const pane = document.getElementById('sessions-pane-' + SESSIONS_CAMPAIGNS_TAB); - if (pane && !pane.firstChild) { pane.innerHTML = renderCampaignsPanel(); loadCampaigns(); } - return; - } const s = sessionsSelectedSession(); - if (!s) return; + if (!s) { sessionsStopLogPoll(); return; } const mode = sessionsViewMode(_sessionsRole, s); if (mode === 'preparing' || mode === 'failed') { sessionsStopLogPoll(); return; } if (mode === 'terminal' && !_sessionsFrameFailed[s.id]) { sessionsStopLogPoll(); sessionsAttachTerminal(s); } else sessionsStartLogPoll(); @@ -76250,7 +75813,7 @@

${model.editIndex === null ? 'Add Event trigger' : 'Edit Event trigger'}

', description:'Ask about governor cadence, kicks and policy.', example:'/governor next kick', details:'Forwards a focused governor question to Hive Chat search.', run: chatForwardCommand('governor') }, { name:'knowledge', aliases:['kb'], usage:'/knowledge ', description:'Ask the knowledge base and imported docs.', example:'/knowledge relay setup', details:'Forwards a focused knowledge-base question to Hive Chat search.', run: chatForwardCommand('knowledge') }, { name:'jam', aliases:['swarm'], usage:'/jam ', description:'Ask about jam sessions, contributors and live collaboration.', example:'/jam who is free?', details:'Presence questions (who is online / free / here / active) are answered locally from `/api/presence`; anything else is forwarded to Hive Chat search.', run: chatCommandJam }, - { name:'spek', aliases:['spectacular','spec'], usage:'/spek ', description:'Ask about Spektacular/inception campaigns and spec runs (v6/edge when unavailable).', example:'/spek active campaigns', details:'Uses v6/edge Spektacular concepts: inception campaigns, spec runs, relay and campaign state.', run: chatForwardCommand('spek') }, + { name:'spek', aliases:['spectacular','spec'], usage:'/spek ', description:'Ask about Spektacular spec runs and Inception (spek) sessions (v6/edge when unavailable).', example:'/spek spec runs', details:'Uses v6/edge Spektacular concepts: spec runs, Inception (spek) sessions and relay state.', run: chatForwardCommand('spek') }, ]; const CHAT_COMMAND_BY_NAME = new Map(); CHAT_COMMANDS.forEach(c => [c.name].concat(c.aliases || []).forEach(n => CHAT_COMMAND_BY_NAME.set(n, c))); @@ -76261,7 +75824,7 @@

${model.editIndex === null ? 'Add Event trigger' : 'Edit Event trigger'}