style: lint
This commit is contained in:
@@ -119,14 +119,14 @@ Capability record baseline:
|
||||
```ts
|
||||
interface CapabilityRecord {
|
||||
capabilityId: string
|
||||
providerModuleId: string
|
||||
health?: 'degraded' | 'ok' | 'unknown'
|
||||
hostId: string
|
||||
instanceId?: string
|
||||
runtime: 'electron' | 'web' | 'pocket' | 'node'
|
||||
state: 'announced' | 'ready' | 'degraded' | 'withdrawn'
|
||||
version?: string
|
||||
health?: 'ok' | 'degraded' | 'unknown'
|
||||
metadata?: Record<string, unknown>
|
||||
providerModuleId: string
|
||||
runtime: 'electron' | 'node' | 'pocket' | 'web'
|
||||
state: 'announced' | 'degraded' | 'ready' | 'withdrawn'
|
||||
version?: string
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -64,11 +64,11 @@ Define a small transport config type owned by the Plugin Host:
|
||||
|
||||
```ts
|
||||
export type PluginTransport
|
||||
= | { kind: 'in-memory' }
|
||||
| { kind: 'websocket', url: string, protocols?: string[] }
|
||||
| { kind: 'web-worker', worker: Worker }
|
||||
= | { kind: 'electron', target: 'main' | 'renderer', webContentsId?: number }
|
||||
| { kind: 'in-memory' }
|
||||
| { kind: 'node-worker', worker: import('node:worker_threads').Worker }
|
||||
| { kind: 'electron', target: 'main' | 'renderer', webContentsId?: number }
|
||||
| { kind: 'web-worker', worker: Worker }
|
||||
| { kind: 'websocket', protocols?: string[], url: string }
|
||||
```
|
||||
|
||||
`createPluginContext(transport)` creates and returns an Eventa context based on the transport adapter (in-memory, WebSocket, worker, electron).
|
||||
@@ -99,6 +99,10 @@ Context creation happens during host setup, before any plugin lifecycle method i
|
||||
Replace direct channel usage with context-bound factories:
|
||||
|
||||
```ts
|
||||
export function createApis(ctx: EventaContext) {
|
||||
return { providers: createProviders(ctx) }
|
||||
}
|
||||
|
||||
export function createProviders(ctx: EventaContext) {
|
||||
return {
|
||||
listProviders() {
|
||||
@@ -106,10 +110,6 @@ export function createProviders(ctx: EventaContext) {
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export function createApis(ctx: EventaContext) {
|
||||
return { providers: createProviders(ctx) }
|
||||
}
|
||||
```
|
||||
|
||||
Plugins call `createApis(ctx)` provided by the host instead of importing global singletons.
|
||||
|
||||
Reference in New Issue
Block a user