refactor(api): expose traced remote namespaces

This commit is contained in:
imccyu
2026-08-07 21:47:18 +08:00
parent 146097368b
commit d6ffd87c5f
38 files changed
+566 -492

No files matched your search

+2 -2
View File
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/core-data-structures/typert.md
typert.md: a61ed8587833e03fd5c1246311e62a6ffaeb3bd0
typert.zh.md: 18c24018f4abd644cf35185c2bd06b6980195481
typert.md: c70e50e2fea8455eb75dfdf8c309f659ab9cb2f9
typert.zh.md: 2cd1636d4cc8dbcfa009073b4a8e1dcc8d5897e4
+8 -8
View File
@@ -126,10 +126,10 @@ interface TypeRTService {
}
```
Generated consumer declarations merge direct namespaces into the map inherited by `TypeRTClientApi`.
Generated consumer declarations merge direct namespaces into the map inherited by `TypeRTClientRemote`.
```ts type-equiv
/** Merge-extensible direct namespace surface generated for Client API services. */
/** Merge-extensible direct namespace surface generated for Client Remote services. */
interface TypeRTRemoteNamespaceMap {}
```
@@ -186,18 +186,18 @@ interface TypertGateway {
}
```
## Consumer API
## Consumer Remote
`ctx.api` exposes only namespaces contributed by imported `/remote` artifacts. Mounting installs the generated descriptors and concrete root/scoped methods as one fiber-owned operation; no JavaScript Proxy or Host Service type enters the consumer.
`ctx.remote` exposes only namespaces contributed by imported `/remote` artifacts. `$mount()` installs generated descriptors and concrete methods as one fiber-owned operation. Each namespace is a traced `remote.<namespace>` Cordis child Service whose lifetime spans its mounted methods; no JavaScript Proxy or Host business Service type enters the consumer.
```ts type-equiv
/** Client API capability implemented by the Gateway and consumed by Remote assemblies. */
interface TypeRTClientApi extends TypeRTRemoteNamespaceMap {
/** Client Remote capability implemented by the Gateway and consumed by Remote assemblies. */
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>
}
```
+8 -8
View File
@@ -126,10 +126,10 @@ interface TypeRTService {
}
```
生成的消费方声明会把 direct namespace 合并到 `TypeRTClientApi` 继承的 map 中。
生成的消费方声明会把 direct namespace 合并到 `TypeRTClientRemote` 继承的 map 中。
```ts type-equiv
/** Merge-extensible direct namespace surface generated for Client API services. */
/** Merge-extensible direct namespace surface generated for Client Remote services. */
interface TypeRTRemoteNamespaceMap {}
```
@@ -186,18 +186,18 @@ interface TypertGateway {
}
```
## 消费方 API
## 消费方 Remote
`ctx.api` 只暴露由已导入 `/remote` 产物贡献的 namespace。挂载会把生成的 descriptor 与具体的 root/scoped 方法作为一项由 fiber 持有的操作统一注册;JavaScript Proxy 与 Host 服务类型都不会进入消费方。
`ctx.remote` 只暴露由已导入 `/remote` 产物贡献的 namespace。`$mount()` 会把生成的 descriptor 与具体方法作为一项由 fiber 持有的操作统一注册。每个 namespace 都是可追踪的 `remote.<namespace>` Cordis 子 Service,其生命周期覆盖已挂载的方法JavaScript Proxy 与 Host 业务 Service 类型都不会进入消费方。
```ts type-equiv
/** Client API capability implemented by the Gateway and consumed by Remote assemblies. */
interface TypeRTClientApi extends TypeRTRemoteNamespaceMap {
/** Client Remote capability implemented by the Gateway and consumed by Remote assemblies. */
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>
}
```