@chatpanel/sdk 0.26.0 → 0.27.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.
@@ -202,6 +202,16 @@ export declare const OPERATIONS: {
202
202
  readonly pathParams: readonly [];
203
203
  readonly queryParams: readonly [];
204
204
  };
205
+ readonly "events.delete": {
206
+ readonly id: "events.delete";
207
+ readonly method: "DELETE";
208
+ readonly path: "/v1/events";
209
+ readonly auth: "token";
210
+ readonly since: "0.105.0";
211
+ readonly stream: null;
212
+ readonly pathParams: readonly [];
213
+ readonly queryParams: readonly ["host", "all", "force"];
214
+ };
205
215
  readonly "events.cursor": {
206
216
  readonly id: "events.cursor";
207
217
  readonly method: "GET";
@@ -1383,6 +1393,12 @@ export declare class EventsApi {
1383
1393
  }, opts?: RequestOptions): Promise<T.EventsPage>;
1384
1394
  /** Push a batch of this client's durable log as CloudEvents; each event is appended once, each refusal is named. Idempotent on event id, so a retry is free. A `seq` that moves backwards for a host under a new id is a corrupt writer and is refused by itself; the rest of the batch lands. Push what lies above your entry in `cursor` (the gateway's highest `seq` per host) and stop re-sending what `rejected` names. At most 2000 events per batch. A gateway without SQLite answers 501. — Requires the gateway token. Gateway 0.24.0+. */
1385
1395
  push(body: T.PushEventsRequest, opts?: RequestOptions): Promise<T.PushEventsResponse>;
1396
+ /** Delete one host's slice of the merged log, or the whole log — only with `force=1`. A client's "Clear activity" reaching the copy held here. Name exactly one of `host` or `all=1`. Without `force=1` nothing is deleted: the answer is 409 `confirm_required` with `wouldDelete`, so leaving the flag off (or sending `force=0`) is a dry run, never a delete. The host's cursor entry goes with its events, so its next push starts afresh. A tailing stream gets a `deleted` frame. Idempotent: a host with nothing left deletes 0. — Requires the gateway token. Gateway 0.105.0+. */
1397
+ delete(query?: {
1398
+ host?: string;
1399
+ all?: "1" | "true" | "yes";
1400
+ force?: "1" | "true" | "yes";
1401
+ }, opts?: RequestOptions): Promise<T.EventsDeleted>;
1386
1402
  /** The gateway's highest `seq` per host — what a client asks for before it pushes. — Requires the gateway token. Gateway 0.24.0+. */
1387
1403
  cursor(opts?: RequestOptions): Promise<T.EventsCursor>;
1388
1404
  /** What the merged log measures — bytes and events per turn, per surface, per host and per day; the dedup hit-rate; tool calls; a year projected against the cap. — Requires the gateway token. Gateway 0.25.1+. */
@@ -20,6 +20,7 @@ export const OPERATIONS = {
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"] },
22
22
  "events.push": { id: "events.push", method: "POST", path: "/v1/events", auth: "token", since: "0.24.0", stream: null, pathParams: [], queryParams: [] },
23
+ "events.delete": { id: "events.delete", method: "DELETE", path: "/v1/events", auth: "token", since: "0.105.0", stream: null, pathParams: [], queryParams: ["host", "all", "force"] },
23
24
  "events.cursor": { id: "events.cursor", method: "GET", path: "/v1/events/cursor", auth: "token", since: "0.24.0", stream: null, pathParams: [], queryParams: [] },
24
25
  "events.stats": { id: "events.stats", method: "GET", path: "/v1/events/stats", auth: "token", since: "0.25.1", stream: null, pathParams: [], queryParams: [] },
25
26
  "events.stream": { id: "events.stream", method: "GET", path: "/v1/events/stream", auth: "token", since: "0.24.0", stream: "sse", pathParams: [], queryParams: ["cursor"] },
@@ -244,6 +245,10 @@ export class EventsApi {
244
245
  push(body, opts) {
245
246
  return this.rt.request(OPERATIONS["events.push"], { path: {}, query: undefined, headers: opts?.headers, body: body, opts });
246
247
  }
248
+ /** Delete one host's slice of the merged log, or the whole log — only with `force=1`. A client's "Clear activity" reaching the copy held here. Name exactly one of `host` or `all=1`. Without `force=1` nothing is deleted: the answer is 409 `confirm_required` with `wouldDelete`, so leaving the flag off (or sending `force=0`) is a dry run, never a delete. The host's cursor entry goes with its events, so its next push starts afresh. A tailing stream gets a `deleted` frame. Idempotent: a host with nothing left deletes 0. — Requires the gateway token. Gateway 0.105.0+. */
249
+ delete(query, opts) {
250
+ return this.rt.request(OPERATIONS["events.delete"], { path: {}, query: query, headers: opts?.headers, body: undefined, opts });
251
+ }
247
252
  /** The gateway's highest `seq` per host — what a client asks for before it pushes. — Requires the gateway token. Gateway 0.24.0+. */
248
253
  cursor(opts) {
249
254
  return this.rt.request(OPERATIONS["events.cursor"], { path: {}, query: undefined, headers: opts?.headers, body: undefined, opts });
@@ -1129,6 +1129,26 @@ export interface EventsCursor {
1129
1129
  cursor: EventsCursorMap;
1130
1130
  count?: number;
1131
1131
  }
1132
+ export interface EventsDeleted {
1133
+ ok: boolean;
1134
+ /** How many events went. */
1135
+ deleted: number;
1136
+ host?: string;
1137
+ all?: boolean;
1138
+ cursor: EventsCursorMap;
1139
+ }
1140
+ export interface EventsDeleteDryRun {
1141
+ ok: false;
1142
+ /** What `force=1` would delete. */
1143
+ wouldDelete: number;
1144
+ host?: string;
1145
+ all?: boolean;
1146
+ error: {
1147
+ message: string;
1148
+ type: "confirm_required";
1149
+ code?: "confirm_required";
1150
+ };
1151
+ }
1132
1152
  export interface EventsPage {
1133
1153
  ok: boolean;
1134
1154
  events: Array<CloudEvent>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chatpanel/sdk",
3
- "version": "0.26.0",
3
+ "version": "0.27.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",