@fork-api/chat-sdk 0.1.180 → 0.1.182

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
@@ -1,6 +1,50 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode, ReactElement, ComponentType } from 'react';
3
3
 
4
+ /**
5
+ * DOM element picker — the Chrome-DevTools-inspect experience for the chat
6
+ * panel. While active it paints a highlight overlay + label over whatever
7
+ * host-page element the cursor is on; clicking captures a structured context
8
+ * blob for the agent, Esc cancels.
9
+ *
10
+ * The overlay mounts directly on document.body (NOT inside the panel's
11
+ * shadow root) so it can sit over host elements, and it is pointer-events:
12
+ * none so document.elementFromPoint() resolves the real host target.
13
+ * Everything inside the Fork panel/launcher hosts is ignored — hovering the
14
+ * panel clears the highlight, clicking it neither selects nor cancels.
15
+ */
16
+ interface SelectedElementContext {
17
+ tag: string;
18
+ id?: string;
19
+ classes?: string[];
20
+ selector?: string;
21
+ componentName?: string;
22
+ text?: string;
23
+ html?: string;
24
+ rect?: {
25
+ x: number;
26
+ y: number;
27
+ width: number;
28
+ height: number;
29
+ };
30
+ }
31
+
32
+ /** Image attachment riding on a fork prompt (raw base64 + media type). */
33
+ interface ForkPromptAttachment {
34
+ mediaType: string;
35
+ data: string;
36
+ }
37
+ /** Options for submitting a prompt from the chat panel. */
38
+ interface ForkSubmitOptions {
39
+ /** Follow-up on this fork (otherwise a new fork is composed). */
40
+ forkId?: string | null;
41
+ /** Force a new fork even when one exists for the target. */
42
+ forceNew?: boolean;
43
+ /** Screenshots pasted/uploaded into the composer. */
44
+ attachments?: ForkPromptAttachment[];
45
+ /** DOM element the user picked on the page for context. */
46
+ selectedElement?: SelectedElementContext | null;
47
+ }
4
48
  interface Fork {
5
49
  id: string;
6
50
  userId: string;
@@ -296,11 +340,8 @@ interface ForkPanelProps {
296
340
  targetId?: string;
297
341
  targetLabel?: string;
298
342
  historyMode?: "slot" | "boundary" | "none";
299
- onSubmit: (prompt: string, targetId: string, containerId?: string | null, opts?: {
300
- forkId?: string | null;
301
- forceNew?: boolean;
302
- }) => void;
303
- onUndo?: (targetId: string) => Promise<any>;
343
+ onSubmit: (prompt: string, targetId: string, containerId?: string | null, opts?: ForkSubmitOptions) => void;
344
+ onUndo?: (targetId: string, forkId?: string | null) => Promise<any>;
304
345
  onClose: () => void;
305
346
  baseUrl?: string;
306
347
  apiKey?: string;
@@ -330,10 +371,7 @@ declare function useFork(): {
330
371
  runs: Record<string, ForkRun>;
331
372
  open: () => void;
332
373
  close: () => void;
333
- startFork: (prompt: string, slotId?: string, containerId?: string | null, opts?: {
334
- forkId?: string | null;
335
- forceNew?: boolean;
336
- }) => Promise<void>;
374
+ startFork: (prompt: string, slotId?: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
337
375
  undoFork: (slotId: string) => Promise<any>;
338
376
  adoptRunningFork: (forkId: string) => Promise<void>;
339
377
  };
@@ -346,11 +384,8 @@ declare function useBoundaryFork(boundaryId: string): {
346
384
  runs: Record<string, ForkRun>;
347
385
  open: () => void;
348
386
  close: () => void;
349
- startFork: (prompt: string, containerId?: string | null, opts?: {
350
- forkId?: string | null;
351
- forceNew?: boolean;
352
- }) => Promise<void>;
353
- undoFork: () => Promise<any>;
387
+ startFork: (prompt: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
388
+ undoFork: (forkId?: string | null) => Promise<any>;
354
389
  adoptRunningFork: (forkId: string) => Promise<void>;
355
390
  };
356
391
 
@@ -360,22 +395,16 @@ declare function useForkChatPanel(options: ForkChatPanelOptions): {
360
395
  targetId: string;
361
396
  targetLabel: string | undefined;
362
397
  historyMode: "slot" | "boundary";
363
- submit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: {
364
- forkId?: string | null;
365
- forceNew?: boolean;
366
- }) => Promise<void>;
367
- undo: (submittedTargetId?: string) => Promise<any>;
398
+ submit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
399
+ undo: (submittedTargetId?: string, forkId?: string | null) => Promise<any>;
368
400
  buttonProps: {
369
401
  onClick: () => void;
370
402
  hasNotification: boolean;
371
403
  activity: ForkActivitySummary;
372
404
  };
373
405
  panelProps: {
374
- onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: {
375
- forkId?: string | null;
376
- forceNew?: boolean;
377
- }) => Promise<void>;
378
- onUndo: (submittedTargetId?: string) => Promise<any>;
406
+ onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
407
+ onUndo: (submittedTargetId?: string, forkId?: string | null) => Promise<any>;
379
408
  onClose: (() => void) | (() => void);
380
409
  baseUrl: string;
381
410
  apiKey: string;
@@ -391,11 +420,8 @@ declare function useForkChatPanel(options: ForkChatPanelOptions): {
391
420
  error: string | null;
392
421
  runs: Record<string, ForkRun>;
393
422
  } | {
394
- onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: {
395
- forkId?: string | null;
396
- forceNew?: boolean;
397
- }) => Promise<void>;
398
- onUndo: (submittedTargetId?: string) => Promise<any>;
423
+ onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
424
+ onUndo: (submittedTargetId?: string, forkId?: string | null) => Promise<any>;
399
425
  onClose: (() => void) | (() => void);
400
426
  baseUrl: string;
401
427
  apiKey: string;
@@ -425,22 +451,16 @@ declare function useForkChatPanel(options: ForkChatPanelOptions): {
425
451
  targetId: string;
426
452
  targetLabel: string | undefined;
427
453
  historyMode: "slot" | "boundary";
428
- submit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: {
429
- forkId?: string | null;
430
- forceNew?: boolean;
431
- }) => Promise<void>;
432
- undo: (submittedTargetId?: string) => Promise<any>;
454
+ submit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
455
+ undo: (submittedTargetId?: string, forkId?: string | null) => Promise<any>;
433
456
  buttonProps: {
434
457
  onClick: () => void;
435
458
  hasNotification: boolean;
436
459
  activity: ForkActivitySummary;
437
460
  };
438
461
  panelProps: {
439
- onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: {
440
- forkId?: string | null;
441
- forceNew?: boolean;
442
- }) => Promise<void>;
443
- onUndo: (submittedTargetId?: string) => Promise<any>;
462
+ onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
463
+ onUndo: (submittedTargetId?: string, forkId?: string | null) => Promise<any>;
444
464
  onClose: (() => void) | (() => void);
445
465
  baseUrl: string;
446
466
  apiKey: string;
@@ -456,11 +476,8 @@ declare function useForkChatPanel(options: ForkChatPanelOptions): {
456
476
  error: string | null;
457
477
  runs: Record<string, ForkRun>;
458
478
  } | {
459
- onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: {
460
- forkId?: string | null;
461
- forceNew?: boolean;
462
- }) => Promise<void>;
463
- onUndo: (submittedTargetId?: string) => Promise<any>;
479
+ onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
480
+ onUndo: (submittedTargetId?: string, forkId?: string | null) => Promise<any>;
464
481
  onClose: (() => void) | (() => void);
465
482
  baseUrl: string;
466
483
  apiKey: string;
@@ -851,4 +868,4 @@ declare function clearCachedManifest(tenantId: string, appId: string, userId: st
851
868
  */
852
869
  declare function manifestDiffers(a: Manifest | null, b: Manifest | null): boolean;
853
870
 
854
- export { type AdminContainer, type AdminContext, type EnsureFeatureInput, type EnsureLlmJobsInput, type Fork, type ForkActivity, type ForkActivitySummary, type ForkActivityTargetKind, type ForkBoundaryDefinition, ForkBoundaryUI, ForkButton, ForkChatInterface, type ForkChatInterfaceProps, type ForkChatPanelOptions, type ForkChatTarget, type ForkDataClient, type ForkDataClientConfig, type ForkDataSource, type ForkDataStatus, type ForkEntityRef, type ForkEvent, type ForkFeature, type ForkFeatureKind, type ForkFeatureOption, type ForkFeatureValue, type ForkLlmJob, type ForkLlmJobStatus, ForkPanel, ForkProvider, type ForkProviderProps, type ForkSharedRegistry, ForkSlot, type ForkSlotProps, type ForkState, ForkUI, type LoadManifestInput, type Manifest, type ManifestEntry, type ManifestModuleEntry, type QueryLlmJobsInput, type QueryValuesInput, type SetOptionsInput, type SetValuesInput, type UseForkFeatureValuesInput, type UseForkLlmJobsInput, clearCachedManifest, createForkDataClient, forkEntityValueKey, forkable, loadManifest, manifestDiffers, readCachedManifest, registerForkShared, useBoundaryFork, useFork, useForkChatPanel, useForkDataClient, useForkDataMutation, useForkFeatureValues, useForkLlmJobs, writeCachedManifest };
871
+ export { type AdminContainer, type AdminContext, type EnsureFeatureInput, type EnsureLlmJobsInput, type Fork, type ForkActivity, type ForkActivitySummary, type ForkActivityTargetKind, type ForkBoundaryDefinition, ForkBoundaryUI, ForkButton, ForkChatInterface, type ForkChatInterfaceProps, type ForkChatPanelOptions, type ForkChatTarget, type ForkDataClient, type ForkDataClientConfig, type ForkDataSource, type ForkDataStatus, type ForkEntityRef, type ForkEvent, type ForkFeature, type ForkFeatureKind, type ForkFeatureOption, type ForkFeatureValue, type ForkLlmJob, type ForkLlmJobStatus, ForkPanel, type ForkPromptAttachment, ForkProvider, type ForkProviderProps, type ForkSharedRegistry, ForkSlot, type ForkSlotProps, type ForkState, type ForkSubmitOptions, ForkUI, type LoadManifestInput, type Manifest, type ManifestEntry, type ManifestModuleEntry, type QueryLlmJobsInput, type QueryValuesInput, type SelectedElementContext, type SetOptionsInput, type SetValuesInput, type UseForkFeatureValuesInput, type UseForkLlmJobsInput, clearCachedManifest, createForkDataClient, forkEntityValueKey, forkable, loadManifest, manifestDiffers, readCachedManifest, registerForkShared, useBoundaryFork, useFork, useForkChatPanel, useForkDataClient, useForkDataMutation, useForkFeatureValues, useForkLlmJobs, writeCachedManifest };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,50 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode, ReactElement, ComponentType } from 'react';
3
3
 
4
+ /**
5
+ * DOM element picker — the Chrome-DevTools-inspect experience for the chat
6
+ * panel. While active it paints a highlight overlay + label over whatever
7
+ * host-page element the cursor is on; clicking captures a structured context
8
+ * blob for the agent, Esc cancels.
9
+ *
10
+ * The overlay mounts directly on document.body (NOT inside the panel's
11
+ * shadow root) so it can sit over host elements, and it is pointer-events:
12
+ * none so document.elementFromPoint() resolves the real host target.
13
+ * Everything inside the Fork panel/launcher hosts is ignored — hovering the
14
+ * panel clears the highlight, clicking it neither selects nor cancels.
15
+ */
16
+ interface SelectedElementContext {
17
+ tag: string;
18
+ id?: string;
19
+ classes?: string[];
20
+ selector?: string;
21
+ componentName?: string;
22
+ text?: string;
23
+ html?: string;
24
+ rect?: {
25
+ x: number;
26
+ y: number;
27
+ width: number;
28
+ height: number;
29
+ };
30
+ }
31
+
32
+ /** Image attachment riding on a fork prompt (raw base64 + media type). */
33
+ interface ForkPromptAttachment {
34
+ mediaType: string;
35
+ data: string;
36
+ }
37
+ /** Options for submitting a prompt from the chat panel. */
38
+ interface ForkSubmitOptions {
39
+ /** Follow-up on this fork (otherwise a new fork is composed). */
40
+ forkId?: string | null;
41
+ /** Force a new fork even when one exists for the target. */
42
+ forceNew?: boolean;
43
+ /** Screenshots pasted/uploaded into the composer. */
44
+ attachments?: ForkPromptAttachment[];
45
+ /** DOM element the user picked on the page for context. */
46
+ selectedElement?: SelectedElementContext | null;
47
+ }
4
48
  interface Fork {
5
49
  id: string;
6
50
  userId: string;
@@ -296,11 +340,8 @@ interface ForkPanelProps {
296
340
  targetId?: string;
297
341
  targetLabel?: string;
298
342
  historyMode?: "slot" | "boundary" | "none";
299
- onSubmit: (prompt: string, targetId: string, containerId?: string | null, opts?: {
300
- forkId?: string | null;
301
- forceNew?: boolean;
302
- }) => void;
303
- onUndo?: (targetId: string) => Promise<any>;
343
+ onSubmit: (prompt: string, targetId: string, containerId?: string | null, opts?: ForkSubmitOptions) => void;
344
+ onUndo?: (targetId: string, forkId?: string | null) => Promise<any>;
304
345
  onClose: () => void;
305
346
  baseUrl?: string;
306
347
  apiKey?: string;
@@ -330,10 +371,7 @@ declare function useFork(): {
330
371
  runs: Record<string, ForkRun>;
331
372
  open: () => void;
332
373
  close: () => void;
333
- startFork: (prompt: string, slotId?: string, containerId?: string | null, opts?: {
334
- forkId?: string | null;
335
- forceNew?: boolean;
336
- }) => Promise<void>;
374
+ startFork: (prompt: string, slotId?: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
337
375
  undoFork: (slotId: string) => Promise<any>;
338
376
  adoptRunningFork: (forkId: string) => Promise<void>;
339
377
  };
@@ -346,11 +384,8 @@ declare function useBoundaryFork(boundaryId: string): {
346
384
  runs: Record<string, ForkRun>;
347
385
  open: () => void;
348
386
  close: () => void;
349
- startFork: (prompt: string, containerId?: string | null, opts?: {
350
- forkId?: string | null;
351
- forceNew?: boolean;
352
- }) => Promise<void>;
353
- undoFork: () => Promise<any>;
387
+ startFork: (prompt: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
388
+ undoFork: (forkId?: string | null) => Promise<any>;
354
389
  adoptRunningFork: (forkId: string) => Promise<void>;
355
390
  };
356
391
 
@@ -360,22 +395,16 @@ declare function useForkChatPanel(options: ForkChatPanelOptions): {
360
395
  targetId: string;
361
396
  targetLabel: string | undefined;
362
397
  historyMode: "slot" | "boundary";
363
- submit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: {
364
- forkId?: string | null;
365
- forceNew?: boolean;
366
- }) => Promise<void>;
367
- undo: (submittedTargetId?: string) => Promise<any>;
398
+ submit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
399
+ undo: (submittedTargetId?: string, forkId?: string | null) => Promise<any>;
368
400
  buttonProps: {
369
401
  onClick: () => void;
370
402
  hasNotification: boolean;
371
403
  activity: ForkActivitySummary;
372
404
  };
373
405
  panelProps: {
374
- onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: {
375
- forkId?: string | null;
376
- forceNew?: boolean;
377
- }) => Promise<void>;
378
- onUndo: (submittedTargetId?: string) => Promise<any>;
406
+ onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
407
+ onUndo: (submittedTargetId?: string, forkId?: string | null) => Promise<any>;
379
408
  onClose: (() => void) | (() => void);
380
409
  baseUrl: string;
381
410
  apiKey: string;
@@ -391,11 +420,8 @@ declare function useForkChatPanel(options: ForkChatPanelOptions): {
391
420
  error: string | null;
392
421
  runs: Record<string, ForkRun>;
393
422
  } | {
394
- onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: {
395
- forkId?: string | null;
396
- forceNew?: boolean;
397
- }) => Promise<void>;
398
- onUndo: (submittedTargetId?: string) => Promise<any>;
423
+ onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
424
+ onUndo: (submittedTargetId?: string, forkId?: string | null) => Promise<any>;
399
425
  onClose: (() => void) | (() => void);
400
426
  baseUrl: string;
401
427
  apiKey: string;
@@ -425,22 +451,16 @@ declare function useForkChatPanel(options: ForkChatPanelOptions): {
425
451
  targetId: string;
426
452
  targetLabel: string | undefined;
427
453
  historyMode: "slot" | "boundary";
428
- submit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: {
429
- forkId?: string | null;
430
- forceNew?: boolean;
431
- }) => Promise<void>;
432
- undo: (submittedTargetId?: string) => Promise<any>;
454
+ submit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
455
+ undo: (submittedTargetId?: string, forkId?: string | null) => Promise<any>;
433
456
  buttonProps: {
434
457
  onClick: () => void;
435
458
  hasNotification: boolean;
436
459
  activity: ForkActivitySummary;
437
460
  };
438
461
  panelProps: {
439
- onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: {
440
- forkId?: string | null;
441
- forceNew?: boolean;
442
- }) => Promise<void>;
443
- onUndo: (submittedTargetId?: string) => Promise<any>;
462
+ onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
463
+ onUndo: (submittedTargetId?: string, forkId?: string | null) => Promise<any>;
444
464
  onClose: (() => void) | (() => void);
445
465
  baseUrl: string;
446
466
  apiKey: string;
@@ -456,11 +476,8 @@ declare function useForkChatPanel(options: ForkChatPanelOptions): {
456
476
  error: string | null;
457
477
  runs: Record<string, ForkRun>;
458
478
  } | {
459
- onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: {
460
- forkId?: string | null;
461
- forceNew?: boolean;
462
- }) => Promise<void>;
463
- onUndo: (submittedTargetId?: string) => Promise<any>;
479
+ onSubmit: (prompt: string, submittedTargetId?: string, containerId?: string | null, opts?: ForkSubmitOptions) => Promise<void>;
480
+ onUndo: (submittedTargetId?: string, forkId?: string | null) => Promise<any>;
464
481
  onClose: (() => void) | (() => void);
465
482
  baseUrl: string;
466
483
  apiKey: string;
@@ -851,4 +868,4 @@ declare function clearCachedManifest(tenantId: string, appId: string, userId: st
851
868
  */
852
869
  declare function manifestDiffers(a: Manifest | null, b: Manifest | null): boolean;
853
870
 
854
- export { type AdminContainer, type AdminContext, type EnsureFeatureInput, type EnsureLlmJobsInput, type Fork, type ForkActivity, type ForkActivitySummary, type ForkActivityTargetKind, type ForkBoundaryDefinition, ForkBoundaryUI, ForkButton, ForkChatInterface, type ForkChatInterfaceProps, type ForkChatPanelOptions, type ForkChatTarget, type ForkDataClient, type ForkDataClientConfig, type ForkDataSource, type ForkDataStatus, type ForkEntityRef, type ForkEvent, type ForkFeature, type ForkFeatureKind, type ForkFeatureOption, type ForkFeatureValue, type ForkLlmJob, type ForkLlmJobStatus, ForkPanel, ForkProvider, type ForkProviderProps, type ForkSharedRegistry, ForkSlot, type ForkSlotProps, type ForkState, ForkUI, type LoadManifestInput, type Manifest, type ManifestEntry, type ManifestModuleEntry, type QueryLlmJobsInput, type QueryValuesInput, type SetOptionsInput, type SetValuesInput, type UseForkFeatureValuesInput, type UseForkLlmJobsInput, clearCachedManifest, createForkDataClient, forkEntityValueKey, forkable, loadManifest, manifestDiffers, readCachedManifest, registerForkShared, useBoundaryFork, useFork, useForkChatPanel, useForkDataClient, useForkDataMutation, useForkFeatureValues, useForkLlmJobs, writeCachedManifest };
871
+ export { type AdminContainer, type AdminContext, type EnsureFeatureInput, type EnsureLlmJobsInput, type Fork, type ForkActivity, type ForkActivitySummary, type ForkActivityTargetKind, type ForkBoundaryDefinition, ForkBoundaryUI, ForkButton, ForkChatInterface, type ForkChatInterfaceProps, type ForkChatPanelOptions, type ForkChatTarget, type ForkDataClient, type ForkDataClientConfig, type ForkDataSource, type ForkDataStatus, type ForkEntityRef, type ForkEvent, type ForkFeature, type ForkFeatureKind, type ForkFeatureOption, type ForkFeatureValue, type ForkLlmJob, type ForkLlmJobStatus, ForkPanel, type ForkPromptAttachment, ForkProvider, type ForkProviderProps, type ForkSharedRegistry, ForkSlot, type ForkSlotProps, type ForkState, type ForkSubmitOptions, ForkUI, type LoadManifestInput, type Manifest, type ManifestEntry, type ManifestModuleEntry, type QueryLlmJobsInput, type QueryValuesInput, type SelectedElementContext, type SetOptionsInput, type SetValuesInput, type UseForkFeatureValuesInput, type UseForkLlmJobsInput, clearCachedManifest, createForkDataClient, forkEntityValueKey, forkable, loadManifest, manifestDiffers, readCachedManifest, registerForkShared, useBoundaryFork, useFork, useForkChatPanel, useForkDataClient, useForkDataMutation, useForkFeatureValues, useForkLlmJobs, writeCachedManifest };