flowstack-sdk 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.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, 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';
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-B80bPIPw.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-B80bPIPw.js';
5
5
  export { h as AppAccessStatus, A as AppPaywallProps, e as UseAppAccessReturn } from './types-BmCPwbGH.js';
6
6
 
7
7
  /**
package/dist/index.js CHANGED
@@ -276,7 +276,25 @@ async function executeQueryWithConfig(credentials, query, workspaceId, options,
276
276
  })
277
277
  });
278
278
  if (!response.ok) {
279
- throw new Error(`Query failed: ${response.statusText}`);
279
+ let message = response.statusText || "request failed";
280
+ let code;
281
+ let body;
282
+ try {
283
+ body = await response.clone().json();
284
+ const payload = body && typeof body === "object" && "detail" in body && typeof body.detail === "object" ? body.detail : body;
285
+ if (payload && typeof payload === "object") {
286
+ code = payload.code;
287
+ message = payload.error || payload.message || payload.detail || message;
288
+ } else if (typeof payload === "string") {
289
+ message = payload;
290
+ }
291
+ } catch {
292
+ }
293
+ const err = new Error(`Query failed: ${message}`);
294
+ err.status = response.status;
295
+ err.code = code;
296
+ err.body = body;
297
+ throw err;
280
298
  }
281
299
  return response;
282
300
  }
@@ -2992,6 +3010,11 @@ function normalizeEventType(type) {
2992
3010
  "progress": "progress",
2993
3011
  "step": "progress",
2994
3012
  // Step-based progress alias
3013
+ // Build pipeline stage markers (harness emits {type:"stage", name:"plan"|…}).
3014
+ // Without this they fell through to 'content' and were dropped, so the build
3015
+ // UI's stage bar never advanced. useAgent's `case 'stage'` maps them to the
3016
+ // running tool call's agentResponse as `[<tool>] stage: <name>`.
3017
+ "stage": "stage",
2995
3018
  // Billing
2996
3019
  "credit_status": "credit_status",
2997
3020
  "credits": "credit_status",
@@ -4005,6 +4028,39 @@ ${prompt}`;
4005
4028
  }
4006
4029
  }
4007
4030
  break;
4031
+ // ── BUILD PIPELINE STAGE MARKERS ─────────────────────────────
4032
+ // The build harness emits {type:"stage", name:"plan"|"style"|
4033
+ // "build"|"verify"|"publish"} as the app progresses. Surface each
4034
+ // as a `[<tool>] stage: <name>` line on the running build tool's
4035
+ // agentResponse so the Casino build UI's stage bar can advance.
4036
+ // Without this these events fell through to 'content' and were
4037
+ // dropped, leaving the bar stuck on "Building…".
4038
+ // (normalizeEvent maps the event's `name` field onto `tool`.)
4039
+ case "stage": {
4040
+ const stageName = event.tool || event.data?.name;
4041
+ if (stageName && currentToolCalls.length > 0) {
4042
+ let idx = -1;
4043
+ for (let i = currentToolCalls.length - 1; i >= 0; i--) {
4044
+ if (currentToolCalls[i].status === "running") {
4045
+ idx = i;
4046
+ break;
4047
+ }
4048
+ }
4049
+ if (idx >= 0) {
4050
+ const marker = `[${currentToolCalls[idx].name}] stage: ${stageName}`;
4051
+ const prev = currentToolCalls[idx].agentResponse || "";
4052
+ if (!prev.endsWith(marker)) {
4053
+ currentToolCalls[idx] = {
4054
+ ...currentToolCalls[idx],
4055
+ agentResponse: prev + (prev.length > 0 ? "\n" : "") + marker
4056
+ };
4057
+ setToolCalls([...currentToolCalls]);
4058
+ updateMessage(assistantId, { toolCalls: [...currentToolCalls] });
4059
+ }
4060
+ }
4061
+ }
4062
+ break;
4063
+ }
4008
4064
  // ── VISUALIZATIONS ─────────────────────────────────────────
4009
4065
  case "visualization":
4010
4066
  if (event.data) {
@@ -7097,7 +7153,7 @@ function useAutomations() {
7097
7153
  return;
7098
7154
  }
7099
7155
  const data = await res.json();
7100
- setAutomations(data.automations ?? []);
7156
+ setAutomations(Array.isArray(data) ? data : data.automations ?? []);
7101
7157
  } catch (e) {
7102
7158
  setError(e.message || "Failed to load automations");
7103
7159
  } finally {
@@ -7196,7 +7252,7 @@ function useAutomations() {
7196
7252
  const res = await fetch(url, { headers: headers() });
7197
7253
  if (!res.ok) return [];
7198
7254
  const data = await res.json();
7199
- return data.runs ?? [];
7255
+ return Array.isArray(data) ? data : data.runs ?? [];
7200
7256
  } catch {
7201
7257
  return [];
7202
7258
  }
@@ -8742,7 +8798,11 @@ function MermaidDiagram({ code }) {
8742
8798
  let cancelled = false;
8743
8799
  async function render() {
8744
8800
  try {
8745
- const mermaid = (await import('mermaid')).default;
8801
+ const mermaidPkg = "mermaid";
8802
+ const mermaid = (await import(
8803
+ /* @vite-ignore */
8804
+ mermaidPkg
8805
+ )).default;
8746
8806
  if (!mermaidInitialized) {
8747
8807
  mermaid.initialize({
8748
8808
  startOnLoad: false,