Commit Graph
801 Commits
Author SHA1 Message Date
Federico Jaramillo Martinez 87c09982e9 feat(plugins): add bundled relays workspace panel plugin 2026-07-28 23:14:21 +02:00
Federico Jaramillo Martinez d19fca4090 feat(plugins): add files.listFiles directory listing to the plugin API 2026-07-28 23:14:21 +02:00
Federico Jaramillo Martinez 12f25282fc fix(sessions): void the open ask_user form when a chat message arrives
An ordinary chat message answers the session's open ask in the user's
own words, so keeping the form open would invite answers to questions
the conversation has already moved past. The form now closes as
cancelled, browsers clear the live card, and the model is told without
being woken so the notice rides into the turn the message itself
starts. Ignored duplicate queued messages skip the void on purpose:
they must not void an ask posted after the queued original.
2026-07-28 23:14:21 +02:00
Federico Jaramillo Martinez f9d0b2b8d5 Merge pull request #107 from jmfederico/remove-legacy-archive-migration
fix(sessiond): remove legacy session archive migration
2026-07-28 23:11:23 +02:00
Federico Jaramillo Martinez eec40267b4 Merge branch 'main' into remove-legacy-archive-migration 2026-07-28 20:21:22 +02:00
Federico Jaramillo Martinez 79d4a294d6 Merge pull request #108 from jmfederico/fix/windows-session-test-paths
test(sessions): fix Windows-only failures from drive-relative fixture paths
2026-07-28 20:21:06 +02:00
Federico Jaramillo Martinez 31c3cfe43e test(sessions): resolve POSIX fixture paths that are drive-relative on Windows
Five tests failed only on the Windows runner. Their fixtures used bare
POSIX-absolute paths such as /srv/other-worktree and /old-project, which
win32 treats as absolute but drive-relative: resolve() maps them onto the
runner's current drive (D:\...). The code under test canonicalizes stored
cwds by contract, so assertions comparing against the raw fixture string
never matched on Windows:

- parentSessionLocator and crossWorkspace listings annotate
  parentSessionCwd with canonicalizeStoredCwd(header.cwd);
- cleanup forgets unread via canonicalizeStoredCwd(record.cwd), which
  missed the marker the test seeded with the raw path.

Resolve the fixture paths once at declaration, matching the existing
WORKSPACE_CWD = resolve("/workspace") convention, so fixtures model what
a real Windows Pi would record. Linux behavior is unchanged.
2026-07-28 19:59:27 +02:00
Federico Jaramillo Martinez 612ea74720 docs(agents): add positive-phrasing principle to documentation guide
Record that docs state what the software does and reserve "does not"
statements for behavior that contradicts the most obvious expectation.
2026-07-28 19:43:32 +02:00
Federico Jaramillo Martinez 5b717ed542 docs(config): state data directory behavior positively
Documentation should describe what the software does, not enumerate
what it does not do. Rephrase the data-directory wording around the
positive facts (each directory is independent; a new root starts with
empty state) and drop the "never moves or copies" constructions from
config.md, the config.html env table, and the changeset.
2026-07-28 19:43:22 +02:00
Federico Jaramillo Martinez 5c3461d508 chore(changeset): record legacy session archive migration removal 2026-07-28 16:22:00 +02:00
Federico Jaramillo Martinez 741b55117b docs(config): document independent data directories
Changing PI_WEB_DATA_DIR selects where managed state lives but never
moves or copies existing state. Explain how to carry session archives
over manually, and fix the stale "moves managed state location" claim
in the config.html env table.
2026-07-28 16:21:51 +02:00
Federico Jaramillo Martinez 1a191bfa13 fix(sessiond): remove legacy session archive migration
The migration moved ~/.pi-web/archived-sessions* into a custom
PI_WEB_DATA_DIR at session daemon startup. Remove it outright: data
directories are independent, and anyone who sets a custom data
directory can copy archived-sessions.json and archived-sessions/
manually while the daemon is stopped.

Without the migration, runSessionDaemonStartup's only remaining
contract was sequencing create/register/listen, so inline those steps
into sessiond.ts and drop the wrapper module and its tests.
2026-07-28 16:13:59 +02:00
Federico Jaramillo Martinez 69b125b001 feat(sessions): surface cross-worktree parent and child sessions
A session spawned into another worktree recorded a parent that no
listing contained, so the row showed only "parent unavailable" and its
parent's row looked childless. Both facts were accurate and useless:
neither said where the related session actually was.

