Commit Graph
80 Commits
Author SHA1 Message Date
Federico Jaramillo Martinez 6f59a4243e refactor: expose session streamFn on PiAgentSession
Add a narrow `agent: { streamFn: StreamFn }` field to the PiAgentSession
interface, sourced structurally from the real AgentSession.agent (Agent,
from the stable @earendil-works/pi-agent-core package). This is the
resolved-auth/headers/retry "call this model" function pi's own
compaction/branch-summarization code uses internally, and will let
sessionNameGenerator.ts drop its dependency on the deprecated pi-ai
/compat provider registry in a follow-up leg.

No adapter object was needed: AgentSession's real .agent field already
structurally satisfies the new narrow shape, so defaultCreateAgentRuntime
needed no changes.

Adds a unit test proving the field is wired end-to-end via the injected
runtime creator. sessionNameGenerator.ts itself is untouched (leg C).
2026-07-02 11:28:18 +02:00
Federico Jaramillo Martinez 889672ff53 feat: add session runtime reload command 2026-07-01 19:32:52 +02:00
Federico Jaramillo Martinez d165d69f73 feat: add bulk session mutations 2026-06-29 13:34:03 +02:00
Federico Jaramillo Martinez a87479815a fix: inherit dispatcher model for spawned sessions 2026-06-28 16:46:37 +02:00
Federico Jaramillo Martinez cb13af4b88 feat: add manual session cleanup 2026-06-26 15:57:12 +02:00
Federico Jaramillo Martinez 7e812aa7f5 feat: support general chat file attachments 2026-06-25 21:32:07 +02:00
Federico Jaramillo Martinez 56c1c1714e fix: treat missing subsession files as unavailable 2026-06-25 11:08:26 +02:00
Federico Jaramillo Martinez b0b497d493 fix: require exact active subsession files 2026-06-25 09:47:41 +02:00
Federico Jaramillo Martinez 5550c60950 fix: enforce exact subsession recovery links 2026-06-25 09:27:10 +02:00
Federico Jaramillo Martinez 417b04a23f fix: harden subsession recovery validation 2026-06-25 00:30:16 +02:00
Federico Jaramillo Martinez a99696bd09 fix: persist tracked subsession links 2026-06-25 00:20:19 +02:00
Federico Jaramillo Martinez c479a0d54d fix: support pi-ai provider compat entrypoint 2026-06-24 09:15:32 +02:00
Federico Jaramillo Martinez 997b821717 feat: add check_subsession and an exploratory read_subsession transcript reader
Split subsession inspection into two tools: check_subsession gives a quick
glance (status + latest assistant output), while read_subsession reads through
a child's transcript with role/content filters, full-content substring search
(including tool-call args), optional per-value maxChars truncation that flags
clipped parts, includeToolArgs, and pagination.

Filtering and search run on full untruncated content; truncation is an explicit,
caller-owned final projection (no default) so a narrow read never silently hides
a match. Empty page-windows are distinguished from zero-match results.
2026-06-19 23:48:12 +02:00
Federico Jaramillo Martinez 355ebe8cf8 feat(sessions): add tracked subsessions behind a beta flag
Add spawn_subsession / list_subsessions / read_subsession tools that let an
agent start child sessions it stays attached to: the child records its parent
in the session tree, the parent is notified (as a system-authored custom
message that wakes an idle parent and queues behind in-flight work) when the
child stops working, and the parent can inspect children's status and result.

Gated behind a beta flag, off by default, mirroring spawnSessions: enable via
PI_WEB_SUBSESSIONS, the subsessions config key, or the Settings toggle. Also
requires spawnSessions.

Also fix the release skill so the version step resyncs package-lock.json
(npm install --package-lock-only) and the commit step refuses a release where
package.json and package-lock.json versions disagree.
2026-06-17 12:13:23 +02:00
Federico Jaramillo Martinez 32d11de38c Rename attachment folder from .pi-web/paste to .pi-web/attachments
Attachments can be pasted, dropped, or uploaded, so 'paste' was too
narrow. Rename the default folder and filename prefix accordingly and
update the changeset reference.
2026-06-17 01:02:33 +02:00
Federico Jaramillo Martinez e77ab98361 fix(sessions): stop duplicating user message for slash commands
A slash command sent as the first (or any idle) message showed the raw
command text twice until reload: once from the client's optimistic insert
and once from the server's message.append echo, neither of which converges
with the agent's canonical expanded message (e.g. a /skill:* block).

Make commands obey the same source-of-truth contract as prompts:
- client no longer inserts the raw command text optimistically; it shows
  the existing per-session sending indicator instead
- forwarded runtime/skill commands return a bare done result rather than a
  synthetic "Accepted ..." line
- server suppresses the raw message.append echo for command-forwarded
  prompts (threaded through the compaction queue too)

