@chatpanel/sdk 0.28.0 → 0.30.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.
@@ -972,6 +972,16 @@ export declare const OPERATIONS: {
972
972
  readonly pathParams: readonly ["id"];
973
973
  readonly queryParams: readonly [];
974
974
  };
975
+ readonly "knowledge.sync": {
976
+ readonly id: "knowledge.sync";
977
+ readonly method: "POST";
978
+ readonly path: "/v1/kb/{id}/sync";
979
+ readonly auth: "token";
980
+ readonly since: "0.142.0";
981
+ readonly stream: null;
982
+ readonly pathParams: readonly ["id"];
983
+ readonly queryParams: readonly [];
984
+ };
975
985
  readonly "retrieval.read": {
976
986
  readonly id: "retrieval.read";
977
987
  readonly method: "POST";
@@ -1152,6 +1162,86 @@ export declare const OPERATIONS: {
1152
1162
  readonly pathParams: readonly ["skillId", "path"];
1153
1163
  readonly queryParams: readonly ["workdir"];
1154
1164
  };
1165
+ readonly "contexts.list": {
1166
+ readonly id: "contexts.list";
1167
+ readonly method: "GET";
1168
+ readonly path: "/v1/contexts";
1169
+ readonly auth: "open";
1170
+ readonly since: "0.141.0";
1171
+ readonly stream: null;
1172
+ readonly pathParams: readonly [];
1173
+ readonly queryParams: readonly [];
1174
+ };
1175
+ readonly "contexts.create": {
1176
+ readonly id: "contexts.create";
1177
+ readonly method: "POST";
1178
+ readonly path: "/v1/contexts";
1179
+ readonly auth: "token";
1180
+ readonly since: "0.141.0";
1181
+ readonly stream: null;
1182
+ readonly pathParams: readonly [];
1183
+ readonly queryParams: readonly [];
1184
+ };
1185
+ readonly "contexts.suggest": {
1186
+ readonly id: "contexts.suggest";
1187
+ readonly method: "POST";
1188
+ readonly path: "/v1/contexts/suggest";
1189
+ readonly auth: "open";
1190
+ readonly since: "0.141.0";
1191
+ readonly stream: null;
1192
+ readonly pathParams: readonly [];
1193
+ readonly queryParams: readonly [];
1194
+ };
1195
+ readonly "contexts.get": {
1196
+ readonly id: "contexts.get";
1197
+ readonly method: "GET";
1198
+ readonly path: "/v1/contexts/{contextId}";
1199
+ readonly auth: "open";
1200
+ readonly since: "0.141.0";
1201
+ readonly stream: null;
1202
+ readonly pathParams: readonly ["contextId"];
1203
+ readonly queryParams: readonly [];
1204
+ };
1205
+ readonly "contexts.remove": {
1206
+ readonly id: "contexts.remove";
1207
+ readonly method: "DELETE";
1208
+ readonly path: "/v1/contexts/{contextId}";
1209
+ readonly auth: "token";
1210
+ readonly since: "0.141.0";
1211
+ readonly stream: null;
1212
+ readonly pathParams: readonly ["contextId"];
1213
+ readonly queryParams: readonly [];
1214
+ };
1215
+ readonly "contexts.edit": {
1216
+ readonly id: "contexts.edit";
1217
+ readonly method: "PATCH";
1218
+ readonly path: "/v1/contexts/{contextId}";
1219
+ readonly auth: "token";
1220
+ readonly since: "0.141.0";
1221
+ readonly stream: null;
1222
+ readonly pathParams: readonly ["contextId"];
1223
+ readonly queryParams: readonly [];
1224
+ };
1225
+ readonly "contexts.items": {
1226
+ readonly id: "contexts.items";
1227
+ readonly method: "POST";
1228
+ readonly path: "/v1/contexts/{contextId}/items";
1229
+ readonly auth: "token";
1230
+ readonly since: "0.141.0";
1231
+ readonly stream: null;
1232
+ readonly pathParams: readonly ["contextId"];
1233
+ readonly queryParams: readonly [];
1234
+ };
1235
+ readonly "contexts.scope": {
1236
+ readonly id: "contexts.scope";
1237
+ readonly method: "GET";
1238
+ readonly path: "/v1/contexts/{contextId}/scope";
1239
+ readonly auth: "open";
1240
+ readonly since: "0.141.0";
1241
+ readonly stream: null;
1242
+ readonly pathParams: readonly ["contextId"];
1243
+ readonly queryParams: readonly [];
1244
+ };
1155
1245
  readonly "fusions.list": {
1156
1246
  readonly id: "fusions.list";
1157
1247
  readonly method: "GET";
@@ -1872,6 +1962,42 @@ export declare class KnowledgeApi {
1872
1962
  setAccess(id: string, body: T.KbAccessRequest, opts?: RequestOptions): Promise<T.KbAccessResponse>;
1873
1963
  /** Embed every passage that has no vector yet, and say where the embedder stands. — Gateway 0.101.0+. */
1874
1964
  embed(id: string, body: Record<string, never>, opts?: RequestOptions): Promise<T.KbEmbedResponse>;
1965
+ /** 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+. */
1966
+ sync(id: string, body: {
1967
+ /** The folder (absolute */
1968
+ path: string;
1969
+ /** Only these file types, e.g. ["md", "pdf"]. */
1970
+ include?: Array<string>;
1971
+ /** The base's name when the sync makes it. */
1972
+ name?: string;
1973
+ }, opts?: RequestOptions): Promise<{
1974
+ /** The folder as resolved (its real path). */
1975
+ folder: string;
1976
+ /** Files read for the first time: { id, title, pages, chunks, path }. */
1977
+ added: Array<{
1978
+ [key: string]: unknown;
1979
+ }>;
1980
+ /** Files read again because their size or time moved: { id, title, pages, chunks, replaced, path }. */
1981
+ changed: Array<{
1982
+ [key: string]: unknown;
1983
+ }>;
1984
+ /** Files gone from the folder */
1985
+ removed: Array<string>;
1986
+ /** Files unchanged — not opened. */
1987
+ same: number;
1988
+ /** Files left out and why: { path, why }. */
1989
+ skipped?: Array<{
1990
+ [key: string]: unknown;
1991
+ }>;
1992
+ embedded?: number;
1993
+ /** True when this sync made the base. */
1994
+ made?: boolean;
1995
+ /** The base's status after the sync. */
1996
+ kb: {
1997
+ [key: string]: unknown;
1998
+ };
1999
+ ms?: number;
2000
+ }>;
1875
2001
  }
1876
2002
  /** The model ledger — every engine's card. */
1877
2003
  export declare class EnginesApi {
@@ -1967,6 +2093,70 @@ export declare class A2aApi {
1967
2093
  }>;
1968
2094
  }>;
1969
2095
  }
2096
+ /** What chats, notes and meetings are about, across kinds — made, filed and suggested. */
2097
+ export declare class ContextsApi {
2098
+ private readonly rt;
2099
+ constructor(rt: Runtime);
2100
+ /** The person's contexts — what their chats, notes and meetings are about — with what each holds. A context groups chats, notes and meetings across kinds ("Product launch", "Kitchen remodel"). It is a record in the library every client syncs, so one made here appears in the panel, the desktop and the phones on their next pull. Busiest first. — Gateway 0.141.0+. */
2101
+ list(opts?: RequestOptions): Promise<{
2102
+ ok: boolean;
2103
+ contexts: Array<T.Context>;
2104
+ }>;
2105
+ /** Make a context. — Requires the gateway token. Gateway 0.141.0+. */
2106
+ create(body: T.ContextEdit, opts?: RequestOptions): Promise<{
2107
+ ok: boolean;
2108
+ context: T.Context;
2109
+ }>;
2110
+ /** Which contexts a chat, note or meeting probably belongs to — a suggestion, never filed by itself. By words — the item's title and text against each context's name, keywords and what it already holds. Pass an item's `id`, or a `title` and `text` for something not saved yet. — Gateway 0.141.0+. */
2111
+ suggest(body: {
2112
+ id?: string;
2113
+ title?: string;
2114
+ text?: string;
2115
+ limit?: number;
2116
+ }, opts?: RequestOptions): Promise<{
2117
+ ok: boolean;
2118
+ suggestions: Array<{
2119
+ id: string;
2120
+ title: string;
2121
+ score: number;
2122
+ why: string;
2123
+ }>;
2124
+ }>;
2125
+ /** A context and what it holds — each item by id, kind and title, never its body. — Gateway 0.141.0+. */
2126
+ get(contextId: string, opts?: RequestOptions): Promise<{
2127
+ ok: boolean;
2128
+ context: T.Context;
2129
+ items: Array<{
2130
+ id: string;
2131
+ kind: "chat" | "note" | "meeting" | "brief";
2132
+ title: string;
2133
+ updatedAt: number;
2134
+ }>;
2135
+ }>;
2136
+ /** Delete a context. Its chats, notes and meetings stay. — Requires the gateway token. Gateway 0.141.0+. */
2137
+ remove(contextId: string, opts?: RequestOptions): Promise<{
2138
+ ok: boolean;
2139
+ }>;
2140
+ /** Rename a context, or change its colour, what it is about or its keywords. — Requires the gateway token. Gateway 0.141.0+. */
2141
+ edit(contextId: string, body: T.ContextEdit, opts?: RequestOptions): Promise<{
2142
+ ok: boolean;
2143
+ context: T.Context;
2144
+ }>;
2145
+ /** Put chats, notes or meetings in a context, or take them out — the items themselves are untouched. One write to the context, never to the items; each item keeps its own clock there, so two devices filing at once both count. — Requires the gateway token. Gateway 0.141.0+. */
2146
+ items(contextId: string, body: {
2147
+ add?: Array<string>;
2148
+ remove?: Array<string>;
2149
+ }, opts?: RequestOptions): Promise<{
2150
+ ok: boolean;
2151
+ context: T.Context;
2152
+ }>;
2153
+ /** What a turn inside a context searches (its item ids) and the one line it is told. — Gateway 0.141.0+. */
2154
+ scope(contextId: string, opts?: RequestOptions): Promise<{
2155
+ ok: boolean;
2156
+ ids: Array<string>;
2157
+ line: string;
2158
+ }>;
2159
+ }
1970
2160
  /** Several models as one — union, draft + target, fallback. */
1971
2161
  export declare class FusionsApi {
1972
2162
  private readonly rt;
@@ -2046,6 +2236,7 @@ export declare function buildApi(rt: Runtime): {
2046
2236
  engines: EnginesApi;
2047
2237
  skills: SkillsApi;
2048
2238
  a2a: A2aApi;
2239
+ contexts: ContextsApi;
2049
2240
  fusions: FusionsApi;
2050
2241
  browser: BrowserApi;
2051
2242
  link: LinkApi;
@@ -97,6 +97,7 @@ export const OPERATIONS = {
97
97
  "knowledge.access": { id: "knowledge.access", method: "GET", path: "/v1/kb/{id}/access", auth: "open", since: "0.101.1", stream: null, pathParams: ["id"], queryParams: [] },
98
98
  "knowledge.setAccess": { id: "knowledge.setAccess", method: "POST", path: "/v1/kb/{id}/access", auth: "token", since: "0.101.1", stream: null, pathParams: ["id"], queryParams: [] },
99
99
  "knowledge.embed": { id: "knowledge.embed", method: "POST", path: "/v1/kb/{id}/embed", auth: "open", since: "0.101.0", stream: null, pathParams: ["id"], queryParams: [] },
100
+ "knowledge.sync": { id: "knowledge.sync", method: "POST", path: "/v1/kb/{id}/sync", auth: "token", since: "0.142.0", stream: null, pathParams: ["id"], queryParams: [] },
100
101
  "retrieval.read": { id: "retrieval.read", method: "POST", path: "/v1/read", auth: "open", since: "0.14.0", stream: null, pathParams: [], queryParams: [] },
101
102
  "retrieval.readAlias": { id: "retrieval.readAlias", method: "GET", path: "/v1/read/{url}", auth: "open", since: "0.14.0", stream: null, pathParams: ["url"], queryParams: [] },
102
103
  "engines.list": { id: "engines.list", method: "GET", path: "/v1/engines", auth: "open", since: "0.6.89", stream: null, pathParams: [], queryParams: ["minCalls"] },
@@ -115,6 +116,14 @@ export const OPERATIONS = {
115
116
  "skills.list": { id: "skills.list", method: "GET", path: "/skills", auth: "open", since: "0.6.64", stream: null, pathParams: [], queryParams: ["workdir"] },
116
117
  "skills.get": { id: "skills.get", method: "GET", path: "/skills/{skillId}", auth: "open", since: "0.6.67", stream: null, pathParams: ["skillId"], queryParams: ["workdir"] },
117
118
  "skills.file": { id: "skills.file", method: "GET", path: "/skills/{skillId}/file/{path}", auth: "open", since: "0.11.4", stream: null, pathParams: ["skillId", "path"], queryParams: ["workdir"] },
119
+ "contexts.list": { id: "contexts.list", method: "GET", path: "/v1/contexts", auth: "open", since: "0.141.0", stream: null, pathParams: [], queryParams: [] },
120
+ "contexts.create": { id: "contexts.create", method: "POST", path: "/v1/contexts", auth: "token", since: "0.141.0", stream: null, pathParams: [], queryParams: [] },
121
+ "contexts.suggest": { id: "contexts.suggest", method: "POST", path: "/v1/contexts/suggest", auth: "open", since: "0.141.0", stream: null, pathParams: [], queryParams: [] },
122
+ "contexts.get": { id: "contexts.get", method: "GET", path: "/v1/contexts/{contextId}", auth: "open", since: "0.141.0", stream: null, pathParams: ["contextId"], queryParams: [] },
123
+ "contexts.remove": { id: "contexts.remove", method: "DELETE", path: "/v1/contexts/{contextId}", auth: "token", since: "0.141.0", stream: null, pathParams: ["contextId"], queryParams: [] },
124
+ "contexts.edit": { id: "contexts.edit", method: "PATCH", path: "/v1/contexts/{contextId}", auth: "token", since: "0.141.0", stream: null, pathParams: ["contextId"], queryParams: [] },
125
+ "contexts.items": { id: "contexts.items", method: "POST", path: "/v1/contexts/{contextId}/items", auth: "token", since: "0.141.0", stream: null, pathParams: ["contextId"], queryParams: [] },
126
+ "contexts.scope": { id: "contexts.scope", method: "GET", path: "/v1/contexts/{contextId}/scope", auth: "open", since: "0.141.0", stream: null, pathParams: ["contextId"], queryParams: [] },
118
127
  "fusions.list": { id: "fusions.list", method: "GET", path: "/v1/fusions", auth: "open", since: "0.33.0", stream: null, pathParams: [], queryParams: [] },
119
128
  "browser.status": { id: "browser.status", method: "GET", path: "/v1/browser", auth: "token", since: "0.59.0", stream: null, pathParams: [], queryParams: [] },
120
129
  "browser.call": { id: "browser.call", method: "POST", path: "/v1/browser/call", auth: "token", since: "0.59.0", stream: null, pathParams: [], queryParams: [] },
@@ -625,6 +634,10 @@ export class KnowledgeApi {
625
634
  embed(id, body, opts) {
626
635
  return this.rt.request(OPERATIONS["knowledge.embed"], { path: { id }, query: undefined, headers: opts?.headers, body: body, opts });
627
636
  }
637
+ /** 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+. */
638
+ sync(id, body, opts) {
639
+ return this.rt.request(OPERATIONS["knowledge.sync"], { path: { id }, query: undefined, headers: opts?.headers, body: body, opts });
640
+ }
628
641
  }
629
642
  /** The model ledger — every engine's card. */
630
643
  export class EnginesApi {
@@ -689,6 +702,43 @@ export class A2aApi {
689
702
  return this.rt.request(OPERATIONS["a2a.agents"], { path: {}, query: undefined, headers: opts?.headers, body: undefined, opts });
690
703
  }
691
704
  }
705
+ /** What chats, notes and meetings are about, across kinds — made, filed and suggested. */
706
+ export class ContextsApi {
707
+ rt;
708
+ constructor(rt) { this.rt = rt; }
709
+ /** The person's contexts — what their chats, notes and meetings are about — with what each holds. A context groups chats, notes and meetings across kinds ("Product launch", "Kitchen remodel"). It is a record in the library every client syncs, so one made here appears in the panel, the desktop and the phones on their next pull. Busiest first. — Gateway 0.141.0+. */
710
+ list(opts) {
711
+ return this.rt.request(OPERATIONS["contexts.list"], { path: {}, query: undefined, headers: opts?.headers, body: undefined, opts });
712
+ }
713
+ /** Make a context. — Requires the gateway token. Gateway 0.141.0+. */
714
+ create(body, opts) {
715
+ return this.rt.request(OPERATIONS["contexts.create"], { path: {}, query: undefined, headers: opts?.headers, body: body, opts });
716
+ }
717
+ /** Which contexts a chat, note or meeting probably belongs to — a suggestion, never filed by itself. By words — the item's title and text against each context's name, keywords and what it already holds. Pass an item's `id`, or a `title` and `text` for something not saved yet. — Gateway 0.141.0+. */
718
+ suggest(body, opts) {
719
+ return this.rt.request(OPERATIONS["contexts.suggest"], { path: {}, query: undefined, headers: opts?.headers, body: body, opts });
720
+ }
721
+ /** A context and what it holds — each item by id, kind and title, never its body. — Gateway 0.141.0+. */
722
+ get(contextId, opts) {
723
+ return this.rt.request(OPERATIONS["contexts.get"], { path: { contextId }, query: undefined, headers: opts?.headers, body: undefined, opts });
724
+ }
725
+ /** Delete a context. Its chats, notes and meetings stay. — Requires the gateway token. Gateway 0.141.0+. */
726
+ remove(contextId, opts) {
727
+ return this.rt.request(OPERATIONS["contexts.remove"], { path: { contextId }, query: undefined, headers: opts?.headers, body: undefined, opts });
728
+ }
729
+ /** Rename a context, or change its colour, what it is about or its keywords. — Requires the gateway token. Gateway 0.141.0+. */
730
+ edit(contextId, body, opts) {
731
+ return this.rt.request(OPERATIONS["contexts.edit"], { path: { contextId }, query: undefined, headers: opts?.headers, body: body, opts });
732
+ }
733
+ /** Put chats, notes or meetings in a context, or take them out — the items themselves are untouched. One write to the context, never to the items; each item keeps its own clock there, so two devices filing at once both count. — Requires the gateway token. Gateway 0.141.0+. */
734
+ items(contextId, body, opts) {
735
+ return this.rt.request(OPERATIONS["contexts.items"], { path: { contextId }, query: undefined, headers: opts?.headers, body: body, opts });
736
+ }
737
+ /** What a turn inside a context searches (its item ids) and the one line it is told. — Gateway 0.141.0+. */
738
+ scope(contextId, opts) {
739
+ return this.rt.request(OPERATIONS["contexts.scope"], { path: { contextId }, query: undefined, headers: opts?.headers, body: undefined, opts });
740
+ }
741
+ }
692
742
  /** Several models as one — union, draft + target, fallback. */
693
743
  export class FusionsApi {
694
744
  rt;
@@ -782,6 +832,7 @@ export function buildApi(rt) {
782
832
  engines: new EnginesApi(rt),
783
833
  skills: new SkillsApi(rt),
784
834
  a2a: new A2aApi(rt),
835
+ contexts: new ContextsApi(rt),
785
836
  fusions: new FusionsApi(rt),
786
837
  browser: new BrowserApi(rt),
787
838
  link: new LinkApi(rt),
@@ -1,3 +1,25 @@
1
+ export interface Context {
2
+ id: string;
3
+ title: string;
4
+ color: "blue" | "orange" | "green" | "purple" | "pink" | "teal" | "gray";
5
+ about: string;
6
+ keywords: Array<string>;
7
+ counts?: {
8
+ chat?: number;
9
+ note?: number;
10
+ meeting?: number;
11
+ brief?: number;
12
+ };
13
+ /** The newest item's time (ms). */
14
+ last?: number;
15
+ updatedAt: number;
16
+ }
17
+ export interface ContextEdit {
18
+ name?: string;
19
+ color?: "blue" | "orange" | "green" | "purple" | "pink" | "teal" | "gray";
20
+ about?: string;
21
+ keywords?: Array<string>;
22
+ }
1
23
  /** A domain object whose shape is owned by `@chatpanel/events`; the SDK carries it as-is. */
2
24
  export interface AnyObject {
3
25
  [key: string]: unknown;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chatpanel/sdk",
3
- "version": "0.28.0",
3
+ "version": "0.30.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",