refactor(client): rename currentProvide to currentProvideInfo

This commit is contained in:
imccyu
2026-07-28 11:09:55 +08:00
parent 71529aa7d2
commit b7f3cd3d78
9 changed files with 35 additions and 35 deletions
@@ -93,7 +93,7 @@ async function bench() {
binding: (id: SessionId) => ({ sessionId: id, session: sessionFake, ctx: mint(id) }),
scope: (id: SessionId) => mint(id),
provideInfo: () => undefined,
currentProvide: { getSnapshot: () => absentInfo, subscribe: () => () => {} },
currentProvideInfo: { getSnapshot: () => absentInfo, subscribe: () => () => {} },
provide: (descriptor: TestProvider) => { providers.push(descriptor); return () => {} },
scopeOf,
sessionOf: (actx: Context) => (scopeOf(actx) === undefined ? undefined : sessionFake),
@@ -38,7 +38,7 @@ async function bench() {
binding: vi.fn(),
scope: () => undefined,
provideInfo: () => undefined,
currentProvide: { getSnapshot: () => absentInfo, subscribe: () => () => {} },
currentProvideInfo: { getSnapshot: () => absentInfo, subscribe: () => () => {} },
provide: vi.fn(() => () => {}),
create: vi.fn(),
open: vi.fn(),
@@ -87,7 +87,7 @@ async function bench(snapshot: ConversationSnapshot) {
// Provide-channel contributions land in this bundle the way the runtime
// materializes them; the renderer host serves it through provideInfo.
const provided: { hooks: Record<string, unknown>; props: Record<string, unknown> } = { hooks: {}, props: {} }
// Identity-stable currentProvide snapshot (uSES getSnapshot contract),
// Identity-stable currentProvideInfo snapshot (uSES getSnapshot contract),
// materialized on first render after the provide contributions landed.
let infoCell: { sessionId: SessionId; hooks: Record<string, unknown>; props: Record<string, unknown> } | undefined
const sessionsFake = {
@@ -106,7 +106,7 @@ async function bench(snapshot: ConversationSnapshot) {
provideInfo: (id: string) => (id === SID
? { sessionId: SID, hooks: { session, ...provided.hooks }, props: provided.props }
: undefined),
currentProvide: {
currentProvideInfo: {
getSnapshot: () => infoCell ??= { sessionId: SID, hooks: { session, ...provided.hooks }, props: provided.props },
subscribe: () => () => {},
},
@@ -111,7 +111,7 @@ async function bench(nodes: ToolResultNode[]) {
binding: bindingOf,
scope: () => actxFake,
provideInfo,
currentProvide: {
currentProvideInfo: {
getSnapshot: () => provideInfo(SID),
subscribe: () => () => {},
},
@@ -255,7 +255,7 @@ describe('registrant load-order seam', () => {
binding: () => undefined,
scope: () => undefined,
provideInfo: () => undefined,
currentProvide: {
currentProvideInfo: {
getSnapshot: () => ABSENT_INFO,
subscribe: () => () => {},
},
@@ -26,7 +26,7 @@ function bench(): Bench {
ids: [], byId: {}, current: undefined, phase: 'ready',
}),
provideInfo: () => undefined,
currentProvide: {
currentProvideInfo: {
getSnapshot: () => ABSENT_INFO,
subscribe: () => () => {},
},