@flovialabs/sdk 0.1.18 → 0.1.19

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
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.19
4
+
5
+ - Expect contract `2026-10-07.182`. context.dev input refusals include a fixed `refusal_detail` or `url_problem` and a matching correction hint. URL privacy restrictions remain unchanged.
6
+ - Contract `2026-10-07.181`: MiniMax generation replies include `lookup_id: "minimax:<generation_id>"`. An `operation_conflict` names the original `generation_id` and explains how to reopen it for free; do not generate again with a new operation ID without the user's decision.
7
+
8
+ - 次版の想定契約を`2026-10-07.180`に更新。`flovia_status`の`fal`欄に、今日のジョブ数・状態別件数と購入残高から精算した額を追加する。plan credit・無料枠・未精算の予約は購入分に含めない。
9
+ - 次版の想定契約を`2026-10-07.179`に更新。`flovia_endpoints`の返答に、Nansenの終了chainの日付・対象・状態を示す`chain_retirements`欄を追加した契約に合わせる。
10
+ - `timeoutMs` must be more than 0 and at most 2147483647 ms, and `--timeout` at most 2147483 seconds (about 24.8 days). Longer values used to overflow Node's timer, so every request timed out after about 1 ms and was reported as `timeout` with `executed: "unknown"`. They are now refused before anything is sent (`invalid_timeout`, or a usage error in the CLI).
11
+
3
12
  ## 0.1.18
4
13
 
5
14
  - `flovia doctor [--client <name>] [--network]` checks, read-only, the Flovia entry in each client's personal settings: its URL, sign-in or key mode, and whether the key file is readable or the environment variable is set. It never writes, runs a client/helper or prints a key. Only the exact installer helper for the selected key path is checked; unknown helpers and unsafe environment references require manual inspection without key reads or network calls for that entry. A sign-in entry gets that client's command to sign in again after a revoked or expired sign-in. `--network` checks `/mcp` and accepts only Flovia-format keys for `flovia_status`; fetch and reply reading share the existing timeout. The exit code is 1 when a check fails. TOML/YAML inspection covers limited line-based forms, not a full parser.
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.18
13
+ npm install --save-exact @flovialabs/sdk@0.1.19
14
14
  ```
15
15
 
16
+ ## 0.1.19 release notes
17
+
18
+ This release expects contract `2026-10-07.182`, whose Relay replies include context.dev input-refusal details, MiniMax lookup IDs and conflict-recovery guidance, Nansen chain-retirement notices, and fal job counts with settled purchased-balance spend. The SDK also refuses timeout values that would overflow Node's timer before sending a request. Provider availability follows the Relay's current configuration.
19
+
16
20
  ## 0.1.18 release notes
17
21
 
18
22
  This release expects contract `2026-10-07.178`. It adds `flovia install --client` and the read-only `flovia doctor` command, lists up to 30 days of your usage history, and exports optional `ForUser` / `ReplyCharge` types for replies that include charge information. A missing charge is not zero. Replay and job snapshots must not be added as new calls. Earlier releases remain unchanged.
@@ -252,7 +256,7 @@ Do not answer these automatically from code or from an agent.
252
256
 
253
257
  ## Timeouts
254
258
 
255
- Each request times out after 300 seconds by default (a long generation can take minutes). Change it with `timeoutMs`. A timeout throws `FloviaError` with code `timeout` and `executed: "unknown"`.
259
+ Each request times out after 300 seconds by default (a long generation can take minutes). Change it with `timeoutMs` (more than 0, at most 2147483647 ms; `--timeout` at most 2147483 seconds). A timeout throws `FloviaError` with code `timeout` and `executed: "unknown"`.
256
260
 
257
261
  A lost or unreadable reply is also `executed: "unknown"`, even after HTTP 200. Keep the saved operation ID and request; do not start another operation to recover the answer. A retired operation is never treated as proof that nothing ran.
258
262
 
@@ -283,7 +287,7 @@ npx flovia agents-md # a short note for CLAUDE.md or AGENTS.md
283
287
  npx flovia help
284
288
  npx flovia --version
285
289
  ```
