@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.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ArtifactRecord, ArtifactSummary, ArtifactType, ArtifactVersion, CreateArtifactResponse, CreateSessionRequest, CreateSessionResponse, EventsPage, FeedbackPage, FeedbackSubmission, FeedbackType, KeyInfo, MintParticipantResponse, PaneEvent, ParticipantsList, SessionState, SessionsPage, TasteInfo } from "./types.js";
1
+ import type { TemplateRecord, TemplateSummary, TemplateType, TemplateVersion, CreateArtifactResponse, CreateSessionRequest, CreateSessionResponse, EventsPage, FeedbackPage, FeedbackSubmission, FeedbackType, KeyInfo, MintParticipantResponse, PaneEvent, ParticipantsList, SurfaceState, SurfacesPage, TasteInfo } from "./types.js";
2
2
  import type { ListSessionsQuery } from "./schemas.js";
3
3
  export interface ClientOptions {
4
4
  /** Relay base URL, e.g. https://pane.example.com. Trailing slash is trimmed. */
@@ -24,7 +24,7 @@ export interface RelayResponse {
24
24
  data: unknown;
25
25
  }
26
26
  /**
27
- * Request body for POST /v1/artifacts — create a named, reusable artifact plus
27
+ * Request body for POST /v1/templates — create a named, reusable template plus
28
28
  * its v1 content. Mirrors `createArtifactSchema` from ./schemas.js.
29
29
  */
30
30
  export interface CreateArtifactRequest {
@@ -33,22 +33,22 @@ export interface CreateArtifactRequest {
33
33
  description?: string;
34
34
  tags?: string[];
35
35
  source: string;
36
- type: ArtifactType;
36
+ type: TemplateType;
37
37
  event_schema?: unknown;
38
38
  input_schema?: Record<string, unknown>;
39
39
  }
40
40
  /**
41
- * Request body for POST /v1/artifacts/:id/versions — append a new immutable
41
+ * Request body for POST /v1/templates/:id/versions — append a new immutable
42
42
  * version (content only). Mirrors `createArtifactVersionSchema`.
43
43
  */
44
44
  export interface CreateArtifactVersionRequest {
45
45
  source: string;
46
- type: ArtifactType;
46
+ type: TemplateType;
47
47
  event_schema?: unknown;
48
48
  input_schema?: Record<string, unknown>;
49
49
  }
50
50
  /**
51
- * Request body for PATCH /v1/artifacts/:id — head metadata only (never
51
+ * Request body for PATCH /v1/templates/:id — head metadata only (never
52
52
  * content). Mirrors `patchArtifactMetadataSchema`.
53
53
  */
54
54
  export interface PatchArtifactMetadataRequest {
@@ -98,21 +98,21 @@ export declare class PaneClient {
98
98
  private asObject;
99
99
  /** Throw a PaneApiError from a failed RelayResponse. */
100
100
  private fail;
101
- /** POST /v1/sessions — create a session. */
101
+ /** POST /v1/surfaces — create a surface. */
102
102
  createSession(req: CreateSessionRequest): Promise<CreateSessionResponse>;
103
- /** GET /v1/sessions/:id — non-blocking session metadata. */
104
- getSession(sessionId: string): Promise<SessionState>;
103
+ /** GET /v1/surfaces/:id — non-blocking surface metadata. */
104
+ getSession(surfaceId: string): Promise<SurfaceState>;
105
105
  /**
106
- * GET /v1/sessions/:id/events — fetch the event log.
106
+ * GET /v1/surfaces/:id/events — fetch the event log.
107
107
  * `since` is an opaque cursor; `waitSeconds` enables the relay long-poll
108
108
  * (0 = non-blocking, capped at 30 by the relay).
109
109
  */
110
- getEvents(sessionId: string, opts?: {
110
+ getEvents(surfaceId: string, opts?: {
111
111
  since?: string | null;
112
112
  waitSeconds?: number;
113
113
  }): Promise<EventsPage>;
114
- /** POST /v1/sessions/:id/events — append an agent event. */
115
- sendEvent(sessionId: string, ev: {
114
+ /** POST /v1/surfaces/:id/events — append an agent event. */
115
+ sendEvent(surfaceId: string, ev: {
116
116
  type: string;
117
117
  data: unknown;
118
118
  causationId?: string;
@@ -122,37 +122,37 @@ export declare class PaneClient {
122
122
  deduped: boolean;
123
123
  }>;
124
124
  /**
125
- * POST /v1/artifacts — create a named, reusable artifact and its v1 content.
126
- * Returns the new `artifact_id` and `version` (1).
125
+ * POST /v1/templates — create a named, reusable template and its v1 content.
126
+ * Returns the new `template_id` and `version` (1).
127
127
  */
128
128
  createArtifact(req: CreateArtifactRequest): Promise<CreateArtifactResponse>;
129
129
  /**
130
- * POST /v1/artifacts/:id/versions — append a new immutable version to an
131
- * existing artifact. `idOrSlug` accepts the artifact id or its slug.
130
+ * POST /v1/templates/:id/versions — append a new immutable version to an
131
+ * existing template. `idOrSlug` accepts the template id or its slug.
132
132
  * Returns the new `version` number.
133
133
  */
134
134
  createArtifactVersion(idOrSlug: string, req: CreateArtifactVersionRequest): Promise<CreateArtifactResponse>;
135
135
  /**
136
- * PATCH /v1/artifacts/:id — update head metadata (name / slug / description /
136
+ * PATCH /v1/templates/:id — update head metadata (name / slug / description /
137
137
  * tags); never the content. Returns the updated lean summary.
138
138
  */
139
- updateArtifact(idOrSlug: string, metadata: PatchArtifactMetadataRequest): Promise<ArtifactSummary>;
139
+ updateArtifact(idOrSlug: string, metadata: PatchArtifactMetadataRequest): Promise<TemplateSummary>;
140
140
  /**
141
- * GET /v1/artifacts?q=... — search/list the agent's named artifacts. The
142
- * response is lean (no `source` blob), ranked by `last_used_at`. Omit `query`
143
- * to list every named artifact.
141
+ * GET /v1/templates?q=... — search/list the agent's named templates. The
142
+ * response is lean (no `source` attachment), ranked by `last_used_at`. Omit `query`
143
+ * to list every named template.
144
144
  */
145
- searchArtifacts(query?: string): Promise<ArtifactSummary[]>;
145
+ searchArtifacts(query?: string): Promise<TemplateSummary[]>;
146
146
  /**
147
- * GET /v1/artifacts/:id — fetch a full artifact (head metadata + version
148
- * list). `idOrSlug` accepts the artifact id or its slug.
147
+ * GET /v1/templates/:id — fetch a full template (head metadata + version
148
+ * list). `idOrSlug` accepts the template id or its slug.
149
149
  */
150
- getArtifact(idOrSlug: string): Promise<ArtifactRecord>;
150
+ getArtifact(idOrSlug: string): Promise<TemplateRecord>;
151
151
  /**
152
- * GET /v1/artifacts/:id/versions/:version — fetch one version's full
152
+ * GET /v1/templates/:id/versions/:version — fetch one version's full
153
153
  * content (HTML, event schema, input schema).
154
154
  */
155
- getArtifactVersion(idOrSlug: string, version: number): Promise<ArtifactVersion>;
155
+ getArtifactVersion(idOrSlug: string, version: number): Promise<TemplateVersion>;
156
156
  /**
157
157
  * GET /v1/keys — the calling agent's own key info. The relay scopes this to
158
158
  * the authenticated agent: it returns one key (the caller's), not a list.
@@ -165,15 +165,27 @@ export declare class PaneClient {
165
165
  */
166
166
  revokeKey(id: string): Promise<void>;
167
167
  /**
168
- * GET /v1/tastethe calling agent's freeform "taste notes" markdown blob:
168
+ * POST /v1/agents/claimbind this agent to a human via a one-shot
169
+ * claim code the human generated in their settings UI. After a
170
+ * successful claim the agent's existing API key continues to work,
171
+ * but the agent (and its surfaces/templates) now belong to the
172
+ * claiming human. One-way operation — there is no unclaim in v1.
173
+ */
174
+ claimAgent(code: string): Promise<{
175
+ ok: true;
176
+ owner_human_id: string;
177
+ claimed_at: string;
178
+ }>;
179
+ /**
180
+ * GET /v1/taste — the calling agent's freeform "taste notes" markdown attachment:
169
181
  * presentation preferences the agent has picked up from human feedback over
170
182
  * time. Returns `{ taste: null, updated_at: null, bytes: 0 }` when the
171
- * agent has never written notes. Read this before generating an artifact so
183
+ * agent has never written notes. Read this before generating an template so
172
184
  * the agent applies prior feedback.
173
185
  */
174
186
  getTaste(): Promise<TasteInfo>;
175
187
  /**
176
- * PUT /v1/taste — whole-blob replace of the calling agent's taste notes.
188
+ * PUT /v1/taste — whole-attachment replace of the calling agent's taste notes.
177
189
  * Empty/whitespace-only values are rejected by the relay; callers asking to
178
190
  * clear must use {@link clearTaste}. The relay caps the payload at the
179
191
  * server's `MAX_TASTE_BYTES` (utf8 bytes).
@@ -193,7 +205,7 @@ export declare class PaneClient {
193
205
  submitFeedback(req: {
194
206
  type: FeedbackType;
195
207
  message: string;
196
- sessionId?: string;
208
+ surfaceId?: string;
197
209
  }): Promise<FeedbackSubmission>;
198
210
  /**
199
211
  * GET /v1/feedback — the calling agent's own submissions, newest first.
@@ -204,38 +216,38 @@ export declare class PaneClient {
204
216
  before?: string;
205
217
  }): Promise<FeedbackPage>;
206
218
  /**
207
- * GET /v1/sessions — list the calling agent's sessions. Default filter is
219
+ * GET /v1/surfaces — list the calling agent's surfaces. Default filter is
208
220
  * `status=open` (effective status — respects expiresAt). Response items
209
221
  * carry NO secrets: no participant token plaintext, no callback URL, no
210
222
  * metadata or input_data. Use `participant_id` from the list as the handle
211
223
  * for {@link revokeParticipant}; use {@link mintParticipant} to issue a
212
224
  * fresh URL when the original was lost.
213
225
  */
214
- listSessions(opts?: ListSessionsQuery): Promise<SessionsPage>;
226
+ listSessions(opts?: ListSessionsQuery): Promise<SurfacesPage>;
215
227
  /**
216
- * GET /v1/sessions/:id/participants — list every participant on one
217
- * session (active and revoked). Bounded by MAX_PARTICIPANTS_PER_SESSION
228
+ * GET /v1/surfaces/:id/participants — list every participant on one
229
+ * surface (active and revoked). Bounded by MAX_PARTICIPANTS_PER_SESSION
218
230
  * on the relay, so the full list is returned with no pagination.
219
231
  * Use this to find the `participant_id` you need to pass to
220
232
  * {@link revokeParticipant}, or to audit revoked rows.
221
233
  */
222
- listParticipants(sessionId: string): Promise<ParticipantsList>;
234
+ listParticipants(surfaceId: string): Promise<ParticipantsList>;
223
235
  /**
224
- * POST /v1/sessions/:id/participants — mint a fresh participant URL for an
225
- * existing session. The one-shot recovery primitive when the original URL
226
- * was dropped: the session keeps its event log, artifact pin, and created_at.
236
+ * POST /v1/surfaces/:id/participants — mint a fresh participant URL for an
237
+ * existing surface. The one-shot recovery primitive when the original URL
238
+ * was dropped: the surface keeps its event log, template pin, and created_at.
227
239
  * v1 supports `kind: "human"` only.
228
240
  *
229
241
  * The plaintext token is returned EXACTLY ONCE in the response — the relay
230
242
  * stores only the hash. Save the response (e.g. pipe to a JSONL log) before
231
243
  * delivering the URL to the human.
232
244
  */
233
- mintParticipant(sessionId: string, opts?: {
245
+ mintParticipant(surfaceId: string, opts?: {
234
246
  kind?: "human";
235
247
  }): Promise<MintParticipantResponse>;
236
248
  /**
237
- * DELETE /v1/sessions/:id/participants/:participant_id — revoke a single
238
- * participant URL. The session's other participants (and the agent's own
249
+ * DELETE /v1/surfaces/:id/participants/:participant_id — revoke a single
250
+ * participant URL. The surface's other participants (and the agent's own
239
251
  * WebSocket) are untouched. Idempotent: revoking an unknown or already-
240
252
  * revoked participant returns 204. The agent participant cannot be revoked
241
253
  * via this endpoint — use {@link deleteSession} instead.
@@ -243,106 +255,106 @@ export declare class PaneClient {
243
255
  * Existing WebSocket connections held under the revoked token are NOT
244
256
  * actively kicked in v1; new HTTP and WS connections are refused.
245
257
  */
246
- revokeParticipant(sessionId: string, participantId: string): Promise<void>;
258
+ revokeParticipant(surfaceId: string, participantId: string): Promise<void>;
247
259
  /**
248
- * DELETE /v1/sessions/:id — close/delete a session. Idempotent on the relay
249
- * side (an already-closed session still returns 204 with no body).
260
+ * DELETE /v1/surfaces/:id — close/delete a surface. Idempotent on the relay
261
+ * side (an already-closed surface still returns 204 with no body).
250
262
  */
251
263
  deleteSession(id: string): Promise<void>;
252
264
  /**
253
- * DELETE /v1/artifacts/:id — remove an artifact and (server-side) all its
265
+ * DELETE /v1/templates/:id — remove an template and (server-side) all its
254
266
  * versions. Strict cascade: the relay refuses with 409 conflict if any
255
- * session in any state still references one of the artifact's versions —
267
+ * surface in any state still references one of the template's versions —
256
268
  * surface that as a typed PaneApiError so the CLI can render a hint
257
269
  * instead of swallowing it.
258
270
  */
259
271
  deleteArtifact(idOrSlug: string): Promise<void>;
260
272
  /**
261
- * Upload a blob to the relay. Returns a `BlobRef` that can be referenced
262
- * in event payloads (the relay's `format: pane-blob-id` schema vocab
273
+ * Upload a attachment to the relay. Returns a `AttachmentRef` that can be referenced
274
+ * in event payloads (the relay's `format: pane-attachment-id` schema vocab
263
275
  * validates the id) or in `pane create --input-data`.
264
276
  *
265
- * Scope defaults to "agent" (reusable across the agent's sessions). For
266
- * `scope: "session"` pass `sessionId`; for `scope: "artifact"` pass
267
- * `artifactId`. The agent must own the referenced session / artifact;
268
- * cross-tenant attempts return blob_not_found.
277
+ * Scope defaults to "agent" (reusable across the agent's surfaces). For
278
+ * `scope: "surface"` pass `surfaceId`; for `scope: "template"` pass
279
+ * `templateId`. The agent must own the referenced surface / template;
280
+ * cross-tenant attempts return attachment_not_found.
269
281
  *
270
282
  * MIME is inferred from `mime` if supplied; otherwise the relay sniffs
271
283
  * leading bytes and may reject with mime_mismatch / mime_disallowed.
272
284
  *
273
- * Backed by the relay's multipart `POST /v1/blobs` (the fallback path).
285
+ * Backed by the relay's multipart `POST /v1/attachments` (the fallback path).
274
286
  * For large uploads (>1 MB on hosted Azure) call `presignBlob()` +
275
287
  * `confirmBlob()` instead — those use SAS direct-to-storage and don't
276
288
  * stream bytes through the relay.
277
289
  */
278
- uploadBlob(file: Blob | Buffer | Uint8Array, opts?: UploadBlobOptions): Promise<BlobRef>;
279
- /** GET /v1/blobs/:id — download bytes as an ArrayBuffer. */
280
- downloadBlob(blobId: string): Promise<ArrayBuffer>;
290
+ uploadBlob(file: Blob | Buffer | Uint8Array, opts?: UploadBlobOptions): Promise<AttachmentRef>;
291
+ /** GET /v1/attachments/:id — download bytes as an ArrayBuffer. */
292
+ downloadBlob(attachmentId: string): Promise<ArrayBuffer>;
281
293
  /**
282
- * GET a blob's metadata only — useful before downloading large blobs, or
283
- * for `pane blob show <id>` which doesn't want the bytes. Returns the full
284
- * BlobRef (the same shape POST /v1/blobs returns): id, scope, mime, size,
294
+ * GET a attachment's metadata only — useful before downloading large attachments, or
295
+ * for `pane attachment show <id>` which doesn't want the bytes. Returns the full
296
+ * AttachmentRef (the same shape POST /v1/attachments returns): id, scope, mime, size,
285
297
  * sha256, filename, width, height, status, scope FKs, timestamps.
286
298
  *
287
- * Backed by GET /v1/blobs/:id/metadata which serves the JSON BlobRef
299
+ * Backed by GET /v1/attachments/:id/metadata which serves the JSON AttachmentRef
288
300
  * without streaming the bytes — cheap on the relay and avoids the
289
301
  * encrypt-at-rest decrypt cost when only the metadata is needed.
290
302
  */
291
- getBlob(blobId: string): Promise<BlobRef>;
292
- /** DELETE /v1/blobs/:id — soft-delete (idempotent). */
293
- deleteBlob(blobId: string): Promise<{
303
+ getBlob(attachmentId: string): Promise<AttachmentRef>;
304
+ /** DELETE /v1/attachments/:id — soft-delete (idempotent). */
305
+ deleteBlob(attachmentId: string): Promise<{
294
306
  deleted: true;
295
307
  }>;
296
308
  /**
297
- * Mint a `/b/<token>` capability URL for `blobId`. Default TTL is set by
298
- * the relay (24h agent, session-TTL session, 30d artifact). `once: true`
309
+ * Mint a `/b/<token>` capability URL for `attachmentId`. Default TTL is set by
310
+ * the relay (24h agent, surface-TTL surface, 30d template). `once: true`
299
311
  * tokens self-delete on first GET.
300
312
  */
301
- mintBlobToken(blobId: string, opts?: {
313
+ mintBlobToken(attachmentId: string, opts?: {
302
314
  ttlSeconds?: number;
303
315
  once?: boolean;
304
- }): Promise<BlobTokenMintResponse>;
316
+ }): Promise<AttachmentTokenMintResponse>;
305
317
  /** Revoke a previously-minted token. Idempotent. */
306
- revokeBlobToken(blobId: string, tokenId: string): Promise<{
318
+ revokeBlobToken(attachmentId: string, tokenId: string): Promise<{
307
319
  token_id: string;
308
320
  revoked: true;
309
321
  }>;
310
322
  /**
311
- * GET /v1/blobs — list YOUR agent's non-deleted blobs (newest first).
323
+ * GET /v1/attachments — list YOUR agent's non-deleted attachments (newest first).
312
324
  * Paginated via opaque cursor: when `next_cursor` is non-null, pass it
313
325
  * back as `cursor` on the next call.
314
326
  */
315
327
  listBlobs(opts?: ListBlobsOptions): Promise<{
316
- items: BlobRef[];
328
+ items: AttachmentRef[];
317
329
  next_cursor: string | null;
318
330
  }>;
319
331
  /**
320
- * GET /v1/blobs/:id/tokens — enumerate the capability tokens minted
321
- * against one blob, including revoked rows (for audit). The plaintext
332
+ * GET /v1/attachments/:id/tokens — enumerate the capability tokens minted
333
+ * against one attachment, including revoked rows (for audit). The plaintext
322
334
  * token is NEVER returned — it isn't stored, only its sha256 is.
323
335
  */
324
- listBlobTokens(blobId: string): Promise<BlobTokenListResponse>;
336
+ listBlobTokens(attachmentId: string): Promise<AttachmentTokenListResponse>;
325
337
  /**
326
338
  * Issue a presigned PUT URL for direct-to-storage upload. Returns the
327
- * upload URL + the blob_id (already reserved in the relay's DB with
339
+ * upload URL + the attachment_id (already reserved in the relay's DB with
328
340
  * status=pending) + expiry. After PUTting the bytes to the URL, call
329
- * `confirmBlob(blob_id)` to finalise.
341
+ * `confirmBlob(attachment_id)` to finalise.
330
342
  *
331
343
  * Filesystem backend returns 501 not_implemented — use uploadBlob()
332
344
  * (multipart fallback) instead. Azure backend returns a SAS URL.
333
345
  */
334
346
  presignBlob(opts: PresignBlobOptions): Promise<{
335
- blob_id: string;
347
+ attachment_id: string;
336
348
  upload_url: string;
337
349
  expires_at: string;
338
350
  }>;
339
351
  /** Finalise a presigned upload — relay HEADs the bytes, verifies, flips ready. */
340
- confirmBlob(blobId: string): Promise<BlobRef>;
352
+ confirmBlob(attachmentId: string): Promise<AttachmentRef>;
341
353
  }
342
- /** Per-blob metadata as returned by `POST /v1/blobs` and friends. */
343
- export interface BlobRef {
344
- blob_id: string;
345
- scope: "agent" | "session" | "artifact";
354
+ /** Per-attachment metadata as returned by `POST /v1/attachments` and friends. */
355
+ export interface AttachmentRef {
356
+ attachment_id: string;
357
+ scope: "agent" | "surface" | "template";
346
358
  mime: string;
347
359
  size: number;
348
360
  sha256: string;
@@ -351,16 +363,16 @@ export interface BlobRef {
351
363
  height?: number | null;
352
364
  filename?: string | null;
353
365
  status?: string;
354
- session_id?: string | null;
355
- artifact_id?: string | null;
366
+ surface_id?: string | null;
367
+ template_id?: string | null;
356
368
  created_at?: string;
357
369
  confirmed_at?: string | null;
358
370
  deleted_at?: string | null;
359
371
  }
360
372
  export interface UploadBlobOptions {
361
- scope?: "agent" | "session" | "artifact";
362
- sessionId?: string;
363
- artifactId?: string;
373
+ scope?: "agent" | "surface" | "template";
374
+ surfaceId?: string;
375
+ templateId?: string;
364
376
  /** Declared Content-Type. Defaults to `application/octet-stream`. The
365
377
  * relay sniffs leading bytes and may reject with `mime_mismatch`. */
366
378
  mime?: string;
@@ -371,12 +383,12 @@ export interface PresignBlobOptions {
371
383
  mime: string;
372
384
  size: number;
373
385
  sha256: string;
374
- scope?: "agent" | "session" | "artifact";
375
- sessionId?: string;
376
- artifactId?: string;
386
+ scope?: "agent" | "surface" | "template";
387
+ surfaceId?: string;
388
+ templateId?: string;
377
389
  filename?: string;
378
390
  }
379
- export interface BlobTokenMintResponse {
391
+ export interface AttachmentTokenMintResponse {
380
392
  token_id: string;
381
393
  token: string;
382
394
  token_prefix: string;
@@ -392,7 +404,7 @@ export interface ListBlobsOptions {
392
404
  limit?: number;
393
405
  }
394
406
  /** One row in the response from `listBlobTokens()`. */
395
- export interface BlobTokenAuditEntry {
407
+ export interface AttachmentTokenAuditEntry {
396
408
  token_id: string;
397
409
  token_prefix: string;
398
410
  expires_at: string;
@@ -406,7 +418,7 @@ export interface BlobTokenAuditEntry {
406
418
  revoked_at: string | null;
407
419
  }
408
420
  /** Shape returned by `listBlobTokens()`. */
409
- export interface BlobTokenListResponse {
410
- blob_id: string;
411
- items: BlobTokenAuditEntry[];
421
+ export interface AttachmentTokenListResponse {
422
+ attachment_id: string;
423
+ items: AttachmentTokenAuditEntry[];
412
424
  }