Report both directions from the session store instead. A missing
parent's cwd and id come from its own file header, so one 4 KB read per
distinct missing parent resolves it without listing other workspaces;
children are counted by listing sibling workspaces and matching the
parent path they already recorded, needing no header reads. Reads are
memoized per path because Pi writes headers once, and the cache is
released on dispose. Both directions are best-effort: an unreadable
header or an unlistable worktree leaves a session unannotated rather
than failing the listing.

In the browser, an orphan child keeps the same child marker as a nested
one, dimmed, so it no longer renders as a root; whereabouts are stated
once on the meta line ("parent in feature/foo", "2 children
elsewhere"), where a clamped title cannot hide them. A "Go to parent
session" action switches to the owning workspace and selects the
parent. Live session.created events keep child counts current instead
of leaving them stale until the next listing.

Session and workspace paths reach the browser from two producers: store
enumeration for a listing, and the live runtime for a broadcast. They
are now compared through one normalizing helper, so tree nesting and
child counts cannot silently miss a link when only a trailing separator
differs.

Extract the shared "workspaces of the project containing this cwd"
lookup out of ProjectScopedSpawnTargetResolver so spawn targeting and
child counting share one implementation, and register it regardless of
whether spawning is enabled: children can predate a config change, and
the tree should stay honest about them either way.
2026-07-28 11:56:21 +02:00
Federico Jaramillo Martinez a4f513dbd1 docs(test): record happy-dom as the standard Lit component test harness
The harness landed in 4973ada and spread to 11 component test files
without the guide mentioning it, while relays cited the guide as
sanctioning it. Document the per-file @vitest-environment opt-in, the
seam-selection order (pure exported seam, happy-dom, TemplateResult
extraction), happy-dom conventions and limits, and the opportunistic
migration stance for existing extraction tests.
2026-07-27 20:42:58 +02:00
Federico Jaramillo Martinez 4a5150309d feat(ui): add copy buttons to workspace menu details 2026-07-27 19:31:15 +02:00
Federico Jaramillo Martinez 8517800a24 feat(plugins): turn Info panel into a PI WEB status view
Rework the bundled Info plugin from a demo into an always-available
status view: running and installed versions, installation details,
release state, and per-service health rendered from host-provided
state, plus machine and workspace details. Replace the window.alert
demo action with a Copy PI WEB Diagnostics action that copies a
plain-text summary for bug reports.

Add state.selectedMachine to the stable plugin runtime state so
actions and other runtime callbacks can read the selected machine's
identity, and split the plugin into a copy-paste-friendly skeleton
(pi-web-plugin.ts) and replaceable internals (infoInternals.ts).
2026-07-27 18:03:25 +02:00
Federico Jaramillo Martinez 0a35748478 Merge pull request #105 from jmfederico/feat/unread-ux
feat(ui): improve unread-messages experience
2026-07-27 15:58:55 +02:00
Federico Jaramillo Martinez f76a9fabc8 feat(ui): unify row indicators into one mark with an unread ring
Unread is no longer a competing ActivityIndicatorKind or a separate
name-adjacent dot: every row renders a single indicator. An accent ring
wraps the still-pulsing work dot when a row is both busy and unread, a
filled accent dot shows while idle and unread, and activity kinds keep
their existing precedence (sending > session > terminal). Session rows
surface unread state even while busy, so the unread header count and
mobile Sessions badge now count busy unread sessions too.
2026-07-27 15:55:06 +02:00
Federico Jaramillo Martinez 8172defca3 Merge pull request #104 from jmfederico/fix/session-list-scroll-reveal
fix(ui): scroll session/workspace lists only on positive reveal triggers
2026-07-27 15:46:50 +02:00
Federico Jaramillo Martinez f2307b8c62 test(ui): explain the double updateComplete await in WorkspaceList scroll tests 2026-07-27 15:41:32 +02:00
Federico Jaramillo Martinez 8af637b00e feat(ui): bubble unread presence up to workspace, project, and machine rows
Wire the derived UnreadPresence into dot indicators (no counts) across the
navigation panel: workspace, project, and machine rows (machine-switcher and
machine-list) now show a static accent dot whenever a session beneath them is
unread, including offline machines with stale-but-present state. Presence
flows PiWebApp -> AppNavigationPanel -> leaf id sets, mirroring the
unreadSessionIds chain, and is covered by happy-dom component tests per list
plus panel- and app-level wiring tests. Adds changesets for the mark-as-read
actions and the bubble-up indicators.
2026-07-27 15:08:31 +02:00
Federico Jaramillo Martinez 76f292cfde fix(ui): scroll session/workspace lists only on positive reveal triggers
Live data refreshes (messageCount churn from session status publication,
workspace topology refreshes) replace the sessions/workspaces arrays and
the selected object with same-id copies, and each replacement re-scrolled
the selected row into view.

Replace the broad updated() scroll triggers with positive reveal triggers:
a different row becoming selected (first render included), the archived
reveal path, a restore moving the selected row from archived back to
current (same id, archived flag cleared), and section expansion. The
sessions/workspaces array triggers are removed, not guarded.
2026-07-27 14:46:25 +02:00
Federico Jaramillo Martinez 9267174736 feat(ui): derive bubble-up unread presence from unread projections
Add pure unreadPresence helpers mapping unread summary cwds to machine,
project, and workspace presence (machine = any summary, workspace = exact
path match, project = known workspace ownership), plus a PiWebApp seam
that keeps the derived UnreadPresence state current on any machine's
projection change and on app-state transitions. No UI consumption yet.
2026-07-27 14:41:40 +02:00
Federico Jaramillo Martinez b4a7a9230b feat(ui): add mark-as-read actions for unread sessions
Add a "Mark as read" item to the session row menu (shown only for
unread, non-archived, non-transient sessions) and a bulk "Mark read"
action to the current-selection toolbar (enabled when any selected
session is unread). Both flow through AppNavigationPanel to PiWebApp,
which acknowledges via SessionUnreadController with the exact observed
completion order.
2026-07-27 14:22:17 +02:00
Federico Jaramillo Martinez 0a080f4390 test(sessions): cover unread cleanup across all archive paths
Relay unread-ux leg 1: audit verified every archive path (single, bulk,
tree, cleanup, restore, delete, rebind) clears unread state in the right
order with no resurrection vector. Add regression tests for the uncovered
paths: bulk archive, archive with descendants, cleanup, bulk delete, and
archiving an active session with a pending activity latch.
2026-07-27 13:59:29 +02:00
Federico Jaramillo Martinez 4191d526f4 Merge pull request #103 from jmfederico/feat/model-questions-ux
feat(sessions): add ask_user question forms
2026-07-27 13:01:59 +02:00
Federico Jaramillo Martinez 80494dd6d8 fix(ui): prevent iOS zoom on custom answers 2026-07-27 12:42:19 +02:00
Federico Jaramillo Martinez e567d43042 feat(settings): add Ask Questions toggle 2026-07-27 12:39:40 +02:00
Federico Jaramillo Martinez 0e83146315 fix(ui): streamline ask_user question forms 2026-07-27 10:55:49 +02:00
Federico Jaramillo Martinez 4e47c23f23 Merge remote-tracking branch 'origin/main' into feat/model-questions-ux
# Conflicts:
#	src/server/sessiond.ts
#	src/server/sessions/sessionRoutes.test.ts
2026-07-27 09:44:40 +02:00
Federico Jaramillo Martinez ce4b469727 feat(ui): add model and thinking selector actions 2026-07-27 09:40:24 +02:00
Federico Jaramillo Martinez 9191f59146 docs: document ask_user question forms 2026-07-27 01:17:48 +02:00
Federico Jaramillo Martinez 7bbf5aa73c feat(client): project ask_user transcript records 2026-07-27 01:09:28 +02:00
Federico Jaramillo Martinez 4973adaa80 feat(client): render ask_user question cards 2026-07-27 00:52:47 +02:00
Federico Jaramillo Martinez 862ae73fcb feat(client): carry the open ask_user question set into browser state
Parse the daemon-owned `pendingAsk` in `parseSessionStatus` and validate
`ask.opened` / `ask.closed` frames rather than accepting them on their type,
since they drive a form the user answers on the model's behalf.

Add `submitAsk` / `cancelAsk` through `request()` + `sessionPath()`, both
returning the recomputed session status so closing an ask needs no follow-up
status request, and derive `pendingAsk` in `SessionController` from status plus
live events with `sessions.askUser` capability gating.

New `askDrafts.ts` keeps what the user has typed in browser-local storage under
`pi-web:ask-draft:<sessionId>:<askId>` and owns the pure answer-state helpers,
so the daemon owns "there is an open ask" and the browser owns "what I have
typed so far".
2026-07-26 23:26:43 +02:00
Federico Jaramillo Martinez e502d569a9 test(sessiond): make the concurrent-refresh note's wiring verifiable
One optional line in sessiond.ts passed the model catalog refresher into
PiSessionService, and it was the only thing making "· provider model lists are
refreshing" reachable in the product. Deleting it left typecheck, lint, Knip,
and all 1860 tests green while the note silently disappeared — confirmed by
actually deleting it and running each check. sessiond.ts starts a daemon as an
import side effect, so nothing in it could be tested.

Extract the dependency assembly into a pure sessionServiceDependencies()
function, following the sessionDaemonStartup.ts precedent, and assert what a
user is actually told: a service built by the real assembly, with a refresh in
flight, reports the note on its startup phases. A companion test pins the note
to the refresher's answer so the first cannot pass on unconditional wording.

Only the object literal moved. Everything createRuntime() constructs before it
stays in place and in order — the provider freeze must still precede any real
session, for the reason its comment gives — and the extracted function performs
no side effect, so construction order, side effects, and routes are unchanged.

The wiring is now guarded at both hops. Dropping the field from the assembly
fails the new test; dropping it from sessiond.ts fails typecheck, because the
assembly's input type requires every collaborator the daemon constructs.
PiSessionServiceDependencies.catalogRefreshStatus stays optional, so the 98
existing service constructions in the suite are untouched, and the refresher's
getter stays read-only: the test injects a fake in-flight status rather than
touching its cadence, timeout, or coalescing.

subsessionsEnabled's spawn-capability conjunction moved into the assembly with
the literal it lived in. The semantics are identical, and it is now covered by a
test instead of being another untested decision in an untestable file.
2026-07-26 23:15:09 +02:00
Federico Jaramillo Martinez 4940eda352 fix(sessions): stop counting session startup as work in progress
Startup progress rides the per-session activity channel with an "active"
phase, because a startup phase really is in progress. But isSessionActive()
treated any active activity as work, so a session that was merely *opening*
enabled "Stop Active Work", disabled "Reload from disk" with the misleading
"Stop current session activity before reloading" tooltip, showed the row's
active-work indicator, and — for any caller that hands a startup activity to
WorkspaceActivityService — reported the whole workspace as busy. Selecting an
archived, read-only session reported active work while it opened.

Starting is not working. publishStartupProgress now marks its reports with a
new optional SessionActivity.startup field, and isSessionActive() does not
count a marked activity. Every affected consumer — the session list, the core
actions, the app's activity-transition handling, and the server's workspace
aggregation — reads that one helper, so the correction lands in all of them at
once.

The marker is a new field rather than a new phase on purpose: six readers test
phase === "active" directly, including the pending row's "creating · " prefix,
the chat dock's active styling, and the daemon's own heartbeat re-publication.
It can only ever remove the activity-phase reason for being active, so
streaming, bash, compaction, and queued prompts still report as active through
the status even while a startup report is the latest activity. The chat dock
still shows the startup text; this changes what counts as work, not what is
shown.

The browser's own pending-create row keeps its previous appearance: it borrows
only the daemon's phase text and drops the marker, since that row stands for a
create the user is waiting on rather than a session the daemon is opening.
2026-07-26 22:54:27 +02:00
Federico Jaramillo Martinez 51ebfe4c00 feat(sessions): deliver ask_user answers
Integrate the pending-ask store into the session service so an open ask is
visible, observable, and closable.

- `statusFromSession` projects `pendingAsk`, so a browser rehydrates an open
  ask from `GET /sessions/:sessionId/status` after reload or a web/API restart.
- `openAsk` publishes `ask.opened`, and publishes `ask.closed` first when the
  new ask supersedes an unanswered one.
- `submitAsk` / `cancelAsk` close the ask and hand the outcome to the model as
  a `pi-web.ask.answers` follow-up custom message (`triggerTurn`,
  `deliverAs: "followUp"`), the same delivery subsession notices use. A stale
  ask id is reported, not thrown: losing the race against a supersede or
  another browser is ordinary. Cancel still reports every question as
  unanswered so the model is not left waiting for a promised message.
- The open ask is forgotten when its runtime closes; nothing is left to
  receive the answers.
- `POST /sessions/:sessionId/ask/{submit,cancel}` behind the existing
  `/api/sessions/*` daemon proxy, allowlisted for machine federation.
2026-07-26 22:38:15 +02:00
Federico Jaramillo Martinez cd1326a8ca Merge pull request #102 from jmfederico/feat/worktree-autodetect
feat(workspaces): detect worktrees created or removed outside PI WEB
2026-07-26 22:32:00 +02:00
Federico Jaramillo Martinez c9fabbf1b6 chore: untrack the relay working notes
.pi-web/ is gitignored local state; the relay packet was force-added while
running the work and should not land on main. The notes stay on disk for the
worktree, they are just no longer tracked.
2026-07-26 22:25:59 +02:00
Federico Jaramillo Martinez ba37bd51ae docs(relay): record review nits 2 and 3 2026-07-26 22:25:59 +02:00
Federico Jaramillo Martinez 12200ab26a fix(workspaces): serialize overlapping topology refreshes
The browser-resume path and the plugin-facing app refresh call
refreshSelectedProjectTopology independently, so two requests for the same
machine and project could be in flight at once. The stale guards check machine
and project but not ordering, so a slower earlier response landing last
overwrote a newer list, making a just-created worktree disappear again.

Route the refresh through TrailingRefreshCoordinator, the primitive already
used for browser resume, session refresh, and activity, keyed by machine and
project. A second caller no longer opens its own request while one is in
flight; it gets a single trailing pass, so the last applied response is the
newest one.
2026-07-26 22:25:59 +02:00
Federico Jaramillo Martinez 9848fc3e40 refactor(workspaces): drop the unused locked worktree flag
Nothing consumed GitWorktreeInfo.locked: a locked worktree is a real checkout
and stays a usable workspace, so no caller needs to distinguish it. Unknown
porcelain keys are already ignored, so parsing it was speculative.

The parser test still feeds a real `locked` line and asserts it is ignored, and
the service test still pins that a present, non-prunable worktree is kept, so
the policy stays covered without the field.
2026-07-26 22:25:59 +02:00
Federico Jaramillo Martinez d7fc25312d docs(relay): record the post-relay selected-workspace freshness fix 2026-07-26 22:25:59 +02:00
Federico Jaramillo Martinez 92c39c8f35 fix(workspaces): keep selected workspace metadata fresh on refresh
A background topology refresh replaced the workspace list but left
selectedWorkspace pointing at the old object, so a branch switched inside a
worktree outside PI WEB showed the new name in the list while the collapsed
Workspaces header and the mobile context bar kept the old one until reselect.

Re-point selectedWorkspace at its refreshed entry, keyed by id (derived from
the path), so which workspace is selected never changes and the session and
terminal teardown in handleWorkspaceChange still does not fire. Skip the patch
entirely when metadata is unchanged, so an ordinary resume does not churn
object identity into state on every focus.
2026-07-26 22:25:59 +02:00
Federico Jaramillo Martinez 36d4e9a296 docs(relay): record worktree-autodetect leg 3 and relay completion 2026-07-26 22:25:59 +02:00
Federico Jaramillo Martinez 8a24a7c4a5 feat(workspaces): refresh worktrees on browser resume
Call WorkspaceController.refreshSelectedProjectTopology() from the existing
browser-resume refresh and the plugin-facing refreshAppData path, so worktrees
created or removed outside PI WEB become visible with no user action. No new
timer, watcher, process, or push channel; the resume path is already debounced
per animation frame and collapses concurrent requests.

Document the resume-scoped detection and the hiding of gone checkouts in the
FAQ, and add the changeset for the user-visible behavior.
2026-07-26 22:25:59 +02:00
Federico Jaramillo Martinez 1970ba14bc docs(relay): record worktree-autodetect leg 2 2026-07-26 22:25:59 +02:00
Federico Jaramillo Martinez 213ec104ea feat(workspaces): add non-disruptive workspace topology refresh
Adds WorkspaceController.refreshSelectedProjectTopology(), which re-lists the
selected project's workspaces and applies them through applyProjectWorkspaces
only. It never routes through selectWorkspace, which lacks an already-selected
guard and would clear the active session and all workspace-scoped state.

Stale responses for a project or machine the user has since left are discarded,
and failures go to an injectable background error sink instead of state.error.
2026-07-26 22:25:59 +02:00
Federico Jaramillo Martinez e12e5d16c6 docs(relay): record worktree-autodetect leg 1 2026-07-26 22:25:59 +02:00