@chatpanel/sdk 0.16.1 → 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.
- package/dist/api.generated.d.ts +56 -1
- package/dist/api.generated.js +17 -1
- package/dist/types.generated.d.ts +45 -1
- package/package.json +1 -1
package/dist/api.generated.d.ts
CHANGED
|
@@ -160,7 +160,7 @@ export declare const OPERATIONS: {
|
|
|
160
160
|
readonly since: "0.10.0";
|
|
161
161
|
readonly stream: null;
|
|
162
162
|
readonly pathParams: readonly [];
|
|
163
|
-
readonly queryParams: readonly ["since", "cursor", "limit", "kind"];
|
|
163
|
+
readonly queryParams: readonly ["since", "cursor", "limit", "kind", "bytes", "after_rev"];
|
|
164
164
|
};
|
|
165
165
|
readonly "history.putRecords": {
|
|
166
166
|
readonly id: "history.putRecords";
|
|
@@ -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";
|
|
@@ -1048,6 +1068,8 @@ export declare class HistoryApi {
|
|
|
1048
1068
|
cursor?: string;
|
|
1049
1069
|
limit?: number;
|
|
1050
1070
|
kind?: string;
|
|
1071
|
+
bytes?: number;
|
|
1072
|
+
after_rev?: number;
|
|
1051
1073
|
}, opts?: RequestOptions): Promise<T.RecordsPage>;
|
|
1052
1074
|
/** Push whole records; the gateway derives the searchable text itself. — Requires the gateway token. Gateway 0.10.0+. */
|
|
1053
1075
|
putRecords(body: T.PutRecordsRequest, opts?: RequestOptions): Promise<T.PutRecordsResponse>;
|
|
@@ -1104,6 +1126,29 @@ export declare class MemoryApi {
|
|
|
1104
1126
|
removes?: Array<string>;
|
|
1105
1127
|
}, opts?: RequestOptions): Promise<T.MemorySyncResponse>;
|
|
1106
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
|
+
}
|
|
1107
1152
|
/** The settings every client shares. */
|
|
1108
1153
|
export declare class PrefsApi {
|
|
1109
1154
|
private readonly rt;
|
|
@@ -1385,6 +1430,13 @@ export declare class RuntimeApi {
|
|
|
1385
1430
|
constructor(rt: Runtime);
|
|
1386
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+. */
|
|
1387
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>;
|
|
1388
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+. */
|
|
1389
1441
|
engine(name: string, body: {
|
|
1390
1442
|
action?: "start";
|
|
@@ -1394,6 +1446,8 @@ export declare class RuntimeApi {
|
|
|
1394
1446
|
action?: "start" | "stop" | "model";
|
|
1395
1447
|
/** With `action: model` — a catalogue id or a Hugging Face owner/name. */
|
|
1396
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;
|
|
1397
1451
|
}, opts?: RequestOptions): Promise<T.RuntimeActionResult>;
|
|
1398
1452
|
}
|
|
1399
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). */
|
|
@@ -1553,6 +1607,7 @@ export declare function buildApi(rt: Runtime): {
|
|
|
1553
1607
|
history: HistoryApi;
|
|
1554
1608
|
events: EventsApi;
|
|
1555
1609
|
memory: MemoryApi;
|
|
1610
|
+
threads: ThreadsApi;
|
|
1556
1611
|
prefs: PrefsApi;
|
|
1557
1612
|
teams: TeamsApi;
|
|
1558
1613
|
projects: ProjectsApi;
|
package/dist/api.generated.js
CHANGED
|
@@ -15,7 +15,7 @@ export const OPERATIONS = {
|
|
|
15
15
|
"history.status": { id: "history.status", method: "GET", path: "/v1/history/status", auth: "open", since: null, stream: null, pathParams: [], queryParams: [] },
|
|
16
16
|
"history.list": { id: "history.list", method: "GET", path: "/v1/history/list", auth: "open", since: null, stream: null, pathParams: [], queryParams: ["limit", "offset", "type"] },
|
|
17
17
|
"history.get": { id: "history.get", method: "GET", path: "/v1/history/get", auth: "open", since: null, stream: null, pathParams: [], queryParams: ["id", "maxChars", "offset"] },
|
|
18
|
-
"history.records": { id: "history.records", method: "GET", path: "/v1/history/records", auth: "open", since: "0.10.0", stream: null, pathParams: [], queryParams: ["since", "cursor", "limit", "kind"] },
|
|
18
|
+
"history.records": { id: "history.records", method: "GET", path: "/v1/history/records", auth: "open", since: "0.10.0", stream: null, pathParams: [], queryParams: ["since", "cursor", "limit", "kind", "bytes", "after_rev"] },
|
|
19
19
|
"history.putRecords": { id: "history.putRecords", method: "PUT", path: "/v1/history/records", auth: "token", since: "0.10.0", stream: null, pathParams: [], queryParams: [] },
|
|
20
20
|
"history.stream": { id: "history.stream", method: "GET", path: "/v1/history/stream", auth: "open", since: "0.11.0", stream: "sse", pathParams: [], queryParams: [] },
|
|
21
21
|
"events.since": { id: "events.since", method: "GET", path: "/v1/events", auth: "token", since: "0.24.0", stream: null, pathParams: [], queryParams: ["cursor", "limit", "host"] },
|
|
@@ -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>;
|
|
@@ -605,10 +634,12 @@ export interface RecordsPage {
|
|
|
605
634
|
ok: boolean;
|
|
606
635
|
/** Whole records; a tombstone carries `deletedAt`. */
|
|
607
636
|
records: Array<AnyObject>;
|
|
608
|
-
/** The cursor for the next page — pass it as `cursor
|
|
637
|
+
/** The cursor for the next page — pass it as `cursor` (or, paging by revision, as `after_rev`); absent on the last page. */
|
|
609
638
|
next?: string;
|
|
610
639
|
size?: number;
|
|
611
640
|
newest?: number;
|
|
641
|
+
/** The newest revision (gateway 0.63.0+). Each record carries its own `rev` too. */
|
|
642
|
+
rev?: number;
|
|
612
643
|
[key: string]: unknown;
|
|
613
644
|
}
|
|
614
645
|
/** One durable event in the CloudEvents 1.0 envelope. `seq`, `host`, `chatpanelv` are ChatPanel's extension attributes (the per-host order, the producer, the log schema version); `causes` is the comma-joined ids this event follows; `data` is the payload — refs and counts, never content. */
|
|
@@ -706,9 +737,12 @@ export interface PutRecordsRequest {
|
|
|
706
737
|
/** Who is pushing — recorded on every record. */
|
|
707
738
|
host?: string;
|
|
708
739
|
at?: number;
|
|
740
|
+
/** Whole records or tombstones. A record with `baseRev` (gateway 0.63.0+) is written only while the stored one is at that revision (0 = none stored); otherwise it comes back in `conflicts`. Without it the newer stamp wins. */
|
|
709
741
|
records?: Array<AnyObject>;
|
|
710
742
|
/** Sealed backup entries, opened with the stored passphrase. */
|
|
711
743
|
entries?: Array<AnyObject>;
|
|
744
|
+
/** Gateway 0.64.0+: a NOTE sent with a `baseRev` that is no longer current is merged against that version (title, tags and text three-way) instead of coming back in `conflicts`; the result is in `merged`. */
|
|
745
|
+
merge?: boolean;
|
|
712
746
|
}
|
|
713
747
|
export interface PutRecordsResponse {
|
|
714
748
|
ok: boolean;
|
|
@@ -716,6 +750,16 @@ export interface PutRecordsResponse {
|
|
|
716
750
|
ids?: Array<string>;
|
|
717
751
|
sealed?: number;
|
|
718
752
|
size?: number;
|
|
753
|
+
/** Each written record's new revision (gateway 0.63.0+). */
|
|
754
|
+
revs?: {
|
|
755
|
+
[key: string]: number;
|
|
756
|
+
};
|
|
757
|
+
/** The current record for each one sent with a `baseRev` that is no longer current — merge and send again. */
|
|
758
|
+
conflicts?: Array<AnyObject>;
|
|
759
|
+
/** Gateway 0.64.0+, with `merge: true`: each note merged from an outdated copy, as stored (with its new `rev`) — replace yours with it. */
|
|
760
|
+
merged?: Array<AnyObject>;
|
|
761
|
+
/** The newest revision after this write. */
|
|
762
|
+
rev?: number;
|
|
719
763
|
}
|
|
720
764
|
export interface IngestRequest {
|
|
721
765
|
upserts?: Array<{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chatpanel/sdk",
|
|
3
|
-
"version": "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",
|