@chatpanel/sdk 0.30.0 → 0.36.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 +221 -4
- package/dist/api.generated.js +92 -5
- package/dist/types.generated.d.ts +311 -3
- package/package.json +1 -1
package/dist/api.generated.d.ts
CHANGED
|
@@ -790,7 +790,7 @@ export declare const OPERATIONS: {
|
|
|
790
790
|
readonly since: "0.101.0";
|
|
791
791
|
readonly stream: null;
|
|
792
792
|
readonly pathParams: readonly [];
|
|
793
|
-
readonly queryParams: readonly [];
|
|
793
|
+
readonly queryParams: readonly ["view"];
|
|
794
794
|
};
|
|
795
795
|
readonly "knowledge.create": {
|
|
796
796
|
readonly id: "knowledge.create";
|
|
@@ -902,6 +902,16 @@ export declare const OPERATIONS: {
|
|
|
902
902
|
readonly pathParams: readonly ["id"];
|
|
903
903
|
readonly queryParams: readonly [];
|
|
904
904
|
};
|
|
905
|
+
readonly "knowledge.wholeGraph": {
|
|
906
|
+
readonly id: "knowledge.wholeGraph";
|
|
907
|
+
readonly method: "GET";
|
|
908
|
+
readonly path: "/v1/kb/{id}/graph";
|
|
909
|
+
readonly auth: "open";
|
|
910
|
+
readonly since: "0.147.0";
|
|
911
|
+
readonly stream: null;
|
|
912
|
+
readonly pathParams: readonly ["id"];
|
|
913
|
+
readonly queryParams: readonly ["limit"];
|
|
914
|
+
};
|
|
905
915
|
readonly "knowledge.graph": {
|
|
906
916
|
readonly id: "knowledge.graph";
|
|
907
917
|
readonly method: "POST";
|
|
@@ -982,6 +992,146 @@ export declare const OPERATIONS: {
|
|
|
982
992
|
readonly pathParams: readonly ["id"];
|
|
983
993
|
readonly queryParams: readonly [];
|
|
984
994
|
};
|
|
995
|
+
readonly "knowledge.pages": {
|
|
996
|
+
readonly id: "knowledge.pages";
|
|
997
|
+
readonly method: "GET";
|
|
998
|
+
readonly path: "/v1/kb/{id}/pages";
|
|
999
|
+
readonly auth: "open";
|
|
1000
|
+
readonly since: "0.147.0";
|
|
1001
|
+
readonly stream: null;
|
|
1002
|
+
readonly pathParams: readonly ["id"];
|
|
1003
|
+
readonly queryParams: readonly ["doc"];
|
|
1004
|
+
};
|
|
1005
|
+
readonly "knowledge.reveal": {
|
|
1006
|
+
readonly id: "knowledge.reveal";
|
|
1007
|
+
readonly method: "POST";
|
|
1008
|
+
readonly path: "/v1/kb/{id}/reveal";
|
|
1009
|
+
readonly auth: "token";
|
|
1010
|
+
readonly since: "0.147.0";
|
|
1011
|
+
readonly stream: null;
|
|
1012
|
+
readonly pathParams: readonly ["id"];
|
|
1013
|
+
readonly queryParams: readonly [];
|
|
1014
|
+
};
|
|
1015
|
+
readonly "context.search": {
|
|
1016
|
+
readonly id: "context.search";
|
|
1017
|
+
readonly method: "POST";
|
|
1018
|
+
readonly path: "/v1/context";
|
|
1019
|
+
readonly auth: "open";
|
|
1020
|
+
readonly since: "0.147.0";
|
|
1021
|
+
readonly stream: null;
|
|
1022
|
+
readonly pathParams: readonly [];
|
|
1023
|
+
readonly queryParams: readonly [];
|
|
1024
|
+
};
|
|
1025
|
+
readonly "destinations.list": {
|
|
1026
|
+
readonly id: "destinations.list";
|
|
1027
|
+
readonly method: "GET";
|
|
1028
|
+
readonly path: "/v1/destinations";
|
|
1029
|
+
readonly auth: "token";
|
|
1030
|
+
readonly since: "0.152.0";
|
|
1031
|
+
readonly stream: null;
|
|
1032
|
+
readonly pathParams: readonly [];
|
|
1033
|
+
readonly queryParams: readonly [];
|
|
1034
|
+
};
|
|
1035
|
+
readonly "destinations.add": {
|
|
1036
|
+
readonly id: "destinations.add";
|
|
1037
|
+
readonly method: "POST";
|
|
1038
|
+
readonly path: "/v1/destinations";
|
|
1039
|
+
readonly auth: "token";
|
|
1040
|
+
readonly since: "0.152.0";
|
|
1041
|
+
readonly stream: null;
|
|
1042
|
+
readonly pathParams: readonly [];
|
|
1043
|
+
readonly queryParams: readonly [];
|
|
1044
|
+
};
|
|
1045
|
+
readonly "destinations.get": {
|
|
1046
|
+
readonly id: "destinations.get";
|
|
1047
|
+
readonly method: "GET";
|
|
1048
|
+
readonly path: "/v1/destinations/{id}";
|
|
1049
|
+
readonly auth: "token";
|
|
1050
|
+
readonly since: "0.152.0";
|
|
1051
|
+
readonly stream: null;
|
|
1052
|
+
readonly pathParams: readonly ["id"];
|
|
1053
|
+
readonly queryParams: readonly [];
|
|
1054
|
+
};
|
|
1055
|
+
readonly "destinations.update": {
|
|
1056
|
+
readonly id: "destinations.update";
|
|
1057
|
+
readonly method: "PUT";
|
|
1058
|
+
readonly path: "/v1/destinations/{id}";
|
|
1059
|
+
readonly auth: "token";
|
|
1060
|
+
readonly since: "0.152.0";
|
|
1061
|
+
readonly stream: null;
|
|
1062
|
+
readonly pathParams: readonly ["id"];
|
|
1063
|
+
readonly queryParams: readonly [];
|
|
1064
|
+
};
|
|
1065
|
+
readonly "destinations.delete": {
|
|
1066
|
+
readonly id: "destinations.delete";
|
|
1067
|
+
readonly method: "DELETE";
|
|
1068
|
+
readonly path: "/v1/destinations/{id}";
|
|
1069
|
+
readonly auth: "token";
|
|
1070
|
+
readonly since: "0.152.0";
|
|
1071
|
+
readonly stream: null;
|
|
1072
|
+
readonly pathParams: readonly ["id"];
|
|
1073
|
+
readonly queryParams: readonly [];
|
|
1074
|
+
};
|
|
1075
|
+
readonly "context.profiles": {
|
|
1076
|
+
readonly id: "context.profiles";
|
|
1077
|
+
readonly method: "GET";
|
|
1078
|
+
readonly path: "/v1/context/profiles";
|
|
1079
|
+
readonly auth: "token";
|
|
1080
|
+
readonly since: "0.148.0";
|
|
1081
|
+
readonly stream: null;
|
|
1082
|
+
readonly pathParams: readonly [];
|
|
1083
|
+
readonly queryParams: readonly [];
|
|
1084
|
+
};
|
|
1085
|
+
readonly "context.providers": {
|
|
1086
|
+
readonly id: "context.providers";
|
|
1087
|
+
readonly method: "GET";
|
|
1088
|
+
readonly path: "/v1/context/providers";
|
|
1089
|
+
readonly auth: "open";
|
|
1090
|
+
readonly since: "0.147.0";
|
|
1091
|
+
readonly stream: null;
|
|
1092
|
+
readonly pathParams: readonly [];
|
|
1093
|
+
readonly queryParams: readonly [];
|
|
1094
|
+
};
|
|
1095
|
+
readonly "context.configureProviders": {
|
|
1096
|
+
readonly id: "context.configureProviders";
|
|
1097
|
+
readonly method: "POST";
|
|
1098
|
+
readonly path: "/v1/context/providers";
|
|
1099
|
+
readonly auth: "token";
|
|
1100
|
+
readonly since: "0.147.0";
|
|
1101
|
+
readonly stream: null;
|
|
1102
|
+
readonly pathParams: readonly [];
|
|
1103
|
+
readonly queryParams: readonly [];
|
|
1104
|
+
};
|
|
1105
|
+
readonly "context.testProvider": {
|
|
1106
|
+
readonly id: "context.testProvider";
|
|
1107
|
+
readonly method: "POST";
|
|
1108
|
+
readonly path: "/v1/context/providers/{id}/test";
|
|
1109
|
+
readonly auth: "token";
|
|
1110
|
+
readonly since: "0.147.0";
|
|
1111
|
+
readonly stream: null;
|
|
1112
|
+
readonly pathParams: readonly ["id"];
|
|
1113
|
+
readonly queryParams: readonly [];
|
|
1114
|
+
};
|
|
1115
|
+
readonly "context.syncBucket": {
|
|
1116
|
+
readonly id: "context.syncBucket";
|
|
1117
|
+
readonly method: "POST";
|
|
1118
|
+
readonly path: "/v1/context/providers/{id}/sync";
|
|
1119
|
+
readonly auth: "token";
|
|
1120
|
+
readonly since: "0.147.0";
|
|
1121
|
+
readonly stream: null;
|
|
1122
|
+
readonly pathParams: readonly ["id"];
|
|
1123
|
+
readonly queryParams: readonly [];
|
|
1124
|
+
};
|
|
1125
|
+
readonly "context.uploadToBucket": {
|
|
1126
|
+
readonly id: "context.uploadToBucket";
|
|
1127
|
+
readonly method: "POST";
|
|
1128
|
+
readonly path: "/v1/context/providers/{id}/upload";
|
|
1129
|
+
readonly auth: "token";
|
|
1130
|
+
readonly since: "0.147.0";
|
|
1131
|
+
readonly stream: null;
|
|
1132
|
+
readonly pathParams: readonly ["id"];
|
|
1133
|
+
readonly queryParams: readonly [];
|
|
1134
|
+
};
|
|
985
1135
|
readonly "retrieval.read": {
|
|
986
1136
|
readonly id: "retrieval.read";
|
|
987
1137
|
readonly method: "POST";
|
|
@@ -1920,8 +2070,10 @@ export declare class RetrievalApi {
|
|
|
1920
2070
|
export declare class KnowledgeApi {
|
|
1921
2071
|
private readonly rt;
|
|
1922
2072
|
constructor(rt: Runtime);
|
|
1923
|
-
/** The knowledge bases on this machine. Each base with its id, name, document count, vector count and model. Loads no passages. — Gateway 0.101.0+. */
|
|
1924
|
-
list(
|
|
2073
|
+
/** The knowledge bases on this machine. Each base with its id, name, document count, vector count and model. Loads no passages. `view=card` (gateway 0.147.0) answers `cards` instead — every base's library card in one answer (counts, type mix, the largest sections, health, a team base's revision and where its bucket is) — and, for the owner, `remote`: the bases of the other gateways configured as context providers, each group tagged with its gateway. — Gateway 0.101.0+. */
|
|
2074
|
+
list(query?: {
|
|
2075
|
+
view?: "card";
|
|
2076
|
+
}, opts?: RequestOptions): Promise<T.KbList>;
|
|
1925
2077
|
/** Create a knowledge base (or return the one with that id). A base is a folder under `~/.chatpanel/kb/<id>/` (manifest, passages, notes, vectors, a Markdown report) — a projection over the documents added to it, rebuildable from them. `embed: off` keeps it on words and the graph only. 201 when created, 200 with `existed` when the id was already there. — Gateway 0.101.0+. */
|
|
1926
2078
|
create(body: T.KbCreateRequest, opts?: RequestOptions): Promise<T.KbStatusResponse>;
|
|
1927
2079
|
/** What a base holds — its documents, passages, notes, vectors, entities and connections. — Gateway 0.101.0+. */
|
|
@@ -1948,7 +2100,11 @@ export declare class KnowledgeApi {
|
|
|
1948
2100
|
search(id: string, body: T.KbSearchRequest, opts?: RequestOptions): Promise<T.KbSearchResponse>;
|
|
1949
2101
|
/** The bounded loop over a base — framed, searched, read, checked once, asked when ambiguous — as one cited block for a model. The harness's loop (events kb-research.js), not a model's tool calls: a whole-document ask ("what is this about") reads the outline and the opening of each section; a focused one searches, reads the best passages grouped by document in page order, and — with `model` (TOKEN-GATED: the check runs on this gateway's own chat route) — asks that model once whether what was read answers it, then searches once more for what it says is missing. When the hits split evenly across documents and the question names none, the answer is `ask` (which document?) instead of a guess; call again with `answer` to go on, or `ask: false` to never pause. `attachment` is the block a client attaches before the question (`kind: prefetch`), `null` when nothing matched beyond the plain statement. — Gateway 0.101.0+. */
|
|
1950
2102
|
research(id: string, body: T.KbResearchRequest, opts?: RequestOptions): Promise<T.KbResearchResponse>;
|
|
1951
|
-
/**
|
|
2103
|
+
/** The whole graph for a map — documents, sections, topics, notes and the top entities, the edges among them, the communities. — Gateway 0.147.0+. */
|
|
2104
|
+
wholeGraph(id: string, query?: {
|
|
2105
|
+
limit?: number;
|
|
2106
|
+
}, opts?: RequestOptions): Promise<T.KbWholeGraph>;
|
|
2107
|
+
/** Walk the graph one step from a node — the passages it reaches and why, the names to step to (toward `query`), its neighbours up to `hops` away — or the path between two. — Gateway 0.101.0+. */
|
|
1952
2108
|
graph(id: string, body: T.KbGraphRequest, opts?: RequestOptions): Promise<T.KbGraphResponse>;
|
|
1953
2109
|
/** The notes filed into a base. — Gateway 0.101.0+. */
|
|
1954
2110
|
notes(id: string, opts?: RequestOptions): Promise<T.KbNotes>;
|
|
@@ -1998,6 +2154,65 @@ export declare class KnowledgeApi {
|
|
|
1998
2154
|
};
|
|
1999
2155
|
ms?: number;
|
|
2000
2156
|
}>;
|
|
2157
|
+
/** One bar per page of a document — passages, characters, forms (prose, list, table) and the printed page label. — Gateway 0.147.0+. */
|
|
2158
|
+
pages(id: string, query?: {
|
|
2159
|
+
doc?: string;
|
|
2160
|
+
}, opts?: RequestOptions): Promise<T.KbPageStrip>;
|
|
2161
|
+
/** Show a document, a kept folder or the base's own folder in the file manager of the computer the gateway runs on. Ids in, never a path: the gateway resolves the path from the base's own records and opens Finder / Explorer / the Linux file manager without a shell. A LOCAL action — the owner's client on this computer only (403 without the token, 501 `local_only` from a linked device or a remote gateway's members, 403 `confined` under `--confined`); a team base has nothing on disk (409 `not_on_disk`); a file moved since the last sync is 410 `gone`. — Requires the gateway token. Gateway 0.147.0+. */
|
|
2162
|
+
reveal(id: string, body: T.KbRevealRequest, opts?: RequestOptions): Promise<T.KbRevealResponse>;
|
|
2163
|
+
}
|
|
2164
|
+
/** The Context API — one search across every knowledge provider at once (this gateway's bases, team bases replicated from a bucket, the web search, a cloud knowledge base the person brought, other ChatPanel gateways), ranked across sources and packed to a token budget; a remote provider is asked only with the redacted query. */
|
|
2165
|
+
export declare class ContextApi {
|
|
2166
|
+
private readonly rt;
|
|
2167
|
+
constructor(rt: Runtime);
|
|
2168
|
+
/** One search across every knowledge provider — ranked across sources, packed to max_tokens, each passage saying where it came from. `sources` picks the providers: `kb:*` (every base, the default), `kb:<id>`, `web`, `web:<api>` (a search API the person added, e.g. `web:brave`), `bedrock:<id>`, `gw:<id>` (another ChatPanel gateway) or `gw:<id>:kb:<base>`. Every provider is asked in parallel with its own deadline; the answers are normalized, deduplicated, fused by rank across providers (their scores are not comparable), reordered by the gateway's reranker when it answers, and packed greedily to `max_tokens`. `providers` says, per provider, how long it took, how many passages it gave and why it did not answer. A REMOTE provider gets the query after the deterministic redaction and is not asked when redaction fails; a gateway the person marked `trusted` gets it as typed. A caller without the token reaches the bases its grants allow and the web search, never a provider that spends the person's cloud account. — Gateway 0.147.0+. */
|
|
2169
|
+
search(body: T.ContextRequest, opts?: RequestOptions): Promise<T.ContextResponse>;
|
|
2170
|
+
/** The cloud profiles on the gateway's computer a source can sign with — names, never a key. Read from the shared credentials file (`~/.aws/credentials` + `~/.aws/config`, or `AWS_SHARED_CREDENTIALS_FILE` / `AWS_CONFIG_FILE`) and the OCI config (`~/.oci/config`, or `OCI_CLI_CONFIG_FILE`). A bucket or Bedrock source names one as `credentials: { profile, from }`; the gateway reads its keys from the file at each call. A profile that signs another way (SSO, `credential_process`, a role) is listed with `usable: false` and why. — Requires the gateway token. Gateway 0.148.0+. */
|
|
2171
|
+
profiles(opts?: RequestOptions): Promise<T.CloudProfileList>;
|
|
2172
|
+
/** The providers a context search can name — built in and configured — and how each is (never a key or a token). — Gateway 0.147.0+. */
|
|
2173
|
+
providers(opts?: RequestOptions): Promise<T.ContextProviderList>;
|
|
2174
|
+
/** Add, change or remove configured providers — a Bedrock knowledge base, another gateway, a team bucket. Keys are write-only. A list of edits, each naming an `id`; `{ id, remove: true }` drops one. A secret an edit leaves out (or sends empty) is kept, `null` clears it. A bad entry is a 400 and nothing changes. — Requires the gateway token. Gateway 0.147.0+. */
|
|
2175
|
+
configureProviders(body: Array<T.ContextProviderEdit>, opts?: RequestOptions): Promise<T.ContextProviderList>;
|
|
2176
|
+
/** One cheap call to a configured provider — a page of a bucket's listing, a gateway's base list, a Retrieve — with its own error word for word. — Requires the gateway token. Gateway 0.147.0+. */
|
|
2177
|
+
testProvider(id: string, opts?: RequestOptions): Promise<{
|
|
2178
|
+
ok: boolean;
|
|
2179
|
+
error?: string;
|
|
2180
|
+
status?: number;
|
|
2181
|
+
[key: string]: unknown;
|
|
2182
|
+
}>;
|
|
2183
|
+
/** Run a team bucket now — a builder indexes what changed and publishes the next revision; a replica fetches it. — Requires the gateway token. Gateway 0.147.0+. */
|
|
2184
|
+
syncBucket(id: string, opts?: RequestOptions): Promise<{
|
|
2185
|
+
[key: string]: unknown;
|
|
2186
|
+
}>;
|
|
2187
|
+
/** Put a document into a team bucket under its prefix (then a builder indexes it). — Requires the gateway token. Gateway 0.147.0+. */
|
|
2188
|
+
uploadToBucket(id: string, body: {
|
|
2189
|
+
/** The object name under the prefix (no .., not hidden). */
|
|
2190
|
+
name: string;
|
|
2191
|
+
data: string;
|
|
2192
|
+
}, opts?: RequestOptions): Promise<{
|
|
2193
|
+
ok: boolean;
|
|
2194
|
+
key?: string;
|
|
2195
|
+
building?: boolean;
|
|
2196
|
+
}>;
|
|
2197
|
+
}
|
|
2198
|
+
/** The gateway's own models — API providers and local agents it routes to — listed and edited one at a time. */
|
|
2199
|
+
export declare class DestinationsApi {
|
|
2200
|
+
private readonly rt;
|
|
2201
|
+
constructor(rt: Runtime);
|
|
2202
|
+
/** The gateway's own models — every API provider and local agent it can route a turn to. Never a key. Each API destination says `hasKey` in place of its key, which is write-only. Edit them one at a time with `PUT`/`DELETE /v1/destinations/{id}` — never by replacing the whole list, so a client never deletes what another added. — Requires the gateway token. Gateway 0.152.0+. */
|
|
2203
|
+
list(opts?: RequestOptions): Promise<T.DestinationList>;
|
|
2204
|
+
/** Add one destination. A name already in use is refused (409), never overwritten. — Requires the gateway token. Gateway 0.152.0+. */
|
|
2205
|
+
add(body: T.DestinationInput, opts?: RequestOptions): Promise<T.DestinationSaved>;
|
|
2206
|
+
/** One destination. Never a key. — Requires the gateway token. Gateway 0.152.0+. */
|
|
2207
|
+
get(id: string, opts?: RequestOptions): Promise<{
|
|
2208
|
+
destination: T.Destination;
|
|
2209
|
+
}>;
|
|
2210
|
+
/** Change one destination; an `id` in the body different from the path renames it. The saved key is kept across an edit or a rename only while the base URL is the same host and path. Point the destination at another address without a new `apiKey` and the key is dropped (`keyDropped: true`) — it was given for that host and is never sent to another. — Requires the gateway token. Gateway 0.152.0+. */
|
|
2211
|
+
update(id: string, body: T.DestinationInput, opts?: RequestOptions): Promise<T.DestinationSaved>;
|
|
2212
|
+
/** Remove one destination. — Requires the gateway token. Gateway 0.152.0+. */
|
|
2213
|
+
delete(id: string, opts?: RequestOptions): Promise<{
|
|
2214
|
+
deleted: string;
|
|
2215
|
+
}>;
|
|
2001
2216
|
}
|
|
2002
2217
|
/** The model ledger — every engine's card. */
|
|
2003
2218
|
export declare class EnginesApi {
|
|
@@ -2233,6 +2448,8 @@ export declare function buildApi(rt: Runtime): {
|
|
|
2233
2448
|
runtime: RuntimeApi;
|
|
2234
2449
|
retrieval: RetrievalApi;
|
|
2235
2450
|
knowledge: KnowledgeApi;
|
|
2451
|
+
context: ContextApi;
|
|
2452
|
+
destinations: DestinationsApi;
|
|
2236
2453
|
engines: EnginesApi;
|
|
2237
2454
|
skills: SkillsApi;
|
|
2238
2455
|
a2a: A2aApi;
|
package/dist/api.generated.js
CHANGED
|
@@ -78,7 +78,7 @@ export const OPERATIONS = {
|
|
|
78
78
|
"capabilities.embed": { id: "capabilities.embed", method: "POST", path: "/v1/embeddings", auth: "open", since: "0.101.0", stream: null, pathParams: [], queryParams: [] },
|
|
79
79
|
"retrieval.extractContext": { id: "retrieval.extractContext", method: "POST", path: "/v1/extract/context", auth: "open", since: "0.102.0", stream: null, pathParams: [], queryParams: [] },
|
|
80
80
|
"retrieval.extract": { id: "retrieval.extract", method: "POST", path: "/v1/extract", auth: "open", since: "0.16.0", stream: null, pathParams: [], queryParams: [] },
|
|
81
|
-
"knowledge.list": { id: "knowledge.list", method: "GET", path: "/v1/kb", auth: "open", since: "0.101.0", stream: null, pathParams: [], queryParams: [] },
|
|
81
|
+
"knowledge.list": { id: "knowledge.list", method: "GET", path: "/v1/kb", auth: "open", since: "0.101.0", stream: null, pathParams: [], queryParams: ["view"] },
|
|
82
82
|
"knowledge.create": { id: "knowledge.create", method: "POST", path: "/v1/kb", auth: "open", since: "0.101.0", stream: null, pathParams: [], queryParams: [] },
|
|
83
83
|
"knowledge.status": { id: "knowledge.status", method: "GET", path: "/v1/kb/{id}", auth: "open", since: "0.101.0", stream: null, pathParams: ["id"], queryParams: [] },
|
|
84
84
|
"knowledge.delete": { id: "knowledge.delete", method: "DELETE", path: "/v1/kb/{id}", auth: "token", since: "0.101.0", stream: null, pathParams: ["id"], queryParams: [] },
|
|
@@ -90,6 +90,7 @@ export const OPERATIONS = {
|
|
|
90
90
|
"knowledge.outline": { id: "knowledge.outline", method: "GET", path: "/v1/kb/{id}/outline", auth: "open", since: "0.101.0", stream: null, pathParams: ["id"], queryParams: ["doc"] },
|
|
91
91
|
"knowledge.search": { id: "knowledge.search", method: "POST", path: "/v1/kb/{id}/search", auth: "open", since: "0.101.0", stream: null, pathParams: ["id"], queryParams: [] },
|
|
92
92
|
"knowledge.research": { id: "knowledge.research", method: "POST", path: "/v1/kb/{id}/research", auth: "open", since: "0.101.0", stream: null, pathParams: ["id"], queryParams: [] },
|
|
93
|
+
"knowledge.wholeGraph": { id: "knowledge.wholeGraph", method: "GET", path: "/v1/kb/{id}/graph", auth: "open", since: "0.147.0", stream: null, pathParams: ["id"], queryParams: ["limit"] },
|
|
93
94
|
"knowledge.graph": { id: "knowledge.graph", method: "POST", path: "/v1/kb/{id}/graph", auth: "open", since: "0.101.0", stream: null, pathParams: ["id"], queryParams: [] },
|
|
94
95
|
"knowledge.notes": { id: "knowledge.notes", method: "GET", path: "/v1/kb/{id}/notes", auth: "open", since: "0.101.0", stream: null, pathParams: ["id"], queryParams: [] },
|
|
95
96
|
"knowledge.note": { id: "knowledge.note", method: "POST", path: "/v1/kb/{id}/notes", auth: "open", since: "0.101.0", stream: null, pathParams: ["id"], queryParams: [] },
|
|
@@ -98,6 +99,20 @@ export const OPERATIONS = {
|
|
|
98
99
|
"knowledge.setAccess": { id: "knowledge.setAccess", method: "POST", path: "/v1/kb/{id}/access", auth: "token", since: "0.101.1", stream: null, pathParams: ["id"], queryParams: [] },
|
|
99
100
|
"knowledge.embed": { id: "knowledge.embed", method: "POST", path: "/v1/kb/{id}/embed", auth: "open", since: "0.101.0", stream: null, pathParams: ["id"], queryParams: [] },
|
|
100
101
|
"knowledge.sync": { id: "knowledge.sync", method: "POST", path: "/v1/kb/{id}/sync", auth: "token", since: "0.142.0", stream: null, pathParams: ["id"], queryParams: [] },
|
|
102
|
+
"knowledge.pages": { id: "knowledge.pages", method: "GET", path: "/v1/kb/{id}/pages", auth: "open", since: "0.147.0", stream: null, pathParams: ["id"], queryParams: ["doc"] },
|
|
103
|
+
"knowledge.reveal": { id: "knowledge.reveal", method: "POST", path: "/v1/kb/{id}/reveal", auth: "token", since: "0.147.0", stream: null, pathParams: ["id"], queryParams: [] },
|
|
104
|
+
"context.search": { id: "context.search", method: "POST", path: "/v1/context", auth: "open", since: "0.147.0", stream: null, pathParams: [], queryParams: [] },
|
|
105
|
+
"destinations.list": { id: "destinations.list", method: "GET", path: "/v1/destinations", auth: "token", since: "0.152.0", stream: null, pathParams: [], queryParams: [] },
|
|
106
|
+
"destinations.add": { id: "destinations.add", method: "POST", path: "/v1/destinations", auth: "token", since: "0.152.0", stream: null, pathParams: [], queryParams: [] },
|
|
107
|
+
"destinations.get": { id: "destinations.get", method: "GET", path: "/v1/destinations/{id}", auth: "token", since: "0.152.0", stream: null, pathParams: ["id"], queryParams: [] },
|
|
108
|
+
"destinations.update": { id: "destinations.update", method: "PUT", path: "/v1/destinations/{id}", auth: "token", since: "0.152.0", stream: null, pathParams: ["id"], queryParams: [] },
|
|
109
|
+
"destinations.delete": { id: "destinations.delete", method: "DELETE", path: "/v1/destinations/{id}", auth: "token", since: "0.152.0", stream: null, pathParams: ["id"], queryParams: [] },
|
|
110
|
+
"context.profiles": { id: "context.profiles", method: "GET", path: "/v1/context/profiles", auth: "token", since: "0.148.0", stream: null, pathParams: [], queryParams: [] },
|
|
111
|
+
"context.providers": { id: "context.providers", method: "GET", path: "/v1/context/providers", auth: "open", since: "0.147.0", stream: null, pathParams: [], queryParams: [] },
|
|
112
|
+
"context.configureProviders": { id: "context.configureProviders", method: "POST", path: "/v1/context/providers", auth: "token", since: "0.147.0", stream: null, pathParams: [], queryParams: [] },
|
|
113
|
+
"context.testProvider": { id: "context.testProvider", method: "POST", path: "/v1/context/providers/{id}/test", auth: "token", since: "0.147.0", stream: null, pathParams: ["id"], queryParams: [] },
|
|
114
|
+
"context.syncBucket": { id: "context.syncBucket", method: "POST", path: "/v1/context/providers/{id}/sync", auth: "token", since: "0.147.0", stream: null, pathParams: ["id"], queryParams: [] },
|
|
115
|
+
"context.uploadToBucket": { id: "context.uploadToBucket", method: "POST", path: "/v1/context/providers/{id}/upload", auth: "token", since: "0.147.0", stream: null, pathParams: ["id"], queryParams: [] },
|
|
101
116
|
"retrieval.read": { id: "retrieval.read", method: "POST", path: "/v1/read", auth: "open", since: "0.14.0", stream: null, pathParams: [], queryParams: [] },
|
|
102
117
|
"retrieval.readAlias": { id: "retrieval.readAlias", method: "GET", path: "/v1/read/{url}", auth: "open", since: "0.14.0", stream: null, pathParams: ["url"], queryParams: [] },
|
|
103
118
|
"engines.list": { id: "engines.list", method: "GET", path: "/v1/engines", auth: "open", since: "0.6.89", stream: null, pathParams: [], queryParams: ["minCalls"] },
|
|
@@ -558,9 +573,9 @@ export class RetrievalApi {
|
|
|
558
573
|
export class KnowledgeApi {
|
|
559
574
|
rt;
|
|
560
575
|
constructor(rt) { this.rt = rt; }
|
|
561
|
-
/** The knowledge bases on this machine. Each base with its id, name, document count, vector count and model. Loads no passages. — Gateway 0.101.0+. */
|
|
562
|
-
list(opts) {
|
|
563
|
-
return this.rt.request(OPERATIONS["knowledge.list"], { path: {}, query:
|
|
576
|
+
/** The knowledge bases on this machine. Each base with its id, name, document count, vector count and model. Loads no passages. `view=card` (gateway 0.147.0) answers `cards` instead — every base's library card in one answer (counts, type mix, the largest sections, health, a team base's revision and where its bucket is) — and, for the owner, `remote`: the bases of the other gateways configured as context providers, each group tagged with its gateway. — Gateway 0.101.0+. */
|
|
577
|
+
list(query, opts) {
|
|
578
|
+
return this.rt.request(OPERATIONS["knowledge.list"], { path: {}, query: query, headers: opts?.headers, body: undefined, opts });
|
|
564
579
|
}
|
|
565
580
|
/** Create a knowledge base (or return the one with that id). A base is a folder under `~/.chatpanel/kb/<id>/` (manifest, passages, notes, vectors, a Markdown report) — a projection over the documents added to it, rebuildable from them. `embed: off` keeps it on words and the graph only. 201 when created, 200 with `existed` when the id was already there. — Gateway 0.101.0+. */
|
|
566
581
|
create(body, opts) {
|
|
@@ -606,7 +621,11 @@ export class KnowledgeApi {
|
|
|
606
621
|
research(id, body, opts) {
|
|
607
622
|
return this.rt.request(OPERATIONS["knowledge.research"], { path: { id }, query: undefined, headers: opts?.headers, body: body, opts });
|
|
608
623
|
}
|
|
609
|
-
/**
|
|
624
|
+
/** The whole graph for a map — documents, sections, topics, notes and the top entities, the edges among them, the communities. — Gateway 0.147.0+. */
|
|
625
|
+
wholeGraph(id, query, opts) {
|
|
626
|
+
return this.rt.request(OPERATIONS["knowledge.wholeGraph"], { path: { id }, query: query, headers: opts?.headers, body: undefined, opts });
|
|
627
|
+
}
|
|
628
|
+
/** Walk the graph one step from a node — the passages it reaches and why, the names to step to (toward `query`), its neighbours up to `hops` away — or the path between two. — Gateway 0.101.0+. */
|
|
610
629
|
graph(id, body, opts) {
|
|
611
630
|
return this.rt.request(OPERATIONS["knowledge.graph"], { path: { id }, query: undefined, headers: opts?.headers, body: body, opts });
|
|
612
631
|
}
|
|
@@ -638,6 +657,72 @@ export class KnowledgeApi {
|
|
|
638
657
|
sync(id, body, opts) {
|
|
639
658
|
return this.rt.request(OPERATIONS["knowledge.sync"], { path: { id }, query: undefined, headers: opts?.headers, body: body, opts });
|
|
640
659
|
}
|
|
660
|
+
/** One bar per page of a document — passages, characters, forms (prose, list, table) and the printed page label. — Gateway 0.147.0+. */
|
|
661
|
+
pages(id, query, opts) {
|
|
662
|
+
return this.rt.request(OPERATIONS["knowledge.pages"], { path: { id }, query: query, headers: opts?.headers, body: undefined, opts });
|
|
663
|
+
}
|
|
664
|
+
/** Show a document, a kept folder or the base's own folder in the file manager of the computer the gateway runs on. Ids in, never a path: the gateway resolves the path from the base's own records and opens Finder / Explorer / the Linux file manager without a shell. A LOCAL action — the owner's client on this computer only (403 without the token, 501 `local_only` from a linked device or a remote gateway's members, 403 `confined` under `--confined`); a team base has nothing on disk (409 `not_on_disk`); a file moved since the last sync is 410 `gone`. — Requires the gateway token. Gateway 0.147.0+. */
|
|
665
|
+
reveal(id, body, opts) {
|
|
666
|
+
return this.rt.request(OPERATIONS["knowledge.reveal"], { path: { id }, query: undefined, headers: opts?.headers, body: body, opts });
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
/** The Context API — one search across every knowledge provider at once (this gateway's bases, team bases replicated from a bucket, the web search, a cloud knowledge base the person brought, other ChatPanel gateways), ranked across sources and packed to a token budget; a remote provider is asked only with the redacted query. */
|
|
670
|
+
export class ContextApi {
|
|
671
|
+
rt;
|
|
672
|
+
constructor(rt) { this.rt = rt; }
|
|
673
|
+
/** One search across every knowledge provider — ranked across sources, packed to max_tokens, each passage saying where it came from. `sources` picks the providers: `kb:*` (every base, the default), `kb:<id>`, `web`, `web:<api>` (a search API the person added, e.g. `web:brave`), `bedrock:<id>`, `gw:<id>` (another ChatPanel gateway) or `gw:<id>:kb:<base>`. Every provider is asked in parallel with its own deadline; the answers are normalized, deduplicated, fused by rank across providers (their scores are not comparable), reordered by the gateway's reranker when it answers, and packed greedily to `max_tokens`. `providers` says, per provider, how long it took, how many passages it gave and why it did not answer. A REMOTE provider gets the query after the deterministic redaction and is not asked when redaction fails; a gateway the person marked `trusted` gets it as typed. A caller without the token reaches the bases its grants allow and the web search, never a provider that spends the person's cloud account. — Gateway 0.147.0+. */
|
|
674
|
+
search(body, opts) {
|
|
675
|
+
return this.rt.request(OPERATIONS["context.search"], { path: {}, query: undefined, headers: opts?.headers, body: body, opts });
|
|
676
|
+
}
|
|
677
|
+
/** The cloud profiles on the gateway's computer a source can sign with — names, never a key. Read from the shared credentials file (`~/.aws/credentials` + `~/.aws/config`, or `AWS_SHARED_CREDENTIALS_FILE` / `AWS_CONFIG_FILE`) and the OCI config (`~/.oci/config`, or `OCI_CLI_CONFIG_FILE`). A bucket or Bedrock source names one as `credentials: { profile, from }`; the gateway reads its keys from the file at each call. A profile that signs another way (SSO, `credential_process`, a role) is listed with `usable: false` and why. — Requires the gateway token. Gateway 0.148.0+. */
|
|
678
|
+
profiles(opts) {
|
|
679
|
+
return this.rt.request(OPERATIONS["context.profiles"], { path: {}, query: undefined, headers: opts?.headers, body: undefined, opts });
|
|
680
|
+
}
|
|
681
|
+
/** The providers a context search can name — built in and configured — and how each is (never a key or a token). — Gateway 0.147.0+. */
|
|
682
|
+
providers(opts) {
|
|
683
|
+
return this.rt.request(OPERATIONS["context.providers"], { path: {}, query: undefined, headers: opts?.headers, body: undefined, opts });
|
|
684
|
+
}
|
|
685
|
+
/** Add, change or remove configured providers — a Bedrock knowledge base, another gateway, a team bucket. Keys are write-only. A list of edits, each naming an `id`; `{ id, remove: true }` drops one. A secret an edit leaves out (or sends empty) is kept, `null` clears it. A bad entry is a 400 and nothing changes. — Requires the gateway token. Gateway 0.147.0+. */
|
|
686
|
+
configureProviders(body, opts) {
|
|
687
|
+
return this.rt.request(OPERATIONS["context.configureProviders"], { path: {}, query: undefined, headers: opts?.headers, body: body, opts });
|
|
688
|
+
}
|
|
689
|
+
/** One cheap call to a configured provider — a page of a bucket's listing, a gateway's base list, a Retrieve — with its own error word for word. — Requires the gateway token. Gateway 0.147.0+. */
|
|
690
|
+
testProvider(id, opts) {
|
|
691
|
+
return this.rt.request(OPERATIONS["context.testProvider"], { path: { id }, query: undefined, headers: opts?.headers, body: undefined, opts });
|
|
692
|
+
}
|
|
693
|
+
/** Run a team bucket now — a builder indexes what changed and publishes the next revision; a replica fetches it. — Requires the gateway token. Gateway 0.147.0+. */
|
|
694
|
+
syncBucket(id, opts) {
|
|
695
|
+
return this.rt.request(OPERATIONS["context.syncBucket"], { path: { id }, query: undefined, headers: opts?.headers, body: undefined, opts });
|
|
696
|
+
}
|
|
697
|
+
/** Put a document into a team bucket under its prefix (then a builder indexes it). — Requires the gateway token. Gateway 0.147.0+. */
|
|
698
|
+
uploadToBucket(id, body, opts) {
|
|
699
|
+
return this.rt.request(OPERATIONS["context.uploadToBucket"], { path: { id }, query: undefined, headers: opts?.headers, body: body, opts });
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
/** The gateway's own models — API providers and local agents it routes to — listed and edited one at a time. */
|
|
703
|
+
export class DestinationsApi {
|
|
704
|
+
rt;
|
|
705
|
+
constructor(rt) { this.rt = rt; }
|
|
706
|
+
/** The gateway's own models — every API provider and local agent it can route a turn to. Never a key. Each API destination says `hasKey` in place of its key, which is write-only. Edit them one at a time with `PUT`/`DELETE /v1/destinations/{id}` — never by replacing the whole list, so a client never deletes what another added. — Requires the gateway token. Gateway 0.152.0+. */
|
|
707
|
+
list(opts) {
|
|
708
|
+
return this.rt.request(OPERATIONS["destinations.list"], { path: {}, query: undefined, headers: opts?.headers, body: undefined, opts });
|
|
709
|
+
}
|
|
710
|
+
/** Add one destination. A name already in use is refused (409), never overwritten. — Requires the gateway token. Gateway 0.152.0+. */
|
|
711
|
+
add(body, opts) {
|
|
712
|
+
return this.rt.request(OPERATIONS["destinations.add"], { path: {}, query: undefined, headers: opts?.headers, body: body, opts });
|
|
713
|
+
}
|
|
714
|
+
/** One destination. Never a key. — Requires the gateway token. Gateway 0.152.0+. */
|
|
715
|
+
get(id, opts) {
|
|
716
|
+
return this.rt.request(OPERATIONS["destinations.get"], { path: { id }, query: undefined, headers: opts?.headers, body: undefined, opts });
|
|
717
|
+
}
|
|
718
|
+
/** Change one destination; an `id` in the body different from the path renames it. The saved key is kept across an edit or a rename only while the base URL is the same host and path. Point the destination at another address without a new `apiKey` and the key is dropped (`keyDropped: true`) — it was given for that host and is never sent to another. — Requires the gateway token. Gateway 0.152.0+. */
|
|
719
|
+
update(id, body, opts) {
|
|
720
|
+
return this.rt.request(OPERATIONS["destinations.update"], { path: { id }, query: undefined, headers: opts?.headers, body: body, opts });
|
|
721
|
+
}
|
|
722
|
+
/** Remove one destination. — Requires the gateway token. Gateway 0.152.0+. */
|
|
723
|
+
delete(id, opts) {
|
|
724
|
+
return this.rt.request(OPERATIONS["destinations.delete"], { path: { id }, query: undefined, headers: opts?.headers, body: undefined, opts });
|
|
725
|
+
}
|
|
641
726
|
}
|
|
642
727
|
/** The model ledger — every engine's card. */
|
|
643
728
|
export class EnginesApi {
|
|
@@ -829,6 +914,8 @@ export function buildApi(rt) {
|
|
|
829
914
|
runtime: new RuntimeApi(rt),
|
|
830
915
|
retrieval: new RetrievalApi(rt),
|
|
831
916
|
knowledge: new KnowledgeApi(rt),
|
|
917
|
+
context: new ContextApi(rt),
|
|
918
|
+
destinations: new DestinationsApi(rt),
|
|
832
919
|
engines: new EnginesApi(rt),
|
|
833
920
|
skills: new SkillsApi(rt),
|
|
834
921
|
a2a: new A2aApi(rt),
|
|
@@ -495,12 +495,25 @@ export interface ExtractResponse {
|
|
|
495
495
|
scanned?: boolean;
|
|
496
496
|
/** Present on a page call. */
|
|
497
497
|
page?: number;
|
|
498
|
-
/** The page's text, on a page call. May be empty. */
|
|
498
|
+
/** The page's text, on a page call. May be empty. With `markdown`, headings are Markdown (`## Section`). */
|
|
499
499
|
text?: string;
|
|
500
|
+
/** The pages' headings are written as Markdown (`##`, `###` …) — a PDF's headings found by size, by its own outline and by numbered titles; its running headers and footers are left out of the text. Absent: plain text. */
|
|
501
|
+
markdown?: boolean;
|
|
502
|
+
/** Per page, the page number printed on it (`'17'`, `'iv'`), read from its running header or footer; `null` where none is printed. Index 0 is page 1. */
|
|
503
|
+
labels?: Array<string | null>;
|
|
504
|
+
/** The document's own outline (a PDF's bookmarks), two levels deep. */
|
|
505
|
+
outline?: Array<ExtractOutlineEntry>;
|
|
500
506
|
/** `chatpanel-extract`. */
|
|
501
507
|
provider: string;
|
|
502
508
|
ms: number;
|
|
503
509
|
}
|
|
510
|
+
export interface ExtractOutlineEntry {
|
|
511
|
+
title: string;
|
|
512
|
+
/** The page it points at (1-based); 0 when it points nowhere. */
|
|
513
|
+
page: number;
|
|
514
|
+
/** 1 for a top-level entry, 2 under it. */
|
|
515
|
+
level: number;
|
|
516
|
+
}
|
|
504
517
|
export interface ExtractContextRequest {
|
|
505
518
|
/** The question the documents are read for — its content words pick the pages of a long document. */
|
|
506
519
|
question: string;
|
|
@@ -598,7 +611,17 @@ export interface KbOkResponse {
|
|
|
598
611
|
ok: boolean;
|
|
599
612
|
}
|
|
600
613
|
export interface KbList {
|
|
601
|
-
|
|
614
|
+
/** With `view=card` (gateway 0.147.0). */
|
|
615
|
+
cards?: Array<KbCard>;
|
|
616
|
+
/** With `view=card`, for the owner: each configured gateway's bases, or why it did not answer. */
|
|
617
|
+
remote?: Array<{
|
|
618
|
+
gateway?: string;
|
|
619
|
+
id?: string;
|
|
620
|
+
host?: string;
|
|
621
|
+
cards?: Array<KbCard>;
|
|
622
|
+
error?: string;
|
|
623
|
+
}>;
|
|
624
|
+
kbs?: Array<{
|
|
602
625
|
id: string;
|
|
603
626
|
name: string;
|
|
604
627
|
docs: number;
|
|
@@ -608,6 +631,258 @@ export interface KbList {
|
|
|
608
631
|
access?: KbAccess;
|
|
609
632
|
}>;
|
|
610
633
|
}
|
|
634
|
+
/** Structure filters (gateway 0.147.0): only passages on pages [from, to], with a printed page label, in a section whose path contains a string, of one form, in documents of these types. */
|
|
635
|
+
export interface KbFilters {
|
|
636
|
+
pages?: Array<number>;
|
|
637
|
+
label?: string;
|
|
638
|
+
section?: string;
|
|
639
|
+
form?: "prose" | "list" | "table";
|
|
640
|
+
types?: Array<string>;
|
|
641
|
+
docs?: Array<string>;
|
|
642
|
+
}
|
|
643
|
+
export interface KbCard {
|
|
644
|
+
id: string;
|
|
645
|
+
name: string;
|
|
646
|
+
/** `team`: copied from a bucket by revision; `remote`: held on another gateway. */
|
|
647
|
+
kind: "local" | "team" | "remote";
|
|
648
|
+
/** The gateway that holds a remote base. */
|
|
649
|
+
gateway?: string;
|
|
650
|
+
docs?: number;
|
|
651
|
+
pages?: number;
|
|
652
|
+
chunks?: number;
|
|
653
|
+
vectors?: number;
|
|
654
|
+
entities?: number;
|
|
655
|
+
notes?: number;
|
|
656
|
+
/** Percent of passages meaning search reaches. */
|
|
657
|
+
coverage?: number;
|
|
658
|
+
types?: Array<{
|
|
659
|
+
type?: string;
|
|
660
|
+
docs?: number;
|
|
661
|
+
chunks?: number;
|
|
662
|
+
share?: number;
|
|
663
|
+
}>;
|
|
664
|
+
strip?: Array<{
|
|
665
|
+
section?: string;
|
|
666
|
+
doc?: string;
|
|
667
|
+
chars?: number;
|
|
668
|
+
share?: number;
|
|
669
|
+
table?: boolean;
|
|
670
|
+
}>;
|
|
671
|
+
health?: Array<{
|
|
672
|
+
id?: string;
|
|
673
|
+
severity?: "ok" | "info" | "warn" | "risk";
|
|
674
|
+
label?: string;
|
|
675
|
+
value?: number;
|
|
676
|
+
action?: string;
|
|
677
|
+
}>;
|
|
678
|
+
pill?: {
|
|
679
|
+
severity?: string;
|
|
680
|
+
label?: string;
|
|
681
|
+
};
|
|
682
|
+
updatedAt?: number;
|
|
683
|
+
syncedAt?: number;
|
|
684
|
+
team?: {
|
|
685
|
+
revision?: number;
|
|
686
|
+
builtAt?: number;
|
|
687
|
+
builtBy?: string;
|
|
688
|
+
/** The store, its region, the bucket and prefix — never a key. */
|
|
689
|
+
where?: {
|
|
690
|
+
[key: string]: unknown;
|
|
691
|
+
};
|
|
692
|
+
freshness?: {
|
|
693
|
+
state?: "current" | "updating" | "behind" | "offline" | "never";
|
|
694
|
+
label?: string;
|
|
695
|
+
[key: string]: unknown;
|
|
696
|
+
};
|
|
697
|
+
};
|
|
698
|
+
/** Whether this computer has a file to show. */
|
|
699
|
+
reveal?: boolean;
|
|
700
|
+
[key: string]: unknown;
|
|
701
|
+
}
|
|
702
|
+
export interface KbWholeGraph {
|
|
703
|
+
nodes: Array<{
|
|
704
|
+
id?: string;
|
|
705
|
+
kind?: string;
|
|
706
|
+
label?: string;
|
|
707
|
+
count?: number;
|
|
708
|
+
weight?: number;
|
|
709
|
+
doc?: string;
|
|
710
|
+
}>;
|
|
711
|
+
edges: Array<{
|
|
712
|
+
from?: string;
|
|
713
|
+
to?: string;
|
|
714
|
+
kind?: string;
|
|
715
|
+
weight?: number;
|
|
716
|
+
}>;
|
|
717
|
+
communities: Array<{
|
|
718
|
+
id?: string;
|
|
719
|
+
label?: string;
|
|
720
|
+
members?: Array<string>;
|
|
721
|
+
size?: number;
|
|
722
|
+
}>;
|
|
723
|
+
total?: {
|
|
724
|
+
nodes?: number;
|
|
725
|
+
edges?: number;
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
export interface KbPageStrip {
|
|
729
|
+
doc: string;
|
|
730
|
+
title?: string;
|
|
731
|
+
pages: Array<{
|
|
732
|
+
page?: number;
|
|
733
|
+
label?: string;
|
|
734
|
+
passages?: number;
|
|
735
|
+
chars?: number;
|
|
736
|
+
forms?: {
|
|
737
|
+
prose?: number;
|
|
738
|
+
list?: number;
|
|
739
|
+
table?: number;
|
|
740
|
+
};
|
|
741
|
+
}>;
|
|
742
|
+
}
|
|
743
|
+
/** A document id, the index of a kept folder, or nothing (the base's folder). */
|
|
744
|
+
export interface KbRevealRequest {
|
|
745
|
+
doc?: string;
|
|
746
|
+
source?: number;
|
|
747
|
+
}
|
|
748
|
+
export interface KbRevealResponse {
|
|
749
|
+
ok: boolean;
|
|
750
|
+
revealed: "file" | "folder" | "index";
|
|
751
|
+
}
|
|
752
|
+
export interface ContextRequest {
|
|
753
|
+
query: string;
|
|
754
|
+
sources?: Array<string>;
|
|
755
|
+
filters?: KbFilters;
|
|
756
|
+
max_tokens?: number;
|
|
757
|
+
limit?: number;
|
|
758
|
+
deadline_ms?: number;
|
|
759
|
+
rerank?: boolean;
|
|
760
|
+
}
|
|
761
|
+
export interface ContextChunk {
|
|
762
|
+
id: string;
|
|
763
|
+
source: {
|
|
764
|
+
/** kb, web, bedrock, gw. */
|
|
765
|
+
type: string;
|
|
766
|
+
/** The base id, the engine, the provider id. */
|
|
767
|
+
provider: string;
|
|
768
|
+
/** kb://<base>/<passage>, a web url, an s3:// location. */
|
|
769
|
+
uri?: string;
|
|
770
|
+
name?: string;
|
|
771
|
+
/** The other gateway that answered, when one did. */
|
|
772
|
+
gateway?: string;
|
|
773
|
+
};
|
|
774
|
+
title?: string;
|
|
775
|
+
content: string;
|
|
776
|
+
/** The provider's own score (not comparable across providers). */
|
|
777
|
+
rawScore?: number;
|
|
778
|
+
/** 0–1 within this answer, after fusion. */
|
|
779
|
+
score: number;
|
|
780
|
+
tokens: number;
|
|
781
|
+
at?: number;
|
|
782
|
+
/** For a passage: kb, kbName, doc, page, label, section, form, cite, lanes. */
|
|
783
|
+
meta?: {
|
|
784
|
+
[key: string]: unknown;
|
|
785
|
+
};
|
|
786
|
+
}
|
|
787
|
+
export interface ContextResponse {
|
|
788
|
+
query?: string;
|
|
789
|
+
chunks: Array<ContextChunk>;
|
|
790
|
+
tokens: number;
|
|
791
|
+
/** Ranked passages that did not fit max_tokens. */
|
|
792
|
+
dropped?: Array<string>;
|
|
793
|
+
providers: {
|
|
794
|
+
[key: string]: {
|
|
795
|
+
ms?: number;
|
|
796
|
+
count?: number;
|
|
797
|
+
error?: string;
|
|
798
|
+
timedOut?: boolean;
|
|
799
|
+
redacted?: boolean;
|
|
800
|
+
};
|
|
801
|
+
};
|
|
802
|
+
reranked?: boolean;
|
|
803
|
+
ms?: number;
|
|
804
|
+
}
|
|
805
|
+
export interface CloudProfileList {
|
|
806
|
+
profiles: Array<{
|
|
807
|
+
/** aws: the shared credentials file (any S3-compatible store, Bedrock) · oci: an OCI config profile (OCI Object Storage, its own API). */
|
|
808
|
+
from: "aws" | "oci";
|
|
809
|
+
name: string;
|
|
810
|
+
region?: string;
|
|
811
|
+
/** The profile's endpoint_url */
|
|
812
|
+
endpoint?: string;
|
|
813
|
+
usable: boolean;
|
|
814
|
+
/** Why a profile cannot sign here. */
|
|
815
|
+
why?: string;
|
|
816
|
+
}>;
|
|
817
|
+
}
|
|
818
|
+
export interface ContextProviderList {
|
|
819
|
+
providers: Array<{
|
|
820
|
+
id: string;
|
|
821
|
+
kind?: "bedrock" | "gateway" | "bucket";
|
|
822
|
+
type: string;
|
|
823
|
+
/** What to put in `sources`. */
|
|
824
|
+
source?: string;
|
|
825
|
+
name?: string;
|
|
826
|
+
configured?: boolean;
|
|
827
|
+
enabled?: boolean;
|
|
828
|
+
remote?: boolean;
|
|
829
|
+
host?: string;
|
|
830
|
+
hasKey?: boolean;
|
|
831
|
+
hasToken?: boolean;
|
|
832
|
+
trusted?: boolean;
|
|
833
|
+
[key: string]: unknown;
|
|
834
|
+
}>;
|
|
835
|
+
}
|
|
836
|
+
/** One configured provider. bedrock: region, knowledgeBaseId, accessKeyId, secretAccessKey, sessionToken? · gateway: url (https), token, trusted? · bucket: provider (oci|r2|aws|minio|b2|custom), endpoint?, namespace? (OCI), accountId? (R2), region, bucket, prefix, addressing (path|virtual), role (replica|builder), kbId, pollMinutes, credentials { accessKeyId, secretAccessKey } or { profile, from: aws|oci } (a profile on the gateway's computer — GET /v1/context/profiles; an OCI config profile signs OCI's own API and finds the namespace itself). A Bedrock source may also name credentials { profile }. */
|
|
837
|
+
export interface ContextProviderEdit {
|
|
838
|
+
id: string;
|
|
839
|
+
kind?: "bedrock" | "gateway" | "bucket";
|
|
840
|
+
name?: string;
|
|
841
|
+
enabled?: boolean;
|
|
842
|
+
remove?: boolean;
|
|
843
|
+
[key: string]: unknown;
|
|
844
|
+
}
|
|
845
|
+
/** Where the gateway can send a turn — an API provider or a local CLI agent. The key is never returned. */
|
|
846
|
+
export interface Destination {
|
|
847
|
+
/** Its name ("Example AI", "claude"). */
|
|
848
|
+
id: string;
|
|
849
|
+
type: "api" | "agent";
|
|
850
|
+
models: Array<string>;
|
|
851
|
+
/** api: the provider's base URL. */
|
|
852
|
+
baseUrl?: string;
|
|
853
|
+
/** api: the API shape it speaks. */
|
|
854
|
+
protocol?: "openai" | "anthropic";
|
|
855
|
+
/** api: a key is saved. */
|
|
856
|
+
hasKey?: boolean;
|
|
857
|
+
/** agent: the bridge agent that runs it. */
|
|
858
|
+
agent?: string;
|
|
859
|
+
/** Set when an engine the Runtime started serves it. */
|
|
860
|
+
service?: string;
|
|
861
|
+
/** Made from a panel endpoint; deleting that endpoint removes it. */
|
|
862
|
+
fromEndpoint?: boolean;
|
|
863
|
+
endpointId?: string;
|
|
864
|
+
[key: string]: unknown;
|
|
865
|
+
}
|
|
866
|
+
export interface DestinationInput {
|
|
867
|
+
/** Letters, numbers, spaces and . _ : @ + ( ) - ; no slashes. */
|
|
868
|
+
id: string;
|
|
869
|
+
type?: "api" | "agent";
|
|
870
|
+
models?: Array<string> | string;
|
|
871
|
+
/** api: required, http(s). */
|
|
872
|
+
baseUrl?: string;
|
|
873
|
+
protocol?: "openai" | "anthropic";
|
|
874
|
+
/** api: write-only. Leave out to keep the saved one (same address only). */
|
|
875
|
+
apiKey?: string;
|
|
876
|
+
agent?: string;
|
|
877
|
+
}
|
|
878
|
+
export interface DestinationList {
|
|
879
|
+
destinations: Array<Destination>;
|
|
880
|
+
}
|
|
881
|
+
export interface DestinationSaved {
|
|
882
|
+
destination: Destination;
|
|
883
|
+
/** The saved key was not kept because the address changed — ask for it again. */
|
|
884
|
+
keyDropped: boolean;
|
|
885
|
+
}
|
|
611
886
|
export interface KbCreateRequest {
|
|
612
887
|
/** Chosen by the caller; made up when absent. */
|
|
613
888
|
id?: string;
|
|
@@ -716,9 +991,16 @@ export interface KbPassage {
|
|
|
716
991
|
title?: string;
|
|
717
992
|
kind?: "text" | "note";
|
|
718
993
|
page?: number;
|
|
994
|
+
/** Past `page` when one sentence crosses a page break — the passage is the sentence whole. */
|
|
719
995
|
pageEnd?: number;
|
|
996
|
+
/** The page number printed on `page` (`'iv'`, `'17'`) — what a reader of the document calls it. Absent when none is printed. */
|
|
997
|
+
label?: string;
|
|
998
|
+
/** The printed number of `pageEnd`, when the passage crosses a page break. */
|
|
999
|
+
labelEnd?: string;
|
|
720
1000
|
/** The heading path, ` › `-joined. */
|
|
721
1001
|
section?: string;
|
|
1002
|
+
/** What the passage is: running prose, mostly list items, or a table (a passage of its own, Markdown rows, cut only between rows with the header row repeated). Absent on a note. */
|
|
1003
|
+
form?: "prose" | "list" | "table";
|
|
722
1004
|
text: string;
|
|
723
1005
|
chars?: number;
|
|
724
1006
|
/** The fused rank score (RRF) — only its order means anything. */
|
|
@@ -750,6 +1032,7 @@ export interface KbSearchRequest {
|
|
|
750
1032
|
/** `false`: skip the reranker. */
|
|
751
1033
|
rerank?: boolean;
|
|
752
1034
|
budgetMs?: number;
|
|
1035
|
+
filters?: KbFilters;
|
|
753
1036
|
}
|
|
754
1037
|
export interface KbSearchResponse {
|
|
755
1038
|
results: Array<KbPassage>;
|
|
@@ -826,10 +1109,12 @@ export interface KbResearchResponse {
|
|
|
826
1109
|
ms: number;
|
|
827
1110
|
}
|
|
828
1111
|
export interface KbGraphRequest {
|
|
829
|
-
/**
|
|
1112
|
+
/** A name, a defined term, a section or a topic — or a passage id as a search prints it (`d3f2a1b4c5d6#12`). */
|
|
830
1113
|
node: string;
|
|
831
1114
|
/** A second node: the path from `node` to it. */
|
|
832
1115
|
to?: string;
|
|
1116
|
+
/** The question the walk is for (since 0.149.0): `passages` and `next` are ranked toward it. */
|
|
1117
|
+
query?: string;
|
|
833
1118
|
hops?: number;
|
|
834
1119
|
kinds?: Array<"doc" | "section" | "entity" | "topic" | "note" | "chunk">;
|
|
835
1120
|
limit?: number;
|
|
@@ -855,6 +1140,29 @@ export interface KbGraphResponse {
|
|
|
855
1140
|
label?: string;
|
|
856
1141
|
kind?: string;
|
|
857
1142
|
}>;
|
|
1143
|
+
/** Since 0.149.0 — the passages one step reaches, each with why: `defines it`, `uses it`, `mentions it`, `the section on it`, `in this section`, `refers to it`, `it refers to <Table 3>`, `this passage`. */
|
|
1144
|
+
passages?: Array<{
|
|
1145
|
+
id?: string;
|
|
1146
|
+
why?: string;
|
|
1147
|
+
title?: string;
|
|
1148
|
+
page?: number;
|
|
1149
|
+
/** The printed page label. */
|
|
1150
|
+
label?: string;
|
|
1151
|
+
section?: string;
|
|
1152
|
+
cite?: string;
|
|
1153
|
+
/** The passage's first characters; read the whole one by id. */
|
|
1154
|
+
text?: string;
|
|
1155
|
+
/** How much of the question it answers (with `query`). */
|
|
1156
|
+
relevance?: number;
|
|
1157
|
+
}>;
|
|
1158
|
+
/** Since 0.149.0 — the names to step to next, toward the question when one was sent. */
|
|
1159
|
+
next?: Array<{
|
|
1160
|
+
id?: string;
|
|
1161
|
+
label?: string;
|
|
1162
|
+
kind?: string;
|
|
1163
|
+
weight?: number;
|
|
1164
|
+
relevance?: number;
|
|
1165
|
+
}>;
|
|
858
1166
|
message?: string;
|
|
859
1167
|
}
|
|
860
1168
|
export interface KbPage {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chatpanel/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.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",
|