@crazx/dsh-client-test-runtime 0.1.5-alpha.1.zw.3

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,71 @@
1
+ /** Controller and UI-domain fixture shapes for the client test runtime. */
2
+ import type { ISession, SessionEventLikeEntry, SessionSnapshot, SessionSummary } from '@deepseek-ai/dsh-api-session-controller/client';
3
+ import type { WorkspaceSnapshot } from '@deepseek-ai/dsh-api-workspace-controller/client';
4
+ import type { SessionId } from '@deepseek-ai/dsh-session/types';
5
+ import { type ConversationSnapshot } from '@deepseek-ai/dsh-client-ui-conversation/client';
6
+ import { type ChatSnapshot } from '@deepseek-ai/dsh-client-ui-chat/client';
7
+ /**
8
+ * Fixture overrides for the session behavior face: any subset of the
9
+ * production ISession verbs (typed against it, so a face change surfaces
10
+ * here at compile time), plus extra members feature-specific casts consume.
11
+ * The open Record tail means a misnamed EXTRA member is not caught by the
12
+ * compiler (it grafts as dead weight); the ISession verbs stay safe — a
13
+ * misnamed verb leaves the fail-loud stub in place, which names itself at
14
+ * the first call.
15
+ */
16
+ export type SessionBehaviorOverrides = Partial<ISession> & Record<string, unknown>;
17
+ /**
18
+ * act-wrapped mutation runner shared by every runtime object: public mutators
19
+ * funnel through it so tests never handle SlotCore microtask batching or
20
+ * React act themselves.
21
+ */
22
+ export type Stabilizer = (fn: () => void | Promise<void>) => Promise<void>;
23
+ /** Mutable top-level snapshot fields accepted by fixture update callbacks. */
24
+ export type FixtureSnapshot<T> = {
25
+ -readonly [Key in keyof T]: T[Key];
26
+ };
27
+ /** Writable test representation of the immutable Session Controller snapshot. */
28
+ export type SessionFixtureSnapshot = FixtureSnapshot<SessionSnapshot>;
29
+ /**
30
+ * Session fixture accepted by {@link TestSessions.add}: identity plus optional
31
+ * snapshot/list-row overrides and the session behavior face the feature under
32
+ * test actually calls (kept open — the runtime never fakes methods a test did
33
+ * not supply, so an unstubbed call fails loud at the call site).
34
+ */
35
+ export interface SessionFixture {
36
+ id: string;
37
+ /** Overrides merged over {@link sessionSnapshot}; Conversation data arrives through the event feed. */
38
+ snapshot?: Partial<Omit<SessionSnapshot, 'sessionId'>>;
39
+ /** List-row overrides merged over the defaults derived from `id`. */
40
+ summary?: Partial<Omit<SessionSummary, 'id'>>;
41
+ /** Session behavior face: exactly the methods the feature under test calls (ISession subset + extras). */
42
+ session?: SessionBehaviorOverrides;
43
+ /** Initial contiguous event window consumed by Conversation assembly. */
44
+ events?: readonly SessionEventLikeEntry[];
45
+ /** Whether the initial event window has an older page. */
46
+ hasMore?: boolean;
47
+ }
48
+ /**
49
+ * A complete quiescent Session Controller snapshot.
50
+ * @param sessionId - owning session id.
51
+ * @returns the snapshot; spread fixture overrides on top.
52
+ */
53
+ export declare function sessionSnapshot(sessionId: SessionId): SessionSnapshot;
54
+ /**
55
+ * A target-neutral Conversation snapshot.
56
+ * @param overrides - target roster or activity overrides.
57
+ * @returns an immutable fixture value.
58
+ */
59
+ export declare function conversationSnapshot(overrides?: Partial<ConversationSnapshot>): ConversationSnapshot;
60
+ /**
61
+ * A Chat target snapshot.
62
+ * @param overrides - Chat target overrides.
63
+ * @returns an immutable fixture value.
64
+ */
65
+ export declare function chatSnapshot(overrides?: Partial<ChatSnapshot>): ChatSnapshot;
66
+ /**
67
+ * A ready Workspace Controller snapshot with no Workspace rows.
68
+ * @returns the initial state of the test Workspace source.
69
+ */
70
+ export declare function workspaceSnapshot(): WorkspaceSnapshot;
71
+ //# sourceMappingURL=fixtures.d.ts.map
@@ -0,0 +1,212 @@
1
+ /**
2
+ * jsdom slot test runtime: a real small runtime — Cordis `Context`, the
3
+ * renderer-owned `SlotRegistry`, the `ui-session` adapter, and the UI renderer — assembled around
4
+ * test-owned session/workspace doubles and a fail-loud file-upload stub, so feature specs exercise
5
+ * declaration, registration, scope, store, inject, rendering, updates, and
6
+ * disposal without hand-building the machinery per suite.
7
+ *
8
+ * Not part of the product plugin graph (no `dsh.client`); feature packages
9
+ * depend on it in devDependencies only. It copies no SlotCore/renderer/store
10
+ * machinery — everything mounts the production implementations.
11
+ * @module @deepseek-ai/dsh-client-test-runtime
12
+ */
13
+ import { Context } from '@deepseek-ai/cordis';
14
+ import type { Fiber, Plugin } from '@deepseek-ai/cordis';
15
+ import type { RenderResult } from '@testing-library/react';
16
+ import type { queries } from '@testing-library/dom';
17
+ import type { BoundFunctions } from '@testing-library/dom';
18
+ import { SlotRegistry } from '@deepseek-ai/dsh-client-ui-renderer/client';
19
+ import type { SessionId } from '@deepseek-ai/dsh-session/types';
20
+ import type { ChildrenDecl, ComposedProps, HostObservable, OwnerOf, SlotComponent, SlotMap, SlotRenderer, SnapshotSelectorHook, StoreInstanceLike } from '@deepseek-ai/dsh-client-ui-slots';
21
+ import { TestSessions } from './sessions.ts';
22
+ import { TestWorkspaces } from './workspaces.ts';
23
+ import type { Stabilizer } from './fixtures.ts';
24
+ export type { UseSession } from '@deepseek-ai/dsh-client-ui-session/client';
25
+ export { domSnapshotSerializer, registerDomSnapshotSerializer } from './snapshot.ts';
26
+ export { FixtureSession, TestSessions } from './sessions.ts';
27
+ export { stubSettingsScope } from './settings-scope.ts';
28
+ export type { StubSettingsScope } from './settings-scope.ts';
29
+ export { scriptedSettingsRemote } from './settings-remote.ts';
30
+ export type { ScriptedNamespace, ScriptedSettingsRemote } from './settings-remote.ts';
31
+ export { TestWorkspaces } from './workspaces.ts';
32
+ export { RemoteError, TestRemote } from './remote.ts';
33
+ export { chatSnapshot, conversationSnapshot, sessionSnapshot, workspaceSnapshot, } from './fixtures.ts';
34
+ export type { FixtureSnapshot, SessionBehaviorOverrides, SessionFixture, SessionFixtureSnapshot, Stabilizer, } from './fixtures.ts';
35
+ export { makeTranslate } from './translate.ts';
36
+ export { usePinnedBrowserLanguages } from './locale-env.ts';
37
+ /**
38
+ * Bind an observable source to the production renderer's selector hook.
39
+ * @param source - Observable snapshot source.
40
+ * @returns Typed React selector hook.
41
+ */
42
+ export declare function bindSnapshotSelector<T>(source: HostObservable<T>): SnapshotSelectorHook<T>;
43
+ /**
44
+ * Create the production slot renderer used by client feature tests.
45
+ * @returns Slot renderer instance.
46
+ */
47
+ export declare function createSlotRenderer(): SlotRenderer;
48
+ /**
49
+ * One rendered slot's local view, from {@link SlotTestRuntime.renderSlot}:
50
+ * the renderer's own `[data-slot]` outlet anchor is the snapshot root
51
+ * (`expect(view.container).toMatchSnapshot()` captures exactly this slot's
52
+ * output), Testing Library queries are bound inside it, and `update`
53
+ * re-renders with new owner props.
54
+ */
55
+ export interface SlotView<K extends keyof SlotMap & string> {
56
+ /** The renderer's `<div data-slot="<key>">` anchor around the slot's rendered output. */
57
+ readonly container: HTMLElement;
58
+ /** Testing Library queries scoped to {@link SlotView.container}. */
59
+ readonly view: BoundFunctions<typeof queries>;
60
+ /**
61
+ * Replace the owner props and flush the re-render (the render-site update:
62
+ * in production the owner recomputes the share and React re-renders).
63
+ * @param owner - the next owner props share.
64
+ */
65
+ update(owner: OwnerOf<K>): void;
66
+ }
67
+ /**
68
+ * Mounted feature plugin handle: the live fiber plus an act-wrapped,
69
+ * idempotent dispose (unload cascade: entries, declared child slots, store
70
+ * instances, and provided services all fall together).
71
+ */
72
+ export interface FeatureHandle {
73
+ /** The plugin's live Cordis fiber (state assertions, escape hatch). */
74
+ readonly fiber: Fiber;
75
+ /**
76
+ * Dispose the plugin fiber inside React act; repeated calls no-op.
77
+ * @returns completion of the unload cascade.
78
+ */
79
+ dispose(): Promise<void>;
80
+ }
81
+ /** Mutable fail-loud file-upload stub installed by {@link SlotTestRuntime}. */
82
+ export interface TestFileUpload {
83
+ /** Availability reported to the feature under test. */
84
+ available: boolean;
85
+ /** Test-supplied upload behavior; the default rejects every call. */
86
+ upload: (sessionId: SessionId, ...args: unknown[]) => Promise<unknown>;
87
+ }
88
+ /**
89
+ * The test-owned 'root' occupant: declares the child slots a suite needs
90
+ * through the REAL `slots.register`, with a caller-supplied minimal frame —
91
+ * the runtime never guesses a feature's page structure.
92
+ */
93
+ export declare class TestRoot {
94
+ private readonly slots;
95
+ private readonly stabilize;
96
+ private disposeEntry;
97
+ /**
98
+ * @param slots - the runtime SlotRegistry.
99
+ * @param stabilize - the owning runtime's act wrapper.
100
+ */
101
+ constructor(slots: SlotRegistry, stabilize: Stabilizer);
102
+ /**
103
+ * Register the root frame, declaring (and thereby claiming) the child
104
+ * slots. One declaration per runtime — a second call fails loud in the
105
+ * core ('root' is a single slot).
106
+ * @param children - child-slot declaration table (declaration + render authorization + runtime spec).
107
+ * @param frame - minimal frame component; its props derive from the declared keys (composed-props contract).
108
+ * @returns completion of the act-wrapped registration.
109
+ */
110
+ declare<const D extends ChildrenDecl>(children: D, frame: SlotComponent<ComposedProps<'root', never, keyof NoInfer<D> & keyof SlotMap & string, undefined, object>>): Promise<void>;
111
+ /** Remove the root registration and collapse its declarations (runtime dispose path). */
112
+ release(): void;
113
+ }
114
+ /**
115
+ * The assembled test runtime. Obtain via {@link SlotTestRuntime.create};
116
+ * dispose with {@link SlotTestRuntime.dispose} (afterEach). Public mutators
117
+ * are act-wrapped throughout — tests never handle SlotCore microtask
118
+ * batching or React act themselves.
119
+ */
120
+ export declare class SlotTestRuntime {
121
+ /** The runtime's Cordis root for owner APIs and explicit test-only services. */
122
+ readonly ctx: Context;
123
+ /** The production SlotRegistry mounted on {@link SlotTestRuntime.ctx}. */
124
+ readonly slots: SlotRegistry;
125
+ /** The test-owned 'root' occupant. */
126
+ readonly root: TestRoot;
127
+ /** Sessions double (list/current observable, cells, scopes, behavior faces). */
128
+ readonly sessions: TestSessions;
129
+ /** Workspaces double (list observable, recorded intent actions). */
130
+ readonly workspaces: TestWorkspaces;
131
+ /** Mutable file-upload stub; replace `upload` in suites that exercise the capability. */
132
+ readonly fileUpload: TestFileUpload;
133
+ private readonly stabilizer;
134
+ private host;
135
+ private readonly views;
136
+ private readonly handles;
137
+ private disposed;
138
+ /** Auto-frame state ({@link SlotTestRuntime.declare} / {@link SlotTestRuntime.renderSlot}). */
139
+ private readonly ownerCell;
140
+ private readonly autoDeclared;
141
+ private autoRootView;
142
+ private readonly disposeWorkspaceSource;
143
+ private constructor();
144
+ /**
145
+ * Assemble a runtime: real Context, mounted SlotRegistry, installed
146
+ * renderer, and the session/workspace doubles provided as services.
147
+ * @returns the ready runtime.
148
+ */
149
+ static create(): Promise<SlotTestRuntime>;
150
+ /**
151
+ * Mount a feature plugin on a real fiber. Required services are prechecked
152
+ * so a missing provider fails loud instead of suspending the fiber forever
153
+ * (deliberate load-order suspension tests use `ctx.plugin` directly).
154
+ * @param plugin - plugin value (function, class, or `{ inject, apply }` object).
155
+ * @returns handle owning the fiber's explicit disposal.
156
+ */
157
+ mount(plugin: Plugin): Promise<FeatureHandle>;
158
+ /** Release the default Workspace hook before mounting its production owner. */
159
+ releaseWorkspaceSource(): void;
160
+ /**
161
+ * Render the root slot tree through the ctx-level entry (the shell's own
162
+ * entry point): `ctx.slots.renderSlot('root', {})` under Testing Library.
163
+ * @returns the Testing Library view.
164
+ */
165
+ renderRoot(): RenderResult;
166
+ /**
167
+ * Declare child slots under an auto-generated root frame — the single-slot
168
+ * mounting path for local DOM snapshots. Each key later supplied through
169
+ * {@link SlotTestRuntime.renderSlot} renders inside the renderer's own
170
+ * `<div data-slot="<key>">` outlet anchor (the snapshot root — the frame
171
+ * adds no wrapper of its own). Mutually exclusive with
172
+ * {@link TestRoot.declare} ('root' is a single slot); one call per runtime.
173
+ * @param children - child-slot declaration table (same contract as TestRoot.declare).
174
+ * @returns completion of the act-wrapped registration.
175
+ */
176
+ declare(children: ChildrenDecl): Promise<void>;
177
+ /**
178
+ * Render one declared slot with its owner props and return the local view.
179
+ * The whole root tree mounts through the production assembly path
180
+ * (renderer, scope providers, store axis); only this key's output lands in
181
+ * the returned container. Call again with another key to view a sibling
182
+ * slot of the same tree.
183
+ * @param key - a key declared through {@link SlotTestRuntime.declare}.
184
+ * @param owner - owner props share for the render site.
185
+ * @returns the slot-local view (snapshot container, scoped queries, owner updates).
186
+ */
187
+ renderSlot<K extends keyof SlotMap & string>(key: K, owner: OwnerOf<K>): SlotView<K>;
188
+ /**
189
+ * Resolve the store instance the renderer would hand a slot's component
190
+ * (identity assertions, action-driven writes). Requires a prior
191
+ * {@link SlotTestRuntime.renderRoot} — the host face exists only inside the
192
+ * installed renderer, exactly as in production.
193
+ * @param key - slot key whose first entry declares the store.
194
+ * @param scopeKey - session id for session-scope slots; omit for root scope.
195
+ * @returns the live store instance.
196
+ */
197
+ storeOf(key: keyof SlotMap & string, scopeKey?: string): StoreInstanceLike;
198
+ /**
199
+ * Flush pending ledger/store notifications inside act — for mutations made
200
+ * outside the runtime's own methods (e.g. a direct `slots.register`).
201
+ * @returns completion of the act pass.
202
+ */
203
+ flush(): Promise<void>;
204
+ /**
205
+ * Tear down: unmount React trees first, then dispose feature fibers, the
206
+ * root registration, minted session scopes, and persisted test state.
207
+ * Idempotent.
208
+ * @returns completion of the teardown.
209
+ */
210
+ dispose(): Promise<void>;
211
+ }
212
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Pin `navigator.languages`/`navigator.language` for every test in the
3
+ * calling file (or describe block), restoring the environment's own values
4
+ * afterwards. Call at suite level, like the other vitest hooks.
5
+ * @param primary - most preferred BCP 47 tag; also becomes `navigator.language`.
6
+ * @param rest - further tags in preference order.
7
+ */
8
+ export declare function usePinnedBrowserLanguages(primary: string, ...rest: string[]): void;
9
+ //# sourceMappingURL=locale-env.d.ts.map
@@ -0,0 +1,58 @@
1
+ /** Test-owned Remote face: `$on` subscriptions with an explicit test event driver. */
2
+ import type { Context } from '@deepseek-ai/cordis';
3
+ export { RemoteError } from '@deepseek-ai/dsh-typert-protocol';
4
+ /**
5
+ * Remote service test double for the forwarded-event path. Feature specs need
6
+ * `ctx.remote.$on` to exist (their plugins inject `remote`) and need forwarded
7
+ * Host events to reach those subscribers, but not the wire — so this double
8
+ * implements subscription plus an explicit `emit` driver available only on the
9
+ * concrete test object. A spec that also calls one namespace scripts it through
10
+ * the constructor rather than reaching the real Client Remote service.
11
+ *
12
+ * `$mount` rejects: a spec that needs a real generated contribution installed —
13
+ * codecs, descriptors, and the wire — has outgrown this double and needs the
14
+ * real Client Remote service.
15
+ *
16
+ * One deliberate asymmetry with production: a throwing listener propagates out
17
+ * of the emit instead of being contained and logged, so a spec cannot lean on
18
+ * this double for the containment guarantee `$on` documents — assert that
19
+ * against the real service.
20
+ */
21
+ export declare class TestRemote {
22
+ private readonly subscriptions;
23
+ /**
24
+ * Fixed Host facts mirrored from the production `ctx.remote.$host`. Plain
25
+ * mutable field: a spec assigns it to script a non-loopback or homed Host.
26
+ */
27
+ $host: {
28
+ home: string | undefined;
29
+ isLoopback: boolean;
30
+ };
31
+ /**
32
+ * Register the double as `ctx.remote`, plus one service per scripted
33
+ * namespace so a plugin injecting `remote.<name>` also unparks.
34
+ * @param ctx - the spec's root Context.
35
+ * @param namespaces - scripted namespace faces reached as `ctx.remote.<name>`.
36
+ */
37
+ constructor(ctx: Context, namespaces?: Readonly<Record<string, object>>);
38
+ /**
39
+ * Deliver one forwarded host event to its subscribers, standing in for the
40
+ * carrier that owns the frame sink.
41
+ * @param event - forwarded host event name.
42
+ * @param args - the Host argument list, verbatim.
43
+ */
44
+ emit(event: string, args: readonly unknown[]): void;
45
+ /**
46
+ * Subscribe to one forwarded host event.
47
+ * @param event - forwarded host event name.
48
+ * @param listener - receives the Host argument list verbatim.
49
+ * @returns disposer removing this subscription.
50
+ */
51
+ $on(event: string, listener: (...args: never[]) => void): () => void;
52
+ /**
53
+ * Generated-namespace mount, unsupported by this double.
54
+ * @returns never; always rejects.
55
+ */
56
+ $mount(): Promise<() => Promise<void>>;
57
+ }
58
+ //# sourceMappingURL=remote.d.ts.map
@@ -0,0 +1,276 @@
1
+ /** Test-owned Session Controller faces over declarative fixtures. */
2
+ import type { Context } from '@deepseek-ai/cordis';
3
+ import type { AttachmentIdType } from '@deepseek-ai/dsh-attachment';
4
+ import { MutableSessionEventSource } from '@deepseek-ai/dsh-api-session-controller/client';
5
+ import type { AgentContext, ISessions, ProjectionsFace, SessionBinding, SessionFace, SessionListState, SessionEventLikeEntry, SessionLiveEventEntry, SessionSearchResultItem, SessionSnapshot, SessionSummary, SubmissionHandle } from '@deepseek-ai/dsh-api-session-controller/client';
6
+ import type { SubagentAddress } from '@deepseek-ai/dsh-subagent/client';
7
+ import type { SnapshotStore } from '@deepseek-ai/dsh-client-store';
8
+ import type { SessionId } from '@deepseek-ai/dsh-session/types';
9
+ import type { SessionFixture, SessionFixtureSnapshot, Stabilizer } from './fixtures.ts';
10
+ /**
11
+ * The fixture-backed session face: lifecycle reads delegate to the fixture's
12
+ * snapshot store; Session verbs are fail-loud stubs unless the
13
+ * fixture supplies them (the runtime never fakes behavior a test did not
14
+ * declare — an unstubbed call names itself instead of half-working). Extra
15
+ * fixture methods are grafted verbatim for feature-side casts.
16
+ */
17
+ export declare class FixtureSession implements SessionFace {
18
+ readonly sessionId: SessionId;
19
+ private readonly store;
20
+ /** Mutable event source consumed only by Conversation assembly. */
21
+ readonly eventSource: MutableSessionEventSource;
22
+ /**
23
+ * Identity-stable per-key faces over fixture-controlled projection values.
24
+ */
25
+ readonly projections: ProjectionsFace & {
26
+ set(key: string, value: unknown): void;
27
+ };
28
+ /**
29
+ * @param sessionId - host identity (branded view of the fixture id).
30
+ * @param store - Session Controller snapshot store.
31
+ * @param overrides - fixture-declared behavior face, grafted over the stubs.
32
+ */
33
+ constructor(sessionId: SessionId, store: SnapshotStore<SessionFixtureSnapshot>, overrides: Record<string, unknown>);
34
+ /** @returns the fixture Session Controller snapshot (useSession read side). */
35
+ getSnapshot(): SessionSnapshot;
36
+ /**
37
+ * Subscribe to fixture snapshot changes.
38
+ * @param fn - change callback.
39
+ * @returns unsubscribe.
40
+ */
41
+ subscribe(fn: () => void): () => void;
42
+ /**
43
+ * Fail-loud stub; supply `prompt` on the fixture's session face to exercise it.
44
+ * @returns never — always throws.
45
+ */
46
+ prompt(): never;
47
+ /**
48
+ * Minimal local-echo registration: mints an identity without touching the
49
+ * fixture snapshot (submission echoes are client-only presentation state).
50
+ * Supply `beginSubmission` on the fixture's session face to observe echoes.
51
+ * @returns a handle whose abandon is a no-op.
52
+ */
53
+ beginSubmission(): SubmissionHandle;
54
+ private submissionSeq;
55
+ /**
56
+ * Fail-loud stub; supply `readAttachment` on the fixture's session face to exercise it.
57
+ * @param _attachmentId - opaque durable attachment id.
58
+ * @returns never — always throws.
59
+ */
60
+ readAttachment(_attachmentId: AttachmentIdType): never;
61
+ /**
62
+ * Fail-loud stub; supply `updateQueue` on the fixture's session face to exercise it.
63
+ * @returns never — always throws.
64
+ */
65
+ updateQueue(): never;
66
+ /**
67
+ * Fail-loud stub; supply `cancel` on the fixture's session face to exercise it.
68
+ * @returns never — always throws.
69
+ */
70
+ cancel(): never;
71
+ /**
72
+ * Fail-loud stub; supply `command` on the fixture's session face to exercise it.
73
+ * @returns never — always throws.
74
+ */
75
+ command(): never;
76
+ /**
77
+ * Fail-loud stub; supply `loadOlder` on the fixture's session face to exercise it.
78
+ * @returns never — always throws.
79
+ */
80
+ loadOlder(): never;
81
+ /**
82
+ * Fail-loud stub; supply `loadThrough` on the fixture's session face to exercise it.
83
+ * @returns never — always throws.
84
+ */
85
+ loadThrough(): never;
86
+ /**
87
+ * Fail-loud stub; supply `rename` on the fixture's session face to exercise it.
88
+ * @returns never — always throws.
89
+ */
90
+ rename(): never;
91
+ }
92
+ /**
93
+ * Sessions test double behind the renderer host and feature injects: owns the
94
+ * list/current observable, scope minting through the production `createScope`,
95
+ * stable Controller bindings, and the session behavior face supplied per
96
+ * fixture. `ui-session` owns standard-source materialization.
97
+ *
98
+ * Implements the same ISessions face features receive as `ctx.sessions`, so
99
+ * a production face change breaks this double at compile time; the extra
100
+ * members (add/updateSessionSnapshot/event-window drivers/setCurrent/remove/
101
+ * behavior/calls/stubs) are bench-only surface.
102
+ */
103
+ export declare class TestSessions implements ISessions {
104
+ private readonly stabilize;
105
+ private readonly rootCtx;
106
+ /** The useSessions standard feed (list rows + current selection). */
107
+ readonly list: SnapshotStore<SessionListState>;
108
+ private readonly records;
109
+ /** Calls observed on the service-level face, newest last. */
110
+ readonly calls: {
111
+ method: 'create' | 'open' | 'openSubagent' | 'setSubagentCatalogOpen' | 'refreshSubagents' | 'clear' | 'refresh' | 'search' | 'fork';
112
+ args: unknown[];
113
+ }[];
114
+ /** The wire schema's `session.search` result bound (production parity). */
115
+ readonly searchResultLimit = 20;
116
+ /** Replaceable search behavior (see {@link TestSessions.stubSearch}). */
117
+ private searchStub;
118
+ private createStub;
119
+ /**
120
+ * @param stabilize - the owning runtime's act wrapper.
121
+ * @param rootCtx - the runtime's Cordis root; scope fibers mount under it.
122
+ */
123
+ constructor(stabilize: Stabilizer, rootCtx: Context);
124
+ /**
125
+ * Add a session from a fixture and (by default) make it current.
126
+ * @param fixture - identity + snapshot/summary overrides + behavior face.
127
+ * @param opts - pass `current: false` to add without selecting.
128
+ * @returns the stable session id (branded view of `fixture.id`).
129
+ */
130
+ add(fixture: SessionFixture, opts?: {
131
+ current?: boolean;
132
+ }): Promise<SessionId>;
133
+ /**
134
+ * Update Session Controller lifecycle state through an immer draft.
135
+ * @param id - session id.
136
+ * @param mutate - draft mutator.
137
+ */
138
+ updateSessionSnapshot(id: string, mutate: (draft: SessionFixtureSnapshot) => void): Promise<void>;
139
+ /**
140
+ * Replace a Session's complete contiguous event window.
141
+ * @param id - Session identity.
142
+ * @param entries - complete event window.
143
+ * @param hasMore - whether older history remains.
144
+ */
145
+ replaceEvents(id: string, entries: readonly SessionEventLikeEntry[], hasMore?: boolean): Promise<void>;
146
+ /**
147
+ * Prepend one older contiguous event page.
148
+ * @param id - Session identity.
149
+ * @param entries - older entries.
150
+ * @param hasMore - whether another older page remains.
151
+ */
152
+ prependEvents(id: string, entries: readonly SessionEventLikeEntry[], hasMore?: boolean): Promise<void>;
153
+ /**
154
+ * Append one live event to a Session's contiguous window.
155
+ * @param id - Session identity.
156
+ * @param entry - live event entry.
157
+ */
158
+ appendEvent(id: string, entry: SessionLiveEventEntry): Promise<void>;
159
+ /**
160
+ * Update a session's list row (the wire-echo stand-in: title settles,
161
+ * running flips — components subscribed via useSessions re-render).
162
+ * @param id - session id.
163
+ * @param patch - summary fields to merge over the row.
164
+ */
165
+ updateSummary(id: string, patch: Partial<Omit<SessionSummary, 'id'>>): Promise<void>;
166
+ /**
167
+ * Switch the current selection (undefined = the no-session empty state).
168
+ * @param id - session id to select, or undefined to clear.
169
+ */
170
+ setCurrent(id: string | undefined): Promise<void>;
171
+ /**
172
+ * Remove a session: list row, scope fiber, and per-session store instances
173
+ * (with persisted state) die together — the same single lifecycle axis the
174
+ * production Client Sessions service drives on session death, minus staging.
175
+ * @param id - session id.
176
+ */
177
+ remove(id: string): Promise<void>;
178
+ /**
179
+ * Resolve (mint on first touch) the session-scoped Cordis context through
180
+ * the production `createScope`, so real `scopeOf`/scope-addressed services
181
+ * resolve it.
182
+ * @param id - session id.
183
+ * @returns the scoped context, or undefined for unknown sessions.
184
+ */
185
+ scope(id: string): AgentContext | undefined;
186
+ /**
187
+ * Session assembly binding (inject factories and provide resolvers receive it).
188
+ * @param id - session id.
189
+ * @returns sessionId + behavior face + scoped ctx, or undefined when unknown.
190
+ */
191
+ binding(id: string): SessionBinding | undefined;
192
+ /**
193
+ * Read the session scope tag off a context (service-method boundary mirror).
194
+ * @param ctx - any client context.
195
+ * @returns the session id, or undefined on root contexts.
196
+ */
197
+ scopeOf(ctx: Context): SessionId | undefined;
198
+ /**
199
+ * Resolve the scoped session face off a context (production `sessionOf`
200
+ * mirror).
201
+ * @param ctx - any client context.
202
+ * @returns the fixture session face, or undefined off-scope.
203
+ */
204
+ sessionOf(ctx: Context): SessionFace | undefined;
205
+ /**
206
+ * Install Session creation behavior for navigation tests.
207
+ * @param impl - implementation that must return an already-added fixture id.
208
+ */
209
+ stubCreate(impl: (opts: Parameters<ISessions['create']>[0]) => Promise<SessionId>): void;
210
+ /** Create through the installed test behavior and require an addressable binding. */
211
+ create(opts?: Parameters<ISessions['create']>[0]): Promise<SessionId>;
212
+ /**
213
+ * Service-level selection call (recorded, then applied to the list store
214
+ * synchronously — inject callbacks call this outside any act window; the
215
+ * store notify is microtask-batched so the next stabilized step observes it).
216
+ * @param id - session id.
217
+ */
218
+ open(id: SessionId): void;
219
+ /** Open an existing fixture through its catalog address. */
220
+ openSubagent(address: SubagentAddress): void;
221
+ /** Resolve the current fixture's retained catalog address. */
222
+ subagentAddress(id: SessionId): SubagentAddress | undefined;
223
+ /** Record catalog consumption; fixture callers drive snapshots explicitly. */
224
+ setSubagentCatalogOpen(parentSessionId: SessionId, open: boolean): void;
225
+ /** Record a catalog refresh; fixture callers drive snapshots explicitly. */
226
+ refreshSubagents(parentSessionId: SessionId): Promise<void>;
227
+ /** Clear the current selection (recorded; the production no-session flow). */
228
+ clear(): void;
229
+ /** History stubs: the test runtime has no selection history — both bounds report empty. */
230
+ canBack(): boolean;
231
+ canForward(): boolean;
232
+ back(): void;
233
+ forward(): void;
234
+ /** Record a list refresh; fixture callers publish list state explicitly. */
235
+ refresh(): Promise<void>;
236
+ /**
237
+ * Replace the sidebar-search result page (the call is still recorded).
238
+ * @param impl - hits for a query, as the Host would rank them.
239
+ */
240
+ stubSearch(impl: (query: string, signal: AbortSignal) => {
241
+ items: SessionSearchResultItem[];
242
+ hasMore: boolean;
243
+ }): void;
244
+ /**
245
+ * Content search over the fixture corpus (recorded). The default answers an
246
+ * empty page: content ranking is Host behavior, so a scenario that asserts
247
+ * hits declares them through {@link TestSessions.stubSearch}.
248
+ * @param query - non-blank literal phrase.
249
+ * @param signal - cancellation for a superseded search (recorded and forwarded).
250
+ * @returns the stubbed or empty result page.
251
+ */
252
+ search(query: string, signal: AbortSignal): ReturnType<ISessions['search']>;
253
+ /**
254
+ * Recorded fork stub: no child materializes (benches asserting the full
255
+ * fork flow drive the production service; this face only proves the call).
256
+ * @param opts - source session id, optional cut anchor, and client title policy.
257
+ * @returns the source id (no child record is created).
258
+ */
259
+ fork(opts: {
260
+ sessionId: SessionId;
261
+ atSeq?: number;
262
+ increaseTitle?: boolean;
263
+ }): Promise<SessionId>;
264
+ /**
265
+ * The session face of a fixture (typed view for assertions; fixture
266
+ * behavior methods are grafted onto it).
267
+ * @param id - session id.
268
+ * @returns the FixtureSession carried by the Controller binding.
269
+ */
270
+ behavior(id: string): FixtureSession;
271
+ /** Dispose minted scope fibers (runtime dispose path). */
272
+ disposeScopes(): Promise<void>;
273
+ private bindingOf;
274
+ private require;
275
+ }
276
+ //# sourceMappingURL=sessions.d.ts.map