@paneui/core 0.0.16 → 0.0.18

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/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { TemplateRecord, TemplateSummary, TemplateType, TemplateVersion, CreateArtifactResponse, CreatePaneRequest, CreatePaneResponse, EventsPage, FeedbackPage, FeedbackSubmission, FeedbackType, KeyInfo, MintParticipantResponse, PaneEvent, ParticipantsList, SerializedRecord, PaneState, PanesPage, TasteInfo, TrashListResponse, UpgradePaneResponse } from "./types.js";
1
+ import type { TemplateRecord, TemplateSummary, TemplateType, TemplateVersion, CreateArtifactResponse, CreatePaneRequest, CreatePaneResponse, EventsPage, FeedbackPage, FeedbackSubmission, FeedbackType, KeyInfo, MintParticipantResponse, PaneEvent, ParticipantsList, SerializedRecord, PaneState, PanesPage, TasteInfo, TrashListResponse, UpgradePaneResponse, UpdatePaneRequest, UpdatePaneResponse } from "./types.js";
2
2
  import type { ListPanesQuery } from "./schemas.js";
3
3
  export interface ClientOptions {
4
4
  /** Relay base URL, e.g. https://pane.example.com. Trailing slash is trimmed. */
@@ -52,6 +52,12 @@ export interface CreateArtifactRequest {
52
52
  type: TemplateType;
53
53
  event_schema?: unknown;
54
54
  input_schema?: Record<string, unknown>;
55
+ /** Optional per-pane record collections (JSON Schema 2020-12 + the
56
+ * `x-pane-collections` extension). Mirrors `createArtifactSchema`. */
57
+ record_schema?: unknown;
58
+ /** Optional template-level record collections (same grammar as
59
+ * `record_schema`; stored separately on the template version). */
60
+ template_record_schema?: unknown;
55
61
  /** Optional template icon emoji (a single emoji grapheme). Image icons are
56
62
  * set post-create via `updateArtifact({ icon_attachment_id })`. */
57
63
  icon_emoji?: string;
@@ -65,6 +71,11 @@ export interface CreateArtifactVersionRequest {
65
71
  type: TemplateType;
66
72
  event_schema?: unknown;
67
73
  input_schema?: Record<string, unknown>;
74
+ /** Optional per-pane record collections for this version (JSON Schema
75
+ * 2020-12 + `x-pane-collections`). Mirrors `createArtifactVersionSchema`. */
76
+ record_schema?: unknown;
77
+ /** Optional template-level record collections for this version. */
78
+ template_record_schema?: unknown;
68
79
  }
69
80
  /**
70
81
  * Request body for PATCH /v1/templates/:id — head metadata only (never
@@ -233,6 +244,12 @@ export declare class PaneClient {
233
244
  deleteRecord(paneId: string, collection: string, recordKey: string, opts?: {
234
245
  ifMatch?: number;
235
246
  }): Promise<void>;
247
+ /**
248
+ * DELETE /v1/panes/:id/records/:collection — drop a WHOLE collection
249
+ * (all rows + the collection row). Privileged: the relay restricts this to
250
+ * the pane's owning agent (#507). Returns nothing on 204.
251
+ */
252
+ deleteRecordCollection(paneId: string, collection: string): Promise<void>;
236
253
  /**
237
254
  * GET /v1/templates/:id/template-records/:collection — owner-only list of
238
255
  * a template's curated records. Same wire shape as listRecords, separate
@@ -279,6 +296,11 @@ export declare class PaneClient {
279
296
  deleteTemplateRecord(templateIdOrSlug: string, collection: string, recordKey: string, opts?: {
280
297
  ifMatch?: number;
281
298
  }): Promise<void>;
299
+ /**
300
+ * DELETE /v1/templates/:id/template-records/:collection — drop a WHOLE
301
+ * template collection (all rows + the collection row). Owner-only (#507).
302
+ */
303
+ deleteTemplateRecordCollection(templateIdOrSlug: string, collection: string): Promise<void>;
282
304
  /** POST /v1/panes/:id/events — append an agent event. */
283
305
  sendEvent(paneId: string, ev: {
284
306
  type: string;
@@ -435,6 +457,20 @@ export declare class PaneClient {
435
457
  template_version?: number;
436
458
  compat?: "strict" | "force";
437
459
  }): Promise<UpgradePaneResponse>;
460
+ /**
461
+ * PATCH /v1/panes/:id — in-place edit of instance-level pane fields (#502):
462
+ * `ttl`/`expires_at`, `input_data`, `title`, `preamble`, `metadata`, `tags`,
463
+ * `icon_emoji`, `icon_attachment_id`. The pane keeps its id, URL, event log,
464
+ * and template pin. `input_data` is replaced wholesale and revalidated
465
+ * against the pane's current template version's input_schema. Pass `null`
466
+ * for `icon_emoji` / `icon_attachment_id` to CLEAR the override.
467
+ *
468
+ * The body must carry at least one updatable field; `ttl` and `expires_at`
469
+ * are mutually exclusive (both express the same intent). Both TTL forms are
470
+ * clamped against the relay's `MAX_TTL_SECONDS` cap and rejected (rather
471
+ * than silently truncated) when exceeded.
472
+ */
473
+ updatePane(paneId: string, body: UpdatePaneRequest): Promise<UpdatePaneResponse>;
438
474
  /**
439
475
  * DELETE /v1/panes/:id/participants/:participant_id — revoke a single
440
476
  * participant URL. The pane's other participants (and the agent's own
package/dist/client.js CHANGED
@@ -262,6 +262,16 @@ export class PaneClient {
262
262
  if (!r.ok)
263
263
  this.fail(r);
264
264
  }
265
+ /**
266
+ * DELETE /v1/panes/:id/records/:collection — drop a WHOLE collection
267
+ * (all rows + the collection row). Privileged: the relay restricts this to
268
+ * the pane's owning agent (#507). Returns nothing on 204.
269
+ */
270
+ async deleteRecordCollection(paneId, collection) {
271
+ const r = await this.call("DELETE", `/v1/panes/${encodeURIComponent(paneId)}/records/${encodeURIComponent(collection)}`);
272
+ if (!r.ok)
273
+ this.fail(r);
274
+ }
265
275
  // ----- template-level records CRUD ------------------------------------
266
276
  /**
267
277
  * GET /v1/templates/:id/template-records/:collection — owner-only list of
@@ -327,6 +337,15 @@ export class PaneClient {
327
337
  if (!r.ok)
328
338
  this.fail(r);
329
339
  }
340
+ /**
341
+ * DELETE /v1/templates/:id/template-records/:collection — drop a WHOLE
342
+ * template collection (all rows + the collection row). Owner-only (#507).
343
+ */
344
+ async deleteTemplateRecordCollection(templateIdOrSlug, collection) {
345
+ const r = await this.call("DELETE", `/v1/templates/${encodeURIComponent(templateIdOrSlug)}/template-records/${encodeURIComponent(collection)}`);
346
+ if (!r.ok)
347
+ this.fail(r);
348
+ }
330
349
  /** POST /v1/panes/:id/events — append an agent event. */
331
350
  async sendEvent(paneId, ev) {
332
351
  const r = await this.call("POST", `/v1/panes/${encodeURIComponent(paneId)}/events`, {
@@ -354,6 +373,8 @@ export class PaneClient {
354
373
  type: req.type,
355
374
  event_schema: req.event_schema,
356
375
  input_schema: req.input_schema,
376
+ record_schema: req.record_schema,
377
+ template_record_schema: req.template_record_schema,
357
378
  icon_emoji: req.icon_emoji,
358
379
  });
359
380
  if (!r.ok)
@@ -371,6 +392,8 @@ export class PaneClient {
371
392
  type: req.type,
372
393
  event_schema: req.event_schema,
373
394
  input_schema: req.input_schema,
395
+ record_schema: req.record_schema,
396
+ template_record_schema: req.template_record_schema,
374
397
  });
375
398
  if (!r.ok)
376
399
  this.fail(r);
@@ -608,6 +631,25 @@ export class PaneClient {
608
631
  this.fail(r);
609
632
  return this.asObject(r);
610
633
  }
634
+ /**
635
+ * PATCH /v1/panes/:id — in-place edit of instance-level pane fields (#502):
636
+ * `ttl`/`expires_at`, `input_data`, `title`, `preamble`, `metadata`, `tags`,
637
+ * `icon_emoji`, `icon_attachment_id`. The pane keeps its id, URL, event log,
638
+ * and template pin. `input_data` is replaced wholesale and revalidated
639
+ * against the pane's current template version's input_schema. Pass `null`
640
+ * for `icon_emoji` / `icon_attachment_id` to CLEAR the override.
641
+ *
642
+ * The body must carry at least one updatable field; `ttl` and `expires_at`
643
+ * are mutually exclusive (both express the same intent). Both TTL forms are
644
+ * clamped against the relay's `MAX_TTL_SECONDS` cap and rejected (rather
645
+ * than silently truncated) when exceeded.
646
+ */
647
+ async updatePane(paneId, body) {
648
+ const r = await this.call("PATCH", `/v1/panes/${encodeURIComponent(paneId)}`, body);
649
+ if (!r.ok)
650
+ this.fail(r);
651
+ return this.asObject(r);
652
+ }
611
653
  /**
612
654
  * DELETE /v1/panes/:id/participants/:participant_id — revoke a single
613
655
  * participant URL. The pane's other participants (and the agent's own
package/dist/index.d.ts CHANGED
@@ -4,9 +4,9 @@ export { openStream } from "./stream.js";
4
4
  export type { OpenStreamOptions, StreamHandlers, StreamHandle, } from "./stream.js";
5
5
  export { registerAgent } from "./register.js";
6
6
  export type { RegisterAgentOptions, RegisterAgentResult } from "./register.js";
7
- export { artifactSchema, callbackSchema, createPaneSchema, artifactTypeSchema, createArtifactSchema, createArtifactVersionSchema, patchArtifactMetadataSchema, feedbackTypeSchema, submitFeedbackSchema, listPanesStatusSchema, listPanesQuerySchema, mintParticipantSchema, upgradePaneSchema, } from "./schemas.js";
8
- export type { CreatePaneInput, ListPanesStatus, ListPanesQuery, MintParticipantInput, UpgradePaneInput, } from "./schemas.js";
7
+ export { artifactSchema, callbackSchema, createPaneSchema, artifactTypeSchema, createArtifactSchema, createArtifactVersionSchema, patchArtifactMetadataSchema, feedbackTypeSchema, submitFeedbackSchema, listPanesStatusSchema, listPanesQuerySchema, mintParticipantSchema, upgradePaneSchema, updatePaneSchema, } from "./schemas.js";
8
+ export type { CreatePaneInput, ListPanesStatus, ListPanesQuery, MintParticipantInput, UpgradePaneInput, UpdatePaneInput, } from "./schemas.js";
9
9
  export { validateIconEmoji, isValidIconEmoji, isRasterImageMime, RASTER_ICON_MIME_ALLOWLIST, MAX_ICON_EMOJI_BYTES, } from "./icons.js";
10
10
  export type { RasterIconMime } from "./icons.js";
11
11
  export { MAX_EVENT_TYPE_LENGTH, MAX_IDEMPOTENCY_KEY_LENGTH, MAX_RESPONSE_SNIPPET_LENGTH, MAX_FRAME_SNIPPET_LENGTH, } from "./limits.js";
12
- export type { AuthorKind, PaneEvent, SerializedRecord, DeletedRecordRef, RecordDeltaMessage, Template, TemplateType, TemplateVersion, TemplateRecord, TemplateSummary, CreateArtifactResponse, KeyInfo, TasteInfo, FeedbackType, FeedbackSubmission, FeedbackRecord, FeedbackPage, Callback, CreatePaneRequest, CreatePaneResponse, PaneState, EventsPage, ParticipantSummary, ParticipantsList, PaneSummary, PanesPage, MintParticipantResponse, UpgradeBreak, UpgradePaneResponse, TrashedPaneEntry, TrashedTemplateEntry, TrashListResponse, RelayError, } from "./types.js";
12
+ export type { AuthorKind, PaneEvent, SerializedRecord, DeletedRecordRef, RecordDeltaMessage, Template, TemplateType, TemplateVersion, TemplateRecord, TemplateSummary, CreateArtifactResponse, KeyInfo, TasteInfo, FeedbackType, FeedbackSubmission, FeedbackRecord, FeedbackPage, Callback, CreatePaneRequest, CreatePaneResponse, PaneState, EventsPage, ParticipantSummary, ParticipantsList, PaneSummary, PanesPage, MintParticipantResponse, UpgradeBreak, UpgradePaneResponse, UpdatePaneRequest, UpdatePaneResponse, TrashedPaneEntry, TrashedTemplateEntry, TrashListResponse, RelayError, } from "./types.js";
package/dist/index.js CHANGED
@@ -3,6 +3,6 @@
3
3
  export { PaneClient, PaneApiError } from "./client.js";
4
4
  export { openStream } from "./stream.js";
5
5
  export { registerAgent } from "./register.js";
6
- export { artifactSchema, callbackSchema, createPaneSchema, artifactTypeSchema, createArtifactSchema, createArtifactVersionSchema, patchArtifactMetadataSchema, feedbackTypeSchema, submitFeedbackSchema, listPanesStatusSchema, listPanesQuerySchema, mintParticipantSchema, upgradePaneSchema, } from "./schemas.js";
6
+ export { artifactSchema, callbackSchema, createPaneSchema, artifactTypeSchema, createArtifactSchema, createArtifactVersionSchema, patchArtifactMetadataSchema, feedbackTypeSchema, submitFeedbackSchema, listPanesStatusSchema, listPanesQuerySchema, mintParticipantSchema, upgradePaneSchema, updatePaneSchema, } from "./schemas.js";
7
7
  export { validateIconEmoji, isValidIconEmoji, isRasterImageMime, RASTER_ICON_MIME_ALLOWLIST, MAX_ICON_EMOJI_BYTES, } from "./icons.js";
8
8
  export { MAX_EVENT_TYPE_LENGTH, MAX_IDEMPOTENCY_KEY_LENGTH, MAX_RESPONSE_SNIPPET_LENGTH, MAX_FRAME_SNIPPET_LENGTH, } from "./limits.js";
package/dist/schemas.d.ts CHANGED
@@ -130,3 +130,15 @@ export declare const upgradePaneSchema: z.ZodObject<{
130
130
  }>>;
131
131
  }, z.core.$strip>;
132
132
  export type UpgradePaneInput = z.infer<typeof upgradePaneSchema>;
133
+ export declare const updatePaneSchema: z.ZodObject<{
134
+ ttl: z.ZodOptional<z.ZodNumber>;
135
+ expires_at: z.ZodOptional<z.ZodString>;
136
+ input_data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
137
+ title: z.ZodOptional<z.ZodString>;
138
+ preamble: z.ZodOptional<z.ZodString>;
139
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
140
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
141
+ icon_emoji: z.ZodOptional<z.ZodNullable<z.ZodString>>;
142
+ icon_attachment_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
143
+ }, z.core.$strip>;
144
+ export type UpdatePaneInput = z.infer<typeof updatePaneSchema>;
package/dist/schemas.js CHANGED
@@ -199,3 +199,35 @@ export const upgradePaneSchema = z.object({
199
199
  template_version: z.number().int().positive().optional(),
200
200
  compat: z.enum(["strict", "force"]).optional(),
201
201
  });
202
+ // PATCH /v1/panes/:id — in-place edit of instance-level pane fields (#502).
203
+ // All fields are optional but the body must carry at least one. `ttl` and
204
+ // `expires_at` are mutually exclusive (both are ways of saying the same thing).
205
+ // `input_data` is replaced wholesale; the relay revalidates it against the
206
+ // pane's current template version's input_schema. `icon_emoji` and
207
+ // `icon_attachment_id` accept null to CLEAR the override and fall back to the
208
+ // template's icon.
209
+ export const updatePaneSchema = z
210
+ .object({
211
+ ttl: z.number().int().positive().optional(),
212
+ expires_at: z
213
+ .string()
214
+ .datetime({ offset: true })
215
+ .refine((s) => !Number.isNaN(new Date(s).getTime()), {
216
+ message: "expires_at must be a parseable ISO-8601 timestamp",
217
+ })
218
+ .optional(),
219
+ input_data: z.record(z.string(), z.unknown()).optional(),
220
+ title: z.string().optional(),
221
+ preamble: z.string().max(300).optional(),
222
+ metadata: z.record(z.string(), z.unknown()).optional(),
223
+ tags: z.array(z.string().min(1).max(50)).max(20).optional(),
224
+ icon_emoji: iconEmojiSchema.nullable().optional(),
225
+ icon_attachment_id: z.string().min(1).nullable().optional(),
226
+ })
227
+ .refine((b) => Object.values(b).some((v) => v !== undefined), {
228
+ message: "request body must carry at least one updatable field (ttl, expires_at, input_data, title, preamble, metadata, tags, icon_emoji, icon_attachment_id)",
229
+ })
230
+ .refine((b) => !(b.ttl !== undefined && b.expires_at !== undefined), {
231
+ message: "ttl and expires_at are mutually exclusive — pass one or the other",
232
+ path: ["expires_at"],
233
+ });
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { z } from "zod";
2
- import type { createPaneSchema } from "./schemas.js";
2
+ import type { createPaneSchema, updatePaneSchema } from "./schemas.js";
3
3
  export type AuthorKind = "human" | "agent" | "system";
4
4
  /** A single event envelope as emitted by the relay. */
5
5
  export interface PaneEvent {
@@ -234,6 +234,31 @@ export interface UpgradePaneResponse {
234
234
  /** The compat mode the upgrade ran under. */
235
235
  compat: "strict" | "force";
236
236
  }
237
+ /**
238
+ * Request body for PATCH /v1/panes/:id (#502). Derived from `updatePaneSchema`
239
+ * so the runtime validator and the static type cannot drift.
240
+ */
241
+ export type UpdatePaneRequest = z.infer<typeof updatePaneSchema>;
242
+ /** Response from PATCH /v1/panes/:id — the full new pane state, matching the
243
+ * shape returned by GET /v1/panes/:id so callers can hot-swap their cached
244
+ * view without an extra read. */
245
+ export interface UpdatePaneResponse {
246
+ pane_id: string;
247
+ status: "open" | "closed";
248
+ template_id: string;
249
+ template_version_id: string;
250
+ template_version: number;
251
+ title: string;
252
+ tags: string[];
253
+ metadata: Record<string, unknown> | null;
254
+ input_data: Record<string, unknown> | null;
255
+ created_at: string;
256
+ expires_at: string;
257
+ deleted_at: string | null;
258
+ /** The set of field names that were actually applied by this PATCH. Useful
259
+ * for callers that want to confirm a no-op vs. a real change. */
260
+ updated_fields: string[];
261
+ }
237
262
  /** One immutable version of an template's content. */
238
263
  export interface TemplateVersion {
239
264
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paneui/core",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "description": "Pane relay client: typed HTTP + WebSocket operations against a Pane relay. Framework-free.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -50,7 +50,7 @@
50
50
  "zod": "^4.4.3"
51
51
  },
52
52
  "devDependencies": {
53
- "@types/node": "^25.9.1",
53
+ "@types/node": "^25.9.2",
54
54
  "@types/ws": "^8.18.1",
55
55
  "typescript": "^6.0.3",
56
56
  "vitest": "^4.1.8"