@chatpanel/sdk 0.18.0 → 0.20.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.
@@ -272,6 +272,16 @@ export declare const OPERATIONS: {
272
272
  readonly pathParams: readonly [];
273
273
  readonly queryParams: readonly [];
274
274
  };
275
+ readonly "threads.send": {
276
+ readonly id: "threads.send";
277
+ readonly method: "POST";
278
+ readonly path: "/v1/threads/send";
279
+ readonly auth: "token";
280
+ readonly since: "0.69.0";
281
+ readonly stream: null;
282
+ readonly pathParams: readonly [];
283
+ readonly queryParams: readonly [];
284
+ };
275
285
  readonly "memory.forget": {
276
286
  readonly id: "memory.forget";
277
287
  readonly method: "POST";
@@ -642,6 +652,16 @@ export declare const OPERATIONS: {
642
652
  readonly pathParams: readonly [];
643
653
  readonly queryParams: readonly [];
644
654
  };
655
+ readonly "runtime.plan": {
656
+ readonly id: "runtime.plan";
657
+ readonly method: "GET";
658
+ readonly path: "/v1/runtime/plan";
659
+ readonly auth: "open";
660
+ readonly since: "0.74.0";
661
+ readonly stream: null;
662
+ readonly pathParams: readonly [];
663
+ readonly queryParams: readonly ["service", "model", "ctx", "need_mb"];
664
+ };
645
665
  readonly "runtime.engine": {
646
666
  readonly id: "runtime.engine";
647
667
  readonly method: "POST";
@@ -1106,6 +1126,29 @@ export declare class MemoryApi {
1106
1126
  removes?: Array<string>;
1107
1127
  }, opts?: RequestOptions): Promise<T.MemorySyncResponse>;
1108
1128
  }
1129
+ /** The person's chats, asked by one another — any chat's own model answers in it. */
1130
+ export declare class ThreadsApi {
1131
+ private readonly rt;
1132
+ constructor(rt: Runtime);
1133
+ /** Ask one of the person's chats and get its answer; the exchange is added to that chat. The chat's own model or coding agent answers, in that chat (its agent session is resumed), and the question — framed with who asked — and the answer are appended to it. A caller acting for an agent should ask the person first; `dryRun` returns the chat's title and model for that question without running anything. — Requires the gateway token. Gateway 0.69.0+. */
1134
+ send(body: {
1135
+ /** The chat to ask — a record id, chat:… */
1136
+ to: string;
1137
+ message: string;
1138
+ /** The chat asking, so the other one says who asked. */
1139
+ from?: {
1140
+ id?: string;
1141
+ title?: string;
1142
+ };
1143
+ /** Only which chat and model — nothing is run. */
1144
+ dryRun?: boolean;
1145
+ }, opts?: RequestOptions): Promise<{
1146
+ ok: boolean;
1147
+ title: string;
1148
+ model: string;
1149
+ reply?: string;
1150
+ }>;
1151
+ }
1109
1152
  /** The settings every client shares. */
