@sorbetai/plugins 0.0.0-stage → 0.1.0-alpha.16

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,610 @@
1
+ import { $t as PluginExecutionProfile, A as ObjectAcquisition, B as PluginObjects, Dt as PluginSessionControlPort, G as ObjectStateHost, It as PluginSessionResolver, K as ObjectStateSnapshot, M as ObjectBinding, Pt as PluginSessionRecordsPort, Qt as PluginMountStatus, _ as PluginServiceRequirement, _n as ReadonlyJsonValue, b as ToolPluginComponent, f as PluginChildSource, g as PluginServiceRegistration, gn as JsonValue, j as ObjectAddress, k as CapturedObjectFactory, n as PluginApplyResult, nn as PluginNativeObservationPort, p as PluginContributionSource, q as ObjectResourceHost, r as PluginContext, t as PluginApply, u as LoadedPluginComponent, v as PluginServiceSource, x as ToolPluginContributions } from "./context-i4UGSmNB.js";
2
+ import { f as DesiredPluginComposition, m as DesiredPluginPatch, p as DesiredPluginEntry, r as PluginExecutionReference, t as PluginCompositionAuthority } from "./authority-BWlX47zt.js";
3
+ import { a as ModelToolSource, o as PluginModelProvider, p as ObjectCapabilitySource } from "./source-Ns6MY6kd.js";
4
+ import "@earendil-works/pi-schema";
5
+ import * as _sorbetai_context8 from "@sorbetai/context";
6
+ import * as Context from "effect/Context";
7
+ import * as Effect from "effect/Effect";
8
+ import * as Exit from "effect/Exit";
9
+ import * as Scope from "effect/Scope";
10
+ import "effect/Cause";
11
+ import * as Deferred from "effect/Deferred";
12
+ import * as Fiber from "effect/Fiber";
13
+ import "effect/Semaphore";
14
+ import * as Stream from "effect/Stream";
15
+
16
+ //#region src/composition/sessions.d.ts
17
+ interface ActivationSessionAccess {
18
+ readonly resolver: PluginSessionResolver;
19
+ readonly entryId: string;
20
+ /** Uses the same drain as captured model and Object callbacks. */
21
+ readonly retain: () => () => void;
22
+ }
23
+ //#endregion
24
+ //#region src/composition/activation.d.ts
25
+ type ActivationPhase = 'loading' | 'pending' | 'active' | 'failed' | 'retiring' | 'closed';
26
+ /** Child scopes and task sets belong to the Platform root, never to a new runtime. */
27
+ declare const makePluginActivation: (activationId: string, component: ToolPluginComponent, onFailure: (error: Error) => Effect.Effect<void>, observation?: PluginNativeObservationPort | undefined, sessionAccess?: ActivationSessionAccess | undefined, objectAccess?: ObjectAcquisition | undefined) => Effect.Effect<{
28
+ scope: Scope.Closeable;
29
+ signal: AbortSignal;
30
+ retirementSignal: AbortSignal;
31
+ canBorrow: () => boolean;
32
+ assertAvailable: () => void;
33
+ activationId: string;
34
+ componentId: string;
35
+ load: Effect.Effect<LoadedPluginComponent, Error, never>;
36
+ prepare: (services?: Context.Context<unknown>) => Effect.Effect<ToolPluginContributions, Error, never>;
37
+ close: Effect.Effect<undefined, AggregateError, never>;
38
+ stop: Effect.Effect<void, never, never>;
39
+ fence: Effect.Effect<void, never, never>;
40
+ awaitServices: Effect.Effect<void, Error, never>;
41
+ serve: Effect.Effect<void, Error, never>;
42
+ poison: Effect.Effect<void, never, never>;
43
+ snapshot: () => {
44
+ activationId: string;
45
+ componentId: string;
46
+ profile: PluginExecutionProfile;
47
+ phase: ActivationPhase;
48
+ residualResources: boolean;
49
+ failures: string[];
50
+ };
51
+ }, never, Scope.Scope>;
52
+ type PluginActivation = Effect.Success<ReturnType<typeof makePluginActivation>>;
53
+ //#endregion
54
+ //#region src/composition/programmatic.d.ts
55
+ type ApplyConfig<Apply$1> = Apply$1 extends ((...arguments_: infer Arguments) => unknown) ? Arguments extends readonly [unknown, ...infer Rest] ? Rest extends readonly [] ? null : Rest[0] : null : never;
56
+ type DefinitionApply<Definition$1> = Definition$1 extends ((...arguments_: never[]) => unknown) ? Definition$1 : Definition$1 extends {
57
+ readonly apply: infer Apply;
58
+ } ? Apply : never;
59
+ type DefinitionConfig<Definition$1> = ApplyConfig<DefinitionApply<Definition$1>>;
60
+ type DefinitionRequirements<Definition$1> = Definition$1 extends ((...arguments_: never[]) => unknown) ? never : Definition$1 extends {
61
+ readonly requires: readonly Context.Key<infer Identifier, unknown>[];
62
+ } ? Identifier : never;
63
+ type ValidServiceDefinition<Definition$1> = Definition$1 extends {
64
+ readonly requires: infer Services;
65
+ } ? Services extends readonly Context.Key<unknown, unknown>[] ? ValidApplyContract<DefinitionApply<Definition$1>, DefinitionRequirements<Definition$1>> : false : ValidApplyContract<DefinitionApply<Definition$1>, never>;
66
+ type ValidProvidesDefinition<Definition$1> = Definition$1 extends {
67
+ readonly provides: infer Services;
68
+ } ? Services extends readonly Context.Key<unknown, unknown>[] ? ValidServiceDefinition<Definition$1> : false : ValidServiceDefinition<Definition$1>;
69
+ type ValidRealmDefinition<Definition$1> = Definition$1 extends {
70
+ readonly realm: infer Realm;
71
+ } ? Realm extends 'inherit' | 'isolate' ? ValidProvidesDefinition<Definition$1> : false : ValidProvidesDefinition<Definition$1>;
72
+ type ValidDefinition<Definition$1> = Definition$1 extends {
73
+ readonly replacement: infer Policy;
74
+ } ? Policy extends 'staged' | 'exclusive' ? ValidRealmDefinition<Definition$1> : false : ValidRealmDefinition<Definition$1>;
75
+ type ValidApplyContract<Apply$1, Requirements> = Apply$1 extends ((context: PluginContext, config: ApplyConfig<Apply$1>) => infer Result) ? [Result] extends [PluginApplyResult<Requirements>] ? true : false : false;
76
+ type ValidateEntry<Entry> = Entry extends {
77
+ readonly key: string;
78
+ readonly apply: infer Definition;
79
+ readonly config: infer Config;
80
+ } ? ValidDefinition<Definition> extends true ? Config extends DefinitionConfig<Definition> ? Entry : never : never : never;
81
+ type DistributeValidEntry<Entry> = Entry extends unknown ? ValidateEntry<Entry> : never;
82
+ type ValidPluginEntries<Entries extends readonly unknown[]> = number extends Entries['length'] ? readonly DistributeValidEntry<Entries[number]>[] : { readonly [Index in keyof Entries]: ValidateEntry<Entries[Index]> };
83
+ interface CapturedProgrammaticEntry {
84
+ readonly key: string;
85
+ readonly apply: PluginApply<JsonValue, unknown>;
86
+ readonly requires: readonly Context.Key<unknown, unknown>[];
87
+ readonly provides: readonly Context.Key<unknown, unknown>[];
88
+ readonly realm?: 'inherit' | 'isolate';
89
+ readonly replacement?: 'staged' | 'exclusive';
90
+ readonly config: JsonValue;
91
+ readonly component: ToolPluginComponent;
92
+ }
93
+ //#endregion
94
+ //#region src/composition/reconciliation.d.ts
95
+ interface PackageEntryIdentity {
96
+ readonly kind: 'package';
97
+ readonly entryId: string;
98
+ readonly packageId: string;
99
+ readonly config: ReadonlyJsonValue;
100
+ }
101
+ interface ProgrammaticEntryIdentity {
102
+ readonly kind: 'programmatic';
103
+ readonly entryId: string;
104
+ readonly apply: CapturedProgrammaticEntry['apply'];
105
+ readonly requires: readonly PluginServiceRequirement[];
106
+ readonly provides?: readonly PluginServiceRequirement[];
107
+ readonly realm?: 'inherit' | 'isolate';
108
+ readonly replacement?: 'staged' | 'exclusive';
109
+ readonly config: ReadonlyJsonValue;
110
+ }
111
+ interface ChildEntryIdentity {
112
+ readonly kind: 'child';
113
+ readonly entryId: string;
114
+ readonly component: ToolPluginComponent;
115
+ }
116
+ type EntryIdentity = PackageEntryIdentity | ProgrammaticEntryIdentity | ChildEntryIdentity;
117
+ interface ServiceBinding {
118
+ readonly provider: ResidentEntry;
119
+ readonly registration: PluginServiceRegistration;
120
+ }
121
+ interface ResidentEntry {
122
+ failure?: Error;
123
+ prepared: boolean;
124
+ definition?: LoadedPluginComponent;
125
+ replacement?: 'staged' | 'exclusive';
126
+ readonly owner: PluginActivation;
127
+ readonly identity?: EntryIdentity;
128
+ readonly parent?: ResidentEntry;
129
+ readonly path: readonly string[];
130
+ rootRealm: boolean;
131
+ readonly ownedChildren: Set<ResidentEntry>;
132
+ readonly consumers: Set<ResidentEntry>;
133
+ bindings: readonly ServiceBinding[];
134
+ requires: readonly PluginServiceRequirement[];
135
+ services?: PluginServiceSource;
136
+ servicesVersion?: number;
137
+ unsubscribeServices?: () => void;
138
+ retirement?: Fiber.Fiber<void, Error>;
139
+ retirementObservation?: Deferred.Deferred<void, Error>;
140
+ preparation?: Effect.Effect<void>;
141
+ contributions: ToolPluginContributions;
142
+ releaseCallbacks?: () => void;
143
+ behaviorRegistrations: NonNullable<ToolPluginContributions['sessionBehaviors']>;
144
+ live?: PluginContributionSource;
145
+ unsubscribeLive?: () => void;
146
+ children?: PluginChildSource;
147
+ childrenVersion?: number;
148
+ unsubscribeChildren?: () => void;
149
+ version?: number;
150
+ readonly drains: Set<Deferred.Deferred<void>>;
151
+ }
152
+ //#endregion
153
+ //#region src/composition/object-transition.d.ts
154
+ interface ObjectTransition {
155
+ readonly quiesce: Effect.Effect<void, Error>;
156
+ commit(): void;
157
+ rollback(): void;
158
+ }
159
+ interface ObjectExclusiveTransition extends ObjectTransition {
160
+ readonly retirePrevious: Effect.Effect<void, Error>;
161
+ }
162
+ //#endregion
163
+ //#region src/composition/object-slots.d.ts
164
+ /** The logical instance owns slots; generations only hold validated access handles. */
165
+ declare const makeObjectSlots: () => Effect.Effect<{
166
+ drainWriters: Effect.Effect<void, never, never>;
167
+ states: () => readonly ObjectStateSnapshot[];
168
+ watchState: (name: string) => Stream.Stream<ObjectStateSnapshot, Error>;
169
+ candidate: (assertAvailable: () => void, transition: ObjectTransition) => Effect.Effect<{
170
+ host: ObjectStateHost;
171
+ validate: () => void;
172
+ rollback: () => void;
173
+ seal: () => void;
174
+ adopt: () => Effect.Effect<void, never, never>[];
175
+ }, never, Scope.Scope>;
176
+ }, never, Scope.Scope>;
177
+ type ObjectSlots = Effect.Success<ReturnType<typeof makeObjectSlots>>;
178
+ //#endregion
179
+ //#region src/composition/source-borrow.d.ts
180
+ interface SourceBorrow {
181
+ /** Register the returned release within the caller's uninterruptible acquisition. */
182
+ retain(): Effect.Effect<Effect.Effect<void>, Error>;
183
+ readonly release: Effect.Effect<void>;
184
+ }
185
+ //#endregion
186
+ //#region src/composition/object-resources.d.ts
187
+ interface ResourceOrigin {
188
+ readonly source: ResidentEntry;
189
+ readonly borrow: SourceBorrow;
190
+ readonly assertAvailable: () => void;
191
+ readonly assertAuthorized: () => void;
192
+ readonly assertDeclaration: () => void;
193
+ }
194
+ /** Stable slots own acquisition and origin retention before any constructor receives the value. */
195
+ declare const makeObjectResources: (root: Scope.Scope, options: {
196
+ readonly cleanupTimeoutMs?: number;
197
+ readonly changed: () => void;
198
+ readonly onFailure: (error: Error) => Effect.Effect<void>;
199
+ }) => Effect.Effect<{
200
+ candidate: (origin: ResourceOrigin, transition: ObjectExclusiveTransition) => Effect.Effect<{
201
+ host: ObjectResourceHost;
202
+ seal: () => void;
203
+ assertAvailable: () => void;
204
+ validate: () => void;
205
+ adopt: (current: boolean) => Effect.Effect<void, Error, never>[];
206
+ }, never, Scope.Scope>;
207
+ close: Effect.Effect<undefined, Error, never>;
208
+ closeUnborrowed: Effect.Effect<undefined, Error, never>;
209
+ status: () => {
210
+ name: string;
211
+ key: string;
212
+ version: number;
213
+ identity: _sorbetai_context8.ReadonlyJsonValue;
214
+ originActivationId: string;
215
+ phase: "failed" | "retiring" | "closed" | "acquiring" | "ready";
216
+ committed: boolean;
217
+ holders: number;
218
+ residualResources: boolean;
219
+ error: string | undefined;
220
+ }[];
221
+ }, never, Scope.Scope>;
222
+ type ObjectResources = Effect.Success<ReturnType<typeof makeObjectResources>>;
223
+ //#endregion
224
+ //#region src/composition/objects.d.ts
225
+ interface ObjectInstance {
226
+ readonly id: string;
227
+ readonly indexKey: string;
228
+ readonly address: ObjectAddress;
229
+ readonly scope: Scope.Closeable;
230
+ readonly slots: ObjectSlots;
231
+ readonly resources: ObjectResources;
232
+ readonly generations: Set<ObjectGeneration>;
233
+ readonly closed: Deferred.Deferred<void, Error>;
234
+ readonly retirementStarted: Deferred.Deferred<void>;
235
+ nextGeneration: number;
236
+ lastAdoptedOrdinal: number;
237
+ closing: boolean;
238
+ retiring: boolean;
239
+ residualResources: boolean;
240
+ failure?: Error;
241
+ retirement?: Fiber.Fiber<void, Error>;
242
+ current?: ObjectGeneration;
243
+ transition?: ObjectGeneration;
244
+ }
245
+ interface ObjectGeneration {
246
+ readonly id: string;
247
+ readonly instance: ObjectInstance;
248
+ readonly ordinal: number;
249
+ readonly factory: CapturedObjectFactory;
250
+ readonly source: ResidentEntry;
251
+ readonly scope: Scope.Closeable;
252
+ readonly releaseSource: Effect.Effect<void>;
253
+ readonly assertResourcesAvailable: () => void;
254
+ readonly ready: Deferred.Deferred<ObjectBinding, Error>;
255
+ readonly retired: Deferred.Deferred<void, Error>;
256
+ readonly retirementStarted: Deferred.Deferred<void>;
257
+ readonly preparation: Fiber.Fiber<Exit.Exit<ObjectBinding, Error>>;
258
+ readonly rollbackTransition: () => void;
259
+ readonly invocations: Set<Deferred.Deferred<void>>;
260
+ readonly calls: Set<Fiber.Fiber<unknown, Error>>;
261
+ holders: number;
262
+ phase: 'activating' | 'active' | 'failed' | 'retiring';
263
+ superseded: boolean;
264
+ residualResources: boolean;
265
+ failure?: Error;
266
+ retirement?: Fiber.Fiber<void, Error>;
267
+ }
268
+ interface ObjectObservation {
269
+ readonly instanceId: string;
270
+ readonly generationId: string | undefined;
271
+ readonly current: boolean;
272
+ readonly address: ObjectAddress;
273
+ readonly activationId: string | undefined;
274
+ readonly phase: ObjectGeneration['phase'];
275
+ readonly holders: number;
276
+ readonly invocations: number;
277
+ readonly residualResources: boolean;
278
+ readonly error: string | undefined;
279
+ readonly resources: ReturnType<ObjectResources['status']>;
280
+ }
281
+ //#endregion
282
+ //#region src/composition/observation.d.ts
283
+ interface PluginCompositionHealth {
284
+ readonly scopeId: string;
285
+ readonly admissionClosed: boolean;
286
+ /** True only after actual owner cleanup and Platform runtime disposal, including late cleanup. */
287
+ readonly closed: boolean;
288
+ readonly mounts: readonly {
289
+ readonly path: readonly string[];
290
+ readonly phase: 'active' | 'pending' | 'failed' | 'removed';
291
+ readonly pendingReason?: 'retiring' | 'admission' | 'dependency-cycle' | 'missing-service' | 'service-conflict';
292
+ readonly activationId?: string;
293
+ readonly profile?: PluginExecutionProfile;
294
+ }[];
295
+ readonly activations: readonly {
296
+ readonly activationId: string;
297
+ readonly componentId: string;
298
+ readonly profile: PluginExecutionProfile;
299
+ readonly phase: 'loading' | 'pending' | 'active' | 'failed' | 'retiring' | 'closed';
300
+ readonly cleanupUncertain: boolean;
301
+ readonly borrows: number;
302
+ }[];
303
+ readonly observerFailures: number;
304
+ /** Lease references acquired through this composition, including retained parents/dependencies. */
305
+ readonly borrowTotal: number;
306
+ }
307
+ interface PluginLifecycleTiming {
308
+ readonly scopeId: string;
309
+ readonly activationId: string;
310
+ readonly componentId: string;
311
+ readonly profile: PluginExecutionProfile;
312
+ readonly outcome: 'succeeded' | 'failed' | 'timeout' | 'late_succeeded';
313
+ readonly durationMs: number;
314
+ readonly startedAtUnixMs: number;
315
+ readonly endedAtUnixMs: number;
316
+ }
317
+ /** Fresh metadata at existing owner boundaries. Callbacks must return promptly;
318
+ * exceptions and accidental rejected promises cannot change composition or cleanup. */
319
+ interface PluginCompositionObservationPort extends PluginNativeObservationPort {
320
+ readonly compositionChanged?: (data: PluginCompositionHealth) => void;
321
+ readonly activationSettled?: (data: PluginLifecycleTiming) => void;
322
+ readonly retirementSettled?: (data: PluginLifecycleTiming) => void;
323
+ readonly borrowsChanged?: (data: {
324
+ readonly scopeId: string;
325
+ /** Lease references acquired through this composition, including retained
326
+ * parents, dependencies and retiring generations. Shared-owner drain counts
327
+ * in compositionChanged are detail, not an alternative aggregate. */
328
+ readonly borrowTotal: number;
329
+ }) => void;
330
+ }
331
+ //#endregion
332
+ //#region src/composition-control.d.ts
333
+ interface PluginCompositionSnapshot {
334
+ readonly scopeId: string;
335
+ readonly generation: number;
336
+ readonly desired: readonly DesiredPluginEntry[];
337
+ readonly authority: {
338
+ readonly fenced: boolean;
339
+ readonly closed: boolean;
340
+ };
341
+ readonly observed: {
342
+ readonly phase: 'open' | 'closing';
343
+ readonly mounts: readonly PluginMountStatus[];
344
+ };
345
+ }
346
+ interface PluginCompositionPolicy {
347
+ /** Bound by the Host. Apply checks the materialized target inside the authority lane. */
348
+ readonly authorize: (request: {
349
+ readonly action: 'query' | 'apply' | 'watch';
350
+ readonly scopeId: string;
351
+ readonly desired: readonly DesiredPluginEntry[];
352
+ readonly patch?: DesiredPluginPatch;
353
+ readonly signal: AbortSignal;
354
+ }) => boolean | Promise<boolean>;
355
+ /** Selects visible entries. Raw configs and diagnostic text never leave the default view. */
356
+ readonly visibleEntry: (entry: DesiredPluginEntry) => boolean;
357
+ /** Explicit Host projection of readable configuration fields; omission hides all config. */
358
+ readonly readConfig?: (entry: DesiredPluginEntry) => ReadonlyJsonValue;
359
+ }
360
+ interface CompositionSource {
361
+ queryComposition(): Promise<PluginCompositionSnapshot>;
362
+ applyComposition(patch: DesiredPluginPatch, authorize: (desired: DesiredPluginComposition) => Promise<void>): Promise<{
363
+ readonly accepted: true;
364
+ readonly generation: number;
365
+ readonly reconciliation: string;
366
+ readonly snapshot: PluginCompositionSnapshot;
367
+ }>;
368
+ watchComposition(observe: (snapshot: PluginCompositionSnapshot, signal: AbortSignal) => Promise<void>, signal: AbortSignal): Promise<void>;
369
+ }
370
+ /** Creates an object capability, not a typed view of the Platform. Never pass the source to a client. */
371
+ declare function makeCompositionControl(source: CompositionSource, policy: PluginCompositionPolicy): Readonly<{
372
+ queryComposition: (signal?: AbortSignal) => Promise<{
373
+ scopeId: string;
374
+ generation: number;
375
+ authority: {
376
+ fenced: boolean;
377
+ closed: boolean;
378
+ };
379
+ desired: {
380
+ entryId: string;
381
+ packageId: string;
382
+ parentId: string | null;
383
+ order: number;
384
+ enabled: boolean;
385
+ effectiveEnabled: boolean;
386
+ config: ReadonlyJsonValue | undefined;
387
+ }[];
388
+ observed: {
389
+ phase: "open" | "closing";
390
+ mounts: {
391
+ path: string[];
392
+ phase: "pending" | "active" | "failed" | "removed";
393
+ activationId: string | undefined;
394
+ pendingReason: "admission" | "retiring" | "dependency-cycle" | undefined;
395
+ }[];
396
+ };
397
+ }>;
398
+ applyComposition: (patch: DesiredPluginPatch, signal?: AbortSignal) => Promise<{
399
+ accepted: true;
400
+ generation: number;
401
+ reconciliation: string;
402
+ snapshot: {
403
+ scopeId: string;
404
+ generation: number;
405
+ authority: {
406
+ fenced: boolean;
407
+ closed: boolean;
408
+ };
409
+ desired: {
410
+ entryId: string;
411
+ packageId: string;
412
+ parentId: string | null;
413
+ order: number;
414
+ enabled: boolean;
415
+ effectiveEnabled: boolean;
416
+ config: ReadonlyJsonValue | undefined;
417
+ }[];
418
+ observed: {
419
+ phase: "open" | "closing";
420
+ mounts: {
421
+ path: string[];
422
+ phase: "pending" | "active" | "failed" | "removed";
423
+ activationId: string | undefined;
424
+ pendingReason: "admission" | "retiring" | "dependency-cycle" | undefined;
425
+ }[];
426
+ };
427
+ };
428
+ }>;
429
+ watchComposition: (observe: (snapshot: PluginCompositionView, signal: AbortSignal) => Promise<void>, signal: AbortSignal) => Promise<void>;
430
+ }>;
431
+ type PluginCompositionControl = ReturnType<typeof makeCompositionControl>;
432
+ type PluginCompositionView = Awaited<ReturnType<PluginCompositionControl['queryComposition']>>;
433
+ //#endregion
434
+ //#region src/composition/lifecycle-error.d.ts
435
+ declare class PluginLifecycleError extends Error {
436
+ readonly phase: 'preparation' | 'cleanup' | 'admission';
437
+ constructor(phase: 'preparation' | 'cleanup' | 'admission', message: string);
438
+ }
439
+ //#endregion
440
+ //#region src/platform.d.ts
441
+ /** Host-owned authorization and code loader. Neither owns a model view or historical executor. */
442
+ interface PluginCompositionAssembly {
443
+ readonly authority: PluginCompositionAuthority;
444
+ readonly loader: {
445
+ componentAt(reference: PluginExecutionReference): ToolPluginComponent;
446
+ };
447
+ }
448
+ interface PluginPlatformOptions {
449
+ readonly sessions?: PluginSessionResolver;
450
+ readonly observation?: PluginCompositionObservationPort;
451
+ readonly modelToolConflictPolicy?: 'strict' | 'isolate';
452
+ readonly durable?: PluginCompositionAssembly;
453
+ /** Plugin Platform identity; also the current Session for default Session access. */
454
+ readonly scopeId: string;
455
+ /** Enables a default single-Session directory; Hosts may bind control later. */
456
+ readonly sessionId?: string;
457
+ readonly createId: () => string;
458
+ readonly now: () => number;
459
+ readonly maxLeaseDurationMs?: number;
460
+ /** Explicit Host preparation deadline; expiry cancels the candidate and retains unsettled work. */
461
+ readonly preparationTimeoutMs?: number;
462
+ /** Explicit Host cleanup observation budget; expiry reports residency while original cleanup continues. */
463
+ readonly cleanupTimeoutMs?: number;
464
+ }
465
+ /** Composition root. Desired persistence finishes before resource convergence begins. */
466
+ declare class PluginPlatform implements PluginModelProvider {
467
+ #private;
468
+ private constructor();
469
+ static open(options: PluginPlatformOptions): Promise<PluginPlatform>;
470
+ get modelTools(): ModelToolSource;
471
+ get objects(): PluginObjects;
472
+ get objectCapabilities(): ObjectCapabilitySource;
473
+ /** Namespace of every Object this Platform owns. Object addresses are scoped by it. */
474
+ get objectNamespace(): string;
475
+ replace(component?: ToolPluginComponent): Promise<void>;
476
+ configure<const Entries extends readonly unknown[]>(entries: Entries & ValidPluginEntries<Entries>): Promise<void>;
477
+ /** Rebuilds current Desired resources. It never loads a historical request binding. */
478
+ reconcile(): Promise<void>;
479
+ status(): Promise<{
480
+ requests: number;
481
+ isolatedTools: string[];
482
+ objects: ObjectObservation[];
483
+ observation: PluginCompositionHealth;
484
+ activations: {
485
+ activationId: string;
486
+ componentId: string;
487
+ profile: PluginExecutionProfile;
488
+ phase: "pending" | "active" | "loading" | "failed" | "retiring" | "closed";
489
+ residualResources: boolean;
490
+ failures: string[];
491
+ }[];
492
+ mounts: PluginMountStatus[];
493
+ serviceConflicts: {
494
+ key: string;
495
+ realmPath: readonly string[];
496
+ providers: {
497
+ path: readonly string[];
498
+ activationId: string;
499
+ }[];
500
+ }[];
501
+ phase: "open" | "closing";
502
+ failures: string[];
503
+ }>;
504
+ flush(): Promise<void>;
505
+ queryComposition(): Promise<{
506
+ scopeId: string;
507
+ generation: number;
508
+ desired: readonly DesiredPluginEntry[];
509
+ authority: {
510
+ fenced: boolean;
511
+ closed: boolean;
512
+ };
513
+ observed: {
514
+ requests: number;
515
+ isolatedTools: string[];
516
+ objects: ObjectObservation[];
517
+ observation: PluginCompositionHealth;
518
+ activations: {
519
+ activationId: string;
520
+ componentId: string;
521
+ profile: PluginExecutionProfile;
522
+ phase: "pending" | "active" | "loading" | "failed" | "retiring" | "closed";
523
+ residualResources: boolean;
524
+ failures: string[];
525
+ }[];
526
+ mounts: PluginMountStatus[];
527
+ serviceConflicts: {
528
+ key: string;
529
+ realmPath: readonly string[];
530
+ providers: {
531
+ path: readonly string[];
532
+ activationId: string;
533
+ }[];
534
+ }[];
535
+ phase: "open" | "closing";
536
+ failures: string[];
537
+ };
538
+ }>;
539
+ createCompositionControl(policy: PluginCompositionPolicy): Readonly<{
540
+ queryComposition: (signal?: AbortSignal) => Promise<{
541
+ scopeId: string;
542
+ generation: number;
543
+ authority: {
544
+ fenced: boolean;
545
+ closed: boolean;
546
+ };
547
+ desired: {
548
+ entryId: string;
549
+ packageId: string;
550
+ parentId: string | null;
551
+ order: number;
552
+ enabled: boolean;
553
+ effectiveEnabled: boolean;
554
+ config: _sorbetai_context8.ReadonlyJsonValue | undefined;
555
+ }[];
556
+ observed: {
557
+ phase: "open" | "closing";
558
+ mounts: {
559
+ path: string[];
560
+ phase: "pending" | "active" | "failed" | "removed";
561
+ activationId: string | undefined;
562
+ pendingReason: "admission" | "retiring" | "dependency-cycle" | undefined;
563
+ }[];
564
+ };
565
+ }>;
566
+ applyComposition: (patch: DesiredPluginPatch, signal?: AbortSignal) => Promise<{
567
+ accepted: true;
568
+ generation: number;
569
+ reconciliation: string;
570
+ snapshot: {
571
+ scopeId: string;
572
+ generation: number;
573
+ authority: {
574
+ fenced: boolean;
575
+ closed: boolean;
576
+ };
577
+ desired: {
578
+ entryId: string;
579
+ packageId: string;
580
+ parentId: string | null;
581
+ order: number;
582
+ enabled: boolean;
583
+ effectiveEnabled: boolean;
584
+ config: _sorbetai_context8.ReadonlyJsonValue | undefined;
585
+ }[];
586
+ observed: {
587
+ phase: "open" | "closing";
588
+ mounts: {
589
+ path: string[];
590
+ phase: "pending" | "active" | "failed" | "removed";
591
+ activationId: string | undefined;
592
+ pendingReason: "admission" | "retiring" | "dependency-cycle" | undefined;
593
+ }[];
594
+ };
595
+ };
596
+ }>;
597
+ watchComposition: (observe: (snapshot: PluginCompositionView, signal: AbortSignal) => Promise<void>, signal: AbortSignal) => Promise<void>;
598
+ }>;
599
+ watchComposition(observe: (snapshot: PluginCompositionSnapshot, signal: AbortSignal) => Promise<void>, signal: AbortSignal): Promise<void>;
600
+ /** Binds the current Host Session control used by Plugin `ctx.session.bind`. */
601
+ bindSessionControl(control: PluginSessionControlPort): void;
602
+ /** Binds per-entry durable Records for the default single-Session directory. */
603
+ bindSessionRecords(records: (owner: {
604
+ readonly entryId: string;
605
+ readonly activationId?: string;
606
+ }) => PluginSessionRecordsPort): void;
607
+ close(): Promise<void>;
608
+ }
609
+ //#endregion
610
+ export { PluginCompositionControl as a, PluginCompositionView as c, PluginLifecycleTiming as d, PluginLifecycleError as i, PluginCompositionHealth as l, PluginPlatform as n, PluginCompositionPolicy as o, PluginPlatformOptions as r, PluginCompositionSnapshot as s, PluginCompositionAssembly as t, PluginCompositionObservationPort as u };
@@ -0,0 +1,5 @@
1
+ import { $ as PluginCompactionObservationDecision, $t as PluginExecutionProfile, At as PluginSessionFactReadOptions, B as PluginObjects, Bt as PluginSessionWorkHandle, C as RunYieldHook, Ct as PluginToolResult, D as PluginContextPreparationHook, Dt as PluginSessionControlPort, E as YieldDecision, Et as PluginSessionActor, F as ObjectFactory, Ft as PluginSessionRequestPort, Gt as PluginCompleteModelRequest, H as ObjectSelf, Ht as PluginSessionWorkPort, It as PluginSessionResolver, J as PluginCompactionCompileInput, Jt as PluginModelUsage, K as ObjectStateSnapshot, Kt as PluginModelForkRequest, L as ObjectMethods, Lt as PluginSessionScope, Mt as PluginSessionRecord, N as ObjectCatalog, Nt as PluginSessionRecordAppend, O as PluginContextPreparationScope, Ot as PluginSessionDirectory, Pt as PluginSessionRecordsPort, Q as PluginCompactionObservation, Qt as PluginMountStatus, R as ObjectRef, Rt as PluginSessionSendInput, S as CommittedAnswer, St as ToolHookPreparation, T as YieldContext, Tt as PluginRequestContext, U as ObjectState, Ut as PluginSessionWriteInput, V as defineObject, Vt as PluginSessionWorkOutcome, W as ObjectStateFrame, Wt as PluginSessionWriteInputSchema, X as PluginCompactionCompilerRegistration, Xt as PluginProviderModel, Y as PluginCompactionCompilerContribution, Yt as PluginProviderHooks, Z as PluginCompactionModel, Zt as PluginSessionModelPort, _t as ToolHookContext, a as PluginMount, an as PluginCommandRegistration, at as PluginCompactionTrigger, b as ToolPluginComponent, bt as ToolHookFeedback, c as PluginToolHookRegistration, cn as SessionBehaviorCommandSchema, ct as PluginInputTransform, d as ModelToolContribution, dn as SessionBehaviorMetadata, dt as PluginStateReadContext, en as PluginNativeInvocationObservation, et as PluginCompactionObserverContribution, fn as SessionBehaviorMetadataSchema, ft as PluginStateReadResult, h as PluginPackageComponent, hn as SessionBehaviorViewSchema, ht as PreparedToolHooks, i as PluginDefinition, in as PluginCommandInput, it as PluginCompactionSettings, j as ObjectAddress, jt as PluginSessionFactsPort, kt as PluginSessionFact, l as PluginToolRegistration, ln as SessionBehaviorContribution, lt as PluginPrefixContribution, m as PluginLifetime, mn as SessionBehaviorView, mt as PluginToolResultSnapshot, nn as PluginNativeObservationPort, nt as PluginCompactionPolicyContribution, o as PluginNamedStateRegistration, on as PluginCommandResult, ot as PluginInput, pn as SessionBehaviorScope, pt as PluginToolResultObservation, qt as PluginModelInvocationReceipt, r as PluginContext, rn as PluginCommandContext, rt as PluginCompactionPolicyRegistration, s as PluginRegistration, sn as SessionBehaviorCommand, t as PluginApply, tn as PluginNativeLifecycleObservation, tt as PluginCompactionObserverRegistration, un as SessionBehaviorDispatch, ut as PluginNamedStateContribution, w as UsageTotals, yt as ToolHookContribution, z as ObjectType, zt as PluginSessionSendInputSchema } from "./context-i4UGSmNB.js";
2
+ import { a as PluginCompositionControl, c as PluginCompositionView, d as PluginLifecycleTiming, i as PluginLifecycleError, l as PluginCompositionHealth, n as PluginPlatform, o as PluginCompositionPolicy, r as PluginPlatformOptions, s as PluginCompositionSnapshot, t as PluginCompositionAssembly, u as PluginCompositionObservationPort } from "./index-NehD_iIX.js";
3
+ import { A as materializePluginConfig, C as PluginPackageDocument, D as encodePluginPackage, E as decodePluginPackage, O as PluginConfigError, S as inspectPluginModules, T as StoredPluginPackage, _ as PluginCompositionError, a as PluginCommitData, b as PluginModuleError, c as PluginAuthorityError, d as PluginCompositionJournalBatch, f as DesiredPluginComposition, g as PluginCompositionBatch, h as DesiredPluginPatchSchema, i as MemoryPluginStore, k as PluginConfigSchema, l as PluginAuthorityJournalBatch, m as DesiredPluginPatch, n as PluginCompositionAuthorityOptions, o as PluginStore, p as DesiredPluginEntry, r as PluginExecutionReference, s as PluginAuthorityCheckpoint, t as PluginCompositionAuthority, u as PluginCompositionCommand, v as projectPluginComposition, w as PluginPackageFormatError, x as PluginModuleInspection, y as PluginPackageInspector } from "./authority-BWlX47zt.js";
4
+ import "./source-Ns6MY6kd.js";
5
+ export { CommittedAnswer, DesiredPluginComposition, DesiredPluginEntry, DesiredPluginPatch, DesiredPluginPatchSchema, MemoryPluginStore, ModelToolContribution, ObjectAddress, ObjectCatalog, ObjectFactory, ObjectMethods, ObjectRef, ObjectSelf, ObjectState, ObjectStateFrame, ObjectStateSnapshot, ObjectType, PluginApply, PluginAuthorityCheckpoint, PluginAuthorityError, PluginAuthorityJournalBatch, PluginCommandContext, PluginCommandInput, PluginCommandRegistration, PluginCommandResult, PluginCommitData, PluginCompactionCompileInput, PluginCompactionCompilerContribution, PluginCompactionCompilerRegistration, PluginCompactionModel, PluginCompactionObservation, PluginCompactionObservationDecision, PluginCompactionObserverContribution, PluginCompactionObserverRegistration, PluginCompactionPolicyContribution, PluginCompactionPolicyRegistration, PluginCompactionSettings, PluginCompactionTrigger, PluginCompleteModelRequest, PluginCompositionAssembly, PluginCompositionAuthority, PluginCompositionAuthorityOptions, PluginCompositionBatch, PluginCompositionCommand, PluginCompositionControl, PluginCompositionError, PluginCompositionHealth, PluginCompositionJournalBatch, PluginCompositionObservationPort, PluginCompositionPolicy, PluginCompositionSnapshot, PluginCompositionView, PluginConfigError, PluginConfigSchema, PluginContext, PluginContextPreparationHook, PluginContextPreparationScope, PluginDefinition, PluginExecutionProfile, PluginExecutionReference, PluginInput, PluginInputTransform, PluginLifecycleError, PluginLifecycleTiming, PluginLifetime, PluginModelForkRequest, PluginModelInvocationReceipt, PluginModelUsage, PluginModuleError, PluginModuleInspection, PluginMount, PluginMountStatus, PluginNamedStateContribution, PluginNamedStateRegistration, PluginNativeInvocationObservation, PluginNativeLifecycleObservation, PluginNativeObservationPort, PluginObjects, PluginPackageComponent, PluginPackageDocument, PluginPackageFormatError, PluginPackageInspector, PluginPlatform, PluginPlatformOptions, PluginPrefixContribution, PluginProviderHooks, PluginProviderModel, PluginRegistration, PluginRequestContext, PluginSessionActor, PluginSessionControlPort, PluginSessionDirectory, PluginSessionFact, PluginSessionFactReadOptions, PluginSessionFactsPort, PluginSessionModelPort, PluginSessionRecord, PluginSessionRecordAppend, PluginSessionRecordsPort, PluginSessionRequestPort, PluginSessionResolver, PluginSessionScope, PluginSessionSendInput, PluginSessionSendInputSchema, PluginSessionWorkHandle, PluginSessionWorkOutcome, PluginSessionWorkPort, PluginSessionWriteInput, PluginSessionWriteInputSchema, PluginStateReadContext, PluginStateReadResult, PluginStore, PluginToolHookRegistration, PluginToolRegistration, PluginToolResult, PluginToolResultObservation, PluginToolResultSnapshot, PreparedToolHooks, RunYieldHook, SessionBehaviorCommand, SessionBehaviorCommandSchema, SessionBehaviorContribution, SessionBehaviorDispatch, SessionBehaviorMetadata, SessionBehaviorMetadataSchema, SessionBehaviorScope, SessionBehaviorView, SessionBehaviorViewSchema, StoredPluginPackage, ToolHookContext, ToolHookContribution, ToolHookFeedback, ToolHookPreparation, ToolPluginComponent, UsageTotals, YieldContext, YieldDecision, decodePluginPackage, defineObject, encodePluginPackage, inspectPluginModules, materializePluginConfig, projectPluginComposition };