dshb-exec-ssh 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1125 @@
1
+ //#region ../../node_modules/@deepseek-ai/cosmokit/lib/types/misc.d.ts
2
+ /** String/symbol keyed dictionary type. */
3
+ type Dict<T = any, K extends string | symbol = string> = { [key in K]: T; };
4
+ /** Wrap a value in `Promise`, preserving the resolved type of existing promises. */
5
+ type Promisify<T> = Promise<T extends Promise<infer S> ? S : T>;
6
+ /** Accept a value or promise unless the value type is already promise-like. */
7
+ type Awaitable<T> = [T] extends [Promise<unknown>] ? T : T | Promise<T>;
8
+ //#endregion
9
+ //#region ../../node_modules/@standard-schema/spec/dist/index.d.ts
10
+ /** The Standard Typed interface. This is a base type extended by other specs. */
11
+ interface StandardTypedV1<Input = unknown, Output = Input> {
12
+ /** The Standard properties. */
13
+ readonly "~standard": StandardTypedV1.Props<Input, Output>;
14
+ }
15
+ declare namespace StandardTypedV1 {
16
+ /** The Standard Typed properties interface. */
17
+ interface Props<Input = unknown, Output = Input> {
18
+ /** The version number of the standard. */
19
+ readonly version: 1;
20
+ /** The vendor name of the schema library. */
21
+ readonly vendor: string;
22
+ /** Inferred types associated with the schema. */
23
+ readonly types?: Types<Input, Output> | undefined;
24
+ }
25
+ /** The Standard Typed types interface. */
26
+ interface Types<Input = unknown, Output = Input> {
27
+ /** The input type of the schema. */
28
+ readonly input: Input;
29
+ /** The output type of the schema. */
30
+ readonly output: Output;
31
+ }
32
+ /** Infers the input type of a Standard Typed. */
33
+ type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["input"];
34
+ /** Infers the output type of a Standard Typed. */
35
+ type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["output"];
36
+ }
37
+ /** The Standard Schema interface. */
38
+ interface StandardSchemaV1<Input = unknown, Output = Input> {
39
+ /** The Standard Schema properties. */
40
+ readonly "~standard": StandardSchemaV1.Props<Input, Output>;
41
+ }
42
+ declare namespace StandardSchemaV1 {
43
+ /** The Standard Schema properties interface. */
44
+ interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
45
+ /** Validates unknown input values. */
46
+ readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
47
+ }
48
+ /** The result interface of the validate function. */
49
+ type Result<Output> = SuccessResult<Output> | FailureResult;
50
+ /** The result interface if validation succeeds. */
51
+ interface SuccessResult<Output> {
52
+ /** The typed output value. */
53
+ readonly value: Output;
54
+ /** A falsy value for `issues` indicates success. */
55
+ readonly issues?: undefined;
56
+ }
57
+ interface Options {
58
+ /** Explicit support for additional vendor-specific parameters, if needed. */
59
+ readonly libraryOptions?: Record<string, unknown> | undefined;
60
+ }
61
+ /** The result interface if validation fails. */
62
+ interface FailureResult {
63
+ /** The issues of failed validation. */
64
+ readonly issues: ReadonlyArray<Issue>;
65
+ }
66
+ /** The issue interface of the failure output. */
67
+ interface Issue {
68
+ /** The error message of the issue. */
69
+ readonly message: string;
70
+ /** The path of the issue, if any. */
71
+ readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
72
+ }
73
+ /** The path segment interface of the issue. */
74
+ interface PathSegment {
75
+ /** The key representing a path segment. */
76
+ readonly key: PropertyKey;
77
+ }
78
+ /** The Standard types interface. */
79
+ interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {}
80
+ /** Infers the input type of a Standard. */
81
+ type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
82
+ /** Infers the output type of a Standard. */
83
+ type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
84
+ }
85
+ //#endregion
86
+ //#region ../../node_modules/@deepseek-ai/cordis/lib/types/utils.d.ts
87
+ /** Ordered collection of disposable values with O(1) deletion by value. */
88
+ declare class DisposableList<T extends WeakKey> {
89
+ private sn;
90
+ private map;
91
+ private weak;
92
+ get length(): number;
93
+ push(value: T): () => boolean;
94
+ delete(value: T): boolean;
95
+ clear(): T[];
96
+ [Symbol.iterator](): MapIterator<T>;
97
+ }
98
+ /** Shared symbols used to avoid public property-name collisions. */
99
+ declare const symbols: {
100
+ shadow: symbol;
101
+ receiver: symbol;
102
+ original: symbol;
103
+ metadata: symbol;
104
+ initHooks: symbol;
105
+ checkProto: symbol;
106
+ effect: typeof Context.effect;
107
+ filter: typeof Context.filter;
108
+ isolate: typeof Context.isolate;
109
+ intercept: typeof Context.intercept;
110
+ init: typeof Service.init;
111
+ check: typeof Service.check;
112
+ config: typeof Service.config;
113
+ invoke: typeof Service.invoke;
114
+ extend: typeof Service.extend;
115
+ tracker: typeof Service.tracker;
116
+ resolveConfig: typeof Service.resolveConfig;
117
+ };
118
+ //#endregion
119
+ //#region ../../node_modules/@deepseek-ai/cordis/lib/types/registry.d.ts
120
+ /**
121
+ * Service dependency declaration accepted by plugins and the `@Inject`
122
+ * decorator.
123
+ *
124
+ * Array form requests services without intercept config. Object form maps each
125
+ * service name to optional intercept config for the plugin context.
126
+ */
127
+ type Inject<M = Dict> = (keyof M)[] | { [K in keyof M]?: M[K]; };
128
+ /** Context keys that correspond to services with typed intercept config. */
129
+ type InjectKey = keyof { [K in keyof Context & string as Context[K] extends {
130
+ [symbols.config]: any;
131
+ } ? K : never]: any; };
132
+ /**
133
+ * Decorator for declaring service dependencies on classes or class methods.
134
+ *
135
+ * On classes it contributes to the plugin's static `inject` map. On methods it
136
+ * delays the method call until the declared services are available.
137
+ */
138
+ /**
139
+ * @param name — the required service name.
140
+ * @param config — optional intercept config applied for that service.
141
+ * @returns the class or method decorator.
142
+ */
143
+ declare function Inject<K extends InjectKey>(name: K, config?: Context[K] extends {
144
+ [symbols.config]: infer T;
145
+ } ? T : never): (value: any, decorator: ClassDecoratorContext<any> | ClassMethodDecoratorContext<any>) => void;
146
+ /** Utilities for normalizing plugin dependency declarations. */
147
+ declare namespace Inject {
148
+ /**
149
+ * Convert array/object/class-inherited inject metadata into a plain map.
150
+ *
151
+ * @param inject — the declaration to normalize; `null`/`undefined` add nothing.
152
+ * @param result — the map to fill (service name → intercept config or `null`).
153
+ * @returns `result`.
154
+ */
155
+ function resolve(inject: Inject | null | undefined, result?: Dict): Dict;
156
+ }
157
+ /** Supported plugin entrypoint shapes. */
158
+ type Plugin<T = any> = Plugin.Function<T> | Plugin.Constructor<T> | Plugin.Object<T>;
159
+ /** Types associated with plugin entrypoints and runtime records. */
160
+ declare namespace Plugin {
161
+ /** Shared metadata understood by the plugin registry and related tooling. */
162
+ interface Base<T = any> {
163
+ /** Display name used for fiber diagnostics and logger names. */
164
+ name?: string;
165
+ /** Standard-schema validator applied to config before the plugin starts. */
166
+ Config?: StandardSchemaV1<any, T>;
167
+ /** Services the plugin requires; it only loads while all are available. */
168
+ inject?: Inject;
169
+ /** Service name(s) the plugin provides (read by `Service` and by loaders). */
170
+ provide?: string | string[];
171
+ /** Service names whose intercept config the plugin declares it consumes. */
172
+ intercept?: Dict<boolean>;
173
+ }
174
+ interface Transform<S, T> {
175
+ /** Marks the transform object as a schema/config transform. */
176
+ schema?: true;
177
+ /** Convert user-facing config to runtime config. */
178
+ Config: (config: S) => T;
179
+ }
180
+ /** Function plugin called with `(ctx, config)`. */
181
+ interface Function<T = any> extends Base<T> {
182
+ (ctx: Context, config: T): any;
183
+ }
184
+ /** Class plugin constructed with `(ctx, config)`. */
185
+ interface Constructor<T = any> extends Base<T> {
186
+ new (ctx: Context, config: T): any;
187
+ }
188
+ /** Object plugin with an `apply(ctx, config)` method. */
189
+ interface Object<T = any> extends Base<T> {
190
+ apply(ctx: Context, config: T): any;
191
+ }
192
+ /** Mutable registry record shared by all fibers of one plugin callback. */
193
+ interface Runtime {
194
+ /** Display name copied from the first registered plugin shape. */
195
+ name?: string;
196
+ /** Every live fiber of this plugin (one per `ctx.plugin()` call). */
197
+ fibers: DisposableList<Fiber>;
198
+ /** The executable entrypoint all fibers share (registry identity key). */
199
+ callback: globalThis.Function;
200
+ /** Standard-schema validator applied to each fiber's config. */
201
+ Config?: StandardSchemaV1;
202
+ }
203
+ }
204
+ type Spread<T> = undefined extends T ? [config?: T] : [config: T];
205
+ type GetPluginParameters<P> = P extends ((ctx: Context, ...args: infer R) => any) ? R : P extends (new (ctx: Context, ...args: infer R) => any) ? R : P extends {
206
+ apply(ctx: Context, ...args: infer R): any;
207
+ } ? R : never;
208
+ type GetPluginConfig<P> = P extends Plugin.Transform<infer S, any> ? S : GetPluginParameters<P>[0];
209
+ declare module './context.ts' {
210
+ interface Context {
211
+ /**
212
+ * Run a callback once the requested services are available.
213
+ *
214
+ * Shorthand for `ctx.plugin({ inject, apply: callback })`: the callback
215
+ * is unloaded and re-run whenever a required service changes.
216
+ *
217
+ * @param deps — required services, as an array or a name → config map.
218
+ * @param callback — plugin body called with `(ctx, config)`.
219
+ * @returns the fiber; awaiting it settles once loading finished.
220
+ */
221
+ inject(deps: Inject, callback: Plugin.Function<void>): Fiber & PromiseLike<Fiber>;
222
+ /**
223
+ * Load a plugin in the current context.
224
+ *
225
+ * @param plugin — a function, class, or `{ apply }` object plugin.
226
+ * @param args — the plugin config, validated against its `Config` schema.
227
+ * @returns the fiber; awaiting it settles once loading finished
228
+ * (rejecting on config or startup errors).
229
+ */
230
+ plugin<P extends Plugin>(plugin: P, ...args: Spread<GetPluginConfig<P>>): Fiber & PromiseLike<Fiber>;
231
+ }
232
+ }
233
+ /**
234
+ * Plugin registry installed as `ctx.registry` and mixed into every context.
235
+ *
236
+ * It normalizes plugin shapes, tracks plugin runtimes, starts fibers, and
237
+ * exposes map-like inspection over active plugin callbacks.
238
+ */
239
+ declare class RegistryService {
240
+ ctx: Context;
241
+ private _counter;
242
+ private _internal;
243
+ constructor(ctx: Context);
244
+ /** Allocate the next fiber uid (increments on every read). */
245
+ get counter(): number;
246
+ /** Number of registered plugin runtimes. */
247
+ get size(): number;
248
+ /**
249
+ * Resolve a supported plugin shape to its executable callback.
250
+ *
251
+ * @param plugin — a function, class, or `{ apply }` object plugin.
252
+ * @returns the callback identifying the plugin, or `undefined` if invalid.
253
+ */
254
+ resolve(plugin: Plugin): Function | undefined;
255
+ /**
256
+ * Look up the runtime record for a plugin.
257
+ *
258
+ * @param plugin — any supported plugin shape.
259
+ * @returns the runtime, or `undefined` when the plugin is not registered.
260
+ */
261
+ get(plugin: Plugin): Plugin.Runtime | undefined;
262
+ /**
263
+ * Check whether a plugin has a registered runtime.
264
+ *
265
+ * @param plugin — any supported plugin shape.
266
+ * @returns `true` when at least one fiber of the plugin exists.
267
+ */
268
+ has(plugin: Plugin): boolean;
269
+ /**
270
+ * Dispose every running fiber for a plugin and remove its runtime record.
271
+ *
272
+ * @param plugin — any supported plugin shape.
273
+ * @returns the removed runtime, or `undefined` when none was registered.
274
+ */
275
+ delete(plugin: Plugin): Plugin.Runtime | undefined;
276
+ /** Iterate the registered plugin callbacks. */
277
+ keys(): MapIterator<Function>;
278
+ /** Iterate the registered plugin runtimes. */
279
+ values(): MapIterator<Plugin.Runtime>;
280
+ /** Iterate `[callback, runtime]` pairs. */
281
+ entries(): MapIterator<[Function, Plugin.Runtime]>;
282
+ /**
283
+ * Visit every registered runtime.
284
+ *
285
+ * @param callback — receives each runtime and its identifying callback.
286
+ */
287
+ forEach(callback: (value: Plugin.Runtime, key: Function) => void): void;
288
+ /**
289
+ * Start a callback once the requested dependencies are available.
290
+ *
291
+ * @param inject — required services, as an array or a name → config map.
292
+ * @param callback — plugin body called with `(ctx, config)`.
293
+ * @returns the fiber; awaiting it settles once loading finished.
294
+ */
295
+ inject(inject: Inject, callback: Plugin.Function<void>): Fiber & PromiseLike<Fiber>;
296
+ /**
297
+ * Start a plugin in the current context and return its fiber.
298
+ *
299
+ * Creates (or reuses) the plugin's runtime record, then starts a new fiber
300
+ * under the current context. Throws if `plugin` is not a supported shape or
301
+ * if the current fiber is already disposed.
302
+ *
303
+ * @param plugin — a function, class, or `{ apply }` object plugin.
304
+ * @param config — the plugin config, validated against its `Config` schema.
305
+ * @param getOuterStack — captures the caller stack for effect diagnostics.
306
+ * @returns the fiber; awaiting it settles once loading finished.
307
+ */
308
+ plugin(plugin: Plugin, config?: any, getOuterStack?: () => string[]): Fiber & PromiseLike<Fiber>;
309
+ }
310
+ //#endregion
311
+ //#region ../../node_modules/@deepseek-ai/cordis/lib/types/reflect.d.ts
312
+ declare module './context.ts' {
313
+ interface Context {
314
+ /**
315
+ * Read a service from the store without the inject requirement.
316
+ *
317
+ * @param name — the service name.
318
+ * @param strict — when `true` (default), only return implementations
319
+ * whose providing fiber is currently active.
320
+ * @returns the service value, or `undefined` when not (yet) provided.
321
+ */
322
+ get<K extends string & keyof this>(name: K, strict?: boolean): undefined | this[K];
323
+ /** Same as above for service names outside the typed `Context` surface. */
324
+ get(name: string, strict?: boolean): any;
325
+ /**
326
+ * Overwrite a provided service's value.
327
+ *
328
+ * Only the fiber that provided the service may set it; setting an
329
+ * unprovided name throws.
330
+ *
331
+ * @param name — the service name.
332
+ * @param value — the new service value.
333
+ */
334
+ set<K extends string & keyof this>(name: K, value: undefined | this[K]): void;
335
+ /** Same as above for service names outside the typed `Context` surface. */
336
+ set(name: string, value: any): void;
337
+ /**
338
+ * Register a service implementation owned by the current fiber.
339
+ *
340
+ * The service becomes visible to dependents in the same isolation scope
341
+ * once the fiber is active; it is unregistered (waking dependents) when
342
+ * the returned disposer runs or the fiber unloads. Throws if the name is
343
+ * already provided in this scope or declared as an accessor.
344
+ *
345
+ * @param name — the service name.
346
+ * @param value — the service value.
347
+ * @returns a disposer that unregisters the service.
348
+ */
349
+ provide<K extends string & keyof this>(name: K, value: undefined | this[K]): () => void;
350
+ /** Same as above for service names outside the typed `Context` surface. */
351
+ provide(name: string, value?: any): () => void;
352
+ /**
353
+ * Define a computed context property backed by get/set hooks.
354
+ *
355
+ * The accessor is removed when the current fiber unloads. Throws if the
356
+ * name is already declared.
357
+ *
358
+ * @param name — the context property name.
359
+ * @param options — the `get` hook and optional `set` hook.
360
+ */
361
+ accessor(name: string, options: Omit<Property.Accessor, 'type'>): void;
362
+ /**
363
+ * Expose selected members of a service directly on `ctx`.
364
+ *
365
+ * Each mixed-in key becomes an accessor that forwards to the service
366
+ * (binding methods to it), so e.g. `ctx.on` forwards to `ctx.events.on`.
367
+ * Mixins are removed when the current fiber unloads.
368
+ *
369
+ * @param name — the context property holding the source service.
370
+ * @param mixins — keys to forward, or a source-key → ctx-key map.
371
+ */
372
+ mixin<K extends string & keyof this>(name: K, mixins: (keyof this & keyof this[K])[] | Dict<string>): void;
373
+ /** Same as above with a source object instead of a context property name. */
374
+ mixin<T extends {}>(source: T, mixins: (keyof this & keyof T)[] | Dict<string>): void;
375
+ }
376
+ }
377
+ /** Context property definition known by the reflection service. */
378
+ type Property = Property.Service | Property.Accessor;
379
+ /** Property definition variants understood by `ReflectService`. */
380
+ declare namespace Property {
381
+ /** Service property backed by a provided implementation. */
382
+ interface Service {
383
+ /** Discriminator. */
384
+ type: 'service';
385
+ }
386
+ /** Computed context property backed by custom get/set hooks. */
387
+ interface Accessor {
388
+ /** Discriminator. */
389
+ type: 'accessor';
390
+ /** Compute the property value; `error` carries the caller stack for diagnostics. */
391
+ get: (this: Context, receiver: any, error: Error) => any;
392
+ /** Optional setter; return `false` to reject the write. */
393
+ set?: (this: Context, value: any, receiver: any, error: Error) => boolean;
394
+ }
395
+ }
396
+ /** Concrete service implementation record stored in the root reflect service. */
397
+ interface Impl {
398
+ /** The service name. */
399
+ name: string;
400
+ /** The fiber that provided the service (owns its lifetime). */
401
+ fiber: Fiber;
402
+ /** The current service value. */
403
+ value?: any;
404
+ /** Optional availability predicate consulted before dependents may load. */
405
+ check?: () => boolean;
406
+ }
407
+ /**
408
+ * Reflection and service-resolution layer installed as `ctx.reflect`.
409
+ *
410
+ * This service powers the context proxy, service registration, accessors, and
411
+ * the mixins that expose core service methods directly on `ctx`.
412
+ */
413
+ declare class ReflectService {
414
+ ctx: Context;
415
+ /** Proxy traps implementing service resolution for every context object. */
416
+ static handler: ProxyHandler<Context>;
417
+ /** Service implementations, keyed by isolation label. */
418
+ store: Dict<Impl, symbol>;
419
+ /** Declared context properties (services and accessors), by name. */
420
+ props: Dict<Property>;
421
+ constructor(ctx: Context);
422
+ /**
423
+ * Read a service from the store without the inject requirement.
424
+ *
425
+ * @param name — the service name.
426
+ * @param strict — when `true`, only return implementations whose providing
427
+ * fiber is currently active.
428
+ * @returns the service value, or `undefined` when not (yet) provided.
429
+ */
430
+ get(name: string, strict?: boolean): any;
431
+ _getImpl(name: string, strict?: boolean): Impl | undefined;
432
+ /**
433
+ * Overwrite a provided service's value.
434
+ *
435
+ * @param name — the service name.
436
+ * @param value — the new service value.
437
+ * @param error — carrier for the caller stack in diagnostics.
438
+ * @returns `true` on success.
439
+ * @throws when `name` was never provided, or was provided by another fiber.
440
+ */
441
+ set(name: string, value: any, error?: Error): boolean;
442
+ /**
443
+ * Register a service implementation owned by the current fiber.
444
+ *
445
+ * See the `ctx.provide()` overload above for the full contract.
446
+ *
447
+ * @param name — the service name.
448
+ * @param value — the service value.
449
+ * @param check — optional availability predicate for dependents.
450
+ * @returns a disposer that unregisters the service.
451
+ */
452
+ provide(name: string, value?: any, check?: () => boolean): Disposable<Promise<void>>;
453
+ /**
454
+ * Re-evaluate every fiber that requires one of the given services.
455
+ *
456
+ * @param names — the service names that changed.
457
+ * @param filter — restricts notification to matching isolation scopes.
458
+ * @returns the fibers whose dependency state was refreshed.
459
+ */
460
+ notify(names: string[], filter?: (ctx: Context, name: string) => boolean): Fiber[];
461
+ /**
462
+ * Define a computed context property backed by get/set hooks.
463
+ *
464
+ * @param name — the context property name.
465
+ * @param options — the `get` hook and optional `set` hook.
466
+ * @returns a disposer that removes the accessor.
467
+ */
468
+ accessor(name: string, options: Omit<Property.Accessor, 'type'>): Disposable<Promise<void>>;
469
+ /**
470
+ * Expose selected members of a service directly on `ctx`.
471
+ *
472
+ * See the `ctx.mixin()` overload above for the full contract.
473
+ *
474
+ * @param source — a context property name or a source object.
475
+ * @param mixins — keys to forward, or a source-key → ctx-key map.
476
+ * @returns a disposer that removes all created accessors.
477
+ */
478
+ mixin(source: any, mixins: string[] | Dict<string>): Disposable<Promise<void>>;
479
+ /**
480
+ * Attach this context's tracing wrapper to a value.
481
+ *
482
+ * @param value — the value to wrap.
483
+ * @returns the traceable wrapper (or the value itself when not applicable).
484
+ */
485
+ trace<T>(value: T): T;
486
+ /**
487
+ * Wrap a callback so calls trace `this` and arguments to this context.
488
+ *
489
+ * @param callback — the function to wrap.
490
+ * @returns a proxy delegating to `callback` with traced values.
491
+ */
492
+ bind<T extends Function>(callback: T): T;
493
+ }
494
+ //#endregion
495
+ //#region ../../node_modules/@deepseek-ai/cordis/lib/types/fiber.d.ts
496
+ declare module './context.ts' {
497
+ interface Context extends Pick<Fiber, 'effect'> {
498
+ /** The fiber (plugin runtime instance) that owns this context. */
499
+ fiber: Fiber;
500
+ }
501
+ }
502
+ interface AsyncDisposable<T extends Awaitable<void> = Awaitable<void>> extends PromiseLike<() => T> {
503
+ (): T;
504
+ }
505
+ /**
506
+ * Function returned by an effect to release resources during disposal.
507
+ *
508
+ * Disposers run in reverse registration order when the owning fiber unloads;
509
+ * they may be async, in which case unloading awaits them.
510
+ */
511
+ type Disposable<T = any> = () => T;
512
+ /**
513
+ * Effect body result accepted by `ctx.effect()` and plugin startup.
514
+ *
515
+ * Either a single disposer, a promise of one, or a (possibly async) iterable
516
+ * yielding several — generator effects register each yielded disposer as it
517
+ * is produced.
518
+ */
519
+ type Effect<T = any> = SyncEffect<T> | AsyncEffect<T>;
520
+ type SyncEffect<T = any> = Disposable<T> | Iterable<Disposable<T>, void, void>;
521
+ type AsyncEffect<T = any> = Promise<Disposable<T>> | AsyncIterable<Disposable<T>, void, void>;
522
+ /** Tree node used to expose nested effect labels for diagnostics. */
523
+ interface EffectMeta {
524
+ /** Human-readable effect label, e.g. `ctx.on("event")` or `ctx.provide("name")`. */
525
+ label: string;
526
+ /** Metadata of nested effects registered while this effect ran. */
527
+ children: EffectMeta[];
528
+ }
529
+ /**
530
+ * Lifecycle state for one plugin fiber.
531
+ *
532
+ * `PENDING` — waiting for required services; `LOADING` — the plugin callback
533
+ * is running; `ACTIVE` — loaded and providing; `FAILED` — the callback or its
534
+ * config threw; `UNLOADING` — disposers are running; `DISPOSED` — the fiber
535
+ * was removed and cannot restart.
536
+ */
537
+ declare const enum FiberState {
538
+ PENDING = 0,
539
+ LOADING = 1,
540
+ ACTIVE = 2,
541
+ FAILED = 3,
542
+ DISPOSED = 4,
543
+ UNLOADING = 5
544
+ }
545
+ /**
546
+ * Runtime instance of one plugin application.
547
+ *
548
+ * A fiber tracks dependency state, validated config, lifecycle effects, and
549
+ * cleanup for the plugin context returned by `ctx.plugin()`.
550
+ */
551
+ declare class Fiber {
552
+ parent: Context;
553
+ inject: Dict<any>;
554
+ runtime: Plugin.Runtime | null;
555
+ /** Unique id within the registry; 0 for the root fiber, `null` once disposed. */
556
+ uid: number | null;
557
+ /** The context this fiber's plugin runs in (extends the parent context). */
558
+ readonly ctx: Context;
559
+ /** The validated plugin config (updated by `update()`). */
560
+ config: any;
561
+ /** The raw plugin config, re-resolved before each activation. */
562
+ _config: any;
563
+ /** Current lifecycle state; transitions emit `internal/status`. */
564
+ state: FiberState;
565
+ /** Dispose this fiber: unload the plugin, then settle once cleanup finished. */
566
+ readonly dispose: () => Promise<void>;
567
+ /** Snapshot of required service implementations while loaded; `undefined` otherwise. */
568
+ store: Dict<Impl> | undefined;
569
+ /** The in-flight load/unload transition, if one is currently running. */
570
+ inertia: Promise<void> | undefined;
571
+ readonly _hooks: Dict<DisposableList<Function>>;
572
+ readonly _disposables: DisposableList<Disposable<any>>;
573
+ protected context: Context;
574
+ private _error;
575
+ private _runner;
576
+ private _store;
577
+ /**
578
+ * Create a fiber. Plugin authors normally obtain fibers from `ctx.plugin()`
579
+ * rather than constructing them directly.
580
+ *
581
+ * @param parent — the context the plugin was loaded from.
582
+ * @param config — raw config, validated against the runtime's schema.
583
+ * @param inject — resolved dependency map (service name → intercept config).
584
+ * @param runtime — the shared plugin runtime, or `null` for the root fiber.
585
+ * @param getOuterStack — captures the caller stack for effect diagnostics.
586
+ */
587
+ constructor(parent: Context, config: any, inject: Dict<any>, runtime: Plugin.Runtime | null, getOuterStack: () => string[]);
588
+ /** The plugin's display name, inherited from the nearest named ancestor, else `'root'`. */
589
+ get name(): string;
590
+ /**
591
+ * Throw if the fiber has already been disposed.
592
+ *
593
+ * @returns nothing when the fiber is still active.
594
+ * @throws {CordisError} `INACTIVE_EFFECT` when the fiber's uid has been cleared.
595
+ */
596
+ assertActive(): void;
597
+ private _execute;
598
+ /**
599
+ * Register a cleanup-aware effect on this fiber.
600
+ *
601
+ * `execute` runs immediately; the disposers it produces are collected and
602
+ * run (in reverse order) either when the returned disposer is called or
603
+ * when the fiber unloads, whichever comes first. Calling the disposer twice
604
+ * is a no-op. Throws `CordisError('INACTIVE_EFFECT')` if the fiber is
605
+ * already disposed, and `TypeError` if `execute` returns an invalid shape.
606
+ *
607
+ * @param execute — the effect body; see {@link Effect} for accepted shapes.
608
+ * @param label — effect label shown in `getEffects()` diagnostics.
609
+ * @returns a disposer that tears the effect down and settles once done.
610
+ */
611
+ effect(execute: () => SyncEffect, label?: string): Disposable<Promise<void>>;
612
+ /** Same as above for async effects; the disposer is also awaitable. */
613
+ effect(execute: () => Effect, label?: string): AsyncDisposable<Promise<void>>;
614
+ /**
615
+ * Return metadata for currently registered effects.
616
+ *
617
+ * @returns one {@link EffectMeta} tree per labeled live effect.
618
+ */
619
+ getEffects(): EffectMeta[];
620
+ private _getState;
621
+ private _updateState;
622
+ _checkImpl(name: string): boolean | undefined;
623
+ _refresh(): void;
624
+ private _setEpoch;
625
+ private _resolveConfig;
626
+ private _reload;
627
+ private _unload;
628
+ /**
629
+ * Wait for current lifecycle work and rethrow startup errors.
630
+ *
631
+ * @returns this fiber, once it has settled into a stable state.
632
+ * @throws the config-validation or plugin-startup error, if any.
633
+ */
634
+ await(): Promise<this>;
635
+ /**
636
+ * Dispose and immediately reload this plugin with its current config.
637
+ *
638
+ * @returns a promise resolving once the reload settled.
639
+ * @throws {CordisError} `INACTIVE_EFFECT` when the fiber is already disposed.
640
+ */
641
+ restart(): Promise<void>;
642
+ /**
643
+ * Validate and apply new config, then restart the plugin.
644
+ *
645
+ * Runs the `internal/update` waterfall first, so update hooks (and HMR)
646
+ * can veto or replace the restart.
647
+ *
648
+ * @param config — the new raw config; validated before anything restarts.
649
+ * @param noSave — hint for persistence hooks not to write the change back.
650
+ * @returns the update waterfall result; the default restart returns a promise.
651
+ * @throws when validation, an update listener, or the restarted plugin fails.
652
+ */
653
+ update(config: any, noSave?: boolean): void | Promise<void>;
654
+ }
655
+ //#endregion
656
+ //#region ../../node_modules/@deepseek-ai/cordis/lib/types/events.d.ts
657
+ /** Extract the parameter tuple from a function type. */
658
+ type Parameters<F> = F extends ((...args: infer P) => any) ? P : never;
659
+ /** Extract the return type from a function type. */
660
+ type ReturnType<F> = F extends ((...args: any) => infer R) ? R : never;
661
+ /** Extract the explicit `this` type from a function type. */
662
+ type ThisType<F> = F extends ((this: infer T, ...args: any) => any) ? T : never;
663
+ /**
664
+ * Event dispatch strategy used by the event service.
665
+ *
666
+ * `emit` runs synchronous listeners without awaiting them, `parallel` awaits
667
+ * all listeners together, `serial` awaits them in order until one bails,
668
+ * `bail` stops on the first synchronous bail value, and `waterfall` composes
669
+ * listeners around a final `next` callback.
670
+ */
671
+ type DispatchMode = 'emit' | 'parallel' | 'serial' | 'bail' | 'waterfall';
672
+ declare module './context.ts' {
673
+ interface Context {
674
+ /**
675
+ * Dispatch an event, running all listeners concurrently.
676
+ *
677
+ * @param name — the event name.
678
+ * @param args — arguments passed to every listener.
679
+ * @returns a promise resolving once every listener has settled.
680
+ */
681
+ parallel<K extends keyof Events>(name: K, ...args: Parameters<Events[K]>): Promise<void>;
682
+ /** Same as above, with an explicit `this` for listeners (also used for filtering). */
683
+ parallel<K extends keyof Events>(thisArg: NoInfer<ThisType<Events[K]>>, name: K, ...args: Parameters<Events[K]>): Promise<void>;
684
+ /**
685
+ * Dispatch an event synchronously, ignoring listener return values.
686
+ *
687
+ * @param name — the event name.
688
+ * @param args — arguments passed to every listener.
689
+ */
690
+ emit<K extends keyof Events>(name: K, ...args: Parameters<Events[K]>): void;
691
+ /** Same as above, with an explicit `this` for listeners (also used for filtering). */
692
+ emit<K extends keyof Events>(thisArg: NoInfer<ThisType<Events[K]>>, name: K, ...args: Parameters<Events[K]>): void;
693
+ /**
694
+ * Dispatch an event, awaiting listeners in order until one bails.
695
+ *
696
+ * @param name — the event name.
697
+ * @param args — arguments passed to each listener.
698
+ * @returns the first bail value (non-null, non-false, non-undefined), if any.
699
+ */
700
+ serial<K extends keyof Events>(name: K, ...args: Parameters<Events[K]>): Promisify<ReturnType<Events[K]>>;
701
+ /** Same as above, with an explicit `this` for listeners (also used for filtering). */
702
+ serial<K extends keyof Events>(thisArg: NoInfer<ThisType<Events[K]>>, name: K, ...args: Parameters<Events[K]>): Promisify<ReturnType<Events[K]>>;
703
+ /**
704
+ * Dispatch an event, calling listeners in order until one bails.
705
+ *
706
+ * @param name — the event name.
707
+ * @param args — arguments passed to each listener.
708
+ * @returns the first bail value (non-null, non-false, non-undefined), if any.
709
+ */
710
+ bail<K extends keyof Events>(name: K, ...args: Parameters<Events[K]>): ReturnType<Events[K]>;
711
+ /** Same as above, with an explicit `this` for listeners (also used for filtering). */
712
+ bail<K extends keyof Events>(thisArg: NoInfer<ThisType<Events[K]>>, name: K, ...args: Parameters<Events[K]>): ReturnType<Events[K]>;
713
+ /**
714
+ * Dispatch an event whose last argument is a `next` continuation.
715
+ *
716
+ * Each listener wraps the rest of the chain: calling `next()` invokes the
717
+ * next listener (finally the built-in behavior); not calling it vetoes.
718
+ *
719
+ * @param name — the event name.
720
+ * @param args — listener arguments; the final one is the innermost `next`.
721
+ * @returns the outermost listener's return value.
722
+ */
723
+ waterfall<K extends keyof Events>(name: K, ...args: Parameters<Events[K]>): ReturnType<Events[K]>;
724
+ /** Same as above, with an explicit `this` for listeners (also used for filtering). */
725
+ waterfall<K extends keyof Events>(thisArg: NoInfer<ThisType<Events[K]>>, name: K, ...args: Parameters<Events[K]>): ReturnType<Events[K]>;
726
+ /**
727
+ * Register an event listener owned by the current fiber.
728
+ *
729
+ * @param name — the event name to listen for.
730
+ * @param listener — called with the dispatch arguments.
731
+ * @param options — listener options; a boolean is shorthand for `prepend`.
732
+ * @returns a disposer removing the listener; `true` if it was still registered.
733
+ */
734
+ on<K extends keyof Events>(name: K, listener: Events[K], options?: boolean | EventOptions): () => boolean;
735
+ /**
736
+ * Same as `on()`, but the listener disposes itself after its first call.
737
+ *
738
+ * @param name — the event name to listen for.
739
+ * @param listener — called at most once with the dispatch arguments.
740
+ * @param options — listener options; a boolean is shorthand for `prepend`.
741
+ * @returns a disposer removing the listener; `true` if it was still registered.
742
+ */
743
+ once<K extends keyof Events>(name: K, listener: Events[K], options?: boolean | EventOptions): () => boolean;
744
+ }
745
+ }
746
+ /** Options accepted by `ctx.on()` and `ctx.once()`. */
747
+ interface EventOptions {
748
+ /** Add the listener before existing listeners for the same event. */
749
+ prepend?: boolean;
750
+ /** Receive the event regardless of context filter checks. */
751
+ global?: boolean;
752
+ }
753
+ /** Registered listener record stored by the event service. */
754
+ interface Hook extends EventOptions {
755
+ ctx: Context;
756
+ callback: (...args: any[]) => any;
757
+ }
758
+ /**
759
+ * Event bus installed as `ctx.events` and mixed into every context.
760
+ *
761
+ * The service supports concurrent, synchronous, serial, bail, and waterfall
762
+ * dispatch and automatically disposes listeners with their owning fiber.
763
+ */
764
+ declare class EventsService {
765
+ private ctx;
766
+ _hooks: Record<keyof any, Hook[]>;
767
+ constructor(ctx: Context);
768
+ /**
769
+ * Resolve listeners for one dispatch and apply context filtering.
770
+ *
771
+ * @param type — the dispatch mode, reported on `internal/dispatch`.
772
+ * @param args — the raw dispatch arguments; consumed up to the event name.
773
+ * @returns the matching listener callbacks, bound to the dispatch `this`.
774
+ */
775
+ dispatch(type: string, args: any[]): ((...args: any[]) => any)[];
776
+ /**
777
+ * Run listeners concurrently and wait for all of them.
778
+ *
779
+ * @param args — optional `this`, the event name, then listener arguments.
780
+ * @returns a promise resolving once every listener has settled.
781
+ */
782
+ parallel(...args: any[]): Promise<void>;
783
+ /**
784
+ * Run listeners synchronously without waiting for returned promises.
785
+ *
786
+ * @param args — optional `this`, the event name, then listener arguments.
787
+ */
788
+ emit(...args: any[]): void;
789
+ /**
790
+ * Run listeners in order, awaiting each, until one returns a bail value.
791
+ *
792
+ * @param args — optional `this`, the event name, then listener arguments.
793
+ * @returns the first bail value (see {@link isBailed}), if any.
794
+ */
795
+ serial(...args: any[]): Promise<any>;
796
+ /**
797
+ * Run listeners synchronously until one returns a bail value.
798
+ *
799
+ * @param args — optional `this`, the event name, then listener arguments.
800
+ * @returns the first bail value (see {@link isBailed}), if any.
801
+ */
802
+ bail(...args: any[]): any;
803
+ /**
804
+ * Compose listeners around the final `next` callback.
805
+ *
806
+ * The last dispatch argument is treated as the innermost `next`. Listeners
807
+ * run outermost-first; a listener that does not call `next()` vetoes the
808
+ * rest of the chain, including the built-in behavior.
809
+ *
810
+ * @param args — optional `this`, the event name, listener arguments, then `next`.
811
+ * @returns the outermost listener's return value.
812
+ */
813
+ waterfall(...args: any[]): any;
814
+ /**
815
+ * Store a listener record as an effect on the current fiber.
816
+ *
817
+ * @param label — effect label shown in fiber diagnostics.
818
+ * @param hooks — the listener list for one event.
819
+ * @param callback — the listener to store.
820
+ * @param options — placement and filtering options.
821
+ * @returns a disposer that unregisters the listener.
822
+ */
823
+ register(label: string, hooks: Hook[], callback: any, options: EventOptions): () => void;
824
+ /**
825
+ * Remove a stored listener record.
826
+ *
827
+ * @param hooks — the listener list for one event.
828
+ * @param callback — the listener to remove.
829
+ * @returns `true` if the listener was found and removed.
830
+ */
831
+ unregister(hooks: Hook[], callback: any): true | undefined;
832
+ /**
833
+ * Register an event listener owned by the current fiber.
834
+ *
835
+ * The listener is removed automatically when the fiber unloads. Throws
836
+ * `CordisError('INACTIVE_EFFECT')` if the fiber is already disposed.
837
+ *
838
+ * @param name — the event name to listen for.
839
+ * @param listener — called with the dispatch arguments.
840
+ * @param options — listener options; a boolean is shorthand for `prepend`.
841
+ * @returns a disposer removing the listener; `true` if it was still registered.
842
+ */
843
+ on(name: string | symbol, listener: (...args: any) => any, options?: boolean | EventOptions): any;
844
+ /**
845
+ * Register an event listener that disposes itself after the first call.
846
+ *
847
+ * @param name — the event name to listen for.
848
+ * @param listener — called at most once with the dispatch arguments.
849
+ * @param options — listener options; a boolean is shorthand for `prepend`.
850
+ * @returns a disposer removing the listener; `true` if it was still registered.
851
+ */
852
+ once(name: string, listener: (...args: any) => any, options?: boolean | EventOptions): any;
853
+ }
854
+ /**
855
+ * Built-in framework events used by core services and extension points.
856
+ *
857
+ * Plugin and status events track fiber lifecycle, service events observe
858
+ * dependency registration, update/get/set/listener events allow core services
859
+ * to intercept runtime operations, and `internal/dispatch` exposes event-bus
860
+ * diagnostics before public events are delivered.
861
+ */
862
+ interface Events {
863
+ /** A plugin fiber was created or its uid was cleared on disposal. */
864
+ 'internal/plugin'(fiber: Fiber): void;
865
+ /** A fiber changed lifecycle state; receives the fiber and its previous state. */
866
+ 'internal/status'(fiber: Fiber, oldValue: FiberState): void;
867
+ /**
868
+ * Resolve raw plugin config after the fiber's injections become active.
869
+ * @param config - the raw config for this activation.
870
+ * @mode waterfall
871
+ */
872
+ 'internal/config'(this: Fiber, config: any, next: () => any): any;
873
+ /** Interception hook for a service binding (no core producer). */
874
+ 'internal/service'(this: Context, name: string, value: any): void;
875
+ /** Waterfall: a fiber config update is being applied; skip `next()` to veto. */
876
+ 'internal/update'(this: Fiber, config: any, noSave: boolean, next: () => void | Promise<void>): void | Promise<void>;
877
+ /** Waterfall: a service is being read through the context proxy. */
878
+ 'internal/get'(ctx: Context, name: string, error: Error, next: () => any): any;
879
+ /** Waterfall: a service is being written through the context proxy. */
880
+ 'internal/set'(ctx: Context, name: string, value: any, error: Error, next: () => boolean): boolean;
881
+ /** Bail: a listener is being registered; a non-null result replaces registration. */
882
+ 'internal/listener'(this: Context, name: string, listener: any, prepend: boolean): void;
883
+ /** An event is being dispatched to listeners (fired for non-internal events only). */
884
+ 'internal/dispatch'(mode: DispatchMode, name: string, args: any[], thisArg: any): void;
885
+ }
886
+ //#endregion
887
+ //#region ../../node_modules/@deepseek-ai/cordis/lib/types/logger.d.ts
888
+ declare module './context.ts' {
889
+ interface Intercept {
890
+ logger: LoggerService.Intercept;
891
+ }
892
+ }
893
+ /** Logger method name and severity category. */
894
+ type LoggerType = 'error' | 'info' | 'warn' | 'debug';
895
+ /** Callable shape for one logger severity method. */
896
+ type LoggerMethod = (format: any, ...param: any[]) => void;
897
+ /** Formatter used to resolve a printf-style placeholder. */
898
+ type Formatter = (value: any, exporter: Exporter, message: Message) => any;
899
+ /** Structured log record delivered to exporters. */
900
+ interface Message {
901
+ sn: number;
902
+ ts: number;
903
+ name: string;
904
+ type: LoggerType;
905
+ level: number;
906
+ args: any[];
907
+ fiber?: WeakRef<Fiber>;
908
+ }
909
+ /** Sink that receives structured log messages. */
910
+ interface Exporter {
911
+ colors?: number | false;
912
+ maxLength?: number;
913
+ levels?: Record<string, number>;
914
+ formatters?: Record<string, Formatter>;
915
+ export(message: Message): void;
916
+ }
917
+ /** Options used when creating a named logger facade. */
918
+ interface LoggerOptions {
919
+ /** The logger name shown with each message. */
920
+ name: string;
921
+ /** Message fields merged into every record from this logger. */
922
+ meta?: Partial<Message>;
923
+ /** Default maximum level exported when an exporter has no own threshold. */
924
+ level?: number;
925
+ }
926
+ /** Logger facade identity, inherited message metadata, and optional minimum level. */
927
+ interface Logger extends LoggerOptions {}
928
+ /** Logger facade severity methods. */
929
+ interface Logger extends Record<LoggerType, LoggerMethod> {}
930
+ /** Logger facade for one named subsystem. */
931
+ declare class Logger {
932
+ private service;
933
+ static color(exporter: Exporter, code: number, value: any, decoration?: string): string;
934
+ static code(name: string, level?: false | number): number;
935
+ static format(exporter: Exporter, message: Message): string;
936
+ constructor(options: LoggerOptions, service: LoggerService);
937
+ private _method;
938
+ }
939
+ /** Logger service configuration merged from context intercepts. */
940
+ declare namespace LoggerService {
941
+ interface Intercept {
942
+ name?: string;
943
+ level?: number;
944
+ }
945
+ }
946
+ /** Callable `ctx.logger` service shape. */
947
+ interface LoggerService extends Record<LoggerType, LoggerMethod> {
948
+ (name?: string): Logger;
949
+ }
950
+ /**
951
+ * Built-in logging service.
952
+ *
953
+ * Call `ctx.logger()` to create a named logger, or call `ctx.logger.info()`
954
+ * directly to log with the current fiber-derived name.
955
+ */
956
+ declare class LoggerService {
957
+ bufferSize: number;
958
+ buffer: Message[];
959
+ ctx: Context;
960
+ _snMessage: number;
961
+ _snExporter: number;
962
+ exporters: Map<number, Exporter>;
963
+ constructor(ctx: Context);
964
+ /**
965
+ * Register an exporter and dispose it with the current fiber.
966
+ *
967
+ * @param exporter — the sink that receives structured log messages.
968
+ * @returns a disposer that removes the exporter.
969
+ */
970
+ exporter(exporter: Exporter): Disposable<Promise<void>>;
971
+ private _resolveConfig;
972
+ [symbols.invoke](name?: string): Logger;
973
+ }
974
+ //#endregion
975
+ //#region ../../node_modules/@deepseek-ai/cordis/lib/types/context.d.ts
976
+ /**
977
+ * Public shape of a Cordis context.
978
+ *
979
+ * The concrete `Context` class is proxied at runtime, so this interface is
980
+ * augmented by core services and plugins to describe the properties that may
981
+ * be read from `ctx`.
982
+ */
983
+ interface Context {
984
+ /** Isolation map: service name → scope label. Lookups for a name resolve within its label. */
985
+ [symbols.isolate]: Dict<symbol>;
986
+ /** Intercept map: service name → config merged into that service's per-plugin config. */
987
+ [symbols.intercept]: Dict;
988
+ /** The root context of the application (every child context shares it). @experimental */
989
+ root: this;
990
+ /** Base URL used to resolve relative plugin/module specifiers, if the runtime sets one. */
991
+ baseUrl?: string;
992
+ /** The event bus. Its methods are also mixed onto `ctx` (`ctx.on`, `ctx.emit`, ...). */
993
+ events: EventsService;
994
+ /** The logging service. Call `ctx.logger(name)` for a named logger. */
995
+ logger: LoggerService;
996
+ /** The reflection layer backing the context proxy (`ctx.get`, `ctx.provide`, ...). */
997
+ reflect: ReflectService;
998
+ /** The plugin registry. Its methods are mixed onto `ctx` (`ctx.plugin`, `ctx.inject`). */
999
+ registry: RegistryService;
1000
+ }
1001
+ /**
1002
+ * Root and child dependency containers for Cordis plugins.
1003
+ *
1004
+ * A context is a proxy: normal property reads go through the service resolver,
1005
+ * while `extend()`, `isolate()`, and `intercept()` create scoped child
1006
+ * contexts without mutating their parent.
1007
+ */
1008
+ declare class Context {
1009
+ /** Symbol key under which a disposer exposes its {@link EffectMeta} diagnostics tree. */
1010
+ static readonly effect: unique symbol;
1011
+ /** Symbol key for a context's listener filter, consulted on every event dispatch. */
1012
+ static readonly filter: unique symbol;
1013
+ /** Symbol key of the isolation map (see the `Context[symbols.isolate]` property). */
1014
+ static readonly isolate: unique symbol;
1015
+ /** Symbol key of the intercept map (see the `Context[symbols.intercept]` property). */
1016
+ static readonly intercept: unique symbol;
1017
+ /**
1018
+ * Returns true for Cordis context proxies and context prototypes.
1019
+ *
1020
+ * Works across realms and across multiple copies of cordis, because the
1021
+ * brand is keyed by a global symbol rather than by `instanceof`.
1022
+ *
1023
+ * @param value — the value to test.
1024
+ * @returns `true` if `value` is a Cordis context, narrowing its type.
1025
+ */
1026
+ static is(value: any): value is Context;
1027
+ /** Create the root context and install the built-in services. */
1028
+ constructor();
1029
+ /**
1030
+ * Create a child context with extra metadata on top of the current scope.
1031
+ *
1032
+ * The child prototypally inherits every property of this context; own
1033
+ * properties of `meta` shadow the inherited ones. The parent is not mutated.
1034
+ *
1035
+ * @param meta — own properties (including symbol keys) to define on the child.
1036
+ * @returns a child context inheriting from this one.
1037
+ */
1038
+ extend(meta?: {}): this;
1039
+ /**
1040
+ * Create a child context with an independent service scope for `name`.
1041
+ *
1042
+ * Below the returned context, reads and writes of the service `name`
1043
+ * resolve against the new label instead of the parent's, so a different
1044
+ * implementation can be provided without affecting the parent scope.
1045
+ * Passing the same `label` to two `isolate()` calls joins their scopes.
1046
+ *
1047
+ * @param name — the service name to isolate.
1048
+ * @param label — scope label to join; defaults to a fresh unique symbol.
1049
+ * @returns a child context whose `name` service resolves in the new scope.
1050
+ */
1051
+ isolate(name: string, label?: symbol): this;
1052
+ /**
1053
+ * Add service-specific intercept config for plugins started below this
1054
+ * context.
1055
+ *
1056
+ * Plugins loaded under the returned context see `config` merged into the
1057
+ * service's resolved config (ancestor entries first; see
1058
+ * `Service[symbols.resolveConfig]`). The parent context is not affected.
1059
+ *
1060
+ * @param name — the service name whose config to intercept.
1061
+ * @param config — the intercept config to merge for that service.
1062
+ * @returns a child context carrying the additional intercept entry.
1063
+ */
1064
+ intercept<K extends InjectKey>(name: K, config: Context[K] extends {
1065
+ [symbols.config]: infer T;
1066
+ } ? T : never): this;
1067
+ intercept(name: string, config: any): this;
1068
+ }
1069
+ //#endregion
1070
+ //#region ../../node_modules/@deepseek-ai/cordis/lib/types/service.d.ts
1071
+ /**
1072
+ * Base class for services that expose a named API on `ctx`.
1073
+ *
1074
+ * Subclasses call `super(ctx, name)` from their constructor. The service is
1075
+ * registered immediately and is automatically removed with the owning fiber.
1076
+ */
1077
+ declare abstract class Service<out T = never> {
1078
+ protected ctx: Context;
1079
+ /** Symbol key of an instance method run after construction (class plugins). */
1080
+ static readonly init: unique symbol;
1081
+ /** Symbol key of the availability predicate passed to `ctx.provide()`. */
1082
+ static readonly check: unique symbol;
1083
+ /** Symbol key of the phantom intercept-config type parameter. */
1084
+ static readonly config: unique symbol;
1085
+ /** Symbol key of the call body making a service callable (e.g. `ctx.logger()`). */
1086
+ static readonly invoke: unique symbol;
1087
+ /** Symbol key of the helper deriving an extended service instance. */
1088
+ static readonly extend: unique symbol;
1089
+ /** Symbol key of the tracker metadata used for context tracing. */
1090
+ static readonly tracker: unique symbol;
1091
+ /** Symbol key of the intercept-config resolution helper below. */
1092
+ static readonly resolveConfig: unique symbol;
1093
+ [symbols.config]: T;
1094
+ /** The service name this instance is registered under. */
1095
+ name: string;
1096
+ /**
1097
+ * Register this instance as `name` in the current context.
1098
+ *
1099
+ * Calls `ctx.reflect.provide(name, this, this[Service.check])`, so the
1100
+ * service is unregistered automatically when the owning fiber unloads.
1101
+ * Services with a `[Service.invoke]` body return a callable instance.
1102
+ *
1103
+ * @param ctx — the context to register in (stored as `this.ctx`).
1104
+ * @param name — the service name; defaults to the static `provide` field.
1105
+ */
1106
+ constructor(ctx: Context, name: string);
1107
+ protected [symbols.filter](ctx: Context): boolean;
1108
+ protected [symbols.extend](props?: any): any;
1109
+ /**
1110
+ * Merge intercept config from ancestors with optional base and head values.
1111
+ *
1112
+ * Entries added closer to the root apply first; `base` is prepended and
1113
+ * `head` appended. Uses `Config.merge` when the service declares one,
1114
+ * otherwise a shallow `Object.assign`.
1115
+ *
1116
+ * @param base — lowest-precedence config merged before all intercepts.
1117
+ * @param head — highest-precedence config merged after all intercepts.
1118
+ * @returns the merged config.
1119
+ */
1120
+ [symbols.resolveConfig](base?: T, head?: T): T;
1121
+ static [Symbol.hasInstance](instance: any): boolean;
1122
+ }
1123
+ //#endregion
1124
+ export { Dict as i, Context as n, StandardSchemaV1 as r, Service as t };
1125
+ //# sourceMappingURL=index-CDfaZYyK.d.ts.map