@supernova-studio/supernova-sdk-beta 2.1.3 → 2.2.1

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.
@@ -88,7 +88,6 @@ export declare class Supernova {
88
88
  requestHook?: DataBridgeRequestHook;
89
89
  customFetchLib?: any;
90
90
  customProxyLib?: any;
91
- proxyUrl?: string;
92
91
  isPreview?: boolean;
93
92
  jobId?: string;
94
93
  });
@@ -1,5 +1,12 @@
1
1
  import { DataCore } from "../data/SDKDataCore";
2
2
  import { RemoteWorkspaceVersionIdentifier } from "./SDKRemoteIdentifiers";
3
+ export declare enum AIGetRouteQueryTask {
4
+ answer = "answer",
5
+ answerWithStream = "answerWithStream",
6
+ autocomplete = "autocomplete",
7
+ reindex = "reindex",
8
+ summarize = "summarize"
9
+ }
3
10
  export declare class AreaAI {
4
11
  /** Internal: Engine */
5
12
  private dataCore;
@@ -17,14 +24,19 @@ export declare class AreaAI {
17
24
  }): Promise<string>;
18
25
  /** Autocompletes a prompt into a full text. Response is not streamed.
19
26
  * @param from - Version identifier
20
- * @param text - Text to autocomplete
27
+ * @param textToComplete - Text to autocomplete
21
28
  * @param options - Autocomplete options
22
29
  * @returns Autocompleted text
23
30
  * @disclaimer This method will throw if the user is not authorized to use AI features (if you are reading this, you are not authorized).
24
31
  */
25
- autocompleteText(from: RemoteWorkspaceVersionIdentifier, text: string, options?: {
32
+ autocompleteText(from: RemoteWorkspaceVersionIdentifier, textToComplete: string, options?: {
26
33
  maximumLength: number;
27
- }): Promise<string>;
34
+ previousText?: string;
35
+ afterText?: string;
36
+ }): Promise<{
37
+ completion: string;
38
+ fullText: string;
39
+ }>;
28
40
  /** Answers question based on the data of design system in natural language. This method is non-streaming.
29
41
  * @param from - Version identifier
30
42
  * @param prompt - Question to answer
@@ -48,11 +60,16 @@ export declare class AreaAI {
48
60
  persona: "designer" | "developer";
49
61
  scope: "all" | "tokens" | "components" | "assets" | "docs";
50
62
  density: "compact" | "full";
51
- }): Promise<ReadableStream<Uint8Array>>;
63
+ }): Promise<ReadableStreamDefaultReader<Uint8Array>>;
52
64
  /** Indexes or reindexes a design system to prepare it for QA engine
53
65
  * @param from - Version identifier
54
66
  * @returns Indexing status
55
67
  * @disclaimer This method will throw if the user is not authorized to use AI features (if you are reading this, you are not authorized).
56
68
  */
57
- rebuildAnswerIndex(from: RemoteWorkspaceVersionIdentifier): Promise<string>;
69
+ rebuildAnswerIndex(from: RemoteWorkspaceVersionIdentifier): Promise<void>;
70
+ /** Temp: Retrieves dynamic URL for all AI tasks
71
+ * @param task - Which task to retrieve URL for
72
+ * @returns Url for the task
73
+ */
74
+ executableTaskUrl(task: AIGetRouteQueryTask): Promise<string>;
58
75
  }
@@ -1,9 +1,8 @@
1
1
  import { DataCore } from "../data/SDKDataCore";
2
- import { RequestInfo, RequestInit, Response } from "node-fetch";
3
2
  export declare class AreaNetwork {
4
3
  /** Internal: Engine */
5
4
  private dataCore;
6
5
  constructor(dataCore: DataCore);
7
- /** Fires network request using node-fetch library */
6
+ /** Fires network request using either node-fetch or native fetch if available inside the environment sdk runs in */
8
7
  fetch(url: RequestInfo, init?: RequestInit): Promise<Response>;
9
8
  }