Result: pre-reload state matches reload, with no transient duplicate.
2026-06-17 00:02:04 +02:00
Federico Jaramillo Martinez 95c151233a feat: let agents start new sessions via spawn_session tool
Add a project-scoped spawn_session tool so agents can dispatch new,
independent sessions (ralph loops, long-plan chaining). Spawned sessions
are constrained to a workspace/worktree of the same registered project,
appear in the session list immediately via a new session.created event,
and the capability is on by default with a Settings -> Session daemon
toggle (spawnSessions / PI_WEB_SPAWN_SESSIONS).

Note: adds a session daemon code path, so pi-web-sessiond.service must be
restarted manually for the server side to take effect.
2026-06-16 14:53:37 +02:00
Federico Jaramillo Martinez 82db15f894 fix(sessions): guard, gate, and test session reload
Build on the original Reload action with the fixes raised in review:

- Server reload() now refuses to run on archived (read-only) sessions
  and when the session has work in progress, mirroring archive(), so a
  reload can no longer silently abort an in-flight agent run.
- Add a sessions.reload runtime capability; the client gates both the
  reloadSession call and the Reload menu entry on it so the action only
  appears for machines whose Pi-Web runtime supports it.
- reloadSession ignores cached-new and archived sessions.
- Add server (PiSessionService + routes) and client (SessionController)
  tests covering reload success, the active-work guard, archived
  rejection, route forwarding, capability gating, and error mapping.
- Restore alphabetical parser import ordering in clients.ts.
- Add a changeset documenting the feature and the sessiond restart note.

Note: touches a session daemon code path, so pi-web-sessiond.service
must be restarted manually for the server side to take effect.
2026-06-14 14:17:51 +02:00
Slava Iumin ea1ec1b595 feat(sessions): add Reload action to refresh session from disk
Sessiond caches the in-memory SessionManager and never re-reads the
session file. When the same session is also being edited by another
process (e.g. the pi CLI), new entries on disk are invisible to the
web UI \u2014 the tail of the conversation gets cut.

Add a manual Reload action in the session three-dot menu:

- Server: PiSessionService.reload(sessionId) closes the active
  session and re-opens it from disk, then publishes a fresh status.
  Exposed as POST /api/.../sessions/:sessionId/reload.
- Client: api.reloadSession, SessionController.reloadSession which
  discards the cached transcript and re-runs selectSession so the
  history page is re-fetched.
- ChatTranscriptStore gains discard(sessionId) and the history
  cache adapter gains optional remove(sessionId).
- SessionList shows a Reload entry for non-archived, non-cached
  sessions; plumbed through AppNavigationPanel and PiWebApp.

Note: pi-web-sessiond.service must be restarted manually after this
change since the session daemon code path is affected.
2026-06-14 14:11:34 +02:00
Federico Jaramillo Martinez ca30c970a7 refactor: source thinking levels from pi and make the gauge dynamic
Depend on @earendil-works/pi-agent-core so the ThinkingLevel union has a single source of truth (re-exported via shared/thinkingLevels). Wire/data fields use string and the parser is lenient, so an unknown level from a newer pi runtime is still listed, selectable, and rendered gracefully instead of throwing. The composer gauge now derives its bar count from the levels available for the current model and fills by rank. Adds compile-time drift guards (satisfies + Exclude check) and unit tests so a changed pi level set fails fast in development.
2026-06-14 13:47:44 +02:00
Federico Jaramillo Martinez edae57b836 Clean up remaining dead code and dependencies
- Replace unused 'codemirror' barrel dep with explicit @codemirror/{state,
  view,commands,language} sub-packages that were imported but unlisted
- Remove unused exports: writeNamespacedQuery, targetWorkspacePathForRun,
  isWorkspaceDeletionRun, piWebConfigDir, duplicate parsePiWebRuntimeResponse
- Remove unused types: WorkspacePanelFiles, WorkspacePanelHost,
  GetActiveSession, SaveAttachmentsResponse, QueryValues
- Drop now-unused re-exports/imports cascading from the above
- Add knip config + 'npm run knip' script for ongoing dead-code detection
2026-06-13 21:57:51 +02:00
Federico Jaramillo Martinez d17050e144 feat: add image attachments to the chat composer
Support pasting (Ctrl/Cmd+V), drag-and-drop, and an Attach button to add
PNG/JPEG/GIF/WebP images to a message, with thumbnail previews and
multi-image support.

Attachments are delivered to the session using pi's native ImageContent
format and are run through pi's own resizeImage so they match pi's inline
image limits exactly. Image content now renders inline in the transcript.

A per-message delivery toggle also lets users save attachments into the
workspace `.pi-web/paste` folder and reference them so the agent reads
them with its own tools.

The accepted HTTP upload size is configurable via PI_WEB_MAX_UPLOAD_BYTES
or the maxUploadBytes config value (default 64 MB).

