Commit Graph
35 Commits
Author SHA1 Message Date
sam 691e10c251 fix(telegram): compact tool output and drop turn caps
Render completed ToolCallEvents as Telegram-safe streaming blocks
with compact name/status and a short cleaned preview. Summarize
file contents and listings instead of dumping source or quoted
JSON. Collapse repeated legacy turn-budget failures.

Remove max_tokens turn gating and the 200000 turn_budget_chars
default so absent or commented config cannot restore an aggregate
cap. Keep per-result max_result_chars and spill.

Confine find/grep discovery to the active workspace/worktree.

Refs #604
2026-08-23 16:40:16 +00:00
sam da5e4e2955 feat(webui): surface per-component update status on /api/version and Configuration
The prior two changes gave every component an InstallType/Reference
and a way to observe what's actually running (installtype.Type(),
daemon.AgentStatus, [nats] config), but nothing consumed any of it --
an operator still had no single place to see whether a component's
actual running state agrees with what the update-check command
claims.

Add GET /api/version: per component, install type, observed running
version, the check command's installed/available claims, and a
computed status -- ok / update_available / drift / unknown. drift
takes priority over update_available (a claim the running system
contradicts is worse than a newer release merely existing), and a
component with no installed claim at all reports unknown rather than
guessing "ok" or "update_available" from a comparison that was never
actually made.

Surface it as an "Update status" card above the Configuration page's
existing config view, sourced independently so its own failure (or a
501 on deployments with no update-check command configured, which
renders nothing rather than an error) never blocks the config view
that's already there.

Closes archie-core-1786751948782-3-837a8fd0.3 and, with it,
archie-core-1786751948782-3-837a8fd0 (all 5 design points landed).
2026-08-23 23:36:44 +10:00
sam a6e500f6fa fix(webui): theme the Workflows 'Start work' form controls
renderStartWork built raw input/select/textarea elements with no CSS
class, so they fell back to browser-default white boxes against the
rest of the dark theme. Style them like the app's other themed form
controls (Configuration's .kv-input).

Closes archie-core-w35v.
2026-08-23 22:23:12 +10:00
sam aba035a396 feat(webui): payload field mapping -- bind JSON paths to named fields, preview before saving
Adds t2db.3: schema-by-example field mapping for the no-code playbook epic.
An operator picks a captured event, clicks through its payload to bind named
fields to JSON paths, and previews the resolution against a real event
before saving -- a missing, null, or type-changed path fails loudly (named
by field and event) rather than handing an agent a blank value.

- internal/domain/mapping: Mapping/Field types, path parsing/walking,
  Resolve (per-field failure reporting), Validate (incl. duplicate names)
- internal/store/mappings.go: SQLite persistence, mirrors captures.go
- internal/webui/api_mapping.go: CRUD + preview HTTP API
- ui/src/mappings/: dashboard editor (clickable payload tree, live preview)

Design decisions recorded in docs/prds/payload-field-mapping.md. t2db.4
(binding a mapping + matcher to a workflow) is out of scope here.
2026-08-22 19:18:15 +10:00
sam b07cb7c312 fix(webui): stop the capture live-event notification duplicating payloads into the unbounded events table
Adversarial review of the just-shipped event inspector (a8f9f1b) found that
handleCapture's s.emit() call embedded the full (up to CaptureMaxBodyBytes,
default 256KiB) redacted body and headers into the events table's Data
column on every capture. That table has no retention or row-count prune
anywhere in the codebase -- unlike captured_events, whose three disk-bound
mechanics (size cap, rate limit, prune-on-write) this feature exists to
provide. An unauthenticated, rate-limited-only sender could grow the events
table without bound even though captured_events itself stayed correctly
capped, silently defeating docs/prds/event-capture-storage.md's stated
"max_events * max_body_bytes" worst-case guarantee.

