refactor(web): consume owner remote events directly

This commit is contained in:
imccyu
2026-08-11 16:50:03 +08:00
parent 80f1a064f5
commit e0bbe42242
75 changed files with 353 additions and 350 deletions

View File

@@ -88,7 +88,5 @@ export const hostFrameSchema = z.discriminatedUnion('type', [
// structural contract belongs to the owner package's cordis `Events`
// declaration — the host validated JSON-safety before forwarding.
z.object({ type: z.literal('host/remote-event'), event: z.string().min(1), args: z.array(z.unknown()) }),
z.object({ type: z.literal('host/session-preset-changed'), sessionId: sessionIdSchema, agentPreset: z.string() }),
z.object({ type: z.literal('host/models-changed') }),
z.object({ type: z.literal('stream/error'), error: rpcErrorSchema }),
]) as unknown as z.ZodType<HostFrame>

View File

@@ -150,23 +150,4 @@ export type HostFrame =
* per-event frame variant.
*/
| { type: 'host/remote-event'; event: string; args: JsonValue[] }
/**
* One blank session was recomposed onto another agent preset (the logged
* `agent-preset/selected` commit point, read off the session stream). The
* registry-wide `commands/change` forwarded above cannot stand in for it:
* recomposing re-parents that agent's scope without registering anything,
* so a preset already mounted for another session produces no registry
* change at all. Clients refetch the catalogs this session's composition
* decides (`command.list`, `skill.list`) for this sessionId alone, and fold
* the preset id into their session row — the RPC echo reaches only the
* client that issued the switch, so the row is where every other one learns
* it.
*/
| { type: 'host/session-preset-changed'; sessionId: SessionId; agentPreset: string }
/**
* The provider topology changed (`llm/adapters-updated` passthrough):
* routes registered or dropped, or the configurable directory moved. Pure
* invalidation: clients refetch `llm.providers`/`llm.models`/`session.models`.
*/
| { type: 'host/models-changed' }
| { type: 'stream/error'; error: RpcError }

View File

@@ -4,7 +4,8 @@
* (which providers CAN be configured, and where their settings live) with the
* live route registry; `llm.models` is the session-independent model catalog
* (the same groups as `session.models`, without a per-session selection).
* Both invalidate on the `host/models-changed` frame.
* Clients invalidate from the forwarded `llm/adapters-updated` and
* `settings/document-updated` owner events.
*/
import type { RpcRequest, RpcResponse } from './rpc.ts'