refactor(api): expose traced remote namespaces
This commit is contained in:
@@ -18,7 +18,12 @@
|
||||
import { Context as CordisContext } from 'cordis'
|
||||
import type { Context, Fiber } from 'cordis'
|
||||
import type { SessionId } from '@deepseek-ai/dsh-client-connection/client'
|
||||
import type { TypeRTRemoteContextApi } from '@deepseek-ai/dsh-type-meta'
|
||||
import type { TypeRTClientRemote, TypeRTRemoteContextApi } from '@deepseek-ai/dsh-type-meta'
|
||||
|
||||
/** Client Cordis Context carrying one Agent identity and its scoped Remote namespaces. */
|
||||
export type AgentContext = Omit<Context, 'remote'> & {
|
||||
readonly remote: TypeRTClientRemote & TypeRTRemoteContextApi<'agent'>
|
||||
}
|
||||
|
||||
/** Context tag written by {@link createScope}. */
|
||||
const kScope = Symbol('dsh.client.scope')
|
||||
@@ -30,7 +35,7 @@ export interface AgentScopeHandle {
|
||||
* through it (passing it as the dispatch subject routes to this agent's
|
||||
* tagged listeners plus every untagged one).
|
||||
*/
|
||||
ctx: Context & TypeRTRemoteContextApi<'agent'>
|
||||
ctx: AgentContext
|
||||
/** Backing fiber (dispose tears down every scope-owned registration). */
|
||||
fiber: Fiber
|
||||
}
|
||||
@@ -55,7 +60,7 @@ export function createScope(ctx: Context, key: SessionId): AgentScopeHandle {
|
||||
const tag = scopeOf(listenerCtx)
|
||||
return tag === undefined || tag === key
|
||||
},
|
||||
}) as Context & TypeRTRemoteContextApi<'agent'>
|
||||
}) as AgentContext
|
||||
return {
|
||||
fiber,
|
||||
ctx: scoped,
|
||||
|
||||
@@ -11,8 +11,8 @@ import type { Context } from 'cordis'
|
||||
import type {
|
||||
RpcResult, SessionId, SubagentAddress,
|
||||
} from '@deepseek-ai/dsh-client-connection/client'
|
||||
import type { TypeRTRemoteContextApi } from '@deepseek-ai/dsh-type-meta'
|
||||
import type { HostObservable, SessionMaybeProvideInfo } from '@deepseek-ai/dsh-client-ui-slots'
|
||||
import type { AgentContext } from '../agents/scope.ts'
|
||||
import type { SessionSearchResultItem } from '../sessions/manager.ts'
|
||||
import type {
|
||||
SessionBinding, SessionListState, SessionProvideDescriptor,
|
||||
@@ -20,8 +20,7 @@ import type {
|
||||
import type { SessionFace } from './session.ts'
|
||||
import type { ObservableSnapshot } from './store.ts'
|
||||
|
||||
/** Client Cordis Context carrying one Agent identity and its generated Remote namespaces. */
|
||||
export type AgentContext = Context & TypeRTRemoteContextApi<'agent'>
|
||||
export type { AgentContext } from '../agents/scope.ts'
|
||||
|
||||
/** The sessions-service face injected as `ctx.sessions`. */
|
||||
export interface ISessions {
|
||||
|
||||
@@ -179,8 +179,8 @@ declare module 'cordis' {
|
||||
}
|
||||
}
|
||||
|
||||
/** Required services: the typed Remote API, wire handle, and Client TypeRT registry. */
|
||||
export const inject = ['api', 'connection', 'typert']
|
||||
/** Required services: the Remote root and Goal namespace, wire handle, and Client TypeRT registry. */
|
||||
export const inject = ['remote', 'remote.goals', 'connection', 'typert']
|
||||
|
||||
/** Mounts the browser runtime services and connection stream.
|
||||
* @param ctx - Client Cordis context.
|
||||
|
||||
@@ -38,7 +38,8 @@ async function mount(): Promise<Bench> {
|
||||
},
|
||||
}
|
||||
ctx.reflect.provide('connection', handle)
|
||||
ctx.reflect.provide('api', {})
|
||||
ctx.reflect.provide('remote', {})
|
||||
ctx.reflect.provide('remote.goals', {})
|
||||
await ctx.plugin(RuntimeClient).await()
|
||||
return bench
|
||||
}
|
||||
|
||||
@@ -32,7 +32,8 @@ async function mount(): Promise<Bench> {
|
||||
},
|
||||
}
|
||||
ctx.reflect.provide('connection', handle)
|
||||
ctx.reflect.provide('api', {})
|
||||
ctx.reflect.provide('remote', {})
|
||||
ctx.reflect.provide('remote.goals', {})
|
||||
await ctx.plugin(RuntimeClient).await()
|
||||
return bench
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user