@runappsai/sdk 0.6.5 → 0.6.6
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/README.md +10 -0
- package/dist/audio.d.ts +4 -1
- package/dist/audio.d.ts.map +1 -1
- package/dist/audio.js.map +1 -1
- package/dist/chat.d.ts +16 -5
- package/dist/chat.d.ts.map +1 -1
- package/dist/chat.js.map +1 -1
- package/dist/image.d.ts +6 -2
- package/dist/image.d.ts.map +1 -1
- package/dist/image.js +1 -1
- package/dist/image.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/sdk.umd.js +2 -2
- package/dist/sdk.umd.js.map +1 -1
- package/dist/video.d.ts +4 -1
- package/dist/video.d.ts.map +1 -1
- package/dist/video.js.map +1 -1
- package/package.json +1 -1
- package/src/audio.ts +4 -1
- package/src/chat.ts +17 -1
- package/src/image.ts +7 -3
- package/src/index.ts +1 -0
- package/src/video.ts +4 -1
package/dist/video.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Transport } from "./transport.js";
|
|
2
|
+
import type { PromptRef } from "./chat.js";
|
|
2
3
|
import type { Usage } from "./types.js";
|
|
3
4
|
import type { SDKEvents } from "./events.js";
|
|
4
5
|
/**
|
|
@@ -9,7 +10,9 @@ import type { SDKEvents } from "./events.js";
|
|
|
9
10
|
* forces off.
|
|
10
11
|
*/
|
|
11
12
|
export interface VideoGenerateParams {
|
|
12
|
-
prompt
|
|
13
|
+
/** The prompt text, or a private prompt `{ id, vars }` whose
|
|
14
|
+
* filled-in text is the prompt (see `PromptRef`). */
|
|
15
|
+
prompt: string | PromptRef;
|
|
13
16
|
aspect_ratio?: string;
|
|
14
17
|
duration?: number;
|
|
15
18
|
resolution?: string;
|
package/dist/video.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video.d.ts","sourceRoot":"","sources":["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AAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAMD,MAAM,WAAW,WAAW;IAC1B,0BAA0B;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,qBAAa,YAAY;IAErB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,SAAS;IAGpC;;;;;;;kEAO8D;IACxD,QAAQ,CACZ,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,mBAAmB,EAC3B,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GAC9B,OAAO,CAAC,SAAS,CAAC;IAarB,0CAA0C;IACpC,SAAS,CACb,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GAC9B,OAAO,CAAC,WAAW,CAAC;IAOvB;;;OAGG;IACG,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,WAAW,CAAC;IAWxE,yDAAyD;IACnD,UAAU,CACd,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GAC9B,OAAO,CAAC;QAAE,IAAI,EAAE,UAAU,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;CAMtD"}
|
package/dist/video.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video.js","sourceRoot":"","sources":["../src/video.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"video.js","sourceRoot":"","sources":["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AAC;IAED,yDAAyD;IACzD,KAAK,CAAC,UAAU,CACd,MAAc,EACd,IAA+B;QAE/B,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAC1B,cAAc,kBAAkB,CAAC,MAAM,CAAC,UAAU,EAClD,IAAI,CACL,CAAC;IACJ,CAAC;CACF;AAED,SAAS,KAAK,CAAC,EAAU,EAAE,MAAoB;IAC7C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;YACpB,MAAM,CAAC,MAAM,CAAC,MAAM,IAAI,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;YAC9C,OAAO;QACT,CAAC;QACD,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC5B,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC9C,OAAO,EAAE,CAAC;QACZ,CAAC,EAAE,EAAE,CAAC,CAAC;QACP,MAAM,OAAO,GAAG,GAAG,EAAE;YACnB,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,CAAC,MAAO,CAAC,MAAM,IAAI,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;QACjD,CAAC,CAAC;QACF,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
package/src/audio.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Transport } from "./transport.js";
|
|
2
|
+
import type { PromptRef } from "./chat.js";
|
|
2
3
|
import type { Usage } from "./types.js";
|
|
3
4
|
import type { SDKEvents } from "./events.js";
|
|
4
5
|
import { wrapEvents } from "./event-wrap.js";
|
|
@@ -17,7 +18,9 @@ import { decodeMediaUrl } from "./media.js";
|
|
|
17
18
|
/* ------------------------------------------------------------------ */
|
|
18
19
|
|
|
19
20
|
export interface SpeechParams {
|
|
20
|
-
|
|
21
|
+
/** The text to speak, or a private prompt `{ id, vars }` whose
|
|
22
|
+
* filled-in text is spoken (see `PromptRef`). */
|
|
23
|
+
input: string | PromptRef;
|
|
21
24
|
/** Named voice id (`alloy`, `nova`, …; provider-dependent). Omit
|
|
22
25
|
* when supplying `reference_audio_url` for zero-shot voice
|
|
23
26
|
* cloning — the cloned timbre overrides any named voice. */
|
package/src/chat.ts
CHANGED
|
@@ -65,6 +65,22 @@ export interface StreamOptions {
|
|
|
65
65
|
*/
|
|
66
66
|
export type ServerToolName = "web_search" | "web_fetch" | "twitter_search";
|
|
67
67
|
|
|
68
|
+
/**
|
|
69
|
+
* One of the app's private prompts, kept out of the browser. The
|
|
70
|
+
* gateway reads `<id>.md` from the app's bundle (`bundle.json` or
|
|
71
|
+
* `.private/prompts/`), fills `{{var}}` placeholders from `vars`, and
|
|
72
|
+
* uses the result: as the system message for chat, or as the whole
|
|
73
|
+
* text for image, video and speech calls, where it takes the place of
|
|
74
|
+
* `prompt` / `input`. `template` sends the text inline instead — for a
|
|
75
|
+
* creator's local dev server, before a bundle exists; the gateway
|
|
76
|
+
* accepts it only from the app's creator.
|
|
77
|
+
*/
|
|
78
|
+
export interface PromptRef {
|
|
79
|
+
id?: string;
|
|
80
|
+
vars?: Record<string, unknown>;
|
|
81
|
+
template?: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
68
84
|
/** Typed constants for {@link ServerToolName} so you get autocomplete. */
|
|
69
85
|
export const ServerTools = {
|
|
70
86
|
WebSearch: "web_search",
|
|
@@ -110,7 +126,7 @@ export interface ChatCompletionParams {
|
|
|
110
126
|
* local dev server, before a bundle exists; the gateway accepts it
|
|
111
127
|
* only from the app's creator.
|
|
112
128
|
*/
|
|
113
|
-
prompt?:
|
|
129
|
+
prompt?: PromptRef;
|
|
114
130
|
/** Pass-through for provider-specific knobs. */
|
|
115
131
|
[extra: string]: unknown;
|
|
116
132
|
}
|
package/src/image.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Transport } from "./transport.js";
|
|
2
|
+
import type { PromptRef } from "./chat.js";
|
|
2
3
|
import type { Usage } from "./types.js";
|
|
3
4
|
import type { SDKEvents } from "./events.js";
|
|
4
5
|
import { wrapEvents } from "./event-wrap.js";
|
|
@@ -13,7 +14,9 @@ import { wrapEvents } from "./event-wrap.js";
|
|
|
13
14
|
* the three is set, the gateway / upstream applies its own default.
|
|
14
15
|
*/
|
|
15
16
|
export interface ImageGenerateParams {
|
|
16
|
-
prompt
|
|
17
|
+
/** The prompt text, or a private prompt `{ id, vars }` whose
|
|
18
|
+
* filled-in text is the prompt (see `PromptRef`). */
|
|
19
|
+
prompt: string | PromptRef;
|
|
17
20
|
/** Legacy explicit "WxH" override. Prefer `resolution` +
|
|
18
21
|
* `aspect_ratio` for new code. */
|
|
19
22
|
size?: string;
|
|
@@ -121,7 +124,8 @@ export interface ImageFileInput {
|
|
|
121
124
|
export interface ImageEditParams {
|
|
122
125
|
image: ImageFileInput;
|
|
123
126
|
mask?: ImageFileInput;
|
|
124
|
-
prompt
|
|
127
|
+
/** The prompt text, or a private prompt `{ id, vars }`. */
|
|
128
|
+
prompt: string | PromptRef;
|
|
125
129
|
size?: string;
|
|
126
130
|
n?: number;
|
|
127
131
|
user?: string;
|
|
@@ -298,7 +302,7 @@ function sleep(ms: number, signal?: AbortSignal): Promise<void> {
|
|
|
298
302
|
function buildEditForm(model: string, params: ImageEditParams): FormData {
|
|
299
303
|
const form = new FormData();
|
|
300
304
|
form.set("model", model);
|
|
301
|
-
form.set("prompt", params.prompt);
|
|
305
|
+
form.set("prompt", typeof params.prompt === "string" ? params.prompt : JSON.stringify(params.prompt));
|
|
302
306
|
if (params.size) form.set("size", params.size);
|
|
303
307
|
if (params.n !== undefined) form.set("n", String(params.n));
|
|
304
308
|
if (params.user) form.set("user", params.user);
|
package/src/index.ts
CHANGED
package/src/video.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Transport } from "./transport.js";
|
|
2
|
+
import type { PromptRef } from "./chat.js";
|
|
2
3
|
import type { Usage } from "./types.js";
|
|
3
4
|
import type { SDKEvents } from "./events.js";
|
|
4
5
|
import { wrapEvents } from "./event-wrap.js";
|
|
@@ -15,7 +16,9 @@ import { wrapEvents } from "./event-wrap.js";
|
|
|
15
16
|
* forces off.
|
|
16
17
|
*/
|
|
17
18
|
export interface VideoGenerateParams {
|
|
18
|
-
prompt
|
|
19
|
+
/** The prompt text, or a private prompt `{ id, vars }` whose
|
|
20
|
+
* filled-in text is the prompt (see `PromptRef`). */
|
|
21
|
+
prompt: string | PromptRef;
|
|
19
22
|
aspect_ratio?: string;
|
|
20
23
|
duration?: number;
|
|
21
24
|
resolution?: string;
|