Closes #13
2026-06-13 13:49:39 +02:00
Federico Jaramillo Martinez 3d68c78c83 test: make working-directory tests pass on Windows
Drive-qualify resolved paths in fixtures and assert against normalized cwds
so route tests match the values normalizeRequestCwd produces. Skip the
POSIX-shell TerminalService suite on native Windows, where the terminal
feature is unsupported.
2026-06-13 11:48:06 +02:00
Federico Jaramillo Martinez c0d12222a2 fix: list and open sessions across project directories
Sessions outside the server's launch directory were invisible and returned
404 on open, leaving the model picker empty. List without the SDK's
process-cwd filter and normalize working directories at the API boundary and
when reading stored session data, tolerating separator/normalization
differences (including Windows backslash vs forward slash). Requires Pi
coding agent SDK 0.78.0 or newer.
2026-06-13 11:40:47 +02:00
Federico Jaramillo Martinez 577594a622 fix: prevent sidebar action menus from being cropped
Use viewport-constrained positioning for sidebar action menus and keep the auth warning test isolated from local models.json config so pre-commit verification is deterministic.
2026-06-11 01:31:56 +02:00
Federico Jaramillo Martinez b99143f757 fix: preserve legacy session route lookups 2026-06-10 22:42:55 +02:00
Federico Jaramillo Martinez 71510444c4 Merge remote-tracking branch 'origin/main' into investigate/issue-12-session-dir
# Conflicts:
#	src/client/src/api.ts
#	src/client/src/api/clients.ts
#	src/client/src/api/federatedRouteContract.test.ts
#	src/server/sessions/piSessionService.ts
#	src/server/sessions/sessionRoutes.ts
2026-06-10 20:43:10 +02:00
Federico Jaramillo Martinez 824b7a0a2f fix: bind extensions for web sessions
Fixes #19
2026-06-10 20:32:25 +02:00
Federico Jaramillo Martinez 06052ea5ec fix: respect Pi session directories by cwd 2026-06-10 20:26:51 +02:00
Federico Jaramillo Martinez a3b5b722c9 feat: add safe session bulk cleanup actions 2026-06-08 17:20:00 +02:00
Federico Jaramillo Martinez 82ba2e0490 fix: validate prompt API payloads
Fixes #11
2026-06-05 11:09:15 +02:00
Federico Jaramillo Martinez 2abd1d9e19 fix: queue prompts during compaction 2026-05-28 14:15:52 +02:00
Federico Jaramillo Martinez 50f1ddc9c5 fix: refresh session message counts live 2026-05-26 08:52:43 +02:00
Federico Jaramillo Martinez 679008d132 fix: clear stale workspace activity indicators 2026-05-24 08:15:47 +02:00
Federico Jaramillo Martinez 428f7bb8c2 feat: archive session descendants 2026-05-23 00:05:03 +02:00
Federico Jaramillo Martinez 3409b0acba feat: name forked and cloned sessions 2026-05-22 15:36:24 +02:00
Federico Jaramillo Martinez 9e3d272731 feat: prefill forked session prompt draft 2026-05-21 22:56:03 +02:00
Federico Jaramillo Martinez 619840a398 fix: clear stale workspace activity 2026-05-19 21:41:58 +02:00
Federico Jaramillo Martinez ebe5639399 feat: show project and workspace activity indicators 2026-05-19 13:24:02 +02:00
Federico Jaramillo Martinez ee6f60fea1 feat: improve edit tool display in web UI 2026-05-18 23:05:19 +02:00
Federico Jaramillo Martinez 9c028a7353 feat: move archived sessions out of active storage 2026-05-18 21:58:40 +02:00
Federico Jaramillo Martinez c5c45195d7 Remove test type assertion suppressions 2026-05-17 08:58:46 +02:00
Federico Jaramillo Martinez 6a8f8b6ccf Add global web auth flows 2026-05-16 22:44:24 +02:00
Federico Jaramillo Martinez a0ca1de51e Disable forking active sessions 2026-05-12 15:55:19 +02:00
Federico Jaramillo Martinez d7dc18a6ec Page chat history at turn boundaries 2026-05-11 23:04:08 +02:00
Federico Jaramillo Martinez 80cf879e0f Add realtime terminal tab badges 2026-05-11 10:45:56 +02:00
Federico Jaramillo Martinez 6a201cab02 Add model and thinking controls 2026-05-10 20:53:30 +02:00
Federico Jaramillo Martinez 63ef03f8f6 Improve queued message handling 2026-05-10 00:46:47 +02:00
Federico Jaramillo Martinez 39ea4bfc15 Show session lineage and support detaching forks 2026-05-10 00:28:08 +02:00
Federico Jaramillo Martinez 8eb4dba7cd Align live assistant transcript with history 2026-05-09 21:23:12 +02:00