286
- These commands run after installing `@flovialabs/sdk` in the current project. Without a local installation, specify the package: `npx --package=@flovialabs/sdk@0.1.18 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.
290
+ These commands run after installing `@flovialabs/sdk` in the current project. Without a local installation, specify the package: `npx --package=@flovialabs/sdk@0.1.19 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.
287
291
 
288
292
  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.
289
293
 
package/dist/cli.js CHANGED
@@ -385,7 +385,8 @@ export async function run(argv, io) {
385
385
  let recoveryLimit;
386
386
  let recoveryEffort;
387
387
  try {
388
- const timeout = positiveInt("--timeout", str(p.flags.get("--timeout")));
388
+ // Seconds; the SDK's longest timer is 2^31 - 1 ms, so the CLI stops at 2147483 s.
389
+ const timeout = positiveInt("--timeout", str(p.flags.get("--timeout")), 2_147_483);
389
390
  const baseUrl = str(p.flags.get("--base-url"));
390
391
  // The key is read only after the command's own arguments are checked, so a usage mistake shows the usage line first.
391
392
  const connect = async () => {
package/dist/client.js CHANGED
@@ -4,6 +4,8 @@ import { EXPECTED_CONTRACT_VERSION } from "./types.js";
4
4
  const OPERATION_ID = /^[A-Za-z0-9_.:-]{8,128}$/;
5
5
  const RESEND_CODES = new Set(["rate_limited", "too_many_in_parallel", "reservation_changed"]);
6
6
  const MAX_RESEND_WAIT_S = 60;
7
+ /** The longest timer delay Node accepts (2^31 - 1 ms). */
8
+ const MAX_TIMEOUT_MS = 2_147_483_647;
7
9
  /** A new operation_id. Save it with the request before sending, so a lost reply can be reopened with the same id. */
8
10
  export const newOperationId = () => `op_${crypto.randomUUID()}`;
9
11
  const envKey = () => globalThis.process?.env?.["FLOVIA_KEY"];
@@ -60,7 +62,11 @@ export class FloviaClient {
60
62
  if (options.accessToken && (url.origin !== "https://dev.api.flovia.dev" || url.username || url.password))
61
63
  throw new FloviaError({ code: "invalid_base_url", executed: "no", message: "accessToken requires https://dev.api.flovia.dev." });
62
64
  this.#accessToken = options.accessToken;
63
- this.#timeoutMs = options.timeoutMs ?? 300_000;
65
+ const timeoutMs = options.timeoutMs ?? 300_000;
66
+ // Node's timers hold a signed 32-bit delay; a longer AbortSignal.timeout fires after 1 ms and would abort every request at once.
67
+ if (!Number.isInteger(timeoutMs) || timeoutMs <= 0 || timeoutMs > MAX_TIMEOUT_MS)
68
+ throw new FloviaError({ code: "invalid_timeout", executed: "no", message: `timeoutMs must be a whole number from 1 to ${MAX_TIMEOUT_MS} ms (about 24.8 days).` });
69
+ this.#timeoutMs = timeoutMs;
64
70
  this.#fetch = options.fetch ?? ((r) => fetch(r));
65
71
  this.#resend = options.retryRateLimited ?? false;
66
72
  // eslint-disable-next-line no-console -- versions only, never the key
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.178";
2
+ export declare const EXPECTED_CONTRACT_VERSION = "2026-10-07.182";
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", "consent_missing", "data_consent_mismatch", "data_consent_needed", "notice_first", "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", "request_text_too_long", "over_max_credits", "window_5h", "window_month", "window_week", "over_week", "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"];
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.178";
2
+ export const EXPECTED_CONTRACT_VERSION = "2026-10-07.182";
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", "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.18",
3
+ "version": "0.1.19",
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",