---
title: Service Capability Tiers
description: 准确选择当前 Provider 或 Autonomous Service 层级，不夸大语言支持。
---

Lenso 明确区分两个进程外 Service Capability Tiers。它们解决不同的所有权
问题，并使用不同运行时合约。

## Service Capability Tiers（服务能力层级）

| 层级 | 合约 | 运行时持有者 | 当前语言 | 适用场景 |
| --- | --- | --- | --- | --- |
| Provider tier | `lenso.service.v1` Metadata；`lenso.provider.v1` Runtime | Host | Rust 与 TypeScript | Service 进程提供精确 Module Release，Host 继续持有 Policy、Queue、Retry、Outbox 分发与 Runtime Story。 |
| Autonomous Service tier | `lenso.service.v2` | Service | Rust | 稳定业务边界必须持有自己的 Workload、业务运行时、service-owned storage、运维与发布节奏。 |

层级描述 Service 职责，不会替换 Module 身份。Support Ticket Module 可以从
Linked 交付迁移到 Provider 交付，之后再迁移到 Autonomous Service，同时保持
业务合约名称不变。

## Provider tier

Provider 向 Host 导出一个或多个 Module。Host 对调用进行认证、应用 Capability
Policy、调度 Runtime Function、持有 Retry 与 Queue、分发 Outbox events，并记录
Runtime Story。Provider 实现声明的 Module Operation，但不会成为另一个 Host
运行时。

该层级支持 Rust 和 `@lenso/service-kit`。兼容性 `lenso.service.v1` Manifest
描述 Service 打包与本地进程启动，不是 Runtime Module Discovery 或 Digest
Authority。`/lenso/provider/v1` 上在线的 `lenso.provider.v1` Descriptor 标识一份
精确 Service Release 及其导出的 `lenso.module-release.v1` Release，并提供锁定的
Invocation、Recovery 与 Acknowledgement 边界。

激活 Provider Export 前，Host 会校验 Service Release、Module Release、Manifest、
Export 与 Contract Digest。生成的 TypeScript Service Kit 与当前 CLI Scaffold
提供该精确 Provider Runtime，而 Queue、Retry、Effect 与 Runtime Story 仍由 Host
持有。

当团队需要独立实现进程，但应用仍持有协调职责时，Provider 通常是合适的第一
进程边界。

## Autonomous Service tier

Rust `lenso-autonomous-service` 运行时校验 `lenso.service.v2`，并启动 Service
持有的运行时图。当前 Rust framework capabilities 包括：

- 从版本化合约生成 direct HTTP/gRPC Client 与 Server；
- 使用 Service 自有 Inbox 与事务 Outbox 处理 business events；
- 版本化 durable workflows、Timer、Retry、Child Workflow 与 Compensation；
- 使用 SPIFFE 生产 Adapter 和确定性本地身份的 Workload identity；
- 为 Actor、Tenant、Deadline、Causation 与 Idempotency 传播提供签名
  delegated context；
- service-owned storage、Migration、Health、Operation Record 与本地 Story
  Segment。

业务流量通过声明合约在 Service 之间直连，不经过 Console，也不经过 Host
Provider Proxy。System Plane 不可用不会停止 Service 本地执行。

## 明确的语言支持

**TypeScript does not provide Autonomous Service parity.**

`@lenso/service-kit` 当前只支持 Provider tier。它没有实现
`lenso.service.v2` 运行时、Service Store、Durable Workflow 运行时、Workload
identity、delegated context 校验、direct contract 运行时或 Service 自有
System Plane Operation。需要这些 Autonomous Service 能力时，请使用 Rust。

这是当前支持边界，不是路线图承诺。TypeScript Provider 即使运行在独立进程，
也不能因此标记为 Autonomous。

## 只为具体原因迁移边界

至少存在一个真实边界时，才选择 Autonomous Service tier：

- 独立团队或发布节奏；
- 隔离的数据权限；
- 独立信任边界；
- 独立运维的可靠性或扩缩容；
- 必须脱离 Host 持续运行的运行时行为。

否则保持 Linked Module，或使用 Provider tier。两者都保留清晰的后续迁移路径，
同时避免过早承担 Autonomous 运维成本。

混合拓扑组合参见 [Service System Plane](/docs/zh/service-system-plane)；Support
Desk 公开生命周期参见[示例](/docs/zh/examples)。
