@morlay/ui-conversation-message-actions 0.0.19-alpha.4 → 0.0.19-alpha.6
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.
- package/dist/client.cjs +39 -64
- package/dist/index.mjs +8 -9
- package/dist/testing.d.cts +203 -414
- package/dist/testing.d.mts +203 -414
- package/dist/testing.mjs +2160 -825
- package/package.json +24 -24
- package/src/client/chat-node/MessageIconActions.tsx +12 -56
- package/src/client/chat-node/message-chrome.ts +0 -15
- package/src/client/composer-stats/StatsPills.tsx +6 -6
- package/src/client/controller.ts +34 -7
- package/src/index.ts +17 -12
- package/src/plan.ts +1 -1
- package/src/shared.ts +0 -1
- package/src/testing.ts +2 -4
package/dist/testing.d.mts
CHANGED
|
@@ -25,6 +25,16 @@ declare namespace Binary {
|
|
|
25
25
|
/** String/symbol keyed dictionary type. */
|
|
26
26
|
type Dict<T = any, K extends string | symbol = string> = { [key in K]: T; };
|
|
27
27
|
//#endregion
|
|
28
|
+
//#region ../../../vendor/deepseek-harness/vendor/cosmokit/lib/types/volatile.d.ts
|
|
29
|
+
/** Shared config references used by schema validators and plugin runtimes. */
|
|
30
|
+
/** Recursively readonly data returned by a volatile config reference. */
|
|
31
|
+
type VolatileSnapshot<T> = T extends object ? { readonly [K in keyof T]: VolatileSnapshot<T[K]>; } : T;
|
|
32
|
+
/** A stable reference; keep the reference, or capture its value for one operation only. */
|
|
33
|
+
interface Volatile<T> {
|
|
34
|
+
/** @returns the current immutable snapshot, including undefined for an absent value. */
|
|
35
|
+
get(): VolatileSnapshot<T>;
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
28
38
|
//#region ../../../node_modules/.pnpm/@standard-schema+spec@1.1.0/node_modules/@standard-schema/spec/dist/index.d.ts
|
|
29
39
|
/** The Standard Typed interface. This is a base type extended by other specs. */
|
|
30
40
|
interface StandardTypedV1$1<Input = unknown, Output = Input> {
|
|
@@ -107,9 +117,9 @@ declare const kSchema: unique symbol;
|
|
|
107
117
|
declare global {
|
|
108
118
|
namespace Schemastery {
|
|
109
119
|
/** Convert primitive constructors, constants, and existing schemas into a schema type. */
|
|
110
|
-
type From<X> = X extends string | number | boolean ? Schema<X> : X extends Schema ? X : X extends typeof String ? Schema<string> : X extends typeof Number ? Schema<number> : X extends typeof Boolean ? Schema<boolean> : X extends typeof Function ? Schema<Function, (...args: any[]) => any> : X extends Constructor<infer S> ? Schema<S> : never;
|
|
111
|
-
type TypeS1<X> = X extends Schema<infer S,
|
|
112
|
-
type Inverse<X> = X extends Schema<
|
|
120
|
+
type From<X> = X extends string | number | boolean ? Schema<X> : X extends Schema<any, any, SchemaMode> ? X : X extends typeof String ? Schema<string> : X extends typeof Number ? Schema<number> : X extends typeof Boolean ? Schema<boolean> : X extends typeof Function ? Schema<Function, (...args: any[]) => any> : X extends Constructor<infer S> ? Schema<S> : never;
|
|
121
|
+
type TypeS1<X> = X extends Schema<infer S, infer _T, infer _M> ? S : never;
|
|
122
|
+
type Inverse<X> = X extends Schema<infer _S, infer T, infer M> ? (arg: SchemaOutput<T, M>) => void : never;
|
|
113
123
|
/** Input type accepted by a schema-like value. */
|
|
114
124
|
type TypeS<X> = TypeS1<From<X>>;
|
|
115
125
|
/** Output type returned by a schema-like value after validation. */
|
|
@@ -117,7 +127,7 @@ declare global {
|
|
|
117
127
|
/** Resolver callback used by custom schema types registered with `Schema.extend()`. */
|
|
118
128
|
type Resolve = (data: any, schema: Schema, options: Options, strict?: boolean) => [any, any?];
|
|
119
129
|
/** Input type accepted by one schema in an intersection. */
|
|
120
|
-
type IntersectS<X> = From<X> extends Schema<infer S,
|
|
130
|
+
type IntersectS<X> = From<X> extends Schema<infer S, infer _T, infer _M> ? S : never;
|
|
121
131
|
/** Output type returned by one schema in an intersection. */
|
|
122
132
|
type IntersectT<X> = Inverse<From<X>> extends ((arg: infer T) => void) ? T : never;
|
|
123
133
|
type TupleS<X extends readonly any[]> = X extends readonly [infer L, ...infer R] ? [TypeS<L>?, ...TupleS<R>] : any[];
|
|
@@ -172,8 +182,8 @@ declare global {
|
|
|
172
182
|
dict<X, Y extends Schema<any, string> = Schema<string>>(inner: X, sKey?: Y): Schema<Dict<TypeS<X>, TypeS<Y>>, Dict<TypeT<X>, TypeT<Y>>>;
|
|
173
183
|
/** Accept tuple arrays where each index matches the corresponding schema. */
|
|
174
184
|
tuple<const X extends readonly any[]>(list: X): Schema<TupleS<X>, TupleT<X>>;
|
|
175
|
-
/** Accept plain objects
|
|
176
|
-
object<X extends Dict>(dict: X): Schema<ObjectS<X
|
|
185
|
+
/** Accept plain objects; infer fields from the dictionary, not the enclosing schema's output type. */
|
|
186
|
+
object<X extends Dict>(dict: X): Schema<ObjectS<NoInfer<X>>, ObjectT<NoInfer<X>>>;
|
|
177
187
|
/** Accept values matching at least one schema in `list`. */
|
|
178
188
|
union<const X>(list: readonly X[]): Schema<TypeS<X>, TypeT<X>>;
|
|
179
189
|
/** Accept values matching every schema in `list`, merging object outputs. */
|
|
@@ -181,7 +191,7 @@ declare global {
|
|
|
181
191
|
/** Validate with `inner`, then convert the result with `callback`. */
|
|
182
192
|
transform<X, T>(inner: X, callback: (value: TypeS<X>, options: Schemastery.Options) => T, preserve?: boolean): Schema<TypeS<X>, T>;
|
|
183
193
|
/** Defer construction of a recursive schema until validation or serialization. */
|
|
184
|
-
lazy<X extends Schema
|
|
194
|
+
lazy<X extends Schema<any, any, SchemaMode>>(callback: () => X): X;
|
|
185
195
|
ValidationError: typeof ValidationError;
|
|
186
196
|
}
|
|
187
197
|
/** Runtime validation options shared by all schema calls. */
|
|
@@ -197,6 +207,8 @@ declare global {
|
|
|
197
207
|
interface Meta<T = any> {
|
|
198
208
|
default?: T extends {} ? Partial<T> : T;
|
|
199
209
|
required?: boolean;
|
|
210
|
+
/** Parse this node as a stable config reference; its type and UI metadata remain unchanged. */
|
|
211
|
+
volatile?: boolean;
|
|
200
212
|
disabled?: boolean;
|
|
201
213
|
collapse?: boolean;
|
|
202
214
|
badges?: {
|
|
@@ -220,9 +232,9 @@ declare global {
|
|
|
220
232
|
}
|
|
221
233
|
}
|
|
222
234
|
/** Callable schema instance that validates input and returns normalized output. */
|
|
223
|
-
interface Schemastery<S = any, T = S> {
|
|
224
|
-
(data?: S | null, options?: Schemastery.Options): T
|
|
225
|
-
new (data?: S | null, options?: Schemastery.Options): T
|
|
235
|
+
interface Schemastery<S = any, T = S, Mode extends SchemaMode = 'plain'> {
|
|
236
|
+
(data?: S | null, options?: Schemastery.Options): SchemaOutput<T, Mode>;
|
|
237
|
+
new (data?: S | null, options?: Schemastery.Options): SchemaOutput<T, Mode>;
|
|
226
238
|
[kSchema]: true;
|
|
227
239
|
uid: number;
|
|
228
240
|
meta: Schemastery.Meta<T>;
|
|
@@ -242,49 +254,54 @@ declare global {
|
|
|
242
254
|
/** Format this schema as a compact TypeScript-like type string. */
|
|
243
255
|
toString(inline?: boolean): string;
|
|
244
256
|
/** Serialize this schema, preserving shared and recursive references. */
|
|
245
|
-
toJSON(): Schema<S, T>;
|
|
257
|
+
toJSON(): Schema<S, T, Mode>;
|
|
246
258
|
/** Mark nullable input as invalid unless a default supplies a fallback. */
|
|
247
|
-
required(value?:
|
|
259
|
+
required<R extends boolean = true>(value?: R): Schema<S, T, SetRequired<Mode, R>>;
|
|
260
|
+
/**
|
|
261
|
+
* Parse this config field as a stable reference containing immutable data.
|
|
262
|
+
* @returns a schema whose output supports get(), including when the field is absent.
|
|
263
|
+
*/
|
|
264
|
+
volatile(): Schema<NoInfer<S>, NoInfer<T>, Mode extends 'defined' | 'volatile-defined' ? 'volatile-defined' : 'volatile'>;
|
|
248
265
|
/** Hide this schema node from UI renderers. */
|
|
249
|
-
hidden(value?: boolean): Schema<S, T>;
|
|
266
|
+
hidden(value?: boolean): Schema<S, T, Mode>;
|
|
250
267
|
/** Return the default value instead of throwing when validation fails. */
|
|
251
|
-
loose(value?: boolean): Schema<S, T>;
|
|
268
|
+
loose(value?: boolean): Schema<S, T, Mode>;
|
|
252
269
|
/** Attach a renderer role and optional role-specific metadata. */
|
|
253
|
-
role(text: string, extra?: any): Schema<S, T>;
|
|
270
|
+
role(text: string, extra?: any): Schema<S, T, Mode>;
|
|
254
271
|
/** Attach an external documentation link. */
|
|
255
|
-
link(link: string): Schema<S, T>;
|
|
272
|
+
link(link: string): Schema<S, T, Mode>;
|
|
256
273
|
/** Set the fallback value used for nullable input. */
|
|
257
|
-
default(value: T): Schema<S, T
|
|
274
|
+
default(value: T | NoInfer<Partial<S>>): Schema<S, T, SetRequired<Mode, true>>;
|
|
258
275
|
/** Attach an auxiliary comment for documentation or form UIs. */
|
|
259
|
-
comment(text: string): Schema<S, T>;
|
|
276
|
+
comment(text: string): Schema<S, T, Mode>;
|
|
260
277
|
/** Attach a localized or plain description for documentation or form UIs. */
|
|
261
|
-
description(text: string): Schema<S, T>;
|
|
278
|
+
description(text: string): Schema<S, T, Mode>;
|
|
262
279
|
/** Mark this schema node as disabled for form UIs. */
|
|
263
|
-
disabled(value?: boolean): Schema<S, T>;
|
|
280
|
+
disabled(value?: boolean): Schema<S, T, Mode>;
|
|
264
281
|
/** Request collapsed rendering for nested form UIs. */
|
|
265
|
-
collapse(value?: boolean): Schema<S, T>;
|
|
282
|
+
collapse(value?: boolean): Schema<S, T, Mode>;
|
|
266
283
|
/** Add a deprecated badge to this schema node. */
|
|
267
|
-
deprecated(): Schema<S, T>;
|
|
284
|
+
deprecated(): Schema<S, T, Mode>;
|
|
268
285
|
/** Add an experimental badge to this schema node. */
|
|
269
|
-
experimental(): Schema<S, T>;
|
|
286
|
+
experimental(): Schema<S, T, Mode>;
|
|
270
287
|
/** Require strings to match a regular expression. */
|
|
271
|
-
pattern(regexp: RegExp): Schema<S, T>;
|
|
288
|
+
pattern(regexp: RegExp): Schema<S, T, Mode>;
|
|
272
289
|
/** Set an inclusive maximum for numbers or collection lengths. */
|
|
273
|
-
max(value: number): Schema<S, T>;
|
|
290
|
+
max(value: number): Schema<S, T, Mode>;
|
|
274
291
|
/** Set an inclusive minimum for numbers or collection lengths. */
|
|
275
|
-
min(value: number): Schema<S, T>;
|
|
292
|
+
min(value: number): Schema<S, T, Mode>;
|
|
276
293
|
/** Set the numeric increment constraint. */
|
|
277
|
-
step(value: number): Schema<S, T>;
|
|
294
|
+
step(value: number): Schema<S, T, Mode>;
|
|
278
295
|
/** Add or replace an object property schema. */
|
|
279
|
-
set(key: string, value: Schema): Schema<S, T>;
|
|
296
|
+
set(key: string, value: Schema): Schema<S, T, Mode>;
|
|
280
297
|
/** Append a tuple, union, or intersection member schema. */
|
|
281
|
-
push(value: Schema): Schema<S, T>;
|
|
298
|
+
push(value: Schema): Schema<S, T, Mode>;
|
|
282
299
|
/** Remove values equal to schema defaults from normalized output. */
|
|
283
300
|
simplify(value?: any): any;
|
|
284
301
|
/** Return a schema clone with descriptions merged from locale messages. */
|
|
285
|
-
i18n(messages: Dict): Schema<S, T>;
|
|
302
|
+
i18n(messages: Dict): Schema<S, T, Mode>;
|
|
286
303
|
/** Attach arbitrary metadata consumed by form renderers and downstream tools. */
|
|
287
|
-
extra<K extends keyof Schemastery.Meta>(key: K, value: Schemastery.Meta[K]): Schema<S, T>;
|
|
304
|
+
extra<K extends keyof Schemastery.Meta>(key: K, value: Schemastery.Meta[K]): Schema<S, T, Mode>;
|
|
288
305
|
}
|
|
289
306
|
}
|
|
290
307
|
declare class ValidationError extends TypeError {
|
|
@@ -293,7 +310,10 @@ declare class ValidationError extends TypeError {
|
|
|
293
310
|
constructor(message: string, options: Schemastery.Options);
|
|
294
311
|
static is(error: any): error is ValidationError;
|
|
295
312
|
}
|
|
296
|
-
type
|
|
313
|
+
type SchemaMode = 'plain' | 'defined' | 'volatile' | 'volatile-defined';
|
|
314
|
+
type SchemaOutput<T, M extends SchemaMode> = M extends 'volatile' ? Volatile<T | undefined> : M extends 'volatile-defined' ? Volatile<T> : T;
|
|
315
|
+
type SetRequired<M extends SchemaMode, R extends boolean> = M extends 'volatile' | 'volatile-defined' ? R extends true ? 'volatile-defined' : 'volatile' : R extends true ? 'defined' : 'plain';
|
|
316
|
+
type Schema<S = any, T = S, Mode extends SchemaMode = 'plain'> = Schemastery<S, T, Mode>;
|
|
297
317
|
declare const Schema: Schemastery.Static;
|
|
298
318
|
//#endregion
|
|
299
319
|
//#region ../../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/json-schema.d.cts
|
|
@@ -2511,20 +2531,24 @@ declare class SessionProjectionCache extends Service {
|
|
|
2511
2531
|
private recordFor;
|
|
2512
2532
|
/**
|
|
2513
2533
|
* The zero-I/O listing read: whole values viewed straight from the stored
|
|
2514
|
-
* rows (version-matching keys only)
|
|
2515
|
-
*
|
|
2516
|
-
*
|
|
2517
|
-
*
|
|
2518
|
-
*
|
|
2519
|
-
*
|
|
2534
|
+
* rows (version-matching keys only) of the record bound to the caller's
|
|
2535
|
+
* lifecycle. The header is the only identity witness a listing holds, so
|
|
2536
|
+
* this face matches the lifecycle identity (`formatVersion`, `createdAt`,
|
|
2537
|
+
* `cwd`, `isSeeded`) and not the inherited cut: within one format
|
|
2538
|
+
* generation the cut is fixed at fork time, so it distinguishes no
|
|
2539
|
+
* lifecycle the other fields do not, and a viewed value never seeds a fold.
|
|
2540
|
+
* The view is as stale as the last durable checkpoint but never wrong and
|
|
2541
|
+
* never from an unrelated log. Its `asOfSeq` is the lowest watermark among
|
|
2542
|
+
* the served rows: the stored record's own position, which the header
|
|
2543
|
+
* cannot relate to the log the caller later opens. The Session list
|
|
2544
|
+
* therefore labels the block as cached, and the client lets every value the
|
|
2545
|
+
* connected Session produces supersede it whatever this number says.
|
|
2520
2546
|
* @param meta - the listed session's header (identity witness; no log read).
|
|
2521
|
-
* @param inheritedEventCount - exact inherited prefix length that completes
|
|
2522
|
-
* the checkpoint identity.
|
|
2523
2547
|
* @param keys - optional projection keys required by the caller's audience.
|
|
2524
|
-
* @returns the
|
|
2525
|
-
*
|
|
2548
|
+
* @returns the viewed block, or `undefined` when no usable row exists for
|
|
2549
|
+
* this lifecycle at the current Session format.
|
|
2526
2550
|
*/
|
|
2527
|
-
cachedSnapshot(meta: SessionHeader$1,
|
|
2551
|
+
cachedSnapshot(meta: SessionHeader$1, keys?: readonly Extract<keyof SessionProjectionMap, string>[]): ProjectionSnapshot | undefined;
|
|
2528
2552
|
/**
|
|
2529
2553
|
* Read only a predecessor checkpoint's title as a zero-I/O listing hint.
|
|
2530
2554
|
*
|
|
@@ -2534,16 +2558,20 @@ declare class SessionProjectionCache extends Service {
|
|
|
2534
2558
|
* fact from this Session. The registry still requires the current title
|
|
2535
2559
|
* projection's row version and schema. No other predecessor projection is
|
|
2536
2560
|
* exposed: format normalization can change their current meaning, and the
|
|
2537
|
-
*
|
|
2561
|
+
* {@link cachedSnapshot} / hydration paths continue to reject them.
|
|
2538
2562
|
* @param meta - authoritative listed Session header.
|
|
2539
|
-
* @
|
|
2540
|
-
*
|
|
2541
|
-
*
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2563
|
+
* @returns a title-only block at the stored title row's watermark, or
|
|
2564
|
+
* `undefined` when the record is current, newer, unrelated, missing, or
|
|
2565
|
+
* incompatible with the title unit.
|
|
2566
|
+
*/
|
|
2567
|
+
cachedPredecessorTitle(meta: SessionHeader$1): ProjectionSnapshot | undefined;
|
|
2568
|
+
/**
|
|
2569
|
+
* View selected wire rows as one block bound to the lowest served
|
|
2570
|
+
* watermark: the seq every served value has folded through at least. The
|
|
2571
|
+
* number is the record's own; whether a consumer may compare it with a
|
|
2572
|
+
* live Session's seqs is decided by the face that serves the block, not
|
|
2573
|
+
* here.
|
|
2574
|
+
*/
|
|
2547
2575
|
private viewRecord;
|
|
2548
2576
|
/**
|
|
2549
2577
|
* Hydrate projection cells for an already-prepared Session without another
|
|
@@ -2627,6 +2655,34 @@ declare module '@deepseek-ai/dsh-typert-protocol' {
|
|
|
2627
2655
|
};
|
|
2628
2656
|
}
|
|
2629
2657
|
}
|
|
2658
|
+
/**
|
|
2659
|
+
* Activity families a `workspace/session-activity` listener may report. This
|
|
2660
|
+
* package declares none: each provider merges its own key from a module both
|
|
2661
|
+
* its Host and Client faces import, so a consumer that renders the families
|
|
2662
|
+
* sees exactly the keys its program compiled and falls through to a generic
|
|
2663
|
+
* description for any other. The shipped providers merge `turn` (the Agent
|
|
2664
|
+
* registry), `job` (the job registry seam), `subagent` (the Subagent
|
|
2665
|
+
* runtime), and `schedule` (the Schedule plugin).
|
|
2666
|
+
*/
|
|
2667
|
+
interface SessionActivityKindMap {}
|
|
2668
|
+
/** One activity family key. */
|
|
2669
|
+
type SessionActivityKind = keyof SessionActivityKindMap;
|
|
2670
|
+
/** One active item of a family that has per-item identity. */
|
|
2671
|
+
interface SessionActivityItem {
|
|
2672
|
+
/** Family-specific identity: a session id, a job id, or a schedule id. */
|
|
2673
|
+
readonly id: string;
|
|
2674
|
+
/** Display label when the family carries one (a job label, a subagent label). */
|
|
2675
|
+
readonly label?: string;
|
|
2676
|
+
}
|
|
2677
|
+
/**
|
|
2678
|
+
* One reason a session counts as active for archive admission. Families with
|
|
2679
|
+
* per-item identity list their items so a caller can name what must stop.
|
|
2680
|
+
*/
|
|
2681
|
+
interface SessionActivity {
|
|
2682
|
+
readonly kind: SessionActivityKind;
|
|
2683
|
+
/** Active items of the family; absent for a family without per-item identity (`turn`). */
|
|
2684
|
+
readonly items?: readonly SessionActivityItem[];
|
|
2685
|
+
}
|
|
2630
2686
|
/**
|
|
2631
2687
|
* One workspace: a stable id over an existing directory, a display title, and
|
|
2632
2688
|
* an ordered candidate account of sessions. Membership requires both an id in
|
|
@@ -2715,10 +2771,52 @@ type WorkspaceId = WorkspaceId$1;
|
|
|
2715
2771
|
* @returns the same string, branded at compile time.
|
|
2716
2772
|
*/
|
|
2717
2773
|
declare function WorkspaceId(id: string): WorkspaceId;
|
|
2774
|
+
/** The session an archive request is about to write into the archive set. */
|
|
2775
|
+
interface SessionActivityRequest {
|
|
2776
|
+
readonly sessionId: SessionId;
|
|
2777
|
+
}
|
|
2778
|
+
/** Caller choices for {@link WorkspaceRegistry.archiveSession}. */
|
|
2779
|
+
interface ArchiveSessionOptions {
|
|
2780
|
+
/**
|
|
2781
|
+
* Ask the composed providers to stop the session's running work instead of
|
|
2782
|
+
* refusing the archive because of it. The archive is written first, then
|
|
2783
|
+
* the stops are requested; running work is never awaited to settlement, and
|
|
2784
|
+
* a provider failure is logged without undoing the archive.
|
|
2785
|
+
*/
|
|
2786
|
+
readonly stopActivity?: boolean;
|
|
2787
|
+
}
|
|
2718
2788
|
declare module '@deepseek-ai/cordis' {
|
|
2719
2789
|
interface Context {
|
|
2720
2790
|
workspaceRegistry: WorkspaceRegistry;
|
|
2721
2791
|
}
|
|
2792
|
+
interface Events {
|
|
2793
|
+
/**
|
|
2794
|
+
* Ask the composed providers what still runs for a session before it is
|
|
2795
|
+
* archived. A listener prepends its own {@link SessionActivity} entries to
|
|
2796
|
+
* the result of `next()`; the registry's innermost callback returns an
|
|
2797
|
+
* empty list, so a composition without providers archives freely. Any
|
|
2798
|
+
* non-empty result refuses the archive without a write.
|
|
2799
|
+
* @param request - the session about to be archived.
|
|
2800
|
+
* @param next - delegate to the remaining providers.
|
|
2801
|
+
* @mode waterfall
|
|
2802
|
+
*/
|
|
2803
|
+
'workspace/session-activity'(request: SessionActivityRequest, next: () => Promise<readonly SessionActivity[]>): Promise<readonly SessionActivity[]>;
|
|
2804
|
+
/**
|
|
2805
|
+
* Stop a session's running work because the caller archived it with
|
|
2806
|
+
* `stopActivity`; the archive set is durable when this dispatches. Each
|
|
2807
|
+
* provider stops its own families — cancelling a turn, its subagent
|
|
2808
|
+
* descendants, owned jobs, or active schedules — through the same cancel
|
|
2809
|
+
* paths the user's own stop actions use, so the session log ends every
|
|
2810
|
+
* open turn regularly and a later unarchive can continue the
|
|
2811
|
+
* conversation. Listeners issue their stop requests without waiting for
|
|
2812
|
+
* running work to settle; a listener may await its own durability
|
|
2813
|
+
* barrier. A rejection is logged by the registry and does not undo the
|
|
2814
|
+
* archive.
|
|
2815
|
+
* @param request - the session being archived.
|
|
2816
|
+
* @mode parallel
|
|
2817
|
+
*/
|
|
2818
|
+
'workspace/session-stop'(request: SessionActivityRequest): Promise<void> | void;
|
|
2819
|
+
}
|
|
2722
2820
|
}
|
|
2723
2821
|
/**
|
|
2724
2822
|
* Durable workspace registry. Startup waits for `sessionPersistence`, builds
|
|
@@ -2753,6 +2851,20 @@ declare class WorkspaceRegistry extends Service {
|
|
|
2753
2851
|
* @returns the existing or newly durable workspace.
|
|
2754
2852
|
*/
|
|
2755
2853
|
create(path: string, title?: string): Promise<Workspace>;
|
|
2854
|
+
/**
|
|
2855
|
+
* Initialize the default Workspace only while both the registry and Session
|
|
2856
|
+
* history are empty. Repeated requests reuse its durable identity; deleting
|
|
2857
|
+
* that registration permanently disables automatic creation.
|
|
2858
|
+
* @param resolveDirectory - resolve the absolute directory and initial title;
|
|
2859
|
+
* called only for eligible creation, inside the registry mutation queue.
|
|
2860
|
+
* Missing directories are created recursively before registration.
|
|
2861
|
+
* After resolution, caller cancellation does not roll back creation or registration.
|
|
2862
|
+
* @returns the initialized Workspace, or undefined when automatic creation is ineligible.
|
|
2863
|
+
*/
|
|
2864
|
+
initializeDefault(resolveDirectory: () => Promise<{
|
|
2865
|
+
path: string;
|
|
2866
|
+
title: string;
|
|
2867
|
+
}>): Promise<Workspace | undefined>;
|
|
2756
2868
|
/**
|
|
2757
2869
|
* Look up a workspace by id.
|
|
2758
2870
|
* @param id - Workspace id.
|
|
@@ -2793,11 +2905,21 @@ declare class WorkspaceRegistry extends Service {
|
|
|
2793
2905
|
/**
|
|
2794
2906
|
* Archive one session durably. The session must exist (live or in session
|
|
2795
2907
|
* persistence); its workspace accounting — or lack of one — is irrelevant.
|
|
2796
|
-
*
|
|
2908
|
+
* Without `stopActivity` the session must also be inactive: the
|
|
2909
|
+
* `workspace/session-activity` waterfall is asked once, and any reported
|
|
2910
|
+
* activity rejects with {@link WorkspaceActiveSessionError} before anything
|
|
2911
|
+
* is written. With `stopActivity` the archive is written without an
|
|
2912
|
+
* activity check, and the `workspace/session-stop` providers are then asked
|
|
2913
|
+
* to stop the session's work: the durable archive set is what a provider's
|
|
2914
|
+
* `agent/pre-step` gate reads, so every wake the stops induce is already
|
|
2915
|
+
* blocked. Archiving drops the session's pin in the same durable write
|
|
2916
|
+
* (pinning and archival are mutually exclusive). An already archived id
|
|
2917
|
+
* resolves without writing, asking, or stopping.
|
|
2797
2918
|
* @param sessionId - The session to archive.
|
|
2798
|
-
* @
|
|
2919
|
+
* @param options - Whether running work is stopped instead of refusing.
|
|
2920
|
+
* @returns resolution after durability and, with `stopActivity`, after every stop request was issued.
|
|
2799
2921
|
*/
|
|
2800
|
-
archiveSession(sessionId: SessionId): Promise<void>;
|
|
2922
|
+
archiveSession(sessionId: SessionId, options?: ArchiveSessionOptions): Promise<void>;
|
|
2801
2923
|
/**
|
|
2802
2924
|
* Unarchive one session durably by dropping it from the registry-global
|
|
2803
2925
|
* archive set; the accounting slot was never touched, so the session
|
|
@@ -2809,6 +2931,29 @@ declare class WorkspaceRegistry extends Service {
|
|
|
2809
2931
|
* @returns resolution after durability.
|
|
2810
2932
|
*/
|
|
2811
2933
|
unarchiveSession(sessionId: SessionId): Promise<void>;
|
|
2934
|
+
/**
|
|
2935
|
+
* The registry-global pin set: sessions surfaced ahead of every unpinned
|
|
2936
|
+
* session on grouping surfaces. Pinning never touches workspace accounting.
|
|
2937
|
+
* @returns Session ids in pin order (most recently pinned first).
|
|
2938
|
+
*/
|
|
2939
|
+
get pinnedSessionIds(): readonly SessionId[];
|
|
2940
|
+
/**
|
|
2941
|
+
* Pin one session durably, prepending it to the registry-global pin set.
|
|
2942
|
+
* The session must exist (live or in session persistence) and must not be
|
|
2943
|
+
* archived. An already pinned id resolves without writing or reordering.
|
|
2944
|
+
* @param sessionId - The session to pin.
|
|
2945
|
+
* @returns resolution after durability.
|
|
2946
|
+
*/
|
|
2947
|
+
pinSession(sessionId: SessionId): Promise<void>;
|
|
2948
|
+
/**
|
|
2949
|
+
* Unpin one session durably by dropping it from the registry-global pin
|
|
2950
|
+
* set. Unpinning runs no session-existence check because removing an id
|
|
2951
|
+
* cannot introduce an unknown one, so an entry whose session is gone still
|
|
2952
|
+
* resolves. An id that is not pinned resolves without writing.
|
|
2953
|
+
* @param sessionId - The session to unpin.
|
|
2954
|
+
* @returns resolution after durability.
|
|
2955
|
+
*/
|
|
2956
|
+
unpinSession(sessionId: SessionId): Promise<void>;
|
|
2812
2957
|
/**
|
|
2813
2958
|
* Whether a session is live, header-indexed, or present in a fresh
|
|
2814
2959
|
* persistence listing. Only a definite miss returns false — a failing
|
|
@@ -2816,6 +2961,8 @@ declare class WorkspaceRegistry extends Service {
|
|
|
2816
2961
|
* masquerade as an unknown session.
|
|
2817
2962
|
*/
|
|
2818
2963
|
private sessionKnown;
|
|
2964
|
+
/** Request every provider's stop; a failing provider is logged, never a reason to keep the session visible. */
|
|
2965
|
+
private stopSessionActivity;
|
|
2819
2966
|
/**
|
|
2820
2967
|
* Resolve by canonical directory path without creating or mutating a
|
|
2821
2968
|
* workspace. A missing path rejects during `realpath`; an existing unowned
|
|
@@ -2854,364 +3001,6 @@ declare function parseJsonlArtifact(content: string): SessionStorageMetadata & {
|
|
|
2854
3001
|
events: SessionEvent$1[];
|
|
2855
3002
|
};
|
|
2856
3003
|
//#endregion
|
|
2857
|
-
//#region ../../../vendor/deepseek-harness/packages/settings/settings/lib/types/redact.d.ts
|
|
2858
|
-
/** One schema-declared secret position inside a redacted value. */
|
|
2859
|
-
interface RedactedSecret {
|
|
2860
|
-
/** Path from the section root to the removed field (concrete dict keys and array indexes included). */
|
|
2861
|
-
path: string[];
|
|
2862
|
-
/** Whether the field held a value before redaction. */
|
|
2863
|
-
set: boolean;
|
|
2864
|
-
}
|
|
2865
|
-
//#endregion
|
|
2866
|
-
//#region ../../../vendor/deepseek-harness/packages/settings/settings/lib/types/types.d.ts
|
|
2867
|
-
/** Nominal id of one registered settings namespace. */
|
|
2868
|
-
type SettingsNamespace = Branded<'SettingsNamespace'>;
|
|
2869
|
-
/** Origin of one committed settings change. */
|
|
2870
|
-
type SettingsUpdateSource = 'update' | 'provider';
|
|
2871
|
-
declare module '@deepseek-ai/cordis' {
|
|
2872
|
-
interface Events {
|
|
2873
|
-
/**
|
|
2874
|
-
* Committed change to one registered namespace's resolved value. Emitted
|
|
2875
|
-
* after the provider persisted (for `update`) or published (`provider`)
|
|
2876
|
-
* the change; never emitted when the resolved value is deep-equal.
|
|
2877
|
-
* Listener failures are contained and logged — a sync throw and an async
|
|
2878
|
-
* rejection alike — except `INVARIANT`-coded failures, which rethrow
|
|
2879
|
-
* after every listener ran; that rethrow reaches the emitter only from
|
|
2880
|
-
* synchronous listeners, so invariant checks on this event must not be
|
|
2881
|
-
* async functions.
|
|
2882
|
-
* @param ns - the namespace whose resolved value changed.
|
|
2883
|
-
* @param next - the new resolved value.
|
|
2884
|
-
* @param prev - the previous resolved value.
|
|
2885
|
-
* @param source - whether the change entered through `update()` or the provider.
|
|
2886
|
-
* @mode emit
|
|
2887
|
-
*/
|
|
2888
|
-
'settings/updated'(ns: SettingsNamespace, next: unknown, prev: unknown, source: SettingsUpdateSource): void;
|
|
2889
|
-
/**
|
|
2890
|
-
* One registered namespace's RAW user section changed, whether or not the
|
|
2891
|
-
* resolved value did. `settings/updated` is the consumer-facing event and
|
|
2892
|
-
* stays deep-equal-gated; this one exists for configuration surfaces,
|
|
2893
|
-
* which must learn that a field went from inherited to overridden (same
|
|
2894
|
-
* resolved value, different meaning) and that their held revision is
|
|
2895
|
-
* stale. Listener containment matches `settings/updated`.
|
|
2896
|
-
* @param ns - the namespace whose stored section changed.
|
|
2897
|
-
* @param revision - the namespace's new revision.
|
|
2898
|
-
* @mode emit
|
|
2899
|
-
*/
|
|
2900
|
-
'settings/document-updated'(ns: SettingsNamespace, revision: number): void;
|
|
2901
|
-
}
|
|
2902
|
-
}
|
|
2903
|
-
//#endregion
|
|
2904
|
-
//#region ../../../vendor/deepseek-harness/packages/settings/settings/lib/types/index.d.ts
|
|
2905
|
-
type LowercaseLetter = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z';
|
|
2906
|
-
type DecimalDigit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
|
|
2907
|
-
type NamespaceCharacter = LowercaseLetter | DecimalDigit | '-';
|
|
2908
|
-
type ValidNamespaceTail<Value extends string> = Value extends '' ? true : Value extends `${NamespaceCharacter}${infer Rest}` ? ValidNamespaceTail<Rest> : false;
|
|
2909
|
-
type SettingsNamespaceInput<Value extends string> = Value extends SettingsNamespace ? Value : string extends Value ? string : Value extends `${LowercaseLetter}${infer Rest}` ? ValidNamespaceTail<Rest> extends true ? Value : never : never;
|
|
2910
|
-
/** When a namespace's changes take effect for its owner. */
|
|
2911
|
-
type SettingsApplies = 'live' | 'restart';
|
|
2912
|
-
/** Registration options beyond the namespace schema. */
|
|
2913
|
-
interface SettingsRegisterOptions<T> {
|
|
2914
|
-
/** Composition-layer values resolved below the user layer (entry-config subset). */
|
|
2915
|
-
base?: Partial<T>;
|
|
2916
|
-
/** Owner's effect timing, surfaced to configuration UIs; defaults to `live`. */
|
|
2917
|
-
applies?: SettingsApplies;
|
|
2918
|
-
/**
|
|
2919
|
-
* Reject a resolved section the owner could not act on, for constraints its
|
|
2920
|
-
* schema cannot express — a cross-field requirement, or one field's validity
|
|
2921
|
-
* depending on another's. Throwing here refuses the *write* that produced the
|
|
2922
|
-
* value, so a caller learns at `update`/`replace`/`mutate` instead of storing
|
|
2923
|
-
* something that would silently disable the owner.
|
|
2924
|
-
*
|
|
2925
|
-
* Kept separate from the schema because the schema is also what a
|
|
2926
|
-
* configuration surface renders and what an absent section resolves through;
|
|
2927
|
-
* folding a cross-field check into it would change both.
|
|
2928
|
-
*
|
|
2929
|
-
* Once the owner is registered, a stored section that fails this keeps the
|
|
2930
|
-
* namespace's last good value and warns, exactly as a schema failure does,
|
|
2931
|
-
* so an externally edited document cannot strand a running owner. At
|
|
2932
|
-
* registration there is no last good value yet, so a stored section that
|
|
2933
|
-
* already fails rejects the registration itself — again exactly as a schema
|
|
2934
|
-
* failure does.
|
|
2935
|
-
* @param value - the resolved section, schema-valid by construction.
|
|
2936
|
-
*/
|
|
2937
|
-
validate?: (value: T) => void;
|
|
2938
|
-
}
|
|
2939
|
-
/** One registered namespace as surfaced to configuration UIs. */
|
|
2940
|
-
interface SettingsDescriptor {
|
|
2941
|
-
/** The registered namespace. */
|
|
2942
|
-
ns: SettingsNamespace;
|
|
2943
|
-
/** Serialized schemastery schema (`schema.toJSON()`). */
|
|
2944
|
-
schema: unknown;
|
|
2945
|
-
/** Current resolved value. */
|
|
2946
|
-
value: unknown;
|
|
2947
|
-
/**
|
|
2948
|
-
* Monotonic revision of the raw user section this descriptor was read at.
|
|
2949
|
-
* Send it back as `expectedRevision` on a write to refuse a stale one.
|
|
2950
|
-
*/
|
|
2951
|
-
revision: number;
|
|
2952
|
-
/** Registrant's composition `base` layer (detached), when one was declared. */
|
|
2953
|
-
base?: unknown;
|
|
2954
|
-
/**
|
|
2955
|
-
* Raw user section from the stored document (detached), when one exists and
|
|
2956
|
-
* is well-formed; a field's presence here is what marks it user-overridden.
|
|
2957
|
-
*/
|
|
2958
|
-
user?: unknown;
|
|
2959
|
-
/** Owner's declared effect timing. */
|
|
2960
|
-
applies: SettingsApplies;
|
|
2961
|
-
/** Schema-declared secret positions; present only under `redactSecrets`. */
|
|
2962
|
-
secrets?: RedactedSecret[];
|
|
2963
|
-
}
|
|
2964
|
-
/** Options for {@link SettingsProvider.describe}. */
|
|
2965
|
-
interface SettingsDescribeOptions {
|
|
2966
|
-
/**
|
|
2967
|
-
* Strip `role('secret')` fields from `value`/`base`/`user` and enumerate
|
|
2968
|
-
* them in each descriptor's `secrets`. Every wire surface MUST pass this;
|
|
2969
|
-
* the verbatim default exists for same-process configuration UIs only.
|
|
2970
|
-
*/
|
|
2971
|
-
redactSecrets?: boolean;
|
|
2972
|
-
}
|
|
2973
|
-
/** Owner-facing handle for one registered namespace. */
|
|
2974
|
-
interface SettingsScope<T> {
|
|
2975
|
-
/** Current resolved value: schema defaults, then `base`, then the user layer. */
|
|
2976
|
-
get(): T;
|
|
2977
|
-
/**
|
|
2978
|
-
* Observe committed changes to this namespace's resolved value. Invocations
|
|
2979
|
-
* of one callback run asynchronously, one at a time, in commit order; a
|
|
2980
|
-
* rejection is contained and logged like a sync throw. After the disposer
|
|
2981
|
-
* returns, no further invocation starts — one already queued is skipped;
|
|
2982
|
-
* one already started still settles, and service disposal waits for it.
|
|
2983
|
-
* @param callback - invoked after each commit with the next and previous values.
|
|
2984
|
-
* @returns the disposer removing this observer.
|
|
2985
|
-
*/
|
|
2986
|
-
watch(callback: (next: T, prev: T) => void | Promise<void>): () => void;
|
|
2987
|
-
/**
|
|
2988
|
-
* Merge a partial patch into this namespace's user layer and persist it.
|
|
2989
|
-
* @param patch - plain-object patch over the user section; JSON-compatible data
|
|
2990
|
-
* only (non-JSON values reject with their path before anything persists).
|
|
2991
|
-
*/
|
|
2992
|
-
update(patch: object): Promise<void>;
|
|
2993
|
-
/**
|
|
2994
|
-
* Replace this namespace's user section wholesale; absent keys re-inherit
|
|
2995
|
-
* the composition `base` and schema defaults (`replace({})` resets all).
|
|
2996
|
-
* @param section - the complete next user section; JSON-compatible data only,
|
|
2997
|
-
* as for {@link update}.
|
|
2998
|
-
*/
|
|
2999
|
-
replace(section: object): Promise<void>;
|
|
3000
|
-
}
|
|
3001
|
-
declare module '@deepseek-ai/cordis' {
|
|
3002
|
-
interface Context {
|
|
3003
|
-
settings: SettingsProvider;
|
|
3004
|
-
}
|
|
3005
|
-
}
|
|
3006
|
-
/**
|
|
3007
|
-
* One path-addressed edit to a namespace's user section. Path mutation exists
|
|
3008
|
-
* for a caller holding an INCOMPLETE view of the section — a configuration UI
|
|
3009
|
-
* reads the redacted descriptor, which by construction never received the
|
|
3010
|
-
* `role('secret')` fields. Such a caller can name the field it means without
|
|
3011
|
-
* restating the section: a wholesale `replace` rebuilt from a redacted
|
|
3012
|
-
* document silently deletes every secret the wire never returned.
|
|
3013
|
-
*/
|
|
3014
|
-
type SettingsPathOp = {
|
|
3015
|
-
op: 'set';
|
|
3016
|
-
path: readonly string[];
|
|
3017
|
-
value: unknown;
|
|
3018
|
-
} | {
|
|
3019
|
-
op: 'unset';
|
|
3020
|
-
path: readonly string[];
|
|
3021
|
-
};
|
|
3022
|
-
/**
|
|
3023
|
-
* Abstract settings service. Providers implement raw-document storage
|
|
3024
|
-
* (`load`/`persist`) and push external changes through {@link Settings.publish};
|
|
3025
|
-
* the base class owns namespace registration, resolution, validation, change
|
|
3026
|
-
* detection, and the `settings/updated` commit event.
|
|
3027
|
-
*/
|
|
3028
|
-
declare abstract class SettingsProvider extends Service {
|
|
3029
|
-
private readonly registrations;
|
|
3030
|
-
/** Latest published raw document; empty until the provider's first publish. */
|
|
3031
|
-
private document;
|
|
3032
|
-
/** Per-namespace write chains; settled tails, so a failure never poisons the queue. */
|
|
3033
|
-
private readonly writeQueues;
|
|
3034
|
-
/** In-flight watcher invocation segments, drained by the dispose teardown. */
|
|
3035
|
-
private readonly pendingTails;
|
|
3036
|
-
/** Set at service dispose: refuse new writes while queued ones drain. */
|
|
3037
|
-
private stopped;
|
|
3038
|
-
/** Opaque read of {@link stopped}: control flow cannot narrow it across awaits. */
|
|
3039
|
-
private isStopped;
|
|
3040
|
-
constructor(ctx: Context);
|
|
3041
|
-
/**
|
|
3042
|
-
* Load the provider's document once and publish it before the service
|
|
3043
|
-
* becomes injectable, and register the write-drain teardown. Providers with
|
|
3044
|
-
* their own init (watchers, connections) delegate here first via
|
|
3045
|
-
* `yield* super[Service.init]()`; their disposers then run before the drain.
|
|
3046
|
-
*/
|
|
3047
|
-
[Service.init](): AsyncGenerator<() => Promise<void> | void, void, void>;
|
|
3048
|
-
/** Whether {@link update} may persist through this provider. */
|
|
3049
|
-
abstract readonly writable: boolean;
|
|
3050
|
-
/**
|
|
3051
|
-
* Absolute path of the provider's user-editable document, when its storage
|
|
3052
|
-
* is one local file. Configuration surfaces use this only as availability
|
|
3053
|
-
* metadata; the guarded open operation resolves the path again Host-side.
|
|
3054
|
-
* Non-file providers leave it undefined and expose no open-document affordance.
|
|
3055
|
-
* @returns the absolute local document path, or undefined for non-file storage.
|
|
3056
|
-
*/
|
|
3057
|
-
get documentPath(): string | undefined;
|
|
3058
|
-
/**
|
|
3059
|
-
* Prepare the provider's user-editable document for a native editor. File
|
|
3060
|
-
* providers may materialize an absent document before returning its path;
|
|
3061
|
-
* non-file providers return undefined.
|
|
3062
|
-
* @returns the absolute local document path, or undefined for non-file storage.
|
|
3063
|
-
*/
|
|
3064
|
-
prepareDocument(): Promise<string | undefined>;
|
|
3065
|
-
/**
|
|
3066
|
-
* Read the provider's current raw document (namespace to raw section).
|
|
3067
|
-
* @returns the detached raw document.
|
|
3068
|
-
*/
|
|
3069
|
-
protected abstract load(): Promise<Record<string, unknown>>;
|
|
3070
|
-
/**
|
|
3071
|
-
* Durably store one namespace's merged user section.
|
|
3072
|
-
* @param ns - the namespace being written.
|
|
3073
|
-
* @param section - the complete merged user section to store.
|
|
3074
|
-
*/
|
|
3075
|
-
protected abstract persist(ns: SettingsNamespace, section: Record<string, unknown>): Promise<void>;
|
|
3076
|
-
/**
|
|
3077
|
-
* Register a namespace schema and receive its owner scope. The registration
|
|
3078
|
-
* is an effect on the calling plugin's fiber: disposing that fiber removes
|
|
3079
|
-
* the namespace and its observers. An invalid stored section fails the
|
|
3080
|
-
* registration itself — the earliest point where the schema can judge it.
|
|
3081
|
-
* @param ns - unique namespace; duplicate registration fails loud.
|
|
3082
|
-
* @param schema - schemastery schema resolving this namespace's value.
|
|
3083
|
-
* @param options - composition `base` layer and effect timing.
|
|
3084
|
-
* @returns the owner scope for reads, observation, and updates.
|
|
3085
|
-
* @throws {TypeError} when `ns` is not a lowercase hyphenated identifier.
|
|
3086
|
-
*/
|
|
3087
|
-
register<const Namespace extends string, T>(ns: Namespace & SettingsNamespaceInput<Namespace>, schema: Schema<T>, options?: SettingsRegisterOptions<T>): SettingsScope<T>;
|
|
3088
|
-
/**
|
|
3089
|
-
* Attach one optional-settings consumer to this provider. The consumer
|
|
3090
|
-
* registers its composition entry as the base layer while this provider is
|
|
3091
|
-
* present, then falls back to that entry if the provider detaches.
|
|
3092
|
-
* @param owner - consumer context whose unload suppresses fallback work.
|
|
3093
|
-
* @param ns - consumer-owned settings namespace.
|
|
3094
|
-
* @param schema - schema resolving the namespace.
|
|
3095
|
-
* @param entry - composition entry used as the base and fallback value.
|
|
3096
|
-
* @param hooks - source sink, change notification, and optional validation.
|
|
3097
|
-
* @throws {TypeError} when `ns` is not a lowercase hyphenated identifier.
|
|
3098
|
-
*/
|
|
3099
|
-
installSection<const Namespace extends string, T>(owner: Context, ns: Namespace & SettingsNamespaceInput<Namespace>, schema: Schema<T>, entry: T, hooks: SettingsSectionHooks<T>): void;
|
|
3100
|
-
/**
|
|
3101
|
-
* Describe every registered namespace for configuration surfaces, including
|
|
3102
|
-
* the composition `base` and raw user layers so a form can mark which fields
|
|
3103
|
-
* the user overrode (presence in `user`) and what a reset returns to.
|
|
3104
|
-
* @param options - redaction switch; wire surfaces must redact.
|
|
3105
|
-
* @returns one descriptor per registered namespace, in registration order.
|
|
3106
|
-
*/
|
|
3107
|
-
describe(options?: SettingsDescribeOptions): SettingsDescriptor[];
|
|
3108
|
-
/**
|
|
3109
|
-
* Read one registered namespace's resolved value.
|
|
3110
|
-
* @param ns - the namespace to read.
|
|
3111
|
-
* @returns the resolved value, or `undefined` while unregistered.
|
|
3112
|
-
* @throws {TypeError} when `ns` is not a lowercase hyphenated identifier.
|
|
3113
|
-
*/
|
|
3114
|
-
get<const Namespace extends string>(ns: Namespace & SettingsNamespaceInput<Namespace>): unknown;
|
|
3115
|
-
/**
|
|
3116
|
-
* Merge a patch into one registered namespace's user layer, validate the
|
|
3117
|
-
* resolved candidate, persist through the provider, then commit and emit.
|
|
3118
|
-
* A validation failure rejects before anything is persisted. Writes to one
|
|
3119
|
-
* namespace are serialized: concurrent updates apply in call order, each
|
|
3120
|
-
* merging over the previous write's committed section.
|
|
3121
|
-
* @param ns - the registered namespace to update.
|
|
3122
|
-
* @param patch - plain-object patch over the user section.
|
|
3123
|
-
* @param expectedRevision - the descriptor `revision` the caller read; a
|
|
3124
|
-
* namespace that moved past it rejects with {@link SettingsConflictError}.
|
|
3125
|
-
* @throws {TypeError} when `ns` is not a lowercase hyphenated identifier.
|
|
3126
|
-
*/
|
|
3127
|
-
update<const Namespace extends string>(ns: Namespace & SettingsNamespaceInput<Namespace>, patch: object, expectedRevision?: number): Promise<void>;
|
|
3128
|
-
/**
|
|
3129
|
-
* Replace one registered namespace's user section wholesale, validate,
|
|
3130
|
-
* persist, then commit and emit. Keys absent from `section` fall back to the
|
|
3131
|
-
* composition `base` and schema defaults — this is the removal/reset path a
|
|
3132
|
-
* merge-only patch cannot express (`replace({})` re-inherits everything).
|
|
3133
|
-
* @param ns - the registered namespace to replace.
|
|
3134
|
-
* @param section - the complete next user section.
|
|
3135
|
-
* @param expectedRevision - the descriptor `revision` the caller read; a
|
|
3136
|
-
* namespace that moved past it rejects with {@link SettingsConflictError}.
|
|
3137
|
-
* @throws {TypeError} when `ns` is not a lowercase hyphenated identifier.
|
|
3138
|
-
*/
|
|
3139
|
-
replace<const Namespace extends string>(ns: Namespace & SettingsNamespaceInput<Namespace>, section: object, expectedRevision?: number): Promise<void>;
|
|
3140
|
-
/**
|
|
3141
|
-
* Apply path-addressed edits to one registered namespace's user section,
|
|
3142
|
-
* validate, persist, then commit and emit. The ops are applied to the
|
|
3143
|
-
* section as it stands when the write reaches the front of the queue, so a
|
|
3144
|
-
* caller never has to restate fields it did not touch — and, crucially,
|
|
3145
|
-
* cannot delete fields it never saw. This is the write path for any caller
|
|
3146
|
-
* holding a redacted view; `replace` remains the wholesale reset.
|
|
3147
|
-
* @param ns - the registered namespace to edit.
|
|
3148
|
-
* @param ops - ordered path edits; later ops observe earlier ones.
|
|
3149
|
-
* @param expectedRevision - the descriptor `revision` the caller read; a
|
|
3150
|
-
* namespace that moved past it rejects with {@link SettingsConflictError}.
|
|
3151
|
-
* @throws {TypeError} when `ns` is not a lowercase hyphenated identifier.
|
|
3152
|
-
*/
|
|
3153
|
-
mutate<const Namespace extends string>(ns: Namespace & SettingsNamespaceInput<Namespace>, ops: readonly SettingsPathOp[], expectedRevision?: number): Promise<void>;
|
|
3154
|
-
/** Validate a write, then queue it on the namespace's serialized write chain. */
|
|
3155
|
-
private write;
|
|
3156
|
-
/**
|
|
3157
|
-
* Provider hook: commit a complete raw document observed in storage. Each
|
|
3158
|
-
* registered namespace re-resolves; an invalid section keeps that
|
|
3159
|
-
* namespace's last good value and warns, other namespaces still commit.
|
|
3160
|
-
* @param doc - the detached raw document (unregistered sections preserved).
|
|
3161
|
-
* @param source - change origin; defaults to `provider`.
|
|
3162
|
-
*/
|
|
3163
|
-
protected publish(doc: Record<string, unknown>, source?: SettingsUpdateSource): void;
|
|
3164
|
-
/** Read one namespace's raw user section, rejecting non-object sections. */
|
|
3165
|
-
private section;
|
|
3166
|
-
/** Resolve one namespace value: schema defaults, then `base`, then the user layer. */
|
|
3167
|
-
private resolve;
|
|
3168
|
-
/**
|
|
3169
|
-
* Advance a namespace's revision when its RAW section changed, and announce
|
|
3170
|
-
* it. Deliberately independent of {@link commit}'s resolved-value equality:
|
|
3171
|
-
* storing an override equal to the composition base leaves the resolved
|
|
3172
|
-
* value alone but changes what the document says, which is exactly what a
|
|
3173
|
-
* configuration surface must re-read.
|
|
3174
|
-
*/
|
|
3175
|
-
private bumpRevision;
|
|
3176
|
-
/** Contained fan-out of `settings/document-updated`, mirroring {@link commit}'s. */
|
|
3177
|
-
private emitDocumentUpdated;
|
|
3178
|
-
/** Commit a resolved value when changed: swap, notify watchers, emit the event. */
|
|
3179
|
-
private commit;
|
|
3180
|
-
/** Contained-watcher diagnostic shared by the sync and async failure paths. */
|
|
3181
|
-
private warnWatcherFailure;
|
|
3182
|
-
/** Contained-listener diagnostic shared by the sync and async failure paths. */
|
|
3183
|
-
private warnListenerFailure;
|
|
3184
|
-
}
|
|
3185
|
-
/** Hooks a consumer hands to {@link SettingsProvider.installSection}. */
|
|
3186
|
-
interface SettingsSectionHooks<T> {
|
|
3187
|
-
/**
|
|
3188
|
-
* Receive the active configuration source: the resolved settings scope
|
|
3189
|
-
* while one is attached, the composition entry otherwise. Called before
|
|
3190
|
-
* the matching `onChange` at attach and at detach.
|
|
3191
|
-
* @param current - thunk returning the currently authoritative value.
|
|
3192
|
-
*/
|
|
3193
|
-
setSource(current: () => T): void;
|
|
3194
|
-
/**
|
|
3195
|
-
* Re-judge anything derived from the source — registration-level facts,
|
|
3196
|
-
* memoized resolutions — after an attach, a detach, or a committed change.
|
|
3197
|
-
*/
|
|
3198
|
-
onChange(): void;
|
|
3199
|
-
/**
|
|
3200
|
-
* Reject a resolved section this consumer could not act on, for constraints
|
|
3201
|
-
* its schema cannot express. See {@link SettingsRegisterOptions.validate}.
|
|
3202
|
-
* @param value - the resolved section, schema-valid by construction.
|
|
3203
|
-
*/
|
|
3204
|
-
validate?: (value: T) => void;
|
|
3205
|
-
}
|
|
3206
|
-
//#endregion
|
|
3207
|
-
//#region ../session-rdb/src/testing/helpers.d.ts
|
|
3208
|
-
declare class EmptySettings extends SettingsProvider {
|
|
3209
|
-
constructor(ctx: Context);
|
|
3210
|
-
get writable(): boolean;
|
|
3211
|
-
protected load(): Promise<Record<string, unknown>>;
|
|
3212
|
-
protected persist(_ns: SettingsNamespace, _section: Record<string, unknown>): Promise<void>;
|
|
3213
|
-
}
|
|
3214
|
-
//#endregion
|
|
3215
3004
|
//#region ../session-rdb/src/testing/contract.d.ts
|
|
3216
3005
|
declare function meta(id: string, cwd?: string): SessionHeader$1;
|
|
3217
3006
|
declare function oneTurnLog(): SessionEvent$1[];
|
|
@@ -3239,4 +3028,4 @@ declare function turnLog(base: number, turn: number, opts?: {
|
|
|
3239
3028
|
time?: number;
|
|
3240
3029
|
}): SessionEvent[];
|
|
3241
3030
|
//#endregion
|
|
3242
|
-
export {
|
|
3031
|
+
export { Harness, SESSION_EDITOR_PATH, Session, type SessionEvent, type SessionHeader, SessionIdBrand, SessionSeq, SessionStore, TokenMeter, assistantMessage, createPersisted, harness, meta, oneTurnLog, parseJsonlArtifact, turnLog, twoTurnLog, userMessage };
|