Fix: the live "capture" SSE event now carries only {id, source} -- enough
for the dashboard to know something arrived -- and the event inspector
treats it purely as an invalidation signal, refetching GET /api/captures
for the authoritative row data instead of merging partial event fields into
its local list. This also fixes two smaller issues the same review found:
the previous approach's frontend dedup-by-id logic depended on a field
(Data["id"]) no test actually asserted, and received_at differed in
precision between the live-pushed and REST-listed copies of the same row --
both are moot now that the frontend has one source of truth for row data.
2026-08-22 05:16:49 +10:00
sam a8f9f1b339 feat(webui): event inspector -- see captured payloads in the dashboard
Adds GET /api/captures (token-gated, matching the memory/skills
enabled-false-not-an-error convention when Server.Captures is nil) and a
new dashboard page at /captures listing recent inbound captures, newest
first, with per-row expand to explore the redacted payload and headers
pretty-printed.

Live updates reuse the existing operator-activity event pipeline
(Server.emit -> Events.Publish -> the /events SSE stream every other page
already subscribes to) rather than polling or inventing new push
plumbing: handleCapture now emits a Kind "capture" event with the same
field shape the list endpoint returns, so a captured event appears in the
inspector without a manual refresh.

Frontend follows the tasks/task-row.js precedent: row rendering is split
into ui/src/captures/capture-row.js so it can be unit tested without the
page's fetch/SSE wiring.

"Unbound" is shown for every row today since no binding data model exists
yet (t2db.4) -- the column is wired now so that bead only needs to change
what it renders, not add it.
2026-08-22 05:10:27 +10:00
sam 824c53b297 fix(webui): scroll selected command into view on keyboard navigation
Arrow-key navigation in the chat composer's command menu updated
aria-selected but never scrolled the option into the visible area, so
selecting past the viewport with the keyboard left the highlighted
item hidden. Mouse scrolling already worked since it doesn't rely on
selection state.
2026-08-15 12:05:52 +10:00
sam c2e8638d24 fix(webui): style tool-call failure from a structured field, not a string prefix
chatStreamEvent gained a Failed bool, set from ToolCallEvent.Err !=
"" -- the field the rest of the codebase already treats as
authoritative -- rather than the browser sniffing summary.startsWith
"failed:" on rendered text. A successful tool whose own output starts
with that literal string (a grep hit, a log line read back) was being
styled as a failed step.
2026-08-15 01:48:29 +10:00
sam e9bc36e33d fix(chat): harden inline tool call streaming
Telegram streaming callbacks now enqueue cancellable rendering rather than performing network I/O while draining the authoritative model stream. Final edit failures fall back to normal split delivery.

Completed tool events now correlate inputs by call ID and expose only bounded, conservative parameter shapes. Tool-call visibility is snapshotted per reply so reloads cannot change an in-flight turn.
2026-08-14 04:52:48 +10:00
sam 06dc034a72 feat(chat): show tool calls inline and stream replies into one message
Chat returned only the final answer, so a wrong tool choice, a
hallucinated action, or a footgun like `systemctl stop` against
`restart` was invisible from the conversation. Only text deltas were
threaded through the turn, and tool calls executed inside Generate with
nowhere to report.

Replace the delta callback with gateway.TurnStream, which carries text
fragments and completed tool calls on one ordered path from the model
loop to the channel. The sequence is the point: a tool line that
overtakes the sentence it interrupted describes a turn that never
happened. Text-only callers use gateway.DeltaFunc and are unaffected.

A tool is reported on its result, never on its call  --  the call part
carries no outcome yet, so reporting both would list every tool twice,
once with nothing to say.

Telegram renders it behind [chat.telegram] show_tool_calls, off by
default: this is debugging visibility, and it narrates every internal
step to provide it. The dashboard always shows it, being the operator's
own observability surface; its tool lines are live-only and are not
persisted with the conversation.

