@chatpanel/sdk 0.37.1 → 0.39.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.
@@ -1336,7 +1336,7 @@ export declare const OPERATIONS: {
1336
1336
  readonly id: "contexts.list";
1337
1337
  readonly method: "GET";
1338
1338
  readonly path: "/v1/contexts";
1339
- readonly auth: "open";
1339
+ readonly auth: "token";
1340
1340
  readonly since: "0.141.0";
1341
1341
  readonly stream: null;
1342
1342
  readonly pathParams: readonly [];
@@ -1356,7 +1356,7 @@ export declare const OPERATIONS: {
1356
1356
  readonly id: "contexts.suggest";
1357
1357
  readonly method: "POST";
1358
1358
  readonly path: "/v1/contexts/suggest";
1359
- readonly auth: "open";
1359
+ readonly auth: "token";
1360
1360
  readonly since: "0.141.0";
1361
1361
  readonly stream: null;
1362
1362
  readonly pathParams: readonly [];
@@ -1366,7 +1366,7 @@ export declare const OPERATIONS: {
1366
1366
  readonly id: "contexts.get";
1367
1367
  readonly method: "GET";
1368
1368
  readonly path: "/v1/contexts/{contextId}";
1369
- readonly auth: "open";
1369
+ readonly auth: "token";
1370
1370
  readonly since: "0.141.0";
1371
1371
  readonly stream: null;
1372
1372
  readonly pathParams: readonly ["contextId"];
@@ -1402,11 +1402,41 @@ export declare const OPERATIONS: {
1402
1402
  readonly pathParams: readonly ["contextId"];
1403
1403
  readonly queryParams: readonly [];
1404
1404
  };
1405
+ readonly "contexts.turn": {
1406
+ readonly id: "contexts.turn";
1407
+ readonly method: "GET";
1408
+ readonly path: "/v1/contexts/turn";
1409
+ readonly auth: "token";
1410
+ readonly since: "0.162.0";
1411
+ readonly stream: null;
1412
+ readonly pathParams: readonly [];
1413
+ readonly queryParams: readonly ["chat", "named"];
1414
+ };
1415
+ readonly "contexts.resources": {
1416
+ readonly id: "contexts.resources";
1417
+ readonly method: "POST";
1418
+ readonly path: "/v1/contexts/{contextId}/resources";
1419
+ readonly auth: "token";
1420
+ readonly since: "0.156.0";
1421
+ readonly stream: null;
1422
+ readonly pathParams: readonly ["contextId"];
1423
+ readonly queryParams: readonly [];
1424
+ };
1425
+ readonly "contexts.people": {
1426
+ readonly id: "contexts.people";
1427
+ readonly method: "POST";
1428
+ readonly path: "/v1/contexts/{contextId}/people";
1429
+ readonly auth: "token";
1430
+ readonly since: "0.156.0";
1431
+ readonly stream: null;
1432
+ readonly pathParams: readonly ["contextId"];
1433
+ readonly queryParams: readonly [];
1434
+ };
1405
1435
  readonly "contexts.scope": {
1406
1436
  readonly id: "contexts.scope";
1407
1437
  readonly method: "GET";
1408
1438
  readonly path: "/v1/contexts/{contextId}/scope";
1409
- readonly auth: "open";
1439
+ readonly auth: "token";
1410
1440
  readonly since: "0.141.0";
1411
1441
  readonly stream: null;
1412
1442
  readonly pathParams: readonly ["contextId"];
@@ -2336,7 +2366,7 @@ export declare class A2aApi {
2336
2366
  export declare class ContextsApi {
2337
2367
  private readonly rt;
2338
2368
  constructor(rt: Runtime);
2339
- /** 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+. */
2369
+ /** 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. — Requires the gateway token. Gateway 0.141.0+. */
2340
2370
  list(opts?: RequestOptions): Promise<{
2341
2371
  ok: boolean;
2342
2372
  contexts: Array<T.Context>;
@@ -2346,7 +2376,7 @@ export declare class ContextsApi {
2346
2376
  ok: boolean;
2347
2377
  context: T.Context;
2348
2378
  }>;
2349
- /** 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+. */
2379
+ /** 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. — Requires the gateway token. Gateway 0.141.0+. */
2350
2380
  suggest(body: {
2351
2381
  id?: string;
2352
2382
  title?: string;
@@ -2361,7 +2391,7 @@ export declare class ContextsApi {
2361
2391
  why: string;
2362
2392
  }>;
2363
2393
  }>;
2364
- /** A context and what it holds — each item by id, kind and title, never its body. — Gateway 0.141.0+. */
2394
+ /** A context and what it holds — each item by id, kind and title, never its body. — Requires the gateway token. Gateway 0.141.0+. */
2365
2395
  get(contextId: string, opts?: RequestOptions): Promise<{
2366
2396
  ok: boolean;
2367
2397
  context: T.Context;
@@ -2389,7 +2419,30 @@ export declare class ContextsApi {
2389
2419
  ok: boolean;
2390
2420
  context: T.Context;
2391
2421
  }>;
2392
- /** What a turn inside a context searches (its item ids) and the one line it is told. — Gateway 0.141.0+. */
2422
+ /** What a chat turn inside its binders is given — the members to search first and only, a hint line, the binders' instructions, the knowledge bases its refs bring, the tools it narrows to. For a client that holds no records of its own (a CLI, a phone, an eval): the binders `chat` is filed in and those `named`, only the ones the caller may use. `turn` is null when the chat is in none. — Requires the gateway token. Gateway 0.162.0+. */
2423
+ turn(query: {
2424
+ chat: string;
2425
+ named?: string;
2426
+ }, opts?: RequestOptions): Promise<{
2427
+ ok: boolean;
2428
+ turn: T.ContextTurn;
2429
+ }>;
2430
+ /** Add or take out members and refs in one typed list — the industry's `resources` (a Copilot Space's, an Anthropic session's). A string `chat:`/`note:`/`meeting:`/`brief:` is a member; `kb:`, `folder:`, `gw:`, `copilot-space:`, `vector-store:`, `file-search-store:`, `notebook:`, `bedrock:` or `mcp-resource:` is a ref, by reference — or `{ type, id, name, noAccess }`. Needs the edit role. Each item keeps its own clock, so two devices editing at once both count. — Requires the gateway token. Gateway 0.156.0+. */
2431
+ resources(contextId: string, body: {
2432
+ add?: Array<string | T.ContextRef>;
2433
+ remove?: Array<string | T.ContextRef>;
2434
+ }, opts?: RequestOptions): Promise<{
2435
+ ok: boolean;
2436
+ context: T.Context;
2437
+ }>;
2438
+ /** Share a context with people or groups by role, or take them off (null). Needs the manage role. — Requires the gateway token. Gateway 0.156.0+. */
2439
+ people(contextId: string, body: {
2440
+ [key: string]: "viewer" | "editor" | "manager" | null;
2441
+ }, opts?: RequestOptions): Promise<{
2442
+ ok: boolean;
2443
+ context: T.Context;
2444
+ }>;
2445
+ /** What a turn inside a context searches (its item ids) and the one line it is told. — Requires the gateway token. Gateway 0.141.0+. */
2393
2446
  scope(contextId: string, opts?: RequestOptions): Promise<{
2394
2447
  ok: boolean;
2395
2448
  ids: Array<string>;
@@ -133,14 +133,17 @@ export const OPERATIONS = {
133
133
  "skills.list": { id: "skills.list", method: "GET", path: "/skills", auth: "open", since: "0.6.64", stream: null, pathParams: [], queryParams: ["workdir"] },
134
134
  "skills.get": { id: "skills.get", method: "GET", path: "/skills/{skillId}", auth: "open", since: "0.6.67", stream: null, pathParams: ["skillId"], queryParams: ["workdir"] },
135
135
  "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"] },
136
- "contexts.list": { id: "contexts.list", method: "GET", path: "/v1/contexts", auth: "open", since: "0.141.0", stream: null, pathParams: [], queryParams: [] },
136
+ "contexts.list": { id: "contexts.list", method: "GET", path: "/v1/contexts", auth: "token", since: "0.141.0", stream: null, pathParams: [], queryParams: [] },
137
137
  "contexts.create": { id: "contexts.create", method: "POST", path: "/v1/contexts", auth: "token", since: "0.141.0", stream: null, pathParams: [], queryParams: [] },
138
- "contexts.suggest": { id: "contexts.suggest", method: "POST", path: "/v1/contexts/suggest", auth: "open", since: "0.141.0", stream: null, pathParams: [], queryParams: [] },
139
- "contexts.get": { id: "contexts.get", method: "GET", path: "/v1/contexts/{contextId}", auth: "open", since: "0.141.0", stream: null, pathParams: ["contextId"], queryParams: [] },
138
+ "contexts.suggest": { id: "contexts.suggest", method: "POST", path: "/v1/contexts/suggest", auth: "token", since: "0.141.0", stream: null, pathParams: [], queryParams: [] },
139
+ "contexts.get": { id: "contexts.get", method: "GET", path: "/v1/contexts/{contextId}", auth: "token", since: "0.141.0", stream: null, pathParams: ["contextId"], queryParams: [] },
140
140
  "contexts.remove": { id: "contexts.remove", method: "DELETE", path: "/v1/contexts/{contextId}", auth: "token", since: "0.141.0", stream: null, pathParams: ["contextId"], queryParams: [] },
141
141
  "contexts.edit": { id: "contexts.edit", method: "PATCH", path: "/v1/contexts/{contextId}", auth: "token", since: "0.141.0", stream: null, pathParams: ["contextId"], queryParams: [] },
142
142
  "contexts.items": { id: "contexts.items", method: "POST", path: "/v1/contexts/{contextId}/items", auth: "token", since: "0.141.0", stream: null, pathParams: ["contextId"], queryParams: [] },
143
- "contexts.scope": { id: "contexts.scope", method: "GET", path: "/v1/contexts/{contextId}/scope", auth: "open", since: "0.141.0", stream: null, pathParams: ["contextId"], queryParams: [] },
143
+ "contexts.turn": { id: "contexts.turn", method: "GET", path: "/v1/contexts/turn", auth: "token", since: "0.162.0", stream: null, pathParams: [], queryParams: ["chat", "named"] },
144
+ "contexts.resources": { id: "contexts.resources", method: "POST", path: "/v1/contexts/{contextId}/resources", auth: "token", since: "0.156.0", stream: null, pathParams: ["contextId"], queryParams: [] },
145
+ "contexts.people": { id: "contexts.people", method: "POST", path: "/v1/contexts/{contextId}/people", auth: "token", since: "0.156.0", stream: null, pathParams: ["contextId"], queryParams: [] },
146
+ "contexts.scope": { id: "contexts.scope", method: "GET", path: "/v1/contexts/{contextId}/scope", auth: "token", since: "0.141.0", stream: null, pathParams: ["contextId"], queryParams: [] },
144
147
  "fusions.list": { id: "fusions.list", method: "GET", path: "/v1/fusions", auth: "open", since: "0.33.0", stream: null, pathParams: [], queryParams: [] },
145
148
  "browser.status": { id: "browser.status", method: "GET", path: "/v1/browser", auth: "token", since: "0.59.0", stream: null, pathParams: [], queryParams: [] },
146
149
  "browser.call": { id: "browser.call", method: "POST", path: "/v1/browser/call", auth: "token", since: "0.59.0", stream: null, pathParams: [], queryParams: [] },
@@ -801,7 +804,7 @@ export class A2aApi {
801
804
  export class ContextsApi {
802
805
  rt;
803
806
  constructor(rt) { this.rt = rt; }
804
- /** 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+. */
807
+ /** 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. — Requires the gateway token. Gateway 0.141.0+. */
805
808
  list(opts) {
806
809
  return this.rt.request(OPERATIONS["contexts.list"], { path: {}, query: undefined, headers: opts?.headers, body: undefined, opts });
807
810
  }
@@ -809,11 +812,11 @@ export class ContextsApi {
809
812
  create(body, opts) {
810
813
  return this.rt.request(OPERATIONS["contexts.create"], { path: {}, query: undefined, headers: opts?.headers, body: body, opts });
811
814
  }
812
- /** 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+. */
815
+ /** 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. — Requires the gateway token. Gateway 0.141.0+. */
813
816
  suggest(body, opts) {
814
817
  return this.rt.request(OPERATIONS["contexts.suggest"], { path: {}, query: undefined, headers: opts?.headers, body: body, opts });
815
818
  }
816
- /** A context and what it holds — each item by id, kind and title, never its body. — Gateway 0.141.0+. */
819
+ /** A context and what it holds — each item by id, kind and title, never its body. — Requires the gateway token. Gateway 0.141.0+. */
817
820
  get(contextId, opts) {
818
821
  return this.rt.request(OPERATIONS["contexts.get"], { path: { contextId }, query: undefined, headers: opts?.headers, body: undefined, opts });
819
822
  }
@@ -829,7 +832,19 @@ export class ContextsApi {
829
832
  items(contextId, body, opts) {
830
833
  return this.rt.request(OPERATIONS["contexts.items"], { path: { contextId }, query: undefined, headers: opts?.headers, body: body, opts });
831
834
  }
832
- /** What a turn inside a context searches (its item ids) and the one line it is told. — Gateway 0.141.0+. */
835
+ /** What a chat turn inside its binders is given — the members to search first and only, a hint line, the binders' instructions, the knowledge bases its refs bring, the tools it narrows to. For a client that holds no records of its own (a CLI, a phone, an eval): the binders `chat` is filed in and those `named`, only the ones the caller may use. `turn` is null when the chat is in none. — Requires the gateway token. Gateway 0.162.0+. */
836
+ turn(query, opts) {
837
+ return this.rt.request(OPERATIONS["contexts.turn"], { path: {}, query: query, headers: opts?.headers, body: undefined, opts });
838
+ }
839
+ /** Add or take out members and refs in one typed list — the industry's `resources` (a Copilot Space's, an Anthropic session's). A string `chat:`/`note:`/`meeting:`/`brief:` is a member; `kb:`, `folder:`, `gw:`, `copilot-space:`, `vector-store:`, `file-search-store:`, `notebook:`, `bedrock:` or `mcp-resource:` is a ref, by reference — or `{ type, id, name, noAccess }`. Needs the edit role. Each item keeps its own clock, so two devices editing at once both count. — Requires the gateway token. Gateway 0.156.0+. */
840
+ resources(contextId, body, opts) {
841
+ return this.rt.request(OPERATIONS["contexts.resources"], { path: { contextId }, query: undefined, headers: opts?.headers, body: body, opts });
842
+ }
843
+ /** Share a context with people or groups by role, or take them off (null). Needs the manage role. — Requires the gateway token. Gateway 0.156.0+. */
844
+ people(contextId, body, opts) {
845
+ return this.rt.request(OPERATIONS["contexts.people"], { path: { contextId }, query: undefined, headers: opts?.headers, body: body, opts });
846
+ }
847
+ /** What a turn inside a context searches (its item ids) and the one line it is told. — Requires the gateway token. Gateway 0.141.0+. */
833
848
  scope(contextId, opts) {
834
849
  return this.rt.request(OPERATIONS["contexts.scope"], { path: { contextId }, query: undefined, headers: opts?.headers, body: undefined, opts });
835
850
  }
@@ -13,12 +13,71 @@ export interface Context {
13
13
  /** The newest item's time (ms). */
14
14
  last?: number;
15
15
  updatedAt: number;
16
+ /** How Chap answers inside it (v2, 0.156.0) — empty for a caller without read. */
17
+ instructions?: string;
18
+ /** What it points at, by reference (v2). A ref the caller cannot open in its own system is `locked` (name only) or absent (hidden), as the context's creator chose. */
19
+ refs?: Array<ContextRef>;
20
+ /** The MCP servers a turn inside it may find; null = every one (v2). */
21
+ mcp_servers?: Array<string> | null;
22
+ /** The skills a turn inside it may find; null = every one (v2). */
23
+ skills?: Array<string> | null;
24
+ access?: ContextAccess;
25
+ }
26
+ export type ContextTurn = {
27
+ /** The binders' members — searched first and only. */
28
+ ids?: Array<string>;
29
+ /** One line for the hint on the last user message. */
30
+ line?: string;
31
+ /** The binders' instructions */
32
+ instructions?: string;
33
+ bases?: Array<{
34
+ id?: string;
35
+ title?: string;
36
+ folder?: boolean;
37
+ }>;
38
+ tools?: {
39
+ mcp_servers?: Array<string> | null;
40
+ skills?: Array<string> | null;
41
+ };
42
+ names?: Array<string>;
43
+ contextIds?: Array<string>;
44
+ } | null;
45
+ export interface ContextRef {
46
+ /** `<type>:<id>`. */
47
+ key: string;
48
+ type: "kb" | "folder" | "gw" | "bedrock" | "copilot-space" | "vector-store" | "file-search-store" | "notebook" | "mcp-resource";
49
+ id?: string;
50
+ name?: string;
51
+ provider?: string;
52
+ /** Overrides the context's choice for this ref. */
53
+ noAccess?: "locked" | "hidden";
54
+ /** The caller cannot open it in its own system; only its name is shown. */
55
+ locked?: boolean;
56
+ at?: number;
57
+ }
58
+ /** Who may reach the context — shown to its owner and managers only (v2, 0.156.0). */
59
+ export interface ContextAccess {
60
+ /** Agents that may find and use it, by name; null = none. */
61
+ agents?: Array<string> | null;
62
+ /** A person's id or `group:<id>` → role. */
63
+ people?: {
64
+ [key: string]: "viewer" | "editor" | "manager";
65
+ };
66
+ /** What a viewer sees of a ref they cannot open in its own system. */
67
+ noAccess?: "locked" | "hidden";
16
68
  }
17
69
  export interface ContextEdit {
18
70
  name?: string;
19
71
  color?: "blue" | "orange" | "green" | "purple" | "pink" | "teal" | "gray";
20
72
  about?: string;
21
73
  keywords?: Array<string>;
74
+ instructions?: string;
75
+ mcp_servers?: Array<string> | null;
76
+ skills?: Array<string> | null;
77
+ /** Needs the manage role. */
78
+ noAccess?: "locked" | "hidden";
79
+ /** Needs the manage role. */
80
+ agents?: Array<string> | null;
22
81
  }
23
82
  /** A domain object whose shape is owned by `@chatpanel/events`; the SDK carries it as-is. */
24
83
  export interface AnyObject {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chatpanel/sdk",
3
- "version": "0.37.1",
3
+ "version": "0.39.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",