@flovialabs/sdk 0.1.25 → 0.1.27

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/CHANGELOG.md CHANGED
@@ -2,6 +2,26 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.1.27
6
+
7
+ - Expect Relay contract `2026-10-07.267`. Generated answers and reports are separate tools: `flovia_exa_answer`, `flovia_contextdev_answers`, `flovia_surf_research` and `flovia_parallel_responses` (which also takes `action: "decisions"`). They require `operation_id`. The old actions on `flovia_exa`, `flovia_contextdev`, `flovia_surf` and `flovia_parallel` still reopen an `operation_id` already used; a new one is refused unsent with `use_tool` naming the new tool.
8
+
9
+ - The MiniMax speech tool advertises its existing limit of 1,000 Unicode code points for text input.
10
+
11
+ - When OpenAI rejects input length, the Relay reports what to shorten. If fal rejects a request because the parallel limit is reached, `retry_after_seconds` tells you when to try again.
12
+
13
+ - Listed tool inputs use plain object schemas so model providers can accept the catalog. The Relay still checks the fields required for each action.
14
+
15
+ - `retryRateLimited` resends the request as it was first sent, even if the caller changes the arguments object meanwhile. `flovia_openai` is no longer resent: its refusal closes the `operation_id`, and the refusal itself is thrown.
16
+
17
+ - `call()` no longer returns a result the server marks as an error (`isError`) as a success when its text is not a refusal. It throws `tool_error` with `executed: "unknown"`.
18
+
19
+ ## 0.1.26
20
+
21
+ - Expect Relay contract `2026-10-07.262`. The SerpApi tool schema marks `operation_id` as required, matching Relay's existing requirement.
22
+ - `flovia_status` ignores unused arguments and accepts `"true"` and `"false"` as strings for `about_sharing`.
23
+ - The SDK passes through Zerion's `gas_prices`, `chain`, `dapps` and `dapp` actions. MiniMax image and video tools advertise the prompt length the Relay accepts. Tool availability follows the Relay's configuration and the account's access.
24
+
5
25
  ## 0.1.25
6
26
 
7
27
  - Expect Relay contract `2026-10-07.255`. The MiniMax tool schema advertises a maximum of 16,000 output tokens. `flovia_zerion` returns `next_cursor` for Zerion's longer page tokens, and its `cursor` accepts them. Where the Relay enables them, `flovia_parallel` and Venice Private chat are offered after the user accepts their own notices. Where enabled by the Relay, `flovia_fal` accepts a `model` for image creation. The available models and their costs depend on the Relay configuration.