The Telegram live reply changes mechanism, and with it what a frame
MEANS. It used to stream through sendMessageDraft: drafts are ephemeral
30-second previews, so a tool call longer than that outlived the
preview, and successive frames were observed concatenated with their
cursors intact. It now sends one real message and edits it. An update
used to be "the next preview of the answer"; it is now "the whole
answer as it currently stands, replacing what is there". The cursor is
appended at render time and never stored, so exactly one exists and
always at the end, and a frame too long for one message is cut to its
tail rather than rejected outright.

A stopped or failed turn now edits the cursor away instead of leaving
it blinking on a message nothing will finish. That cleanup runs on a
live context because turnCtx is already dead, and it runs on both
failure branches: ai-sdk raises an aborted stream as ErrAborted with
ctx.Err() formatted in rather than wrapped, so errors.Is cannot be
trusted to tell a /stop from a fault.

Closes #467
2026-08-14 02:36:12 +10:00
sam 367637d174 fix(webui): cap and centre the Configuration page instead of its lists
The page ran the full width of the shell, so a card was roughly 1300px
of which the content used the left third. Every previous attempt fought
that inside the card by capping or shrinking .kv-list, which only moved
the imbalance around: the lists changed width but the Repositories and
Providers tables stayed stretched just as far, and shrinking the lists
broke the row separators and the alignment of the Edit column.

Constrain the page container instead. One max-width and auto margins on
the view fixes every child at once, so cards, key/value lists and tables
all sit on the same readable measure and the leftover space falls
outside the cards where it reads as margin rather than as a hole.

Scoped to this page as .cfg-page rather than added to .page-head, which
every other view shares; widening that is a separate decision.

This is what `margin: 0 auto` was for. Applying it to .kv-list, which is
what I tried first, really would have misaligned each list against its
own card heading and against the table beneath it, and I used that to
rule the approach out rather than to move it up a level.
2026-08-10 03:18:17 +10:00
sam f2eaba2fe1 fix(webui): keep Configuration rows full width, hug only the label column
Sizing the whole list with width: fit-content fixed the label-to-value
distance by breaking the row: every list ended at a different width, the
separators stopped part-way across the card, and no two Edit buttons
shared a column.

Those are two different knobs and only one of them was ever the bug.
How far the value sits from its label is set by the label track; how
wide the row is is set by the container. Hug the first, leave the second
alone: the label column is max-content so the value starts immediately
after the longest label, the value column takes the slack, and the
actions column is pinned right. The row spans the card again, so the
separators run full width and every Edit lands in one column, while the
label-to-value distance stays as short as it was.

Verified against the built stylesheet in the dark theme at 1440px:
label and value adjacent, locked reasons on their own line, actions
aligned across sibling lists.
2026-08-10 03:11:58 +10:00
sam 7b07033d7c fix(webui): size Configuration key/value lists to their own content
The rewrite capped .kv-list at 72rem and left it anchored to the card's
left edge, so on a wide screen the rows stopped well short of the card
and the action column floated in the middle of the dead space rather
than sitting near the value it belongs to.

Any fixed cap is a guess that is wrong at some viewport: too wide and
the actions drift away from the value, too narrow and paths truncate
for no reason. Size the list to its children instead --
width: fit-content, bounded by max-width: 100% so a pathological value
clamps and lets the ellipsis take over.

Not centred with margin: 0 auto. These lists share cards with
full-width tables (Models & providers has both), so centring would
misalign every list against its own card heading and against the table
directly beneath it.

Sizing to content required moving the columns off the row and onto the
list. Each .kv was previously its own grid, so no row could size a
column against any other row, and a max-content label track would have
ended at a different x on every line. The list now declares the tracks
and each row adopts them with grid-template-columns: subgrid, giving
one shared label column sized to the longest label and no wider. A
@supports fallback keeps the previous bounded-column behaviour where
subgrid is unavailable, and the narrow-viewport rules drop out of
subgrid because a shared label column is the wrong shape once the row
stacks.

