@fork-api/chat-sdk 0.1.182 → 0.1.183

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
@@ -69,6 +69,47 @@ interface Fork {
69
69
  error?: string;
70
70
  }
71
71
  type ForkActivityTargetKind = "slot" | "module";
72
+ /** One step of a target's timeline as the revert planner reports it. */
73
+ interface RevertPlanStep {
74
+ forkId: string;
75
+ promptId: string;
76
+ sequence: number;
77
+ kind: "initial" | "follow_up" | "revert";
78
+ prompt: string;
79
+ }
80
+ /** GET /forks/:id/revert-plan — what a revert would remove/keep and which
81
+ * strategies apply. Rendered by the panel's confirm UI; the server
82
+ * recomputes it at execute time. */
83
+ interface RevertPlan {
84
+ mode: "revert_to" | "remove_step";
85
+ targetKind: "slot" | "module";
86
+ targetId: string;
87
+ containerId: string;
88
+ removes: RevertPlanStep[];
89
+ laterSteps: RevertPlanStep[];
90
+ strategies: Array<{
91
+ id: "discard_later" | "keep_later";
92
+ instant: boolean;
93
+ estimateMinutes?: number;
94
+ }>;
95
+ busy: boolean;
96
+ }
97
+ interface RevertArgs {
98
+ forkId: string;
99
+ promptId?: string;
100
+ mode: "revert_to" | "remove_step";
101
+ strategy: "discard_later" | "keep_later";
102
+ }
103
+ /** POST /forks/:id/revert result. agentic=true → the chain-tip fork is
104
+ * running an excise; stream its events like any run. */
105
+ type RevertResponse = {
106
+ agentic: false;
107
+ removed: boolean;
108
+ fork?: Fork;
109
+ } | {
110
+ agentic: true;
111
+ fork: Fork;
112
+ };
72
113
  interface ForkActivity {
73
114
  id: string;
74
115
  status: Fork["status"];
@@ -342,6 +383,14 @@ interface ForkPanelProps {
342
383
  historyMode?: "slot" | "boundary" | "none";
343
384
  onSubmit: (prompt: string, targetId: string, containerId?: string | null, opts?: ForkSubmitOptions) => void;
344
385
  onUndo?: (targetId: string, forkId?: string | null) => Promise<any>;
386
+ /** Classify a revert before executing — drives the inline confirm UI. */
387
+ onPlanRevert?: (forkId: string, promptId?: string, mode?: "revert_to" | "remove_step") => Promise<RevertPlan>;
388
+ /** Execute a revert (undo-to-point / remove-step / agentic excise). */
389
+ onRevert?: (args: RevertArgs) => Promise<RevertResponse>;
390
+ /** Kebab-menu disable/enable toggle for a fork. */
391
+ onSetForkDisabled?: (forkId: string, disabled: boolean) => Promise<any>;
392
+ /** Kebab-menu rename — empty name clears back to the generated title. */
393
+ onRenameFork?: (forkId: string, name: string) => Promise<any>;
345
394
  onClose: () => void;
346
395
  baseUrl?: string;
347
396
  apiKey?: string;
@@ -361,7 +410,7 @@ interface ForkPanelProps {
361
410
  */
362
411
  completeVariant?: "bubble" | "item";
363
412
  }
364
- declare function ForkPanel({ state, fork, events, error, runs, slotId, targetId, targetLabel, historyMode, onSubmit, onUndo, onClose, baseUrl, apiKey, userId, userHash, appId, embedded, completeVariant, }: ForkPanelProps): react_jsx_runtime.JSX.Element;
413
+ declare function ForkPanel({ state, fork, events, error, runs, slotId, targetId, targetLabel, historyMode, onSubmit, onUndo, onPlanRevert, onRevert, onSetForkDisabled, onRenameFork, onClose, baseUrl, apiKey, userId, userHash, appId, embedded, completeVariant, }: ForkPanelProps): react_jsx_runtime.JSX.Element;
365
414
 
366
415
  declare function useFork(): {
367
416
  state: ForkState;
@@ -372,7 +421,11 @@ declare function useFork(): {
372
421
  open: () => void;
373
422
  close: () => void;
374
423
  startFork: (prompt: string, slotId?: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
375
- undoFork: (slotId: string) => Promise<any>;
424
+ undoFork: (slotId: string, forkId?: string | null) => Promise<any>;
425
+ planRevert: (forkId: string, promptId?: string, mode?: "revert_to" | "remove_step") => Promise<RevertPlan>;
426
+ revertFork: (slotId: string, args: RevertArgs) => Promise<RevertResponse>;
427
+ setForkDisabled: (forkId: string, disabled: boolean) => Promise<any>;
428
+ renameFork: (forkId: string, name: string) => Promise<any>;
376
429
  adoptRunningFork: (forkId: string) => Promise<void>;
377
430
  };
378
431
 
@@ -386,6 +439,10 @@ declare function useBoundaryFork(boundaryId: string): {
386
439
  close: () => void;
387
440
  startFork: (prompt: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
388
441
  undoFork: (forkId?: string | null) => Promise<any>;
442
+ planRevert: (forkId: string, promptId?: string, mode?: "revert_to" | "remove_step") => Promise<RevertPlan>;
443
+ revertFork: (args: RevertArgs) => Promise<RevertResponse>;
444
+ setForkDisabled: (forkId: string, disabled: boolean) => Promise<any>;
445
+ renameFork: (forkId: string, name: string) => Promise<any>;
389
446
  adoptRunningFork: (forkId: string) => Promise<void>;
390
447
  };
391
448
 
@@ -397,6 +454,8 @@ declare function useForkChatPanel(options: ForkChatPanelOptions): {
397
454
  historyMode: "slot" | "boundary";
398
455
  submit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
399
456
  undo: (submittedTargetId?: string, forkId?: string | null) => Promise<any>;
457
+ planRevert: (forkId: string, promptId?: string, mode?: "revert_to" | "remove_step") => Promise<RevertPlan>;
458
+ revert: (args: RevertArgs) => Promise<RevertResponse>;
400
459
  buttonProps: {
401
460
  onClick: () => void;
402
461
  hasNotification: boolean;
@@ -405,6 +464,10 @@ declare function useForkChatPanel(options: ForkChatPanelOptions): {
405
464
  panelProps: {
406
465
  onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
407
466
  onUndo: (submittedTargetId?: string, forkId?: string | null) => Promise<any>;
467
+ onPlanRevert: (forkId: string, promptId?: string, mode?: "revert_to" | "remove_step") => Promise<RevertPlan>;
468
+ onRevert: (args: RevertArgs) => Promise<RevertResponse>;
469
+ onSetForkDisabled: (forkId: string, disabled: boolean) => Promise<any>;
470
+ onRenameFork: (forkId: string, name: string) => Promise<any>;
408
471
  onClose: (() => void) | (() => void);
409
472
  baseUrl: string;
410
473
  apiKey: string;
@@ -422,6 +485,10 @@ declare function useForkChatPanel(options: ForkChatPanelOptions): {
422
485
  } | {
423
486
  onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
424
487
  onUndo: (submittedTargetId?: string, forkId?: string | null) => Promise<any>;
488
+ onPlanRevert: (forkId: string, promptId?: string, mode?: "revert_to" | "remove_step") => Promise<RevertPlan>;
489
+ onRevert: (args: RevertArgs) => Promise<RevertResponse>;
490
+ onSetForkDisabled: (forkId: string, disabled: boolean) => Promise<any>;
491
+ onRenameFork: (forkId: string, name: string) => Promise<any>;
425
492
  onClose: (() => void) | (() => void);
426
493
  baseUrl: string;
427
494
  apiKey: string;
@@ -444,6 +511,9 @@ declare function useForkChatPanel(options: ForkChatPanelOptions): {
444
511
  runs: Record<string, ForkRun>;
445
512
  isOpen: boolean;
446
513
  close: () => void;
514
+ revertFork: (args: RevertArgs) => Promise<RevertResponse>;
515
+ setForkDisabled: (forkId: string, disabled: boolean) => Promise<any>;
516
+ renameFork: (forkId: string, name: string) => Promise<any>;
447
517
  adoptRunningFork: (forkId: string) => Promise<void>;
448
518
  } | {
449
519
  open: () => void;
@@ -453,6 +523,8 @@ declare function useForkChatPanel(options: ForkChatPanelOptions): {
453
523
  historyMode: "slot" | "boundary";
454
524
  submit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
455
525
  undo: (submittedTargetId?: string, forkId?: string | null) => Promise<any>;
526
+ planRevert: (forkId: string, promptId?: string, mode?: "revert_to" | "remove_step") => Promise<RevertPlan>;
527
+ revert: (args: RevertArgs) => Promise<RevertResponse>;
456
528
  buttonProps: {
457
529
  onClick: () => void;
458
530
  hasNotification: boolean;
@@ -461,6 +533,10 @@ declare function useForkChatPanel(options: ForkChatPanelOptions): {
461
533
  panelProps: {
462
534
  onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
463
535
  onUndo: (submittedTargetId?: string, forkId?: string | null) => Promise<any>;
536
+ onPlanRevert: (forkId: string, promptId?: string, mode?: "revert_to" | "remove_step") => Promise<RevertPlan>;
537
+ onRevert: (args: RevertArgs) => Promise<RevertResponse>;
538
+ onSetForkDisabled: (forkId: string, disabled: boolean) => Promise<any>;
539
+ onRenameFork: (forkId: string, name: string) => Promise<any>;
464
540
  onClose: (() => void) | (() => void);
465
541
  baseUrl: string;
466
542
  apiKey: string;
@@ -478,6 +554,10 @@ declare function useForkChatPanel(options: ForkChatPanelOptions): {
478
554
  } | {
479
555
  onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
480
556
  onUndo: (submittedTargetId?: string, forkId?: string | null) => Promise<any>;
557
+ onPlanRevert: (forkId: string, promptId?: string, mode?: "revert_to" | "remove_step") => Promise<RevertPlan>;
558
+ onRevert: (args: RevertArgs) => Promise<RevertResponse>;
559
+ onSetForkDisabled: (forkId: string, disabled: boolean) => Promise<any>;
560
+ onRenameFork: (forkId: string, name: string) => Promise<any>;
481
561
  onClose: (() => void) | (() => void);
482
562
  baseUrl: string;
483
563
  apiKey: string;
@@ -500,6 +580,9 @@ declare function useForkChatPanel(options: ForkChatPanelOptions): {
500
580
  runs: Record<string, ForkRun>;
501
581
  isOpen: boolean;
502
582
  close: () => void;
583
+ revertFork: (slotId: string, args: RevertArgs) => Promise<RevertResponse>;
584
+ setForkDisabled: (forkId: string, disabled: boolean) => Promise<any>;
585
+ renameFork: (forkId: string, name: string) => Promise<any>;
503
586
  adoptRunningFork: (forkId: string) => Promise<void>;
504
587
  };
505
588
 
package/dist/index.d.ts CHANGED
@@ -69,6 +69,47 @@ interface Fork {
69
69
  error?: string;
70
70
  }
71
71
  type ForkActivityTargetKind = "slot" | "module";
72
+ /** One step of a target's timeline as the revert planner reports it. */
73
+ interface RevertPlanStep {
74
+ forkId: string;
75
+ promptId: string;
76
+ sequence: number;
77
+ kind: "initial" | "follow_up" | "revert";
78
+ prompt: string;
79
+ }
80
+ /** GET /forks/:id/revert-plan — what a revert would remove/keep and which
81
+ * strategies apply. Rendered by the panel's confirm UI; the server
82
+ * recomputes it at execute time. */
83
+ interface RevertPlan {
84
+ mode: "revert_to" | "remove_step";
85
+ targetKind: "slot" | "module";
86
+ targetId: string;
87
+ containerId: string;
88
+ removes: RevertPlanStep[];
89
+ laterSteps: RevertPlanStep[];
90
+ strategies: Array<{
91
+ id: "discard_later" | "keep_later";
92
+ instant: boolean;
93
+ estimateMinutes?: number;
94
+ }>;
95
+ busy: boolean;
96
+ }
97
+ interface RevertArgs {
98
+ forkId: string;
99
+ promptId?: string;
100
+ mode: "revert_to" | "remove_step";
101
+ strategy: "discard_later" | "keep_later";
102
+ }
103
+ /** POST /forks/:id/revert result. agentic=true → the chain-tip fork is
104
+ * running an excise; stream its events like any run. */
105
+ type RevertResponse = {
106
+ agentic: false;
107
+ removed: boolean;
108
+ fork?: Fork;
109
+ } | {
110
+ agentic: true;
111
+ fork: Fork;
112
+ };
72
113
  interface ForkActivity {
73
114
  id: string;
74
115
  status: Fork["status"];
@@ -342,6 +383,14 @@ interface ForkPanelProps {
342
383
  historyMode?: "slot" | "boundary" | "none";
343
384
  onSubmit: (prompt: string, targetId: string, containerId?: string | null, opts?: ForkSubmitOptions) => void;
344
385
  onUndo?: (targetId: string, forkId?: string | null) => Promise<any>;
386
+ /** Classify a revert before executing — drives the inline confirm UI. */
387
+ onPlanRevert?: (forkId: string, promptId?: string, mode?: "revert_to" | "remove_step") => Promise<RevertPlan>;
388
+ /** Execute a revert (undo-to-point / remove-step / agentic excise). */
389
+ onRevert?: (args: RevertArgs) => Promise<RevertResponse>;
390
+ /** Kebab-menu disable/enable toggle for a fork. */
391
+ onSetForkDisabled?: (forkId: string, disabled: boolean) => Promise<any>;
392
+ /** Kebab-menu rename — empty name clears back to the generated title. */
393
+ onRenameFork?: (forkId: string, name: string) => Promise<any>;
345
394
  onClose: () => void;
346
395
  baseUrl?: string;
347
396
  apiKey?: string;
@@ -361,7 +410,7 @@ interface ForkPanelProps {
361
410
  */
362
411
  completeVariant?: "bubble" | "item";
363
412
  }
364
- declare function ForkPanel({ state, fork, events, error, runs, slotId, targetId, targetLabel, historyMode, onSubmit, onUndo, onClose, baseUrl, apiKey, userId, userHash, appId, embedded, completeVariant, }: ForkPanelProps): react_jsx_runtime.JSX.Element;
413
+ declare function ForkPanel({ state, fork, events, error, runs, slotId, targetId, targetLabel, historyMode, onSubmit, onUndo, onPlanRevert, onRevert, onSetForkDisabled, onRenameFork, onClose, baseUrl, apiKey, userId, userHash, appId, embedded, completeVariant, }: ForkPanelProps): react_jsx_runtime.JSX.Element;
365
414
 
366
415
  declare function useFork(): {
367
416
  state: ForkState;
@@ -372,7 +421,11 @@ declare function useFork(): {
372
421
  open: () => void;
373
422
  close: () => void;
374
423
  startFork: (prompt: string, slotId?: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
375
- undoFork: (slotId: string) => Promise<any>;
424
+ undoFork: (slotId: string, forkId?: string | null) => Promise<any>;
425
+ planRevert: (forkId: string, promptId?: string, mode?: "revert_to" | "remove_step") => Promise<RevertPlan>;
426
+ revertFork: (slotId: string, args: RevertArgs) => Promise<RevertResponse>;
427
+ setForkDisabled: (forkId: string, disabled: boolean) => Promise<any>;
428
+ renameFork: (forkId: string, name: string) => Promise<any>;
376
429
  adoptRunningFork: (forkId: string) => Promise<void>;
377
430
  };
378
431
 
@@ -386,6 +439,10 @@ declare function useBoundaryFork(boundaryId: string): {
386
439
  close: () => void;
387
440
  startFork: (prompt: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
388
441
  undoFork: (forkId?: string | null) => Promise<any>;
442
+ planRevert: (forkId: string, promptId?: string, mode?: "revert_to" | "remove_step") => Promise<RevertPlan>;
443
+ revertFork: (args: RevertArgs) => Promise<RevertResponse>;
444
+ setForkDisabled: (forkId: string, disabled: boolean) => Promise<any>;
445
+ renameFork: (forkId: string, name: string) => Promise<any>;
389
446
  adoptRunningFork: (forkId: string) => Promise<void>;
390
447
  };
391
448
 
@@ -397,6 +454,8 @@ declare function useForkChatPanel(options: ForkChatPanelOptions): {
397
454
  historyMode: "slot" | "boundary";
398
455
  submit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
399
456
  undo: (submittedTargetId?: string, forkId?: string | null) => Promise<any>;
457
+ planRevert: (forkId: string, promptId?: string, mode?: "revert_to" | "remove_step") => Promise<RevertPlan>;
458
+ revert: (args: RevertArgs) => Promise<RevertResponse>;
400
459
  buttonProps: {
401
460
  onClick: () => void;
402
461
  hasNotification: boolean;
@@ -405,6 +464,10 @@ declare function useForkChatPanel(options: ForkChatPanelOptions): {
405
464
  panelProps: {
406
465
  onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
407
466
  onUndo: (submittedTargetId?: string, forkId?: string | null) => Promise<any>;
467
+ onPlanRevert: (forkId: string, promptId?: string, mode?: "revert_to" | "remove_step") => Promise<RevertPlan>;
468
+ onRevert: (args: RevertArgs) => Promise<RevertResponse>;
469
+ onSetForkDisabled: (forkId: string, disabled: boolean) => Promise<any>;
470
+ onRenameFork: (forkId: string, name: string) => Promise<any>;
408
471
  onClose: (() => void) | (() => void);
409
472
  baseUrl: string;
410
473
  apiKey: string;
@@ -422,6 +485,10 @@ declare function useForkChatPanel(options: ForkChatPanelOptions): {
422
485
  } | {
423
486
  onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
424
487
  onUndo: (submittedTargetId?: string, forkId?: string | null) => Promise<any>;
488
+ onPlanRevert: (forkId: string, promptId?: string, mode?: "revert_to" | "remove_step") => Promise<RevertPlan>;
489
+ onRevert: (args: RevertArgs) => Promise<RevertResponse>;
490
+ onSetForkDisabled: (forkId: string, disabled: boolean) => Promise<any>;
491
+ onRenameFork: (forkId: string, name: string) => Promise<any>;
425
492
  onClose: (() => void) | (() => void);
426
493
  baseUrl: string;
427
494
  apiKey: string;
@@ -444,6 +511,9 @@ declare function useForkChatPanel(options: ForkChatPanelOptions): {
444
511
  runs: Record<string, ForkRun>;
445
512
  isOpen: boolean;
446
513
  close: () => void;
514
+ revertFork: (args: RevertArgs) => Promise<RevertResponse>;
515
+ setForkDisabled: (forkId: string, disabled: boolean) => Promise<any>;
516
+ renameFork: (forkId: string, name: string) => Promise<any>;
447
517
  adoptRunningFork: (forkId: string) => Promise<void>;
448
518
  } | {
449
519
  open: () => void;
@@ -453,6 +523,8 @@ declare function useForkChatPanel(options: ForkChatPanelOptions): {
453
523
  historyMode: "slot" | "boundary";
454
524
  submit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
455
525
  undo: (submittedTargetId?: string, forkId?: string | null) => Promise<any>;
526
+ planRevert: (forkId: string, promptId?: string, mode?: "revert_to" | "remove_step") => Promise<RevertPlan>;
527
+ revert: (args: RevertArgs) => Promise<RevertResponse>;
456
528
  buttonProps: {
457
529
  onClick: () => void;
458
530
  hasNotification: boolean;
@@ -461,6 +533,10 @@ declare function useForkChatPanel(options: ForkChatPanelOptions): {
461
533
  panelProps: {
462
534
  onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
463
535
  onUndo: (submittedTargetId?: string, forkId?: string | null) => Promise<any>;
536
+ onPlanRevert: (forkId: string, promptId?: string, mode?: "revert_to" | "remove_step") => Promise<RevertPlan>;
537
+ onRevert: (args: RevertArgs) => Promise<RevertResponse>;
538
+ onSetForkDisabled: (forkId: string, disabled: boolean) => Promise<any>;
539
+ onRenameFork: (forkId: string, name: string) => Promise<any>;
464
540
  onClose: (() => void) | (() => void);
465
541
  baseUrl: string;
466
542
  apiKey: string;
@@ -478,6 +554,10 @@ declare function useForkChatPanel(options: ForkChatPanelOptions): {
478
554
  } | {
479
555
  onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
480
556
  onUndo: (submittedTargetId?: string, forkId?: string | null) => Promise<any>;
557
+ onPlanRevert: (forkId: string, promptId?: string, mode?: "revert_to" | "remove_step") => Promise<RevertPlan>;
558
+ onRevert: (args: RevertArgs) => Promise<RevertResponse>;
559
+ onSetForkDisabled: (forkId: string, disabled: boolean) => Promise<any>;
560
+ onRenameFork: (forkId: string, name: string) => Promise<any>;
481
561
  onClose: (() => void) | (() => void);
482
562
  baseUrl: string;
483
563
  apiKey: string;
@@ -500,6 +580,9 @@ declare function useForkChatPanel(options: ForkChatPanelOptions): {
500
580
  runs: Record<string, ForkRun>;
501
581
  isOpen: boolean;
502
582
  close: () => void;
583
+ revertFork: (slotId: string, args: RevertArgs) => Promise<RevertResponse>;
584
+ setForkDisabled: (forkId: string, disabled: boolean) => Promise<any>;
585
+ renameFork: (forkId: string, name: string) => Promise<any>;
503
586
  adoptRunningFork: (forkId: string) => Promise<void>;
504
587
  };
505
588