@flovialabs/sdk 0.1.8 → 0.1.9
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 +5 -0
- package/README.md +12 -3
- package/dist/cli.js +29 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.1.9
|
|
6
|
+
|
|
7
|
+
- `flovia tools <tool>` shows just one offered tool's full description and input schema. With `--json` it returns that tool object; the existing full catalog array is unchanged. This only reads the catalog.
|
|
8
|
+
- `flovia call <tool> -` reads a saved JSON object from stdin, keeping the operation ID and request unchanged. Invalid input stops before connecting. No automatic replay or new operation ID is added.
|
|
9
|
+
|
|
5
10
|
## 0.1.8
|
|
6
11
|
|
|
7
12
|
- Expect relay contract `2026-10-07.135`, which adds optional `fresh` input for Exa and Firecrawl. Identical requests by the same user can reuse a completed answer for 15 minutes; `fresh: true` asks for a new lookup. Recovery with the same operation id stays unchanged.
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ 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.
|
|
13
|
+
npm install --save-exact @flovialabs/sdk@0.1.9
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
## Your key
|
|
@@ -221,6 +221,7 @@ npx flovia status
|
|
|
221
221
|
npx flovia usage --days 3
|
|
222
222
|
npx flovia tools
|
|
223
223
|
npx flovia tools --json # includes each tool's inputSchema
|
|
224
|
+
npx flovia tools flovia_coingecko --json # only this tool's description and inputSchema
|
|
224
225
|
npx flovia call flovia_usage_today '{}'
|
|
225
226
|
npx flovia generate --op sdk-example-0001 --max-output 1000 --reasoning-effort low "Explain a DEX aggregator."
|
|
226
227
|
# Only to reopen that exact request within about 15 minutes (not a new generation):
|
|
@@ -228,11 +229,19 @@ npx flovia generate --op sdk-example-0001 --max-output 1000 --reasoning-effort l
|
|
|
228
229
|
npx flovia help
|
|
229
230
|
npx flovia --version
|
|
230
231
|
```
|
|
231
|
-
These commands run after installing `@flovialabs/sdk` in the current project. Without a local installation, specify the package: `npx --package=@flovialabs/sdk@0.1.
|
|
232
|
+
These commands run after installing `@flovialabs/sdk` in the current project. Without a local installation, specify the package: `npx --package=@flovialabs/sdk@0.1.9 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.
|
|
232
233
|
|
|
233
234
|
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.
|
|
234
235
|
|
|
235
|
-
For
|
|
236
|
+
For a data lookup, save its JSON object (including your chosen `operation_id`) in a private `request.json` before sending. Keep it out of Git and read it from stdin rather than quoting it in a shell argument:
|
|
237
|
+
|
|
238
|
+
```sh
|
|
239
|
+
flovia call flovia_coingecko - < request.json
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
This sends the saved request once. Reopening it uses the same file and operation ID; never create a new ID to recover a lost answer. The CLI does not invent or save an ID for `call`. Inspect the live `inputSchema` first, and follow any returned consent or recovery instructions. `tools <tool> --json` returns one tool object; `tools --json` keeps returning the full array. Neither executes a data lookup.
|
|
243
|
+
|
|
244
|
+
For multiline generation text, keep the original input in a private file:
|
|
236
245
|
|
|
237
246
|
```sh
|
|
238
247
|
flovia generate --new-op --max-output 1000 --reasoning-effort high --yes - < prompt.txt
|
package/dist/cli.js
CHANGED
|
@@ -14,8 +14,8 @@ const VERSION = String(JSON.parse(readFileSync(new URL("../package.json", import
|
|
|
14
14
|
const COMMANDS = {
|
|
15
15
|
status: { usage: "status", about: "usage windows, services, contract version and recent updates", flags: {} },
|
|
16
16
|
usage: { usage: "usage [--since ISO | --days N] [--cursor C]", about: "lookups and generations (today, or since a time within 7 days)", flags: { "--since": true, "--days": true, "--cursor": true } },
|
|
17
|
-
tools: { usage: "tools", about: "
|
|
18
|
-
call: { usage: "call <tool> ['<json args>']", about: "call
|
|
17
|
+
tools: { usage: "tools [tool]", about: "list offered tools, or inspect one tool's description and arguments", flags: {} },
|
|
18
|
+
call: { usage: "call <tool> ['<json args>' | -]", about: "call a tool; - reads a JSON object from stdin", flags: {} },
|
|
19
19
|
generate: { usage: "generate (--op ID | --new-op) [--max-output N]\n [--reasoning-effort LEVEL] [--yes] <prompt | ->", about: "a text generation (uses your free allowance, then your purchased balance)", flags: { "--op": true, "--new-op": false, "--max-output": true, "--reasoning-effort": true, "--yes": false } },
|
|
20
20
|
help: { usage: "help [command]", about: "this help", flags: {} },
|
|
21
21
|
version: { usage: "version", about: "the installed CLI version", flags: {} },
|
|
@@ -43,7 +43,9 @@ export function help(command) {
|
|
|
43
43
|
if (command === "generate")
|
|
44
44
|
lines.push("", "Default output limit: 1000 tokens; maximum: 4000.", "--reasoning-effort: none (default), low, medium, high, xhigh, max.", "Reasoning shares the output token limit; higher effort can leave less visible text.", "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.");
|
|
45
45
|
if (command === "tools" || c === undefined)
|
|
46
|
-
lines.push("", "Inspect tool arguments: flovia tools --json", "Read-only example: flovia call flovia_status '{}'");
|
|
46
|
+
lines.push("", "Inspect one tool: flovia tools <tool> --json", "Inspect all tool arguments: flovia tools --json", "Read-only example: flovia call flovia_status '{}'");
|
|
47
|
+
if (command === "call")
|
|
48
|
+
lines.push("", "Read a saved request: flovia call <tool> - < request.json", "Save the request and operation_id before sending a data lookup.", "To recover a lost reply, keep the same request and operation_id.", "Never create a new operation_id just to recover an answer.");
|
|
47
49
|
lines.push("", "Default base URL: https://api.flovia.dev.", "Exit codes: 0 ok, 1 error from Flovia, 2 usage error.", "");
|
|
48
50
|
return lines.join("\n");
|
|
49
51
|
}
|
|
@@ -301,17 +303,38 @@ export async function run(argv, io) {
|
|
|
301
303
|
return 0;
|
|
302
304
|
}
|
|
303
305
|
case "tools": {
|
|
306
|
+
const [name, extra] = p.positional;
|
|
307
|
+
if (extra !== undefined)
|
|
308
|
+
throw new Usage(`Usage: flovia ${COMMANDS["tools"]?.usage}`);
|
|
304
309
|
const client = await connect(), tools = await waitFor(() => client.listTools());
|
|
305
|
-
if (
|
|
310
|
+
if (name !== undefined) {
|
|
311
|
+
const tool = tools.find((t) => t.name === name);
|
|
312
|
+
if (tool === undefined)
|
|
313
|
+
throw new Usage("Tool is not offered to this key. Run: flovia tools");
|
|
314
|
+
if (json)
|
|
315
|
+
print(tool);
|
|
316
|
+
else
|
|
317
|
+
out(`${tool.name}\n${tool.description ?? ""}\n\nArguments (JSON Schema):\n${JSON.stringify(tool.inputSchema, null, 2)}\n`);
|
|
318
|
+
}
|
|
319
|
+
else if (json)
|
|
306
320
|
print(tools);
|
|
307
321
|
else
|
|
308
|
-
out(tools.map((t) => `${t.name}\n ${prose((t.description ?? "").split(/(?<=\.)\s/)[0] ?? "")}\n`).join("\n") + "\nArguments: flovia tools --json\nRead-only example: flovia call flovia_status '{}'\n");
|
|
322
|
+
out(tools.map((t) => `${t.name}\n ${prose((t.description ?? "").split(/(?<=\.)\s/)[0] ?? "")}\n`).join("\n") + "\nArguments: flovia tools <tool> --json\nRead-only example: flovia call flovia_status '{}'\n");
|
|
309
323
|
return 0;
|
|
310
324
|
}
|
|
311
325
|
case "call": {
|
|
312
|
-
const [tool,
|
|
326
|
+
const [tool, input, extra] = p.positional;
|
|
313
327
|
if (tool === undefined || extra !== undefined)
|
|
314
328
|
throw new Usage(`Usage: flovia ${COMMANDS["call"]?.usage}`);
|
|
329
|
+
let raw = input;
|
|
330
|
+
if (input === "-") {
|
|
331
|
+
try {
|
|
332
|
+
raw = await io.readStdin();
|
|
333
|
+
}
|
|
334
|
+
catch {
|
|
335
|
+
throw new Usage("call: cannot read JSON from stdin");
|
|
336
|
+
}
|
|
337
|
+
}
|
|
315
338
|
let args = {};
|
|
316
339
|
if (raw !== undefined)
|
|
317
340
|
try {
|
package/package.json
CHANGED