Verified by rendering the built stylesheet against representative
markup rather than by inspection: label and value adjacent, notes on
their own line, actions in a reserved column, no dead space.
2026-08-10 03:07:47 +10:00
sam fb7fba4232 fix(webui): rebuild the Configuration page layout so values stop colliding
The page had three compounding layout faults, all visible on a wide
screen and all still present after the earlier spacing pass:

  1. .cfg-row used justify-content: space-between on a full-width card,
     so the label sat at the far left and its value at the far right with
     roughly a thousand pixels between them. Reading one pair meant
     tracking across the viewport. The earlier "tighten KV row spacing"
     change reduced vertical padding only, which is why the complaint it
     was meant to answer survived it.
  2. .cfg-value had no min-width: 0, so a long value could not shrink
     inside its flex parent. It overflowed into the Edit button, which is
     why 400 rendered as "40" and 100000000 was clipped mid-number.
  3. The locked-row reason was a flex sibling of that overflowing value,
     so it ran onto the end of the path with no separation, rendering
     ".../archie/work" and "pins the daemon's working layout" as one
     unbroken string.

Replace the flex row with a three-column grid: label, value, actions.
Label and value are adjacent and left-aligned so the eye travels a fixed
short distance at any viewport width; the value column is minmax(0, 1fr)
so it can actually shrink, truncating with an ellipsis and keeping the
full text in a title attribute; actions occupy a reserved column that
nothing can overlap. Secondary text (locked reason, override marker,
validation error) gets its own grid row instead of sharing the value
line. Narrow viewports stack label over value rather than truncating
both to a few characters.

Extract the row renderer into settings/config-row.js. settings.js
imports its own stylesheet, which the node test shim cannot parse, so
the rendering logic was untestable where it sat; this mirrors
tasks/task-row.js. Seven tests now cover the two collision bugs
structurally, asserting on per-child text rather than the row's
flattened string so a future layout change cannot pass by merging the
fields back into one node.

Also stop sharing .cfg-rows with the Workflows "Start work" form. A
class owned by the Configuration page meant restyling Configuration
could silently restyle that form; it is now .wf-form, owned by the
feature that uses it.
2026-08-10 03:00:56 +10:00
sam 171e1b2686 feat(config): surface overlay state, shadowed keys, and per-row reset
Three gaps closed, all in the 'your change didn't take effect and
nothing told you' family:

1. MaxRetries joins the reloadable allowlist, and the criterion is
   fixed on reloadableFields: a field is reloadable when EVERY
   consumer re-reads it. MaxRetries is the worked example -- its only
   consumer is the webui maxRetriesFor handler, which re-reads per
   request (api_tasks.go:380,383); nothing in the daemon reads it, so
   warning 'requires restart' was spurious. Chat.Telegram.TokenEnv is
   documented as the counter-example (webui reads it per request but a
   startup-built telegram bot consumes it, so it is not reloadable).
   Pinned by TestChangedNonReloadableFields alongside the comment.

2. Boot-time overlay degradation is now surfaced. config.ReloadStatus
   gains OverlayUnavailable; main.go records the reason when the
   overlay store cannot be opened or its values fail validation, and
   /api/config carries it (merged into LastReload). Cleared by a
   successful dashboard write or reset. The settings page renders a
   warning banner, so a daemon running on file config alone says so
   where the operator is looking, not only in logs.

3. Overlay-shadowed file edits are visible and recoverable.
   ConfigView.Overridden lists the dotted keys the runtime overlay
   currently sets, so the UI marks those rows (their file value is
   shadowed until reset). POST /api/config/reset exposes the
   store's Delete as a per-row reset: it deletes the row and
   republishes file + remaining overlay, which is also the answer to
   'my file edit isn't taking effect'. The dashboard can now remove
   every override it can create.

