@superblocksteam/library 2.0.89 → 2.0.90

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.
@@ -2,10 +2,11 @@ import { Callback, ControlType, DataType, DataTypeString, EntityDefinition, Head
2
2
  import { Dim, EditorConfig, EvaluateOrValueComputedArgs, Property, TailwindPropertyKey } from "@superblocksteam/library-shared";
3
3
  import { DataRouter, Location, Params } from "react-router";
4
4
  import * as React$2 from "react";
5
- import React$1, { LegacyRef, ReactNode } from "react";
5
+ import React$1, { LegacyRef, ReactNode, createElement } from "react";
6
6
  import { OrchestratorViewMode, PlaceholderInfo, Profile } from "@superblocksteam/shared";
7
7
  import { AiContextMode, AppToEditorMessage, Catalog, CatalogWithInternalDetails, ComponentRegistryShareState, ConsoleLogEntry, CreateChild, CreateChild as CreateChild$1, CreateRequest, DeleteMeLibraryApi, DeleteRequest, EditOperationPayload, EditOperationType, EditOperations, EditorConfig as EditorConfig$1, Entity, EntityOutputProp, InitData, InteractionMode, PayloadAction, PropertyInfo, ReparentRequest, RuntimeErrorData, RuntimeSyncComposite, SbApiRunOptions, SbElement, SbSelector, SetPropertiesRequest, SetPropertyRequest, SourceLocation, TransactionInfo, UrlState, ViteMessage, ViteMessageKind, WithBindingIdentifier } from "@superblocksteam/library-shared/types";
8
8
  import * as react_jsx_runtime0 from "react/jsx-runtime";
9
+ import { CompiledApi, CompiledStreamingApi } from "@superblocksteam/sdk-api";
9
10
  import { Graph } from "@dagrejs/graphlib";
10
11
  import { XYCoord } from "react-dnd";
11
12
 
@@ -31,18 +32,20 @@ type Group = {
31
32
  name: string;
32
33
  size: number;
33
34
  };
34
- type Profiles = {
35
+ type DataTags = {
35
36
  available: Profile[];
36
37
  selected?: Profile;
37
38
  default: Profile;
38
39
  };
40
+ /** @deprecated Use DataTags instead */
41
+ type Profiles = DataTags;
39
42
  declare class SuperblocksAppContext {
40
43
  private context?;
41
44
  constructor();
42
45
  get user(): User | undefined;
43
46
  get groups(): Group[] | undefined;
44
47
  get selectedProfile(): Profile | undefined;
45
- get profiles(): Profiles | undefined;
48
+ get profiles(): DataTags | undefined;
46
49
  setProfile(profileKey: string): void;
47
50
  updateContext(context: Partial<SuperblocksAppContext>): void;
48
51
  getGlobal(): {
@@ -59,9 +62,14 @@ declare class SuperblocksAppContext {
59
62
  }
60
63
  declare function useSuperblocksUser(): User | undefined;
61
64
  declare function useSuperblocksGroups(): Group[] | undefined;
65
+ declare function useSuperblocksDataTags(): {
66
+ dataTags: DataTags | undefined;
67
+ setDataTag: (dataTagKey: string) => void;
68
+ };
69
+ /** @deprecated Use useSuperblocksDataTags instead */
62
70
  declare function useSuperblocksProfiles(): {
63
- profiles: Profiles | undefined;
64
- setProfile: (profileKey: string) => void;
71
+ profiles: DataTags | undefined;
72
+ setProfile: (dataTagKey: string) => void;
65
73
  };
66
74
  declare function getAppMode(): AppMode | undefined;
67
75
  //#endregion
@@ -130,6 +138,45 @@ interface StreamEvent {
130
138
  };
131
139
  }
132
140
  type RouteInfo = Omit<UrlState, "host" | "hostname" | "href" | "port" | "protocol">;
141
+ /**
142
+ * Schema representation for SDK API input/output/chunk schemas.
143
+ * Contains both TypeScript and JSON Schema formats for display in the UI.
144
+ */
145
+ interface SdkApiSchemaInfo {
146
+ /** TypeScript type string representation, e.g., "{ userId: string; limit?: number }" */
147
+ typescript: string;
148
+ /** JSON Schema representation for the schema */
149
+ jsonSchema: object;
150
+ }
151
+ /**
152
+ * Metadata for an SDK API, sent from the library to ui-code-mode
153
+ * when an SDK API is registered.
154
+ */
155
+ interface SdkApiMetadata {
156
+ /** Unique name of the API */
157
+ name: string;
158
+ /** Input schema information */
159
+ inputSchema: SdkApiSchemaInfo;
160
+ /** Output schema information (for non-streaming APIs) */
161
+ outputSchema?: SdkApiSchemaInfo;
162
+ /** Chunk schema information (for streaming APIs) */
163
+ chunkSchema?: SdkApiSchemaInfo;
164
+ /** Whether this is a streaming API */
165
+ isStreaming: boolean;
166
+ /** Declared integrations for this API */
167
+ integrations: Array<{
168
+ /** Key used in the API code to reference this integration */
169
+ key: string;
170
+ /** Plugin ID (e.g., "postgres", "slack") */
171
+ pluginId: string;
172
+ /** Integration name (e.g., "Production Postgres") */
173
+ name: string;
174
+ /** Integration ID (UUID) */
175
+ id: string;
176
+ }>;
177
+ /** TypeScript source code of the API */
178
+ sourceCode?: string;
179
+ }
133
180
  type RouteChangePayload = Omit<UrlState, "host" | "hostname" | "href" | "pathname" | "port" | "protocol">;
134
181
  type AiUpdatesPayload = {
135
182
  parentToChild: {
@@ -184,6 +231,11 @@ type AgentInfo = {
184
231
  };
185
232
  type FromParentToChildMessageTypesMap = {
186
233
  "sb-init": InitData;
234
+ "sdk-execute-api-internal": {
235
+ apiName: string;
236
+ input: Record<string, unknown>;
237
+ callbackId: string;
238
+ };
187
239
  "sb-bootstrap-response": {
188
240
  userId?: string;
189
241
  appId: string;
@@ -238,7 +290,17 @@ type FromParentToChildMessageTypesMap = {
238
290
  "canvas-scale-update": {
239
291
  canvasScaleFactor: number;
240
292
  };
293
+ /**
294
+ * Resolve a promise created by addNewPromise.
295
+ * Note: callbackId must be at the top level, not nested in payload.
296
+ * Payload contains the resolution value.
297
+ */
241
298
  "resolve-promise": unknown;
299
+ /**
300
+ * Reject a promise created by addNewPromise.
301
+ * Note: callbackId must be at the top level, not nested in payload.
302
+ * Payload contains the error object.
303
+ */
242
304
  "reject-promise": unknown;
243
305
  "flash-element": {
244
306
  elementId: string;
@@ -332,6 +394,35 @@ type FromParentToChildMessageTypesMap = {
332
394
  callbackId: string;
333
395
  sourceIds: string[];
334
396
  };
397
+ /**
398
+ * Execute an SDK-based API by name in the iframe.
399
+ * The parent (ui-code-mode) sends this to the library iframe to execute the API.
400
+ */
401
+ "sdk-execute-api": {
402
+ apiName: string;
403
+ input: Record<string, unknown>;
404
+ callbackId: string;
405
+ };
406
+ /**
407
+ * Send a chunk from a streaming query back to the library.
408
+ * Used during SDK streaming API execution.
409
+ */
410
+ "sdk-stream-chunk": {
411
+ streamId: string;
412
+ chunk?: unknown;
413
+ done?: boolean;
414
+ error?: {
415
+ code: string;
416
+ message: string;
417
+ };
418
+ };
419
+ /**
420
+ * Request the TypeScript source code for an SDK API.
421
+ */
422
+ "sdk-get-api-code": {
423
+ name: string;
424
+ callbackId: string;
425
+ };
335
426
  };
336
427
  type FromParentToChildMessageTypes = keyof FromParentToChildMessageTypesMap;
337
428
  type FromChildToParentMessageTypesMap = {
@@ -350,7 +441,17 @@ type FromChildToParentMessageTypesMap = {
350
441
  newWindow?: boolean;
351
442
  };
352
443
  "sb-iframe-track-changes": Record<string, unknown>;
444
+ /**
445
+ * Resolve a promise created by addNewPromise.
446
+ * Note: callbackId must be at the top level, not nested in payload.
447
+ * Payload contains the resolution value.
448
+ */
353
449
  "resolve-promise": unknown;
450
+ /**
451
+ * Reject a promise created by addNewPromise.
452
+ * Note: callbackId must be at the top level, not nested in payload.
453
+ * Payload contains the error object.
454
+ */
354
455
  "reject-promise": unknown;
355
456
  "sb-editor-request-bootstrap": void;
356
457
  "reload-configs": void;
@@ -407,6 +508,63 @@ type FromChildToParentMessageTypesMap = {
407
508
  apiId: string;
408
509
  callbackId: string;
409
510
  };
511
+ /**
512
+ * Execute an integration query as part of SDK API execution.
513
+ * The parent (ui-code-mode) will dispatch executeRequestToIntegration
514
+ * and resolve the promise with the result.
515
+ *
516
+ * For language plugins (Python, JavaScript), the input parameter contains
517
+ * bindings that should be passed to the API execution request for {{}} resolution.
518
+ */
519
+ "sdk-execute-query": {
520
+ integrationId: string;
521
+ request: Record<string, unknown>;
522
+ input?: Record<string, unknown>;
523
+ callbackId: string;
524
+ };
525
+ /**
526
+ * Execute an SDK-based API by name.
527
+ * The parent (ui-code-mode) will load the API, validate inputs,
528
+ * and execute it with the provided input.
529
+ *
530
+ * This message is sent from the library iframe to request API execution.
531
+ */
532
+ "sdk-execute-api": {
533
+ apiName: string;
534
+ input: Record<string, unknown>;
535
+ callbackId: string;
536
+ };
537
+ /**
538
+ * Resolve integration configs before SDK API execution.
539
+ * The parent (ui-code-mode) will look up each integration by ID,
540
+ * ensure it's authenticated, and return the resolved configs.
541
+ *
542
+ * This enables upfront auth checks before API execution starts.
543
+ */
544
+ "sdk-resolve-integrations": {
545
+ integrations: Array<{
546
+ key: string;
547
+ pluginId: string;
548
+ id: string;
549
+ }>;
550
+ callbackId: string;
551
+ };
552
+ /**
553
+ * Execute a streaming integration query as part of SDK streaming API execution.
554
+ * The parent (ui-code-mode) will dispatch streaming execution and send
555
+ * chunks back via sdk-stream-chunk messages.
556
+ */
557
+ "sdk-execute-streaming-query": {
558
+ integrationId: string;
559
+ request: Record<string, unknown>;
560
+ streamId: string;
561
+ };
562
+ /**
563
+ * Cancel an in-progress streaming query.
564
+ */
565
+ "sdk-cancel-stream": {
566
+ streamId: string;
567
+ };
410
568
  "set-apis-deployed-mode": {
411
569
  apis: Array<DeleteMeLibraryApi & {
412
570
  scopeId: string;
@@ -462,6 +620,67 @@ type FromChildToParentMessageTypesMap = {
462
620
  eventName: string;
463
621
  payload: Record<string, unknown>;
464
622
  };
623
+ /**
624
+ * Notify the parent when an SDK API is registered (loaded).
625
+ * Contains metadata including input/output schemas for display in the UI.
626
+ */
627
+ "sdk-api-registered": {
628
+ name: string;
629
+ metadata: SdkApiMetadata;
630
+ };
631
+ /**
632
+ * Notify the parent when an SDK API is unregistered (HMR unload).
633
+ */
634
+ "sdk-api-unregistered": {
635
+ name: string;
636
+ };
637
+ /**
638
+ * Notify the parent when an SDK API's source code has been updated.
639
+ * Used for HMR to update the code viewer without full re-registration.
640
+ */
641
+ "sdk-api-source-updated": {
642
+ name: string;
643
+ sourceCode: string;
644
+ };
645
+ /**
646
+ * Response to sdk-get-api-code request with the TypeScript source code.
647
+ */
648
+ "sdk-api-code-response": {
649
+ callbackId: string;
650
+ name: string;
651
+ code?: string;
652
+ error?: string;
653
+ };
654
+ /**
655
+ * Notify the parent when an SDK API execution starts (from app code).
656
+ * Used for tracking executions in the SDK API editor's execution log.
657
+ */
658
+ "sdk-api-execution-started": {
659
+ executionId: string;
660
+ apiName: string;
661
+ input: Record<string, unknown>;
662
+ };
663
+ /**
664
+ * Notify the parent when an SDK API execution completes successfully.
665
+ */
666
+ "sdk-api-execution-completed": {
667
+ executionId: string;
668
+ apiName: string;
669
+ output: unknown;
670
+ durationMs: number;
671
+ };
672
+ /**
673
+ * Notify the parent when an SDK API execution fails.
674
+ */
675
+ "sdk-api-execution-failed": {
676
+ executionId: string;
677
+ apiName: string;
678
+ error: {
679
+ code: string;
680
+ message: string;
681
+ };
682
+ durationMs: number;
683
+ };
465
684
  } & AppToEditorMessage<PropertiesPanelDefinition$1>;
466
685
  type FromChildToParentMessageTypes = keyof FromChildToParentMessageTypesMap;
467
686
  //#endregion
@@ -893,6 +1112,22 @@ declare class EditStore {
893
1112
  }
894
1113
  //#endregion
895
1114
  //#region src/lib/internal-details/lib/root-store.d.ts
1115
+ /**
1116
+ * User information extracted from JWT for SDK API execution.
1117
+ * Matches the ApiUser interface from @superblocksteam/sdk-api.
1118
+ */
1119
+ interface SdkApiUser {
1120
+ /** Unique user identifier from JWT */
1121
+ readonly userId: string;
1122
+ /** User's email address (if available) */
1123
+ readonly email?: string;
1124
+ /** User's display name (if available) */
1125
+ readonly name?: string;
1126
+ /** User's group memberships from JWT */
1127
+ readonly groups: string[];
1128
+ /** Custom claims from JWT */
1129
+ readonly customClaims: Readonly<Record<string, unknown>>;
1130
+ }
896
1131
  declare class RootStore {
897
1132
  apis: ApiManager;
898
1133
  componentRegistry: ComponentRegistry;
@@ -902,8 +1137,29 @@ declare class RootStore {
902
1137
  applicationId: string | undefined;
903
1138
  userId: string | undefined;
904
1139
  windowOriginUrl: string | undefined;
1140
+ /**
1141
+ * Current user info for SDK API execution.
1142
+ * Populated from JWT claims when available.
1143
+ */
1144
+ sdkUser: SdkApiUser;
1145
+ /**
1146
+ * Whether the SDK API feature is enabled.
1147
+ * Derived from the application's templateName (see `isSdkApiTemplate()`).
1148
+ * Passed to the library via the `clark.sdk-api.enabled` bootstrap flag.
1149
+ * When false, the YAML-based API system is used instead.
1150
+ */
1151
+ sdkApiEnabled: boolean;
905
1152
  private editorRegisteredCallbacks;
906
1153
  constructor();
1154
+ /**
1155
+ * Updates the SDK user info from JWT claims or bootstrap data.
1156
+ */
1157
+ setSdkUser(user: Partial<SdkApiUser>): void;
1158
+ /**
1159
+ * Sets the SDK API feature flag state.
1160
+ * Called during bootstrap with the value from feature flags.
1161
+ */
1162
+ setSdkApiEnabled(enabled: boolean): void;
907
1163
  setEditStore(editStore: EditStore): void;
908
1164
  notifyEditorRegistered(): void;
909
1165
  onEditorRegistered(fn: () => void): void;
@@ -1383,51 +1639,168 @@ type ApiInterfaces<Name extends string> = Name extends keyof SuperblocksAPIRegis
1383
1639
  output: never;
1384
1640
  };
1385
1641
  /**
1386
- * React hook for executing Superblocks APIs with type-safe inputs and outputs.
1642
+ * Get the API path for an API by name.
1387
1643
  *
1388
- * @param name - The name of the registered API to execute
1389
- * @returns An object with `run` and `cancel` functions
1644
+ * When SDK APIs are enabled, paths point to `/server/apis/<name>/api.ts`.
1645
+ * When using legacy YAML mode, paths point to `/apis/<name>/api.yaml`.
1646
+ */
1647
+
1648
+ /** Helper type to extract input type from a CompiledApi */
1649
+ type ApiInput<T> = T extends CompiledApi<infer TInput, any> ? TInput : never;
1650
+ /** Helper type to extract output type from a CompiledApi */
1651
+ type ApiOutput<T> = T extends CompiledApi<any, infer TOutput> ? TOutput : never;
1652
+ /** Return type for useApi hook */
1653
+ interface UseApiResult<TInput, TOutput> {
1654
+ run: (inputs: TInput) => Promise<TOutput | undefined>;
1655
+ cancel: () => Promise<void>;
1656
+ }
1657
+ /**
1658
+ * API Registry interface for type inference.
1659
+ *
1660
+ * This interface is used with useTypedApi to enable automatic type inference.
1661
+ * Apps define their own ApiRegistry type and pass it to useTypedApi.
1390
1662
  *
1391
1663
  * @example
1392
1664
  * ```typescript
1393
- * const myApi = useApiStateful("getUserData");
1665
+ * // In server/apis/index.ts
1666
+ * const apis = { GetUsers, CreateOrder } as const;
1667
+ * export type ApiRegistry = typeof apis;
1394
1668
  *
1395
- * try {
1396
- * const result = await myApi.run({ userId: "123" });
1397
- * console.log(result);
1398
- * } catch (error) {
1399
- * // error is a string describing what went wrong
1400
- * console.error(error);
1401
- * }
1669
+ * // In client/hooks/useApi.ts
1670
+ * import type { ApiRegistry } from "../../server/apis/index.js";
1671
+ * import { useTypedApi } from "@superblocksteam/library";
1672
+ * export const useApi = useTypedApi<ApiRegistry>();
1402
1673
  * ```
1674
+ */
1675
+ interface ApiRegistry {}
1676
+ /**
1677
+ * Conditional return type for useApi.
1678
+ * Returns typed result if the API name is in the registry, otherwise unknown.
1679
+ */
1680
+ type UseApiReturnType<TName extends string> = TName extends keyof ApiRegistry ? UseApiResult<ApiInput<ApiRegistry[TName]>, ApiOutput<ApiRegistry[TName]>> : UseApiResult<unknown, unknown>;
1681
+ /**
1682
+ * React hook for executing YAML-based Superblocks APIs.
1683
+ *
1684
+ * This is the legacy API system that uses `rootStore.apis.runApiByPath`.
1685
+ * It remains the default when the `sdkApiEnabled` flag is off.
1686
+ *
1687
+ * @param name - The name of the registered API to execute
1688
+ * @returns An object with `run` and `cancel` functions
1689
+ */
1690
+ declare function useApiStateful<Name extends RegisteredAPINames, Inputs = ApiInterfaces<Name>["input"], Response = ApiInterfaces<Name>["output"]>(name: Name): {
1691
+ run: (inputs?: Inputs) => Promise<Response | undefined>;
1692
+ cancel: () => Promise<void>;
1693
+ };
1694
+ /**
1695
+ * React hook for calling APIs with automatic type inference.
1403
1696
  *
1404
- * ## Error Handling
1697
+ * When the SDK API feature flag (`clark.sdk-api.enabled`) is on, this sends
1698
+ * a message to the parent frame which loads and executes the SDK-based API.
1405
1699
  *
1406
- * When an API execution fails, the `run` function throws a **string** error message.
1407
- * The error format can be one of:
1700
+ * When the flag is off, this delegates to the legacy YAML-based API system
1701
+ * which uses `rootStore.apis.runApiByPath`.
1408
1702
  *
1409
- * - **Client errors (4xx)**: System error message from the server
1410
- * - Example: `"Authentication failed"`, `"Invalid request parameters"`
1703
+ * The flag is set once at bootstrap time and never changes within a session,
1704
+ * so the conditional delegation is safe.
1411
1705
  *
1412
- * - **API execution errors**: Formatted message from unhandled API errors
1413
- * - Example: `"Error in API: Division by zero"`, `"Error in API: Database connection failed"`
1706
+ * @param apiName - The name of the API to execute (e.g., "GetUsers")
1707
+ * @returns Object with `run` function and `cancel` function
1708
+ */
1709
+ declare function useApi<TName extends string>(apiName: TName): UseApiReturnType<TName>;
1710
+ declare function useApi<TApi extends CompiledApi<unknown, unknown>>(apiName: string): UseApiResult<ApiInput<TApi>, ApiOutput<TApi>>;
1711
+ /**
1712
+ * Type for a registry of compiled APIs.
1713
+ * Used with useTypedApi to enable automatic type inference.
1714
+ */
1715
+ type AnyApiRegistry = Record<string, CompiledApi<any, any>>;
1716
+ /**
1717
+ * Typed useApi function signature for a specific registry.
1718
+ */
1719
+ type TypedUseApi<TRegistry extends AnyApiRegistry> = <TName extends keyof TRegistry & string>(apiName: TName) => UseApiResult<ApiInput<TRegistry[TName]>, ApiOutput<TRegistry[TName]>>;
1720
+ /**
1721
+ * Creates a typed version of useApi bound to a specific API registry type.
1414
1722
  *
1415
- * - **Infrastructure errors**: High-level error messages
1416
- * - Example: `"No application ID was found"`, `"No active agent found"`
1723
+ * This enables full type inference using only type imports from the server,
1724
+ * keeping backend code out of the client bundle.
1417
1725
  *
1418
- * The error is also logged to the console before being thrown.
1726
+ * @returns A typed useApi function
1727
+ */
1728
+ declare function useTypedApi<TRegistry extends AnyApiRegistry>(): TypedUseApi<TRegistry>;
1729
+ //#endregion
1730
+ //#region src/lib/internal-details/use-streaming-api.d.ts
1731
+ /**
1732
+ * React hook for calling streaming SDK APIs with real-time chunk delivery.
1733
+ *
1734
+ * Returns an AsyncGenerator that yields chunks as they arrive, allowing
1735
+ * natural iteration with `for await...of`.
1736
+ *
1737
+ * @param api - The imported CompiledStreamingApi definition
1738
+ * @returns Object with `stream` function and `cancel` function
1419
1739
  *
1420
- * ## Usage Notes
1740
+ * @example
1741
+ * ```typescript
1742
+ * import StreamChatApi from "../apis/StreamChat/api";
1743
+ * import { useStreamingApi } from "@superblocksteam/library";
1744
+ *
1745
+ * const { stream, cancel } = useStreamingApi(StreamChatApi);
1421
1746
  *
1422
- * - Always wrap `run()` calls in try/catch blocks to handle errors gracefully
1423
- * - Errors are thrown as strings, not Error objects
1424
- * - If the API executes successfully but returns no data, `run()` returns `undefined`
1425
- * - Use `cancel()` to abort in-flight API requests
1747
+ * // Execute and iterate over chunks
1748
+ * const generator = stream({ prompt: "Hello!" });
1749
+ *
1750
+ * for await (const chunk of generator) {
1751
+ * console.log(chunk.text);
1752
+ * // Update UI with each chunk
1753
+ * }
1754
+ * ```
1755
+ *
1756
+ * @example With try/catch for error handling
1757
+ * ```typescript
1758
+ * const { stream } = useStreamingApi(StreamChatApi);
1759
+ *
1760
+ * try {
1761
+ * for await (const chunk of stream({ prompt: "Hello!" })) {
1762
+ * appendToOutput(chunk.text);
1763
+ * }
1764
+ * console.log("Stream completed!");
1765
+ * } catch (error) {
1766
+ * console.error("Stream error:", error);
1767
+ * }
1768
+ * ```
1426
1769
  */
1427
- declare function useApiStateful<Name extends RegisteredAPINames, Inputs = ApiInterfaces<Name>["input"], Response = ApiInterfaces<Name>["output"]>(name: Name): {
1428
- run: (inputs?: Inputs) => Promise<Response | undefined>;
1429
- cancel: () => Promise<void>;
1770
+ declare function useStreamingApi<TInput, TChunk>(api: CompiledStreamingApi<TInput, TChunk>): {
1771
+ stream: (inputs: TInput) => AsyncGenerator<TChunk, void, undefined>;
1772
+ cancel: () => void;
1430
1773
  };
1774
+ /**
1775
+ * @deprecated Use the new AsyncGenerator-based API instead.
1776
+ * Callback options for streaming API execution.
1777
+ */
1778
+ interface StreamingCallbacks<TChunk> {
1779
+ /** Called for each chunk as it arrives */
1780
+ onChunk?: (chunk: TChunk, index: number) => void;
1781
+ /** Called when streaming completes successfully */
1782
+ onComplete?: (totalChunks: number) => void;
1783
+ /** Called if an error occurs during streaming */
1784
+ onError?: (error: {
1785
+ code: string;
1786
+ message: string;
1787
+ }) => void;
1788
+ }
1789
+ /**
1790
+ * @deprecated Use the new AsyncGenerator-based API instead.
1791
+ * Result of a streaming API execution.
1792
+ */
1793
+ interface StreamingResult {
1794
+ /** Whether the streaming completed successfully */
1795
+ success: boolean;
1796
+ /** Total number of chunks received */
1797
+ totalChunks: number;
1798
+ /** Error details if success is false */
1799
+ error?: {
1800
+ code: string;
1801
+ message: string;
1802
+ };
1803
+ }
1431
1804
  //#endregion
1432
1805
  //#region src/lib/user-facing/global-functions.d.ts
1433
1806
  declare function logoutIntegrations(): Promise<void>;
@@ -1609,5 +1982,5 @@ declare function useEmbedEvent(eventName: string, handler: (payload: Record<stri
1609
1982
  */
1610
1983
  declare function useEmitEmbedEvent(): (eventName: string, payload?: Record<string, unknown>) => void;
1611
1984
  //#endregion
1612
- export { type AgentInfo, App, type CreateChild, type CreationContext, type EditorConfig, type EditorTemplate, type FromChildToParentMessageTypes, type FromChildToParentMessageTypesMap, type FromParentToChildMessageTypes, type FromParentToChildMessageTypesMap, PageNotFound, Prop, type PropertiesPanelDefinition, Property, PropsCategory, RouteLoadError, Section, Superblocks, SbProvider as SuperblocksProvider, embedStore, getAppMode, logoutIntegrations, registerComponent, tailwindStylesCategory, useApiStateful as useApi, useEmbedEvent, useEmbedProperties, useEmitEmbedEvent, useSuperblocksGroups, useSuperblocksProfiles, useSuperblocksUser };
1985
+ export { type AgentInfo, type AnyApiRegistry, type ApiInput, type ApiOutput, type ApiRegistry, App, type CreateChild, type CreationContext, type EditorConfig, type EditorTemplate, type FromChildToParentMessageTypes, type FromChildToParentMessageTypesMap, type FromParentToChildMessageTypes, type FromParentToChildMessageTypesMap, PageNotFound, Prop, type PropertiesPanelDefinition, Property, PropsCategory, RouteLoadError, Section, type StreamingCallbacks, type StreamingResult, Superblocks, SbProvider as SuperblocksProvider, type TypedUseApi, type UseApiResult, type UseApiReturnType, createElement, embedStore, getAppMode, logoutIntegrations, registerComponent, tailwindStylesCategory, useApi, useApiStateful, useEmbedEvent, useEmbedProperties, useEmitEmbedEvent, useStreamingApi, useSuperblocksDataTags, useSuperblocksGroups, useSuperblocksProfiles, useSuperblocksUser, useTypedApi };
1613
1986
  //# sourceMappingURL=index.d.ts.map