@chatpanel/sdk 0.20.0 → 0.22.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/dist/api.generated.d.ts
CHANGED
|
@@ -1454,9 +1454,9 @@ export declare class RuntimeApi {
|
|
|
1454
1454
|
export declare class RetrievalApi {
|
|
1455
1455
|
private readonly rt;
|
|
1456
1456
|
constructor(rt: Runtime);
|
|
1457
|
-
/** Search the web through the provider this gateway is configured with; optionally read the top results in the same request. The `search` capability (docs/web-retrieval.md §4.1). Providers are listed by `GET /v1/capabilities`: `serp` (a results page fetched and read with the shared rules — no install, the default) and `searxng` (the user's own metasearch, preferred the moment it answers). `read: N` reads the top N results in parallel in this request, each carrying a §4.2 document under `read` — one round-trip instead of 1 + N; a page that will not be read keeps its snippet with `read.restricted.reason`. The query goes through layer-1 redaction (emails, cards, keys, dictionary terms — never the name detector) before it leaves; what was replaced is dropped and `redacted: true` says so; a query with nothing left is 400 `unsafe_query`. `freshness` and `lang` are honoured by SearXNG; `site` by both. `budgetMs` covers the search and its reads and is refused (503 `over_budget`) from the provider's record. `engines` names what was actually asked, so an empty list can be told from a blocked one. — Gateway 0.15.0+. */
|
|
1457
|
+
/** Search the web through the provider this gateway is configured with; optionally read the top results in the same request. The `search` capability (docs/web-retrieval.md §4.1). Providers are listed by `GET /v1/capabilities`: `serp` (a results page fetched and read with the shared rules — no install, the default) and `searxng` (the user's own metasearch, preferred the moment it answers). `read: N` reads the top N results in parallel in this request, each carrying a §4.2 document under `read` — one round-trip instead of 1 + N; a page that will not be read keeps its snippet with `read.restricted.reason`. The query goes through layer-1 redaction (emails, cards, keys, dictionary terms — never the name detector) before it leaves; what was replaced is dropped and `redacted: true` says so; a query with nothing left is 400 `unsafe_query`. `freshness` and `lang` are honoured by SearXNG; `site` by both. `budgetMs` covers the search and its reads and is refused (503 `over_budget`) from the provider's record. `engines` names what was actually asked, so an empty list can be told from a blocked one. Since gateway 0.78.0 `serp` asks one built-in engine per search (DuckDuckGo, Startpage, Bing) plus any search API the person added in the gateway's settings (Exa, Brave, Tavily, Serper, SerpApi, Google Programmable Search, Jina, Mwmbl, or one they describe — keyed ones first); an engine that refuses rests for a while. Since gateway 0.79.0 every result is tagged with its `engine` and `via` (the kind of door it came through), and `trail` says what each provider and engine asked did and, when nothing came back, why — `nothing` (they answered, found nothing) reads differently from `blocked`, `resting` or `offline`. Both are optional: an older gateway sends neither. — Gateway 0.15.0+. */
|
|
1458
1458
|
search(body: T.WebSearchRequest, opts?: RequestOptions): Promise<T.WebSearchResponse>;
|
|
1459
|
-
/** The s.jina.ai-shaped alias — `GET /v1/search/<query>` — the top results WITH their content. Same search as `POST /v1/search` with `read: 5` (`?read=N`, 0–10, changes it), answered in the shape the shipped ChatPanel extension's *Web search API* engine already reads: `{ code, status, data: [{ url, title, description, content, publishedTime? }] }` where `content` is the page's Markdown when it was read and the snippet otherwise — nothing needs fetching on the client. A Bearer token is accepted and ignored. — Gateway 0.15.0+. */
|
|
1459
|
+
/** The s.jina.ai-shaped alias — `GET /v1/search/<query>` — the top results WITH their content. Same search as `POST /v1/search` with `read: 5` (`?read=N`, 0–10, changes it), answered in the shape the shipped ChatPanel extension's *Web search API* engine already reads: `{ code, status, data: [{ url, title, description, content, publishedTime? }] }` where `content` is the page's Markdown when it was read and the snippet otherwise — nothing needs fetching on the client. A Bearer token is accepted and ignored. Since gateway 0.79.0 each item may carry `engine` and `via`, and the top level `trail`, exactly as `POST /v1/search` does (a Jina reader ignores them). — Gateway 0.15.0+. */
|
|
1460
1460
|
searchAlias(q: string, query?: {
|
|
1461
1461
|
read?: number;
|
|
1462
1462
|
}, opts?: RequestOptions): Promise<{
|
|
@@ -1468,7 +1468,12 @@ export declare class RetrievalApi {
|
|
|
1468
1468
|
description: string;
|
|
1469
1469
|
content: string;
|
|
1470
1470
|
publishedTime?: string;
|
|
1471
|
+
/** The engine that produced it, as on `WebSearchResult.engine`. Since gateway 0.79.0. */
|
|
1472
|
+
engine?: string;
|
|
1473
|
+
/** The kind of door it came through, as on `WebSearchResult.via`. Since gateway 0.79.0. */
|
|
1474
|
+
via?: string;
|
|
1471
1475
|
}>;
|
|
1476
|
+
trail?: T.SearchTrail;
|
|
1472
1477
|
}>;
|
|
1473
1478
|
/** A document's pages from its bytes — a PDF, a Word file, a sheet, a deck — parsed once, paged by hash. The `extract` capability (docs/capability-endpoints.md): the third leg beside `search` and `read`. Two calls on one route. With `name` and `data` (the file, base64), the document is parsed in a worker process on this machine — no network, the vault unreadable — and the answer is its identity (`hash`, SHA-256 of the bytes), its `type` as read from the bytes, its `title` when it has one and how many `pages` it has; the text stays on the server. With `hash` and `page`, one page's text comes back; the bytes crossed once. A page is the format's own unit (a PDF page, a slide, a sheet) or, for a document with none (DOCX, Markdown, text), a run of ~6,000 characters cut at a heading. Readers: PDF (pdf.js, the text layer — a scanned document is `scanned: true` with empty pages, never OCR'd), DOCX (Markdown), XLSX/ODS (rows of cells), PPTX/ODP (a slide per page, speaker notes appended), ODT, Markdown, text, CSV, HTML. A hash the worker no longer holds (it is dropped when idle) is a 404 `unknown_document`: send the bytes again. `budgetMs` is refused (503 `over_budget`) from the worker's own record. — Gateway 0.16.0+. */
|
|
1474
1479
|
extract(body: T.ExtractRequest, opts?: RequestOptions): Promise<T.ExtractResponse>;
|
package/dist/api.generated.js
CHANGED
|
@@ -476,11 +476,11 @@ export class RuntimeApi {
|
|
|
476
476
|
export class RetrievalApi {
|
|
477
477
|
rt;
|
|
478
478
|
constructor(rt) { this.rt = rt; }
|
|
479
|
-
/** Search the web through the provider this gateway is configured with; optionally read the top results in the same request. The `search` capability (docs/web-retrieval.md §4.1). Providers are listed by `GET /v1/capabilities`: `serp` (a results page fetched and read with the shared rules — no install, the default) and `searxng` (the user's own metasearch, preferred the moment it answers). `read: N` reads the top N results in parallel in this request, each carrying a §4.2 document under `read` — one round-trip instead of 1 + N; a page that will not be read keeps its snippet with `read.restricted.reason`. The query goes through layer-1 redaction (emails, cards, keys, dictionary terms — never the name detector) before it leaves; what was replaced is dropped and `redacted: true` says so; a query with nothing left is 400 `unsafe_query`. `freshness` and `lang` are honoured by SearXNG; `site` by both. `budgetMs` covers the search and its reads and is refused (503 `over_budget`) from the provider's record. `engines` names what was actually asked, so an empty list can be told from a blocked one. — Gateway 0.15.0+. */
|
|
479
|
+
/** Search the web through the provider this gateway is configured with; optionally read the top results in the same request. The `search` capability (docs/web-retrieval.md §4.1). Providers are listed by `GET /v1/capabilities`: `serp` (a results page fetched and read with the shared rules — no install, the default) and `searxng` (the user's own metasearch, preferred the moment it answers). `read: N` reads the top N results in parallel in this request, each carrying a §4.2 document under `read` — one round-trip instead of 1 + N; a page that will not be read keeps its snippet with `read.restricted.reason`. The query goes through layer-1 redaction (emails, cards, keys, dictionary terms — never the name detector) before it leaves; what was replaced is dropped and `redacted: true` says so; a query with nothing left is 400 `unsafe_query`. `freshness` and `lang` are honoured by SearXNG; `site` by both. `budgetMs` covers the search and its reads and is refused (503 `over_budget`) from the provider's record. `engines` names what was actually asked, so an empty list can be told from a blocked one. Since gateway 0.78.0 `serp` asks one built-in engine per search (DuckDuckGo, Startpage, Bing) plus any search API the person added in the gateway's settings (Exa, Brave, Tavily, Serper, SerpApi, Google Programmable Search, Jina, Mwmbl, or one they describe — keyed ones first); an engine that refuses rests for a while. Since gateway 0.79.0 every result is tagged with its `engine` and `via` (the kind of door it came through), and `trail` says what each provider and engine asked did and, when nothing came back, why — `nothing` (they answered, found nothing) reads differently from `blocked`, `resting` or `offline`. Both are optional: an older gateway sends neither. — Gateway 0.15.0+. */
|
|
480
480
|
search(body, opts) {
|
|
481
481
|
return this.rt.request(OPERATIONS["retrieval.search"], { path: {}, query: undefined, headers: opts?.headers, body: body, opts });
|
|
482
482
|
}
|
|
483
|
-
/** The s.jina.ai-shaped alias — `GET /v1/search/<query>` — the top results WITH their content. Same search as `POST /v1/search` with `read: 5` (`?read=N`, 0–10, changes it), answered in the shape the shipped ChatPanel extension's *Web search API* engine already reads: `{ code, status, data: [{ url, title, description, content, publishedTime? }] }` where `content` is the page's Markdown when it was read and the snippet otherwise — nothing needs fetching on the client. A Bearer token is accepted and ignored. — Gateway 0.15.0+. */
|
|
483
|
+
/** The s.jina.ai-shaped alias — `GET /v1/search/<query>` — the top results WITH their content. Same search as `POST /v1/search` with `read: 5` (`?read=N`, 0–10, changes it), answered in the shape the shipped ChatPanel extension's *Web search API* engine already reads: `{ code, status, data: [{ url, title, description, content, publishedTime? }] }` where `content` is the page's Markdown when it was read and the snippet otherwise — nothing needs fetching on the client. A Bearer token is accepted and ignored. Since gateway 0.79.0 each item may carry `engine` and `via`, and the top level `trail`, exactly as `POST /v1/search` does (a Jina reader ignores them). — Gateway 0.15.0+. */
|
|
484
484
|
searchAlias(q, query, opts) {
|
|
485
485
|
return this.rt.request(OPERATIONS["retrieval.searchAlias"], { path: { q }, query: query, headers: opts?.headers, body: undefined, opts });
|
|
486
486
|
}
|
|
@@ -251,6 +251,8 @@ export interface DetectRequest {
|
|
|
251
251
|
labels?: Array<string>;
|
|
252
252
|
/** Refused before running if the provider's record predicts it cannot be met. */
|
|
253
253
|
budgetMs?: number;
|
|
254
|
+
/** Return every span the provider finds, second-guessing none (redaction strictness 'strict'). A provider that does not filter ignores it. Since gateway 0.76.0. */
|
|
255
|
+
strict?: boolean;
|
|
254
256
|
}
|
|
255
257
|
export interface DetectedEntity {
|
|
256
258
|
value: string;
|
|
@@ -355,8 +357,10 @@ export interface WebSearchResult {
|
|
|
355
357
|
url: string;
|
|
356
358
|
title: string;
|
|
357
359
|
snippet: string;
|
|
358
|
-
/** The engine that produced it (SearXNG: the first of `engines`; serp: the
|
|
360
|
+
/** The engine that produced it (SearXNG: the first of `engines`; serp: the engine asked — `duckduckgo`, `startpage`, `bing`, or `api:<id>` for a search API such as `api:exa`). Since gateway 0.79.0 every result carries it; the provider id when nothing finer is known. */
|
|
359
361
|
engine?: string;
|
|
362
|
+
/** The kind of door it came through: `gateway` · `searxng` · `api` (a search API) · `page` (a results page read) · `browser` (the person's own browser). A client meeting a value it does not know shows it as it is. Since gateway 0.79.0. */
|
|
363
|
+
via?: string;
|
|
360
364
|
/** SearXNG: every engine that returned it. */
|
|
361
365
|
engines?: Array<string>;
|
|
362
366
|
/** SearXNG's fused score. */
|
|
@@ -380,6 +384,36 @@ export interface WebSearchResponse {
|
|
|
380
384
|
query?: string;
|
|
381
385
|
provider: string;
|
|
382
386
|
ms: number;
|
|
387
|
+
trail?: SearchTrail;
|
|
388
|
+
}
|
|
389
|
+
/** What the search did — each provider and engine asked, what it did, which are resting — and how it ended. Optional on every response that carries it; an older gateway sends none. Since gateway 0.79.0. */
|
|
390
|
+
export interface SearchTrail {
|
|
391
|
+
/** How it ended: `answered` (results came back) · `nothing` (engines answered, none had anything) · `blocked` (every engine asked refused or timed out) · `resting` (nothing was asked: every engine is resting after earlier refusals) · `offline` (every engine failed at the network) · `no-engines`. A client meeting a value it does not know treats it as no results. */
|
|
392
|
+
status: string;
|
|
393
|
+
/** In the order asked: the provider tried first (`searxng`, or each engine and API `serp` asked), then the other provider when the first came back empty. */
|
|
394
|
+
asked: Array<SearchTrailAsk>;
|
|
395
|
+
/** Engines resting after refusing earlier, and until when. */
|
|
396
|
+
resting: Array<SearchTrailResting>;
|
|
397
|
+
}
|
|
398
|
+
export interface SearchTrailAsk {
|
|
399
|
+
/** The engine or provider asked — `searxng`, `serp`, `duckduckgo`, `startpage`, `bing`, `api:<id>`. */
|
|
400
|
+
id: string;
|
|
401
|
+
/** `answered` · `empty` (answered, found nothing) · `refused` (a refusing status, a timeout or no answer at all). */
|
|
402
|
+
outcome: string;
|
|
403
|
+
/** How many results it returned. */
|
|
404
|
+
found?: number;
|
|
405
|
+
/** The HTTP status of a refusal (429, 403, …), when there was one. */
|
|
406
|
+
status?: number;
|
|
407
|
+
/** It did not answer within its share of the budget. */
|
|
408
|
+
timedOut?: boolean;
|
|
409
|
+
/** It failed at the network — no status at all. */
|
|
410
|
+
network?: boolean;
|
|
411
|
+
}
|
|
412
|
+
export interface SearchTrailResting {
|
|
413
|
+
/** The resting engine. */
|
|
414
|
+
id: string;
|
|
415
|
+
/** When it may be asked again, ms since epoch. */
|
|
416
|
+
until: number;
|
|
383
417
|
}
|
|
384
418
|
/** Either `name` + `data` (open a document) or `hash` + `page` (read one page of an open document). */
|
|
385
419
|
export interface ExtractRequest {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chatpanel/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "Typed client for the local ChatPanel gateway — chat through the privacy proxy, search the user's history, read and write memory, follow team runs. Zero dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|