package/README.md CHANGED
@@ -10,9 +10,17 @@ TypeScript client and command-line tool for [Flovia](https://api.flovia.dev). It
10
10
  ## Install
11
11
 
12
12
  ```sh
13
- npm install --save-exact @flovialabs/sdk@0.1.25
13
+ npm install --save-exact @flovialabs/sdk@0.1.27
14
14
  ```
15
15
 
16
+ ## 0.1.27 release notes
17
+
18
+ This release expects Relay contract `2026-10-07.267`. The MiniMax speech input schema shows its 1,000-character text limit. Use dedicated tools for generated answers and reports. When a fal request reaches the parallel limit, the Relay includes `retry_after_seconds`. See [CHANGELOG.md](CHANGELOG.md) for details.
19
+
20
+ ## 0.1.26 release notes
21
+
22
+ This release expects Relay contract `2026-10-07.262`. Pass an `operation_id` when calling `flovia_serpapi`. See [CHANGELOG.md](CHANGELOG.md) for the tool contract changes.
23
+
16
24
  ## 0.1.25 release notes
17
25
 
18
26
  This release expects Relay contract `2026-10-07.255`. `client.generate()` accepts `gpt-6.1-terra` when the Relay offers it; it accepts every reasoning effort and defaults to `none`. When `flovia key-caps set` cannot find the target key, scripts using `--json` receive exit status 1 and can read `outcome: "not_found"` from stdout. See [CHANGELOG.md](CHANGELOG.md) for the provider and CLI changes.
@@ -295,18 +303,18 @@ HTTP 401 with `code: "formal_registration_required"` means test access ended: re
295
303
 
296
304
  ### Notices and consent
297
305
 
298
- These two codes stop the call on purpose. Show the notice in full and follow `nextStep`; a separate explicit opt-in may be required. The SDK never consents for the person.
306
+ Follow the refusal’s `nextStep` (`next_step` in the CLI). The CLI’s `--json` output includes any notice returned in the reply. For the general data-use notice, direct the person to [Console](https://console.flovia.dev/groupbuy/). If they ask what Flovia shares, follow the chat steps in the refusal.
299
307
 
300
- 1. Show the full `error.reply.user_notice` unchanged (`error.reply.notice` for case reports), and `error.reply.consent.question` when present. For `data_consent_needed`, use `consent.line` when there is no question; the short question does not replace the notice.
301
- 2. For `data_consent_needed`, get the person's own answer through your normal flow. Follow `nextStep` for the consent tool: lookup consent uses `flovia_data_consent`; Runway uses `flovia_runway` with `action: "consent"`. Pass `answer` (`"y"` or `"n"` from that answer), `consent_version` from `error.reply.consent.version`, and `user_words` containing their actual words. Do not substitute the current SDK version or a generated answer. Case-report `notice_first` uses its own explicit opt-in and returned `consent_version`, not `flovia_data_consent`.
302
- 3. For `data_consent_needed`, repeat the unchanged call only after their `y` is accepted; with `n`, stop. For `notice_first`, show the notice and follow `nextStep`; add `notice_shown: true` only when requested. Never opt in to a report automatically.
308
+ 1. When the refusal directs you to collect an answer, show the full `error.reply.user_notice` unchanged and include `error.reply.consent.question` or `consent.line` if supplied.
309
+ 2. Use the consent tool named in the refusal. Runway uses `flovia_runway` with `action: "consent"`. Pass the person’s own `answer` (`"y"` or `"n"`), the returned `consent_version` (usually `error.reply.consent.version`), and their actual `user_words`. Repeat the unchanged call after the Relay accepts their `y`. Stop if they say `n`.
310
+ 3. For case-report `notice_first`, show `error.reply.notice` in full. Send the report text with `opt_in: true` and the returned `consent_version` only after the person explicitly opts in to that report.
303
311
 
304
- Do not answer these automatically from code or from an agent.
312
+ The SDK leaves the consent decision to the person.
305
313
 
306
314
  ## Retries
307
315
 
308
316
  - `client.generate()` (the HTTP generation route) is never resent automatically.
309
- - With `new FloviaClient({ retryRateLimited: true })`, a tool call refused with `rate_limited`, `too_many_in_parallel` or `reservation_changed` and `executed: "no"` is resent once, unchanged (same `operation_id`), after `retry_after_seconds` (at least 1 s, at most 60 s). Off by default. This covers generation tools called through `client.call()` (`flovia_openai`, `flovia_minimax`, `flovia_fal`) too: such a refusal means nothing ran and nothing was charged. `flovia_runway` is never resent.
317
+ - With `new FloviaClient({ retryRateLimited: true })`, a tool call refused with `rate_limited`, `too_many_in_parallel` or `reservation_changed` and `executed: "no"` is resent once, unchanged (same `operation_id`), after `retry_after_seconds` (at least 1 s, at most 60 s). Off by default. This covers generation tools called through `client.call()` (`flovia_minimax`, `flovia_fal`) too: such a refusal means nothing ran and nothing was charged. `flovia_runway` is never resent, nor is `flovia_openai`: its refusal closes the `operation_id`, so follow `nextStep`.
310
318
  - Anything with `executed: "unknown"` is not resent.
311
319
 
312
320
  ## Timeouts
@@ -323,6 +331,8 @@ A lost or unreadable reply is also `executed: "unknown"`, even after HTTP 200. K
323
331
 
324
332
  The package installs a `flovia` command.
325
333
 
334
+ On `https://api.flovia.dev`, the account settings reads (`flovia consent`, `flovia key-caps` and `flovia spend-mode`) currently return HTTP 404. The equivalent SDK methods use the same routes. Review account notices in [Console](https://console.flovia.dev/groupbuy/). For a consent-related tool refusal, follow its `nextStep` (`next_step` in the CLI).
335
+
326
336
  ```sh
327
337
  export FLOVIA_KEY=flv_... # or: --key-file ~/.config/flovia/key
328
338
  npx flovia status
@@ -352,7 +362,7 @@ npx flovia agents-md # a short note for CLAUDE.md or AGENTS.md
352
362
  npx flovia help
353
363
  npx flovia --version
354
364
  ```
355
- These commands run after installing `@flovialabs/sdk` in the current project. Without a local installation, specify the package: `npx --package=@flovialabs/sdk@0.1.25 flovia --help`. Use a unique operation id for each new request; `sdk-example-0001` is only an example. Save the id, prompt and options before sending, and keep them unchanged for replay.
365
+ These commands run after installing `@flovialabs/sdk` in the current project. Without a local installation, specify the package: `npx --package=@flovialabs/sdk@0.1.27 flovia --help`. Use a unique operation id for each new request; `sdk-example-0001` is only an example. Save the id, prompt and options before sending, and keep them unchanged for replay.
356
366
 
357
367
  Get or manage your key in [Console](https://console.flovia.dev/groupbuy/), save it privately, then run `flovia status --key-file <saved-key-file>`. A connected key can still have sharing declined, withdrawn or stopped; `status` shows those separately from provider availability. It never answers consent for you.
358
368
 
package/dist/client.d.ts CHANGED
@@ -11,9 +11,9 @@ export interface FloviaClientOptions {
11
11
  fetch?: (request: Request) => Promise<Response>;
12
12
  /**
13
13
  * Resend a tool call once, unchanged (same operation_id), after rate_limited, too_many_in_parallel or reservation_changed with executed
14
- * "no", when the wait is at most 60 s; it waits at least 1 s. Off by default. It applies to every call() tool except flovia_runway, so a
15
- * refused generation tool (flovia_openai, flovia_minimax, flovia_fal) can be resent once: only after a refusal where nothing
16
- * ran and nothing was charged. generate() (HTTP) is never resent automatically.
14
+ * "no", when the wait is at most 60 s; it waits at least 1 s. Off by default. It applies to every call() tool except flovia_runway and
15
+ * flovia_openai (whose refusal closes its operation_id), so a refused flovia_minimax or flovia_fal can be resent once: only after a
16
+ * refusal where nothing ran and nothing was charged. generate() (HTTP) is never resent automatically.
17
17
  */
18
18
  retryRateLimited?: boolean;
19
19
  /** Called once when flovia_status reports another contract version. Defaults to console.warn. */
package/dist/client.js CHANGED
@@ -7,6 +7,8 @@ import { downloadRunwayOutput } from "./runwayoutput.js";
7
7
  import {} from "./transport.js";
8
8
  import { EXPECTED_CONTRACT_VERSION } from "./types.js";
9
9
  const RESEND_CODES = new Set(["rate_limited", "too_many_in_parallel", "reservation_changed"]);
10
+ /** Never resent: a Runway call is not repeated automatically, and an OpenAI refusal closes its operation_id (the same id cannot run again). */
11
+ const NOT_RESENT = new Set(["flovia_runway", "flovia_openai"]);
10
12
  const MAX_RESEND_WAIT_S = 60;
11
13
  /** The longest timer delay Node accepts (2^31 - 1 ms). */
12
14
  const MAX_TIMEOUT_MS = 2_147_483_647;
@@ -147,8 +149,14 @@ export class FloviaClient {
147
149
  /** tools/call for any tool. A reply with ok: false throws FloviaError (handshakes such as notice_first too; see error.reply). */
148
150
  async call(tool, args = {}) {
149
151
  const operationId = typeof args["operation_id"] === "string" ? args["operation_id"] : null;
152
+ // Read once: a resend is the same request even if the caller changes its object meanwhile.
153
+ let sent = args;
154
+ try {
155
+ sent = JSON.parse(JSON.stringify(args));
156
+ }
157
+ catch { /* a value JSON cannot hold: #send refuses it, unsent */ }
150
158
  for (let attempt = 0;; attempt++) {
151
- const result = await this.#rpc("tools/call", { name: tool, arguments: args }, operationId);
159
+ const result = await this.#rpc("tools/call", { name: tool, arguments: sent }, operationId);
152
160
  const text = result.content?.[0]?.text;
153
161
  let reply;
154
162
  try {
@@ -156,6 +164,9 @@ export class FloviaClient {
156
164
  if (reply === null || typeof reply !== "object" || Array.isArray(reply) || (reply.ok === false &&
157
165
  (reply.explanation === null || typeof reply.explanation !== "object")))
158
166
  throw new Error("invalid tool reply");
167
+ // A result the server marks as an error is never a success, whatever its text holds.
168
+ if (result.isError === true && reply.ok !== false)
169
+ throw new Error("error result without a refusal");
159
170
  if (reply.ok === false) {
160
171
  const e = reply.explanation;
161
172
  if (Array.isArray(e) || typeof e?.code !== "string" || typeof e.meaning !== "string" || typeof e.next_step !== "string" ||
@@ -172,7 +183,7 @@ export class FloviaClient {
172
183
  return reply;
173
184
  const wait = seconds(reply.retry_after_seconds);
174
185
  // Only a refusal that surely did not run; at least 1 s apart, so a missing or 0 wait never resends at once.
175
- if (tool !== "flovia_runway" && this.#resend && attempt === 0 && e.executed === "no" && RESEND_CODES.has(e.code) && (wait ?? 0) <= MAX_RESEND_WAIT_S) {
186
+ if (!NOT_RESENT.has(tool) && this.#resend && attempt === 0 && e.executed === "no" && RESEND_CODES.has(e.code) && (wait ?? 0) <= MAX_RESEND_WAIT_S) {
176
187
  await sleep(Math.max(1, wait ?? 0) * 1000);
177
188
  continue;
178
189
  }
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /** The relay's tool contract this SDK was written against (flovia_status.contract_version). */
2
- export declare const EXPECTED_CONTRACT_VERSION = "2026-10-07.255";
2
+ export declare const EXPECTED_CONTRACT_VERSION = "2026-10-07.267";
3
3
  /** Every public explanation.code (the relay's contract). A provider's own HTTP error is `http_<status>`. */
4
4
  export declare const PUBLIC_CODES: readonly ["approval_pending", "key_disabled", "key_stopped", "team_stopped", "consent_missing", "data_consent_mismatch", "data_consent_needed", "notice_first", "elevenlabs_terms_required", "provider_not_allowed", "account_key_required", "endpoint_unknown", "endpoint_disabled", "read_only", "not_relayed", "key_in_query", "secret_in_input", "invalid_body", "body_too_large", "answer_too_large", "answer_precision_unsafe", "answer_not_relayed", "output_withheld", "request_text_too_long", "over_max_credits", "window_5h", "window_month", "window_week", "over_week", "free_only_exhausted", "key_cap_reached", "member_cap_reached", "team_balance_empty", "free_limited", "free_needs_email", "free_not_granted", "global_cap", "flovia_paused", "rate_limited", "too_many_in_parallel", "reservation_changed", "operation_conflict", "operation_pending", "relay_internal_error", "relay_internal_unknown", "upstream_unknown", "cannot_summarize", "upstream_unavailable", "page_tls_invalid", "page_unreachable", "replay_response_unavailable", "rpc_error", "unknown_lookup", "invalid_cursor", "since_too_old", "since_in_future", "feedback_too_long", "feedback_limit", "not_configured", "service_off", "queue_full", "input_unavailable", "sandbox_disabled", "team_feature_off", "purchase_refused", "team_purchase_not_supported"];
5
5
  export type FloviaCode = (typeof PUBLIC_CODES)[number] | `http_${number}`;
package/dist/types.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /** The relay's tool contract this SDK was written against (flovia_status.contract_version). */
2
- export const EXPECTED_CONTRACT_VERSION = "2026-10-07.255";
2
+ export const EXPECTED_CONTRACT_VERSION = "2026-10-07.267";
3
3
  /** Every public explanation.code (the relay's contract). A provider's own HTTP error is `http_<status>`. */
4
4
  export const PUBLIC_CODES = [
5
5
  "approval_pending", "key_disabled", "key_stopped", "team_stopped", "consent_missing", "data_consent_mismatch", "data_consent_needed", "notice_first",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flovialabs/sdk",
3
- "version": "0.1.25",
3
+ "version": "0.1.27",
4
4
  "type": "module",
5
5
  "description": "TypeScript client and CLI for Flovia: MCP tools over HTTP and OpenAI-compatible generation. Zero dependencies.",
6
6
  "license": "MIT",