Verified: task check clean; -race clean on cmd/archied, webui,
infrastructure/configuration; new handler tests cover the reset
200/400/503 paths and the overridden list.
2026-08-10 01:09:05 +10:00
sam fa8a0d6d02 feat(webui): inline config editing on the Configuration page
The dashboard's Configuration page can now change runtime-tunable
settings without hand-editing TOML (issue #348). Scalar rows get an
Edit affordance; Save PATCHes the dotted key to /api/config, which
validates the materialised config before persisting to the runtime
overlay and republishing.

Per the design constraints:
- Structured values (repositories, models, providers -- arrays and
  maps) render read-only with no edit affordance; they are not
  faked as editable.
- Denylisted keys (db_path, work_dir) render explicitly disabled with
  the server's reason from the ConfigView.locked map, instead of a row
  that silently lacks an Edit button.
- Bool fields edit via a select, ints parse client-side so a typo
  fails before a round trip, durations and strings pass through to
  the server which validates them. The server's error text is shown
  inline on a rejected save (validation failure, denylist, disabled
  overlay).
- Enter saves, Escape cancels, Cancel restores the row.

api.configUpdate PATCHes /api/config with {updates: {dotted.key: v}}.

Verified: task check clean; 23 node tests pass; dist rebuilt and
committed in the same change.
2026-08-10 00:57:05 +10:00
sam 4204005ca3 fix(webui): tighten configuration KV row spacing
Each row in the read-only configuration view was ~45px tall but the
text was only ~20px — empty space outweighed content by ~2:1, making
the page hard to scan. The combined effect of `gap: var(--sp-2)` on
the flex container and `padding: var(--sp-2) 0` on each row doubled
the breathing room. Tables on the same page (Repositories, Providers)
already use the target density; configuration rows now match them.

Scope the override to `.cfg-section` descendants because the
Workflows "Start work" form reuses `.cfg-rows` for its input fields
(form.cfg-rows, no .cfg-row children) and would otherwise lose its
8px inter-field gap. The form is unaffected: the override only
matches when an ancestor carries .cfg-section.

Rows go from ~45px to ~25px, with the border carrying the visual
rhythm instead of doubled padding.
2026-08-09 23:18:02 +10:00
sam 61b4b7b0cf refactor(store): replace legacy persistence with SQLite
Task and event persistence now uses a dedicated SQLite sidecar derived from the configured state prefix, matching the independently persisted conversation store. The configured path now means a state-path prefix rather than a database file so fresh SQLite state never attempts to interpret the previous storage format.

Remove the retired implementation and dependency completely, strengthen SQLite migrations and concurrency behavior, restore backend-neutral coverage, and align configuration, operational guidance, UI labels, and deployment documentation with the new storage and host-daemon topology.
2026-08-09 22:27:25 +10:00
sam 03d52903c7 Merge pull request #449 from samcharles93/fix/444-chat-layout-scroll
fix(chat): give chat page a real height budget instead of a floor
2026-08-09 02:45:41 +10:00
sam 7846d37760 fix(chat): give chat page a real height budget instead of a floor
Fixes #444

.chat-page previously used min-height: calc(100vh - 5rem), which is a
floor, not a cap. Any dynamic content pushed above .chat-layout (an
error banner, extra status pills, the "Reload Telegram"/"Check
updates" row wrapping to two lines) grew total page height past the
viewport, so the whole page scrolled instead of just
.chat-transcript.

Turn .chat-page into a fixed-height flex column (height, not
min-height, plus overflow: hidden) so it can never grow past its
viewport budget. .chat-page-content, .chat-topbar, .chat-update-panel
and .chat-dangerous-panel become flex children that size to their own
content, and .chat-layout switches from a min-height floor to
flex: 1 1 auto; min-height: 0 so it absorbs whatever space is left
after the topbar/banners, mirroring the minmax(0, 1fr) pattern
.chat-workspace already used internally. .chat-sidebar gains
overflow-y: auto so a long session list scrolls in place rather than
pushing the layout taller.
2026-08-09 02:42:40 +10:00
sam e94040a882 fix(chat): stop showing raw 501 banner for unconfigured update-check
refreshUpdate() rendered the fetch error's raw message text into a
visible banner on every page load, including a plain "501: Not
Implemented" when chat.telegram.update_check_command is unset -- a
normal "feature not configured" state, not a failure.

Add updateUnavailableMessage() (chat-update-status.js) to branch on
ApiError.status: 501 renders nothing (matching how Channels shows a
calm "not configured" state for an unconfigured channel), any other
error gets a fixed human message instead of the raw fetch text.

Fixes #443
2026-08-09 02:41:38 +10:00
sam b56f07fe73 feat(webui): Enter sends, Shift+Enter inserts a newline
Composer previously required Ctrl/Cmd+Enter to send. Plain Enter now
sends (still yielding to the command-menu's own Enter handling when
it's open); Shift+Enter is left unhandled so the textarea's default
newline behavior applies. Updated the visible hint to match.
2026-08-09 02:36:07 +10:00
sam dafbcb0f5c fix(webui): Send button no longer passes its click event to sendMessage
send.onclick = sendMessage bound the DOM click handler directly, so every
click invoked sendMessage(event) -- the MouseEvent became `retry`, which
is truthy but has no .turn, and retry?.turn.text threw immediately,
before any UI state changed. The click silently did nothing.

Extracted the retry/composer-text resolution into chat-retry.js's new
resolveTurn(), which only treats an argument as a genuine retry when it
actually carries a turn.text string -- a stray event (or any other
non-conforming truthy value) now falls back to the composer text
instead of crashing. Fixed the call site itself
(send.onclick = () => sendMessage()) as the actual root cause.

Fixes #447
2026-08-09 02:34:55 +10:00
sam 98b9a57ce9 fix(ui): hide inactive chat command menu 2026-08-09 01:30:38 +10:00
sam 4131f05036 feat(webui,gateway): wire config, channel, log-feed, and work-intake seams
Composition root work tying the config resolver, channel manager, log
feed, and executable workflow registry into the running daemon and
dashboard server: web.Channels/LogFeed/Workflows/ConfigProvenance,
channel-reload wiring, TaskStopper for the Stop action, and
SpawnRequest.Body/WorkRequests threading dashboard "Start work" requests
through the same admission path chat uses. Touches all three features at
once because this is where they're composed, not owned by any single one.

Refs #53, #54, #55
2026-08-09 01:26:58 +10:00
sam 92280f4039 fix(store,gateway): taskstate constants and mobile jump-to search
Follow-up pieces of the task-controls work: store.InsertEvent factors out
an execer-generic insertEvent so SQLite gets the same zero-time defaulting
ArchiveTask's audit path relies on; gateway tests assert against
taskstate constants instead of magic status strings; the navigation
command bar gets an accessible mobile search toggle.

Refs #53
2026-08-09 01:26:40 +10:00
sam a27d430215 feat(logging,workflow): daemon log feed and executable workflow registry
Add internal/logging.Feed, a logging-owned bounded replay buffer separate
from the persisted task-lifecycle event stream, with a live SSE endpoint.
Expose the executable workflow registry (skillbuild.Catalog) including
zero-run definitions and their origin (builtin vs. installed skill), not
just historical run statistics. Route() now returns an explicit failure
workflow for an unknown pre-assigned workflow name instead of silently
falling through to label-based routing.

Fixes #54
2026-08-09 01:26:10 +10:00
sam 472d8d717c feat(config,channels): format-neutral config resolution and truthful channel state
Loader.Resolve() selects TOML/YAML files or a config directory as the
production entry point, replacing the TOML-only Overlay() as the default
path. Add internal/channels.Manager, reporting each adapter's actual
runtime lifecycle (configured/starting/running/degraded/failed) instead of
inferring health from configuration presence alone. Wire channel reload
through a per-adapter seam.

Fixes #55
2026-08-09 01:25:58 +10:00
sam 0d500a4ca9 feat(webui): lifecycle-safe task controls with atomic retry and archive
Add cancel/stop/approve/reject/retry/abandon/archive to the dashboard task
action matrix, each guarded by an optimistic status check against the
store. Retry accounting (RetryCount, max_retries) is now atomic with the
status transition instead of a separate write. Archive removes a terminal
task's local record with a fail-safe audit event first. Add always-labelled
responsive navigation, mobile Jump-to search, and versioned Setup-complete
dismissal.

Fixes #53
2026-08-09 01:25:51 +10:00
sam b876fc80cc feat(gateway): make chat turns durable and idempotent 2026-08-09 01:15:41 +10:00
sam e10cbbc92c refactor: pre-cleanup. 2026-08-06 01:40:15 +10:00
sam 68ba3456ee feat(webui): chat from the dashboard
Brings the chat surface to the Web UI: /api/chat with its own handlers
and tests, a self-contained ui/src/chat feature folder, and the shared
plumbing to reach the same router Telegram uses.

Includes a dangerous-command approval path (internal/gateway/dangerous.go,
internal/webui/dangerous.go, and the Telegram counterpart) so /rollback
and /stop are gated the same way on both surfaces, persona handling for
web sessions, and release-update formatting split out of the Telegram
service so both can render it.

web_parity_test.go pins that the two surfaces expose the same commands.

Authored in a parallel session; committed here so it lands with the rest
rather than sitting uncommitted while other work builds on top of it.
task check passes with it in place.

Screenshots used while building are gitignored (*.png) rather than
committed, matching the call made on the earlier design reference.
2026-08-05 10:48:51 +10:00
sam 1f2e7a42eb refactor: one definition of what approving or declining a task means
The dashboard and chat both let an operator approve or refuse work, and
they had drifted. Declining from the dashboard left the task
closed_wont_do; cancelling the same task from chat left it rejected. Two
operators looking at one queue saw different states for the same
decision, and "rejected" -- which reconcilePRs also uses for a pull
request closed without merging -- stopped meaning one thing.

internal/gateway deliberately does not import internal/store, so it kept
a hand-synced copy of the status strings with a comment asking future
editors to keep them aligned. That is the same defect one level down,
and it is how the drift happened.

internal/taskstate is a leaf package with no dependencies holding the
lifecycle vocabulary and the rules for operator actions. gateway, store
and the dashboard all import it, so gateway stays decoupled from store
without a copy, and CheckApprove/CheckRetry/CheckDecline have one
implementation. Declined is named for what it is -- a human said no --
and stays distinct from Rejected, which is something archie observed.

Chat cancel now records Declined. That is the behaviour change: same
decision, same state, whichever surface the operator used.

Rules were preserved rather than tidied while unifying. A parked task
still cannot be declined, which both surfaces already refused, even
though "not terminal" would have allowed it -- widening a rule under
cover of a refactor is how you ship a change nobody reviewed. The
comment says where to change it if that is ever wanted.

TestDashboardAndChatAgreeOnTerminalStates drives both real surfaces
against one store, so this cannot drift apart again without a red test.

Also removes a second rule for the dash-top-standalone class: renderSetup
already reconciles it from the data at the top of every call, and a later
branch cleared it again. Harmless, but it reads as two sources of truth
for one bit of layout state.
2026-08-05 04:15:39 +10:00
sam 170fe0250b fix: close the duplicate-work loop and the dead paths around it
Applies the four-reviewer pass over the forge/dashboard-actions work.
The through-line is that several capabilities were wired but inert, and
one of them could cost real work.

DUPLICATE WORK. "Closes #N" was dropped from PR bodies in favour of
LinkBranch, which is sidebar linkage on Gitea and a no-op stub on
GitHub -- neither closes anything, and nothing else did either. So a
merged task left its issue open, labelled and assigned; the next poll
re-enqueued it, and once the dashboard's Clear removed the task row that
became a second implementation and a second PR for work already merged.
reconcilePRs now closes the issue on merge, and a rejected task closes
its issue too. A PR closed without merging deliberately leaves the issue
open: that usually means "try again".

MAX RETRIES. Configured, defaulted and reported by /api/config, and
enforced nowhere -- markDead was unreachable and EffectiveMaxRetries had
no callers, so the dashboard's retry incremented retry_count forever.
The retry action now retires a task to dead at the cap.

DEAD ON ARRIVAL. Tasks() never selected plan or source, so the
"Decision required" panel could not render and chat tasks -- whose issue
number is synthetic -- linked to forge issues that do not exist.

COSMETIC FAILURE, FATAL RESULT. OpenPR failed the whole stage when
LinkBranch errored, so the pull request was never opened and the task
parked; a retry re-links the same branch, which Gitea answers with a
conflict, so every retry parked again. It is best-effort now.

INVISIBLE ACTIONS. Approve/retry/reject wrote store rows and nothing
else, so the timeline and activity stream never showed that a human had
intervened. They emit events now.

Also: store write failures answer 500 rather than 409; the dashboard
surfaces the server's actual reason instead of "409 Conflict"; action
buttons stop propagation (acting on a task no longer also expands it),
disable in flight, keep per-task errors instead of one shared string,
and confirm before rejecting.

Removed: the maybeRetryParked shim and markDead with their now-vacuous
tests, WaitingTasks (no consumers; its tests were rewritten to assert
the same routing through TaskByID), write-only Daemon.Runtime, and
dir/dirs response bloat from /api/skills. skillSource checked workDir
before sharedDir, mislabelling every shared skill when the two are equal.
DefaultRoots now dedupes roots differing only by a trailing separator.

The air build rule claiming to keep ui/dist current never ran -- it
required one file to satisfy include_dir and include_file together, and
ui/ is excluded from the walk. Deleted with the comment that promised it.
task test:ui joins task check and CI; it ran nowhere before, so the
dashboard suite could rot silently.

Docs corrected where they described behaviour that no longer exists:
parks no longer comment on the issue, state labels no longer drive
retries, and forgerpc's doc claimed four proxied methods while listing
three of five.
2026-08-05 03:54:25 +10:00
sam 4d44ef76f5 feat(webui): rebuild the dashboard
The old UI was a single 200-line Go file serving one hand-written HTML
page of task rows. It showed that archied was running and almost nothing
about what it was doing -- skills, workflows, memory, channels, logs and
configuration were all invisible unless you read the source or the
config file.

The dashboard now covers each of those as its own section, built as a
Vite app under ui/ at the repo root: it is a separate artefact from the
Go daemon, not an internal package of it. dist/ is committed so building
archied never needs a Node toolchain, and the !no_ui build tag keeps an
embed-free build available.

Both sides are split by concern rather than by layer -- one Go file per
API area, one folder per UI section with its own CSS -- so a change to
logs cannot disturb tasks.

Pages report consequences, not just state: an empty memory page says
Archie starts every conversation with no recollection of earlier ones,
and the setup checklist names what is missing in plain language instead
of showing a grid of zeroes. Nothing greets by a hardcoded name; the
operator comes from [chat], which is deployment data.

Auth is exposure control, not capability control -- the agent already
holds this user's authority through its own tools. So a loopback bind
needs no token, and only a reachable bind mints one and logs a URL,
which means an instance cannot be exposed merely by omitting config.

Container startup now degrades instead of aborting, for the reason
resolveForge already does: a missing agent image should not deny the
operator chat and the dashboard, and under Restart=on-failure it turns a
recoverable problem into a crash loop with the real error scrolling past.

`task dev` runs the daemon under air and the Vite server together in one
terminal.
2026-08-04 01:45:36 +10:00