@chatpanel/sdk 0.36.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.
@@ -972,6 +972,26 @@ export declare const OPERATIONS: {
972
972
  readonly pathParams: readonly ["id"];
973
973
  readonly queryParams: readonly [];
974
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
+ };
975
995
  readonly "knowledge.embed": {
976
996
  readonly id: "knowledge.embed";
977
997
  readonly method: "POST";
@@ -2116,6 +2136,10 @@ export declare class KnowledgeApi {
2116
2136
  access(id: string, opts?: RequestOptions): Promise<T.KbAccessResponse>;
2117
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+. */
2118
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>;
2119
2143
  /** Embed every passage that has no vector yet, and say where the embedder stands. — Gateway 0.101.0+. */
2120
2144
  embed(id: string, body: Record<string, never>, opts?: RequestOptions): Promise<T.KbEmbedResponse>;
2121
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+. */
@@ -97,6 +97,8 @@ export const OPERATIONS = {
97
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: [] },
98
98
  "knowledge.access": { id: "knowledge.access", method: "GET", path: "/v1/kb/{id}/access", auth: "open", since: "0.101.1", stream: null, pathParams: ["id"], queryParams: [] },
99
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: [] },
100
102
  "knowledge.embed": { id: "knowledge.embed", method: "POST", path: "/v1/kb/{id}/embed", auth: "open", since: "0.101.0", stream: null, pathParams: ["id"], queryParams: [] },
101
103
  "knowledge.sync": { id: "knowledge.sync", method: "POST", path: "/v1/kb/{id}/sync", auth: "token", since: "0.142.0", stream: null, pathParams: ["id"], queryParams: [] },
102
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"] },
@@ -649,6 +651,14 @@ export class KnowledgeApi {
649
651
  setAccess(id, body, opts) {
650
652
  return this.rt.request(OPERATIONS["knowledge.setAccess"], { path: { id }, query: undefined, headers: opts?.headers, body: body, opts });
651
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
+ }
652
662
  /** Embed every passage that has no vector yet, and say where the embedder stands. — Gateway 0.101.0+. */
653
663
  embed(id, body, opts) {
654
664
  return this.rt.request(OPERATIONS["knowledge.embed"], { path: { id }, query: undefined, headers: opts?.headers, body: body, opts });
@@ -607,6 +607,24 @@ 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
  }
@@ -926,6 +944,9 @@ export interface KbStatus {
926
944
  /** The tightest provenance of its documents (`internal`, `web`, or empty). */
927
945
  reach?: string;
928
946
  access?: KbAccess;
947
+ instructions?: KbInstructions;
948
+ /** May this caller set the base's instructions (GET /v1/kb/{id} only). */
949
+ canInstruct?: boolean;
929
950
  documents: Array<KbDocument>;
930
951
  /** On disk. */
931
952
  bytes?: number;
@@ -1036,6 +1057,7 @@ export interface KbSearchRequest {
1036
1057
  }
1037
1058
  export interface KbSearchResponse {
1038
1059
  results: Array<KbPassage>;
1060
+ instructions?: KbInstructions;
1039
1061
  /** How many candidates each lane found. */
1040
1062
  lanes: {
1041
1063
  text?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chatpanel/sdk",
3
- "version": "0.36.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",