@flovialabs/sdk 0.1.27 → 0.1.28

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,16 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.1.28
6
+
7
+ - Expect Relay contract `2026-10-07.268`. Tool schemas list `operation_id` as required for each paid action, matching what the Relay already checks. Calls that already send `operation_id` work as before.
8
+
9
+ - `flovia doctor` reports a retired test key as rejected instead of passing it.
10
+
11
+ - When a Runway download is refused, the SDK cancels the response body instead of leaving it open.
12
+
13
+ - When the server does not serve an account settings route (HTTP 404), `flovia consent`, `flovia spend-mode`, `flovia key-caps` and the SDK methods say so and name what to use instead. `flovia help generate` points to `flovia status --json` for spending settings.
14
+
5
15
  ## 0.1.27
6
16
 
7
17
  - 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.
package/README.md CHANGED
@@ -10,9 +10,13 @@ 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.27
13
+ npm install --save-exact @flovialabs/sdk@0.1.28
14
14
  ```
15
15
 
16
+ ## 0.1.28 release notes
17
+
18
+ This release expects Relay contract `2026-10-07.268`. Tool schemas mark `operation_id` as required for paid actions. When an account settings route is not served, the CLI and SDK say so and name what to use instead. See [CHANGELOG.md](CHANGELOG.md) for details.
19
+
16
20
  ## 0.1.27 release notes
17
21
 
18
22
  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.
@@ -331,7 +335,7 @@ A lost or unreadable reply is also `executed: "unknown"`, even after HTTP 200. K
331
335
 
332
336
  The package installs a `flovia` command.
333
337
 
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).
338
+ On `https://api.flovia.dev`, the account settings reads (`flovia consent`, `flovia key-caps` and `flovia spend-mode`) and their writes currently return HTTP 404. The command says so and names what to use instead. 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
339
 
