feat(sessions): allow global-extension providers, require Pi 0.81

Relaxes the provider policy from 'global config only' to 'global sources':
providers registered by agent-dir (global) extensions are learned once at
daemon startup and allowed on the shared runtime; project-extension
registrations are still rejected with a session warning. Global extensions
load identically for every session, so their providers are daemon-consistent
and cannot leak project state (#76).

- Shim now allows allowlisted ids through and also covers Pi 0.81's native
  provider path (registerNativeProvider), closing a bypass.
- Startup learning step loads only global extensions against a scratch cwd
  and diffs the runtime's registered provider ids.
- Bumps @earendil-works/* dev/peer ranges to >=0.81.1 <0.82; adapts to the
  Agent.streamFn -> streamFunction rename.
- Docs, changeset, unit and acceptance tests updated (global-extension allow
  path, late re-registration a la pi-tensorx, native provider rule).
This commit is contained in:
Federico Jaramillo Martinez
2026-07-22 17:13:57 +02:00
parent 242911331a
commit c2bf595999
12 changed files with 360 additions and 197 deletions
+7 -7
View File
@@ -346,13 +346,13 @@ export interface PiAgentSession {
setSessionName(name: string): void;
/**
* Narrow re-expression of `AgentSession.agent` (an `@earendil-works/pi-agent-core`
* `Agent`), exposing only `streamFn` — the resolved-auth/headers/retry "call this
* model" function pi's own compaction/branch-summarization code uses internally.
* Lets callers (e.g. session title generation) issue one-off model calls without
* depending on pi-ai's deprecated `/compat` provider registry or leaking the full
* `Agent`/`AgentSession` surface.
* `Agent`), exposing only `streamFunction` — the resolved-auth/headers/retry "call
* this model" function pi's own compaction/branch-summarization code uses
* internally. Lets callers (e.g. session title generation) issue one-off model
* calls without depending on pi-ai's deprecated `/compat` provider registry or
* leaking the full `Agent`/`AgentSession` surface.
*/
agent: { streamFn: StreamFn };
agent: { streamFunction: StreamFn };
}
export interface PiSessionRuntime {
@@ -2761,7 +2761,7 @@ export class PiSessionService implements SessionRouteService {
const model = session.model;
if (model === undefined) return;
void generateShortSessionName(session.agent.streamFn, model, firstMessage).then((name) => {
void generateShortSessionName(session.agent.streamFunction, model, firstMessage).then((name) => {
this.applyGeneratedSessionName(session, name ?? fallbackSessionName(firstMessage));
}).catch(() => {
this.applyGeneratedSessionName(session, fallbackSessionName(firstMessage));