1110
1153
  export declare class PrefsApi {
1111
1154
  private readonly rt;
@@ -1387,6 +1430,13 @@ export declare class RuntimeApi {
1387
1430
  constructor(rt: Runtime);
1388
1431
  /** The runtime — the process sandbox, what is running now, the container engine, the services. One document for Settings › Runtime. `sandbox` is the bridge's own (`/health.sandbox`: enabled, mode `open` | `allowlist` | `none`, the runtime found, the reason when none, the global `extras`, whether a process can get a session of its own, and `refused` — the last hosts any process was refused, names only). `processes` lists every local MCP server running for the user with its sandbox record and the hosts it was refused, and the warm agent processes. `engines` says which container engine exists (`podman` first, `docker`) and whether it can run a container now; when none does, `install` carries the command for this platform — shown to the person, never run by the gateway. `services` is the catalogue: `searxng` with its state (`no-engine` | `engine-stopped` | `absent` | `stopped` | `running`), its loopback URL and whether it answers. — Gateway 0.19.0+. */
1389
1432
  status(opts?: RequestOptions): Promise<T.RuntimeDocument>;
1433
+ /** Will this local model run now? Weights + the KV cache for the context + 10% headroom, against what is free. Checked against what Heatwatch (an optional macOS tool on `127.0.0.1:7878`) says is reclaimable NOW, with the apps to close when it is short — or, without Heatwatch, against the machine's total memory, and `source` says which (`heatwatch` | `total-memory`). The KV cache is counted from the model's `config.json` when it is in the gateway's model cache (`contextCounted` says whether it was). A model the catalogue does not list needs `need_mb`. A native service's start makes the same check and refuses a model that does not fit what is free, unless the start says `force: true`. `runtime.heatwatch: false` stops the gateway asking Heatwatch. — Gateway 0.74.0+. */
1434
+ plan(query?: {
1435
+ service?: string;
1436
+ model?: string;
1437
+ ctx?: number;
1438
+ need_mb?: number;
1439
+ }, opts?: RequestOptions): Promise<T.RuntimePlan>;
1390
1440
  /** Start the container engine (Podman — creates and starts its machine where one is needed). `{ action: 'start' }`. Podman on macOS and Windows runs containers in a machine: made on first start (`podman machine init`), then started. Linux Podman is rootless and needs nothing. Docker is not started by the gateway — the response says so. — Requires the gateway token. Gateway 0.19.0+. */
1391
1441
  engine(name: string, body: {
1392
1442
  action?: "start";
@@ -1396,6 +1446,8 @@ export declare class RuntimeApi {
1396
1446
  action?: "start" | "stop" | "model";
1397
1447
  /** With `action: model` — a catalogue id or a Hugging Face owner/name. */
1398
1448
  model?: string;
1449
+ /** With `action: start` (gateway 0.74+) — start a native model past the live-memory check (`GET /v1/runtime/plan`). */
1450
+ force?: boolean;
1399
1451
  }, opts?: RequestOptions): Promise<T.RuntimeActionResult>;
1400
1452
  }
1401
1453
  /** Web retrieval — search through the provider the user chose, and a page as LLM-ready Markdown, cited where it landed, with its sections (docs/web-retrieval.md). */
@@ -1555,6 +1607,7 @@ export declare function buildApi(rt: Runtime): {
1555
1607
  history: HistoryApi;
1556
1608
  events: EventsApi;
1557
1609
  memory: MemoryApi;
1610
+ threads: ThreadsApi;
1558
1611
  prefs: PrefsApi;
1559
1612
  teams: TeamsApi;
1560
1613
  projects: ProjectsApi;
@@ -27,6 +27,7 @@ export const OPERATIONS = {
27
27
  "memory.list": { id: "memory.list", method: "GET", path: "/v1/memory/list", auth: "open", since: null, stream: null, pathParams: [], queryParams: [] },
28
28
  "memory.recall": { id: "memory.recall", method: "POST", path: "/v1/memory/recall", auth: "open", since: null, stream: null, pathParams: [], queryParams: [] },
29
29
  "memory.remember": { id: "memory.remember", method: "POST", path: "/v1/memory/remember", auth: "token", since: null, stream: null, pathParams: [], queryParams: [] },
30
+ "threads.send": { id: "threads.send", method: "POST", path: "/v1/threads/send", auth: "token", since: "0.69.0", stream: null, pathParams: [], queryParams: [] },
30
31
  "memory.forget": { id: "memory.forget", method: "POST", path: "/v1/memory/forget", auth: "token", since: null, stream: null, pathParams: [], queryParams: [] },
31
32
  "memory.sync": { id: "memory.sync", method: "POST", path: "/v1/memory/sync", auth: "token", since: null, stream: null, pathParams: [], queryParams: [] },
32
33
  "prefs.get": { id: "prefs.get", method: "GET", path: "/v1/prefs", auth: "open", since: "0.6.77", stream: null, pathParams: [], queryParams: ["section", "stamps"] },
@@ -64,6 +65,7 @@ export const OPERATIONS = {
64
65
  "agents.rate": { id: "agents.rate", method: "POST", path: "/v1/agents/{agentId}/scorecard", auth: "open", since: "0.6.87", stream: null, pathParams: ["agentId"], queryParams: [] },
65
66
  "capabilities.list": { id: "capabilities.list", method: "GET", path: "/v1/capabilities", auth: "open", since: "0.13.0", stream: null, pathParams: [], queryParams: [] },
66
67
  "runtime.status": { id: "runtime.status", method: "GET", path: "/v1/runtime", auth: "open", since: "0.19.0", stream: null, pathParams: [], queryParams: [] },
68
+ "runtime.plan": { id: "runtime.plan", method: "GET", path: "/v1/runtime/plan", auth: "open", since: "0.74.0", stream: null, pathParams: [], queryParams: ["service", "model", "ctx", "need_mb"] },
67
69
  "runtime.engine": { id: "runtime.engine", method: "POST", path: "/v1/runtime/engines/{name}", auth: "token", since: "0.19.0", stream: null, pathParams: ["name"], queryParams: [] },
68
70
  "runtime.service": { id: "runtime.service", method: "POST", path: "/v1/runtime/services/{id}", auth: "token", since: "0.19.0", stream: null, pathParams: ["id"], queryParams: [] },
69
71
  "capabilities.detect": { id: "capabilities.detect", method: "POST", path: "/v1/detect", auth: "open", since: "0.13.0", stream: null, pathParams: [], queryParams: [] },
@@ -251,6 +253,15 @@ export class MemoryApi {
251
253
  return this.rt.request(OPERATIONS["memory.sync"], { path: {}, query: undefined, headers: opts?.headers, body: body, opts });
252
254
  }
253
255
  }
256
+ /** The person's chats, asked by one another — any chat's own model answers in it. */
257
+ export class ThreadsApi {
258
+ rt;
259
+ constructor(rt) { this.rt = rt; }
260
+ /** Ask one of the person's chats and get its answer; the exchange is added to that chat. The chat's own model or coding agent answers, in that chat (its agent session is resumed), and the question — framed with who asked — and the answer are appended to it. A caller acting for an agent should ask the person first; `dryRun` returns the chat's title and model for that question without running anything. — Requires the gateway token. Gateway 0.69.0+. */
261
+ send(body, opts) {
262
+ return this.rt.request(OPERATIONS["threads.send"], { path: {}, query: undefined, headers: opts?.headers, body: body, opts });
263
+ }
264
+ }
254
265
  /** The settings every client shares. */
255
266
  export class PrefsApi {
256
267
  rt;
@@ -448,6 +459,10 @@ export class RuntimeApi {
448
459
  status(opts) {
449
460
  return this.rt.request(OPERATIONS["runtime.status"], { path: {}, query: undefined, headers: opts?.headers, body: undefined, opts });
450
461
  }
462
+ /** Will this local model run now? Weights + the KV cache for the context + 10% headroom, against what is free. Checked against what Heatwatch (an optional macOS tool on `127.0.0.1:7878`) says is reclaimable NOW, with the apps to close when it is short — or, without Heatwatch, against the machine's total memory, and `source` says which (`heatwatch` | `total-memory`). The KV cache is counted from the model's `config.json` when it is in the gateway's model cache (`contextCounted` says whether it was). A model the catalogue does not list needs `need_mb`. A native service's start makes the same check and refuses a model that does not fit what is free, unless the start says `force: true`. `runtime.heatwatch: false` stops the gateway asking Heatwatch. — Gateway 0.74.0+. */
463
+ plan(query, opts) {
464
+ return this.rt.request(OPERATIONS["runtime.plan"], { path: {}, query: query, headers: opts?.headers, body: undefined, opts });
465
+ }
451
466
  /** Start the container engine (Podman — creates and starts its machine where one is needed). `{ action: 'start' }`. Podman on macOS and Windows runs containers in a machine: made on first start (`podman machine init`), then started. Linux Podman is rootless and needs nothing. Docker is not started by the gateway — the response says so. — Requires the gateway token. Gateway 0.19.0+. */
452
467
  engine(name, body, opts) {
453
468
  return this.rt.request(OPERATIONS["runtime.engine"], { path: { name }, query: undefined, headers: opts?.headers, body: body, opts });
@@ -585,6 +600,7 @@ export function buildApi(rt) {
585
600
  history: new HistoryApi(rt),
586
601
  events: new EventsApi(rt),
587
602
  memory: new MemoryApi(rt),
603
+ threads: new ThreadsApi(rt),
588
604
  prefs: new PrefsApi(rt),
589
605
  teams: new TeamsApi(rt),
590
606
  projects: new ProjectsApi(rt),
@@ -173,6 +173,35 @@ export interface RuntimeActionResult {
173
173
  restarted?: boolean;
174
174
  /** A model pick that fits but is tight for the engine's memory. */
175
175
  note?: string;
176
+ plan?: RuntimePlan;
177
+ }
178
+ /** Whether a local model fits in memory (gateway 0.74+) — `GET /v1/runtime/plan`, and on a start the live-memory check refused. */
179
+ export interface RuntimePlan {
180
+ ok: boolean;
181
+ service?: string;
182
+ model?: string;
183
+ /** Weights + KV cache + 10% headroom. */
184
+ needMB?: number;
185
+ weightsMB?: number;
186
+ /** The KV cache for the context; null when the model's config.json is not on disk. */
187
+ kvMB?: number;
188
+ context?: number;
189
+ contextCounted?: boolean;
190
+ source?: "heatwatch" | "total-memory";
191
+ fits?: boolean;
192
+ /** Heatwatch's answer; null without it. */
193
+ live?: {
194
+ fits?: boolean;
195
+ needMB?: number;
196
+ availableMB?: number;
197
+ shortfallMB?: number;
198
+ fitsGPULimit?: boolean;
199
+ gpuWiredLimitMB?: number;
200
+ /** The apps to close to make room. */
201
+ close?: Array<string>;
202
+ };
203
+ /** One sentence for the person. */
204
+ advice?: string;
176
205
  }
177
206
  export interface CapabilitiesDocument {
178
207
  capabilities: Array<Capability>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chatpanel/sdk",
3
- "version": "0.18.0",
3
+ "version": "0.20.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",