336
340
  ```sh
337
341
  export FLOVIA_KEY=flv_... # or: --key-file ~/.config/flovia/key
@@ -362,7 +366,7 @@ npx flovia agents-md # a short note for CLAUDE.md or AGENTS.md
362
366
  npx flovia help
363
367
  npx flovia --version
364
368
  ```
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.
369
+ These commands run after installing `@flovialabs/sdk` in the current project. Without a local installation, specify the package: `npx --package=@flovialabs/sdk@0.1.28 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.
366
370
 
367
371
  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.
368
372
 
package/dist/account.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import { FloviaError } from "./errors.js";
2
2
  import { readReply, relayNextStep } from "./reply.js";
3
+ import { CONSOLE } from "./output.js";
3
4
  export async function bankedResets(t) {
4
5
  const r = await t.send("/account/banked-resets", null, {}, null, "GET");
5
- const body = await account(t, r, null);
6
+ const body = await account(t, "/account/banked-resets", r, null);
6
7
  if (!isResets(body))
7
8
  throw t.error({ code: "invalid_reply", status: r.status, executed: "no", message: "The saved-reset reply was not in the expected form.", nextStep: null });
8
9
  return { available: body.available, next: body.next, ...(body.resets === undefined ? {} : { resets: body.resets }) };
@@ -18,7 +19,7 @@ export async function useBankedReset(t, grantId) {
18
19
  }
19
20
  export async function consent(t) {
20
21
  const r = await t.send("/account/consent", null, {}, null, "GET");
21
- const body = await account(t, r, null);
22
+ const body = await account(t, "/account/consent", r, null);
22
23
  if (!isConsent(body))
23
24
  throw t.error({ code: "invalid_reply", status: r.status, executed: "no", message: "The consent reply was not in the expected form.", nextStep: null });
24
25
  return { version: body.version, answered_version: body.answered_version, needed: body.needed, updated: body.updated, notice: body.notice };
@@ -34,7 +35,7 @@ export async function acceptConsent(t, version) {
34
35
  }
35
36
  export async function keyCaps(t) {
36
37
  const r = await t.send("/account/key-caps", null, {}, null, "GET");
37
- const body = await account(t, r, null);
38
+ const body = await account(t, "/account/key-caps", r, null);
38
39
  if (!Array.isArray(body["keys"]))
39
40
  throw t.error({ code: "invalid_reply", status: r.status, executed: "no", message: "The key-caps reply was not in the expected form.", nextStep: null });
40
41
  return { keys: body["keys"] };
@@ -57,7 +58,7 @@ export async function spendMode(t, mode) {
57
58
  let r, body;
58
59
  if (mode === undefined) {
59
60
  r = await t.send("/account/spend-mode", null, {}, null, "GET");
60
- body = await account(t, r, null);
61
+ body = await account(t, "/account/spend-mode", r, null);
61
62
  }
62
63
  else
63
64
  ({ r, body } = await write(t, "/account/spend-mode", { mode }, check));
@@ -78,9 +79,15 @@ async function write(t, path, payload, check) {
78
79
  throw e instanceof FloviaError && (e.executed === "unknown" || e.status === 401) ? t.error({ code: e.code, status: e.status, executed: "unknown", message: e.message,
79
80
  nextStep: e.nextStep && e.executed !== "unknown" ? `${check} ${e.nextStep}` : check }) : e;
80
81
  }
81
- return { r, body: await account(t, r, check) };
82
+ return { r, body: await account(t, path, r, check) };
82
83
  }
83
- async function account(t, r, unknownStep) {
84
+ /** Account settings a Flovia server may not serve yet (api.flovia.dev answers 404). What to use instead; Console has no spend mode or key cap setting. */
85
+ const UNSERVED = {
86
+ consent: `Read and answer Flovia's main notice in Console: ${CONSOLE} For a refused tool call, follow that refusal's next_step.`,
87
+ "spend-mode": `Read it with flovia status --json (spend_mode); your balance and plan are in Console: ${CONSOLE} Changing it is not available on this server or in Console.`,
88
+ "key-caps": `Read set caps with flovia status --json (api_key_caps); your keys are in Console: ${CONSOLE} Changing caps is not available on this server or in Console.`,
89
+ };
90
+ async function account(t, path, r, unknownStep) {
84
91
  let body;
85
92
  try {
86
93
  body = await readReply(r, null, init => t.error(init));
@@ -90,6 +97,10 @@ async function account(t, r, unknownStep) {
90
97
  }
91
98
  if (r.status === 200)
92
99
  return body;
100
+ const unserved = r.status === 404 && body["error"] === "not_found" ? UNSERVED[path.split("/")[2] ?? ""] : undefined;
101
+ if (unserved)
102
+ throw t.error({ code: "not_found", status: 404, executed: "no",
103
+ message: `This Flovia server does not serve ${path} (HTTP 404), so this setting cannot be read or changed here. Nothing was changed, and your key was not the cause.`, nextStep: unserved });
93
104
  throw t.error({ code: typeof body["error"] === "string" ? body["error"] : `http_${r.status}`, status: r.status, executed: r.status >= 500 && unknownStep !== null ? "unknown" : "no",
94
105
  message: typeof body["message"] === "string" ? body["message"] : `HTTP ${r.status}`, nextStep: r.status >= 500 ? unknownStep : relayNextStep(body) });
95
106
  }
@@ -30,7 +30,7 @@ export function help(command) {
30
30
  ...Object.values(COMMANDS).flatMap((x) => [` ${x.usage}`, ` ${x.about}`])] : [`Usage: flovia ${c.usage}`, ` ${c.about}`];
31
31
  lines.push("", "Options: " + GLOBAL, "", `Get or manage your key: ${CONSOLE}`, "Save the key privately, then: flovia status --key-file <saved-key-file>", "Or set FLOVIA_KEY, or save it to ~/.config/flovia/key.", "Never paste the key into a command argument.");
32
32
  if (command === "generate")
33
- lines.push("", "Default output limit: 1000 tokens; maximum: 16000.", "--reasoning-effort: none (default), low, medium, high, xhigh, max.", "Reasoning shares the output token limit; higher effort can leave less visible text.", "Check spending settings with flovia spend-mode and flovia key-caps.", "Long answers can take minutes. Save the id, same input, output limit and effort.", " flovia generate --new-op --reasoning-effort high --yes - < prompt.txt", "Replay only: replace --new-op with --op <saved-id>; keep everything else.", "Use -- before a prompt that starts with a hyphen.");
33
+ lines.push("", "Default output limit: 1000 tokens; maximum: 16000.", "--reasoning-effort: none (default), low, medium, high, xhigh, max.", "Reasoning shares the output token limit; higher effort can leave less visible text.", "Check spending settings with flovia status --json (spend_mode, api_key_caps).", "Long answers can take minutes. Save the id, same input, output limit and effort.", " flovia generate --new-op --reasoning-effort high --yes - < prompt.txt", "Replay only: replace --new-op with --op <saved-id>; keep everything else.", "Use -- before a prompt that starts with a hyphen.");
34
34
  if (command === "tools" || c === undefined)
35
35
  lines.push("", "Inspect one tool: flovia tools <tool> --json", "Inspect all tool arguments: flovia tools --json", "Read-only example: flovia call flovia_status '{}'");
36
36
  if (command === "resets")
@@ -67,9 +67,11 @@ export async function doctor(p, io, out, json, remember, o, fromFile, DEFAULT_KE
67
67
  r.checks.push({ name: "key accepted", result: "ok", detail: "flovia_status answered with this key" });
68
68
  }
69
69
  catch (e) {
70
- if (e instanceof FloviaError && (e.code === "unauthorized" || e.code === "key_disabled" || e.code === "key_stopped")) {
70
+ const needsRegistration = e instanceof FloviaError && e.status === 401 && e.code === "formal_registration_required";
71
+ if (e instanceof FloviaError && (needsRegistration || e.code === "unauthorized" || e.code === "key_disabled" || e.code === "key_stopped")) {
71
72
  r.checks.push({ name: "key accepted", result: "fail", detail: `Flovia refused this key (${e.code})` });
72
- r.next.push(`Issue or re-enable a key in Console (${CONSOLE}), save it, then restart ${r.client}.`);
73
+ r.next.push(needsRegistration && e.nextStep
74
+ ? e.nextStep : `Issue or re-enable a key in Console (${CONSOLE}), save it, then restart ${r.client}.`);
73
75
  }
74
76
  else
75
77
  r.checks.push({ name: "key accepted", result: "warn", detail: e instanceof FloviaError ? `flovia_status answered ${e.code}` : "flovia_status could not be reached" });
@@ -8,8 +8,11 @@ export async function downloadRunwayOutput(t, generationId) {
8
8
  const response = await t.send("/mcp?runway_output=" + generationId, null, { Accept: "image/png, image/jpeg, image/webp, video/mp4" }, null, "GET");
9
9
  const contentType = response.headers.get("Content-Type"), declared = response.headers.get("Content-Length"), length = declared === null ? null : Number(declared), limit = 32 * 1024 * 1024;
10
10
  if (response.status !== 200 || !response.body || contentType === null || !["image/png", "image/jpeg", "image/webp", "video/mp4"].includes(contentType ?? "") ||
11
- length !== null && (!Number.isSafeInteger(length) || length < 1 || length > limit))
11
+ length !== null && (!Number.isSafeInteger(length) || length < 1 || length > limit)) {
12
+ // A custom transport may leave cancellation pending.
13
+ void response.body?.cancel().catch(() => { });
12
14
  throw unavailable();
15
+ }
13
16
  reader = response.body.getReader();
14
17
  const chunks = [];
15
18
  let size = 0;
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.267";
2
+ export declare const EXPECTED_CONTRACT_VERSION = "2026-10-07.268";
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.267";
2
+ export const EXPECTED_CONTRACT_VERSION = "2026-10-07.268";
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.27",
3
+ "version": "0.1.28",
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",