@fork-api/chat-sdk 0.1.141 → 0.1.143

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/index.d.cts CHANGED
@@ -160,11 +160,9 @@ interface PreviewSessionPayload {
160
160
  kind: PreviewTargetKind;
161
161
  id: string;
162
162
  };
163
- target_user_id: string;
164
163
  operator_id: number;
165
164
  container_id?: string | null;
166
- /** Human-readable container label for preview UI. Older sessions may not
167
- * have this; callers should fall back to target_user_id. */
165
+ /** Human-readable container label for preview UI. Defaults to "Fork". */
168
166
  container_name?: string | null;
169
167
  /** Seeded from activate(); the SDK updates it when authoring creates a
170
168
  * new fork. Null when the operator just landed and hasn't authored. */
@@ -215,7 +213,10 @@ interface ForkPanelProps {
215
213
  targetId?: string;
216
214
  targetLabel?: string;
217
215
  historyMode?: "slot" | "boundary" | "none";
218
- onSubmit: (prompt: string, targetId: string, containerId?: string | null) => void;
216
+ onSubmit: (prompt: string, targetId: string, containerId?: string | null, opts?: {
217
+ forkId?: string | null;
218
+ forceNew?: boolean;
219
+ }) => void;
219
220
  onUndo?: (targetId: string) => Promise<any>;
220
221
  onClose: () => void;
221
222
  baseUrl?: string;
@@ -240,7 +241,10 @@ declare function useFork(): {
240
241
  error: string | null;
241
242
  open: () => void;
242
243
  close: () => void;
243
- startFork: (prompt: string, slotId?: string, containerId?: string | null) => Promise<void>;
244
+ startFork: (prompt: string, slotId?: string, containerId?: string | null, opts?: {
245
+ forkId?: string | null;
246
+ forceNew?: boolean;
247
+ }) => Promise<void>;
244
248
  undoFork: (slotId: string) => Promise<any>;
245
249
  };
246
250
 
@@ -251,7 +255,10 @@ declare function useBoundaryFork(boundaryId: string): {
251
255
  error: string | null;
252
256
  open: () => void;
253
257
  close: () => void;
254
- startFork: (prompt: string, containerId?: string | null) => Promise<void>;
258
+ startFork: (prompt: string, containerId?: string | null, opts?: {
259
+ forkId?: string | null;
260
+ forceNew?: boolean;
261
+ }) => Promise<void>;
255
262
  undoFork: () => Promise<any>;
256
263
  };
257
264
 
@@ -260,15 +267,21 @@ declare function useForkChatPanel(options: ForkChatPanelOptions): {
260
267
  targetId: string;
261
268
  targetLabel: string | undefined;
262
269
  historyMode: "slot" | "boundary";
263
- submit: (prompt: string, submittedTargetId?: string, containerId?: string | null) => Promise<void>;
270
+ submit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: {
271
+ forkId?: string | null;
272
+ forceNew?: boolean;
273
+ }) => Promise<void>;
264
274
  undo: (submittedTargetId?: string) => Promise<any>;
265
275
  buttonProps: {
266
- onClick: () => void;
276
+ onClick: (() => void) | (() => void);
267
277
  };
268
278
  panelProps: {
269
- onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null) => Promise<void>;
279
+ onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: {
280
+ forkId?: string | null;
281
+ forceNew?: boolean;
282
+ }) => Promise<void>;
270
283
  onUndo: (submittedTargetId?: string) => Promise<any>;
271
- onClose: () => void;
284
+ onClose: (() => void) | (() => void);
272
285
  baseUrl: string;
273
286
  apiKey: string;
274
287
  userId: string;
@@ -282,9 +295,71 @@ declare function useForkChatPanel(options: ForkChatPanelOptions): {
282
295
  events: ForkEvent[];
283
296
  error: string | null;
284
297
  } | {
285
- onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null) => Promise<void>;
298
+ onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: {
299
+ forkId?: string | null;
300
+ forceNew?: boolean;
301
+ }) => Promise<void>;
286
302
  onUndo: (submittedTargetId?: string) => Promise<any>;
