@websimai/client-api-types 0.0.5 → 0.0.7
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.mts +95 -95
- package/package.json +6 -9
package/dist/index.d.mts
CHANGED
|
@@ -4,89 +4,89 @@ import { WebsimComment } from "@websimai/shared-types";
|
|
|
4
4
|
type ChatCompletionsMessageRole = "system" | "user" | "assistant" | "tool";
|
|
5
5
|
type ChatCompletionsMessageContent = {
|
|
6
6
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
* The type of content part.
|
|
8
|
+
*/
|
|
9
9
|
type: "text";
|
|
10
10
|
/**
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
* The text content.
|
|
12
|
+
*/
|
|
13
13
|
text: string;
|
|
14
14
|
} | {
|
|
15
15
|
/**
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
* The type of content part.
|
|
17
|
+
*/
|
|
18
18
|
type: "image_url";
|
|
19
19
|
/**
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
* An object containing the base64 encoded image data URL.
|
|
21
|
+
*/
|
|
22
22
|
image_url: {
|
|
23
23
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
* A base64 encoded image data URL.
|
|
25
|
+
*/
|
|
26
26
|
url: string;
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
29
|
/**
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
* Represents a single message in the conversation history.
|
|
31
|
+
*/
|
|
32
32
|
type ChatCompletionsMessage = {
|
|
33
33
|
/**
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
* The role of the message sender.
|
|
35
|
+
*/
|
|
36
36
|
role: ChatCompletionsMessageRole;
|
|
37
37
|
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
* The message content.
|
|
39
|
+
* Can be plain text or an array for multimodal inputs.
|
|
40
|
+
*/
|
|
41
41
|
content: string | ChatCompletionsMessageContent[];
|
|
42
42
|
};
|
|
43
43
|
type ChatCompletionOptions = {
|
|
44
44
|
/**
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
* A list of messages comprising the conversation so far.
|
|
46
|
+
* Each message includes a `role` (system, user, assistant, tool) and `content`.
|
|
47
|
+
*/
|
|
48
48
|
messages: ChatCompletionsMessage[];
|
|
49
49
|
/**
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
* ID of the model to use.
|
|
51
|
+
* If not specified, websim uses its default model.
|
|
52
|
+
*/
|
|
53
53
|
model?: string;
|
|
54
54
|
/**
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
* If `true`, the model will attempt to generate a JSON object.
|
|
56
|
+
* The response content will be a string that you will need to parse.
|
|
57
|
+
* Defaults to `false`.
|
|
58
|
+
*/
|
|
59
59
|
json?: boolean;
|
|
60
60
|
/**
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
* If `true`, the response will be streamed back incrementally.
|
|
62
|
+
* Defaults to `false`.
|
|
63
|
+
*/
|
|
64
64
|
stream?: boolean;
|
|
65
65
|
/**
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
* What sampling temperature to use, between 0 and 2.
|
|
67
|
+
* Higher values (e.g., 0.8) make the output more random; lower values (e.g., 0.2) make it more focused.
|
|
68
|
+
* Defaults to 1.
|
|
69
|
+
*/
|
|
70
70
|
temperature?: number;
|
|
71
71
|
/**
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
* An alternative to sampling with temperature, where the model considers tokens with top_p probability mass.
|
|
73
|
+
* E.g., 0.1 means only tokens comprising the top 10% probability mass are considered.
|
|
74
|
+
* Defaults to 1.
|
|
75
|
+
*/
|
|
76
76
|
top_p?: number;
|
|
77
77
|
/**
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
* The maximum number of tokens to generate in the chat completion.
|
|
79
|
+
*/
|
|
80
80
|
max_tokens?: number;
|
|
81
81
|
};
|
|
82
82
|
type ChatCompletionResult = {
|
|
83
83
|
/**
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
* The generated text content from the assistant.
|
|
85
|
+
*/
|
|
86
86
|
readonly content: string;
|
|
87
87
|
/**
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
* The role of the message sender, which will always be "assistant" for the model's response.
|
|
89
|
+
*/
|
|
90
90
|
readonly role: "assistant";
|
|
91
91
|
};
|
|
92
92
|
declare namespace ChatCompletions {
|
|
@@ -106,51 +106,51 @@ declare class Chat {
|
|
|
106
106
|
type ImageGenAspectRatio = "1:1" | "16:9" | "21:9" | "3:2" | "2:3" | "4:5" | "5:4" | "3:4" | "4:3" | "9:16" | "9:21";
|
|
107
107
|
type ImageGenOptions = {
|
|
108
108
|
/**
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
* The primary text prompt describing the image to generate.
|
|
110
|
+
* This is a required parameter.
|
|
111
|
+
*/
|
|
112
112
|
prompt: string;
|
|
113
113
|
/**
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
* Optional aspect ratio for the generated image.
|
|
115
|
+
* Defaults to "1:1".
|
|
116
|
+
* If `width` and `height` are provided, this parameter will be ignored.
|
|
117
|
+
*/
|
|
118
118
|
aspect_ratio?: ImageGenAspectRatio;
|
|
119
119
|
/**
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
* Optional width of the generated image in pixels.
|
|
121
|
+
* If provided along with `height`, it overrides `aspect_ratio`.
|
|
122
|
+
*/
|
|
123
123
|
width?: number;
|
|
124
124
|
/**
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
* Optional height of the generated image in pixels.
|
|
126
|
+
* If provided along with `width`, it overrides `aspect_ratio`.
|
|
127
|
+
*/
|
|
128
128
|
height?: number;
|
|
129
129
|
/**
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
130
|
+
* Optional boolean.
|
|
131
|
+
* If `true`, the generated image will have a transparent background.
|
|
132
|
+
* Defaults to `false`.
|
|
133
|
+
*/
|
|
134
134
|
transparent?: boolean;
|
|
135
135
|
/**
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
136
|
+
* Optional array of image inputs.
|
|
137
|
+
* Each object in the array should have a `url` property, which is a base64 encoded image data URL.
|
|
138
|
+
* Supports 1-4 input images for image-to-image generation.
|
|
139
|
+
*/
|
|
140
140
|
image_inputs?: {
|
|
141
141
|
url: string;
|
|
142
142
|
}[];
|
|
143
143
|
/**
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
144
|
+
* Optional seed for the image generation process.
|
|
145
|
+
* Using the same prompt and seed will produce variations of the same output, useful for consistent results or exploring variations.
|
|
146
|
+
*/
|
|
147
147
|
seed?: number;
|
|
148
148
|
};
|
|
149
149
|
type ImageGenResult = {
|
|
150
150
|
/**
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
151
|
+
* The URL of the generated image.
|
|
152
|
+
* This URL can be used to display the image.
|
|
153
|
+
*/
|
|
154
154
|
readonly url: `https://${string}/${string}`;
|
|
155
155
|
};
|
|
156
156
|
declare namespace ImageGen {
|
|
@@ -162,33 +162,33 @@ declare namespace ImageGen {
|
|
|
162
162
|
//#region src/types/text-to-speech.d.ts
|
|
163
163
|
type TextToSpeechOptions = {
|
|
164
164
|
/**
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
* The text string to synthesize to speech.
|
|
166
|
+
*/
|
|
167
167
|
text: string;
|
|
168
168
|
/**
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
* Voice identifier (e.g., "en-male") or ElevenLabs voice ID for a specific voice.
|
|
170
|
+
*/
|
|
171
171
|
voice?: string;
|
|
172
172
|
/**
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
173
|
+
* Desired audio format.
|
|
174
|
+
* Defaults to "mp3".
|
|
175
|
+
*/
|
|
176
176
|
format?: "mp3" | "wav";
|
|
177
177
|
/**
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
178
|
+
* Playback speed multiplier.
|
|
179
|
+
* Typical range 0.5 - 2.0.
|
|
180
|
+
*/
|
|
181
181
|
speed?: number;
|
|
182
182
|
/**
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
183
|
+
* Pitch adjustment in semitones.
|
|
184
|
+
* Typical range -12 to 12.
|
|
185
|
+
*/
|
|
186
186
|
pitch?: number;
|
|
187
187
|
};
|
|
188
188
|
type TextToSpeechResult = {
|
|
189
189
|
/**
|
|
190
|
-
|
|
191
|
-
|
|
190
|
+
* A public URL pointing to the generated audio file.
|
|
191
|
+
*/
|
|
192
192
|
readonly url: `https://${string}/${string}`;
|
|
193
193
|
};
|
|
194
194
|
//#endregion
|
|
@@ -253,19 +253,19 @@ interface WebsimClientAPI {
|
|
|
253
253
|
readonly v0: {
|
|
254
254
|
login(): Promise<void>;
|
|
255
255
|
/**
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
256
|
+
* Saves the given htmlContent to a new websim site.
|
|
257
|
+
* @param htmlContent html content to save
|
|
258
|
+
* @returns object with id of the saved site
|
|
259
|
+
*/
|
|
260
260
|
save(htmlContent: string): Promise<{
|
|
261
261
|
id: string;
|
|
262
262
|
}>;
|
|
263
263
|
/**
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
264
|
+
* Returns the HTML for the given siteId.
|
|
265
|
+
* Defaults to the current websimsite.
|
|
266
|
+
* @param siteId
|
|
267
|
+
* @returns HTML for the given siteId.
|
|
268
|
+
*/
|
|
269
269
|
getHTML(siteId?: string): Promise<string>;
|
|
270
270
|
};
|
|
271
271
|
};
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@websimai/client-api-types",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "Type declarations for the `window.websim` object",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"author": "
|
|
6
|
+
"author": "gameroman",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"access": "public"
|
|
@@ -22,24 +22,21 @@
|
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
24
|
"build": "bunx --bun tsdown",
|
|
25
|
-
"
|
|
25
|
+
"prepublishOnly": "bun run build"
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
28
|
"dist/**/*",
|
|
29
|
-
"README.md"
|
|
30
|
-
"LICENSE"
|
|
29
|
+
"README.md"
|
|
31
30
|
],
|
|
32
|
-
"main": "./dist/index.mjs",
|
|
33
|
-
"module": "./dist/index.mjs",
|
|
34
31
|
"types": "./dist/index.d.mts",
|
|
35
32
|
"exports": {
|
|
36
33
|
".": "./dist/index.mjs",
|
|
37
34
|
"./package.json": "./package.json"
|
|
38
35
|
},
|
|
39
36
|
"dependencies": {
|
|
40
|
-
"@websimai/shared-types": "0.0.
|
|
37
|
+
"@websimai/shared-types": "0.0.5"
|
|
41
38
|
},
|
|
42
39
|
"devDependencies": {
|
|
43
|
-
"tsdown": "^0.
|
|
40
|
+
"tsdown": "^0.20.1"
|
|
44
41
|
}
|
|
45
42
|
}
|