@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haikit/client",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "The haikit browser runtime: streams tool payloads into interactive UI surfaces. Plain ESM, no build step, no dependencies.",
5
5
  "keywords": [
6
6
  "haikit",
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),