@specstream/sdk 1.1.1 → 1.3.0
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 +28 -3
- package/dist/index.d.ts +36 -2
- package/dist/index.js +49 -3
- package/dist/work-types.d.ts +223 -9
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# @specstream/sdk
|
|
2
2
|
|
|
3
|
-
TypeScript client for [SpecStream](https://specstream.ai), the live web data engine for teams and agents. Describe the list you need in plain words; SpecStream reads the web where those things live, hands back only the matches,
|
|
3
|
+
TypeScript client for [SpecStream](https://specstream.ai), the live web data engine for teams and agents. Describe the list you need in plain words; SpecStream reads the web where those things live, hands back only the matches, and you pay for each result delivered.
|
|
4
|
+
|
|
5
|
+
Source URL and read time on every value.
|
|
4
6
|
|
|
5
7
|
The client has no runtime dependencies and needs Node 22 or newer. It uses the same account, permissions, projects and balance as the workspace.
|
|
6
8
|
|
|
@@ -10,6 +12,29 @@ npm install @specstream/sdk
|
|
|
10
12
|
|
|
11
13
|
Create an API key under **Agents & API** in your SpecStream workspace and keep it in the environment: `SPECSTREAM_API_KEY`.
|
|
12
14
|
|
|
15
|
+
## Search API and Extract API
|
|
16
|
+
|
|
17
|
+
SpecStream has three products: Search API, Extract API and Deep Search. The first two take one call at a flat price, with no quote or approval. The sections after this one cover Deep Search.
|
|
18
|
+
|
|
19
|
+
`client.webSearch` calls the [Search API](https://specstream.ai/docs/search-api), `GET /v1/web-search`, at $5 per 1,000 searches. It is the most accurate web search API in the world ([benchmarks](https://specstream.ai/benchmarks)) and answers from the live web in a few seconds. Write `q` in everyday words, in any language.
|
|
20
|
+
|
|
21
|
+
`client.extractPages` calls the [Extract API](https://specstream.ai/docs/extract-api), `POST /v1/extract`, at $0.80 per 1,000 pages. It takes up to 20 URLs a call, reads web pages, PDF, Word and Excel, and returns each one's main text as `markdown` (the default) or `text`. A page with no text is free.
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { Client } from "@specstream/sdk";
|
|
25
|
+
|
|
26
|
+
const client = new Client({ apiKey: process.env.SPECSTREAM_API_KEY! });
|
|
27
|
+
|
|
28
|
+
const search = await client.webSearch({ q: "What is the latest stable release of PostgreSQL?" });
|
|
29
|
+
console.log(search.answer?.value, search.answer?.page);
|
|
30
|
+
|
|
31
|
+
const extract = await client.extractPages({
|
|
32
|
+
urls: search.sources.slice(0, 5).map((source) => source.url),
|
|
33
|
+
format: "markdown",
|
|
34
|
+
});
|
|
35
|
+
for (const page of extract.results) console.log(page.url, page.status, page.text);
|
|
36
|
+
```
|
|
37
|
+
|
|
13
38
|
## Read a request, get the price
|
|
14
39
|
|
|
15
40
|
```ts
|
|
@@ -59,12 +84,12 @@ If the response is lost, `getCapacityRequest(savedRequestKey)` returns the same
|
|
|
59
84
|
|
|
60
85
|
## Pricing
|
|
61
86
|
|
|
62
|
-
New accounts start with $10 of
|
|
87
|
+
New accounts start with $10 of credit for 30 days, no card. The Search API costs $5 per 1,000 searches 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).
|
|
63
88
|
|
|
64
89
|
## Links
|
|
65
90
|
|
|
66
91
|
- [SDK docs](https://specstream.ai/docs/sdk) and [API docs](https://specstream.ai/docs/api)
|
|
67
|
-
- [Source and issues](https://github.com/
|
|
92
|
+
- [Source and issues](https://github.com/specstream/specstream-tools)
|
|
68
93
|
- [Python client](https://pypi.org/project/specstream-client/)
|
|
69
94
|
- Support: support@specstream.ai
|
|
70
95
|
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
import type { Schemas } from "./work-types.js";
|
|
3
3
|
export type { Schemas } from "./work-types.js";
|
|
4
4
|
export declare const FAMILIES: readonly ["local_business", "creator", "organization", "storefront_product", "app_listing", "job_posting", "scholarly_work", "tender", "grant", "software_repository", "software_package", "dataset", "clinical_trial", "regulatory_document", "vulnerability", "book", "podcast", "web_page", "knowledge_entity", "person"];
|
|
5
|
-
|
|
5
|
+
/** A record kind the service names today. FAMILIES lists them; they are examples, not a limit. */
|
|
6
|
+
export type KnownEntityType = (typeof FAMILIES)[number];
|
|
7
|
+
/** A record kind is an open string: any kind name a reading gives is valid. */
|
|
8
|
+
export type EntityType = KnownEntityType | (string & {});
|
|
6
9
|
export declare const DEFAULT_BASE_URL = "https://api.specstream.ai";
|
|
7
10
|
export declare class SpecstreamError extends Error {
|
|
8
11
|
readonly status: number | null;
|
|
@@ -28,7 +31,7 @@ export declare class Client {
|
|
|
28
31
|
private readonly exportOrigin?;
|
|
29
32
|
private readonly timeoutMs;
|
|
30
33
|
constructor(options: ClientOptions);
|
|
31
|
-
families(): readonly
|
|
34
|
+
families(): readonly KnownEntityType[];
|
|
32
35
|
compile(q: string, locale?: string): Promise<JsonMap>;
|
|
33
36
|
editSpec(ast: JsonMap, operations?: JsonMap[]): Promise<JsonMap>;
|
|
34
37
|
specOptions(target: string): Promise<JsonMap>;
|
|
@@ -52,6 +55,17 @@ export declare class Client {
|
|
|
52
55
|
"limit"?: number;
|
|
53
56
|
"cursor"?: string;
|
|
54
57
|
}): Promise<Schemas["WorkspaceSearchPage"]>;
|
|
58
|
+
webSearch(query: {
|
|
59
|
+
"q": string;
|
|
60
|
+
"passages"?: boolean;
|
|
61
|
+
}): Promise<Schemas["WebSearchPage"]>;
|
|
62
|
+
extractPages(request: Schemas["ExtractRequest"]): Promise<Schemas["ExtractPage"]>;
|
|
63
|
+
webSearchAnswers(query?: {
|
|
64
|
+
"q"?: string;
|
|
65
|
+
"limit"?: number;
|
|
66
|
+
"cursor"?: string;
|
|
67
|
+
}): Promise<Schemas["WebSearchAnswerPage"]>;
|
|
68
|
+
webSearchAnswer(answerId: string): Promise<Schemas["WebSearchAnswer"]>;
|
|
55
69
|
workspaceListNotifications(query?: {
|
|
56
70
|
"tab"?: "all" | "unread" | "archived";
|
|
57
71
|
"limit"?: number;
|
|
@@ -139,11 +153,30 @@ export declare class Client {
|
|
|
139
153
|
quoteCapacityWork(request: Schemas["CapacityQuoteRequest"]): Promise<Schemas["CapacityQuoteData"]>;
|
|
140
154
|
getCapacityQuote(quoteId: string): Promise<Schemas["CapacityQuoteData"]>;
|
|
141
155
|
authorizeCapacityWork(request: Schemas["CapacityAuthorizeRequest"]): Promise<Schemas["CapacityExecutionData"]>;
|
|
156
|
+
startCapacityRequest(request: Schemas["CapacityStartRequest"]): Promise<Schemas["CapacityStartData"]>;
|
|
142
157
|
getCapacityRequest(requestKey: string, query?: {
|
|
143
158
|
"project_id"?: string;
|
|
144
159
|
}): Promise<{
|
|
145
160
|
[key: string]: unknown;
|
|
146
161
|
}>;
|
|
162
|
+
getCapacityRequestRows(requestKey: string, query?: {
|
|
163
|
+
"project_id"?: string;
|
|
164
|
+
"cursor"?: string;
|
|
165
|
+
"limit"?: number;
|
|
166
|
+
"format"?: "json" | "markdown" | "csv";
|
|
167
|
+
}): Promise<({
|
|
168
|
+
[key: string]: unknown;
|
|
169
|
+
} | {
|
|
170
|
+
"format": "markdown" | "csv";
|
|
171
|
+
"columns": Array<{
|
|
172
|
+
"column_id": string;
|
|
173
|
+
"label": string;
|
|
174
|
+
}>;
|
|
175
|
+
"table": string;
|
|
176
|
+
"find_id"?: (string | null);
|
|
177
|
+
"accepted_count"?: number;
|
|
178
|
+
"next_cursor"?: (string | null);
|
|
179
|
+
})>;
|
|
147
180
|
getCapacityExecution(findId: string): Promise<Schemas["CommerceData"]>;
|
|
148
181
|
createCapacityFunding(request: Schemas["CapacityFundingRequest"]): Promise<Schemas["CapacityFundingData"]>;
|
|
149
182
|
getCapacityFunding(fundingId: string): Promise<Schemas["CapacityFundingData"]>;
|
|
@@ -269,6 +302,7 @@ export declare class Client {
|
|
|
269
302
|
"field_id"?: string;
|
|
270
303
|
}): Promise<Schemas["RelationshipData"]>;
|
|
271
304
|
workspaceSaveRelationships(collectionId: string, request: Schemas["RelationshipSelection"]): Promise<Schemas["RelationshipData"]>;
|
|
305
|
+
workspaceShareCollection(collectionId: string, request: Schemas["CollectionShareInput"]): Promise<Schemas["CollectionShareData"]>;
|
|
272
306
|
workspaceReportResult(collectionId: string, request: Schemas["ResultReportInput"]): Promise<Schemas["ResultReportData"]>;
|
|
273
307
|
listRequestTemplates(query?: {
|
|
274
308
|
"record_type"?: string;
|
package/dist/index.js
CHANGED
|
@@ -51,8 +51,8 @@ export class SpecstreamError extends Error {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
export function assertFamily(entityType) {
|
|
54
|
-
if (!
|
|
55
|
-
throw new Error(
|
|
54
|
+
if (typeof entityType !== "string" || !entityType.trim()) {
|
|
55
|
+
throw new Error("entity_type must be a non-empty string");
|
|
56
56
|
}
|
|
57
57
|
return entityType;
|
|
58
58
|
}
|
|
@@ -220,6 +220,34 @@ export class Client {
|
|
|
220
220
|
path += "?" + queryString.toString();
|
|
221
221
|
return this.request("GET", path);
|
|
222
222
|
}
|
|
223
|
+
webSearch(query) {
|
|
224
|
+
let path = `/v1/web-search`;
|
|
225
|
+
const queryString = new URLSearchParams();
|
|
226
|
+
for (const [key, value] of Object.entries(query))
|
|
227
|
+
if (value !== undefined && value !== null)
|
|
228
|
+
queryString.set(key, String(value));
|
|
229
|
+
if (queryString.size)
|
|
230
|
+
path += "?" + queryString.toString();
|
|
231
|
+
return this.request("GET", path);
|
|
232
|
+
}
|
|
233
|
+
extractPages(request) {
|
|
234
|
+
let path = `/v1/extract`;
|
|
235
|
+
return this.request("POST", path, request);
|
|
236
|
+
}
|
|
237
|
+
webSearchAnswers(query = {}) {
|
|
238
|
+
let path = `/v1/web-search/answers`;
|
|
239
|
+
const queryString = new URLSearchParams();
|
|
240
|
+
for (const [key, value] of Object.entries(query))
|
|
241
|
+
if (value !== undefined && value !== null)
|
|
242
|
+
queryString.set(key, String(value));
|
|
243
|
+
if (queryString.size)
|
|
244
|
+
path += "?" + queryString.toString();
|
|
245
|
+
return this.request("GET", path);
|
|
246
|
+
}
|
|
247
|
+
webSearchAnswer(answerId) {
|
|
248
|
+
let path = `/v1/web-search/answers/${encodeURIComponent(answerId)}`;
|
|
249
|
+
return this.request("GET", path);
|
|
250
|
+
}
|
|
223
251
|
workspaceListNotifications(query = {}) {
|
|
224
252
|
let path = `/v1/workspace/notifications`;
|
|
225
253
|
const queryString = new URLSearchParams();
|
|
@@ -459,6 +487,10 @@ export class Client {
|
|
|
459
487
|
requireWorkAuthorization(request);
|
|
460
488
|
return this.request("POST", path, request);
|
|
461
489
|
}
|
|
490
|
+
startCapacityRequest(request) {
|
|
491
|
+
let path = `/v1/capacity/requests`;
|
|
492
|
+
return this.request("POST", path, request);
|
|
493
|
+
}
|
|
462
494
|
getCapacityRequest(requestKey, query = {}) {
|
|
463
495
|
let path = `/v1/capacity/requests/${encodeURIComponent(requestKey)}`;
|
|
464
496
|
const queryString = new URLSearchParams();
|
|
@@ -469,6 +501,16 @@ export class Client {
|
|
|
469
501
|
path += "?" + queryString.toString();
|
|
470
502
|
return this.request("GET", path);
|
|
471
503
|
}
|
|
504
|
+
getCapacityRequestRows(requestKey, query = {}) {
|
|
505
|
+
let path = `/v1/capacity/requests/${encodeURIComponent(requestKey)}/rows`;
|
|
506
|
+
const queryString = new URLSearchParams();
|
|
507
|
+
for (const [key, value] of Object.entries(query))
|
|
508
|
+
if (value !== undefined && value !== null)
|
|
509
|
+
queryString.set(key, String(value));
|
|
510
|
+
if (queryString.size)
|
|
511
|
+
path += "?" + queryString.toString();
|
|
512
|
+
return this.request("GET", path);
|
|
513
|
+
}
|
|
472
514
|
getCapacityExecution(findId) {
|
|
473
515
|
let path = `/v1/capacity/executions/${encodeURIComponent(findId)}`;
|
|
474
516
|
return this.request("GET", path);
|
|
@@ -791,6 +833,10 @@ export class Client {
|
|
|
791
833
|
let path = `/v1/workspace/collections/${encodeURIComponent(collectionId)}/relationships`;
|
|
792
834
|
return this.request("PUT", path, request);
|
|
793
835
|
}
|
|
836
|
+
workspaceShareCollection(collectionId, request) {
|
|
837
|
+
let path = `/v1/workspace/collections/${encodeURIComponent(collectionId)}/share`;
|
|
838
|
+
return this.request("POST", path, request);
|
|
839
|
+
}
|
|
794
840
|
workspaceReportResult(collectionId, request) {
|
|
795
841
|
let path = `/v1/workspace/collections/${encodeURIComponent(collectionId)}/reports`;
|
|
796
842
|
return this.request("POST", path, request);
|
|
@@ -966,7 +1012,7 @@ export class Client {
|
|
|
966
1012
|
Authorization: token,
|
|
967
1013
|
Accept: "application/json",
|
|
968
1014
|
"Content-Type": "application/json",
|
|
969
|
-
"User-Agent": "specstream-typescript/1.
|
|
1015
|
+
"User-Agent": "specstream-typescript/1.3.0",
|
|
970
1016
|
};
|
|
971
1017
|
}
|
|
972
1018
|
async request(method, path, body) {
|
package/dist/work-types.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export interface Schemas {
|
|
|
6
6
|
"worded_evidence"?: ({
|
|
7
7
|
[key: string]: unknown;
|
|
8
8
|
} | null);
|
|
9
|
+
"unconfirmed"?: (Array<string> | null);
|
|
9
10
|
"lineage"?: (Schemas["MatchLineage"] | null);
|
|
10
11
|
"spec_version"?: "accepted_row.v1";
|
|
11
12
|
"entity_id": string;
|
|
@@ -174,8 +175,6 @@ export interface Schemas {
|
|
|
174
175
|
"members_used": number;
|
|
175
176
|
"current_lists_limit": (number | null);
|
|
176
177
|
"current_lists_used": number;
|
|
177
|
-
"finds_at_once": number;
|
|
178
|
-
"finds_per_hour": number;
|
|
179
178
|
"capabilities": Schemas["CapacityPlanCapabilities"];
|
|
180
179
|
"unlock": {
|
|
181
180
|
[key: string]: "starter" | "pro" | "team" | "enterprise";
|
|
@@ -245,7 +244,8 @@ export interface Schemas {
|
|
|
245
244
|
"CapacityMembershipData": {
|
|
246
245
|
"plan_id": string;
|
|
247
246
|
"pending_plan_id"?: (string | null);
|
|
248
|
-
"billed_by"?: "card" | "app_store" | "google_play";
|
|
247
|
+
"billed_by"?: "card" | "app_store" | "google_play" | "vercel" | "digitalocean";
|
|
248
|
+
"manage_url"?: (string | null);
|
|
249
249
|
"next_plan"?: (string | null);
|
|
250
250
|
"upgrade_pending"?: boolean;
|
|
251
251
|
"payment_action_url"?: (string | null);
|
|
@@ -264,6 +264,16 @@ export interface Schemas {
|
|
|
264
264
|
"CapacityMembershipStatusData": {
|
|
265
265
|
"membership"?: (Schemas["CapacityMembershipData"] | null);
|
|
266
266
|
};
|
|
267
|
+
"CapacityPartnerData": {
|
|
268
|
+
"share_percent": number;
|
|
269
|
+
"months": number;
|
|
270
|
+
"clearing_days": number;
|
|
271
|
+
"yearly_clearing_days": number;
|
|
272
|
+
"pending_cents": number;
|
|
273
|
+
"payable_cents": number;
|
|
274
|
+
"paid_cents": number;
|
|
275
|
+
"paying_accounts": number;
|
|
276
|
+
};
|
|
267
277
|
"CapacityPlanCapabilities": {
|
|
268
278
|
"schedules": boolean;
|
|
269
279
|
"deliveries": boolean;
|
|
@@ -293,6 +303,7 @@ export interface Schemas {
|
|
|
293
303
|
"check_unit_cents"?: number;
|
|
294
304
|
"required_check_unit_cents"?: number;
|
|
295
305
|
"required_check_allowance"?: number;
|
|
306
|
+
"unchanged_unit_cents"?: number;
|
|
296
307
|
"related_block_cents"?: number;
|
|
297
308
|
"undelivered_unit_cents"?: number;
|
|
298
309
|
"retail_rate"?: {
|
|
@@ -329,6 +340,7 @@ export interface Schemas {
|
|
|
329
340
|
"signed_up": number;
|
|
330
341
|
"rewarded": number;
|
|
331
342
|
"earned_cents": number;
|
|
343
|
+
"partner"?: (Schemas["CapacityPartnerData"] | null);
|
|
332
344
|
};
|
|
333
345
|
"CapacityReferralVisitData": {
|
|
334
346
|
"attributed": boolean;
|
|
@@ -368,6 +380,31 @@ export interface Schemas {
|
|
|
368
380
|
"calendar_schedule"?: (Schemas["CalendarSchedule"] | null);
|
|
369
381
|
"valid_until": string;
|
|
370
382
|
};
|
|
383
|
+
"CapacityStartData": {
|
|
384
|
+
"idempotency_key": string;
|
|
385
|
+
"state": "reading" | "started" | "needs_edit" | "above_maximum" | "failed";
|
|
386
|
+
"message"?: (string | null);
|
|
387
|
+
"read_back"?: (string | null);
|
|
388
|
+
"maximum_cents"?: (number | null);
|
|
389
|
+
"find_id"?: (string | null);
|
|
390
|
+
"retry_after_seconds"?: (number | null);
|
|
391
|
+
"queue_position"?: (number | null);
|
|
392
|
+
};
|
|
393
|
+
"CapacityStartRequest": {
|
|
394
|
+
"q"?: (string | null);
|
|
395
|
+
"rows"?: (Array<{
|
|
396
|
+
[key: string]: (string | number | boolean | null);
|
|
397
|
+
}> | null);
|
|
398
|
+
"fields"?: (Array<string> | null);
|
|
399
|
+
"requested_units"?: number;
|
|
400
|
+
"confirm_max_cents": number;
|
|
401
|
+
"maximum_price_usd"?: (number | null);
|
|
402
|
+
"idempotency_key": string;
|
|
403
|
+
"locale"?: string;
|
|
404
|
+
"callback_url"?: (string | null);
|
|
405
|
+
"callback_on"?: "start" | "done";
|
|
406
|
+
"one_row_per"?: (string | null);
|
|
407
|
+
};
|
|
371
408
|
"CapacityTrialEndingData": {
|
|
372
409
|
"event"?: "trial_ending";
|
|
373
410
|
"expires_at": string;
|
|
@@ -421,6 +458,20 @@ export interface Schemas {
|
|
|
421
458
|
"source_collection_ids"?: (Array<string> | null);
|
|
422
459
|
"bbox"?: (Array<unknown> | null);
|
|
423
460
|
};
|
|
461
|
+
"CollectionShareData": {
|
|
462
|
+
"id": string;
|
|
463
|
+
"snapshot_id": string;
|
|
464
|
+
"public_url": string;
|
|
465
|
+
"created_at": string;
|
|
466
|
+
"expires_at"?: (string | null);
|
|
467
|
+
"revoked": boolean;
|
|
468
|
+
"allow_export": boolean;
|
|
469
|
+
"row_count": number;
|
|
470
|
+
};
|
|
471
|
+
"CollectionShareInput": {
|
|
472
|
+
"expires_days"?: (number | null);
|
|
473
|
+
"allow_export"?: boolean;
|
|
474
|
+
};
|
|
424
475
|
"CombineCollectionsInput": {
|
|
425
476
|
"request_id": string;
|
|
426
477
|
"name": string;
|
|
@@ -451,7 +502,7 @@ export interface Schemas {
|
|
|
451
502
|
"billed_units"?: Array<Schemas["BilledUnit"]>;
|
|
452
503
|
"shortfall"?: (Schemas["Shortfall"] | null);
|
|
453
504
|
};
|
|
454
|
-
"CompilerStatus": "runnable" | "needs_edit" | "rejected" | "capability_pending" | "compiler_unavailable" | "unquoted_plan";
|
|
505
|
+
"CompilerStatus": "runnable" | "needs_edit" | "rejected" | "capability_pending" | "compiler_unavailable" | "unquoted_plan" | "pending";
|
|
455
506
|
"ConditionGrade": {
|
|
456
507
|
"part_id": string;
|
|
457
508
|
"field_id": (string | null);
|
|
@@ -470,6 +521,12 @@ export interface Schemas {
|
|
|
470
521
|
"name": string;
|
|
471
522
|
"project_id"?: (string | null);
|
|
472
523
|
};
|
|
524
|
+
"CoreEntity": {
|
|
525
|
+
"name": string;
|
|
526
|
+
"url": string;
|
|
527
|
+
"description": string;
|
|
528
|
+
"request": string;
|
|
529
|
+
};
|
|
473
530
|
"CountComparison": {
|
|
474
531
|
"op": "gte" | "gt" | "lte" | "lt" | "eq" | "ne";
|
|
475
532
|
"value": number;
|
|
@@ -588,13 +645,14 @@ export interface Schemas {
|
|
|
588
645
|
"platforms"?: Array<string>;
|
|
589
646
|
"searches"?: Array<string>;
|
|
590
647
|
"role_phrases"?: Array<string>;
|
|
648
|
+
"record_words"?: Array<string>;
|
|
591
649
|
"seed_identifiers"?: {
|
|
592
650
|
[key: string]: string;
|
|
593
651
|
};
|
|
594
652
|
};
|
|
595
653
|
"DisplayAbsence": "Not published" | "Couldn't check";
|
|
596
|
-
"EntityKind":
|
|
597
|
-
"EntityType":
|
|
654
|
+
"EntityKind": string;
|
|
655
|
+
"EntityType": string;
|
|
598
656
|
"EquivalenceRecord": {
|
|
599
657
|
"assessment_id": string;
|
|
600
658
|
"provider": string;
|
|
@@ -613,7 +671,7 @@ export interface Schemas {
|
|
|
613
671
|
[key: string]: unknown;
|
|
614
672
|
};
|
|
615
673
|
};
|
|
616
|
-
"ErrorCode": "unsupported_query" | "unsupported_predicate" | "unsupported_entity_family" | "ambiguous_geo" | "capability_pending" | "source_blocked" | "challenge_page" | "unquoted_plan" | "compiler_unavailable" | "parse_failed" | "payments_not_live" | "capacity" | "kill_switch" | "internal_failure" | "plan_required";
|
|
674
|
+
"ErrorCode": "unsupported_query" | "unsupported_predicate" | "unsupported_entity_family" | "ambiguous_geo" | "capability_pending" | "source_blocked" | "challenge_page" | "unquoted_plan" | "compiler_unavailable" | "parse_failed" | "payments_not_live" | "capacity" | "kill_switch" | "internal_failure" | "plan_required" | "invalid_token";
|
|
617
675
|
"ErrorEnvelope": {
|
|
618
676
|
"error": Schemas["ErrorBody"];
|
|
619
677
|
};
|
|
@@ -655,6 +713,25 @@ export interface Schemas {
|
|
|
655
713
|
"ExportRequest": {
|
|
656
714
|
"format": Schemas["ExportFormat"];
|
|
657
715
|
};
|
|
716
|
+
"ExtractPage": {
|
|
717
|
+
"request_id": string;
|
|
718
|
+
"results": Array<Schemas["ExtractedPage"]>;
|
|
719
|
+
"took_ms": number;
|
|
720
|
+
"price_usd": number;
|
|
721
|
+
};
|
|
722
|
+
"ExtractRequest": {
|
|
723
|
+
"urls": Array<string>;
|
|
724
|
+
"format"?: "markdown" | "text";
|
|
725
|
+
};
|
|
726
|
+
"ExtractedPage": {
|
|
727
|
+
"url": string;
|
|
728
|
+
"status": "ok" | "blocked" | "not_found" | "empty" | "unsupported" | "invalid_url" | "failed";
|
|
729
|
+
"title": (string | null);
|
|
730
|
+
"text": string;
|
|
731
|
+
"published": (string | null);
|
|
732
|
+
"read_from"?: ("live" | "site" | "archive" | null);
|
|
733
|
+
"captured_at"?: (string | null);
|
|
734
|
+
};
|
|
658
735
|
"FieldObservation": {
|
|
659
736
|
"entity_id": string;
|
|
660
737
|
"field_id": string;
|
|
@@ -674,6 +751,10 @@ export interface Schemas {
|
|
|
674
751
|
"source_pointer"?: (string | null);
|
|
675
752
|
"source_response_sha256"?: (string | null);
|
|
676
753
|
"source_time"?: (Schemas["EvidenceTime"] | null);
|
|
754
|
+
"source_raw"?: ({
|
|
755
|
+
[key: string]: unknown;
|
|
756
|
+
} | null);
|
|
757
|
+
"capability_id"?: (string | null);
|
|
677
758
|
};
|
|
678
759
|
"FileImportCommand": {
|
|
679
760
|
"import_id": string;
|
|
@@ -748,6 +829,9 @@ export interface Schemas {
|
|
|
748
829
|
"accepted_count": number;
|
|
749
830
|
"rows": Array<Schemas["AcceptedRow"]>;
|
|
750
831
|
"possible"?: Array<Schemas["PossibleRow"]>;
|
|
832
|
+
"flat_rows"?: Array<{
|
|
833
|
+
[key: string]: unknown;
|
|
834
|
+
}>;
|
|
751
835
|
"entitlement": string;
|
|
752
836
|
"commerce"?: (Schemas["CommerceData"] | null);
|
|
753
837
|
"next_cursor"?: (string | null);
|
|
@@ -1142,6 +1226,7 @@ export interface Schemas {
|
|
|
1142
1226
|
};
|
|
1143
1227
|
"ParseResult": {
|
|
1144
1228
|
"retained"?: (Schemas["RetainedRequest"] | null);
|
|
1229
|
+
"core_entity"?: (Schemas["CoreEntity"] | null);
|
|
1145
1230
|
"grading"?: (Schemas["ReadingGrade"] | null);
|
|
1146
1231
|
"understanding"?: (Schemas["Understanding"] | null);
|
|
1147
1232
|
"decision_id"?: (string | null);
|
|
@@ -1152,6 +1237,8 @@ export interface Schemas {
|
|
|
1152
1237
|
"compiler_version": string;
|
|
1153
1238
|
"ast_hash": (string | null);
|
|
1154
1239
|
"canonical_sentence": (string | null);
|
|
1240
|
+
"notice"?: (string | null);
|
|
1241
|
+
"read_back"?: (string | null);
|
|
1155
1242
|
};
|
|
1156
1243
|
"PasskeyComplete": {
|
|
1157
1244
|
"challenge_id": string;
|
|
@@ -1353,6 +1440,9 @@ export interface Schemas {
|
|
|
1353
1440
|
"output_fields"?: Array<Schemas["OutputField"]>;
|
|
1354
1441
|
"worded_conditions"?: Array<Schemas["WordedCondition"]>;
|
|
1355
1442
|
"worded_outputs"?: Array<Schemas["WordedOutput"]>;
|
|
1443
|
+
"contact_off"?: Array<"email" | "phone">;
|
|
1444
|
+
"record_fields"?: Array<string>;
|
|
1445
|
+
"each_location"?: boolean;
|
|
1356
1446
|
"sort": Array<Schemas["SortKey"]>;
|
|
1357
1447
|
"locale": string;
|
|
1358
1448
|
"inferred": Array<Schemas["InferredClause"]>;
|
|
@@ -1941,6 +2031,7 @@ export interface Schemas {
|
|
|
1941
2031
|
"source_find_id"?: (string | null);
|
|
1942
2032
|
"project_id"?: (string | null);
|
|
1943
2033
|
"context"?: string;
|
|
2034
|
+
"q"?: (string | null);
|
|
1944
2035
|
} & ({
|
|
1945
2036
|
"ast": NonNullable<unknown>;
|
|
1946
2037
|
"source_find_id"?: null;
|
|
@@ -1993,10 +2084,12 @@ export interface Schemas {
|
|
|
1993
2084
|
"ast": Schemas["QueryAst"];
|
|
1994
2085
|
"name"?: (string | null);
|
|
1995
2086
|
"context"?: (string | null);
|
|
2087
|
+
"q"?: (string | null);
|
|
1996
2088
|
};
|
|
1997
2089
|
"SseComplete": {
|
|
1998
2090
|
"row_count": number;
|
|
1999
2091
|
"stop_reason": Schemas["StopReason"];
|
|
2092
|
+
"message"?: (string | null);
|
|
2000
2093
|
};
|
|
2001
2094
|
"SseError": {
|
|
2002
2095
|
"code": Schemas["ErrorCode"];
|
|
@@ -2055,7 +2148,7 @@ export interface Schemas {
|
|
|
2055
2148
|
"SseZero": {
|
|
2056
2149
|
"cause": string;
|
|
2057
2150
|
};
|
|
2058
|
-
"StopReason": "complete_target" | "saturated_discovery" | "budget_reserved_exhausted" | "wall_clock" | "fetch_count" | "source_blocked" | "unsupported_predicate" | "zero_after_filters" | "user_cancel" | "capacity";
|
|
2151
|
+
"StopReason": "complete_target" | "saturated_discovery" | "budget_reserved_exhausted" | "wall_clock" | "fetch_count" | "source_blocked" | "unsupported_predicate" | "zero_after_filters" | "user_cancel" | "capacity" | "model_unavailable";
|
|
2059
2152
|
"StoreCardTransferRequest": {
|
|
2060
2153
|
"plan_id": string;
|
|
2061
2154
|
"idempotency_key": string;
|
|
@@ -2167,6 +2260,126 @@ export interface Schemas {
|
|
|
2167
2260
|
"expirationTime"?: ((number) | null);
|
|
2168
2261
|
"name": string;
|
|
2169
2262
|
};
|
|
2263
|
+
"WebSearchAnswer": {
|
|
2264
|
+
"id"?: (string | null);
|
|
2265
|
+
"request_id": string;
|
|
2266
|
+
"query": string;
|
|
2267
|
+
"kind": "list" | "fact";
|
|
2268
|
+
"columns": Array<string>;
|
|
2269
|
+
"answer": (Schemas["WebSearchValue"] | null);
|
|
2270
|
+
"rows": Array<Schemas["WebSearchRow"]>;
|
|
2271
|
+
"sources": Array<Schemas["WebSearchSource"]>;
|
|
2272
|
+
"handoff": (Schemas["WebSearchHandoff"] | null);
|
|
2273
|
+
"took_ms": number;
|
|
2274
|
+
"price_usd": number;
|
|
2275
|
+
"passages"?: (Array<Schemas["WebSearchPassage"]> | null);
|
|
2276
|
+
"request": string;
|
|
2277
|
+
"created_at": string;
|
|
2278
|
+
};
|
|
2279
|
+
"WebSearchAnswerPage": {
|
|
2280
|
+
"results": Array<Schemas["WebSearchAnswerSummary"]>;
|
|
2281
|
+
"next_cursor": (string | null);
|
|
2282
|
+
};
|
|
2283
|
+
"WebSearchAnswerSummary": {
|
|
2284
|
+
"id": string;
|
|
2285
|
+
"request": string;
|
|
2286
|
+
"created_at": string;
|
|
2287
|
+
"rows": number;
|
|
2288
|
+
"answer": (string | null);
|
|
2289
|
+
"source"?: (string | null);
|
|
2290
|
+
"sources"?: Array<Schemas["WebSearchCited"]>;
|
|
2291
|
+
"list": boolean;
|
|
2292
|
+
"kind": "list" | "fact";
|
|
2293
|
+
};
|
|
2294
|
+
"WebSearchBatchPage": {
|
|
2295
|
+
"results": Array<Schemas["WebSearchBatchResult"]>;
|
|
2296
|
+
"took_ms": number;
|
|
2297
|
+
"price_usd": number;
|
|
2298
|
+
};
|
|
2299
|
+
"WebSearchBatchRequest": {
|
|
2300
|
+
"questions": Array<Schemas["WebSearchQuestion"]>;
|
|
2301
|
+
};
|
|
2302
|
+
"WebSearchBatchResult": {
|
|
2303
|
+
"request_id": string;
|
|
2304
|
+
"status": number;
|
|
2305
|
+
"data": (Schemas["WebSearchPage"] | null);
|
|
2306
|
+
"error": (Schemas["ErrorBody"] | null);
|
|
2307
|
+
"retry_after_s"?: (number | null);
|
|
2308
|
+
};
|
|
2309
|
+
"WebSearchCall": {
|
|
2310
|
+
"method": "POST";
|
|
2311
|
+
"path": "/v1/parse";
|
|
2312
|
+
"body": {
|
|
2313
|
+
[key: string]: unknown;
|
|
2314
|
+
};
|
|
2315
|
+
};
|
|
2316
|
+
"WebSearchCited": {
|
|
2317
|
+
"url": string;
|
|
2318
|
+
"title": string;
|
|
2319
|
+
"site": string;
|
|
2320
|
+
};
|
|
2321
|
+
"WebSearchHandoff": {
|
|
2322
|
+
"line": string;
|
|
2323
|
+
"request": string;
|
|
2324
|
+
"rows_estimated": number;
|
|
2325
|
+
"rows_basis": "request" | "page" | "seen";
|
|
2326
|
+
"count_page": (string | null);
|
|
2327
|
+
"next": Schemas["WebSearchNext"];
|
|
2328
|
+
};
|
|
2329
|
+
"WebSearchNext": {
|
|
2330
|
+
"tool": "compile";
|
|
2331
|
+
"arguments": {
|
|
2332
|
+
[key: string]: unknown;
|
|
2333
|
+
};
|
|
2334
|
+
"http": Schemas["WebSearchCall"];
|
|
2335
|
+
};
|
|
2336
|
+
"WebSearchPage": {
|
|
2337
|
+
"id"?: (string | null);
|
|
2338
|
+
"request_id": string;
|
|
2339
|
+
"query": string;
|
|
2340
|
+
"kind": "list" | "fact";
|
|
2341
|
+
"columns": Array<string>;
|
|
2342
|
+
"answer": (Schemas["WebSearchValue"] | null);
|
|
2343
|
+
"rows": Array<Schemas["WebSearchRow"]>;
|
|
2344
|
+
"sources": Array<Schemas["WebSearchSource"]>;
|
|
2345
|
+
"handoff": (Schemas["WebSearchHandoff"] | null);
|
|
2346
|
+
"took_ms": number;
|
|
2347
|
+
"price_usd": number;
|
|
2348
|
+
"passages"?: (Array<Schemas["WebSearchPassage"]> | null);
|
|
2349
|
+
};
|
|
2350
|
+
"WebSearchPassage": {
|
|
2351
|
+
"url": string;
|
|
2352
|
+
"title": string;
|
|
2353
|
+
"text": string;
|
|
2354
|
+
};
|
|
2355
|
+
"WebSearchQuestion": {
|
|
2356
|
+
"q": string;
|
|
2357
|
+
"id"?: (string | null);
|
|
2358
|
+
};
|
|
2359
|
+
"WebSearchRow": {
|
|
2360
|
+
"name": string;
|
|
2361
|
+
"page": string;
|
|
2362
|
+
"snippet": string;
|
|
2363
|
+
"probability": number;
|
|
2364
|
+
"fields": {
|
|
2365
|
+
[key: string]: Schemas["WebSearchValue"];
|
|
2366
|
+
};
|
|
2367
|
+
"sources"?: Array<number>;
|
|
2368
|
+
};
|
|
2369
|
+
"WebSearchSource": {
|
|
2370
|
+
"url": string;
|
|
2371
|
+
"title": string;
|
|
2372
|
+
"site": string;
|
|
2373
|
+
"snippet": string;
|
|
2374
|
+
"cited": boolean;
|
|
2375
|
+
"published"?: (string | null);
|
|
2376
|
+
};
|
|
2377
|
+
"WebSearchValue": {
|
|
2378
|
+
"value": string;
|
|
2379
|
+
"page": string;
|
|
2380
|
+
"seen_at"?: (string | null);
|
|
2381
|
+
"confirmed"?: (boolean | null);
|
|
2382
|
+
};
|
|
2170
2383
|
"WebSourceCell": {
|
|
2171
2384
|
"source_url": string;
|
|
2172
2385
|
"response_sha256": string;
|
|
@@ -2243,7 +2456,7 @@ export interface Schemas {
|
|
|
2243
2456
|
"detail_id": string;
|
|
2244
2457
|
"words": string;
|
|
2245
2458
|
"description": string;
|
|
2246
|
-
"value_type"?: "text" | "number" | "date" | "url" | "email" | "phone" | "yes_no";
|
|
2459
|
+
"value_type"?: "text" | "number" | "date" | "url" | "email" | "phone" | "yes_no" | "place";
|
|
2247
2460
|
"required"?: boolean;
|
|
2248
2461
|
};
|
|
2249
2462
|
"WorkspaceAuditEvent": {
|
|
@@ -2470,6 +2683,7 @@ export interface Schemas {
|
|
|
2470
2683
|
"snippet": string;
|
|
2471
2684
|
"project_id"?: (string | null);
|
|
2472
2685
|
"collection_id"?: (string | null);
|
|
2686
|
+
"find_id"?: (string | null);
|
|
2473
2687
|
"record_id"?: (string | null);
|
|
2474
2688
|
"note_id"?: (string | null);
|
|
2475
2689
|
"imported"?: (boolean | null);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@specstream/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "TypeScript client for building lead lists and company lists from the live web. Every match comes with its source, priced before it runs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -49,11 +49,11 @@
|
|
|
49
49
|
"homepage": "https://specstream.ai/docs/sdk",
|
|
50
50
|
"repository": {
|
|
51
51
|
"type": "git",
|
|
52
|
-
"url": "git+https://github.com/
|
|
52
|
+
"url": "git+https://github.com/specstream/specstream-tools.git",
|
|
53
53
|
"directory": "packages/sdk-ts"
|
|
54
54
|
},
|
|
55
55
|
"bugs": {
|
|
56
|
-
"url": "https://github.com/
|
|
56
|
+
"url": "https://github.com/specstream/specstream-tools/issues"
|
|
57
57
|
},
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"access": "public"
|