@kolbo/app-sdk
Advanced tools
+1
-1
| { | ||
| "name": "@kolbo/app-sdk", | ||
| "version": "2.2.0", | ||
| "version": "2.3.0", | ||
| "description": "Kolbo App Builder SDK — auth, data, storage and AI for generated apps", | ||
@@ -5,0 +5,0 @@ "type": "module", |
+29
-29
@@ -572,7 +572,7 @@ // Kolbo-native adapter. | ||
| return { | ||
| async chat({ message, messages, session_id, model, ...rest } = {}) { | ||
| async chat({ message, messages, session_id, model, signal, ...rest } = {}) { | ||
| assertKey(); | ||
| const text = message ?? (messages ? messages[messages.length - 1]?.content : '') ?? ''; | ||
| const body = { message: text, session_id, ...(model ? { model } : {}), ...rest }; | ||
| const r = await fetch(`${apiBase}/v1/chat`, { method: 'POST', headers: h(), body: JSON.stringify(body) }); | ||
| const r = await fetch(`${apiBase}/v1/chat`, { method: 'POST', headers: h(), body: JSON.stringify(body), signal }); | ||
| assertAuthed(r); | ||
@@ -584,6 +584,6 @@ if (r.status === 402) throw new Error('Out of Kolbo AI credits — top up at kolbo.ai/pricing'); | ||
| }, | ||
| async generateImage({ prompt, aspect_ratio = '1:1', model, visual_dna_id, reference_image, ...rest } = {}) { | ||
| async generateImage({ prompt, aspect_ratio = '1:1', model, visual_dna_id, reference_image, signal, ...rest } = {}) { | ||
| const body = { prompt, aspect_ratio, ...(model ? { model } : {}), ...(visual_dna_id ? { visual_dna_id } : {}), ...(reference_image ? { reference_image } : {}), ...rest }; | ||
| assertKey(); | ||
| const init = await fetch(`${apiBase}/v1/generate/image`, { method: 'POST', headers: h(), body: JSON.stringify(body) }); | ||
| const init = await fetch(`${apiBase}/v1/generate/image`, { method: 'POST', headers: h(), body: JSON.stringify(body), signal }); | ||
| assertAuthed(init); | ||
@@ -593,83 +593,83 @@ if (init.status === 402) throw new Error('Out of Kolbo AI credits'); | ||
| const { pollUrl } = await init.json(); | ||
| const result = await poll(pollUrl); | ||
| const result = await poll(pollUrl, { signal }); | ||
| return { url: result.images?.[0]?.url, images: result.images }; | ||
| }, | ||
| async generateImageEdit({ prompt, image, mask, model, ...rest } = {}) { | ||
| async generateImageEdit({ prompt, image, mask, model, signal, ...rest } = {}) { | ||
| assertKey(); | ||
| const body = { prompt, image, ...(mask ? { mask } : {}), ...(model ? { model } : {}), ...rest }; | ||
| const init = await fetch(`${apiBase}/v1/generate/image-edit`, { method: 'POST', headers: h(), body: JSON.stringify(body) }); | ||
| const init = await fetch(`${apiBase}/v1/generate/image-edit`, { method: 'POST', headers: h(), body: JSON.stringify(body), signal }); | ||
| assertAuthed(init); | ||
| if (!init.ok) throw new Error(`Image edit failed: ${init.status}`); | ||
| const { pollUrl } = await init.json(); | ||
| const result = await poll(pollUrl); | ||
| const result = await poll(pollUrl, { signal }); | ||
| return { url: result.images?.[0]?.url, images: result.images }; | ||
| }, | ||
| async generateVideo({ prompt, duration = 5, aspect_ratio = '16:9', model, ...rest } = {}) { | ||
| async generateVideo({ prompt, duration = 5, aspect_ratio = '16:9', model, signal, ...rest } = {}) { | ||
| assertKey(); | ||
| const body = { prompt, duration, aspect_ratio, ...(model ? { model } : {}), ...rest }; | ||
| const init = await fetch(`${apiBase}/v1/generate/video`, { method: 'POST', headers: h(), body: JSON.stringify(body) }); | ||
| const init = await fetch(`${apiBase}/v1/generate/video`, { method: 'POST', headers: h(), body: JSON.stringify(body), signal }); | ||
| assertAuthed(init); | ||
| if (!init.ok) throw new Error(`Video init failed: ${init.status}`); | ||
| const { pollUrl } = await init.json(); | ||
| const result = await poll(pollUrl, 10 * 60_000); | ||
| const result = await poll(pollUrl, { timeoutMs: 10 * 60_000, signal }); | ||
| return { url: result.video?.url }; | ||
| }, | ||
| async generateVideoFromImage({ prompt, image, duration = 5, model, ...rest } = {}) { | ||
| async generateVideoFromImage({ prompt, image, duration = 5, model, signal, ...rest } = {}) { | ||
| assertKey(); | ||
| const body = { prompt, image, duration, ...(model ? { model } : {}), ...rest }; | ||
| const init = await fetch(`${apiBase}/v1/generate/video/from-image`, { method: 'POST', headers: h(), body: JSON.stringify(body) }); | ||
| const init = await fetch(`${apiBase}/v1/generate/video/from-image`, { method: 'POST', headers: h(), body: JSON.stringify(body), signal }); | ||
| assertAuthed(init); | ||
| if (!init.ok) throw new Error(`Video-from-image init failed: ${init.status}`); | ||
| const { pollUrl } = await init.json(); | ||
| const result = await poll(pollUrl, 10 * 60_000); | ||
| const result = await poll(pollUrl, { timeoutMs: 10 * 60_000, signal }); | ||
| return { url: result.video?.url }; | ||
| }, | ||
| async generateLipsync({ image, video, audio, model, ...rest } = {}) { | ||
| async generateLipsync({ image, video, audio, model, signal, ...rest } = {}) { | ||
| assertKey(); | ||
| const body = { audio, ...(image ? { image } : {}), ...(video ? { video } : {}), ...(model ? { model } : {}), ...rest }; | ||
| const init = await fetch(`${apiBase}/v1/generate/lipsync`, { method: 'POST', headers: h(), body: JSON.stringify(body) }); | ||
| const init = await fetch(`${apiBase}/v1/generate/lipsync`, { method: 'POST', headers: h(), body: JSON.stringify(body), signal }); | ||
| assertAuthed(init); | ||
| if (!init.ok) throw new Error(`Lipsync init failed: ${init.status}`); | ||
| const { pollUrl } = await init.json(); | ||
| const result = await poll(pollUrl, 10 * 60_000); | ||
| const result = await poll(pollUrl, { timeoutMs: 10 * 60_000, signal }); | ||
| return { url: result.video?.url }; | ||
| }, | ||
| async generateMusic({ prompt, duration, model, ...rest } = {}) { | ||
| async generateMusic({ prompt, duration, model, signal, ...rest } = {}) { | ||
| assertKey(); | ||
| const body = { prompt, ...(duration ? { duration } : {}), ...(model ? { model } : {}), ...rest }; | ||
| const init = await fetch(`${apiBase}/v1/generate/music`, { method: 'POST', headers: h(), body: JSON.stringify(body) }); | ||
| const init = await fetch(`${apiBase}/v1/generate/music`, { method: 'POST', headers: h(), body: JSON.stringify(body), signal }); | ||
| assertAuthed(init); | ||
| if (!init.ok) throw new Error(`Music init failed: ${init.status}`); | ||
| const { pollUrl } = await init.json(); | ||
| const result = await poll(pollUrl); | ||
| const result = await poll(pollUrl, { signal }); | ||
| return { url: result.audio_url }; | ||
| }, | ||
| async generateSpeech({ text, voice, model, ...rest } = {}) { | ||
| async generateSpeech({ text, voice, model, signal, ...rest } = {}) { | ||
| assertKey(); | ||
| const body = { text, ...(voice ? { voice } : {}), ...(model ? { model } : {}), ...rest }; | ||
| const init = await fetch(`${apiBase}/v1/generate/speech`, { method: 'POST', headers: h(), body: JSON.stringify(body) }); | ||
| const init = await fetch(`${apiBase}/v1/generate/speech`, { method: 'POST', headers: h(), body: JSON.stringify(body), signal }); | ||
| assertAuthed(init); | ||
| if (!init.ok) throw new Error(`Speech init failed: ${init.status}`); | ||
| const { pollUrl } = await init.json(); | ||
| const result = await poll(pollUrl); | ||
| const result = await poll(pollUrl, { signal }); | ||
| return { url: result.audio_url }; | ||
| }, | ||
| async generateSound({ prompt, duration, model, ...rest } = {}) { | ||
| async generateSound({ prompt, duration, model, signal, ...rest } = {}) { | ||
| assertKey(); | ||
| const body = { prompt, ...(duration ? { duration } : {}), ...(model ? { model } : {}), ...rest }; | ||
| const init = await fetch(`${apiBase}/v1/generate/sound`, { method: 'POST', headers: h(), body: JSON.stringify(body) }); | ||
| const init = await fetch(`${apiBase}/v1/generate/sound`, { method: 'POST', headers: h(), body: JSON.stringify(body), signal }); | ||
| assertAuthed(init); | ||
| if (!init.ok) throw new Error(`Sound init failed: ${init.status}`); | ||
| const { pollUrl } = await init.json(); | ||
| const result = await poll(pollUrl); | ||
| const result = await poll(pollUrl, { signal }); | ||
| return { url: result.audio_url }; | ||
| }, | ||
| async transcribe({ audio, model, ...rest } = {}) { | ||
| async transcribe({ audio, model, signal, ...rest } = {}) { | ||
| assertKey(); | ||
| const body = { audio, ...(model ? { model } : {}), ...rest }; | ||
| const init = await fetch(`${apiBase}/v1/transcribe`, { method: 'POST', headers: h(), body: JSON.stringify(body) }); | ||
| const init = await fetch(`${apiBase}/v1/transcribe`, { method: 'POST', headers: h(), body: JSON.stringify(body), signal }); | ||
| assertAuthed(init); | ||
| if (!init.ok) throw new Error(`Transcribe init failed: ${init.status}`); | ||
| const { pollUrl } = await init.json(); | ||
| const result = await poll(pollUrl); | ||
| const result = await poll(pollUrl, { signal }); | ||
| return { text: result.text, srt: result.srt, segments: result.segments }; | ||
@@ -676,0 +676,0 @@ }, |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
80298
0.38%