flowstack-sdk 0.2.1 → 0.2.2
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/README.md +77 -0
- package/dist/api/index.d.mts +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.js +63 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/index.mjs +58 -1
- package/dist/api/index.mjs.map +1 -1
- package/dist/{index-BkACA2ls.d.mts → index-CUyJ5c2d.d.mts} +54 -1
- package/dist/{index-BkACA2ls.d.ts → index-CUyJ5c2d.d.ts} +54 -1
- package/dist/index.d.mts +77 -3
- package/dist/index.d.ts +77 -3
- package/dist/index.js +183 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +176 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1236,6 +1236,59 @@ declare function deleteDocuments(credentials: FlowstackCredentials, collection:
|
|
|
1236
1236
|
deleted_count: number;
|
|
1237
1237
|
collection: string;
|
|
1238
1238
|
}>>;
|
|
1239
|
+
interface DmMessage {
|
|
1240
|
+
message_id: string;
|
|
1241
|
+
from: string;
|
|
1242
|
+
to: string;
|
|
1243
|
+
/** UNTRUSTED user input — render as text, never raw HTML. */
|
|
1244
|
+
body: string;
|
|
1245
|
+
created_at: string;
|
|
1246
|
+
read_at: string | null;
|
|
1247
|
+
}
|
|
1248
|
+
interface DmThread {
|
|
1249
|
+
pair_key: string;
|
|
1250
|
+
with_user_key: string;
|
|
1251
|
+
status: 'pending' | 'open';
|
|
1252
|
+
last_message: DmMessage | null;
|
|
1253
|
+
unread_count: number;
|
|
1254
|
+
updated_at: string | null;
|
|
1255
|
+
}
|
|
1256
|
+
/**
|
|
1257
|
+
* Deterministic, order-independent thread key for a pair of user keys.
|
|
1258
|
+
* Mirrors the backend's `pair_key` (sorted, '::'-joined).
|
|
1259
|
+
*/
|
|
1260
|
+
declare function dmPairKey(a: string, b: string): string;
|
|
1261
|
+
/** List the caller's threads (counterpart key, last message, unread count). */
|
|
1262
|
+
declare function listThreads(credentials: FlowstackCredentials, config?: FlowstackClientConfig): Promise<ApiResponse<{
|
|
1263
|
+
threads: DmThread[];
|
|
1264
|
+
count: number;
|
|
1265
|
+
}>>;
|
|
1266
|
+
/** List messages in the caller's thread with `withUserKey`. ACL'd server-side. */
|
|
1267
|
+
declare function listMessages(credentials: FlowstackCredentials, withUserKey: string, options?: {
|
|
1268
|
+
limit?: number;
|
|
1269
|
+
before?: string;
|
|
1270
|
+
}, config?: FlowstackClientConfig): Promise<ApiResponse<{
|
|
1271
|
+
messages: DmMessage[];
|
|
1272
|
+
count: number;
|
|
1273
|
+
}>>;
|
|
1274
|
+
/** Send a message to `toUserKey`. 403 unless the thread is mutually open. */
|
|
1275
|
+
declare function sendMessage(credentials: FlowstackCredentials, toUserKey: string, body: string, config?: FlowstackClientConfig): Promise<ApiResponse<{
|
|
1276
|
+
message_id: string;
|
|
1277
|
+
created_at: string;
|
|
1278
|
+
}>>;
|
|
1279
|
+
/**
|
|
1280
|
+
* Record the caller's consent to open a thread with `withUserKey`.
|
|
1281
|
+
* The thread becomes `open` (sendable) only once BOTH parties have consented.
|
|
1282
|
+
*/
|
|
1283
|
+
declare function openThread(credentials: FlowstackCredentials, withUserKey: string, config?: FlowstackClientConfig): Promise<ApiResponse<{
|
|
1284
|
+
pair_key: string;
|
|
1285
|
+
status: string;
|
|
1286
|
+
}>>;
|
|
1287
|
+
/** Mark a received message as read (recipient only). */
|
|
1288
|
+
declare function markMessageRead(credentials: FlowstackCredentials, messageId: string, config?: FlowstackClientConfig): Promise<ApiResponse<{
|
|
1289
|
+
message_id: string;
|
|
1290
|
+
read: boolean;
|
|
1291
|
+
}>>;
|
|
1239
1292
|
/**
|
|
1240
1293
|
* Invoke an agent tool directly (bypasses LLM orchestration).
|
|
1241
1294
|
*/
|
|
@@ -1543,4 +1596,4 @@ declare function getCachedSites(credentials: FlowstackCredentials, config: Redis
|
|
|
1543
1596
|
declare function setCachedSites(credentials: FlowstackCredentials, sites: PublishedSiteInfo[], config: RedisConfig): Promise<boolean>;
|
|
1544
1597
|
declare function invalidateSitesCache(credentials: FlowstackCredentials, config: RedisConfig): Promise<boolean>;
|
|
1545
1598
|
|
|
1546
|
-
export {
|
|
1599
|
+
export { COLLECTION_LAYERS as $, type AgentTemplate as A, type UserStats as B, type ChatMessage as C, type DmThread as D, type UserActivityLog as E, type FlowstackConfig as F, type DataSourceBadgeInfo as G, type AgentConfig as H, type ModelPreferenceState as I, type ModelOption as J, type AdminProviderCredential as K, type LLMProvider as L, type ManagedUser as M, type ExistingProviderCredential as N, type OllamaLocalModel as O, type ProviderCredential as P, type CreateAdminProviderCredentialInput as Q, type FlowstackClientConfig as R, type StreamEvent as S, type ToolCall as T, type UseAuthReturn as U, type VisualizationData as V, type WorkspaceInfo as W, LLM_PROVIDERS as X, CREDENTIAL_PURPOSES as Y, DEFAULT_PROVIDER_MODEL_SETTINGS as Z, isProviderCredential as _, type FlowstackContextValue as a, createDataSource as a$, type AuthConfig as a0, type RedisConfig$1 as a1, type DatabaseConfig as a2, type LoginRequest as a3, type LoginResponse as a4, type RegisterRequest as a5, type RegisterResponse as a6, type GoogleAuthResponse as a7, type SessionState as a8, type CreateWorkspaceRequest as a9, type UserDataOverviewWorkspace as aA, type GitHubRepo as aB, type PiiSettings as aC, type PiiEntitySettings as aD, type PiiRedactedEntity as aE, type ApiResponse as aF, type ListResponse as aG, type UserRole as aH, type UserStatus as aI, type UserActivityType as aJ, type UpdateUserRequest as aK, type UserListParams as aL, type UserListResponse as aM, flowstackFetch as aN, listWorkspaces as aO, createWorkspace as aP, getWorkspace as aQ, listDatasets as aR, getDataset as aS, getDatasetPreview as aT, deleteDataset as aU, listVisualizations as aV, listReports as aW, listModels as aX, listScripts as aY, getModel as aZ, listDataSources as a_, type DatasetPreview as aa, type ColumnSchema as ab, type DatasetRow as ac, type DatasetStreamOptions as ad, type ReportInfo as ae, type ModelInfo as af, type ScriptInfo as ag, type DataSourceType as ah, type DataSourceConfig as ai, type ConnectionTestResult as aj, type SearchResult as ak, type SearchResultsData as al, type StreamEventType as am, type InterruptInfo as an, type QueryOptions as ao, type UsageStats as ap, type UsagePeriod as aq, type CreditStatus as ar, type AgentInfo as as, type PublishedSiteInfo as at, type CreateSiteParams$1 as au, type SiteVersion as av, type SiteVersionManifest as aw, type PublishToGitHubParams as ax, type PublishToGitHubResult as ay, type CredentialPurpose as az, type UseWorkspaceReturn as b, getCachedVisualizations as b$, testDataSource as b0, deleteDataSource as b1, executeQuery as b2, executeQueryWithConfig as b3, uploadFile as b4, login as b5, register as b6, googleLogin as b7, listUsers as b8, getUser as b9, sendMessage as bA, openThread as bB, markMessageRead as bC, dmPairKey as bD, invokeTool as bE, listGitHubRepos as bF, importFromGitHub as bG, getPiiSettings as bH, updatePiiSettings as bI, previewPiiMasking as bJ, getPiiAllowlist as bK, addPiiAllowlistTerm as bL, removePiiAllowlistTerm as bM, getUserDataOverview as bN, getUserCollections as bO, getUserCollectionDocuments as bP, getUserCollectionSchema as bQ, deleteUserCollection as bR, exportUserCollection as bS, type RequestOptions as bT, CACHE_TTL as bU, getCachedWorkspaces as bV, setCachedWorkspaces as bW, invalidateWorkspacesCache as bX, getCachedDatasets as bY, setCachedDatasets as bZ, invalidateDatasetsCache as b_, updateUser as ba, deleteUser as bb, suspendUser as bc, reactivateUser as bd, getUserActivity as be, getUserStats as bf, checkAdminPermissions as bg, getConversationHistory as bh, listAgents as bi, listSites as bj, getSite as bk, createSite as bl, addSiteFile as bm, publishStagedSite as bn, deleteSite as bo, getSiteVersions as bp, promoteSiteVersion as bq, deleteSiteVersion as br, setSiteAlias as bs, removeSiteAlias as bt, publishToGitHub as bu, insertDocuments as bv, updateDocuments as bw, deleteDocuments as bx, listThreads as by, listMessages as bz, type UseDatasetsReturn as c, setCachedVisualizations as c0, invalidateVisualizationsCache as c1, getCachedReports as c2, setCachedReports as c3, invalidateReportsCache as c4, invalidateWorkspaceArtifacts as c5, invalidateAllUserCache as c6, getCachedSites as c7, setCachedSites as c8, invalidateSitesCache as c9, getCached as ca, setCached as cb, deleteCached as cc, queryCollection as cd, uploadDocument as ce, type CreateSiteParams as cf, type RedisConfig as cg, type UseVisualizationsReturn as d, type UseReportsReturn as e, type UseModelsReturn as f, type UseDataSourcesReturn as g, type UseAgentOptions as h, type UseAgentReturn as i, type UseQueryReturn as j, type UseUserManagementReturn as k, type UseSitesReturn as l, type UseAgentsReturn as m, type CollectionLayer as n, type DmMessage as o, type UseSiteVersionsReturn as p, type PurposeInfo as q, type ProviderModelSettings as r, type OllamaStatus as s, type UserDataOverview as t, type UserCollectionInfo as u, type CollectionSchemaInfo as v, type FlowstackCredentials as w, type User as x, type DatasetInfo as y, type DataSource as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React, { ReactNode } from 'react';
|
|
3
|
-
import { F as FlowstackConfig, a as FlowstackContextValue, U as UseAuthReturn, b as UseWorkspaceReturn, c as UseDatasetsReturn, d as UseVisualizationsReturn, e as UseReportsReturn, f as UseModelsReturn, g as UseDataSourcesReturn, A as AgentTemplate, h as UseAgentOptions, i as UseAgentReturn, j as UseQueryReturn, C as ChatMessage, T as ToolCall, k as UseUserManagementReturn, l as UseSitesReturn, m as UseAgentsReturn, n as CollectionLayer, o as UseSiteVersionsReturn, P as ProviderCredential,
|
|
4
|
-
export {
|
|
3
|
+
import { F as FlowstackConfig, a as FlowstackContextValue, U as UseAuthReturn, b as UseWorkspaceReturn, c as UseDatasetsReturn, d as UseVisualizationsReturn, e as UseReportsReturn, f as UseModelsReturn, g as UseDataSourcesReturn, A as AgentTemplate, h as UseAgentOptions, i as UseAgentReturn, j as UseQueryReturn, C as ChatMessage, T as ToolCall, k as UseUserManagementReturn, l as UseSitesReturn, m as UseAgentsReturn, n as CollectionLayer, D as DmThread, o as DmMessage, p as UseSiteVersionsReturn, P as ProviderCredential, q as PurposeInfo, L as LLMProvider, r as ProviderModelSettings, O as OllamaLocalModel, s as OllamaStatus, t as UserDataOverview, u as UserCollectionInfo, v as CollectionSchemaInfo, w as FlowstackCredentials, x as User, W as WorkspaceInfo, y as DatasetInfo, V as VisualizationData, z as DataSource, M as ManagedUser, B as UserStats, E as UserActivityLog, G as DataSourceBadgeInfo, S as StreamEvent, H as AgentConfig, I as ModelPreferenceState, J as ModelOption, K as AdminProviderCredential, N as ExistingProviderCredential, Q as CreateAdminProviderCredentialInput, R as FlowstackClientConfig } from './index-CUyJ5c2d.mjs';
|
|
4
|
+
export { as as AgentInfo, aF as ApiResponse, a0 as AuthConfig, bU as CACHE_TTL, $ as COLLECTION_LAYERS, Y as CREDENTIAL_PURPOSES, ab as ColumnSchema, aj as ConnectionTestResult, au as CreateSiteParams, a9 as CreateWorkspaceRequest, az as CredentialPurpose, ar as CreditStatus, Z as DEFAULT_PROVIDER_MODEL_SETTINGS, ai as DataSourceConfig, ah as DataSourceType, a2 as DatabaseConfig, aa as DatasetPreview, ac as DatasetRow, ad as DatasetStreamOptions, aB as GitHubRepo, a7 as GoogleAuthResponse, an as InterruptInfo, X as LLM_PROVIDERS, aG as ListResponse, a3 as LoginRequest, a4 as LoginResponse, af as ModelInfo, aD as PiiEntitySettings, aE as PiiRedactedEntity, aC as PiiSettings, ax as PublishToGitHubParams, ay as PublishToGitHubResult, at as PublishedSiteInfo, ao as QueryOptions, a1 as RedisConfig, a5 as RegisterRequest, a6 as RegisterResponse, ae as ReportInfo, bT as RequestOptions, ag as ScriptInfo, ak as SearchResult, al as SearchResultsData, a8 as SessionState, av as SiteVersion, aw as SiteVersionManifest, am as StreamEventType, aK as UpdateUserRequest, aq as UsagePeriod, ap as UsageStats, aJ as UserActivityType, aA as UserDataOverviewWorkspace, aL as UserListParams, aM as UserListResponse, aH as UserRole, aI as UserStatus, bL as addPiiAllowlistTerm, bm as addSiteFile, bg as checkAdminPermissions, a$ as createDataSource, bl as createSite, aP as createWorkspace, cc as deleteCached, b1 as deleteDataSource, aU as deleteDataset, bx as deleteDocuments, bo as deleteSite, br as deleteSiteVersion, bb as deleteUser, bR as deleteUserCollection, bD as dmPairKey, b2 as executeQuery, b3 as executeQueryWithConfig, bS as exportUserCollection, aN as flowstackFetch, ca as getCached, bY as getCachedDatasets, c2 as getCachedReports, c7 as getCachedSites, b$ as getCachedVisualizations, bV as getCachedWorkspaces, bh as getConversationHistory, aS as getDataset, aT as getDatasetPreview, aZ as getModel, bK as getPiiAllowlist, bH as getPiiSettings, bk as getSite, bp as getSiteVersions, b9 as getUser, be as getUserActivity, bP as getUserCollectionDocuments, bQ as getUserCollectionSchema, bO as getUserCollections, bN as getUserDataOverview, bf as getUserStats, aQ as getWorkspace, b7 as googleLogin, bG as importFromGitHub, bv as insertDocuments, c6 as invalidateAllUserCache, b_ as invalidateDatasetsCache, c4 as invalidateReportsCache, c9 as invalidateSitesCache, c1 as invalidateVisualizationsCache, c5 as invalidateWorkspaceArtifacts, bX as invalidateWorkspacesCache, bE as invokeTool, _ as isProviderCredential, bi as listAgents, a_ as listDataSources, aR as listDatasets, bF as listGitHubRepos, bz as listMessages, aX as listModels, aW as listReports, aY as listScripts, bj as listSites, by as listThreads, b8 as listUsers, aV as listVisualizations, aO as listWorkspaces, b5 as login, bC as markMessageRead, bB as openThread, bJ as previewPiiMasking, bq as promoteSiteVersion, bn as publishStagedSite, bu as publishToGitHub, bd as reactivateUser, b6 as register, bM as removePiiAllowlistTerm, bt as removeSiteAlias, bA as sendMessage, cb as setCached, bZ as setCachedDatasets, c3 as setCachedReports, c8 as setCachedSites, c0 as setCachedVisualizations, bW as setCachedWorkspaces, bs as setSiteAlias, bc as suspendUser, b0 as testDataSource, bw as updateDocuments, bI as updatePiiSettings, ba as updateUser, b4 as uploadFile } from './index-CUyJ5c2d.mjs';
|
|
5
5
|
export { h as AppAccessStatus, A as AppPaywallProps, e as UseAppAccessReturn } from './types-BmCPwbGH.mjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -733,6 +733,80 @@ interface UseConnectionsReturn {
|
|
|
733
733
|
}
|
|
734
734
|
declare function useConnections(): UseConnectionsReturn;
|
|
735
735
|
|
|
736
|
+
/**
|
|
737
|
+
* useThreads — list a built-app user's private message threads (P0-138).
|
|
738
|
+
*
|
|
739
|
+
* Backed by the server-owned, ACL'd DM store: the backend only ever returns
|
|
740
|
+
* threads the authenticated caller participates in. Each thread carries the
|
|
741
|
+
* counterpart's user key, the last message, and an unread count.
|
|
742
|
+
*
|
|
743
|
+
* Private messaging is a built-app capability — requires an `appScope` on the
|
|
744
|
+
* FlowstackProvider config. In a Casino personal session the backend returns 403
|
|
745
|
+
* and this hook surfaces an error.
|
|
746
|
+
*
|
|
747
|
+
* Usage:
|
|
748
|
+
* const { threads, isLoading, refresh } = useThreads({ refreshInterval: 5000 });
|
|
749
|
+
* threads.map(t => <ThreadRow key={t.pair_key} counterpart={t.with_user_key} ... />)
|
|
750
|
+
*/
|
|
751
|
+
|
|
752
|
+
interface UseThreadsOptions {
|
|
753
|
+
/** Auto-poll interval in ms (optional — no polling by default). */
|
|
754
|
+
refreshInterval?: number;
|
|
755
|
+
/** Skip initial fetch. */
|
|
756
|
+
enabled?: boolean;
|
|
757
|
+
}
|
|
758
|
+
interface UseThreadsReturn {
|
|
759
|
+
threads: DmThread[];
|
|
760
|
+
isLoading: boolean;
|
|
761
|
+
error: string | null;
|
|
762
|
+
refresh: () => Promise<void>;
|
|
763
|
+
/**
|
|
764
|
+
* Record the caller's consent to open a thread with `withUserKey`. The thread
|
|
765
|
+
* becomes sendable only once BOTH parties have consented. Idempotent per caller;
|
|
766
|
+
* refetches the thread list on success. Returns the resulting status.
|
|
767
|
+
*/
|
|
768
|
+
openThread: (withUserKey: string) => Promise<'pending' | 'open' | null>;
|
|
769
|
+
}
|
|
770
|
+
declare function useThreads(options?: UseThreadsOptions): UseThreadsReturn;
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* useMessages — read + send private messages in one thread (P0-138).
|
|
774
|
+
*
|
|
775
|
+
* Mirrors `useCollection`'s ergonomics but is backed by the server-owned, ACL'd
|
|
776
|
+
* DM endpoints instead of a Mongo collection. The backend pins the sender to the
|
|
777
|
+
* caller's identity and only delivers into a mutually-consented (open) thread, so
|
|
778
|
+
* a `send()` to a not-yet-open thread returns an error.
|
|
779
|
+
*
|
|
780
|
+
* SECURITY: message bodies are UNTRUSTED user input. Render them as plain text or
|
|
781
|
+
* sanitized markdown — never as raw HTML (no dangerouslySetInnerHTML). If a body
|
|
782
|
+
* is ever fed to an agent, treat it as data, not instructions.
|
|
783
|
+
*
|
|
784
|
+
* Usage:
|
|
785
|
+
* const { messages, send, isLoading, refresh } = useMessages(counterpartUserKey, {
|
|
786
|
+
* refreshInterval: 4000,
|
|
787
|
+
* });
|
|
788
|
+
* await send('hey there');
|
|
789
|
+
* messages.map(m => <Bubble key={m.message_id} mine={m.from === myKey}>{m.body}</Bubble>)
|
|
790
|
+
*/
|
|
791
|
+
|
|
792
|
+
interface UseMessagesOptions {
|
|
793
|
+
/** Max messages to load (default 50, max 200). */
|
|
794
|
+
limit?: number;
|
|
795
|
+
/** Auto-poll interval in ms (optional — no polling by default). */
|
|
796
|
+
refreshInterval?: number;
|
|
797
|
+
/** Skip initial fetch (e.g. before a counterpart is selected). */
|
|
798
|
+
enabled?: boolean;
|
|
799
|
+
}
|
|
800
|
+
interface UseMessagesReturn {
|
|
801
|
+
messages: DmMessage[];
|
|
802
|
+
isLoading: boolean;
|
|
803
|
+
error: string | null;
|
|
804
|
+
/** Send a message to the counterpart. Refetches on success. */
|
|
805
|
+
send: (body: string) => Promise<void>;
|
|
806
|
+
refresh: () => Promise<void>;
|
|
807
|
+
}
|
|
808
|
+
declare function useMessages(withUserKey: string | null | undefined, options?: UseMessagesOptions): UseMessagesReturn;
|
|
809
|
+
|
|
736
810
|
declare function useSiteVersions(siteId: string | null): UseSiteVersionsReturn;
|
|
737
811
|
|
|
738
812
|
/**
|
|
@@ -2322,4 +2396,4 @@ type SubagentInvokeRun = {
|
|
|
2322
2396
|
output: string | null;
|
|
2323
2397
|
};
|
|
2324
2398
|
|
|
2325
|
-
export { AdminGate, type AdminGateProps, AdminProviderCredential, AgentConfig, AgentFactory, type AgentFactoryOptions, AgentRegistry, type AgentRegistryOptions, AgentTemplate, AuthGuard, type AuthGuardOptions, type AuthGuardProps, AuthPage, type AuthPageProps, type Automation, type AutomationOutputConfig, type AutomationOutputType, type AutomationRun, type AutomationStatus, BrokeredLoginButton, type BrokeredLoginButtonProps, COLLECTION_CHANGED_EVENT, ChatInterface, type ChatInterfaceProps, ChatMessage, ChatPage, type ChatPageProps, CollectionLayer, CollectionSchemaInfo, type ConnectionStatus, type ConnectionsState, type ContentSegment, CreateAdminProviderCredentialInput, type CreateAutomationInput, type CreateCredentialParams, type CreateIntegrationInput, CreateWorkspaceModal, type CreateWorkspaceModalProps, DEFAULT_PATTERNS, DashboardLayout, type DashboardLayoutProps, DataSource, DataSourceBadgeInfo, DatasetInfo, DatasetUploader, type DatasetUploaderProps, type DynamicAgentConfig, type ErrorCode, ErrorCodes, ErrorMessages, ExistingProviderCredential, FlowstackClientConfig, FlowstackConfig, FlowstackContextValue, FlowstackCredentials, FlowstackError, type FlowstackErrorOptions, FlowstackProvider, type GitHubConnectionStatus, type GoogleService, GoogleSignIn, type GoogleSignInProps, type Integration, type IntegrationAuthType, type IntegrationEndpoint, type IntentAnalysis, IntentAnalyzer, type IntentAnalyzerOptions, type IntentCategory, type IntentEntity, type IntentPattern, type LLMExecutor, LLMProvider, type LibraryConversationSummary, type LibraryItem, type LibraryItemDetail, type LibraryItemType, LoginForm, type LoginFormProps, type LoginRouteConfig, ManagedUser, MarkdownRenderer, type MarkdownRendererProps, MessageList, type MessageListProps, ModelOption, ModelPreferenceState, OllamaLocalModel, OllamaStatus, ProviderCredential, ProviderModelSettings, PurposeInfo, RecoveryActions, RegisterForm, type RegisterFormProps, type RegisterRouteConfig, type RegisteredAgent, type ServiceProvider, StreamEvent, type SubagentDefinition, type SubagentInvokeRun, type SubagentSummary, ToolCall, type TrashedItem, type UpdateAutomationInput, type UpdateIntegrationInput, type UseAdminProviderCredentialsReturn, UseAgentOptions, UseAgentReturn, UseAgentsReturn, type UseAuthGuardReturn, UseAuthReturn, type UseAutomationsReturn, type UseCollectionExplorerOptions, type UseCollectionExplorerReturn, type UseCollectionOptions, type UseCollectionReturn, type UseConnectionsReturn, type UseConversationReturn, type UseDataOverviewReturn, UseDataSourcesReturn, UseDatasetsReturn, type UseFlowstackStatusOptions, type UseFlowstackStatusReturn, type UseIntegrationsReturn, type UseIntentAgentOptions, type UseIntentAgentReturn, type UseLibraryReturn, type UseModelPreferenceReturn, UseModelsReturn, type UseProviderCredentialsReturn, type UsePublicCollectionOptions, type UsePublicCollectionReturn, UseQueryReturn, UseReportsReturn, UseSiteVersionsReturn, UseSitesReturn, type UseToolInvocationOptions, type UseToolInvocationReturn, type UseUserCollectionsOptions, type UseUserCollectionsReturn, UseUserManagementReturn, UseVisualizationsReturn, UseWorkspaceReturn, User, UserActivityLog, UserCollectionInfo, UserDataOverview, UserStats, type ValidationResult, VisualizationData, WorkspaceInfo, WorkspaceSelector, type WorkspaceSelectorProps, analyzeWithRules, clearAllFlowstackData, clearCredentials, clearMessages, clearSelectedWorkspace, createCustomTemplate, dataScienceTemplate, extractEntities, generateMockId, getAgentTemplate, getConfigSummary, getItem, getSubagent, isDevelopmentConfig, isFlowstackError, listLibraryItems, loadCredentials, loadMessages, loadSelectedWorkspace, marketingTemplate, mockChatHistory, mockCredentials, mockDataSources, mockDatasets, mockDelay, mockManagedUsers, mockUser, mockUserActivity, mockUserStats, mockVisualizations, mockWorkspaces, parseSSELine, parseSSEStream, processSSEStream, removeItem, sanitizeMermaidCode, saveCredentials, saveMessages, saveSelectedWorkspace, setItem, splitContentSegments, supportTemplate, useAdminProviderCredentials, useAgent, useAgents, useAuth, useAuthGuard, useAutomations, useCollection, useCollectionExplorer, useConnections, useConversation, useConversations, useCurrentSession, useDataOverview, useDataSources, useDatasets, useFlowstack, useFlowstackOptional, useFlowstackStatus, useIntegrations, useIntentAgent, useLibrary, useLibraryConversations, useLibrarySearch, useLibraryTrash, useModelPreference, useModels, useOllamaDetection, useProviderCredentials, usePublicCollection, useQuery, useRecentLibraryConversations, useReports, useSiteVersions, useSites, useSubagentInvoke, useSubagents, useToolInvocation, useUserCollections, useUserManagement, useVisualizations, useWorkspace, validateConfig, validateConfigOrThrow, withErrorHandling };
|
|
2399
|
+
export { AdminGate, type AdminGateProps, AdminProviderCredential, AgentConfig, AgentFactory, type AgentFactoryOptions, AgentRegistry, type AgentRegistryOptions, AgentTemplate, AuthGuard, type AuthGuardOptions, type AuthGuardProps, AuthPage, type AuthPageProps, type Automation, type AutomationOutputConfig, type AutomationOutputType, type AutomationRun, type AutomationStatus, BrokeredLoginButton, type BrokeredLoginButtonProps, COLLECTION_CHANGED_EVENT, ChatInterface, type ChatInterfaceProps, ChatMessage, ChatPage, type ChatPageProps, CollectionLayer, CollectionSchemaInfo, type ConnectionStatus, type ConnectionsState, type ContentSegment, CreateAdminProviderCredentialInput, type CreateAutomationInput, type CreateCredentialParams, type CreateIntegrationInput, CreateWorkspaceModal, type CreateWorkspaceModalProps, DEFAULT_PATTERNS, DashboardLayout, type DashboardLayoutProps, DataSource, DataSourceBadgeInfo, DatasetInfo, DatasetUploader, type DatasetUploaderProps, DmMessage, DmThread, type DynamicAgentConfig, type ErrorCode, ErrorCodes, ErrorMessages, ExistingProviderCredential, FlowstackClientConfig, FlowstackConfig, FlowstackContextValue, FlowstackCredentials, FlowstackError, type FlowstackErrorOptions, FlowstackProvider, type GitHubConnectionStatus, type GoogleService, GoogleSignIn, type GoogleSignInProps, type Integration, type IntegrationAuthType, type IntegrationEndpoint, type IntentAnalysis, IntentAnalyzer, type IntentAnalyzerOptions, type IntentCategory, type IntentEntity, type IntentPattern, type LLMExecutor, LLMProvider, type LibraryConversationSummary, type LibraryItem, type LibraryItemDetail, type LibraryItemType, LoginForm, type LoginFormProps, type LoginRouteConfig, ManagedUser, MarkdownRenderer, type MarkdownRendererProps, MessageList, type MessageListProps, ModelOption, ModelPreferenceState, OllamaLocalModel, OllamaStatus, ProviderCredential, ProviderModelSettings, PurposeInfo, RecoveryActions, RegisterForm, type RegisterFormProps, type RegisterRouteConfig, type RegisteredAgent, type ServiceProvider, StreamEvent, type SubagentDefinition, type SubagentInvokeRun, type SubagentSummary, ToolCall, type TrashedItem, type UpdateAutomationInput, type UpdateIntegrationInput, type UseAdminProviderCredentialsReturn, UseAgentOptions, UseAgentReturn, UseAgentsReturn, type UseAuthGuardReturn, UseAuthReturn, type UseAutomationsReturn, type UseCollectionExplorerOptions, type UseCollectionExplorerReturn, type UseCollectionOptions, type UseCollectionReturn, type UseConnectionsReturn, type UseConversationReturn, type UseDataOverviewReturn, UseDataSourcesReturn, UseDatasetsReturn, type UseFlowstackStatusOptions, type UseFlowstackStatusReturn, type UseIntegrationsReturn, type UseIntentAgentOptions, type UseIntentAgentReturn, type UseLibraryReturn, type UseMessagesOptions, type UseMessagesReturn, type UseModelPreferenceReturn, UseModelsReturn, type UseProviderCredentialsReturn, type UsePublicCollectionOptions, type UsePublicCollectionReturn, UseQueryReturn, UseReportsReturn, UseSiteVersionsReturn, UseSitesReturn, type UseThreadsOptions, type UseThreadsReturn, type UseToolInvocationOptions, type UseToolInvocationReturn, type UseUserCollectionsOptions, type UseUserCollectionsReturn, UseUserManagementReturn, UseVisualizationsReturn, UseWorkspaceReturn, User, UserActivityLog, UserCollectionInfo, UserDataOverview, UserStats, type ValidationResult, VisualizationData, WorkspaceInfo, WorkspaceSelector, type WorkspaceSelectorProps, analyzeWithRules, clearAllFlowstackData, clearCredentials, clearMessages, clearSelectedWorkspace, createCustomTemplate, dataScienceTemplate, extractEntities, generateMockId, getAgentTemplate, getConfigSummary, getItem, getSubagent, isDevelopmentConfig, isFlowstackError, listLibraryItems, loadCredentials, loadMessages, loadSelectedWorkspace, marketingTemplate, mockChatHistory, mockCredentials, mockDataSources, mockDatasets, mockDelay, mockManagedUsers, mockUser, mockUserActivity, mockUserStats, mockVisualizations, mockWorkspaces, parseSSELine, parseSSEStream, processSSEStream, removeItem, sanitizeMermaidCode, saveCredentials, saveMessages, saveSelectedWorkspace, setItem, splitContentSegments, supportTemplate, useAdminProviderCredentials, useAgent, useAgents, useAuth, useAuthGuard, useAutomations, useCollection, useCollectionExplorer, useConnections, useConversation, useConversations, useCurrentSession, useDataOverview, useDataSources, useDatasets, useFlowstack, useFlowstackOptional, useFlowstackStatus, useIntegrations, useIntentAgent, useLibrary, useLibraryConversations, useLibrarySearch, useLibraryTrash, useMessages, useModelPreference, useModels, useOllamaDetection, useProviderCredentials, usePublicCollection, useQuery, useRecentLibraryConversations, useReports, useSiteVersions, useSites, useSubagentInvoke, useSubagents, useThreads, useToolInvocation, useUserCollections, useUserManagement, useVisualizations, useWorkspace, validateConfig, validateConfigOrThrow, withErrorHandling };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React, { ReactNode } from 'react';
|
|
3
|
-
import { F as FlowstackConfig, a as FlowstackContextValue, U as UseAuthReturn, b as UseWorkspaceReturn, c as UseDatasetsReturn, d as UseVisualizationsReturn, e as UseReportsReturn, f as UseModelsReturn, g as UseDataSourcesReturn, A as AgentTemplate, h as UseAgentOptions, i as UseAgentReturn, j as UseQueryReturn, C as ChatMessage, T as ToolCall, k as UseUserManagementReturn, l as UseSitesReturn, m as UseAgentsReturn, n as CollectionLayer, o as UseSiteVersionsReturn, P as ProviderCredential,
|
|
4
|
-
export {
|
|
3
|
+
import { F as FlowstackConfig, a as FlowstackContextValue, U as UseAuthReturn, b as UseWorkspaceReturn, c as UseDatasetsReturn, d as UseVisualizationsReturn, e as UseReportsReturn, f as UseModelsReturn, g as UseDataSourcesReturn, A as AgentTemplate, h as UseAgentOptions, i as UseAgentReturn, j as UseQueryReturn, C as ChatMessage, T as ToolCall, k as UseUserManagementReturn, l as UseSitesReturn, m as UseAgentsReturn, n as CollectionLayer, D as DmThread, o as DmMessage, p as UseSiteVersionsReturn, P as ProviderCredential, q as PurposeInfo, L as LLMProvider, r as ProviderModelSettings, O as OllamaLocalModel, s as OllamaStatus, t as UserDataOverview, u as UserCollectionInfo, v as CollectionSchemaInfo, w as FlowstackCredentials, x as User, W as WorkspaceInfo, y as DatasetInfo, V as VisualizationData, z as DataSource, M as ManagedUser, B as UserStats, E as UserActivityLog, G as DataSourceBadgeInfo, S as StreamEvent, H as AgentConfig, I as ModelPreferenceState, J as ModelOption, K as AdminProviderCredential, N as ExistingProviderCredential, Q as CreateAdminProviderCredentialInput, R as FlowstackClientConfig } from './index-CUyJ5c2d.js';
|
|
4
|
+
export { as as AgentInfo, aF as ApiResponse, a0 as AuthConfig, bU as CACHE_TTL, $ as COLLECTION_LAYERS, Y as CREDENTIAL_PURPOSES, ab as ColumnSchema, aj as ConnectionTestResult, au as CreateSiteParams, a9 as CreateWorkspaceRequest, az as CredentialPurpose, ar as CreditStatus, Z as DEFAULT_PROVIDER_MODEL_SETTINGS, ai as DataSourceConfig, ah as DataSourceType, a2 as DatabaseConfig, aa as DatasetPreview, ac as DatasetRow, ad as DatasetStreamOptions, aB as GitHubRepo, a7 as GoogleAuthResponse, an as InterruptInfo, X as LLM_PROVIDERS, aG as ListResponse, a3 as LoginRequest, a4 as LoginResponse, af as ModelInfo, aD as PiiEntitySettings, aE as PiiRedactedEntity, aC as PiiSettings, ax as PublishToGitHubParams, ay as PublishToGitHubResult, at as PublishedSiteInfo, ao as QueryOptions, a1 as RedisConfig, a5 as RegisterRequest, a6 as RegisterResponse, ae as ReportInfo, bT as RequestOptions, ag as ScriptInfo, ak as SearchResult, al as SearchResultsData, a8 as SessionState, av as SiteVersion, aw as SiteVersionManifest, am as StreamEventType, aK as UpdateUserRequest, aq as UsagePeriod, ap as UsageStats, aJ as UserActivityType, aA as UserDataOverviewWorkspace, aL as UserListParams, aM as UserListResponse, aH as UserRole, aI as UserStatus, bL as addPiiAllowlistTerm, bm as addSiteFile, bg as checkAdminPermissions, a$ as createDataSource, bl as createSite, aP as createWorkspace, cc as deleteCached, b1 as deleteDataSource, aU as deleteDataset, bx as deleteDocuments, bo as deleteSite, br as deleteSiteVersion, bb as deleteUser, bR as deleteUserCollection, bD as dmPairKey, b2 as executeQuery, b3 as executeQueryWithConfig, bS as exportUserCollection, aN as flowstackFetch, ca as getCached, bY as getCachedDatasets, c2 as getCachedReports, c7 as getCachedSites, b$ as getCachedVisualizations, bV as getCachedWorkspaces, bh as getConversationHistory, aS as getDataset, aT as getDatasetPreview, aZ as getModel, bK as getPiiAllowlist, bH as getPiiSettings, bk as getSite, bp as getSiteVersions, b9 as getUser, be as getUserActivity, bP as getUserCollectionDocuments, bQ as getUserCollectionSchema, bO as getUserCollections, bN as getUserDataOverview, bf as getUserStats, aQ as getWorkspace, b7 as googleLogin, bG as importFromGitHub, bv as insertDocuments, c6 as invalidateAllUserCache, b_ as invalidateDatasetsCache, c4 as invalidateReportsCache, c9 as invalidateSitesCache, c1 as invalidateVisualizationsCache, c5 as invalidateWorkspaceArtifacts, bX as invalidateWorkspacesCache, bE as invokeTool, _ as isProviderCredential, bi as listAgents, a_ as listDataSources, aR as listDatasets, bF as listGitHubRepos, bz as listMessages, aX as listModels, aW as listReports, aY as listScripts, bj as listSites, by as listThreads, b8 as listUsers, aV as listVisualizations, aO as listWorkspaces, b5 as login, bC as markMessageRead, bB as openThread, bJ as previewPiiMasking, bq as promoteSiteVersion, bn as publishStagedSite, bu as publishToGitHub, bd as reactivateUser, b6 as register, bM as removePiiAllowlistTerm, bt as removeSiteAlias, bA as sendMessage, cb as setCached, bZ as setCachedDatasets, c3 as setCachedReports, c8 as setCachedSites, c0 as setCachedVisualizations, bW as setCachedWorkspaces, bs as setSiteAlias, bc as suspendUser, b0 as testDataSource, bw as updateDocuments, bI as updatePiiSettings, ba as updateUser, b4 as uploadFile } from './index-CUyJ5c2d.js';
|
|
5
5
|
export { h as AppAccessStatus, A as AppPaywallProps, e as UseAppAccessReturn } from './types-BmCPwbGH.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -733,6 +733,80 @@ interface UseConnectionsReturn {
|
|
|
733
733
|
}
|
|
734
734
|
declare function useConnections(): UseConnectionsReturn;
|
|
735
735
|
|
|
736
|
+
/**
|
|
737
|
+
* useThreads — list a built-app user's private message threads (P0-138).
|
|
738
|
+
*
|
|
739
|
+
* Backed by the server-owned, ACL'd DM store: the backend only ever returns
|
|
740
|
+
* threads the authenticated caller participates in. Each thread carries the
|
|
741
|
+
* counterpart's user key, the last message, and an unread count.
|
|
742
|
+
*
|
|
743
|
+
* Private messaging is a built-app capability — requires an `appScope` on the
|
|
744
|
+
* FlowstackProvider config. In a Casino personal session the backend returns 403
|
|
745
|
+
* and this hook surfaces an error.
|
|
746
|
+
*
|
|
747
|
+
* Usage:
|
|
748
|
+
* const { threads, isLoading, refresh } = useThreads({ refreshInterval: 5000 });
|
|
749
|
+
* threads.map(t => <ThreadRow key={t.pair_key} counterpart={t.with_user_key} ... />)
|
|
750
|
+
*/
|
|
751
|
+
|
|
752
|
+
interface UseThreadsOptions {
|
|
753
|
+
/** Auto-poll interval in ms (optional — no polling by default). */
|
|
754
|
+
refreshInterval?: number;
|
|
755
|
+
/** Skip initial fetch. */
|
|
756
|
+
enabled?: boolean;
|
|
757
|
+
}
|
|
758
|
+
interface UseThreadsReturn {
|
|
759
|
+
threads: DmThread[];
|
|
760
|
+
isLoading: boolean;
|
|
761
|
+
error: string | null;
|
|
762
|
+
refresh: () => Promise<void>;
|
|
763
|
+
/**
|
|
764
|
+
* Record the caller's consent to open a thread with `withUserKey`. The thread
|
|
765
|
+
* becomes sendable only once BOTH parties have consented. Idempotent per caller;
|
|
766
|
+
* refetches the thread list on success. Returns the resulting status.
|
|
767
|
+
*/
|
|
768
|
+
openThread: (withUserKey: string) => Promise<'pending' | 'open' | null>;
|
|
769
|
+
}
|
|
770
|
+
declare function useThreads(options?: UseThreadsOptions): UseThreadsReturn;
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* useMessages — read + send private messages in one thread (P0-138).
|
|
774
|
+
*
|
|
775
|
+
* Mirrors `useCollection`'s ergonomics but is backed by the server-owned, ACL'd
|
|
776
|
+
* DM endpoints instead of a Mongo collection. The backend pins the sender to the
|
|
777
|
+
* caller's identity and only delivers into a mutually-consented (open) thread, so
|
|
778
|
+
* a `send()` to a not-yet-open thread returns an error.
|
|
779
|
+
*
|
|
780
|
+
* SECURITY: message bodies are UNTRUSTED user input. Render them as plain text or
|
|
781
|
+
* sanitized markdown — never as raw HTML (no dangerouslySetInnerHTML). If a body
|
|
782
|
+
* is ever fed to an agent, treat it as data, not instructions.
|
|
783
|
+
*
|
|
784
|
+
* Usage:
|
|
785
|
+
* const { messages, send, isLoading, refresh } = useMessages(counterpartUserKey, {
|
|
786
|
+
* refreshInterval: 4000,
|
|
787
|
+
* });
|
|
788
|
+
* await send('hey there');
|
|
789
|
+
* messages.map(m => <Bubble key={m.message_id} mine={m.from === myKey}>{m.body}</Bubble>)
|
|
790
|
+
*/
|
|
791
|
+
|
|
792
|
+
interface UseMessagesOptions {
|
|
793
|
+
/** Max messages to load (default 50, max 200). */
|
|
794
|
+
limit?: number;
|
|
795
|
+
/** Auto-poll interval in ms (optional — no polling by default). */
|
|
796
|
+
refreshInterval?: number;
|
|
797
|
+
/** Skip initial fetch (e.g. before a counterpart is selected). */
|
|
798
|
+
enabled?: boolean;
|
|
799
|
+
}
|
|
800
|
+
interface UseMessagesReturn {
|
|
801
|
+
messages: DmMessage[];
|
|
802
|
+
isLoading: boolean;
|
|
803
|
+
error: string | null;
|
|
804
|
+
/** Send a message to the counterpart. Refetches on success. */
|
|
805
|
+
send: (body: string) => Promise<void>;
|
|
806
|
+
refresh: () => Promise<void>;
|
|
807
|
+
}
|
|
808
|
+
declare function useMessages(withUserKey: string | null | undefined, options?: UseMessagesOptions): UseMessagesReturn;
|
|
809
|
+
|
|
736
810
|
declare function useSiteVersions(siteId: string | null): UseSiteVersionsReturn;
|
|
737
811
|
|
|
738
812
|
/**
|
|
@@ -2322,4 +2396,4 @@ type SubagentInvokeRun = {
|
|
|
2322
2396
|
output: string | null;
|
|
2323
2397
|
};
|
|
2324
2398
|
|
|
2325
|
-
export { AdminGate, type AdminGateProps, AdminProviderCredential, AgentConfig, AgentFactory, type AgentFactoryOptions, AgentRegistry, type AgentRegistryOptions, AgentTemplate, AuthGuard, type AuthGuardOptions, type AuthGuardProps, AuthPage, type AuthPageProps, type Automation, type AutomationOutputConfig, type AutomationOutputType, type AutomationRun, type AutomationStatus, BrokeredLoginButton, type BrokeredLoginButtonProps, COLLECTION_CHANGED_EVENT, ChatInterface, type ChatInterfaceProps, ChatMessage, ChatPage, type ChatPageProps, CollectionLayer, CollectionSchemaInfo, type ConnectionStatus, type ConnectionsState, type ContentSegment, CreateAdminProviderCredentialInput, type CreateAutomationInput, type CreateCredentialParams, type CreateIntegrationInput, CreateWorkspaceModal, type CreateWorkspaceModalProps, DEFAULT_PATTERNS, DashboardLayout, type DashboardLayoutProps, DataSource, DataSourceBadgeInfo, DatasetInfo, DatasetUploader, type DatasetUploaderProps, type DynamicAgentConfig, type ErrorCode, ErrorCodes, ErrorMessages, ExistingProviderCredential, FlowstackClientConfig, FlowstackConfig, FlowstackContextValue, FlowstackCredentials, FlowstackError, type FlowstackErrorOptions, FlowstackProvider, type GitHubConnectionStatus, type GoogleService, GoogleSignIn, type GoogleSignInProps, type Integration, type IntegrationAuthType, type IntegrationEndpoint, type IntentAnalysis, IntentAnalyzer, type IntentAnalyzerOptions, type IntentCategory, type IntentEntity, type IntentPattern, type LLMExecutor, LLMProvider, type LibraryConversationSummary, type LibraryItem, type LibraryItemDetail, type LibraryItemType, LoginForm, type LoginFormProps, type LoginRouteConfig, ManagedUser, MarkdownRenderer, type MarkdownRendererProps, MessageList, type MessageListProps, ModelOption, ModelPreferenceState, OllamaLocalModel, OllamaStatus, ProviderCredential, ProviderModelSettings, PurposeInfo, RecoveryActions, RegisterForm, type RegisterFormProps, type RegisterRouteConfig, type RegisteredAgent, type ServiceProvider, StreamEvent, type SubagentDefinition, type SubagentInvokeRun, type SubagentSummary, ToolCall, type TrashedItem, type UpdateAutomationInput, type UpdateIntegrationInput, type UseAdminProviderCredentialsReturn, UseAgentOptions, UseAgentReturn, UseAgentsReturn, type UseAuthGuardReturn, UseAuthReturn, type UseAutomationsReturn, type UseCollectionExplorerOptions, type UseCollectionExplorerReturn, type UseCollectionOptions, type UseCollectionReturn, type UseConnectionsReturn, type UseConversationReturn, type UseDataOverviewReturn, UseDataSourcesReturn, UseDatasetsReturn, type UseFlowstackStatusOptions, type UseFlowstackStatusReturn, type UseIntegrationsReturn, type UseIntentAgentOptions, type UseIntentAgentReturn, type UseLibraryReturn, type UseModelPreferenceReturn, UseModelsReturn, type UseProviderCredentialsReturn, type UsePublicCollectionOptions, type UsePublicCollectionReturn, UseQueryReturn, UseReportsReturn, UseSiteVersionsReturn, UseSitesReturn, type UseToolInvocationOptions, type UseToolInvocationReturn, type UseUserCollectionsOptions, type UseUserCollectionsReturn, UseUserManagementReturn, UseVisualizationsReturn, UseWorkspaceReturn, User, UserActivityLog, UserCollectionInfo, UserDataOverview, UserStats, type ValidationResult, VisualizationData, WorkspaceInfo, WorkspaceSelector, type WorkspaceSelectorProps, analyzeWithRules, clearAllFlowstackData, clearCredentials, clearMessages, clearSelectedWorkspace, createCustomTemplate, dataScienceTemplate, extractEntities, generateMockId, getAgentTemplate, getConfigSummary, getItem, getSubagent, isDevelopmentConfig, isFlowstackError, listLibraryItems, loadCredentials, loadMessages, loadSelectedWorkspace, marketingTemplate, mockChatHistory, mockCredentials, mockDataSources, mockDatasets, mockDelay, mockManagedUsers, mockUser, mockUserActivity, mockUserStats, mockVisualizations, mockWorkspaces, parseSSELine, parseSSEStream, processSSEStream, removeItem, sanitizeMermaidCode, saveCredentials, saveMessages, saveSelectedWorkspace, setItem, splitContentSegments, supportTemplate, useAdminProviderCredentials, useAgent, useAgents, useAuth, useAuthGuard, useAutomations, useCollection, useCollectionExplorer, useConnections, useConversation, useConversations, useCurrentSession, useDataOverview, useDataSources, useDatasets, useFlowstack, useFlowstackOptional, useFlowstackStatus, useIntegrations, useIntentAgent, useLibrary, useLibraryConversations, useLibrarySearch, useLibraryTrash, useModelPreference, useModels, useOllamaDetection, useProviderCredentials, usePublicCollection, useQuery, useRecentLibraryConversations, useReports, useSiteVersions, useSites, useSubagentInvoke, useSubagents, useToolInvocation, useUserCollections, useUserManagement, useVisualizations, useWorkspace, validateConfig, validateConfigOrThrow, withErrorHandling };
|
|
2399
|
+
export { AdminGate, type AdminGateProps, AdminProviderCredential, AgentConfig, AgentFactory, type AgentFactoryOptions, AgentRegistry, type AgentRegistryOptions, AgentTemplate, AuthGuard, type AuthGuardOptions, type AuthGuardProps, AuthPage, type AuthPageProps, type Automation, type AutomationOutputConfig, type AutomationOutputType, type AutomationRun, type AutomationStatus, BrokeredLoginButton, type BrokeredLoginButtonProps, COLLECTION_CHANGED_EVENT, ChatInterface, type ChatInterfaceProps, ChatMessage, ChatPage, type ChatPageProps, CollectionLayer, CollectionSchemaInfo, type ConnectionStatus, type ConnectionsState, type ContentSegment, CreateAdminProviderCredentialInput, type CreateAutomationInput, type CreateCredentialParams, type CreateIntegrationInput, CreateWorkspaceModal, type CreateWorkspaceModalProps, DEFAULT_PATTERNS, DashboardLayout, type DashboardLayoutProps, DataSource, DataSourceBadgeInfo, DatasetInfo, DatasetUploader, type DatasetUploaderProps, DmMessage, DmThread, type DynamicAgentConfig, type ErrorCode, ErrorCodes, ErrorMessages, ExistingProviderCredential, FlowstackClientConfig, FlowstackConfig, FlowstackContextValue, FlowstackCredentials, FlowstackError, type FlowstackErrorOptions, FlowstackProvider, type GitHubConnectionStatus, type GoogleService, GoogleSignIn, type GoogleSignInProps, type Integration, type IntegrationAuthType, type IntegrationEndpoint, type IntentAnalysis, IntentAnalyzer, type IntentAnalyzerOptions, type IntentCategory, type IntentEntity, type IntentPattern, type LLMExecutor, LLMProvider, type LibraryConversationSummary, type LibraryItem, type LibraryItemDetail, type LibraryItemType, LoginForm, type LoginFormProps, type LoginRouteConfig, ManagedUser, MarkdownRenderer, type MarkdownRendererProps, MessageList, type MessageListProps, ModelOption, ModelPreferenceState, OllamaLocalModel, OllamaStatus, ProviderCredential, ProviderModelSettings, PurposeInfo, RecoveryActions, RegisterForm, type RegisterFormProps, type RegisterRouteConfig, type RegisteredAgent, type ServiceProvider, StreamEvent, type SubagentDefinition, type SubagentInvokeRun, type SubagentSummary, ToolCall, type TrashedItem, type UpdateAutomationInput, type UpdateIntegrationInput, type UseAdminProviderCredentialsReturn, UseAgentOptions, UseAgentReturn, UseAgentsReturn, type UseAuthGuardReturn, UseAuthReturn, type UseAutomationsReturn, type UseCollectionExplorerOptions, type UseCollectionExplorerReturn, type UseCollectionOptions, type UseCollectionReturn, type UseConnectionsReturn, type UseConversationReturn, type UseDataOverviewReturn, UseDataSourcesReturn, UseDatasetsReturn, type UseFlowstackStatusOptions, type UseFlowstackStatusReturn, type UseIntegrationsReturn, type UseIntentAgentOptions, type UseIntentAgentReturn, type UseLibraryReturn, type UseMessagesOptions, type UseMessagesReturn, type UseModelPreferenceReturn, UseModelsReturn, type UseProviderCredentialsReturn, type UsePublicCollectionOptions, type UsePublicCollectionReturn, UseQueryReturn, UseReportsReturn, UseSiteVersionsReturn, UseSitesReturn, type UseThreadsOptions, type UseThreadsReturn, type UseToolInvocationOptions, type UseToolInvocationReturn, type UseUserCollectionsOptions, type UseUserCollectionsReturn, UseUserManagementReturn, UseVisualizationsReturn, UseWorkspaceReturn, User, UserActivityLog, UserCollectionInfo, UserDataOverview, UserStats, type ValidationResult, VisualizationData, WorkspaceInfo, WorkspaceSelector, type WorkspaceSelectorProps, analyzeWithRules, clearAllFlowstackData, clearCredentials, clearMessages, clearSelectedWorkspace, createCustomTemplate, dataScienceTemplate, extractEntities, generateMockId, getAgentTemplate, getConfigSummary, getItem, getSubagent, isDevelopmentConfig, isFlowstackError, listLibraryItems, loadCredentials, loadMessages, loadSelectedWorkspace, marketingTemplate, mockChatHistory, mockCredentials, mockDataSources, mockDatasets, mockDelay, mockManagedUsers, mockUser, mockUserActivity, mockUserStats, mockVisualizations, mockWorkspaces, parseSSELine, parseSSEStream, processSSEStream, removeItem, sanitizeMermaidCode, saveCredentials, saveMessages, saveSelectedWorkspace, setItem, splitContentSegments, supportTemplate, useAdminProviderCredentials, useAgent, useAgents, useAuth, useAuthGuard, useAutomations, useCollection, useCollectionExplorer, useConnections, useConversation, useConversations, useCurrentSession, useDataOverview, useDataSources, useDatasets, useFlowstack, useFlowstackOptional, useFlowstackStatus, useIntegrations, useIntentAgent, useLibrary, useLibraryConversations, useLibrarySearch, useLibraryTrash, useMessages, useModelPreference, useModels, useOllamaDetection, useProviderCredentials, usePublicCollection, useQuery, useRecentLibraryConversations, useReports, useSiteVersions, useSites, useSubagentInvoke, useSubagents, useThreads, useToolInvocation, useUserCollections, useUserManagement, useVisualizations, useWorkspace, validateConfig, validateConfigOrThrow, withErrorHandling };
|
package/dist/index.js
CHANGED
|
@@ -344,6 +344,63 @@ async function deleteDocuments(credentials, collection, filter, config, layer) {
|
|
|
344
344
|
config
|
|
345
345
|
);
|
|
346
346
|
}
|
|
347
|
+
function dmPairKey(a, b) {
|
|
348
|
+
return [a, b].sort().join("::");
|
|
349
|
+
}
|
|
350
|
+
function requireAppScope(config) {
|
|
351
|
+
const scope = config?.appScope;
|
|
352
|
+
if (!scope) {
|
|
353
|
+
throw new Error("Private messaging requires an app scope (built-app context).");
|
|
354
|
+
}
|
|
355
|
+
return scope;
|
|
356
|
+
}
|
|
357
|
+
async function listThreads(credentials, config) {
|
|
358
|
+
const scope = requireAppScope(config);
|
|
359
|
+
return flowstackFetch(
|
|
360
|
+
`/apps/${encodeURIComponent(scope)}/threads`,
|
|
361
|
+
{ credentials },
|
|
362
|
+
config
|
|
363
|
+
);
|
|
364
|
+
}
|
|
365
|
+
async function listMessages(credentials, withUserKey, options, config) {
|
|
366
|
+
const scope = requireAppScope(config);
|
|
367
|
+
const params = new URLSearchParams();
|
|
368
|
+
params.set("with", withUserKey);
|
|
369
|
+
if (options?.limit) params.set("limit", String(options.limit));
|
|
370
|
+
if (options?.before) params.set("before", options.before);
|
|
371
|
+
return flowstackFetch(
|
|
372
|
+
`/apps/${encodeURIComponent(scope)}/messages?${params.toString()}`,
|
|
373
|
+
{ credentials },
|
|
374
|
+
config
|
|
375
|
+
);
|
|
376
|
+
}
|
|
377
|
+
async function sendMessage(credentials, toUserKey, body, config) {
|
|
378
|
+
const scope = requireAppScope(config);
|
|
379
|
+
return flowstackFetch(
|
|
380
|
+
`/apps/${encodeURIComponent(scope)}/messages`,
|
|
381
|
+
{ method: "POST", credentials, body: { to_user_key: toUserKey, body } },
|
|
382
|
+
config
|
|
383
|
+
);
|
|
384
|
+
}
|
|
385
|
+
async function openThread(credentials, withUserKey, config) {
|
|
386
|
+
const scope = requireAppScope(config);
|
|
387
|
+
const me = credentials.userId;
|
|
388
|
+
if (!me) throw new Error("openThread requires an authenticated user.");
|
|
389
|
+
const pk = dmPairKey(me, withUserKey);
|
|
390
|
+
return flowstackFetch(
|
|
391
|
+
`/apps/${encodeURIComponent(scope)}/threads/${encodeURIComponent(pk)}/consent`,
|
|
392
|
+
{ method: "POST", credentials },
|
|
393
|
+
config
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
async function markMessageRead(credentials, messageId, config) {
|
|
397
|
+
const scope = requireAppScope(config);
|
|
398
|
+
return flowstackFetch(
|
|
399
|
+
`/apps/${encodeURIComponent(scope)}/messages/${encodeURIComponent(messageId)}/read`,
|
|
400
|
+
{ method: "POST", credentials },
|
|
401
|
+
config
|
|
402
|
+
);
|
|
403
|
+
}
|
|
347
404
|
async function invokeTool(credentials, agentName, toolName, kwargs = {}, config) {
|
|
348
405
|
return flowstackFetch(
|
|
349
406
|
"/tool/invoke",
|
|
@@ -6178,6 +6235,124 @@ function useConnections() {
|
|
|
6178
6235
|
}, [credentials, config.baseUrl, config.tenantId, refresh]);
|
|
6179
6236
|
return { connections, isLoading, error, connect, disconnect, refresh };
|
|
6180
6237
|
}
|
|
6238
|
+
function useThreads(options) {
|
|
6239
|
+
const { credentials, config } = useFlowstack();
|
|
6240
|
+
const [threads, setThreads] = react.useState([]);
|
|
6241
|
+
const [isLoading, setIsLoading] = react.useState(false);
|
|
6242
|
+
const [error, setError] = react.useState(null);
|
|
6243
|
+
const enabled = options?.enabled !== false;
|
|
6244
|
+
const clientConfig = {
|
|
6245
|
+
baseUrl: config.baseUrl,
|
|
6246
|
+
tenantId: config.tenantId,
|
|
6247
|
+
appScope: config.appScope
|
|
6248
|
+
};
|
|
6249
|
+
const refresh = react.useCallback(async () => {
|
|
6250
|
+
if (!credentials || !enabled) return;
|
|
6251
|
+
setIsLoading(true);
|
|
6252
|
+
setError(null);
|
|
6253
|
+
try {
|
|
6254
|
+
const res = await listThreads(credentials, clientConfig);
|
|
6255
|
+
if (res.ok && res.data) {
|
|
6256
|
+
setThreads(res.data.threads);
|
|
6257
|
+
} else {
|
|
6258
|
+
setError(res.error || "Failed to load threads");
|
|
6259
|
+
}
|
|
6260
|
+
} catch (err) {
|
|
6261
|
+
setError(err?.message || "Failed to load threads");
|
|
6262
|
+
} finally {
|
|
6263
|
+
setIsLoading(false);
|
|
6264
|
+
}
|
|
6265
|
+
}, [credentials, config.baseUrl, config.tenantId, config.appScope, enabled]);
|
|
6266
|
+
react.useEffect(() => {
|
|
6267
|
+
refresh();
|
|
6268
|
+
}, [refresh]);
|
|
6269
|
+
const intervalRef = react.useRef(null);
|
|
6270
|
+
react.useEffect(() => {
|
|
6271
|
+
if (!options?.refreshInterval || !enabled) return;
|
|
6272
|
+
intervalRef.current = setInterval(refresh, options.refreshInterval);
|
|
6273
|
+
return () => {
|
|
6274
|
+
if (intervalRef.current) clearInterval(intervalRef.current);
|
|
6275
|
+
};
|
|
6276
|
+
}, [options?.refreshInterval, enabled, refresh]);
|
|
6277
|
+
const openThread2 = react.useCallback(
|
|
6278
|
+
async (withUserKey) => {
|
|
6279
|
+
if (!credentials || !withUserKey) return null;
|
|
6280
|
+
const res = await openThread(credentials, withUserKey, clientConfig);
|
|
6281
|
+
if (res.ok && res.data) {
|
|
6282
|
+
await refresh();
|
|
6283
|
+
return res.data.status;
|
|
6284
|
+
}
|
|
6285
|
+
setError(res.error || "Failed to open thread");
|
|
6286
|
+
return null;
|
|
6287
|
+
},
|
|
6288
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6289
|
+
[credentials, config.baseUrl, config.tenantId, config.appScope, refresh]
|
|
6290
|
+
);
|
|
6291
|
+
return { threads, isLoading, error, refresh, openThread: openThread2 };
|
|
6292
|
+
}
|
|
6293
|
+
function useMessages(withUserKey, options) {
|
|
6294
|
+
const { credentials, config } = useFlowstack();
|
|
6295
|
+
const [messages, setMessages] = react.useState([]);
|
|
6296
|
+
const [isLoading, setIsLoading] = react.useState(false);
|
|
6297
|
+
const [error, setError] = react.useState(null);
|
|
6298
|
+
const enabled = options?.enabled !== false && !!withUserKey;
|
|
6299
|
+
const clientConfig = {
|
|
6300
|
+
baseUrl: config.baseUrl,
|
|
6301
|
+
tenantId: config.tenantId,
|
|
6302
|
+
appScope: config.appScope
|
|
6303
|
+
};
|
|
6304
|
+
const refresh = react.useCallback(async () => {
|
|
6305
|
+
if (!credentials || !withUserKey || !enabled) return;
|
|
6306
|
+
setIsLoading(true);
|
|
6307
|
+
setError(null);
|
|
6308
|
+
try {
|
|
6309
|
+
const res = await listMessages(
|
|
6310
|
+
credentials,
|
|
6311
|
+
withUserKey,
|
|
6312
|
+
{ limit: options?.limit },
|
|
6313
|
+
clientConfig
|
|
6314
|
+
);
|
|
6315
|
+
if (res.ok && res.data) {
|
|
6316
|
+
setMessages(res.data.messages);
|
|
6317
|
+
} else {
|
|
6318
|
+
setError(res.error || "Failed to load messages");
|
|
6319
|
+
}
|
|
6320
|
+
} catch (err) {
|
|
6321
|
+
setError(err?.message || "Failed to load messages");
|
|
6322
|
+
} finally {
|
|
6323
|
+
setIsLoading(false);
|
|
6324
|
+
}
|
|
6325
|
+
}, [credentials, withUserKey, config.baseUrl, config.tenantId, config.appScope, enabled, options?.limit]);
|
|
6326
|
+
react.useEffect(() => {
|
|
6327
|
+
refresh();
|
|
6328
|
+
}, [refresh]);
|
|
6329
|
+
const intervalRef = react.useRef(null);
|
|
6330
|
+
react.useEffect(() => {
|
|
6331
|
+
if (!options?.refreshInterval || !enabled) return;
|
|
6332
|
+
intervalRef.current = setInterval(refresh, options.refreshInterval);
|
|
6333
|
+
return () => {
|
|
6334
|
+
if (intervalRef.current) clearInterval(intervalRef.current);
|
|
6335
|
+
};
|
|
6336
|
+
}, [options?.refreshInterval, enabled, refresh]);
|
|
6337
|
+
const send = react.useCallback(
|
|
6338
|
+
async (body) => {
|
|
6339
|
+
if (!credentials) throw new Error("Not authenticated");
|
|
6340
|
+
if (!withUserKey) throw new Error("No counterpart selected");
|
|
6341
|
+
if (!body || !body.trim()) return;
|
|
6342
|
+
setError(null);
|
|
6343
|
+
const res = await sendMessage(credentials, withUserKey, body, clientConfig);
|
|
6344
|
+
if (!res.ok) {
|
|
6345
|
+
const msg = res.error || "Failed to send message";
|
|
6346
|
+
setError(msg);
|
|
6347
|
+
throw new Error(msg);
|
|
6348
|
+
}
|
|
6349
|
+
await refresh();
|
|
6350
|
+
},
|
|
6351
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6352
|
+
[credentials, withUserKey, config.baseUrl, config.tenantId, config.appScope, refresh]
|
|
6353
|
+
);
|
|
6354
|
+
return { messages, isLoading, error, send, refresh };
|
|
6355
|
+
}
|
|
6181
6356
|
function normalizeVersion(raw) {
|
|
6182
6357
|
return {
|
|
6183
6358
|
version: raw.version || 0,
|
|
@@ -10663,6 +10838,7 @@ exports.deleteSite = deleteSite;
|
|
|
10663
10838
|
exports.deleteSiteVersion = deleteSiteVersion;
|
|
10664
10839
|
exports.deleteUser = deleteUser;
|
|
10665
10840
|
exports.deleteUserCollection = deleteUserCollection;
|
|
10841
|
+
exports.dmPairKey = dmPairKey;
|
|
10666
10842
|
exports.executeQuery = executeQuery;
|
|
10667
10843
|
exports.executeQueryWithConfig = executeQueryWithConfig;
|
|
10668
10844
|
exports.exportUserCollection = exportUserCollection;
|
|
@@ -10714,10 +10890,12 @@ exports.listDataSources = listDataSources;
|
|
|
10714
10890
|
exports.listDatasets = listDatasets;
|
|
10715
10891
|
exports.listGitHubRepos = listGitHubRepos;
|
|
10716
10892
|
exports.listLibraryItems = listLibraryItems;
|
|
10893
|
+
exports.listMessages = listMessages;
|
|
10717
10894
|
exports.listModels = listModels;
|
|
10718
10895
|
exports.listReports = listReports;
|
|
10719
10896
|
exports.listScripts = listScripts;
|
|
10720
10897
|
exports.listSites = listSites;
|
|
10898
|
+
exports.listThreads = listThreads;
|
|
10721
10899
|
exports.listUsers = listUsers;
|
|
10722
10900
|
exports.listVisualizations = listVisualizations;
|
|
10723
10901
|
exports.listWorkspaces = listWorkspaces;
|
|
@@ -10725,6 +10903,7 @@ exports.loadCredentials = loadCredentials;
|
|
|
10725
10903
|
exports.loadMessages = loadMessages;
|
|
10726
10904
|
exports.loadSelectedWorkspace = loadSelectedWorkspace;
|
|
10727
10905
|
exports.login = login;
|
|
10906
|
+
exports.markMessageRead = markMessageRead;
|
|
10728
10907
|
exports.marketingTemplate = marketingTemplate;
|
|
10729
10908
|
exports.mockChatHistory = mockChatHistory;
|
|
10730
10909
|
exports.mockCredentials = mockCredentials;
|
|
@@ -10737,6 +10916,7 @@ exports.mockUserActivity = mockUserActivity;
|
|
|
10737
10916
|
exports.mockUserStats = mockUserStats;
|
|
10738
10917
|
exports.mockVisualizations = mockVisualizations;
|
|
10739
10918
|
exports.mockWorkspaces = mockWorkspaces;
|
|
10919
|
+
exports.openThread = openThread;
|
|
10740
10920
|
exports.parseSSELine = parseSSELine;
|
|
10741
10921
|
exports.parseSSEStream = parseSSEStream;
|
|
10742
10922
|
exports.previewPiiMasking = previewPiiMasking;
|
|
@@ -10753,6 +10933,7 @@ exports.sanitizeMermaidCode = sanitizeMermaidCode;
|
|
|
10753
10933
|
exports.saveCredentials = saveCredentials;
|
|
10754
10934
|
exports.saveMessages = saveMessages;
|
|
10755
10935
|
exports.saveSelectedWorkspace = saveSelectedWorkspace;
|
|
10936
|
+
exports.sendMessage = sendMessage;
|
|
10756
10937
|
exports.setCached = setCached;
|
|
10757
10938
|
exports.setCachedDatasets = setCachedDatasets;
|
|
10758
10939
|
exports.setCachedReports = setCachedReports;
|
|
@@ -10793,6 +10974,7 @@ exports.useLibrary = useLibrary;
|
|
|
10793
10974
|
exports.useLibraryConversations = useLibraryConversations;
|
|
10794
10975
|
exports.useLibrarySearch = useLibrarySearch;
|
|
10795
10976
|
exports.useLibraryTrash = useLibraryTrash;
|
|
10977
|
+
exports.useMessages = useMessages;
|
|
10796
10978
|
exports.useModelPreference = useModelPreference;
|
|
10797
10979
|
exports.useModels = useModels;
|
|
10798
10980
|
exports.useOllamaDetection = useOllamaDetection;
|
|
@@ -10805,6 +10987,7 @@ exports.useSiteVersions = useSiteVersions;
|
|
|
10805
10987
|
exports.useSites = useSites;
|
|
10806
10988
|
exports.useSubagentInvoke = useSubagentInvoke;
|
|
10807
10989
|
exports.useSubagents = useSubagents;
|
|
10990
|
+
exports.useThreads = useThreads;
|
|
10808
10991
|
exports.useToolInvocation = useToolInvocation;
|
|
10809
10992
|
exports.useUserCollections = useUserCollections;
|
|
10810
10993
|
exports.useUserManagement = useUserManagement;
|