Commit Graph
166 Commits
Author SHA1 Message Date
Federico Jaramillo Martinez 0c04c9b19c refactor(test): use vi.waitFor instead of sleeps in promptQueue test 2026-07-17 21:54:29 +02:00
Federico Jaramillo Martinez 4ccd4f81fc Migrate piSessionService to ModelRuntime (slice 4)
Pass modelRuntime to createAgentSessionServices instead of authStorage +
modelRegistry; carry ModelRuntime on PiAgentSession; make modelRuntime a
required PiSessionService dependency (sessiond already injects auth.runtime).
Switch anthropicSubscriptionWarning to readStoredCredential, and rederive
model reads (availableModels/setModel/syncCurrentModelAuthWarning) via the
runtime (getAvailableSnapshot/getModel/hasConfiguredAuth). sessiond.ts and
piSessionService.ts now typecheck; only slice-5 test/support files remain.
2026-07-17 21:32:02 +02:00
Federico Jaramillo Martinez 1c3d6db109 Migrate oauthLoginFlowService to pi-ai AuthInteraction contract
Reimplement OAuthLoginFlowService against the pi-ai AuthInteraction
({ signal?, prompt(AuthPrompt), notify(AuthEvent) }) contract instead of
the removed OAuthLoginCallbacks shape, and drive login via
runtime.login(providerId, "oauth", interaction). start() now takes a
ModelRuntime instead of authStorage, resolving the authService.ts line-83
error. AuthPrompt text/secret/manual_code/select map onto the existing
web-UI prompt/select flow state; auth_url/device_code map onto the auth
field; info/progress append to progress. Per-prompt AuthPrompt.signal now
cancels just that pending request without ending the flow.

Slice 3 of the issue-62 authStorage migration relay.
2026-07-17 21:09:39 +02:00
Federico Jaramillo Martinez d09d7cc1ff Migrate authProviderOptions to ModelRuntime API
Rederive login/logout provider options from runtime.getProviders() +
listCredentials() + getProviderAuthStatus() instead of the removed
authStorage.getOAuthProviders()/list()/get() + getAll()/
getProviderDisplayName() surface (Pi 0.80.8+).

- Replace the AuthProviderModelRegistry structural interface with a
  runtime-shaped AuthProviderRuntime (getProviders/listCredentials/
  getProviderAuthStatus); a real ModelRuntime satisfies it.
- Make getLoginProviderOptions/getLogoutProviderOptions async to match
  the await call sites already in authService.ts.
- OAuth-capable providers = auth.oauth present; api-key providers =
  auth.apiKey present, preserving OAUTH_ONLY_PROVIDERS /
  isApiKeyLoginProvider logic. Display names from Provider.name.
- Update the test double to the new runtime shape.

Slice 2 of the authStorage migration relay. tsc: 31 -> 28 errors
(remaining are cross-slice: slices 3/4/5).
2026-07-17 20:58:46 +02:00
Federico Jaramillo Martinez e37148c193 Migrate authService to async ModelRuntime API (slice 1)
Move AuthService off the removed AuthStorage / ModelRegistry.create surface
onto the async ModelRuntime API:

- AuthService.create({ agentDir | runtime }) async factory wrapping
  ModelRuntime.create({ authPath, modelsPath }); createModelRuntimeForAgentDir
  replaces createModelRegistryForAgentDir.
- saveApiKey -> runtime.login(providerId, "api_key", nonInteractive) so the
  key is persisted through the runtime credential store.
- logoutProvider -> runtime.logout; refreshAuthState -> await runtime.refresh().
- startOAuthLogin now passes the runtime into OAuthLoginFlowService.start.
- authProviders/requireOAuthLoginProvider became async around getLogin/Logout
  provider options.
- sessiond.ts: async createRuntime, AuthService.create, pass modelRuntime to
  PiSessionService; sessionDaemonStartup awaits createRuntime.

