@fork-api/chat-sdk 0.1.164 → 0.1.167
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.cjs +8 -8
- package/dist/index.d.cts +265 -2
- package/dist/index.d.ts +265 -2
- package/dist/index.js +8 -8
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -153,6 +153,12 @@ interface ForkSlotProps {
|
|
|
153
153
|
children: ReactElement<unknown, ComponentType<any>>;
|
|
154
154
|
/** Whitelist of API paths the forked component can fetch (iframe mode only). In direct mode, the component can call fetch() natively. */
|
|
155
155
|
allowedFetches?: string[];
|
|
156
|
+
/**
|
|
157
|
+
* Stable host-entity identity for persistent Fork data and LLM features.
|
|
158
|
+
* Example:
|
|
159
|
+
* { rows: { entityType: "account", getId: "id", hashFields: ["name", "stage"] } }
|
|
160
|
+
*/
|
|
161
|
+
entityBindings?: Record<string, unknown>;
|
|
156
162
|
/** Optional GitHub repo in "owner/repo" format. If omitted, Fork resolves repo access from appId onboarding metadata. */
|
|
157
163
|
githubRepo?: string;
|
|
158
164
|
/** Callbacks the forked component can invoke on the parent app (bridged via postMessage) */
|
|
@@ -210,9 +216,17 @@ interface PreviewSessionPayload {
|
|
|
210
216
|
|
|
211
217
|
declare function usePreviewSession(): PreviewSessionPayload | null;
|
|
212
218
|
|
|
219
|
+
interface ForkRuntimeGlobal {
|
|
220
|
+
dataFetch: (path: string, body?: unknown, method?: string) => Promise<any>;
|
|
221
|
+
}
|
|
222
|
+
declare global {
|
|
223
|
+
interface Window {
|
|
224
|
+
__FORK_RUNTIME__?: ForkRuntimeGlobal;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
213
227
|
declare function ForkProvider(props: ForkProviderProps): react_jsx_runtime.JSX.Element;
|
|
214
228
|
|
|
215
|
-
declare function ForkSlot({ slotId, props, children, allowedFetches, githubRepo, callbacks, mode, shared, events }: ForkSlotProps): react_jsx_runtime.JSX.Element;
|
|
229
|
+
declare function ForkSlot({ slotId, props, children, allowedFetches, entityBindings, githubRepo, callbacks, mode, shared, events }: ForkSlotProps): react_jsx_runtime.JSX.Element;
|
|
216
230
|
|
|
217
231
|
declare function ForkChatInterface(props: ForkChatInterfaceProps): react_jsx_runtime.JSX.Element;
|
|
218
232
|
|
|
@@ -433,6 +447,255 @@ declare function useForkChatPanel(options: ForkChatPanelOptions): {
|
|
|
433
447
|
adoptRunningFork: (forkId: string) => Promise<void>;
|
|
434
448
|
};
|
|
435
449
|
|
|
450
|
+
type ForkFeatureKind = "data_value" | "llm_field" | "tagging" | "briefing" | "kv_store";
|
|
451
|
+
type ForkDataSource = "user" | "llm" | "system";
|
|
452
|
+
type ForkDataStatus = "pending" | "complete" | "error" | "stale";
|
|
453
|
+
type ForkLlmJobStatus = "queued" | "running" | "complete" | "error" | "cancelled";
|
|
454
|
+
interface ForkEntityRef {
|
|
455
|
+
namespace?: string;
|
|
456
|
+
type: string;
|
|
457
|
+
id: string;
|
|
458
|
+
}
|
|
459
|
+
interface ForkFeature {
|
|
460
|
+
id: string;
|
|
461
|
+
tenantId: string;
|
|
462
|
+
appId: string;
|
|
463
|
+
containerId: string;
|
|
464
|
+
forkId: string | null;
|
|
465
|
+
artifactId: string | null;
|
|
466
|
+
targetKind: "slot" | "module" | null;
|
|
467
|
+
targetId: string | null;
|
|
468
|
+
key: string;
|
|
469
|
+
kind: ForkFeatureKind;
|
|
470
|
+
config: Record<string, unknown>;
|
|
471
|
+
status: "active" | "archived";
|
|
472
|
+
createdAt: string;
|
|
473
|
+
updatedAt: string;
|
|
474
|
+
}
|
|
475
|
+
interface ForkFeatureValue<T = unknown> {
|
|
476
|
+
id: string;
|
|
477
|
+
tenantId: string;
|
|
478
|
+
appId: string;
|
|
479
|
+
containerId: string;
|
|
480
|
+
featureId: string;
|
|
481
|
+
entity: Required<ForkEntityRef>;
|
|
482
|
+
valueKey: string;
|
|
483
|
+
value: T;
|
|
484
|
+
inputHash: string | null;
|
|
485
|
+
source: ForkDataSource;
|
|
486
|
+
llmJobId: string | null;
|
|
487
|
+
status: ForkDataStatus;
|
|
488
|
+
createdAt: string;
|
|
489
|
+
updatedAt: string;
|
|
490
|
+
}
|
|
491
|
+
interface ForkFeatureOption {
|
|
492
|
+
id: string;
|
|
493
|
+
featureId: string;
|
|
494
|
+
optionKey: string;
|
|
495
|
+
label: string;
|
|
496
|
+
color: string | null;
|
|
497
|
+
metadata: Record<string, unknown>;
|
|
498
|
+
archivedAt: string | null;
|
|
499
|
+
createdAt: string;
|
|
500
|
+
updatedAt: string;
|
|
501
|
+
}
|
|
502
|
+
interface ForkLlmJob {
|
|
503
|
+
id: string;
|
|
504
|
+
tenantId: string;
|
|
505
|
+
appId: string;
|
|
506
|
+
containerId: string;
|
|
507
|
+
forkId: string | null;
|
|
508
|
+
featureId: string;
|
|
509
|
+
entity: Required<ForkEntityRef>;
|
|
510
|
+
valueKey: string;
|
|
511
|
+
operation: string;
|
|
512
|
+
inputHash: string;
|
|
513
|
+
promptHash: string;
|
|
514
|
+
model: string;
|
|
515
|
+
status: ForkLlmJobStatus;
|
|
516
|
+
attempts: number;
|
|
517
|
+
result: unknown;
|
|
518
|
+
error: string | null;
|
|
519
|
+
promptTokens: number;
|
|
520
|
+
completionTokens: number;
|
|
521
|
+
cacheReadTokens: number;
|
|
522
|
+
cacheWriteTokens: number;
|
|
523
|
+
costUsd: number;
|
|
524
|
+
latencyMs: number | null;
|
|
525
|
+
valueId: string | null;
|
|
526
|
+
createdAt: string;
|
|
527
|
+
startedAt: string | null;
|
|
528
|
+
completedAt: string | null;
|
|
529
|
+
updatedAt: string;
|
|
530
|
+
}
|
|
531
|
+
interface ForkDataClientConfig {
|
|
532
|
+
baseUrl: string;
|
|
533
|
+
apiKey: string;
|
|
534
|
+
appId: string;
|
|
535
|
+
containerId: string;
|
|
536
|
+
userId?: string;
|
|
537
|
+
userHash?: string;
|
|
538
|
+
extraHeaders?: Record<string, string>;
|
|
539
|
+
}
|
|
540
|
+
interface EnsureFeatureInput {
|
|
541
|
+
key: string;
|
|
542
|
+
kind?: ForkFeatureKind;
|
|
543
|
+
config?: Record<string, unknown>;
|
|
544
|
+
forkId?: string | null;
|
|
545
|
+
artifactId?: string | null;
|
|
546
|
+
targetKind?: "slot" | "module" | null;
|
|
547
|
+
targetId?: string | null;
|
|
548
|
+
}
|
|
549
|
+
interface QueryValuesInput {
|
|
550
|
+
featureId?: string;
|
|
551
|
+
featureKey?: string;
|
|
552
|
+
entities?: ForkEntityRef[];
|
|
553
|
+
valueKeys?: string[];
|
|
554
|
+
}
|
|
555
|
+
interface SetValuesInput {
|
|
556
|
+
featureId?: string;
|
|
557
|
+
featureKey?: string;
|
|
558
|
+
kind?: ForkFeatureKind;
|
|
559
|
+
config?: Record<string, unknown>;
|
|
560
|
+
values: Array<{
|
|
561
|
+
entity: ForkEntityRef;
|
|
562
|
+
valueKey?: string;
|
|
563
|
+
value: unknown;
|
|
564
|
+
inputHash?: string | null;
|
|
565
|
+
source?: ForkDataSource;
|
|
566
|
+
status?: ForkDataStatus;
|
|
567
|
+
}>;
|
|
568
|
+
}
|
|
569
|
+
interface SetOptionsInput {
|
|
570
|
+
featureId?: string;
|
|
571
|
+
featureKey?: string;
|
|
572
|
+
kind?: ForkFeatureKind;
|
|
573
|
+
config?: Record<string, unknown>;
|
|
574
|
+
options: Array<{
|
|
575
|
+
optionKey: string;
|
|
576
|
+
label: string;
|
|
577
|
+
color?: string | null;
|
|
578
|
+
metadata?: Record<string, unknown>;
|
|
579
|
+
archived?: boolean;
|
|
580
|
+
}>;
|
|
581
|
+
}
|
|
582
|
+
interface EnsureLlmJobsInput {
|
|
583
|
+
featureId?: string;
|
|
584
|
+
featureKey?: string;
|
|
585
|
+
kind?: ForkFeatureKind;
|
|
586
|
+
config?: Record<string, unknown>;
|
|
587
|
+
forkId?: string | null;
|
|
588
|
+
targetKind?: "slot" | "module" | null;
|
|
589
|
+
targetId?: string | null;
|
|
590
|
+
operation?: string;
|
|
591
|
+
model?: string;
|
|
592
|
+
prompt?: string;
|
|
593
|
+
system?: string;
|
|
594
|
+
promptHash?: string;
|
|
595
|
+
outputFormat?: "text" | "json";
|
|
596
|
+
maxTokens?: number;
|
|
597
|
+
temperature?: number;
|
|
598
|
+
force?: boolean;
|
|
599
|
+
jobs: Array<{
|
|
600
|
+
entity: ForkEntityRef;
|
|
601
|
+
valueKey?: string;
|
|
602
|
+
input: unknown;
|
|
603
|
+
inputHash?: string;
|
|
604
|
+
metadata?: Record<string, unknown>;
|
|
605
|
+
}>;
|
|
606
|
+
}
|
|
607
|
+
interface QueryLlmJobsInput {
|
|
608
|
+
jobIds?: string[];
|
|
609
|
+
featureId?: string;
|
|
610
|
+
featureKey?: string;
|
|
611
|
+
entities?: ForkEntityRef[];
|
|
612
|
+
}
|
|
613
|
+
interface ForkDataClient {
|
|
614
|
+
listFeatures(): Promise<{
|
|
615
|
+
features: ForkFeature[];
|
|
616
|
+
}>;
|
|
617
|
+
ensureFeature(input: EnsureFeatureInput): Promise<{
|
|
618
|
+
feature: ForkFeature;
|
|
619
|
+
}>;
|
|
620
|
+
queryValues<T = unknown>(input: QueryValuesInput): Promise<{
|
|
621
|
+
feature: ForkFeature | null;
|
|
622
|
+
values: Array<ForkFeatureValue<T>>;
|
|
623
|
+
}>;
|
|
624
|
+
setValues(input: SetValuesInput): Promise<{
|
|
625
|
+
feature: ForkFeature;
|
|
626
|
+
values: ForkFeatureValue[];
|
|
627
|
+
}>;
|
|
628
|
+
listOptions(input: {
|
|
629
|
+
featureId?: string;
|
|
630
|
+
featureKey?: string;
|
|
631
|
+
includeArchived?: boolean;
|
|
632
|
+
}): Promise<{
|
|
633
|
+
feature: ForkFeature | null;
|
|
634
|
+
options: ForkFeatureOption[];
|
|
635
|
+
}>;
|
|
636
|
+
setOptions(input: SetOptionsInput): Promise<{
|
|
637
|
+
feature: ForkFeature;
|
|
638
|
+
options: ForkFeatureOption[];
|
|
639
|
+
}>;
|
|
640
|
+
ensureLlmJobs(input: EnsureLlmJobsInput): Promise<{
|
|
641
|
+
feature: ForkFeature;
|
|
642
|
+
jobs: ForkLlmJob[];
|
|
643
|
+
values: ForkFeatureValue[];
|
|
644
|
+
}>;
|
|
645
|
+
queryLlmJobs(input: QueryLlmJobsInput): Promise<{
|
|
646
|
+
feature: ForkFeature | null;
|
|
647
|
+
jobs: ForkLlmJob[];
|
|
648
|
+
}>;
|
|
649
|
+
}
|
|
650
|
+
declare function forkEntityValueKey(entity: ForkEntityRef, valueKey?: string): string;
|
|
651
|
+
declare function createForkDataClient(config: ForkDataClientConfig): ForkDataClient;
|
|
652
|
+
declare function useForkDataClient(containerIdOverride?: string | null): ForkDataClient | null;
|
|
653
|
+
interface UseForkFeatureValuesInput extends QueryValuesInput {
|
|
654
|
+
containerId?: string | null;
|
|
655
|
+
enabled?: boolean;
|
|
656
|
+
pollMs?: number;
|
|
657
|
+
}
|
|
658
|
+
declare function useForkFeatureValues<T = unknown>(input: UseForkFeatureValuesInput): {
|
|
659
|
+
feature: ForkFeature | null;
|
|
660
|
+
values: ForkFeatureValue<T>[];
|
|
661
|
+
byKey: Map<string, ForkFeatureValue<T>>;
|
|
662
|
+
getValue: (entity: ForkEntityRef, valueKey?: string) => ForkFeatureValue<T> | null;
|
|
663
|
+
loading: boolean;
|
|
664
|
+
error: Error | null;
|
|
665
|
+
refresh: () => Promise<void>;
|
|
666
|
+
};
|
|
667
|
+
declare function useForkDataMutation(containerIdOverride?: string | null): {
|
|
668
|
+
client: ForkDataClient | null;
|
|
669
|
+
ensureFeature: (input: EnsureFeatureInput) => Promise<{
|
|
670
|
+
feature: ForkFeature;
|
|
671
|
+
}>;
|
|
672
|
+
setValues: (input: SetValuesInput) => Promise<{
|
|
673
|
+
feature: ForkFeature;
|
|
674
|
+
values: ForkFeatureValue[];
|
|
675
|
+
}>;
|
|
676
|
+
setOptions: (input: SetOptionsInput) => Promise<{
|
|
677
|
+
feature: ForkFeature;
|
|
678
|
+
options: ForkFeatureOption[];
|
|
679
|
+
}>;
|
|
680
|
+
};
|
|
681
|
+
interface UseForkLlmJobsInput extends EnsureLlmJobsInput {
|
|
682
|
+
containerId?: string | null;
|
|
683
|
+
enabled?: boolean;
|
|
684
|
+
pollMs?: number;
|
|
685
|
+
}
|
|
686
|
+
declare function useForkLlmJobs<T = unknown>(input: UseForkLlmJobsInput): {
|
|
687
|
+
feature: ForkFeature | null;
|
|
688
|
+
jobs: ForkLlmJob[];
|
|
689
|
+
values: ForkFeatureValue<T>[];
|
|
690
|
+
byKey: Map<string, ForkFeatureValue<T>>;
|
|
691
|
+
getValue: (entity: ForkEntityRef, valueKey?: string) => ForkFeatureValue<T> | null;
|
|
692
|
+
loading: boolean;
|
|
693
|
+
error: Error | null;
|
|
694
|
+
ensure: () => Promise<void>;
|
|
695
|
+
refresh: () => Promise<void>;
|
|
696
|
+
running: boolean;
|
|
697
|
+
};
|
|
698
|
+
|
|
436
699
|
/**
|
|
437
700
|
* Containers v2 — SDK-side manifest client.
|
|
438
701
|
*
|
|
@@ -537,4 +800,4 @@ declare function clearCachedManifest(tenantId: string, appId: string, userId: st
|
|
|
537
800
|
*/
|
|
538
801
|
declare function manifestDiffers(a: Manifest | null, b: Manifest | null): boolean;
|
|
539
802
|
|
|
540
|
-
export { type Fork, type ForkActivity, type ForkActivitySummary, type ForkActivityTargetKind, type ForkBoundaryDefinition, ForkBoundaryUI, ForkButton, ForkChatInterface, type ForkChatInterfaceProps, type ForkChatPanelOptions, type ForkChatTarget, type ForkEvent, ForkPanel, ForkProvider, type ForkProviderProps, type ForkSharedRegistry, ForkSlot, type ForkSlotProps, type ForkState, ForkUI, type LoadManifestInput, type Manifest, type ManifestEntry, type ManifestModuleEntry, type PreviewSessionPayload, clearCachedManifest, forkable, loadManifest, manifestDiffers, readCachedManifest, registerForkShared, useBoundaryFork, useFork, useForkChatPanel, usePreviewSession, writeCachedManifest };
|
|
803
|
+
export { 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 PreviewSessionPayload, 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, usePreviewSession, writeCachedManifest };
|
package/dist/index.d.ts
CHANGED
|
@@ -153,6 +153,12 @@ interface ForkSlotProps {
|
|
|
153
153
|
children: ReactElement<unknown, ComponentType<any>>;
|
|
154
154
|
/** Whitelist of API paths the forked component can fetch (iframe mode only). In direct mode, the component can call fetch() natively. */
|
|
155
155
|
allowedFetches?: string[];
|
|
156
|
+
/**
|
|
157
|
+
* Stable host-entity identity for persistent Fork data and LLM features.
|
|
158
|
+
* Example:
|
|
159
|
+
* { rows: { entityType: "account", getId: "id", hashFields: ["name", "stage"] } }
|
|
160
|
+
*/
|
|
161
|
+
entityBindings?: Record<string, unknown>;
|
|
156
162
|
/** Optional GitHub repo in "owner/repo" format. If omitted, Fork resolves repo access from appId onboarding metadata. */
|
|
157
163
|
githubRepo?: string;
|
|
158
164
|
/** Callbacks the forked component can invoke on the parent app (bridged via postMessage) */
|
|
@@ -210,9 +216,17 @@ interface PreviewSessionPayload {
|
|
|
210
216
|
|
|
211
217
|
declare function usePreviewSession(): PreviewSessionPayload | null;
|
|
212
218
|
|
|
219
|
+
interface ForkRuntimeGlobal {
|
|
220
|
+
dataFetch: (path: string, body?: unknown, method?: string) => Promise<any>;
|
|
221
|
+
}
|
|
222
|
+
declare global {
|
|
223
|
+
interface Window {
|
|
224
|
+
__FORK_RUNTIME__?: ForkRuntimeGlobal;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
213
227
|
declare function ForkProvider(props: ForkProviderProps): react_jsx_runtime.JSX.Element;
|
|
214
228
|
|
|
215
|
-
declare function ForkSlot({ slotId, props, children, allowedFetches, githubRepo, callbacks, mode, shared, events }: ForkSlotProps): react_jsx_runtime.JSX.Element;
|
|
229
|
+
declare function ForkSlot({ slotId, props, children, allowedFetches, entityBindings, githubRepo, callbacks, mode, shared, events }: ForkSlotProps): react_jsx_runtime.JSX.Element;
|
|
216
230
|
|
|
217
231
|
declare function ForkChatInterface(props: ForkChatInterfaceProps): react_jsx_runtime.JSX.Element;
|
|
218
232
|
|
|
@@ -433,6 +447,255 @@ declare function useForkChatPanel(options: ForkChatPanelOptions): {
|
|
|
433
447
|
adoptRunningFork: (forkId: string) => Promise<void>;
|
|
434
448
|
};
|
|
435
449
|
|
|
450
|
+
type ForkFeatureKind = "data_value" | "llm_field" | "tagging" | "briefing" | "kv_store";
|
|
451
|
+
type ForkDataSource = "user" | "llm" | "system";
|
|
452
|
+
type ForkDataStatus = "pending" | "complete" | "error" | "stale";
|
|
453
|
+
type ForkLlmJobStatus = "queued" | "running" | "complete" | "error" | "cancelled";
|
|
454
|
+
interface ForkEntityRef {
|
|
455
|
+
namespace?: string;
|
|
456
|
+
type: string;
|
|
457
|
+
id: string;
|
|
458
|
+
}
|
|
459
|
+
interface ForkFeature {
|
|
460
|
+
id: string;
|
|
461
|
+
tenantId: string;
|
|
462
|
+
appId: string;
|
|
463
|
+
containerId: string;
|
|
464
|
+
forkId: string | null;
|
|
465
|
+
artifactId: string | null;
|
|
466
|
+
targetKind: "slot" | "module" | null;
|
|
467
|
+
targetId: string | null;
|
|
468
|
+
key: string;
|
|
469
|
+
kind: ForkFeatureKind;
|
|
470
|
+
config: Record<string, unknown>;
|
|
471
|
+
status: "active" | "archived";
|
|
472
|
+
createdAt: string;
|
|
473
|
+
updatedAt: string;
|
|
474
|
+
}
|
|
475
|
+
interface ForkFeatureValue<T = unknown> {
|
|
476
|
+
id: string;
|
|
477
|
+
tenantId: string;
|
|
478
|
+
appId: string;
|
|
479
|
+
containerId: string;
|
|
480
|
+
featureId: string;
|
|
481
|
+
entity: Required<ForkEntityRef>;
|
|
482
|
+
valueKey: string;
|
|
483
|
+
value: T;
|
|
484
|
+
inputHash: string | null;
|
|
485
|
+
source: ForkDataSource;
|
|
486
|
+
llmJobId: string | null;
|
|
487
|
+
status: ForkDataStatus;
|
|
488
|
+
createdAt: string;
|
|
489
|
+
updatedAt: string;
|
|
490
|
+
}
|
|
491
|
+
interface ForkFeatureOption {
|
|
492
|
+
id: string;
|
|
493
|
+
featureId: string;
|
|
494
|
+
optionKey: string;
|
|
495
|
+
label: string;
|
|
496
|
+
color: string | null;
|
|
497
|
+
metadata: Record<string, unknown>;
|
|
498
|
+
archivedAt: string | null;
|
|
499
|
+
createdAt: string;
|
|
500
|
+
updatedAt: string;
|
|
501
|
+
}
|
|
502
|
+
interface ForkLlmJob {
|
|
503
|
+
id: string;
|
|
504
|
+
tenantId: string;
|
|
505
|
+
appId: string;
|
|
506
|
+
containerId: string;
|
|
507
|
+
forkId: string | null;
|
|
508
|
+
featureId: string;
|
|
509
|
+
entity: Required<ForkEntityRef>;
|
|
510
|
+
valueKey: string;
|
|
511
|
+
operation: string;
|
|
512
|
+
inputHash: string;
|
|
513
|
+
promptHash: string;
|
|
514
|
+
model: string;
|
|
515
|
+
status: ForkLlmJobStatus;
|
|
516
|
+
attempts: number;
|
|
517
|
+
result: unknown;
|
|
518
|
+
error: string | null;
|
|
519
|
+
promptTokens: number;
|
|
520
|
+
completionTokens: number;
|
|
521
|
+
cacheReadTokens: number;
|
|
522
|
+
cacheWriteTokens: number;
|
|
523
|
+
costUsd: number;
|
|
524
|
+
latencyMs: number | null;
|
|
525
|
+
valueId: string | null;
|
|
526
|
+
createdAt: string;
|
|
527
|
+
startedAt: string | null;
|
|
528
|
+
completedAt: string | null;
|
|
529
|
+
updatedAt: string;
|
|
530
|
+
}
|
|
531
|
+
interface ForkDataClientConfig {
|
|
532
|
+
baseUrl: string;
|
|
533
|
+
apiKey: string;
|
|
534
|
+
appId: string;
|
|
535
|
+
containerId: string;
|
|
536
|
+
userId?: string;
|
|
537
|
+
userHash?: string;
|
|
538
|
+
extraHeaders?: Record<string, string>;
|
|
539
|
+
}
|
|
540
|
+
interface EnsureFeatureInput {
|
|
541
|
+
key: string;
|
|
542
|
+
kind?: ForkFeatureKind;
|
|
543
|
+
config?: Record<string, unknown>;
|
|
544
|
+
forkId?: string | null;
|
|
545
|
+
artifactId?: string | null;
|
|
546
|
+
targetKind?: "slot" | "module" | null;
|
|
547
|
+
targetId?: string | null;
|
|
548
|
+
}
|
|
549
|
+
interface QueryValuesInput {
|
|
550
|
+
featureId?: string;
|
|
551
|
+
featureKey?: string;
|
|
552
|
+
entities?: ForkEntityRef[];
|
|
553
|
+
valueKeys?: string[];
|
|
554
|
+
}
|
|
555
|
+
interface SetValuesInput {
|
|
556
|
+
featureId?: string;
|
|
557
|
+
featureKey?: string;
|
|
558
|
+
kind?: ForkFeatureKind;
|
|
559
|
+
config?: Record<string, unknown>;
|
|
560
|
+
values: Array<{
|
|
561
|
+
entity: ForkEntityRef;
|
|
562
|
+
valueKey?: string;
|
|
563
|
+
value: unknown;
|
|
564
|
+
inputHash?: string | null;
|
|
565
|
+
source?: ForkDataSource;
|
|
566
|
+
status?: ForkDataStatus;
|
|
567
|
+
}>;
|
|
568
|
+
}
|
|
569
|
+
interface SetOptionsInput {
|
|
570
|
+
featureId?: string;
|
|
571
|
+
featureKey?: string;
|
|
572
|
+
kind?: ForkFeatureKind;
|
|
573
|
+
config?: Record<string, unknown>;
|
|
574
|
+
options: Array<{
|
|
575
|
+
optionKey: string;
|
|
576
|
+
label: string;
|
|
577
|
+
color?: string | null;
|
|
578
|
+
metadata?: Record<string, unknown>;
|
|
579
|
+
archived?: boolean;
|
|
580
|
+
}>;
|
|
581
|
+
}
|
|
582
|
+
interface EnsureLlmJobsInput {
|
|
583
|
+
featureId?: string;
|
|
584
|
+
featureKey?: string;
|
|
585
|
+
kind?: ForkFeatureKind;
|
|
586
|
+
config?: Record<string, unknown>;
|
|
587
|
+
forkId?: string | null;
|
|
588
|
+
targetKind?: "slot" | "module" | null;
|
|
589
|
+
targetId?: string | null;
|
|
590
|
+
operation?: string;
|
|
591
|
+
model?: string;
|
|
592
|
+
prompt?: string;
|
|
593
|
+
system?: string;
|
|
594
|
+
promptHash?: string;
|
|
595
|
+
outputFormat?: "text" | "json";
|
|
596
|
+
maxTokens?: number;
|
|
597
|
+
temperature?: number;
|
|
598
|
+
force?: boolean;
|
|
599
|
+
jobs: Array<{
|
|
600
|
+
entity: ForkEntityRef;
|
|
601
|
+
valueKey?: string;
|
|
602
|
+
input: unknown;
|
|
603
|
+
inputHash?: string;
|
|
604
|
+
metadata?: Record<string, unknown>;
|
|
605
|
+
}>;
|
|
606
|
+
}
|
|
607
|
+
interface QueryLlmJobsInput {
|
|
608
|
+
jobIds?: string[];
|
|
609
|
+
featureId?: string;
|
|
610
|
+
featureKey?: string;
|
|
611
|
+
entities?: ForkEntityRef[];
|
|
612
|
+
}
|
|
613
|
+
interface ForkDataClient {
|
|
614
|
+
listFeatures(): Promise<{
|
|
615
|
+
features: ForkFeature[];
|
|
616
|
+
}>;
|
|
617
|
+
ensureFeature(input: EnsureFeatureInput): Promise<{
|
|
618
|
+
feature: ForkFeature;
|
|
619
|
+
}>;
|
|
620
|
+
queryValues<T = unknown>(input: QueryValuesInput): Promise<{
|
|
621
|
+
feature: ForkFeature | null;
|
|
622
|
+
values: Array<ForkFeatureValue<T>>;
|
|
623
|
+
}>;
|
|
624
|
+
setValues(input: SetValuesInput): Promise<{
|
|
625
|
+
feature: ForkFeature;
|
|
626
|
+
values: ForkFeatureValue[];
|
|
627
|
+
}>;
|
|
628
|
+
listOptions(input: {
|
|
629
|
+
featureId?: string;
|
|
630
|
+
featureKey?: string;
|
|
631
|
+
includeArchived?: boolean;
|
|
632
|
+
}): Promise<{
|
|
633
|
+
feature: ForkFeature | null;
|
|
634
|
+
options: ForkFeatureOption[];
|
|
635
|
+
}>;
|
|
636
|
+
setOptions(input: SetOptionsInput): Promise<{
|
|
637
|
+
feature: ForkFeature;
|
|
638
|
+
options: ForkFeatureOption[];
|
|
639
|
+
}>;
|
|
640
|
+
ensureLlmJobs(input: EnsureLlmJobsInput): Promise<{
|
|
641
|
+
feature: ForkFeature;
|
|
642
|
+
jobs: ForkLlmJob[];
|
|
643
|
+
values: ForkFeatureValue[];
|
|
644
|
+
}>;
|
|
645
|
+
queryLlmJobs(input: QueryLlmJobsInput): Promise<{
|
|
646
|
+
feature: ForkFeature | null;
|
|
647
|
+
jobs: ForkLlmJob[];
|
|
648
|
+
}>;
|
|
649
|
+
}
|
|
650
|
+
declare function forkEntityValueKey(entity: ForkEntityRef, valueKey?: string): string;
|
|
651
|
+
declare function createForkDataClient(config: ForkDataClientConfig): ForkDataClient;
|
|
652
|
+
declare function useForkDataClient(containerIdOverride?: string | null): ForkDataClient | null;
|
|
653
|
+
interface UseForkFeatureValuesInput extends QueryValuesInput {
|
|
654
|
+
containerId?: string | null;
|
|
655
|
+
enabled?: boolean;
|
|
656
|
+
pollMs?: number;
|
|
657
|
+
}
|
|
658
|
+
declare function useForkFeatureValues<T = unknown>(input: UseForkFeatureValuesInput): {
|
|
659
|
+
feature: ForkFeature | null;
|
|
660
|
+
values: ForkFeatureValue<T>[];
|
|
661
|
+
byKey: Map<string, ForkFeatureValue<T>>;
|
|
662
|
+
getValue: (entity: ForkEntityRef, valueKey?: string) => ForkFeatureValue<T> | null;
|
|
663
|
+
loading: boolean;
|
|
664
|
+
error: Error | null;
|
|
665
|
+
refresh: () => Promise<void>;
|
|
666
|
+
};
|
|
667
|
+
declare function useForkDataMutation(containerIdOverride?: string | null): {
|
|
668
|
+
client: ForkDataClient | null;
|
|
669
|
+
ensureFeature: (input: EnsureFeatureInput) => Promise<{
|
|
670
|
+
feature: ForkFeature;
|
|
671
|
+
}>;
|
|
672
|
+
setValues: (input: SetValuesInput) => Promise<{
|
|
673
|
+
feature: ForkFeature;
|
|
674
|
+
values: ForkFeatureValue[];
|
|
675
|
+
}>;
|
|
676
|
+
setOptions: (input: SetOptionsInput) => Promise<{
|
|
677
|
+
feature: ForkFeature;
|
|
678
|
+
options: ForkFeatureOption[];
|
|
679
|
+
}>;
|
|
680
|
+
};
|
|
681
|
+
interface UseForkLlmJobsInput extends EnsureLlmJobsInput {
|
|
682
|
+
containerId?: string | null;
|
|
683
|
+
enabled?: boolean;
|
|
684
|
+
pollMs?: number;
|
|
685
|
+
}
|
|
686
|
+
declare function useForkLlmJobs<T = unknown>(input: UseForkLlmJobsInput): {
|
|
687
|
+
feature: ForkFeature | null;
|
|
688
|
+
jobs: ForkLlmJob[];
|
|
689
|
+
values: ForkFeatureValue<T>[];
|
|
690
|
+
byKey: Map<string, ForkFeatureValue<T>>;
|
|
691
|
+
getValue: (entity: ForkEntityRef, valueKey?: string) => ForkFeatureValue<T> | null;
|
|
692
|
+
loading: boolean;
|
|
693
|
+
error: Error | null;
|
|
694
|
+
ensure: () => Promise<void>;
|
|
695
|
+
refresh: () => Promise<void>;
|
|
696
|
+
running: boolean;
|
|
697
|
+
};
|
|
698
|
+
|
|
436
699
|
/**
|
|
437
700
|
* Containers v2 — SDK-side manifest client.
|
|
438
701
|
*
|
|
@@ -537,4 +800,4 @@ declare function clearCachedManifest(tenantId: string, appId: string, userId: st
|
|
|
537
800
|
*/
|
|
538
801
|
declare function manifestDiffers(a: Manifest | null, b: Manifest | null): boolean;
|
|
539
802
|
|
|
540
|
-
export { type Fork, type ForkActivity, type ForkActivitySummary, type ForkActivityTargetKind, type ForkBoundaryDefinition, ForkBoundaryUI, ForkButton, ForkChatInterface, type ForkChatInterfaceProps, type ForkChatPanelOptions, type ForkChatTarget, type ForkEvent, ForkPanel, ForkProvider, type ForkProviderProps, type ForkSharedRegistry, ForkSlot, type ForkSlotProps, type ForkState, ForkUI, type LoadManifestInput, type Manifest, type ManifestEntry, type ManifestModuleEntry, type PreviewSessionPayload, clearCachedManifest, forkable, loadManifest, manifestDiffers, readCachedManifest, registerForkShared, useBoundaryFork, useFork, useForkChatPanel, usePreviewSession, writeCachedManifest };
|
|
803
|
+
export { 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 PreviewSessionPayload, 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, usePreviewSession, writeCachedManifest };
|