@haikit/client 0.7.0 → 0.8.0
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/package.json +1 -1
- package/src/index.d.ts +4 -0
- package/src/index.js +3 -0
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -37,6 +37,8 @@ export interface MountCtx {
|
|
|
37
37
|
handle: string;
|
|
38
38
|
mode: SurfaceMode;
|
|
39
39
|
state: SurfaceState;
|
|
40
|
+
/** What the user picked, when the surface is mounted already frozen. */
|
|
41
|
+
selection?: unknown;
|
|
40
42
|
send(action: string, value: unknown): Promise<void>;
|
|
41
43
|
}
|
|
42
44
|
|
|
@@ -78,6 +80,8 @@ export interface SurfaceRecord {
|
|
|
78
80
|
mode: SurfaceMode;
|
|
79
81
|
state: SurfaceState;
|
|
80
82
|
props: unknown | null;
|
|
83
|
+
/** What the user picked, once frozen. */
|
|
84
|
+
selection?: unknown;
|
|
81
85
|
instance: SurfaceInstance | null;
|
|
82
86
|
/** The element it was last mounted into. */
|
|
83
87
|
element: HTMLElement | null;
|
package/src/index.js
CHANGED
|
@@ -222,6 +222,8 @@ export function createChat({ endpoint = "/hai", registry }) {
|
|
|
222
222
|
const surface = state.surfaces.get(event.handle);
|
|
223
223
|
if (surface) {
|
|
224
224
|
surface.state = event.state;
|
|
225
|
+
// kept, so a surface mounted again once frozen still knows the answer
|
|
226
|
+
surface.selection = event.selection;
|
|
225
227
|
surface.instance?.freeze?.(event.selection);
|
|
226
228
|
}
|
|
227
229
|
break;
|
|
@@ -320,6 +322,7 @@ export function createChat({ endpoint = "/hai", registry }) {
|
|
|
320
322
|
handle,
|
|
321
323
|
mode: surface.mode,
|
|
322
324
|
state: surface.state,
|
|
325
|
+
selection: surface.selection,
|
|
323
326
|
// The ONLY channel a component has to the server. It passes an action
|
|
324
327
|
// name declared in the contract — never a tool, never a handler.
|
|
325
328
|
send: (action, value) => interact(handle, action, value),
|