287
- onClose: () => void;
303
+ onClose: (() => void) | (() => void);
304
+ baseUrl: string;
305
+ apiKey: string;
306
+ userId: string;
307
+ userHash: string | undefined;
308
+ appId: string | undefined;
309
+ targetId: string;
310
+ targetLabel: string | undefined;
311
+ historyMode: "slot" | "boundary";
312
+ state: ForkState;
313
+ fork: Fork | null;
314
+ events: ForkEvent[];
315
+ error: string | null;
316
+ };
317
+ state: ForkState;
318
+ fork: Fork | null;
319
+ events: ForkEvent[];
320
+ error: string | null;
321
+ isOpen: boolean;
322
+ open: () => void;
323
+ close: () => void;
324
+ } | {
325
+ target: ForkChatTarget;
326
+ targetId: string;
327
+ targetLabel: string | undefined;
328
+ historyMode: "slot" | "boundary";
329
+ submit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: {
330
+ forkId?: string | null;
331
+ forceNew?: boolean;
332
+ }) => Promise<void>;
333
+ undo: (submittedTargetId?: string) => Promise<any>;
334
+ buttonProps: {
335
+ onClick: (() => void) | (() => void);
336
+ };
337
+ panelProps: {
338
+ onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: {
339
+ forkId?: string | null;
340
+ forceNew?: boolean;
341
+ }) => Promise<void>;
342
+ onUndo: (submittedTargetId?: string) => Promise<any>;
343
+ onClose: (() => void) | (() => void);
344
+ baseUrl: string;
345
+ apiKey: string;
346
+ userId: string;
347
+ userHash: string | undefined;
348
+ appId: string | undefined;
349
+ slotId: string;
350
+ targetLabel: string | undefined;
351
+ historyMode: "slot" | "boundary";
352
+ state: ForkState;
353
+ fork: Fork | null;
354
+ events: ForkEvent[];
355
+ error: string | null;
356
+ } | {
357
+ onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: {
358
+ forkId?: string | null;
359
+ forceNew?: boolean;
360
+ }) => Promise<void>;
361
+ onUndo: (submittedTargetId?: string) => Promise<any>;
362
+ onClose: (() => void) | (() => void);
288
363
  baseUrl: string;
289
364
  apiKey: string;
290
365
  userId: string;
package/dist/index.d.ts CHANGED
@@ -160,11 +160,9 @@ interface PreviewSessionPayload {
160
160
  kind: PreviewTargetKind;
161
161
  id: string;
162
162
  };
163
- target_user_id: string;
164
163
  operator_id: number;
165
164
  container_id?: string | null;
166
- /** Human-readable container label for preview UI. Older sessions may not
167
- * have this; callers should fall back to target_user_id. */
165
+ /** Human-readable container label for preview UI. Defaults to "Fork". */
168
166
  container_name?: string | null;
169
167
  /** Seeded from activate(); the SDK updates it when authoring creates a
170
168
  * new fork. Null when the operator just landed and hasn't authored. */
@@ -215,7 +213,10 @@ interface ForkPanelProps {
215
213
  targetId?: string;
216
214
  targetLabel?: string;
217
215
  historyMode?: "slot" | "boundary" | "none";
218
- onSubmit: (prompt: string, targetId: string, containerId?: string | null) => void;
216
+ onSubmit: (prompt: string, targetId: string, containerId?: string | null, opts?: {
217
+ forkId?: string | null;
218
+ forceNew?: boolean;
219
+ }) => void;
219
220
  onUndo?: (targetId: string) => Promise<any>;
220
221
  onClose: () => void;
221
222
  baseUrl?: string;
@@ -240,7 +241,10 @@ declare function useFork(): {
240
241
  error: string | null;
241
242
  open: () => void;
242
243
  close: () => void;
243
- startFork: (prompt: string, slotId?: string, containerId?: string | null) => Promise<void>;
244
+ startFork: (prompt: string, slotId?: string, containerId?: string | null, opts?: {
245
+ forkId?: string | null;
246
+ forceNew?: boolean;
247
+ }) => Promise<void>;
244
248
  undoFork: (slotId: string) => Promise<any>;
245
249
  };
246
250
 
@@ -251,7 +255,10 @@ declare function useBoundaryFork(boundaryId: string): {
251
255
  error: string | null;
252
256
  open: () => void;
253
257
  close: () => void;
254
- startFork: (prompt: string, containerId?: string | null) => Promise<void>;
258
+ startFork: (prompt: string, containerId?: string | null, opts?: {
259
+ forkId?: string | null;
260
+ forceNew?: boolean;
261
+ }) => Promise<void>;
255
262
  undoFork: () => Promise<any>;
256
263
  };
257
264
 
@@ -260,15 +267,21 @@ declare function useForkChatPanel(options: ForkChatPanelOptions): {
260
267
  targetId: string;
261
268
  targetLabel: string | undefined;
262
269
  historyMode: "slot" | "boundary";
263
- submit: (prompt: string, submittedTargetId?: string, containerId?: string | null) => Promise<void>;
270
+ submit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: {
271
+ forkId?: string | null;
272
+ forceNew?: boolean;
273
+ }) => Promise<void>;
264
274
  undo: (submittedTargetId?: string) => Promise<any>;
265
275
  buttonProps: {
266
- onClick: () => void;
276
+ onClick: (() => void) | (() => void);
267
277
  };
268
278
  panelProps: {
269
- onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null) => Promise<void>;
279
+ onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: {
280
+ forkId?: string | null;
281
+ forceNew?: boolean;
282
+ }) => Promise<void>;
270
283
  onUndo: (submittedTargetId?: string) => Promise<any>;
