@chatpanel/sdk 0.31.0 → 0.37.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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";
@@ -962,6 +972,26 @@ export declare const OPERATIONS: {
962
972
  readonly pathParams: readonly ["id"];
963
973
  readonly queryParams: readonly [];
964
974
  };
975
+ readonly "knowledge.instructions": {
976
+ readonly id: "knowledge.instructions";
977
+ readonly method: "GET";
978
+ readonly path: "/v1/kb/{id}/instructions";
979
+ readonly auth: "open";
980
+ readonly since: "0.155.0";
981
+ readonly stream: null;
982
+ readonly pathParams: readonly ["id"];
983
+ readonly queryParams: readonly [];
984
+ };
985
+ readonly "knowledge.setInstructions": {
986
+ readonly id: "knowledge.setInstructions";
987
+ readonly method: "POST";
988
+ readonly path: "/v1/kb/{id}/instructions";
989
+ readonly auth: "token";
990
+ readonly since: "0.155.0";
991
+ readonly stream: null;
992
+ readonly pathParams: readonly ["id"];
993
+ readonly queryParams: readonly [];
994
+ };
965
995
  readonly "knowledge.embed": {
966
996
  readonly id: "knowledge.embed";
967
997
  readonly method: "POST";
@@ -982,6 +1012,146 @@ export declare const OPERATIONS: {
982
1012
  readonly pathParams: readonly ["id"];
983
1013
  readonly queryParams: readonly [];
984
1014
  };
1015
+ readonly "knowledge.pages": {
1016
+ readonly id: "knowledge.pages";
1017
+ readonly method: "GET";
1018
+ readonly path: "/v1/kb/{id}/pages";
1019
+ readonly auth: "open";
1020
+ readonly since: "0.147.0";
1021
+ readonly stream: null;
1022
+ readonly pathParams: readonly ["id"];
1023
+ readonly queryParams: readonly ["doc"];
1024
+ };
1025
+ readonly "knowledge.reveal": {
1026
+ readonly id: "knowledge.reveal";
1027
+ readonly method: "POST";
1028
+ readonly path: "/v1/kb/{id}/reveal";
1029
+ readonly auth: "token";
1030
+ readonly since: "0.147.0";
1031
+ readonly stream: null;
1032
+ readonly pathParams: readonly ["id"];
1033
+ readonly queryParams: readonly [];
1034
+ };
1035
+ readonly "context.search": {
1036
+ readonly id: "context.search";
1037
+ readonly method: "POST";
1038
+ readonly path: "/v1/context";
1039
+ readonly auth: "open";
1040
+ readonly since: "0.147.0";
1041
+ readonly stream: null;
1042
+ readonly pathParams: readonly [];
1043
+ readonly queryParams: readonly [];
1044
+ };
1045
+ readonly "destinations.list": {
1046
+ readonly id: "destinations.list";
1047
+ readonly method: "GET";
1048
+ readonly path: "/v1/destinations";
1049
+ readonly auth: "token";
1050
+ readonly since: "0.152.0";
1051
+ readonly stream: null;
1052
+ readonly pathParams: readonly [];
1053
+ readonly queryParams: readonly [];
1054
+ };
1055
+ readonly "destinations.add": {
1056
+ readonly id: "destinations.add";
1057
+ readonly method: "POST";
1058
+ readonly path: "/v1/destinations";
1059
+ readonly auth: "token";
1060
+ readonly since: "0.152.0";
1061
+ readonly stream: null;
1062
+ readonly pathParams: readonly [];
1063
+ readonly queryParams: readonly [];
1064
+ };
1065
+ readonly "destinations.get": {
1066
+ readonly id: "destinations.get";
1067
+ readonly method: "GET";
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 "destinations.update": {
1076
+ readonly id: "destinations.update";
1077
+ readonly method: "PUT";
1078
+ readonly path: "/v1/destinations/{id}";
1079
+ readonly auth: "token";
1080
+ readonly since: "0.152.0";
1081
+ readonly stream: null;
1082
+ readonly pathParams: readonly ["id"];
1083
+ readonly queryParams: readonly [];
1084
+ };
1085
+ readonly "destinations.delete": {
1086
+ readonly id: "destinations.delete";
1087
+ readonly method: "DELETE";
1088
+ readonly path: "/v1/destinations/{id}";
1089
+ readonly auth: "token";
1090
+ readonly since: "0.152.0";
1091
+ readonly stream: null;
1092
+ readonly pathParams: readonly ["id"];
1093
+ readonly queryParams: readonly [];
1094
+ };
1095
+ readonly "context.profiles": {
1096
+ readonly id: "context.profiles";
1097
+ readonly method: "GET";
1098
+ readonly path: "/v1/context/profiles";
1099
+ readonly auth: "token";
1100
+ readonly since: "0.148.0";
1101
+ readonly stream: null;
1102
+ readonly pathParams: readonly [];
1103
+ readonly queryParams: readonly [];
1104
+ };
1105
+ readonly "context.providers": {
1106
+ readonly id: "context.providers";
1107
+ readonly method: "GET";
1108
+ readonly path: "/v1/context/providers";
1109
+ readonly auth: "open";
1110
+ readonly since: "0.147.0";
1111
+ readonly stream: null;
1112
+ readonly pathParams: readonly [];
1113
+ readonly queryParams: readonly [];
1114
+ };
1115
+ readonly "context.configureProviders": {
1116
+ readonly id: "context.configureProviders";
1117
+ readonly method: "POST";
1118
+ readonly path: "/v1/context/providers";
1119
+ readonly auth: "token";
1120
+ readonly since: "0.147.0";
1121
+ readonly stream: null;
1122
+ readonly pathParams: readonly [];
1123
+ readonly queryParams: readonly [];
1124
+ };
1125
+ readonly "context.testProvider": {
1126
+ readonly id: "context.testProvider";
1127
+ readonly method: "POST";
1128
+ readonly path: "/v1/context/providers/{id}/test";
1129
+ readonly auth: "token";
1130
+ readonly since: "0.147.0";
1131
+ readonly stream: null;
1132
+ readonly pathParams: readonly ["id"];
1133
+ readonly queryParams: readonly [];
1134
+ };
1135
+ readonly "context.syncBucket": {
1136
+ readonly id: "context.syncBucket";
1137
+ readonly method: "POST";
1138
+ readonly path: "/v1/context/providers/{id}/sync";
1139
+ readonly auth: "token";
1140
+ readonly since: "0.147.0";
1141
+ readonly stream: null;
1142
+ readonly pathParams: readonly ["id"];
1143
+ readonly queryParams: readonly [];
1144
+ };
1145
+ readonly "context.uploadToBucket": {
1146
+ readonly id: "context.uploadToBucket";
1147
+ readonly method: "POST";
1148
+ readonly path: "/v1/context/providers/{id}/upload";
1149
+ readonly auth: "token";
1150
+ readonly since: "0.147.0";
1151
+ readonly stream: null;
1152
+ readonly pathParams: readonly ["id"];
1153
+ readonly queryParams: readonly [];
1154
+ };
985
1155
  readonly "retrieval.read": {
986
1156
  readonly id: "retrieval.read";
987
1157
  readonly method: "POST";
@@ -1920,8 +2090,10 @@ export declare class RetrievalApi {
1920
2090
  export declare class KnowledgeApi {
1921
2091
  private readonly rt;
1922
2092
  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(opts?: RequestOptions): Promise<T.KbList>;
2093
+ /** 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+. */
2094
+ list(query?: {
2095
+ view?: "card";
2096
+ }, opts?: RequestOptions): Promise<T.KbList>;
1925
2097
  /** 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
2098
  create(body: T.KbCreateRequest, opts?: RequestOptions): Promise<T.KbStatusResponse>;
1927
2099
  /** What a base holds — its documents, passages, notes, vectors, entities and connections. — Gateway 0.101.0+. */
@@ -1948,7 +2120,11 @@ export declare class KnowledgeApi {
1948
2120
  search(id: string, body: T.KbSearchRequest, opts?: RequestOptions): Promise<T.KbSearchResponse>;
1949
2121
  /** 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
2122
  research(id: string, body: T.KbResearchRequest, opts?: RequestOptions): Promise<T.KbResearchResponse>;
1951
- /** What connects to a node — its neighbours up to `hops` away — or the path between two. — Gateway 0.101.0+. */
2123
+ /** The whole graph for a map — documents, sections, topics, notes and the top entities, the edges among them, the communities. — Gateway 0.147.0+. */
2124
+ wholeGraph(id: string, query?: {
2125
+ limit?: number;
2126
+ }, opts?: RequestOptions): Promise<T.KbWholeGraph>;
2127
+ /** 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
2128
  graph(id: string, body: T.KbGraphRequest, opts?: RequestOptions): Promise<T.KbGraphResponse>;
1953
2129
  /** The notes filed into a base. — Gateway 0.101.0+. */
1954
2130
  notes(id: string, opts?: RequestOptions): Promise<T.KbNotes>;
@@ -1960,6 +2136,10 @@ export declare class KnowledgeApi {
1960
2136
  access(id: string, opts?: RequestOptions): Promise<T.KbAccessResponse>;
1961
2137
  /** Grant a base to every agent or to the ones named — the owner's act. Grants (docs/knowledge-base.md §3, "knowledge is granted like skills"): a caller with the token or the extension's origin is the owner and reaches every base; any other caller names itself (`X-ChatPanel-Agent: claude`, or `?agent=`) — the gateway's own MCP server sends the connected client's name — and reaches the bases whose `access.agents` is `all` (the default) or names it. `GET /v1/kb` lists only those; a base not granted reads as 404 to that caller. — Requires the gateway token. Gateway 0.101.1+. */
1962
2138
  setAccess(id: string, body: T.KbAccessRequest, opts?: RequestOptions): Promise<T.KbAccessResponse>;
2139
+ /** How a model should answer from a base — its administrator's instructions, or null. Anyone the base is granted to reads them; they also come with the base's status (`kb.instructions`) and every search answer (`instructions`), so a client that only attaches the base gets them. A person's own instructions for a base live in their settings (`ui.kbPrompts`) and are layered after these, unless `personal` is `off`. — Gateway 0.155.0+. */
2140
+ instructions(id: string, opts?: RequestOptions): Promise<T.KbInstructionsResponse>;
2141
+ /** Set a base's instructions — the administrator's act (this gateway's token). Either part may be sent alone: `text` ('' clears it, at most 4000 characters) and `personal` (`allow`, the default, or `off` — a person's own instructions are then not sent with this base). A member of a hosted gateway cannot change them. A team base copied from its bucket answers 409 `read_only`: its builder sets them. — Requires the gateway token. Gateway 0.155.0+. */
2142
+ setInstructions(id: string, body: T.KbInstructionsRequest, opts?: RequestOptions): Promise<T.KbInstructionsResponse>;
1963
2143
  /** Embed every passage that has no vector yet, and say where the embedder stands. — Gateway 0.101.0+. */
1964
2144
  embed(id: string, body: Record<string, never>, opts?: RequestOptions): Promise<T.KbEmbedResponse>;
1965
2145
  /** Keep a folder in a base — read only what is new or changed, drop what is gone. A folder becomes a SOURCE of its base (events kb-folder-sync.js). The first sync makes the base when it does not exist (named after the folder) and reads every file once; each later sync lists the folder — sizes and times, nothing opened — and reads only new and changed files, a changed file REPLACING its document (its id is fixed by its path), a deleted one leaving the base. The walk refuses what a first add refuses: credential stores named as withheld, links out of the folder, the size and count limits. A path is a read on this machine, so this is the owner's only. — Requires the gateway token. Gateway 0.142.0+. */
@@ -1998,6 +2178,65 @@ export declare class KnowledgeApi {
1998
2178
  };
1999
2179
  ms?: number;
2000
2180
  }>;
2181
+ /** One bar per page of a document — passages, characters, forms (prose, list, table) and the printed page label. — Gateway 0.147.0+. */
2182
+ pages(id: string, query?: {
2183
+ doc?: string;
2184
+ }, opts?: RequestOptions): Promise<T.KbPageStrip>;
2185
+ /** 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+. */
2186
+ reveal(id: string, body: T.KbRevealRequest, opts?: RequestOptions): Promise<T.KbRevealResponse>;
2187
+ }
2188
+ /** 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. */
2189
+ export declare class ContextApi {
2190
+ private readonly rt;
2191
+ constructor(rt: Runtime);
2192
+ /** 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+. */
2193
+ search(body: T.ContextRequest, opts?: RequestOptions): Promise<T.ContextResponse>;
2194
+ /** 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+. */
2195
+ profiles(opts?: RequestOptions): Promise<T.CloudProfileList>;
2196
+ /** 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+. */
2197
+ providers(opts?: RequestOptions): Promise<T.ContextProviderList>;
2198
+ /** 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+. */
2199
+ configureProviders(body: Array<T.ContextProviderEdit>, opts?: RequestOptions): Promise<T.ContextProviderList>;
2200
+ /** 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+. */
2201
+ testProvider(id: string, opts?: RequestOptions): Promise<{
2202
+ ok: boolean;
2203
+ error?: string;
2204
+ status?: number;
2205
+ [key: string]: unknown;
2206
+ }>;
2207
+ /** 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+. */
2208
+ syncBucket(id: string, opts?: RequestOptions): Promise<{
2209
+ [key: string]: unknown;
2210
+ }>;
2211
+ /** Put a document into a team bucket under its prefix (then a builder indexes it). — Requires the gateway token. Gateway 0.147.0+. */
2212
+ uploadToBucket(id: string, body: {
2213
+ /** The object name under the prefix (no .., not hidden). */
2214
+ name: string;
2215
+ data: string;
2216
+ }, opts?: RequestOptions): Promise<{
2217
+ ok: boolean;
2218
+ key?: string;
2219
+ building?: boolean;
2220
+ }>;
2221
+ }
2222
+ /** The gateway's own models — API providers and local agents it routes to — listed and edited one at a time. */
2223
+ export declare class DestinationsApi {
2224
+ private readonly rt;
2225
+ constructor(rt: Runtime);
2226
+ /** 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+. */
2227
+ list(opts?: RequestOptions): Promise<T.DestinationList>;
2228
+ /** Add one destination. A name already in use is refused (409), never overwritten. — Requires the gateway token. Gateway 0.152.0+. */
2229
+ add(body: T.DestinationInput, opts?: RequestOptions): Promise<T.DestinationSaved>;
2230
+ /** One destination. Never a key. — Requires the gateway token. Gateway 0.152.0+. */
2231
+ get(id: string, opts?: RequestOptions): Promise<{
2232
+ destination: T.Destination;
2233
+ }>;
2234
+ /** 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+. */
2235
+ update(id: string, body: T.DestinationInput, opts?: RequestOptions): Promise<T.DestinationSaved>;
2236
+ /** Remove one destination. — Requires the gateway token. Gateway 0.152.0+. */
2237
+ delete(id: string, opts?: RequestOptions): Promise<{
2238
+ deleted: string;
2239
+ }>;
2001
2240
  }
2002
2241
  /** The model ledger — every engine's card. */
2003
2242
  export declare class EnginesApi {
@@ -2233,6 +2472,8 @@ export declare function buildApi(rt: Runtime): {
2233
2472
  runtime: RuntimeApi;
2234
2473
  retrieval: RetrievalApi;
2235
2474
  knowledge: KnowledgeApi;
2475
+ context: ContextApi;
2476
+ destinations: DestinationsApi;
2236
2477
  engines: EnginesApi;
2237
2478
  skills: SkillsApi;
2238
2479
  a2a: A2aApi;
@@ -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,14 +90,31 @@ 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: [] },
96
97
  "knowledge.noteStatus": { id: "knowledge.noteStatus", method: "POST", path: "/v1/kb/{id}/notes/{note}", auth: "token", since: "0.101.0", stream: null, pathParams: ["id", "note"], queryParams: [] },
97
98
  "knowledge.access": { id: "knowledge.access", method: "GET", path: "/v1/kb/{id}/access", auth: "open", since: "0.101.1", stream: null, pathParams: ["id"], queryParams: [] },
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: [] },
100
+ "knowledge.instructions": { id: "knowledge.instructions", method: "GET", path: "/v1/kb/{id}/instructions", auth: "open", since: "0.155.0", stream: null, pathParams: ["id"], queryParams: [] },
101
+ "knowledge.setInstructions": { id: "knowledge.setInstructions", method: "POST", path: "/v1/kb/{id}/instructions", auth: "token", since: "0.155.0", stream: null, pathParams: ["id"], queryParams: [] },
99
102
  "knowledge.embed": { id: "knowledge.embed", method: "POST", path: "/v1/kb/{id}/embed", auth: "open", since: "0.101.0", stream: null, pathParams: ["id"], queryParams: [] },
100
103
  "knowledge.sync": { id: "knowledge.sync", method: "POST", path: "/v1/kb/{id}/sync", auth: "token", since: "0.142.0", stream: null, pathParams: ["id"], queryParams: [] },
104
+ "knowledge.pages": { id: "knowledge.pages", method: "GET", path: "/v1/kb/{id}/pages", auth: "open", since: "0.147.0", stream: null, pathParams: ["id"], queryParams: ["doc"] },
105
+ "knowledge.reveal": { id: "knowledge.reveal", method: "POST", path: "/v1/kb/{id}/reveal", auth: "token", since: "0.147.0", stream: null, pathParams: ["id"], queryParams: [] },
106
+ "context.search": { id: "context.search", method: "POST", path: "/v1/context", auth: "open", since: "0.147.0", stream: null, pathParams: [], queryParams: [] },
107
+ "destinations.list": { id: "destinations.list", method: "GET", path: "/v1/destinations", auth: "token", since: "0.152.0", stream: null, pathParams: [], queryParams: [] },
108
+ "destinations.add": { id: "destinations.add", method: "POST", path: "/v1/destinations", auth: "token", since: "0.152.0", stream: null, pathParams: [], queryParams: [] },
109
+ "destinations.get": { id: "destinations.get", method: "GET", path: "/v1/destinations/{id}", auth: "token", since: "0.152.0", stream: null, pathParams: ["id"], queryParams: [] },
110
+ "destinations.update": { id: "destinations.update", method: "PUT", path: "/v1/destinations/{id}", auth: "token", since: "0.152.0", stream: null, pathParams: ["id"], queryParams: [] },
111
+ "destinations.delete": { id: "destinations.delete", method: "DELETE", path: "/v1/destinations/{id}", auth: "token", since: "0.152.0", stream: null, pathParams: ["id"], queryParams: [] },
112
+ "context.profiles": { id: "context.profiles", method: "GET", path: "/v1/context/profiles", auth: "token", since: "0.148.0", stream: null, pathParams: [], queryParams: [] },
113
+ "context.providers": { id: "context.providers", method: "GET", path: "/v1/context/providers", auth: "open", since: "0.147.0", stream: null, pathParams: [], queryParams: [] },
114
+ "context.configureProviders": { id: "context.configureProviders", method: "POST", path: "/v1/context/providers", auth: "token", since: "0.147.0", stream: null, pathParams: [], queryParams: [] },
115
+ "context.testProvider": { id: "context.testProvider", method: "POST", path: "/v1/context/providers/{id}/test", auth: "token", since: "0.147.0", stream: null, pathParams: ["id"], queryParams: [] },
116
+ "context.syncBucket": { id: "context.syncBucket", method: "POST", path: "/v1/context/providers/{id}/sync", auth: "token", since: "0.147.0", stream: null, pathParams: ["id"], queryParams: [] },
117
+ "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
118
  "retrieval.read": { id: "retrieval.read", method: "POST", path: "/v1/read", auth: "open", since: "0.14.0", stream: null, pathParams: [], queryParams: [] },
102
119
  "retrieval.readAlias": { id: "retrieval.readAlias", method: "GET", path: "/v1/read/{url}", auth: "open", since: "0.14.0", stream: null, pathParams: ["url"], queryParams: [] },
103
120
  "engines.list": { id: "engines.list", method: "GET", path: "/v1/engines", auth: "open", since: "0.6.89", stream: null, pathParams: [], queryParams: ["minCalls"] },
@@ -558,9 +575,9 @@ export class RetrievalApi {
558
575
  export class KnowledgeApi {
559
576
  rt;
560
577
  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: undefined, headers: opts?.headers, body: undefined, opts });
578
+ /** 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+. */
579
+ list(query, opts) {
580
+ return this.rt.request(OPERATIONS["knowledge.list"], { path: {}, query: query, headers: opts?.headers, body: undefined, opts });
564
581
  }
565
582
  /** 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
583
  create(body, opts) {
@@ -606,7 +623,11 @@ export class KnowledgeApi {
606
623
  research(id, body, opts) {
607
624
  return this.rt.request(OPERATIONS["knowledge.research"], { path: { id }, query: undefined, headers: opts?.headers, body: body, opts });
608
625
  }
609
- /** What connects to a node — its neighbours up to `hops` away — or the path between two. — Gateway 0.101.0+. */
626
+ /** The whole graph for a map — documents, sections, topics, notes and the top entities, the edges among them, the communities. — Gateway 0.147.0+. */
627
+ wholeGraph(id, query, opts) {
628
+ return this.rt.request(OPERATIONS["knowledge.wholeGraph"], { path: { id }, query: query, headers: opts?.headers, body: undefined, opts });
629
+ }
630
+ /** 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
631
  graph(id, body, opts) {
611
632
  return this.rt.request(OPERATIONS["knowledge.graph"], { path: { id }, query: undefined, headers: opts?.headers, body: body, opts });
612
633
  }
@@ -630,6 +651,14 @@ export class KnowledgeApi {
630
651
  setAccess(id, body, opts) {
631
652
  return this.rt.request(OPERATIONS["knowledge.setAccess"], { path: { id }, query: undefined, headers: opts?.headers, body: body, opts });
632
653
  }
654
+ /** How a model should answer from a base — its administrator's instructions, or null. Anyone the base is granted to reads them; they also come with the base's status (`kb.instructions`) and every search answer (`instructions`), so a client that only attaches the base gets them. A person's own instructions for a base live in their settings (`ui.kbPrompts`) and are layered after these, unless `personal` is `off`. — Gateway 0.155.0+. */
655
+ instructions(id, opts) {
656
+ return this.rt.request(OPERATIONS["knowledge.instructions"], { path: { id }, query: undefined, headers: opts?.headers, body: undefined, opts });
657
+ }
658
+ /** Set a base's instructions — the administrator's act (this gateway's token). Either part may be sent alone: `text` ('' clears it, at most 4000 characters) and `personal` (`allow`, the default, or `off` — a person's own instructions are then not sent with this base). A member of a hosted gateway cannot change them. A team base copied from its bucket answers 409 `read_only`: its builder sets them. — Requires the gateway token. Gateway 0.155.0+. */
659
+ setInstructions(id, body, opts) {
660
+ return this.rt.request(OPERATIONS["knowledge.setInstructions"], { path: { id }, query: undefined, headers: opts?.headers, body: body, opts });
661
+ }
633
662
  /** Embed every passage that has no vector yet, and say where the embedder stands. — Gateway 0.101.0+. */
634
663
  embed(id, body, opts) {
635
664
  return this.rt.request(OPERATIONS["knowledge.embed"], { path: { id }, query: undefined, headers: opts?.headers, body: body, opts });
@@ -638,6 +667,72 @@ export class KnowledgeApi {
638
667
  sync(id, body, opts) {
639
668
  return this.rt.request(OPERATIONS["knowledge.sync"], { path: { id }, query: undefined, headers: opts?.headers, body: body, opts });
640
669
  }
670
+ /** One bar per page of a document — passages, characters, forms (prose, list, table) and the printed page label. — Gateway 0.147.0+. */
671
+ pages(id, query, opts) {
672
+ return this.rt.request(OPERATIONS["knowledge.pages"], { path: { id }, query: query, headers: opts?.headers, body: undefined, opts });
673
+ }
674
+ /** 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+. */
675
+ reveal(id, body, opts) {
676
+ return this.rt.request(OPERATIONS["knowledge.reveal"], { path: { id }, query: undefined, headers: opts?.headers, body: body, opts });
677
+ }
678
+ }
679
+ /** 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. */
680
+ export class ContextApi {
681
+ rt;
682
+ constructor(rt) { this.rt = rt; }
683
+ /** 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+. */
684
+ search(body, opts) {
685
+ return this.rt.request(OPERATIONS["context.search"], { path: {}, query: undefined, headers: opts?.headers, body: body, opts });
686
+ }
687
+ /** 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+. */
688
+ profiles(opts) {
689
+ return this.rt.request(OPERATIONS["context.profiles"], { path: {}, query: undefined, headers: opts?.headers, body: undefined, opts });
690
+ }
691
+ /** 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+. */
692
+ providers(opts) {
693
+ return this.rt.request(OPERATIONS["context.providers"], { path: {}, query: undefined, headers: opts?.headers, body: undefined, opts });
694
+ }
695
+ /** 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+. */
696
+ configureProviders(body, opts) {
697
+ return this.rt.request(OPERATIONS["context.configureProviders"], { path: {}, query: undefined, headers: opts?.headers, body: body, opts });
698
+ }
699
+ /** 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+. */
700
+ testProvider(id, opts) {
701
+ return this.rt.request(OPERATIONS["context.testProvider"], { path: { id }, query: undefined, headers: opts?.headers, body: undefined, opts });
702
+ }
703
+ /** 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+. */
704
+ syncBucket(id, opts) {
705
+ return this.rt.request(OPERATIONS["context.syncBucket"], { path: { id }, query: undefined, headers: opts?.headers, body: undefined, opts });
706
+ }
707
+ /** Put a document into a team bucket under its prefix (then a builder indexes it). — Requires the gateway token. Gateway 0.147.0+. */
708
+ uploadToBucket(id, body, opts) {
709
+ return this.rt.request(OPERATIONS["context.uploadToBucket"], { path: { id }, query: undefined, headers: opts?.headers, body: body, opts });
710
+ }
711
+ }
712
+ /** The gateway's own models — API providers and local agents it routes to — listed and edited one at a time. */
713
+ export class DestinationsApi {
714
+ rt;
715
+ constructor(rt) { this.rt = rt; }
716
+ /** 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+. */
717
+ list(opts) {
718
+ return this.rt.request(OPERATIONS["destinations.list"], { path: {}, query: undefined, headers: opts?.headers, body: undefined, opts });
719
+ }
720
+ /** Add one destination. A name already in use is refused (409), never overwritten. — Requires the gateway token. Gateway 0.152.0+. */
721
+ add(body, opts) {
722
+ return this.rt.request(OPERATIONS["destinations.add"], { path: {}, query: undefined, headers: opts?.headers, body: body, opts });
723
+ }
724
+ /** One destination. Never a key. — Requires the gateway token. Gateway 0.152.0+. */
725
+ get(id, opts) {
726
+ return this.rt.request(OPERATIONS["destinations.get"], { path: { id }, query: undefined, headers: opts?.headers, body: undefined, opts });
727
+ }
728
+ /** 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+. */
729
+ update(id, body, opts) {
730
+ return this.rt.request(OPERATIONS["destinations.update"], { path: { id }, query: undefined, headers: opts?.headers, body: body, opts });
731
+ }
732
+ /** Remove one destination. — Requires the gateway token. Gateway 0.152.0+. */
733
+ delete(id, opts) {
734
+ return this.rt.request(OPERATIONS["destinations.delete"], { path: { id }, query: undefined, headers: opts?.headers, body: undefined, opts });
735
+ }
641
736
  }
642
737
  /** The model ledger — every engine's card. */
643
738
  export class EnginesApi {
@@ -829,6 +924,8 @@ export function buildApi(rt) {
829
924
  runtime: new RuntimeApi(rt),
830
925
  retrieval: new RetrievalApi(rt),
831
926
  knowledge: new KnowledgeApi(rt),
927
+ context: new ContextApi(rt),
928
+ destinations: new DestinationsApi(rt),
832
929
  engines: new EnginesApi(rt),
833
930
  skills: new SkillsApi(rt),
834
931
  a2a: new A2aApi(rt),
@@ -607,11 +607,39 @@ export interface KbAccessRequest {
607
607
  export interface KbAccessResponse {
608
608
  access: KbAccess;
609
609
  }
610
+ /** A base's own instructions for the model that answers from it, set by its administrator. */
611
+ export interface KbInstructions {
612
+ text: string;
613
+ /** `off`: a person's own instructions are not sent with this base. */
614
+ personal: "allow" | "off";
615
+ /** When they were last set (ms since the epoch). */
616
+ at?: number;
617
+ }
618
+ export interface KbInstructionsRequest {
619
+ /** '' clears them. */
620
+ text?: string;
621
+ personal?: "allow" | "off";
622
+ }
623
+ export interface KbInstructionsResponse {
624
+ instructions: KbInstructions;
625
+ /** May this caller set them — the gateway's token, not a team copy. A client draws one box for a person's own base, the administrator's read-only beside the person's own otherwise. */
626
+ canInstruct?: boolean;
627
+ }
610
628
  export interface KbOkResponse {
611
629
  ok: boolean;
612
630
  }
613
631
  export interface KbList {
614
- kbs: Array<{
632
+ /** With `view=card` (gateway 0.147.0). */
633
+ cards?: Array<KbCard>;
634
+ /** With `view=card`, for the owner: each configured gateway's bases, or why it did not answer. */
635
+ remote?: Array<{
636
+ gateway?: string;
637
+ id?: string;
638
+ host?: string;
639
+ cards?: Array<KbCard>;
640
+ error?: string;
641
+ }>;
642
+ kbs?: Array<{
615
643
  id: string;
616
644
  name: string;
617
645
  docs: number;
@@ -621,6 +649,258 @@ export interface KbList {
621
649
  access?: KbAccess;
622
650
  }>;
623
651
  }
652
+ /** 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. */
653
+ export interface KbFilters {
654
+ pages?: Array<number>;
655
+ label?: string;
656
+ section?: string;
657
+ form?: "prose" | "list" | "table";
658
+ types?: Array<string>;
659
+ docs?: Array<string>;
660
+ }
661
+ export interface KbCard {
662
+ id: string;
663
+ name: string;
664
+ /** `team`: copied from a bucket by revision; `remote`: held on another gateway. */
665
+ kind: "local" | "team" | "remote";
666
+ /** The gateway that holds a remote base. */
667
+ gateway?: string;
668
+ docs?: number;
669
+ pages?: number;
670
+ chunks?: number;
671
+ vectors?: number;
672
+ entities?: number;
673
+ notes?: number;
674
+ /** Percent of passages meaning search reaches. */
675
+ coverage?: number;
676
+ types?: Array<{
677
+ type?: string;
678
+ docs?: number;
679
+ chunks?: number;
680
+ share?: number;
681
+ }>;
682
+ strip?: Array<{
683
+ section?: string;
684
+ doc?: string;
685
+ chars?: number;
686
+ share?: number;
687
+ table?: boolean;
688
+ }>;
689
+ health?: Array<{
690
+ id?: string;
691
+ severity?: "ok" | "info" | "warn" | "risk";
692
+ label?: string;
693
+ value?: number;
694
+ action?: string;
695
+ }>;
696
+ pill?: {
697
+ severity?: string;
698
+ label?: string;
699
+ };
700
+ updatedAt?: number;
701
+ syncedAt?: number;
702
+ team?: {
703
+ revision?: number;
704
+ builtAt?: number;
705
+ builtBy?: string;
706
+ /** The store, its region, the bucket and prefix — never a key. */
707
+ where?: {
708
+ [key: string]: unknown;
709
+ };
710
+ freshness?: {
711
+ state?: "current" | "updating" | "behind" | "offline" | "never";
712
+ label?: string;
713
+ [key: string]: unknown;
714
+ };
715
+ };
716
+ /** Whether this computer has a file to show. */
717
+ reveal?: boolean;
718
+ [key: string]: unknown;
719
+ }
720
+ export interface KbWholeGraph {
721
+ nodes: Array<{
722
+ id?: string;
723
+ kind?: string;
724
+ label?: string;
725
+ count?: number;
726
+ weight?: number;
727
+ doc?: string;
728
+ }>;
729
+ edges: Array<{
730
+ from?: string;
731
+ to?: string;
732
+ kind?: string;
733
+ weight?: number;
734
+ }>;
735
+ communities: Array<{
736
+ id?: string;
737
+ label?: string;
738
+ members?: Array<string>;
739
+ size?: number;
740
+ }>;
741
+ total?: {
742
+ nodes?: number;
743
+ edges?: number;
744
+ };
745
+ }
746
+ export interface KbPageStrip {
747
+ doc: string;
748
+ title?: string;
749
+ pages: Array<{
750
+ page?: number;
751
+ label?: string;
752
+ passages?: number;
753
+ chars?: number;
754
+ forms?: {
755
+ prose?: number;
756
+ list?: number;
757
+ table?: number;
758
+ };
759
+ }>;
760
+ }
761
+ /** A document id, the index of a kept folder, or nothing (the base's folder). */
762
+ export interface KbRevealRequest {
763
+ doc?: string;
764
+ source?: number;
765
+ }
766
+ export interface KbRevealResponse {
767
+ ok: boolean;
768
+ revealed: "file" | "folder" | "index";
769
+ }
770
+ export interface ContextRequest {
771
+ query: string;
772
+ sources?: Array<string>;
773
+ filters?: KbFilters;
774
+ max_tokens?: number;
775
+ limit?: number;
776
+ deadline_ms?: number;
777
+ rerank?: boolean;
778
+ }
779
+ export interface ContextChunk {
780
+ id: string;
781
+ source: {
782
+ /** kb, web, bedrock, gw. */
783
+ type: string;
784
+ /** The base id, the engine, the provider id. */
785
+ provider: string;
786
+ /** kb://<base>/<passage>, a web url, an s3:// location. */
787
+ uri?: string;
788
+ name?: string;
789
+ /** The other gateway that answered, when one did. */
790
+ gateway?: string;
791
+ };
792
+ title?: string;
793
+ content: string;
794
+ /** The provider's own score (not comparable across providers). */
795
+ rawScore?: number;
796
+ /** 0–1 within this answer, after fusion. */
797
+ score: number;
798
+ tokens: number;
799
+ at?: number;
800
+ /** For a passage: kb, kbName, doc, page, label, section, form, cite, lanes. */
801
+ meta?: {
802
+ [key: string]: unknown;
803
+ };
804
+ }
805
+ export interface ContextResponse {
806
+ query?: string;
807
+ chunks: Array<ContextChunk>;
808
+ tokens: number;
809
+ /** Ranked passages that did not fit max_tokens. */
810
+ dropped?: Array<string>;
811
+ providers: {
812
+ [key: string]: {
813
+ ms?: number;
814
+ count?: number;
815
+ error?: string;
816
+ timedOut?: boolean;
817
+ redacted?: boolean;
818
+ };
819
+ };
820
+ reranked?: boolean;
821
+ ms?: number;
822
+ }
823
+ export interface CloudProfileList {
824
+ profiles: Array<{
825
+ /** aws: the shared credentials file (any S3-compatible store, Bedrock) · oci: an OCI config profile (OCI Object Storage, its own API). */
826
+ from: "aws" | "oci";
827
+ name: string;
828
+ region?: string;
829
+ /** The profile's endpoint_url */
830
+ endpoint?: string;
831
+ usable: boolean;
832
+ /** Why a profile cannot sign here. */
833
+ why?: string;
834
+ }>;
835
+ }
836
+ export interface ContextProviderList {
837
+ providers: Array<{
838
+ id: string;
839
+ kind?: "bedrock" | "gateway" | "bucket";
840
+ type: string;
841
+ /** What to put in `sources`. */
842
+ source?: string;
843
+ name?: string;
844
+ configured?: boolean;
845
+ enabled?: boolean;
846
+ remote?: boolean;
847
+ host?: string;
848
+ hasKey?: boolean;
849
+ hasToken?: boolean;
850
+ trusted?: boolean;
851
+ [key: string]: unknown;
852
+ }>;
853
+ }
854
+ /** 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 }. */
855
+ export interface ContextProviderEdit {
856
+ id: string;
857
+ kind?: "bedrock" | "gateway" | "bucket";
858
+ name?: string;
859
+ enabled?: boolean;
860
+ remove?: boolean;
861
+ [key: string]: unknown;
862
+ }
863
+ /** Where the gateway can send a turn — an API provider or a local CLI agent. The key is never returned. */
864
+ export interface Destination {
865
+ /** Its name ("Example AI", "claude"). */
866
+ id: string;
867
+ type: "api" | "agent";
868
+ models: Array<string>;
869
+ /** api: the provider's base URL. */
870
+ baseUrl?: string;
871
+ /** api: the API shape it speaks. */
872
+ protocol?: "openai" | "anthropic";
873
+ /** api: a key is saved. */
874
+ hasKey?: boolean;
875
+ /** agent: the bridge agent that runs it. */
876
+ agent?: string;
877
+ /** Set when an engine the Runtime started serves it. */
878
+ service?: string;
879
+ /** Made from a panel endpoint; deleting that endpoint removes it. */
880
+ fromEndpoint?: boolean;
881
+ endpointId?: string;
882
+ [key: string]: unknown;
883
+ }
884
+ export interface DestinationInput {
885
+ /** Letters, numbers, spaces and . _ : @ + ( ) - ; no slashes. */
886
+ id: string;
887
+ type?: "api" | "agent";
888
+ models?: Array<string> | string;
889
+ /** api: required, http(s). */
890
+ baseUrl?: string;
891
+ protocol?: "openai" | "anthropic";
892
+ /** api: write-only. Leave out to keep the saved one (same address only). */
893
+ apiKey?: string;
894
+ agent?: string;
895
+ }
896
+ export interface DestinationList {
897
+ destinations: Array<Destination>;
898
+ }
899
+ export interface DestinationSaved {
900
+ destination: Destination;
901
+ /** The saved key was not kept because the address changed — ask for it again. */
902
+ keyDropped: boolean;
903
+ }
624
904
  export interface KbCreateRequest {
625
905
  /** Chosen by the caller; made up when absent. */
626
906
  id?: string;
@@ -664,6 +944,9 @@ export interface KbStatus {
664
944
  /** The tightest provenance of its documents (`internal`, `web`, or empty). */
665
945
  reach?: string;
666
946
  access?: KbAccess;
947
+ instructions?: KbInstructions;
948
+ /** May this caller set the base's instructions (GET /v1/kb/{id} only). */
949
+ canInstruct?: boolean;
667
950
  documents: Array<KbDocument>;
668
951
  /** On disk. */
669
952
  bytes?: number;
@@ -729,9 +1012,16 @@ export interface KbPassage {
729
1012
  title?: string;
730
1013
  kind?: "text" | "note";
731
1014
  page?: number;
1015
+ /** Past `page` when one sentence crosses a page break — the passage is the sentence whole. */
732
1016
  pageEnd?: number;
1017
+ /** The page number printed on `page` (`'iv'`, `'17'`) — what a reader of the document calls it. Absent when none is printed. */
1018
+ label?: string;
1019
+ /** The printed number of `pageEnd`, when the passage crosses a page break. */
1020
+ labelEnd?: string;
733
1021
  /** The heading path, ` › `-joined. */
734
1022
  section?: string;
1023
+ /** 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. */
1024
+ form?: "prose" | "list" | "table";
735
1025
  text: string;
736
1026
  chars?: number;
737
1027
  /** The fused rank score (RRF) — only its order means anything. */
@@ -763,9 +1053,11 @@ export interface KbSearchRequest {
763
1053
  /** `false`: skip the reranker. */
764
1054
  rerank?: boolean;
765
1055
  budgetMs?: number;
1056
+ filters?: KbFilters;
766
1057
  }
767
1058
  export interface KbSearchResponse {
768
1059
  results: Array<KbPassage>;
1060
+ instructions?: KbInstructions;
769
1061
  /** How many candidates each lane found. */
770
1062
  lanes: {
771
1063
  text?: number;
@@ -839,10 +1131,12 @@ export interface KbResearchResponse {
839
1131
  ms: number;
840
1132
  }
841
1133
  export interface KbGraphRequest {
842
- /** An entity, section or topic by name (or a node id). */
1134
+ /** A name, a defined term, a section or a topic — or a passage id as a search prints it (`d3f2a1b4c5d6#12`). */
843
1135
  node: string;
844
1136
  /** A second node: the path from `node` to it. */
845
1137
  to?: string;
1138
+ /** The question the walk is for (since 0.149.0): `passages` and `next` are ranked toward it. */
1139
+ query?: string;
846
1140
  hops?: number;
847
1141
  kinds?: Array<"doc" | "section" | "entity" | "topic" | "note" | "chunk">;
848
1142
  limit?: number;
@@ -868,6 +1162,29 @@ export interface KbGraphResponse {
868
1162
  label?: string;
869
1163
  kind?: string;
870
1164
  }>;
1165
+ /** 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`. */
1166
+ passages?: Array<{
1167
+ id?: string;
1168
+ why?: string;
1169
+ title?: string;
1170
+ page?: number;
1171
+ /** The printed page label. */
1172
+ label?: string;
1173
+ section?: string;
1174
+ cite?: string;
1175
+ /** The passage's first characters; read the whole one by id. */
1176
+ text?: string;
1177
+ /** How much of the question it answers (with `query`). */
1178
+ relevance?: number;
1179
+ }>;
1180
+ /** Since 0.149.0 — the names to step to next, toward the question when one was sent. */
1181
+ next?: Array<{
1182
+ id?: string;
1183
+ label?: string;
1184
+ kind?: string;
1185
+ weight?: number;
1186
+ relevance?: number;
1187
+ }>;
871
1188
  message?: string;
872
1189
  }
873
1190
  export interface KbPage {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chatpanel/sdk",
3
- "version": "0.31.0",
3
+ "version": "0.37.1",
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",