Cross-slice: authProviderOptions (2), oauthLoginFlowService (3), and
piSessionService (4) still expose the old ModelRegistry shape, so the tree does
not fully typecheck yet. Session-daemon path changed -> manual sessiond restart
needed once the migration lands.
2026-07-17 20:53:42 +02:00
Federico Jaramillo Martinez aedcbf885e feat(sessions): surface live session startup warnings in the web UI
Show a pinned banner at the top of the session view with resource and
runtime diagnostics (skills, prompts, themes, extension load errors) plus
the Anthropic subscription-auth billing notice, recomputed live from the
current runtime so they stay accurate across browser reloads.

Warnings carry an optional dismiss capability; the Anthropic notice is
dismissable and durably suppressed through pi's own anthropicExtraUsage
warning setting. Also fixes the testing-guide skill frontmatter so it
loads.
2026-07-17 19:16:58 +02:00
Federico Jaramillo Martinez 2b17145291 feat(sessions): stream in-flight partial when joining a mid-turn session
Seed the in-flight partial assistant message (text, thinking, and
in-progress tool calls) when opening or reconnecting to a session that is
mid-stream, then continue streaming live deltas on top of it. Replaces the
blocking "Catching up..." placeholder and the end-of-turn transcript reload.

Server stamps every per-session UI event with a monotonic seq at the
SessionEventHub publish choke point and exposes
GET /sessions/:sessionId/stream-snapshot returning { seq, partial }. The
client fetches the snapshot on join, seeds the normalized partial into the
in-memory transcript (never the history cache), and applies buffered/live
events using the seq watermark for exactly-once delivery.

