@specstream/cli 0.1.0 → 0.2.1

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
@@ -10,6 +10,8 @@ specstream search "What is the latest stable release of PostgreSQL?"
10
10
 
11
11
  Or run it once without an install: `npx @specstream/cli search "..."`. The package has no dependencies and needs Node 20 or newer.
12
12
 
13
+ SpecStream is hosted in the EU and is first on 15 public search, research and extraction benchmarks: AA-Omniscience 82.67% on all 600 questions, SurfBench v2 84.6, WideSearch on all 200 official tasks over 4 trials, FRAMES 90.78% and TRACE Extract v6 88.51%. Scores and method: [specstream.ai/benchmarks](https://specstream.ai/benchmarks). Every raw answer: [Hugging Face](https://huggingface.co/datasets/SpecStreamAI/benchmark-results).
14
+
13
15
  ## Single binary
14
16
 
15
17
  No Node on the machine? Each release has one file per system, with nothing else to install:
@@ -23,7 +25,7 @@ No Node on the machine? Each release has one file per system, with nothing else
23
25
  | Windows x64 | `specstream-windows-x64.exe` |
24
26
 
25
27
  ```sh
26
- curl -fsSL -o specstream https://github.com/specstream/specstream-tools/releases/download/cli-v0.1.0/specstream-linux-x64
28
+ curl -fsSL -o specstream https://github.com/specstream/specstream-tools/releases/download/cli-v0.2.1/specstream-linux-x64
27
29
  chmod +x specstream
28
30
  ./specstream --version
29
31
  ```
@@ -36,9 +38,10 @@ chmod +x specstream
36
38
  specstream search "What is the latest stable release of PostgreSQL?"
37
39
  specstream search "open source vector databases" --fast --num 20
38
40
  specstream search "central bank rate decision" --news --country us --json
41
+ specstream search "PostgreSQL 18 release notes logical replication" --passages
39
42
  ```
40
43
 
41
- The Search API answers from the live web and prints the answer, the page it stands on, and the sources. The default search costs $5 per 1,000 searches of up to 10 results; `--fast` costs $1 per 1,000.
44
+ The Search API answers from the live web and prints the answer, the page it stands on, and the sources. The default search costs $5 per 1,000 searches of up to 10 results; `--fast` costs $1 per 1,000. `--passages` reads the pages and prints under each source the passages closest to the question, so an agent answers without opening a page; `--compact` prints one best snippet per source instead.
42
45
 
43
46
  ## Read pages
44
47
 
@@ -75,9 +78,19 @@ specstream deep rows <find_id> --all > rows.jsonl
75
78
 
76
79
  The command sends your requests to the SpecStream API and nowhere else. It writes no file and keeps no state.
77
80
 
81
+ ## Moving off Google Custom Search
82
+
83
+ Google ends its Custom Search JSON API for existing customers on January 1, 2027. SpecStream answers the same call in Google's shape, so the move is one line: change the base address from `https://www.googleapis.com` to `https://api.specstream.ai`.
84
+
85
+ ```bash
86
+ curl "https://api.specstream.ai/customsearch/v1?key=$SPECSTREAM_API_KEY&q=open+source+vector+databases&num=10"
87
+ ```
88
+
89
+ `items[].title`, `link`, `snippet` and `displayLink` come back as before. `cx` is accepted and not needed. Each call runs on the fast tier at $1 per 1,000, and the Extract API reads the pages at $0.80 per 1,000. Guide: [specstream.ai/migrate/google-custom-search](https://specstream.ai/migrate/google-custom-search).
90
+
78
91
  ## Pricing
79
92
 
80
- New accounts start with $10 of credit, no card. The Search API costs $5 per 1,000 searches of up to 10 results, or $1 on the fast tier, and the Extract API $0.80 per 1,000 pages. In Deep Search, a delivered result costs 5 cents, 15 cents or $1 depending on how many facts it carries. No result, no charge. See [pricing](https://specstream.ai/pricing).
93
+ New accounts start with $2 of credit, enough for 2,000 fast searches, no card. The Search API costs $5 per 1,000 searches of up to 10 results, or $1 on the fast tier, and the Extract API $0.80 per 1,000 pages. In Deep Search, a delivered result costs 5 cents, 15 cents or $1 depending on how many facts it carries. See [pricing](https://specstream.ai/pricing).
81
94
 
82
95
  ## Links
83
96
 
package/bin/specstream.js CHANGED
@@ -3,7 +3,7 @@
3
3
  // One file with no dependencies, so the npm package and the single binary (Node SEA) run the same code.
4
4
  "use strict";
5
5
 
6
- const VERSION = "0.1.0";
6
+ const VERSION = "0.2.1";
7
7
  const DEFAULT_BASE_URL = "https://api.specstream.ai";
8
8
  const KEY_HELP =
9
9
  "Set SPECSTREAM_API_KEY (or pass --api-key). Create a key under Agents & API at https://specstream.ai/workspace";
@@ -15,6 +15,8 @@ Usage:
15
15
  --fast the fast search ($1 per 1,000 searches; the default search is $5 per 1,000)
16
16
  --num <n> how many results (default 10)
17
17
  --news news results
18
+ --passages each source with its passages closest to the question, read from the page
19
+ --compact one best snippet per source, read from the page (not with --passages or --news)
18
20
  --country <cc> two-letter country --language <xx> two-letter language
19
21
  specstream read <url> [<url> ...] Extract API: the main text of up to 20 pages, PDF, Word or Excel
20
22
  --format <markdown|text> (default markdown)
@@ -38,7 +40,7 @@ ${KEY_HELP}
38
40
  const VALUE_FLAGS = new Set([
39
41
  "num", "country", "language", "format", "results", "max-cents", "key", "api-key", "base-url", "limit",
40
42
  ]);
41
- const SWITCHES = new Set(["fast", "news", "json", "all", "help", "version"]);
43
+ const SWITCHES = new Set(["fast", "news", "passages", "compact", "json", "all", "help", "version"]);
42
44
 
43
45
  class Usage extends Error {}
44
46
  class ApiError extends Error {
@@ -146,6 +148,9 @@ async function search(ctx, words, flags) {
146
148
  if (flags.fast) query.set("speed", "fast");
147
149
  if (flags.num !== undefined) query.set("num", String(wholeNumber(flags, "num", 10, 1, 100)));
148
150
  if (flags.news) query.set("news", "true");
151
+ if (flags.compact && (flags.passages || flags.news)) throw new Usage("--compact goes with neither --passages nor --news");
152
+ if (flags.passages) query.set("passages", "true");
153
+ if (flags.compact) query.set("compact", "true");
149
154
  if (flags.country) query.set("country", flags.country);
150
155
  if (flags.language) query.set("language", flags.language);
151
156
  const data = await ctx.api("GET", "/v1/web-search?" + query);
@@ -159,7 +164,9 @@ async function search(ctx, words, flags) {
159
164
  sources.forEach((source, index) => {
160
165
  ctx.out(`${index + 1}. ${source.title || source.url}`);
161
166
  ctx.out(` ${source.url}`);
162
- if (source.snippet) ctx.out(` ${String(source.snippet).replace(/\s+/g, " ").trim()}`);
167
+ const highlights = Array.isArray(source.highlights) ? source.highlights.filter(Boolean) : [];
168
+ if (highlights.length) highlights.forEach((text) => ctx.out(` > ${String(text).replace(/\s+/g, " ").trim()}`));
169
+ else if (source.snippet) ctx.out(` ${String(source.snippet).replace(/\s+/g, " ").trim()}`);
163
170
  });
164
171
  if (!sources.length && !(data.answer && data.answer.value)) ctx.err("No results.");
165
172
  if (typeof data.price_usd === "number") ctx.err(`$${data.price_usd} charged, ${data.took_ms} ms`);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@specstream/cli",
3
- "version": "0.1.0",
4
- "description": "The specstream command: web search, page reading and Deep Search from the terminal, with one key.",
3
+ "version": "0.2.1",
4
+ "description": "The specstream command: web search, page reading and Deep Search from the terminal, with one key. SpecStream is first on 15 public benchmarks: $1 per 1,000 fast searches, $0.80 per 1,000 pages read. $2 free credit, no card.",
5
5
  "bin": {
6
6
  "specstream": "bin/specstream.js"
7
7
  },