@@ -43,15 +43,20 @@ export declare class DataBridge {
43
43
  constructor(conf: DataBridgeConfiguration);
44
44
  delete(endpoint: string): Promise<any>;
45
45
  get(endpoint: string): Promise<any>;
46
+ getStreamed(endpoint: string): Promise<ReadableStreamDefaultReader<Uint8Array>>;
46
47
  getAsData(endpoint: string): Promise<any>;
47
48
  put(endpoint: string, payload: any | null): Promise<any>;
48
49
  post(endpoint: string, payload: any | null): Promise<any>;
50
+ postStreamed(endpoint: string, payload: any | null): Promise<ReadableStreamDefaultReader<Uint8Array>>;
49
51
  upload(endpoint: string, formData: FormData, method?: "PUT" | "POST"): Promise<any>;
50
52
  private request;
53
+ private streamedRequest;
51
54
  private handleResponse;
55
+ private handleStreamedResponse;
52
56
  private buildRequestConfig;
53
57
  private getProxyAgent;
54
- private getFetchInvoker;
58
+ getFetchInvoker(): any;
59
+ getAIEndpoint(fragment: string | null): string;
55
60
  getApiEndpoint(fragment: string | null): string;
56
61
  getBaseEndpoint(fragment: string | null): string;
57
62
  getPublicEndpoint(fragment: string): string;
@@ -71,11 +71,11 @@ import { GitProvidersBranches } from "../../model/workspaces/integrations/GitPro
71
71
  import { GitProvidersOrganizations } from "../../model/workspaces/integrations/GitProvidersOrganizations";
72
72
  import { GitProvidersProjects } from "../../model/workspaces/integrations/GitProvidersProjects";
73
73
  import { GitProvidersRepositories } from "../../model/workspaces/integrations/GitProvidersRepositories";
74
+ import { AIGetRouteQueryTask } from "../areas/SDKAreaAI";
74
75
  import { ComponentUpdateTransactionData, TokenUpdateTransactionData } from "../areas/SDKAreaBulkOperations";
75
76
  import { DataCoreReadRequests } from "./requests/SDKDataCoreReadRequests";
76
77
  import { RenderedAssetRequestSettings } from "./requests/SDKDataCoreRenderRequests";
77
78
  import { DataBridge } from "./SDKDataBridge";
78
- import { RequestInfo, RequestInit, Response } from "node-fetch";
79
79
  export declare class DataCore {
80
80
  /** Read part of the network calls */
81
81
  read: DataCoreReadRequests;
@@ -102,9 +102,14 @@ export declare class DataCore {
102
102
  strategy: "noun" | "verb";
103
103
  }): Promise<string>;
104
104
  /** Remote: Autocompletes a prompt into a full text. Response is not streamed. */
105
- aiAutocompleteText(workspaceId: string, designSystemId: string, versionId: string, text: string, options: {
105
+ aiAutocompleteText(workspaceId: string, designSystemId: string, versionId: string, textToComplete: string, options?: {
106
106
  maximumLength: number;
107
- }): Promise<string>;
107
+ previousText?: string;
108
+ afterText?: string;
109
+ }): Promise<{
110
+ completion: string;
111
+ fullText: string;
112
+ }>;
108
113
  /** Remote: Answers question based on the data of design system in natural language. This method is non-streaming. */
109
114
  aiAnswer(workspaceId: string, designSystemId: string, versionId: string, prompt: string, options: {
110
115
  persona: "designer" | "developer";
@@ -116,9 +121,11 @@ export declare class DataCore {
116
121
  persona: "designer" | "developer";
117
122
  scope: "all" | "tokens" | "components" | "assets" | "docs";
118
123
  density: "compact" | "full";
119
- }): Promise<ReadableStream<Uint8Array>>;
124
+ }): Promise<ReadableStreamDefaultReader<Uint8Array>>;
120
125
  /** Indexes or reindexes a design system to prepare it for QA engine */
121
- aiRebuildAnswerIndex(workspaceId: string, designSystemId: string, versionId: string): Promise<string>;
126
+ aiRebuildAnswerIndex(workspaceId: string, designSystemId: string, versionId: string): Promise<void>;
127
+ /** Remote: Retrieves executable url for various AI tasks */
128
+ executableTaskUrl(task: AIGetRouteQueryTask): Promise<string>;
122
129
  /** Remote: Get information about currently logged in user */
123
130
  currentUser(): Promise<User>;
124
131
  /** Remote: Get information about a specific user */
@@ -1,3 +1,4 @@
1
+ import { AIGetRouteQueryTask } from "../../areas/SDKAreaAI";
1
2
  import { DataBridge } from "../SDKDataBridge";
2
3
  export declare class DataCoreAIRequests {
3
4
  private bridge;
@@ -8,9 +9,14 @@ export declare class DataCoreAIRequests {
8
9
  strategy: "noun" | "verb";
9
10
  }): Promise<string>;
10
11
  /** Remote: Autocompletes a prompt into a full text. Response is not streamed. */
11
- autocompleteText(workspaceId: string, designSystemId: string, versionId: string, text: string, options: {
12
+ autocompleteText(workspaceId: string, designSystemId: string, versionId: string, textToComplete: string, options?: {
12
13
  maximumLength: number;
13
- }): Promise<string>;
14
+ previousText?: string;
15
+ afterText?: string;
16
+ }): Promise<{
17
+ completion: string;
18
+ fullText: string;
19
+ }>;
14
20
  /** Remote: Answers question based on the data of design system in natural language. This method is non-streaming. */
15
21
  answer(workspaceId: string, designSystemId: string, versionId: string, question: string, options: {
16
22
  persona: "designer" | "developer";
@@ -22,7 +28,11 @@ export declare class DataCoreAIRequests {
22
28
  persona: "designer" | "developer";
23
29
  scope: "all" | "tokens" | "components" | "assets" | "docs";
24
30
  density: "compact" | "full";
25
- }): Promise<ReadableStream<Uint8Array>>;
31
+ }): Promise<ReadableStreamDefaultReader<Uint8Array>>;
26
32
  /** Indexes or reindexes a design system to prepare it for QA engine */
27
- rebuildAnswerIndex(workspaceId: string, designSystemId: string, versionId: string): Promise<string>;
33
+ rebuildAnswerIndex(workspaceId: string, designSystemId: string, versionId: string): Promise<void>;
34
+ /** Retrieves executable url for various AI tasks */
35
+ executableTaskUrl(task: AIGetRouteQueryTask): Promise<string>;
36
+ cachedEndpoints: Map<AIGetRouteQueryTask, string>;
37
+ private getCachedAIEndpoint;
28
38
  }