The snapshot is a progressive enhancement: a 404 from an older remote
pi-web or a not-yet-restarted session daemon falls back to an empty seed
(seq 0, drops nothing), so sessions still open and stream normally. The
stream-snapshot route is registered in the federation allowlist for
remote-machine proxying.
2026-07-17 14:49:56 +02:00
Federico Jaramillo Martinez 15d25d8c2e fix(subsessions): omit oversized completion output 2026-07-17 09:22:54 +02:00
Federico Jaramillo Martinez ca07e48c0a docs: clarify Pi-compatible agent profiles 2026-07-14 00:30:09 +02:00
Federico Jaramillo Martinez a1f749cdb6 feat: add server session queue clearing 2026-07-14 00:24:14 +02:00
Federico Jaramillo Martinez c0465c4a5c fix: delimit subsession output from guidance 2026-07-14 00:04:53 +02:00
Federico Jaramillo Martinez 0761e1509a fix: report remaining subsessions on completion 2026-07-13 23:41:20 +02:00
Federico Jaramillo Martinez adc2e297a4 fix: harden agent profile boundaries 2026-07-13 23:39:49 +02:00
Federico Jaramillo Martinez d5154dfb3a feat: add explicit tracked subsession yielding 2026-07-13 22:45:07 +02:00
Federico Jaramillo Martinez a1a019e7b1 chore: merge origin/main 2026-07-13 22:36:36 +02:00
Federico Jaramillo Martinez cfa9f5a2fa Merge remote-tracking branch 'origin/main' into pr-36-generic-agent-config
# Conflicts:
#	docs/config.html
#	docs/config.md
#	src/cli.test.ts
#	src/cli.ts
#	src/client/src/components/settings/SettingsSessiondPanel.ts
#	src/client/src/components/settings/settingsConfigDraft.test.ts
#	src/client/src/components/settings/settingsConfigDraft.ts
#	src/server/app.test.ts
#	src/server/app.ts
#	src/server/configRoutes.test.ts
#	src/server/configRoutes.ts
#	src/server/piWebPluginService.test.ts
#	src/server/piWebPluginService.ts
#	src/server/piWebStatus.test.ts
#	src/server/piWebStatus.ts
#	src/server/piWebStatusCache.ts
#	src/server/sessions/authService.test.ts
#	src/server/sessions/piSessionService.ts
#	src/server/sessions/sessionRoutes.test.ts
2026-07-13 20:30:08 +02:00
Federico Jaramillo Martinez 050b053d23 test(sessiond): harden archive migration safety 2026-07-13 14:45:14 +02:00
Federico Jaramillo Martinez 7878cbe57b fix(sessions): add safe legacy archive migration core 2026-07-13 14:26:32 +02:00
Federico Jaramillo Martinez ec0ca13120 fix: store session archives under PI_WEB_DATA_DIR 2026-07-12 22:52:59 +02:00
Federico Jaramillo Martinez 338faf4b81 perf: speed up chat loading and resume 2026-07-12 09:22:19 +02:00
Federico Jaramillo Martinez 6fbeed345e fix(sessions): clarify subsession join guidance 2026-07-11 22:03:31 +02:00
Federico Jaramillo Martinez 52925c1405 fix(sessions): restrict delegation tools in tracked children 2026-07-11 15:56:20 +02:00
Federico Jaramillo Martinez a660ba8ef8 fix(sessions): clarify subsession waiting behavior 2026-07-11 09:41:03 +02:00
Federico Jaramillo Martinez 410242aae8 Merge branch 'test-suite-audit-followup'
# Conflicts:
#	src/server/sessions/piSessionService.test.ts
2026-07-10 22:44:13 +02:00
Federico Jaramillo Martinez 32907bba5f chore(deps): update runtime and development packages 2026-07-10 22:10:40 +02:00
Federico Jaramillo Martinez 6b61596ebd test(sessions): cover attachment filename safety 2026-07-05 00:49:45 +02:00
Federico Jaramillo Martinez 1f26ae3935 test(sessions): cover archive lookup edge cases 2026-07-04 23:58:32 +02:00
Federico Jaramillo Martinez 386386d2b5 test(sessions): split pi session service specs 2026-07-04 23:53:58 +02:00
Federico Jaramillo Martinez 73b169a768 test: close selected coverage gaps 2026-07-03 21:40:36 +02:00
Federico Jaramillo Martinez 10efb7f221 fix(sessions): name relay handoffs deterministically 2026-07-03 10:51:45 +02:00
Federico Jaramillo Martinez 1564f1cfc5 test: audit existing suite 2026-07-03 09:48:20 +02:00
Federico Jaramillo Martinez 2665d1e4bc fix: handle session start persistence 2026-07-02 18:46:44 +02:00
Federico Jaramillo Martinez ad74ea4da7 refactor: generate session names via agent.streamFn instead of pi-ai compat
Rewrite sessionNameGenerator.ts to consume a StreamFn-shaped dependency
(sourced from PiAgentSession.agent.streamFn, wired in leg B) instead of
ModelRegistry plus a dynamic @earendil-works/pi-ai/compat import.

streamFn resolves auth/headers/retry internally, so the explicit
modelRegistry.getApiKeyAndHeaders(model) call and apiKey/headers stream
options are no longer needed.

Deletes now-dead compat-loading machinery: getPiAiProviderRegistryModule,
loadPiAiProviderRegistryModule, importOptionalPiAiModule,
isModuleUnavailableError, hasGetApiProvider, PI_AI_COMPAT_MODULE,
ModuleImporter, SessionNameApiProvider, PiAiProviderRegistryModule, and
the module-level provider registry cache.

Updates the maybeGenerateSessionName call site in piSessionService.ts to
pass session.agent.streamFn instead of this.modelRegistry, and updates
both test files: sessionNameGenerator.test.ts gains coverage for the new
streamFn-driven generateShortSessionName signature (success and error
paths), and piSessionService.test.ts gains an end-to-end test proving a
first prompt generates a session name through the wired agent.streamFn
fake.

sessionNameGenerator.ts no longer imports @earendil-works/pi-ai/compat
or references getApiProvider anywhere.
2026-07-02 11:42:30 +02:00
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 75e2377756 feat: generalize agent runtime config 2026-06-28 16:36:40 +02:00
Jeff Scott Ward 84a485d62e feat: add OMP runtime support 2026-06-26 12:49:58 -04:00
Jeff Scott Ward 4605a4f1d8 refactor: add session route service seam 2026-06-26 12:32:13 -04: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