@supernova-studio/supernova-sdk-beta 2.1.1 → 2.1.3
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/build/sdk-typescript/src/core/SDKSupernova.d.ts +6 -2
- package/build/sdk-typescript/src/core/areas/SDKAreaAI.d.ts +49 -25
- package/build/sdk-typescript/src/core/data/SDKConfiguration.d.ts +2 -0
- package/build/sdk-typescript/src/core/data/SDKDataBridge.d.ts +7 -4
- package/build/sdk-typescript/src/core/data/SDKDataCore.d.ts +23 -10
- package/build/sdk-typescript/src/core/data/requests/SDKDataCoreAIRequests.d.ts +23 -10
- package/build/sdk-typescript/src/tests/Areas/AreaAI.spec.d.ts +1 -0
- package/build/sdk-typescript/src/tests/Areas/AreaResources.spec.d.ts +1 -0
- package/build/supernova-sdk-typescript.js +1 -1
- package/build/supernova-sdk-typescript.js.map +1 -1
- package/package.json +1 -2
|
@@ -25,6 +25,7 @@ import { DataBridgeRequestHook } from "./data/SDKDataBridge";
|
|
|
25
25
|
export declare class Supernova {
|
|
26
26
|
private apiKey;
|
|
27
27
|
private apiUrl;
|
|
28
|
+
private aiApiUrl;
|
|
28
29
|
private apiVersion;
|
|
29
30
|
private requestHook;
|
|
30
31
|
private dataCore;
|
|
@@ -78,12 +79,15 @@ export declare class Supernova {
|
|
|
78
79
|
* @param options Options for SDK
|
|
79
80
|
* @param options.url URL of the Supernova.io instance to connect to. Defaults to production environment
|
|
80
81
|
* @param options.requestHook Hook for observing requests
|
|
81
|
-
* @param options.
|
|
82
|
+
* @param options.customFetchLib When provided, network requests will run through custom provided, fetch-like. Use in environments where fetch is not available or you want to provide your own implementation.
|
|
83
|
+
* @param options.customProxyLib When provided, proxy will be used to route network requests.
|
|
82
84
|
*/
|
|
83
85
|
constructor(apiKey: string, options?: {
|
|
84
86
|
apiUrl?: string;
|
|
87
|
+
aiApiUrl?: string;
|
|
85
88
|
requestHook?: DataBridgeRequestHook;
|
|
86
|
-
|
|
89
|
+
customFetchLib?: any;
|
|
90
|
+
customProxyLib?: any;
|
|
87
91
|
proxyUrl?: string;
|
|
88
92
|
isPreview?: boolean;
|
|
89
93
|
jobId?: string;
|
|
@@ -1,34 +1,58 @@
|
|
|
1
1
|
import { DataCore } from "../data/SDKDataCore";
|
|
2
|
-
import {
|
|
2
|
+
import { RemoteWorkspaceVersionIdentifier } from "./SDKRemoteIdentifiers";
|
|
3
3
|
export declare class AreaAI {
|
|
4
4
|
/** Internal: Engine */
|
|
5
5
|
private dataCore;
|
|
6
6
|
constructor(dataCore: DataCore);
|
|
7
|
-
/**
|
|
8
|
-
* @param from -
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
11
|
-
* @returns
|
|
7
|
+
/** Summarizes a prompt into a title. Response is not streamed.
|
|
8
|
+
* @param from - Version identifier
|
|
9
|
+
* @param text - Text to summarize
|
|
10
|
+
* @param options - Summarization options
|
|
11
|
+
* @returns Summarized title
|
|
12
|
+
* @disclaimer This method will throw if the user is not authorized to use AI features (if you are reading this, you are not authorized).
|
|
12
13
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* @param
|
|
19
|
-
* @
|
|
14
|
+
summarizeIntoTitle(from: RemoteWorkspaceVersionIdentifier, text: string, options?: {
|
|
15
|
+
maxWordCount: number;
|
|
16
|
+
strategy: "noun" | "verb";
|
|
17
|
+
}): Promise<string>;
|
|
18
|
+
/** Autocompletes a prompt into a full text. Response is not streamed.
|
|
19
|
+
* @param from - Version identifier
|
|
20
|
+
* @param text - Text to autocomplete
|
|
21
|
+
* @param options - Autocomplete options
|
|
22
|
+
* @returns Autocompleted text
|
|
23
|
+
* @disclaimer This method will throw if the user is not authorized to use AI features (if you are reading this, you are not authorized).
|
|
20
24
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* @param
|
|
26
|
-
* @param
|
|
27
|
-
* @
|
|
25
|
+
autocompleteText(from: RemoteWorkspaceVersionIdentifier, text: string, options?: {
|
|
26
|
+
maximumLength: number;
|
|
27
|
+
}): Promise<string>;
|
|
28
|
+
/** Answers question based on the data of design system in natural language. This method is non-streaming.
|
|
29
|
+
* @param from - Version identifier
|
|
30
|
+
* @param prompt - Question to answer
|
|
31
|
+
* @param options - Answering options
|
|
32
|
+
* @returns Answer to the question
|
|
33
|
+
* @disclaimer This method will throw if the user is not authorized to use AI features (if you are reading this, you are not authorized).
|
|
28
34
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
answer(from: RemoteWorkspaceVersionIdentifier, prompt: string, options?: {
|
|
36
|
+
persona: "designer" | "developer";
|
|
37
|
+
scope: "all" | "tokens" | "components" | "assets" | "docs";
|
|
38
|
+
density: "compact" | "full";
|
|
39
|
+
}): Promise<string>;
|
|
40
|
+
/** Answers question based on the data of design system in natural language. This method streams answer.
|
|
41
|
+
* @param from - Version identifier
|
|
42
|
+
* @param prompt - Question to answer
|
|
43
|
+
* @param options - Answering options
|
|
44
|
+
* @returns Answer to the question
|
|
45
|
+
* @disclaimer This method will throw if the user is not authorized to use AI features (if you are reading this, you are not authorized).
|
|
46
|
+
*/
|
|
47
|
+
answerAsStream(from: RemoteWorkspaceVersionIdentifier, prompt: string, options?: {
|
|
48
|
+
persona: "designer" | "developer";
|
|
49
|
+
scope: "all" | "tokens" | "components" | "assets" | "docs";
|
|
50
|
+
density: "compact" | "full";
|
|
51
|
+
}): Promise<ReadableStream<Uint8Array>>;
|
|
52
|
+
/** Indexes or reindexes a design system to prepare it for QA engine
|
|
53
|
+
* @param from - Version identifier
|
|
54
|
+
* @returns Indexing status
|
|
55
|
+
* @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
|
+
*/
|
|
57
|
+
rebuildAnswerIndex(from: RemoteWorkspaceVersionIdentifier): Promise<string>;
|
|
34
58
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export declare class Configuration {
|
|
2
2
|
/** Retrieve API URL for default target */
|
|
3
3
|
static apiUrlForDefaultEnvironment(): string;
|
|
4
|
+
/** Retrieve API URL for default AI target */
|
|
5
|
+
static aiApiUrlForDefaultEnvironment(): string;
|
|
4
6
|
/** Retrieve API version for the specific environment accesse */
|
|
5
7
|
static apiVersionForDefaultEnvironment(): string;
|
|
6
8
|
}
|
|
@@ -15,26 +15,28 @@ export type DebugRequestObserver = (info: {
|
|
|
15
15
|
}) => void;
|
|
16
16
|
export type DataBridgeConfiguration = {
|
|
17
17
|
apiUrl: string;
|
|
18
|
+
aiApiUrl: string;
|
|
18
19
|
apiVersion: string;
|
|
19
20
|
accessToken: string;
|
|
20
21
|
target: string | null;
|
|
21
|
-
|
|
22
|
+
customFetchLib: any | null;
|
|
23
|
+
customProxyLib: any | null;
|
|
22
24
|
requestHook: DataBridgeRequestHook | null;
|
|
23
25
|
debugRequestObserver?: DebugRequestObserver | null;
|
|
24
26
|
debugResponseObserver?: DebugResponseObserver | null;
|
|
25
|
-
proxyUrl?: string | null;
|
|
26
27
|
jobId?: string | null;
|
|
27
28
|
isPreview?: boolean;
|
|
28
29
|
};
|
|
29
30
|
export declare class DataBridge {
|
|
30
31
|
authToken: string;
|
|
31
32
|
apiUrl: string;
|
|
33
|
+
aiApiUrl: string;
|
|
32
34
|
apiVersion: string;
|
|
33
35
|
target: string | null;
|
|
34
|
-
|
|
36
|
+
customFetchLib: any | null;
|
|
37
|
+
customProxyLib: any | null;
|
|
35
38
|
isPreview: boolean;
|
|
36
39
|
jobId: string | null;
|
|
37
|
-
proxyUrl: string | undefined;
|
|
38
40
|
requestHook: DataBridgeRequestHook | null;
|
|
39
41
|
debugRequestObserver: DebugRequestObserver | null;
|
|
40
42
|
debugResponseObserver: DebugResponseObserver | null;
|
|
@@ -50,6 +52,7 @@ export declare class DataBridge {
|
|
|
50
52
|
private buildRequestConfig;
|
|
51
53
|
private getProxyAgent;
|
|
52
54
|
private getFetchInvoker;
|
|
55
|
+
getApiEndpoint(fragment: string | null): string;
|
|
53
56
|
getBaseEndpoint(fragment: string | null): string;
|
|
54
57
|
getPublicEndpoint(fragment: string): string;
|
|
55
58
|
getAclEndpoint(resource?: string): string;
|
|
@@ -96,16 +96,29 @@ export declare class DataCore {
|
|
|
96
96
|
multiplayerToken(room: string | undefined): Promise<{
|
|
97
97
|
token: string;
|
|
98
98
|
}>;
|
|
99
|
-
/** Remote:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
99
|
+
/** Remote: Summarizes a prompt into a title. Response is not streamed */
|
|
100
|
+
aiSummarizeIntoTitle(workspaceId: string, designSystemId: string, versionId: string, text: string, options: {
|
|
101
|
+
maxWordCount: number;
|
|
102
|
+
strategy: "noun" | "verb";
|
|
103
|
+
}): Promise<string>;
|
|
104
|
+
/** Remote: Autocompletes a prompt into a full text. Response is not streamed. */
|
|
105
|
+
aiAutocompleteText(workspaceId: string, designSystemId: string, versionId: string, text: string, options: {
|
|
106
|
+
maximumLength: number;
|
|
107
|
+
}): Promise<string>;
|
|
108
|
+
/** Remote: Answers question based on the data of design system in natural language. This method is non-streaming. */
|
|
109
|
+
aiAnswer(workspaceId: string, designSystemId: string, versionId: string, prompt: string, options: {
|
|
110
|
+
persona: "designer" | "developer";
|
|
111
|
+
scope: "all" | "tokens" | "components" | "assets" | "docs";
|
|
112
|
+
density: "compact" | "full";
|
|
113
|
+
}): Promise<string>;
|
|
114
|
+
/** Remote: Answers question based on the data of design system in natural language. This method streams answer. */
|
|
115
|
+
aiAnswerAsStream(workspaceId: string, designSystemId: string, versionId: string, prompt: string, options: {
|
|
116
|
+
persona: "designer" | "developer";
|
|
117
|
+
scope: "all" | "tokens" | "components" | "assets" | "docs";
|
|
118
|
+
density: "compact" | "full";
|
|
119
|
+
}): Promise<ReadableStream<Uint8Array>>;
|
|
120
|
+
/** Indexes or reindexes a design system to prepare it for QA engine */
|
|
121
|
+
aiRebuildAnswerIndex(workspaceId: string, designSystemId: string, versionId: string): Promise<string>;
|
|
109
122
|
/** Remote: Get information about currently logged in user */
|
|
110
123
|
currentUser(): Promise<User>;
|
|
111
124
|
/** Remote: Get information about a specific user */
|
|
@@ -2,14 +2,27 @@ import { DataBridge } from "../SDKDataBridge";
|
|
|
2
2
|
export declare class DataCoreAIRequests {
|
|
3
3
|
private bridge;
|
|
4
4
|
constructor(bridge: DataBridge);
|
|
5
|
-
/** Remote:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
/** Remote: Summarizes a prompt into a title. Response is not streamed */
|
|
6
|
+
summarizeIntoTitle(workspaceId: string, designSystemId: string, versionId: string, text: string, options: {
|
|
7
|
+
maxWordCount: number;
|
|
8
|
+
strategy: "noun" | "verb";
|
|
9
|
+
}): Promise<string>;
|
|
10
|
+
/** Remote: Autocompletes a prompt into a full text. Response is not streamed. */
|
|
11
|
+
autocompleteText(workspaceId: string, designSystemId: string, versionId: string, text: string, options: {
|
|
12
|
+
maximumLength: number;
|
|
13
|
+
}): Promise<string>;
|
|
14
|
+
/** Remote: Answers question based on the data of design system in natural language. This method is non-streaming. */
|
|
15
|
+
answer(workspaceId: string, designSystemId: string, versionId: string, question: string, options: {
|
|
16
|
+
persona: "designer" | "developer";
|
|
17
|
+
scope: "all" | "tokens" | "components" | "assets" | "docs";
|
|
18
|
+
density: "compact" | "full";
|
|
19
|
+
}): Promise<string>;
|
|
20
|
+
/** Remote: Answers question based on the data of design system in natural language. This method streams answer. */
|
|
21
|
+
answerAsStream(workspaceId: string, designSystemId: string, versionId: string, question: string, options: {
|
|
22
|
+
persona: "designer" | "developer";
|
|
23
|
+
scope: "all" | "tokens" | "components" | "assets" | "docs";
|
|
24
|
+
density: "compact" | "full";
|
|
25
|
+
}): Promise<ReadableStream<Uint8Array>>;
|
|
26
|
+
/** Indexes or reindexes a design system to prepare it for QA engine */
|
|
27
|
+
rebuildAnswerIndex(workspaceId: string, designSystemId: string, versionId: string): Promise<string>;
|
|
15
28
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|