271
- onClose: () => void;
284
+ onClose: (() => void) | (() => void);
272
285
  baseUrl: string;
273
286
  apiKey: string;
274
287
  userId: string;
@@ -282,9 +295,71 @@ declare function useForkChatPanel(options: ForkChatPanelOptions): {
282
295
  events: ForkEvent[];
283
296
  error: string | null;
284
297
  } | {
285
- onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null) => Promise<void>;
298
+ onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: {
299
+ forkId?: string | null;
300
+ forceNew?: boolean;
301
+ }) => Promise<void>;
286
302
  onUndo: (submittedTargetId?: string) => Promise<any>;
287
- onClose: () => void;
303
+ onClose: (() => void) | (() => void);
304
+ baseUrl: string;
305
+ apiKey: string;
306
+ userId: string;
307
+ userHash: string | undefined;
308
+ appId: string | undefined;
309
+ targetId: string;
310
+ targetLabel: string | undefined;
311
+ historyMode: "slot" | "boundary";
312
+ state: ForkState;
313
+ fork: Fork | null;
314
+ events: ForkEvent[];
315
+ error: string | null;
316
+ };
317
+ state: ForkState;
318
+ fork: Fork | null;
319
+ events: ForkEvent[];
320
+ error: string | null;
321
+ isOpen: boolean;
322
+ open: () => void;
323
+ close: () => void;
324
+ } | {
325
+ target: ForkChatTarget;
326
+ targetId: string;
327
+ targetLabel: string | undefined;
328
+ historyMode: "slot" | "boundary";
329
+ submit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: {
330
+ forkId?: string | null;
331
+ forceNew?: boolean;
332
+ }) => Promise<void>;
333
+ undo: (submittedTargetId?: string) => Promise<any>;
334
+ buttonProps: {
335
+ onClick: (() => void) | (() => void);
336
+ };
337
+ panelProps: {
338
+ onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: {
339
+ forkId?: string | null;
340
+ forceNew?: boolean;
341
+ }) => Promise<void>;
342
+ onUndo: (submittedTargetId?: string) => Promise<any>;
343
+ onClose: (() => void) | (() => void);
344
+ baseUrl: string;
345
+ apiKey: string;
346
+ userId: string;
347
+ userHash: string | undefined;
348
+ appId: string | undefined;
349
+ slotId: string;
350
+ targetLabel: string | undefined;
351
+ historyMode: "slot" | "boundary";
352
+ state: ForkState;
353
+ fork: Fork | null;
354
+ events: ForkEvent[];
355
+ error: string | null;
356
+ } | {
357
+ onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: {
358
+ forkId?: string | null;
359
+ forceNew?: boolean;
360
+ }) => Promise<void>;
361
+ onUndo: (submittedTargetId?: string) => Promise<any>;
362
+ onClose: (() => void) | (() => void);
288
363
  baseUrl: string;
289
364
  apiKey: string;
290
365
  userId: string;