@paneui/core 0.0.6 → 0.0.8

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.js CHANGED
@@ -121,10 +121,10 @@ export class PaneClient {
121
121
  docsUrl: err?.docs_url,
122
122
  });
123
123
  }
124
- /** POST /v1/sessions — create a session. */
124
+ /** POST /v1/surfaces — create a surface. */
125
125
  async createSession(req) {
126
- const r = await this.call("POST", "/v1/sessions", {
127
- artifact: req.artifact,
126
+ const r = await this.call("POST", "/v1/surfaces", {
127
+ template: req.template,
128
128
  title: req.title,
129
129
  input_data: req.input_data,
130
130
  participants: req.participants,
@@ -136,19 +136,19 @@ export class PaneClient {
136
136
  this.fail(r);
137
137
  return this.asObject(r);
138
138
  }
139
- /** GET /v1/sessions/:id — non-blocking session metadata. */
140
- async getSession(sessionId) {
141
- const r = await this.call("GET", `/v1/sessions/${encodeURIComponent(sessionId)}`);
139
+ /** GET /v1/surfaces/:id — non-blocking surface metadata. */
140
+ async getSession(surfaceId) {
141
+ const r = await this.call("GET", `/v1/surfaces/${encodeURIComponent(surfaceId)}`);
142
142
  if (!r.ok)
143
143
  this.fail(r);
144
144
  return this.asObject(r);
145
145
  }
146
146
  /**
147
- * GET /v1/sessions/:id/events — fetch the event log.
147
+ * GET /v1/surfaces/:id/events — fetch the event log.
148
148
  * `since` is an opaque cursor; `waitSeconds` enables the relay long-poll
149
149
  * (0 = non-blocking, capped at 30 by the relay).
150
150
  */
151
- async getEvents(sessionId, opts = {}) {
151
+ async getEvents(surfaceId, opts = {}) {
152
152
  const q = new URLSearchParams();
153
153
  if (opts.since != null && opts.since !== "")
154
154
  q.set("since", opts.since);
@@ -156,14 +156,14 @@ export class PaneClient {
156
156
  q.set("wait", String(Math.floor(opts.waitSeconds)));
157
157
  }
158
158
  const qs = q.toString();
159
- const r = await this.call("GET", `/v1/sessions/${encodeURIComponent(sessionId)}/events${qs ? "?" + qs : ""}`);
159
+ const r = await this.call("GET", `/v1/surfaces/${encodeURIComponent(surfaceId)}/events${qs ? "?" + qs : ""}`);
160
160
  if (!r.ok)
161
161
  this.fail(r);
162
162
  return this.asObject(r);
163
163
  }
164
- /** POST /v1/sessions/:id/events — append an agent event. */
165
- async sendEvent(sessionId, ev) {
166
- const r = await this.call("POST", `/v1/sessions/${encodeURIComponent(sessionId)}/events`, {
164
+ /** POST /v1/surfaces/:id/events — append an agent event. */
165
+ async sendEvent(surfaceId, ev) {
166
+ const r = await this.call("POST", `/v1/surfaces/${encodeURIComponent(surfaceId)}/events`, {
167
167
  type: ev.type,
168
168
  data: ev.data,
169
169
  causation_id: ev.causationId,
@@ -175,11 +175,11 @@ export class PaneClient {
175
175
  return { event: body.event, deduped: body.deduped ?? false };
176
176
  }
177
177
  /**
178
- * POST /v1/artifacts — create a named, reusable artifact and its v1 content.
179
- * Returns the new `artifact_id` and `version` (1).
178
+ * POST /v1/templates — create a named, reusable template and its v1 content.
179
+ * Returns the new `template_id` and `version` (1).
180
180
  */
181
181
  async createArtifact(req) {
182
- const r = await this.call("POST", "/v1/artifacts", {
182
+ const r = await this.call("POST", "/v1/templates", {
183
183
  name: req.name,
184
184
  slug: req.slug,
185
185
  description: req.description,
@@ -194,12 +194,12 @@ export class PaneClient {
194
194
  return this.asObject(r);
195
195
  }
196
196
  /**
197
- * POST /v1/artifacts/:id/versions — append a new immutable version to an
198
- * existing artifact. `idOrSlug` accepts the artifact id or its slug.
197
+ * POST /v1/templates/:id/versions — append a new immutable version to an
198
+ * existing template. `idOrSlug` accepts the template id or its slug.
199
199
  * Returns the new `version` number.
200
200
  */
201
201
  async createArtifactVersion(idOrSlug, req) {
202
- const r = await this.call("POST", `/v1/artifacts/${encodeURIComponent(idOrSlug)}/versions`, {
202
+ const r = await this.call("POST", `/v1/templates/${encodeURIComponent(idOrSlug)}/versions`, {
203
203
  source: req.source,
204
204
  type: req.type,
205
205
  event_schema: req.event_schema,
@@ -210,11 +210,11 @@ export class PaneClient {
210
210
  return this.asObject(r);
211
211
  }
212
212
  /**
213
- * PATCH /v1/artifacts/:id — update head metadata (name / slug / description /
213
+ * PATCH /v1/templates/:id — update head metadata (name / slug / description /
214
214
  * tags); never the content. Returns the updated lean summary.
215
215
  */
216
216
  async updateArtifact(idOrSlug, metadata) {
217
- const r = await this.call("PATCH", `/v1/artifacts/${encodeURIComponent(idOrSlug)}`, {
217
+ const r = await this.call("PATCH", `/v1/templates/${encodeURIComponent(idOrSlug)}`, {
218
218
  name: metadata.name,
219
219
  slug: metadata.slug,
220
220
  description: metadata.description,
@@ -225,33 +225,33 @@ export class PaneClient {
225
225
  return this.asObject(r);
226
226
  }
227
227
  /**
228
- * GET /v1/artifacts?q=... — search/list the agent's named artifacts. The
229
- * response is lean (no `source` blob), ranked by `last_used_at`. Omit `query`
230
- * to list every named artifact.
228
+ * GET /v1/templates?q=... — search/list the agent's named templates. The
229
+ * response is lean (no `source` attachment), ranked by `last_used_at`. Omit `query`
230
+ * to list every named template.
231
231
  */
232
232
  async searchArtifacts(query) {
233
233
  const qs = query != null && query !== "" ? "?q=" + encodeURIComponent(query) : "";
234
- const r = await this.call("GET", `/v1/artifacts${qs}`);
234
+ const r = await this.call("GET", `/v1/templates${qs}`);
235
235
  if (!r.ok)
236
236
  this.fail(r);
237
- return this.asObject(r).artifacts;
237
+ return this.asObject(r).templates;
238
238
  }
239
239
  /**
240
- * GET /v1/artifacts/:id — fetch a full artifact (head metadata + version
241
- * list). `idOrSlug` accepts the artifact id or its slug.
240
+ * GET /v1/templates/:id — fetch a full template (head metadata + version
241
+ * list). `idOrSlug` accepts the template id or its slug.
242
242
  */
243
243
  async getArtifact(idOrSlug) {
244
- const r = await this.call("GET", `/v1/artifacts/${encodeURIComponent(idOrSlug)}`);
244
+ const r = await this.call("GET", `/v1/templates/${encodeURIComponent(idOrSlug)}`);
245
245
  if (!r.ok)
246
246
  this.fail(r);
247
247
  return this.asObject(r);
248
248
  }
249
249
  /**
250
- * GET /v1/artifacts/:id/versions/:version — fetch one version's full
250
+ * GET /v1/templates/:id/versions/:version — fetch one version's full
251
251
  * content (HTML, event schema, input schema).
252
252
  */
253
253
  async getArtifactVersion(idOrSlug, version) {
254
- const r = await this.call("GET", `/v1/artifacts/${encodeURIComponent(idOrSlug)}/versions/${encodeURIComponent(String(version))}`);
254
+ const r = await this.call("GET", `/v1/templates/${encodeURIComponent(idOrSlug)}/versions/${encodeURIComponent(String(version))}`);
255
255
  if (!r.ok)
256
256
  this.fail(r);
257
257
  return this.asObject(r);
@@ -277,10 +277,23 @@ export class PaneClient {
277
277
  this.fail(r);
278
278
  }
279
279
  /**
280
- * GET /v1/tastethe calling agent's freeform "taste notes" markdown blob:
280
+ * POST /v1/agents/claimbind this agent to a human via a one-shot
281
+ * claim code the human generated in their settings UI. After a
282
+ * successful claim the agent's existing API key continues to work,
283
+ * but the agent (and its surfaces/templates) now belong to the
284
+ * claiming human. One-way operation — there is no unclaim in v1.
285
+ */
286
+ async claimAgent(code) {
287
+ const r = await this.call("POST", "/v1/agents/claim", { code });
288
+ if (!r.ok)
289
+ this.fail(r);
290
+ return this.asObject(r);
291
+ }
292
+ /**
293
+ * GET /v1/taste — the calling agent's freeform "taste notes" markdown attachment:
281
294
  * presentation preferences the agent has picked up from human feedback over
282
295
  * time. Returns `{ taste: null, updated_at: null, bytes: 0 }` when the
283
- * agent has never written notes. Read this before generating an artifact so
296
+ * agent has never written notes. Read this before generating an template so
284
297
  * the agent applies prior feedback.
285
298
  */
286
299
  async getTaste() {
@@ -290,7 +303,7 @@ export class PaneClient {
290
303
  return this.asObject(r);
291
304
  }
292
305
  /**
293
- * PUT /v1/taste — whole-blob replace of the calling agent's taste notes.
306
+ * PUT /v1/taste — whole-attachment replace of the calling agent's taste notes.
294
307
  * Empty/whitespace-only values are rejected by the relay; callers asking to
295
308
  * clear must use {@link clearTaste}. The relay caps the payload at the
296
309
  * server's `MAX_TASTE_BYTES` (utf8 bytes).
@@ -320,7 +333,7 @@ export class PaneClient {
320
333
  const r = await this.call("POST", "/v1/feedback", {
321
334
  type: req.type,
322
335
  message: req.message,
323
- session_id: req.sessionId,
336
+ surface_id: req.surfaceId,
324
337
  });
325
338
  if (!r.ok)
326
339
  this.fail(r);
@@ -343,7 +356,7 @@ export class PaneClient {
343
356
  return this.asObject(r);
344
357
  }
345
358
  /**
346
- * GET /v1/sessions — list the calling agent's sessions. Default filter is
359
+ * GET /v1/surfaces — list the calling agent's surfaces. Default filter is
347
360
  * `status=open` (effective status — respects expiresAt). Response items
348
361
  * carry NO secrets: no participant token plaintext, no callback URL, no
349
362
  * metadata or input_data. Use `participant_id` from the list as the handle
@@ -358,46 +371,46 @@ export class PaneClient {
358
371
  q.set("limit", String(opts.limit));
359
372
  if (opts.cursor !== undefined && opts.cursor !== "")
360
373
  q.set("cursor", opts.cursor);
361
- if (opts.artifact_id !== undefined && opts.artifact_id !== "")
362
- q.set("artifact_id", opts.artifact_id);
374
+ if (opts.template_id !== undefined && opts.template_id !== "")
375
+ q.set("template_id", opts.template_id);
363
376
  const qs = q.toString();
364
- const r = await this.call("GET", `/v1/sessions${qs ? "?" + qs : ""}`);
377
+ const r = await this.call("GET", `/v1/surfaces${qs ? "?" + qs : ""}`);
365
378
  if (!r.ok)
366
379
  this.fail(r);
367
380
  return this.asObject(r);
368
381
  }
369
382
  /**
370
- * GET /v1/sessions/:id/participants — list every participant on one
371
- * session (active and revoked). Bounded by MAX_PARTICIPANTS_PER_SESSION
383
+ * GET /v1/surfaces/:id/participants — list every participant on one
384
+ * surface (active and revoked). Bounded by MAX_PARTICIPANTS_PER_SESSION
372
385
  * on the relay, so the full list is returned with no pagination.
373
386
  * Use this to find the `participant_id` you need to pass to
374
387
  * {@link revokeParticipant}, or to audit revoked rows.
375
388
  */
376
- async listParticipants(sessionId) {
377
- const r = await this.call("GET", `/v1/sessions/${encodeURIComponent(sessionId)}/participants`);
389
+ async listParticipants(surfaceId) {
390
+ const r = await this.call("GET", `/v1/surfaces/${encodeURIComponent(surfaceId)}/participants`);
378
391
  if (!r.ok)
379
392
  this.fail(r);
380
393
  return this.asObject(r);
381
394
  }
382
395
  /**
383
- * POST /v1/sessions/:id/participants — mint a fresh participant URL for an
384
- * existing session. The one-shot recovery primitive when the original URL
385
- * was dropped: the session keeps its event log, artifact pin, and created_at.
396
+ * POST /v1/surfaces/:id/participants — mint a fresh participant URL for an
397
+ * existing surface. The one-shot recovery primitive when the original URL
398
+ * was dropped: the surface keeps its event log, template pin, and created_at.
386
399
  * v1 supports `kind: "human"` only.
387
400
  *
388
401
  * The plaintext token is returned EXACTLY ONCE in the response — the relay
389
402
  * stores only the hash. Save the response (e.g. pipe to a JSONL log) before
390
403
  * delivering the URL to the human.
391
404
  */
392
- async mintParticipant(sessionId, opts = {}) {
393
- const r = await this.call("POST", `/v1/sessions/${encodeURIComponent(sessionId)}/participants`, { kind: opts.kind ?? "human" });
405
+ async mintParticipant(surfaceId, opts = {}) {
406
+ const r = await this.call("POST", `/v1/surfaces/${encodeURIComponent(surfaceId)}/participants`, { kind: opts.kind ?? "human" });
394
407
  if (!r.ok)
395
408
  this.fail(r);
396
409
  return this.asObject(r);
397
410
  }
398
411
  /**
399
- * DELETE /v1/sessions/:id/participants/:participant_id — revoke a single
400
- * participant URL. The session's other participants (and the agent's own
412
+ * DELETE /v1/surfaces/:id/participants/:participant_id — revoke a single
413
+ * participant URL. The surface's other participants (and the agent's own
401
414
  * WebSocket) are untouched. Idempotent: revoking an unknown or already-
402
415
  * revoked participant returns 204. The agent participant cannot be revoked
403
416
  * via this endpoint — use {@link deleteSession} instead.
@@ -405,29 +418,29 @@ export class PaneClient {
405
418
  * Existing WebSocket connections held under the revoked token are NOT
406
419
  * actively kicked in v1; new HTTP and WS connections are refused.
407
420
  */
408
- async revokeParticipant(sessionId, participantId) {
409
- const r = await this.call("DELETE", `/v1/sessions/${encodeURIComponent(sessionId)}/participants/${encodeURIComponent(participantId)}`);
421
+ async revokeParticipant(surfaceId, participantId) {
422
+ const r = await this.call("DELETE", `/v1/surfaces/${encodeURIComponent(surfaceId)}/participants/${encodeURIComponent(participantId)}`);
410
423
  if (!r.ok)
411
424
  this.fail(r);
412
425
  }
413
426
  /**
414
- * DELETE /v1/sessions/:id — close/delete a session. Idempotent on the relay
415
- * side (an already-closed session still returns 204 with no body).
427
+ * DELETE /v1/surfaces/:id — close/delete a surface. Idempotent on the relay
428
+ * side (an already-closed surface still returns 204 with no body).
416
429
  */
417
430
  async deleteSession(id) {
418
- const r = await this.call("DELETE", `/v1/sessions/${encodeURIComponent(id)}`);
431
+ const r = await this.call("DELETE", `/v1/surfaces/${encodeURIComponent(id)}`);
419
432
  if (!r.ok)
420
433
  this.fail(r);
421
434
  }
422
435
  /**
423
- * DELETE /v1/artifacts/:id — remove an artifact and (server-side) all its
436
+ * DELETE /v1/templates/:id — remove an template and (server-side) all its
424
437
  * versions. Strict cascade: the relay refuses with 409 conflict if any
425
- * session in any state still references one of the artifact's versions —
438
+ * surface in any state still references one of the template's versions —
426
439
  * surface that as a typed PaneApiError so the CLI can render a hint
427
440
  * instead of swallowing it.
428
441
  */
429
442
  async deleteArtifact(idOrSlug) {
430
- const r = await this.call("DELETE", `/v1/artifacts/${encodeURIComponent(idOrSlug)}`);
443
+ const r = await this.call("DELETE", `/v1/templates/${encodeURIComponent(idOrSlug)}`);
431
444
  if (!r.ok)
432
445
  this.fail(r);
433
446
  }
@@ -436,28 +449,28 @@ export class PaneClient {
436
449
  // See proposal pane#152 for the full design.
437
450
  // ------------------------------------------------------------------------
438
451
  /**
439
- * Upload a blob to the relay. Returns a `BlobRef` that can be referenced
440
- * in event payloads (the relay's `format: pane-blob-id` schema vocab
452
+ * Upload a attachment to the relay. Returns a `AttachmentRef` that can be referenced
453
+ * in event payloads (the relay's `format: pane-attachment-id` schema vocab
441
454
  * validates the id) or in `pane create --input-data`.
442
455
  *
443
- * Scope defaults to "agent" (reusable across the agent's sessions). For
444
- * `scope: "session"` pass `sessionId`; for `scope: "artifact"` pass
445
- * `artifactId`. The agent must own the referenced session / artifact;
446
- * cross-tenant attempts return blob_not_found.
456
+ * Scope defaults to "agent" (reusable across the agent's surfaces). For
457
+ * `scope: "surface"` pass `surfaceId`; for `scope: "template"` pass
458
+ * `templateId`. The agent must own the referenced surface / template;
459
+ * cross-tenant attempts return attachment_not_found.
447
460
  *
448
461
  * MIME is inferred from `mime` if supplied; otherwise the relay sniffs
449
462
  * leading bytes and may reject with mime_mismatch / mime_disallowed.
450
463
  *
451
- * Backed by the relay's multipart `POST /v1/blobs` (the fallback path).
464
+ * Backed by the relay's multipart `POST /v1/attachments` (the fallback path).
452
465
  * For large uploads (>1 MB on hosted Azure) call `presignBlob()` +
453
466
  * `confirmBlob()` instead — those use SAS direct-to-storage and don't
454
467
  * stream bytes through the relay.
455
468
  */
456
469
  async uploadBlob(file, opts = {}) {
457
470
  const fd = new FormData();
458
- let blob;
471
+ let attachment;
459
472
  if (file instanceof Blob) {
460
- blob = file;
473
+ attachment = file;
461
474
  }
462
475
  else {
463
476
  // Buffer / Uint8Array path — wrap in a Blob with the declared MIME.
@@ -466,26 +479,26 @@ export class PaneClient {
466
479
  // to `ArrayBuffer` specifically — the Blob constructor accepts only
467
480
  // the latter under @types/node ≥25 + TS ≥5.7's generic narrowing of
468
481
  // Uint8Array<TArrayBuffer>. `new Uint8Array(length)` returns
469
- // `Uint8Array<ArrayBuffer>` by construction, satisfying BlobPart
482
+ // `Uint8Array<ArrayBuffer>` by construction, satisfying AttachmentPart
470
483
  // without a type cast. The extra copy is one walk over the bytes —
471
484
  // negligible vs the network upload that follows.
472
485
  const src = file instanceof Uint8Array ? file : new Uint8Array(file);
473
486
  const u8 = new Uint8Array(src.byteLength);
474
487
  u8.set(src);
475
- blob = new Blob([u8], {
488
+ attachment = new Blob([u8], {
476
489
  type: opts.mime ?? "application/octet-stream",
477
490
  });
478
491
  }
479
- fd.set("file", blob, opts.filename ?? "blob");
492
+ fd.set("file", attachment, opts.filename ?? "attachment");
480
493
  if (opts.scope)
481
494
  fd.set("scope", opts.scope);
482
- if (opts.sessionId)
483
- fd.set("session_id", opts.sessionId);
484
- if (opts.artifactId)
485
- fd.set("artifact_id", opts.artifactId);
495
+ if (opts.surfaceId)
496
+ fd.set("surface_id", opts.surfaceId);
497
+ if (opts.templateId)
498
+ fd.set("template_id", opts.templateId);
486
499
  if (opts.filename)
487
500
  fd.set("filename", opts.filename);
488
- const url = this.base + "/v1/blobs";
501
+ const url = this.base + "/v1/attachments";
489
502
  let res;
490
503
  try {
491
504
  res = await this.fetchImpl(url, {
@@ -514,9 +527,9 @@ export class PaneClient {
514
527
  }
515
528
  return data;
516
529
  }
517
- /** GET /v1/blobs/:id — download bytes as an ArrayBuffer. */
518
- async downloadBlob(blobId) {
519
- const url = this.base + "/v1/blobs/" + encodeURIComponent(blobId);
530
+ /** GET /v1/attachments/:id — download bytes as an ArrayBuffer. */
531
+ async downloadBlob(attachmentId) {
532
+ const url = this.base + "/v1/attachments/" + encodeURIComponent(attachmentId);
520
533
  const res = await this.fetchImpl(url, {
521
534
  method: "GET",
522
535
  headers: {
@@ -538,43 +551,43 @@ export class PaneClient {
538
551
  return res.arrayBuffer();
539
552
  }
540
553
  /**
541
- * GET a blob's metadata only — useful before downloading large blobs, or
542
- * for `pane blob show <id>` which doesn't want the bytes. Returns the full
543
- * BlobRef (the same shape POST /v1/blobs returns): id, scope, mime, size,
554
+ * GET a attachment's metadata only — useful before downloading large attachments, or
555
+ * for `pane attachment show <id>` which doesn't want the bytes. Returns the full
556
+ * AttachmentRef (the same shape POST /v1/attachments returns): id, scope, mime, size,
544
557
  * sha256, filename, width, height, status, scope FKs, timestamps.
545
558
  *
546
- * Backed by GET /v1/blobs/:id/metadata which serves the JSON BlobRef
559
+ * Backed by GET /v1/attachments/:id/metadata which serves the JSON AttachmentRef
547
560
  * without streaming the bytes — cheap on the relay and avoids the
548
561
  * encrypt-at-rest decrypt cost when only the metadata is needed.
549
562
  */
550
- async getBlob(blobId) {
551
- const r = await this.call("GET", "/v1/blobs/" + encodeURIComponent(blobId) + "/metadata");
563
+ async getBlob(attachmentId) {
564
+ const r = await this.call("GET", "/v1/attachments/" + encodeURIComponent(attachmentId) + "/metadata");
552
565
  if (!r.ok)
553
566
  this.fail(r);
554
567
  return this.asObject(r);
555
568
  }
556
- /** DELETE /v1/blobs/:id — soft-delete (idempotent). */
557
- async deleteBlob(blobId) {
558
- const r = await this.call("DELETE", "/v1/blobs/" + encodeURIComponent(blobId));
569
+ /** DELETE /v1/attachments/:id — soft-delete (idempotent). */
570
+ async deleteBlob(attachmentId) {
571
+ const r = await this.call("DELETE", "/v1/attachments/" + encodeURIComponent(attachmentId));
559
572
  if (!r.ok)
560
573
  this.fail(r);
561
574
  return { deleted: true };
562
575
  }
563
576
  /**
564
- * Mint a `/b/<token>` capability URL for `blobId`. Default TTL is set by
565
- * the relay (24h agent, session-TTL session, 30d artifact). `once: true`
577
+ * Mint a `/b/<token>` capability URL for `attachmentId`. Default TTL is set by
578
+ * the relay (24h agent, surface-TTL surface, 30d template). `once: true`
566
579
  * tokens self-delete on first GET.
567
580
  */
568
- async mintBlobToken(blobId, opts = {}) {
569
- const r = await this.call("POST", "/v1/blobs/" + encodeURIComponent(blobId) + "/tokens", { ttl_seconds: opts.ttlSeconds, once: opts.once });
581
+ async mintBlobToken(attachmentId, opts = {}) {
582
+ const r = await this.call("POST", "/v1/attachments/" + encodeURIComponent(attachmentId) + "/tokens", { ttl_seconds: opts.ttlSeconds, once: opts.once });
570
583
  if (!r.ok)
571
584
  this.fail(r);
572
585
  return r.data;
573
586
  }
574
587
  /** Revoke a previously-minted token. Idempotent. */
575
- async revokeBlobToken(blobId, tokenId) {
576
- const r = await this.call("DELETE", "/v1/blobs/" +
577
- encodeURIComponent(blobId) +
588
+ async revokeBlobToken(attachmentId, tokenId) {
589
+ const r = await this.call("DELETE", "/v1/attachments/" +
590
+ encodeURIComponent(attachmentId) +
578
591
  "/tokens/" +
579
592
  encodeURIComponent(tokenId));
580
593
  if (!r.ok)
@@ -582,7 +595,7 @@ export class PaneClient {
582
595
  return r.data;
583
596
  }
584
597
  /**
585
- * GET /v1/blobs — list YOUR agent's non-deleted blobs (newest first).
598
+ * GET /v1/attachments — list YOUR agent's non-deleted attachments (newest first).
586
599
  * Paginated via opaque cursor: when `next_cursor` is non-null, pass it
587
600
  * back as `cursor` on the next call.
588
601
  */
@@ -593,39 +606,39 @@ export class PaneClient {
593
606
  if (opts.limit !== undefined)
594
607
  params.set("limit", String(opts.limit));
595
608
  const qs = params.toString();
596
- const r = await this.call("GET", "/v1/blobs" + (qs ? "?" + qs : ""));
609
+ const r = await this.call("GET", "/v1/attachments" + (qs ? "?" + qs : ""));
597
610
  if (!r.ok)
598
611
  this.fail(r);
599
612
  return r.data;
600
613
  }
601
614
  /**
602
- * GET /v1/blobs/:id/tokens — enumerate the capability tokens minted
603
- * against one blob, including revoked rows (for audit). The plaintext
615
+ * GET /v1/attachments/:id/tokens — enumerate the capability tokens minted
616
+ * against one attachment, including revoked rows (for audit). The plaintext
604
617
  * token is NEVER returned — it isn't stored, only its sha256 is.
605
618
  */
606
- async listBlobTokens(blobId) {
607
- const r = await this.call("GET", "/v1/blobs/" + encodeURIComponent(blobId) + "/tokens");
619
+ async listBlobTokens(attachmentId) {
620
+ const r = await this.call("GET", "/v1/attachments/" + encodeURIComponent(attachmentId) + "/tokens");
608
621
  if (!r.ok)
609
622
  this.fail(r);
610
623
  return r.data;
611
624
  }
612
625
  /**
613
626
  * Issue a presigned PUT URL for direct-to-storage upload. Returns the
614
- * upload URL + the blob_id (already reserved in the relay's DB with
627
+ * upload URL + the attachment_id (already reserved in the relay's DB with
615
628
  * status=pending) + expiry. After PUTting the bytes to the URL, call
616
- * `confirmBlob(blob_id)` to finalise.
629
+ * `confirmBlob(attachment_id)` to finalise.
617
630
  *
618
631
  * Filesystem backend returns 501 not_implemented — use uploadBlob()
619
632
  * (multipart fallback) instead. Azure backend returns a SAS URL.
620
633
  */
621
634
  async presignBlob(opts) {
622
- const r = await this.call("POST", "/v1/blobs/presign", {
635
+ const r = await this.call("POST", "/v1/attachments/presign", {
623
636
  mime: opts.mime,
624
637
  size: opts.size,
625
638
  sha256: opts.sha256,
626
639
  scope: opts.scope,
627
- session_id: opts.sessionId,
628
- artifact_id: opts.artifactId,
640
+ surface_id: opts.surfaceId,
641
+ template_id: opts.templateId,
629
642
  filename: opts.filename,
630
643
  });
631
644
  if (!r.ok)
@@ -633,8 +646,8 @@ export class PaneClient {
633
646
  return r.data;
634
647
  }
635
648
  /** Finalise a presigned upload — relay HEADs the bytes, verifies, flips ready. */
636
- async confirmBlob(blobId) {
637
- const r = await this.call("POST", "/v1/blobs/" + encodeURIComponent(blobId) + "/confirm");
649
+ async confirmBlob(attachmentId) {
650
+ const r = await this.call("POST", "/v1/attachments/" + encodeURIComponent(attachmentId) + "/confirm");
638
651
  if (!r.ok)
639
652
  this.fail(r);
640
653
  return r.data;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { PaneClient, PaneApiError } from "./client.js";
2
- export type { ClientOptions, RelayResponse, CreateArtifactRequest, CreateArtifactVersionRequest, PatchArtifactMetadataRequest, BlobRef, UploadBlobOptions, PresignBlobOptions, BlobTokenMintResponse, ListBlobsOptions, BlobTokenAuditEntry, BlobTokenListResponse, } from "./client.js";
2
+ export type { ClientOptions, RelayResponse, CreateArtifactRequest, CreateArtifactVersionRequest, PatchArtifactMetadataRequest, AttachmentRef, UploadBlobOptions, PresignBlobOptions, AttachmentTokenMintResponse, ListBlobsOptions, AttachmentTokenAuditEntry, AttachmentTokenListResponse, } from "./client.js";
3
3
  export { openStream } from "./stream.js";
4
4
  export type { OpenStreamOptions, StreamHandlers, StreamHandle, } from "./stream.js";
5
5
  export { registerAgent } from "./register.js";
@@ -7,4 +7,4 @@ export type { RegisterAgentOptions, RegisterAgentResult } from "./register.js";
7
7
  export { artifactSchema, callbackSchema, createSessionSchema, artifactTypeSchema, createArtifactSchema, createArtifactVersionSchema, patchArtifactMetadataSchema, feedbackTypeSchema, submitFeedbackSchema, listSessionsStatusSchema, listSessionsQuerySchema, mintParticipantSchema, } from "./schemas.js";
8
8
  export type { CreateSessionInput, ListSessionsStatus, ListSessionsQuery, MintParticipantInput, } from "./schemas.js";
9
9
  export { MAX_EVENT_TYPE_LENGTH, MAX_IDEMPOTENCY_KEY_LENGTH, MAX_RESPONSE_SNIPPET_LENGTH, MAX_FRAME_SNIPPET_LENGTH, } from "./limits.js";
10
- export type { AuthorKind, PaneEvent, Artifact, ArtifactType, ArtifactVersion, ArtifactRecord, ArtifactSummary, CreateArtifactResponse, KeyInfo, TasteInfo, FeedbackType, FeedbackSubmission, FeedbackRecord, FeedbackPage, Callback, CreateSessionRequest, CreateSessionResponse, SessionState, EventsPage, ParticipantSummary, ParticipantsList, SessionSummary, SessionsPage, MintParticipantResponse, RelayError, } from "./types.js";
10
+ export type { AuthorKind, PaneEvent, Template, TemplateType, TemplateVersion, TemplateRecord, TemplateSummary, CreateArtifactResponse, KeyInfo, TasteInfo, FeedbackType, FeedbackSubmission, FeedbackRecord, FeedbackPage, Callback, CreateSessionRequest, CreateSessionResponse, SurfaceState, EventsPage, ParticipantSummary, ParticipantsList, SurfaceSummary, SurfacesPage, MintParticipantResponse, RelayError, } from "./types.js";
package/dist/schemas.d.ts CHANGED
@@ -16,7 +16,7 @@ export declare const callbackSchema: z.ZodObject<{
16
16
  secret: z.ZodString;
17
17
  }, z.core.$strip>;
18
18
  export declare const createSessionSchema: z.ZodObject<{
19
- artifact: z.ZodUnion<readonly [z.ZodObject<{
19
+ template: z.ZodUnion<readonly [z.ZodObject<{
20
20
  id: z.ZodString;
21
21
  version: z.ZodOptional<z.ZodNumber>;
22
22
  }, z.core.$strip>, z.ZodObject<{
@@ -40,6 +40,7 @@ export declare const createSessionSchema: z.ZodObject<{
40
40
  secret: z.ZodString;
41
41
  }, z.core.$strip>>;
42
42
  title: z.ZodOptional<z.ZodString>;
43
+ context_key: z.ZodOptional<z.ZodString>;
43
44
  }, z.core.$strip>;
44
45
  export declare const createArtifactSchema: z.ZodObject<{
45
46
  name: z.ZodString;
@@ -81,7 +82,7 @@ export declare const submitFeedbackSchema: z.ZodObject<{
81
82
  note: "note";
82
83
  }>;
83
84
  message: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
84
- session_id: z.ZodOptional<z.ZodString>;
85
+ surface_id: z.ZodOptional<z.ZodString>;
85
86
  }, z.core.$strip>;
86
87
  /** @deprecated use `CreateSessionRequest` from ./types.js (same type). */
87
88
  export type CreateSessionInput = z.infer<typeof createSessionSchema>;
@@ -99,7 +100,7 @@ export declare const listSessionsQuerySchema: z.ZodObject<{
99
100
  }>>;
100
101
  limit: z.ZodOptional<z.ZodNumber>;
101
102
  cursor: z.ZodOptional<z.ZodString>;
102
- artifact_id: z.ZodOptional<z.ZodString>;
103
+ template_id: z.ZodOptional<z.ZodString>;
103
104
  }, z.core.$strip>;
104
105
  export type ListSessionsQuery = z.infer<typeof listSessionsQuerySchema>;
105
106
  export declare const mintParticipantSchema: z.ZodObject<{