refactor(api): expose traced remote namespaces
This commit is contained in:
@@ -593,8 +593,8 @@ const created: Promise<CreateGoalResult> = create('agent-1', { title: 'ship' })
|
||||
const cancellable: Promise<CreateGoalResult> = create('agent-1', { title: 'ship' }, new AbortController().signal)
|
||||
const createdScoped: Promise<CreateGoalResult> = createScoped({ title: 'ship' })
|
||||
const renamed: Promise<RenameGoalResult> = rename({ ref: 'goal-1', title: 'land' })
|
||||
declare const ctx: { api: TypeRTRemoteNamespaceMap }
|
||||
const navigated: Promise<CreateGoalResult> = ctx.api.goals.create('agent-1', { title: 'navigate' })
|
||||
declare const ctx: { remote: TypeRTRemoteNamespaceMap }
|
||||
const navigated: Promise<CreateGoalResult> = ctx.remote.goals.create('agent-1', { title: 'navigate' })
|
||||
void contribution
|
||||
void created
|
||||
void cancellable
|
||||
@@ -643,7 +643,7 @@ void navigated
|
||||
readFile: path => ts.sys.readFile(path),
|
||||
realpath: path => ts.sys.realpath?.(path) ?? path,
|
||||
})
|
||||
const navigation = 'ctx.api.goals.create'
|
||||
const navigation = 'ctx.remote.goals.create'
|
||||
const position = consumerSource.indexOf(navigation) + navigation.lastIndexOf('create') + 1
|
||||
const definitions = languageService.getDefinitionAtPosition(consumerPath, position)
|
||||
const generatedDefinition = definitions?.find(candidate => candidate.fileName === declarationPath)
|
||||
@@ -672,8 +672,8 @@ function assertRemoteConsumerWithoutImportHasNoNamespace(consumerRoot: string):
|
||||
const consumerPath = join(consumerRoot, 'consumer-without-remote.ts')
|
||||
writeFileSync(consumerPath, `
|
||||
import type { TypeRTRemoteNamespaceMap } from '@deepseek-ai/dsh-type-meta'
|
||||
declare const ctx: { api: TypeRTRemoteNamespaceMap }
|
||||
ctx.api.goals.create('agent-1', { title: 'must not compile' })
|
||||
declare const ctx: { remote: TypeRTRemoteNamespaceMap }
|
||||
ctx.remote.goals.create('agent-1', { title: 'must not compile' })
|
||||
`)
|
||||
const configPath = join(consumerRoot, 'tsconfig.consumer-without-remote.json')
|
||||
writeFileSync(configPath, JSON.stringify({
|
||||
|
||||
@@ -41,7 +41,7 @@ export type {
|
||||
InvocationDescriptor,
|
||||
InvocationParameterDescriptor,
|
||||
InvocationSourceLocation,
|
||||
TypeRTClientApi,
|
||||
TypeRTClientRemote,
|
||||
TypeRTClientContextBinder,
|
||||
TypeRTCodec,
|
||||
TypeRTContext,
|
||||
|
||||
@@ -77,7 +77,7 @@ export type TypeRTRemoteContextApi<ContextKey extends string> = {
|
||||
TypeRTRemoteContextNamespace<Namespace, ContextKey>
|
||||
}
|
||||
|
||||
/** Merge-extensible direct namespace surface generated for Client API services. */
|
||||
/** Merge-extensible direct namespace surface generated for Client Remote services. */
|
||||
export interface TypeRTRemoteNamespaceMap {}
|
||||
|
||||
/** Awaitable disposer returned by Cordis-owned TypeRT registrations. */
|
||||
@@ -176,14 +176,14 @@ export interface TypeRTRemoteContribution {
|
||||
readonly descriptors: readonly InvocationDescriptor[]
|
||||
}
|
||||
|
||||
/** Client API capability implemented by the Gateway and consumed by Remote assemblies. */
|
||||
export interface TypeRTClientApi extends TypeRTRemoteNamespaceMap {
|
||||
/** Client Remote capability implemented by the Gateway and consumed by Remote assemblies. */
|
||||
export interface TypeRTClientRemote extends TypeRTRemoteNamespaceMap {
|
||||
/**
|
||||
* Mount one generated Host-for-Client contribution in the caller's fiber.
|
||||
* @param contribution - explicitly selected Remote package artifact.
|
||||
* @returns disposer withdrawing descriptors and concrete methods together.
|
||||
* @returns disposer after namespace services and concrete methods are ready.
|
||||
*/
|
||||
mount(contribution: TypeRTRemoteContribution): TypeRTDisposer
|
||||
$mount(contribution: TypeRTRemoteContribution): Promise<TypeRTDisposer>
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user