@fork-api/chat-sdk 0.1.173 → 0.1.175
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 +7 -8
- package/dist/index.d.cts +41 -52
- package/dist/index.d.ts +41 -52
- package/dist/index.js +7 -8
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -15,6 +15,11 @@ interface Fork {
|
|
|
15
15
|
summary?: string;
|
|
16
16
|
/** Rough estimate in minutes for how long the agent will take. Set after the Haiku title call resolves. */
|
|
17
17
|
estimateMinutes?: number;
|
|
18
|
+
/** True when this user authored the fork and hasn't seen its one-shot
|
|
19
|
+
* reveal animation yet (server-tracked via forks.reveal_seen_at, once
|
|
20
|
+
* ever across tabs/devices). Set client-side on live SSE completion;
|
|
21
|
+
* DirectForkSlot plays the reveal and records it via POST /forks/reveals. */
|
|
22
|
+
revealPending?: boolean;
|
|
18
23
|
createdAt: string;
|
|
19
24
|
completedAt?: string;
|
|
20
25
|
error?: string;
|
|
@@ -58,24 +63,32 @@ interface ForkProviderBase {
|
|
|
58
63
|
shared?: ForkSharedRegistry;
|
|
59
64
|
}
|
|
60
65
|
/**
|
|
61
|
-
* User identity — provide EITHER userId OR authUrl:
|
|
66
|
+
* User identity — provide EITHER userId (optionally with userHash) OR authUrl:
|
|
62
67
|
*
|
|
63
|
-
* - `userId
|
|
68
|
+
* - `userId` alone: Client-asserted, no server verification (dev/testing only).
|
|
69
|
+
* - `userId` + `userHash`: Host-brokered verified identity. Your backend
|
|
70
|
+
* computes userHash = HMAC-SHA256(sk_fork_key, userId) and your app passes
|
|
71
|
+
* both as props. Fork never touches cookies or Web Storage for identity, so
|
|
72
|
+
* this is the required mode for embedded/iframe contexts where third-party
|
|
73
|
+
* cookies are blocked (e.g. app-store review environments).
|
|
64
74
|
* - `authUrl`: URL on your backend that returns `{ userId, userHash }`.
|
|
65
75
|
* The SDK calls this on mount (same-origin, cookies sent automatically).
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
76
|
+
* Relies on the host's cookie session, so it does not work where the host
|
|
77
|
+
* page's cookies are third-party — prefer the userHash prop mode there.
|
|
78
|
+
*
|
|
79
|
+
* In either verified mode, if the user is also a Fork tenant operator (their
|
|
80
|
+
* email matches a fork_users row with a user_roles entry on this tenant), the
|
|
81
|
+
* SDK transparently enters admin mode and acts as their mapped end-user — set
|
|
82
|
+
* the mapping in Fork's Team Settings → End user.
|
|
72
83
|
*/
|
|
73
84
|
type ForkProviderProps = ForkProviderBase & ({
|
|
74
85
|
userId: string;
|
|
86
|
+
userHash?: string;
|
|
75
87
|
authUrl?: never;
|
|
76
88
|
} | {
|
|
77
89
|
authUrl: string;
|
|
78
90
|
userId?: never;
|
|
91
|
+
userHash?: never;
|
|
79
92
|
});
|
|
80
93
|
interface ForkBoundaryRegistration {
|
|
81
94
|
id: string;
|
|
@@ -172,50 +185,24 @@ interface ForkSlotProps {
|
|
|
172
185
|
}
|
|
173
186
|
type ForkState = "idle" | "prompting" | "running" | "complete" | "error";
|
|
174
187
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
* Why pub/sub over React context alone: the banner is mounted into a
|
|
193
|
-
* detached Shadow DOM root (separate render tree). It can't read context
|
|
194
|
-
* from the ForkProvider tree, so it subscribes to this module directly.
|
|
195
|
-
*/
|
|
196
|
-
|
|
197
|
-
interface PreviewSessionPayload {
|
|
198
|
-
preview_session_id: string;
|
|
199
|
-
tenant_id: string;
|
|
200
|
-
app_id: string;
|
|
201
|
-
target: {
|
|
202
|
-
kind: PreviewTargetKind;
|
|
203
|
-
id: string;
|
|
204
|
-
};
|
|
205
|
-
operator_id: number;
|
|
206
|
-
container_id?: string | null;
|
|
207
|
-
/** Human-readable container label for preview UI. Defaults to "Fork". */
|
|
208
|
-
container_name?: string | null;
|
|
209
|
-
/** Seeded from activate(); the SDK updates it when authoring creates a
|
|
210
|
-
* new fork. Null when the operator just landed and hasn't authored. */
|
|
211
|
-
fork_id: string | null;
|
|
212
|
-
/** ISO-8601 expiration. The banner ticks against this; once past, the
|
|
213
|
-
* module clears storage on next access. */
|
|
214
|
-
expires_at: string;
|
|
188
|
+
interface AdminContainer {
|
|
189
|
+
id: string;
|
|
190
|
+
name: string;
|
|
191
|
+
isPrimary: boolean;
|
|
192
|
+
forkCount: number;
|
|
193
|
+
}
|
|
194
|
+
interface AdminContext {
|
|
195
|
+
/** True when the verified caller is an operator (or a mapped end-user) on
|
|
196
|
+
* this tenant — resolved server-side via GET /admin/containers. */
|
|
197
|
+
isAdmin: boolean;
|
|
198
|
+
/** The tenant end-user the operator acts as (their mapped End-user). */
|
|
199
|
+
actingUserId: string | null;
|
|
200
|
+
/** Container currently being viewed/authored; null before one resolves. */
|
|
201
|
+
containerId: string | null;
|
|
202
|
+
containerName: string | null;
|
|
203
|
+
/** Containers the acting end-user can access (for the panel switcher). */
|
|
204
|
+
containers: AdminContainer[];
|
|
215
205
|
}
|
|
216
|
-
|
|
217
|
-
declare function usePreviewSession(): PreviewSessionPayload | null;
|
|
218
|
-
|
|
219
206
|
interface ForkRuntimeGlobal {
|
|
220
207
|
dataFetch: (path: string, body?: unknown, method?: string) => Promise<any>;
|
|
221
208
|
}
|
|
@@ -730,6 +717,8 @@ interface ManifestEntry {
|
|
|
730
717
|
legacyBundleUrl: string | null;
|
|
731
718
|
buildId: string | null;
|
|
732
719
|
updatedAt: string;
|
|
720
|
+
/** Author-only, once-ever reveal-animation flag (server-tracked). */
|
|
721
|
+
revealPending?: boolean;
|
|
733
722
|
}
|
|
734
723
|
interface ManifestModuleEntry {
|
|
735
724
|
forkId: string;
|
|
@@ -804,4 +793,4 @@ declare function clearCachedManifest(tenantId: string, appId: string, userId: st
|
|
|
804
793
|
*/
|
|
805
794
|
declare function manifestDiffers(a: Manifest | null, b: Manifest | null): boolean;
|
|
806
795
|
|
|
807
|
-
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
|
|
796
|
+
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,11 @@ interface Fork {
|
|
|
15
15
|
summary?: string;
|
|
16
16
|
/** Rough estimate in minutes for how long the agent will take. Set after the Haiku title call resolves. */
|
|
17
17
|
estimateMinutes?: number;
|
|
18
|
+
/** True when this user authored the fork and hasn't seen its one-shot
|
|
19
|
+
* reveal animation yet (server-tracked via forks.reveal_seen_at, once
|
|
20
|
+
* ever across tabs/devices). Set client-side on live SSE completion;
|
|
21
|
+
* DirectForkSlot plays the reveal and records it via POST /forks/reveals. */
|
|
22
|
+
revealPending?: boolean;
|
|
18
23
|
createdAt: string;
|
|
19
24
|
completedAt?: string;
|
|
20
25
|
error?: string;
|
|
@@ -58,24 +63,32 @@ interface ForkProviderBase {
|
|
|
58
63
|
shared?: ForkSharedRegistry;
|
|
59
64
|
}
|
|
60
65
|
/**
|
|
61
|
-
* User identity — provide EITHER userId OR authUrl:
|
|
66
|
+
* User identity — provide EITHER userId (optionally with userHash) OR authUrl:
|
|
62
67
|
*
|
|
63
|
-
* - `userId
|
|
68
|
+
* - `userId` alone: Client-asserted, no server verification (dev/testing only).
|
|
69
|
+
* - `userId` + `userHash`: Host-brokered verified identity. Your backend
|
|
70
|
+
* computes userHash = HMAC-SHA256(sk_fork_key, userId) and your app passes
|
|
71
|
+
* both as props. Fork never touches cookies or Web Storage for identity, so
|
|
72
|
+
* this is the required mode for embedded/iframe contexts where third-party
|
|
73
|
+
* cookies are blocked (e.g. app-store review environments).
|
|
64
74
|
* - `authUrl`: URL on your backend that returns `{ userId, userHash }`.
|
|
65
75
|
* The SDK calls this on mount (same-origin, cookies sent automatically).
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
76
|
+
* Relies on the host's cookie session, so it does not work where the host
|
|
77
|
+
* page's cookies are third-party — prefer the userHash prop mode there.
|
|
78
|
+
*
|
|
79
|
+
* In either verified mode, if the user is also a Fork tenant operator (their
|
|
80
|
+
* email matches a fork_users row with a user_roles entry on this tenant), the
|
|
81
|
+
* SDK transparently enters admin mode and acts as their mapped end-user — set
|
|
82
|
+
* the mapping in Fork's Team Settings → End user.
|
|
72
83
|
*/
|
|
73
84
|
type ForkProviderProps = ForkProviderBase & ({
|
|
74
85
|
userId: string;
|
|
86
|
+
userHash?: string;
|
|
75
87
|
authUrl?: never;
|
|
76
88
|
} | {
|
|
77
89
|
authUrl: string;
|
|
78
90
|
userId?: never;
|
|
91
|
+
userHash?: never;
|
|
79
92
|
});
|
|
80
93
|
interface ForkBoundaryRegistration {
|
|
81
94
|
id: string;
|
|
@@ -172,50 +185,24 @@ interface ForkSlotProps {
|
|
|
172
185
|
}
|
|
173
186
|
type ForkState = "idle" | "prompting" | "running" | "complete" | "error";
|
|
174
187
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
* Why pub/sub over React context alone: the banner is mounted into a
|
|
193
|
-
* detached Shadow DOM root (separate render tree). It can't read context
|
|
194
|
-
* from the ForkProvider tree, so it subscribes to this module directly.
|
|
195
|
-
*/
|
|
196
|
-
|
|
197
|
-
interface PreviewSessionPayload {
|
|
198
|
-
preview_session_id: string;
|
|
199
|
-
tenant_id: string;
|
|
200
|
-
app_id: string;
|
|
201
|
-
target: {
|
|
202
|
-
kind: PreviewTargetKind;
|
|
203
|
-
id: string;
|
|
204
|
-
};
|
|
205
|
-
operator_id: number;
|
|
206
|
-
container_id?: string | null;
|
|
207
|
-
/** Human-readable container label for preview UI. Defaults to "Fork". */
|
|
208
|
-
container_name?: string | null;
|
|
209
|
-
/** Seeded from activate(); the SDK updates it when authoring creates a
|
|
210
|
-
* new fork. Null when the operator just landed and hasn't authored. */
|
|
211
|
-
fork_id: string | null;
|
|
212
|
-
/** ISO-8601 expiration. The banner ticks against this; once past, the
|
|
213
|
-
* module clears storage on next access. */
|
|
214
|
-
expires_at: string;
|
|
188
|
+
interface AdminContainer {
|
|
189
|
+
id: string;
|
|
190
|
+
name: string;
|
|
191
|
+
isPrimary: boolean;
|
|
192
|
+
forkCount: number;
|
|
193
|
+
}
|
|
194
|
+
interface AdminContext {
|
|
195
|
+
/** True when the verified caller is an operator (or a mapped end-user) on
|
|
196
|
+
* this tenant — resolved server-side via GET /admin/containers. */
|
|
197
|
+
isAdmin: boolean;
|
|
198
|
+
/** The tenant end-user the operator acts as (their mapped End-user). */
|
|
199
|
+
actingUserId: string | null;
|
|
200
|
+
/** Container currently being viewed/authored; null before one resolves. */
|
|
201
|
+
containerId: string | null;
|
|
202
|
+
containerName: string | null;
|
|
203
|
+
/** Containers the acting end-user can access (for the panel switcher). */
|
|
204
|
+
containers: AdminContainer[];
|
|
215
205
|
}
|
|
216
|
-
|
|
217
|
-
declare function usePreviewSession(): PreviewSessionPayload | null;
|
|
218
|
-
|
|
219
206
|
interface ForkRuntimeGlobal {
|
|
220
207
|
dataFetch: (path: string, body?: unknown, method?: string) => Promise<any>;
|
|
221
208
|
}
|
|
@@ -730,6 +717,8 @@ interface ManifestEntry {
|
|
|
730
717
|
legacyBundleUrl: string | null;
|
|
731
718
|
buildId: string | null;
|
|
732
719
|
updatedAt: string;
|
|
720
|
+
/** Author-only, once-ever reveal-animation flag (server-tracked). */
|
|
721
|
+
revealPending?: boolean;
|
|
733
722
|
}
|
|
734
723
|
interface ManifestModuleEntry {
|
|
735
724
|
forkId: string;
|
|
@@ -804,4 +793,4 @@ declare function clearCachedManifest(tenantId: string, appId: string, userId: st
|
|
|
804
793
|
*/
|
|
805
794
|
declare function manifestDiffers(a: Manifest | null, b: Manifest | null): boolean;
|
|
806
795
|
|
|
807
|
-
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
|
|
796
|
+
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 };
|