feat(invariants): add package-owned service seam
This commit is contained in:
@@ -54,6 +54,10 @@
|
||||
"text": "ctx.fs",
|
||||
"link": "/zh-CN/api/harness/fs"
|
||||
},
|
||||
{
|
||||
"text": "ctx.invariants",
|
||||
"link": "/zh-CN/api/harness/invariants"
|
||||
},
|
||||
{
|
||||
"text": "ctx.llm",
|
||||
"link": "/zh-CN/api/harness/llm"
|
||||
|
||||
32
website/zh-CN/api/harness/invariants.md
Normal file
32
website/zh-CN/api/harness/invariants.md
Normal file
@@ -0,0 +1,32 @@
|
||||
<!-- Generated by scripts/gen-website-api.ts — do not edit by hand. Run `pnpm run gen-website-api` to regenerate. -->
|
||||
|
||||
# ctx.invariants
|
||||
|
||||
`InvariantService` — provided by `@deepseek-ai/dsh-invariants`.
|
||||
|
||||
Package-owned invariant registry with global and regex-based selection.
|
||||
|
||||
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/support/invariants/src/index.ts#L94)
|
||||
|
||||
### ctx.invariants.register(packageName, installer)
|
||||
|
||||
```ts website-api
|
||||
/**
|
||||
* Register one package's invariant installer. The package name is reserved
|
||||
* even when filtering disables its checks. Enabled installers run in a child
|
||||
* fiber; failure disposes that fiber and releases the reservation.
|
||||
* @param packageName - full npm package name that owns the contribution.
|
||||
* @param installer - synchronous listener installer for the child context.
|
||||
* @returns an effect-scoped disposer for the registration.
|
||||
*/
|
||||
register(packageName: string, installer: InvariantInstaller): () => void
|
||||
```
|
||||
|
||||
Register one package's invariant installer. The package name is reserved even when filtering disables its checks. Enabled installers run in a child fiber; failure disposes that fiber and releases the reservation.
|
||||
|
||||
- `packageName` — full npm package name that owns the contribution.
|
||||
- `installer` — synchronous listener installer for the child context.
|
||||
|
||||
**Returns** an effect-scoped disposer for the registration.
|
||||
|
||||
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/support/invariants/src/index.ts#L136)
|
||||
Reference in New Issue
Block a user