@devvibex/aiflow 1.17.0 → 1.17.2

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 CHANGED
@@ -83,7 +83,6 @@ console.log(emb.data[0].embedding.length);
83
83
  | `timeout` | `number` | `60000` | Per-request timeout (ms). |
84
84
  | `maxRetries` | `number` | `2` | Retries on 429 / 5xx / network errors. |
85
85
  | `fetch` | `typeof fetch` | `globalThis.fetch` | Custom fetch (Node <18, testing). |
86
- | `backgroundNotice` | `boolean` | `true` | `false` turns off the [background notice](#the-background-notice--1170) for the whole page. |
87
86
 
88
87
  When you don't pass a `defaultModel`, the SDK calls `GET /config` on the
89
88
  first `chat` / `chatStream` / `generateImage` / `embed` and caches the
@@ -146,6 +145,10 @@ away from, and keeps the result for a week. The calls resolve with exactly the
146
145
  same value as before; on an older gateway they fall back to one synchronous
147
146
  request.
148
147
 
148
+ The SDK draws no UI for them (1.17.0 showed a corner panel; 1.17.1 removed it).
149
+ Show a job's state where its result goes — a loading state, then the result or
150
+ an inline error — rather than in a popup or toast.
151
+
149
152
  Every generation call takes these extra options:
150
153
 
151
154
  | Option | |
@@ -210,11 +213,11 @@ finished, or when it does (also after a page change or a reload):
210
213
  ```js
211
214
  useEffect(() => {
212
215
  const job = aiflow.jobs.attach('poster');
213
- if (!job || job.status === 'failed') return; // an old failure: the notice shows it
216
+ if (!job || job.status === 'failed') return; // an earlier failure: start fresh
214
217
  if (job.status === 'processing') setLoading(true);
215
218
  job.done
216
219
  .then((res) => setImages(res.images))
217
- .catch((err) => toast.error(err.message))
220
+ .catch((err) => setError(err.message)) // shown next to the result
218
221
  .finally(() => setLoading(false));
219
222
  }, []);
220
223
 
@@ -222,29 +225,8 @@ const res = await aiflow.generateImage({ prompt, tag: 'poster' });
222
225
  ```
223
226
 
224
227
  Without a tag, `jobs.attach()` picks the newest job started from the current
225
- page. Reading `done` is what tells the background notice that the page shows
226
- the job; a page that skips a failed job leaves its card in the notice.
227
-
228
- ### The background notice (≥ 1.17.0)
229
-
230
- When the user leaves the page that started a generation (or reloads it), the
231
- SDK shows a small panel in the corner: *"Generating your video… It keeps going
232
- in the background."* When the job finishes, the panel shows the result — image
233
- thumbnails, an audio or video player, or the start of the answer — with
234
- **Open page**, **Download** / **Copy** and a close button. A page that picks the
235
- job up itself (`jobs.attach(…).done`, `waitForJob`, `resumeChatStream`) takes
236
- over and the panel hides it. It speaks English, Korean, Vietnamese, Japanese and
237
- Chinese (from `<html lang>`, then the browser), follows the system light/dark
238
- setting, and never appears in a client constructed with `appSecret` or outside
239
- a browser.
240
-
241
- ```js
242
- // Move it, force a language, or turn it off for the whole page:
243
- AIFlowClient.configureBackgroundNotice({ position: 'bottom-right', locale: 'ko' });
244
- AIFlowClient.configureBackgroundNotice({ enabled: false });
245
- // also: new AIFlowClient({ ..., backgroundNotice: false })
246
- // or: window.__AIFLOW_BACKGROUND_NOTICE__ = false
247
- ```
228
+ page. A job still running joins the wait already open on the page, so it is
229
+ not polled twice.
248
230
 
249
231
  ### Job methods
250
232
 
@@ -255,7 +237,7 @@ AIFlowClient.configureBackgroundNotice({ enabled: false });
255
237
  | `resumeChatStream(jobId, { from?, signal? })` | Re-attach to a streamed chat answer: chunks from character `from` (the length already shown; `0` replays all of it), then live until done. |
256
238
  | `getJob(jobId, { waitMs? })` | One job now: `{ jobId, kind, status, tag?, prompt?, result?, error?, errorStatus?, errorCode? }`. |
257
239
  | `listJobs({ active?, limit? })` | The signed-in end user's own jobs on this module, from any device (needs `setEndUser(id, token)`; anonymous → `[]`). No results — read one with `waitForJob`. |
258
- | `jobs.latest(tag?)` / `jobs.list({ tag? })` / `jobs.forget(idOrTag)` | Jobs started from **this browser**, kept a day in localStorage: `{ jobId, kind, tag, status, result?, error?, page?, label? }`. Works without login. |
240
+ | `jobs.latest(tag?)` / `jobs.list({ tag? })` / `jobs.forget(idOrTag)` | Jobs started from **this browser**, kept a day in localStorage: `{ jobId, kind, tag, status, result?, error?, page? }`. Works without login. |
259
241
 
260
242
  A job whose server restarted mid-way fails with `code: 'interrupted'` (status
261
243
  503) and is not charged — credits are deducted only on success. `chat`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devvibex/aiflow",
3
- "version": "1.17.0",
3
+ "version": "1.17.2",
4
4
  "description": "First-party LLM gateway SDK for apps generated on the VibeX platform — chat, streaming, image, video (including stateful multi-turn video extension with Gemini Omni), music (Lyria), sound effects (ElevenLabs), embeddings and real-time speech translation (Gemini Live) without shipping any third-party API key.",
5
5
  "keywords": [
6
6
  "ai",
package/src/index.d.ts CHANGED
@@ -104,18 +104,6 @@ export interface RememberedJob {
104
104
  error?: string;
105
105
  /** The page that started it: path, plus the `#/…` route of a hash router (≥ 1.17.0). */
106
106
  page?: string;
107
- /** Prompt (or last user message), shortened — what the background notice shows. */
108
- label?: string;
109
- /** Background-notice bookkeeping (≥ 1.17.0). */
110
- bg?: 1;
111
- /** The user left its page while it ran. */
112
- orphaned?: boolean;
113
- /** It finished where a page showed it. */
114
- delivered?: boolean;
115
- /** The user closed its card in the notice. */
116
- dismissed?: boolean;
117
- /** Replaced by a re-run, or no longer readable — never shown. */
118
- hidden?: boolean;
119
107
  createdAt: number;
120
108
  updatedAt: number;
121
109
  }
@@ -132,8 +120,7 @@ export interface AttachedJob<T = any> {
132
120
  /**
133
121
  * Resolves with what the starting call resolved with — at once when it
134
122
  * already finished, else when it does (also after a page change or a
135
- * reload). Rejects with an AIFlowError when it failed. Reading it tells the
136
- * background notice that this page shows the job.
123
+ * reload). Rejects with an AIFlowError when it failed.
137
124
  */
138
125
  readonly done: Promise<T>;
139
126
  }
@@ -147,22 +134,11 @@ export interface JobsNamespace {
147
134
  forget(jobIdOrTag: string): void;
148
135
  /**
149
136
  * Pick a job up again on mount: the newest one with `tag` (with no tag,
150
- * the newest one started from the current page), or null. The page now
151
- * shows it, so the background notice hides it.
137
+ * the newest one started from the current page), or null.
152
138
  */
153
139
  attach<T = any>(tag?: string): AttachedJob<T> | null;
154
140
  }
155
141
 
156
- /** Page-wide settings for the background notice. */
157
- export interface BackgroundNoticeOptions {
158
- /** Default true in browsers. Also off when `window.__AIFLOW_BACKGROUND_NOTICE__ === false`. */
159
- enabled?: boolean;
160
- /** Default `'bottom-left'`. */
161
- position?: 'bottom-left' | 'bottom-right';
162
- /** `'en' | 'ko' | 'vi' | 'ja' | 'zh'`; default from `<html lang>`, then the browser. */
163
- locale?: string | null;
164
- }
165
-
166
142
  export type ChatRole = 'system' | 'user' | 'assistant';
167
143
 
168
144
  // ─── Multimodal content blocks ───────────────────────────────────────────────
@@ -1050,8 +1026,6 @@ export interface AIFlowClientOptions {
1050
1026
  timeout?: number;
1051
1027
  maxRetries?: number;
1052
1028
  fetch?: typeof fetch;
1053
- /** `false` turns off the background notice for the whole page. */
1054
- backgroundNotice?: boolean;
1055
1029
  }
1056
1030
 
1057
1031
  export interface AiflowConfig {
@@ -1214,13 +1188,6 @@ export class AIFlowClient {
1214
1188
 
1215
1189
  constructor(options: AIFlowClientOptions);
1216
1190
 
1217
- /**
1218
- * Configure the background notice for the whole page — the small panel
1219
- * that tells a user who left a page mid-generation that it keeps going,
1220
- * then shows the result with a way back to the page.
1221
- */
1222
- static configureBackgroundNotice(options: BackgroundNoticeOptions): void;
1223
-
1224
1191
  /**
1225
1192
  * Set (or clear with `null`) the current end user. Call after your app
1226
1193
  * authenticates a user, passing the user's id AND their access token (from
@@ -1376,7 +1343,6 @@ export class AIFlowClient {
1376
1343
  * that started it resolves with. Works after a reload or on another page.
1377
1344
  * Aborting `signal` / hitting `timeout` (default 30 min) stops only the
1378
1345
  * waiting. Throws an AIFlowError (`status`, `code`) when the job failed.
1379
- * The page now shows the job, so the background notice hides it.
1380
1346
  */
1381
1347
  waitForJob<T = any>(
1382
1348
  jobId: string,