mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
Rebuild of the region machinery (PR3) on the post-#904 Typert projection: renderPageRegion/renderInheritedPage live in dsh-typert-generator beside the projection; scripts/gen-cordis-catalog.ts owns the curated SERVICE_PAGE / EVENT_SCOPE_PAGE / SERVICE_WALK_EXEMPTIONS / LINK_MAP partition (fail-loud in both directions, with the independent Context-merge scan backstopping the projection's blind spot), spliceRegion, and the guarded pair auto-record. docs/cordis-catalog/ is deleted: the flat events/services catalogs dissolve into per-page regions and docs/cordis-catalog/core moves to docs/cordis-api/ with the inherited tier as its own generated page. The partition absorbs the post-regrouping surface: ctx.typert → invariants.md, ctx.directoryPicker → workspace.md, skills/* events → skills.md, and the four launcher-provided tui accessor values join the named exemptions.
208 lines
7.2 KiB
Markdown
208 lines
7.2 KiB
Markdown
<!-- Generated by scripts/gen-cordis-catalog.ts — do not edit by hand.
|
|
Run `pnpm run gen-cordis-catalog` to regenerate. -->
|
|
|
|
# Events
|
|
|
|
The event-dispatch API mixed into every context. Harness event declarations and their dispatch modes are generated into each owning [subsystem page](../subsystems/core.md).
|
|
|
|
### ctx.parallel(name, ...args)
|
|
|
|
```ts cordis-catalog
|
|
/**
|
|
* Dispatch an event, running all listeners concurrently.
|
|
*
|
|
* @param name — the event name.
|
|
* @param args — arguments passed to every listener.
|
|
* @returns a promise resolving once every listener has settled.
|
|
*/
|
|
parallel<K extends keyof Events>(name: K, ...args: Parameters<Events[K]>): Promise<void>
|
|
parallel<K extends keyof Events>(thisArg: NoInfer<ThisType<Events[K]>>, name: K, ...args: Parameters<Events[K]>): Promise<void>
|
|
```
|
|
|
|
Dispatch an event, running all listeners concurrently.
|
|
|
|
- `name` — the event name.
|
|
- `args` — arguments passed to every listener.
|
|
|
|
**Returns** a promise resolving once every listener has settled.
|
|
|
|
[Source](../../vendor/cordis/src/events.ts#L44)
|
|
|
|
### ctx.emit(name, ...args)
|
|
|
|
```ts cordis-catalog
|
|
/**
|
|
* Dispatch an event synchronously, ignoring listener return values.
|
|
*
|
|
* @param name — the event name.
|
|
* @param args — arguments passed to every listener.
|
|
*/
|
|
emit<K extends keyof Events>(name: K, ...args: Parameters<Events[K]>): void
|
|
emit<K extends keyof Events>(thisArg: NoInfer<ThisType<Events[K]>>, name: K, ...args: Parameters<Events[K]>): void
|
|
```
|
|
|
|
Dispatch an event synchronously, ignoring listener return values.
|
|
|
|
- `name` — the event name.
|
|
- `args` — arguments passed to every listener.
|
|
|
|
[Source](../../vendor/cordis/src/events.ts#L53)
|
|
|
|
### ctx.serial(name, ...args)
|
|
|
|
```ts cordis-catalog
|
|
/**
|
|
* Dispatch an event, awaiting listeners in order until one bails.
|
|
*
|
|
* @param name — the event name.
|
|
* @param args — arguments passed to each listener.
|
|
* @returns the first bail value (non-null, non-false, non-undefined), if any.
|
|
*/
|
|
serial<K extends keyof Events>(name: K, ...args: Parameters<Events[K]>): Promisify<ReturnType<Events[K]>>
|
|
serial<K extends keyof Events>(thisArg: NoInfer<ThisType<Events[K]>>, name: K, ...args: Parameters<Events[K]>): Promisify<ReturnType<Events[K]>>
|
|
```
|
|
|
|
Dispatch an event, awaiting listeners in order until one bails.
|
|
|
|
- `name` — the event name.
|
|
- `args` — arguments passed to each listener.
|
|
|
|
**Returns** the first bail value (non-null, non-false, non-undefined), if any.
|
|
|
|
[Source](../../vendor/cordis/src/events.ts#L63)
|
|
|
|
### ctx.bail(name, ...args)
|
|
|
|
```ts cordis-catalog
|
|
/**
|
|
* Dispatch an event, calling listeners in order until one bails.
|
|
*
|
|
* @param name — the event name.
|
|
* @param args — arguments passed to each listener.
|
|
* @returns the first bail value (non-null, non-false, non-undefined), if any.
|
|
*/
|
|
bail<K extends keyof Events>(name: K, ...args: Parameters<Events[K]>): ReturnType<Events[K]>
|
|
bail<K extends keyof Events>(thisArg: NoInfer<ThisType<Events[K]>>, name: K, ...args: Parameters<Events[K]>): ReturnType<Events[K]>
|
|
```
|
|
|
|
Dispatch an event, calling listeners in order until one bails.
|
|
|
|
- `name` — the event name.
|
|
- `args` — arguments passed to each listener.
|
|
|
|
**Returns** the first bail value (non-null, non-false, non-undefined), if any.
|
|
|
|
[Source](../../vendor/cordis/src/events.ts#L73)
|
|
|
|
### ctx.waterfall(name, ...args)
|
|
|
|
```ts cordis-catalog
|
|
/**
|
|
* Dispatch an event whose last argument is a `next` continuation.
|
|
*
|
|
* Each listener wraps the rest of the chain: calling `next()` invokes the
|
|
* next listener (finally the built-in behavior); not calling it vetoes.
|
|
*
|
|
* @param name — the event name.
|
|
* @param args — listener arguments; the final one is the innermost `next`.
|
|
* @returns the outermost listener's return value.
|
|
*/
|
|
waterfall<K extends keyof Events>(name: K, ...args: Parameters<Events[K]>): ReturnType<Events[K]>
|
|
waterfall<K extends keyof Events>(thisArg: NoInfer<ThisType<Events[K]>>, name: K, ...args: Parameters<Events[K]>): ReturnType<Events[K]>
|
|
```
|
|
|
|
Dispatch an event whose last argument is a `next` continuation.
|
|
|
|
Each listener wraps the rest of the chain: calling `next()` invokes the next listener (finally the built-in behavior); not calling it vetoes.
|
|
|
|
- `name` — the event name.
|
|
- `args` — listener arguments; the final one is the innermost `next`.
|
|
|
|
**Returns** the outermost listener's return value.
|
|
|
|
[Source](../../vendor/cordis/src/events.ts#L86)
|
|
|
|
### ctx.on(name, listener, options?)
|
|
|
|
```ts cordis-catalog
|
|
/**
|
|
* Register an event listener owned by the current fiber.
|
|
*
|
|
* @param name — the event name to listen for.
|
|
* @param listener — called with the dispatch arguments.
|
|
* @param options — listener options; a boolean is shorthand for `prepend`.
|
|
* @returns a disposer removing the listener; `true` if it was still registered.
|
|
*/
|
|
on<K extends keyof Events>(name: K, listener: Events[K], options?: boolean | EventOptions): () => boolean
|
|
```
|
|
|
|
Register an event listener owned by the current fiber.
|
|
|
|
- `name` — the event name to listen for.
|
|
- `listener` — called with the dispatch arguments.
|
|
- `options` — listener options; a boolean is shorthand for `prepend`.
|
|
|
|
**Returns** a disposer removing the listener; `true` if it was still registered.
|
|
|
|
[Source](../../vendor/cordis/src/events.ts#L97)
|
|
|
|
### ctx.once(name, listener, options?)
|
|
|
|
```ts cordis-catalog
|
|
/**
|
|
* Same as `on()`, but the listener disposes itself after its first call.
|
|
*
|
|
* @param name — the event name to listen for.
|
|
* @param listener — called at most once with the dispatch arguments.
|
|
* @param options — listener options; a boolean is shorthand for `prepend`.
|
|
* @returns a disposer removing the listener; `true` if it was still registered.
|
|
*/
|
|
once<K extends keyof Events>(name: K, listener: Events[K], options?: boolean | EventOptions): () => boolean
|
|
```
|
|
|
|
Same as `on()`, but the listener disposes itself after its first call.
|
|
|
|
- `name` — the event name to listen for.
|
|
- `listener` — called at most once with the dispatch arguments.
|
|
- `options` — listener options; a boolean is shorthand for `prepend`.
|
|
|
|
**Returns** a disposer removing the listener; `true` if it was still registered.
|
|
|
|
[Source](../../vendor/cordis/src/events.ts#L106)
|
|
|
|
## EventOptions
|
|
|
|
Options accepted by `ctx.on()` and `ctx.once()`.
|
|
|
|
```ts cordis-catalog
|
|
/** Options accepted by `ctx.on()` and `ctx.once()`. */
|
|
interface EventOptions {
|
|
/** Add the listener before existing listeners for the same event. */
|
|
prepend?: boolean
|
|
/** Receive the event regardless of context filter checks. */
|
|
global?: boolean
|
|
}
|
|
```
|
|
|
|
[Source](../../vendor/cordis/src/events.ts#L112)
|
|
|
|
## DispatchMode
|
|
|
|
Event dispatch strategy used by the event service.
|
|
|
|
`emit` runs synchronous listeners without awaiting them, `parallel` awaits all listeners together, `serial` awaits them in order until one bails, `bail` stops on the first synchronous bail value, and `waterfall` composes listeners around a final `next` callback.
|
|
|
|
```ts cordis-catalog
|
|
/**
|
|
* Event dispatch strategy used by the event service.
|
|
*
|
|
* `emit` runs synchronous listeners without awaiting them, `parallel` awaits
|
|
* all listeners together, `serial` awaits them in order until one bails,
|
|
* `bail` stops on the first synchronous bail value, and `waterfall` composes
|
|
* listeners around a final `next` callback.
|
|
*/
|
|
type DispatchMode = 'emit' | 'parallel' | 'serial' | 'bail' | 'waterfall'
|
|
```
|
|
|
|
[Source](../../vendor/cordis/src/events.ts#L32)
|