palbase 0.64.0 → 0.66.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.
Files changed (76) hide show
  1. package/dist/ai/index.js +2 -2
  2. package/dist/ai-sdk/index.js +4 -0
  3. package/dist/backend/engine.js +2 -2
  4. package/dist/backend/env.js +1 -1
  5. package/dist/backend/index.js +3 -3
  6. package/dist/backend/stack.js +1 -1
  7. package/dist/backend/test.js +2 -2
  8. package/dist/chunks/{ZO7BWXF3.js → 243727GR.js} +2 -2
  9. package/dist/chunks/{KRYGPGVB.js → 2DGYQO2K.js} +2 -2
  10. package/dist/chunks/{U6S2T2FE.js → 47OT2TAE.js} +2 -2
  11. package/dist/chunks/{ZZLCBUNM.js → 4DOKNJUJ.js} +2 -2
  12. package/dist/chunks/{TTDCC4FL.js → 7JAVCOPA.js} +1 -1
  13. package/dist/chunks/{7WLAMFND.js → FFRCUMXB.js} +2 -2
  14. package/dist/chunks/GS7AQ2KQ.js +2 -0
  15. package/dist/chunks/GVC6OZMF.js +13 -0
  16. package/dist/chunks/{2FPPZ3A3.js → GYB7XBYV.js} +2 -2
  17. package/dist/chunks/{TNY6UGJZ.js → HECZUS65.js} +2 -2
  18. package/dist/chunks/{B6FEEB5R.js → L5DVXXH3.js} +1 -1
  19. package/dist/chunks/{AUCNHNPD.js → MTOW4UUP.js} +2 -2
  20. package/dist/chunks/PQ23MXWT.js +18 -0
  21. package/dist/chunks/{XDGXREXS.js → PZXACOXA.js} +1 -1
  22. package/dist/chunks/{D2Z5R7ZP.js → QKAKVJLA.js} +1 -1
  23. package/dist/chunks/{MVHF5I2L.js → QT7PHIRR.js} +2 -2
  24. package/dist/chunks/{RCV4YOM6.js → REON7CA7.js} +1 -1
  25. package/dist/chunks/UZERPL37.js +2 -0
  26. package/dist/chunks/V7X2RHTR.js +21 -0
  27. package/dist/chunks/{MUHCCKSS.js → YO7F2OI2.js} +1 -1
  28. package/dist/chunks/ZA5NYGQH.js +22 -0
  29. package/dist/chunks/{XIHO4HVO.js → ZV6WG4DE.js} +1 -1
  30. package/dist/chunks/ZY6P5WKM.js +2 -0
  31. package/dist/cli.js +356 -371
  32. package/dist/cloud/index.js +2 -2
  33. package/dist/refuse/ai-sdk.js +2 -0
  34. package/dist/refuse/ai.js +1 -1
  35. package/dist/refuse/backend.js +1 -1
  36. package/dist/refuse/cloud.js +1 -1
  37. package/dist/refuse/server.js +1 -1
  38. package/dist/server/index.js +2 -2
  39. package/dist/server/testing.js +2 -2
  40. package/dist/web/index.js +2 -2
  41. package/dist/web/message.js +2 -2
  42. package/dist/web/palbe.js +2 -2
  43. package/dist/web/paywall.js +2 -2
  44. package/dist/web/push-sw.js +1 -1
  45. package/dist/web/ssr.js +2 -2
  46. package/dist/web/vite.js +4 -3
  47. package/package.json +14 -2
  48. package/types/ai/src/ai.d.ts +55 -29
  49. package/types/ai/src/chats.d.ts +163 -171
  50. package/types/ai/src/index.d.ts +5 -5
  51. package/types/ai/src/pools.d.ts +17 -7
  52. package/types/ai/src/tools.d.ts +6 -64
  53. package/types/ai-sdk/src/index.d.ts +166 -0
  54. package/types/backend/src/decorators.d.ts +2 -1
  55. package/types/backend/src/services.d.ts +2 -2
  56. package/types/backend/src/stack.d.ts +2 -4
  57. package/types/backend/src/upload.d.ts +2 -1
  58. package/types/cloud/src/generated/project.d.ts +2 -1
  59. package/types/internal/src/chat.d.ts +56 -2
  60. package/types/internal/src/modules/ai.d.ts +960 -1140
  61. package/types/internal/src/modules/events.d.ts +4 -3
  62. package/types/internal/src/modules/index.d.ts +1 -0
  63. package/types/internal/src/modules/storage.d.ts +1 -1
  64. package/types/internal/src/modules/workspaces.d.ts +626 -0
  65. package/types/server/src/server.d.ts +5 -0
  66. package/types/web/src/chat.d.ts +30 -4
  67. package/types/web/src/client.d.ts +7 -7
  68. package/types/web/src/index.d.ts +2 -1
  69. package/types/web/src/vite.d.ts +8 -0
  70. package/dist/chunks/47YRZOKH.js +0 -2
  71. package/dist/chunks/73CKSYD7.js +0 -21
  72. package/dist/chunks/HWDOVTN4.js +0 -22
  73. package/dist/chunks/K4E27V7K.js +0 -2
  74. package/dist/chunks/QDAQJXBR.js +0 -18
  75. package/dist/chunks/SKPSBDXT.js +0 -2
  76. package/dist/chunks/UAD4XPIB.js +0 -13
@@ -0,0 +1,626 @@
1
+ import { type Reply, type Transport } from '../transport.js';
2
+ export type ErrorResponse = {
3
+ error: string;
4
+ error_description: string;
5
+ status: number;
6
+ request_id?: string;
7
+ };
8
+ export type AttachedErrorResponse = {
9
+ error: string;
10
+ error_description: string;
11
+ status: number;
12
+ attachments: Attachment[];
13
+ };
14
+ export type LockHeldErrorResponse = {
15
+ error: string;
16
+ error_description: string;
17
+ status: number;
18
+ holder: string;
19
+ expires_at: string;
20
+ };
21
+ export type MissingBlobsErrorResponse = {
22
+ error: string;
23
+ error_description: string;
24
+ missing: string[];
25
+ };
26
+ export type Attachment = {
27
+ owner_module: string;
28
+ owner_id: string;
29
+ owner_name?: string;
30
+ attached_at: string;
31
+ };
32
+ export type StorageSummary = {
33
+ kind: "managed" | "byos";
34
+ endpoint?: string;
35
+ region?: string;
36
+ bucket?: string;
37
+ prefix?: string;
38
+ access_key_preview?: string;
39
+ force_path_style?: boolean;
40
+ presign_endpoint?: string;
41
+ };
42
+ export type WorkspaceStorageInput = {
43
+ kind?: "managed" | "byos";
44
+ endpoint?: string;
45
+ region?: string;
46
+ bucket?: string;
47
+ prefix?: string;
48
+ access_key_id?: string;
49
+ secret_access_key?: string;
50
+ force_path_style?: boolean;
51
+ presign_endpoint?: string;
52
+ };
53
+ export type TestBYOSResponse = {
54
+ ok: boolean;
55
+ latency_ms: number;
56
+ };
57
+ export type Workspace = {
58
+ id: string;
59
+ name: string;
60
+ storage_kind: "managed" | "byos";
61
+ storage?: StorageSummary;
62
+ seq: number;
63
+ manifest_id: string;
64
+ tree_checksum: string;
65
+ total_files: number;
66
+ total_bytes: number;
67
+ created_by?: string;
68
+ created_at: string;
69
+ updated_at: string;
70
+ };
71
+ export type WorkspaceListResponse = {
72
+ workspaces: Workspace[];
73
+ };
74
+ export type CreateWorkspaceRequest = {
75
+ name?: string;
76
+ storage?: WorkspaceStorageInput;
77
+ };
78
+ export type ChunkSpec = {
79
+ index: number;
80
+ digest: string;
81
+ size: number;
82
+ };
83
+ export type FileEntry = {
84
+ path: string;
85
+ kind: "file" | "symlink";
86
+ digest: string;
87
+ size: number;
88
+ mode: number;
89
+ link_target?: string;
90
+ chunks?: ChunkSpec[];
91
+ updated_seq?: number;
92
+ };
93
+ export type FileInfo = {
94
+ path: string;
95
+ kind: "file" | "symlink";
96
+ digest: string;
97
+ md5?: string;
98
+ size: number;
99
+ mode: number;
100
+ link_target?: string;
101
+ content_type: string;
102
+ chunks?: ChunkSpec[];
103
+ updated_seq: number;
104
+ updated_at: string;
105
+ };
106
+ export type HeadResponse = {
107
+ workspace_id: string;
108
+ seq: number;
109
+ manifest_id: string;
110
+ tree_checksum: string;
111
+ total_files: number;
112
+ total_bytes: number;
113
+ files?: FileEntry[];
114
+ };
115
+ export type TokenInfo = {
116
+ id: string;
117
+ workspace_id?: string;
118
+ kind: "sync" | "s3";
119
+ access: "rw" | "ro";
120
+ label?: string;
121
+ access_key_id?: string;
122
+ created_by?: string;
123
+ expires_at?: string;
124
+ created_at: string;
125
+ };
126
+ export type TokenListResponse = {
127
+ tokens: TokenInfo[];
128
+ };
129
+ export type S3KeyListResponse = {
130
+ keys: TokenInfo[];
131
+ };
132
+ export type CreateWorkspaceTokenRequest = {
133
+ kind?: "sync" | "s3";
134
+ access?: "rw" | "ro";
135
+ label?: string;
136
+ ttl_seconds?: number;
137
+ };
138
+ export type CreateProjectS3KeyRequest = {
139
+ access?: "rw" | "ro";
140
+ label?: string;
141
+ ttl_seconds?: number;
142
+ };
143
+ export type CreatedTokenResponse = {
144
+ id: string;
145
+ workspace_id?: string;
146
+ kind: "sync" | "s3";
147
+ access: "rw" | "ro";
148
+ label?: string;
149
+ token?: string;
150
+ sync_url?: string;
151
+ access_key_id?: string;
152
+ secret_access_key?: string;
153
+ bucket?: string;
154
+ endpoint?: string;
155
+ expires_at?: string;
156
+ created_at: string;
157
+ };
158
+ export type Lock = {
159
+ workspace_id: string;
160
+ scope: string;
161
+ owner_id: string;
162
+ token?: string;
163
+ expires_at: string;
164
+ created_at: string;
165
+ };
166
+ export type LockListResponse = {
167
+ locks: Lock[];
168
+ };
169
+ export type AcquireLockRequest = {
170
+ scope?: string;
171
+ owner_id: string;
172
+ ttl_seconds?: number;
173
+ };
174
+ export type DeltaEntry = {
175
+ seq: number;
176
+ path: string;
177
+ op: "upsert" | "delete";
178
+ kind?: "file" | "symlink";
179
+ digest?: string;
180
+ size?: number;
181
+ mode?: number;
182
+ link_target?: string;
183
+ chunks?: ChunkSpec[];
184
+ inline?: string;
185
+ writer?: string;
186
+ };
187
+ export type ConflictRecord = {
188
+ id: string;
189
+ seq: number;
190
+ path: string;
191
+ base_digest?: string;
192
+ winner_digest?: string;
193
+ loser_digest?: string;
194
+ loser_writer?: string;
195
+ created_at: string;
196
+ };
197
+ export type ChangesResponse = {
198
+ seq: number;
199
+ manifest_id: string;
200
+ tree_checksum: string;
201
+ reset?: boolean;
202
+ changes?: DeltaEntry[];
203
+ conflicts?: ConflictRecord[];
204
+ };
205
+ export type ChangeItem = {
206
+ path: string;
207
+ op: "upsert" | "delete";
208
+ kind?: "file" | "symlink";
209
+ digest?: string;
210
+ size?: number;
211
+ mode?: number;
212
+ link_target?: string;
213
+ previous_digest?: string;
214
+ previous_absent?: boolean;
215
+ inline?: string;
216
+ chunks?: ChunkSpec[];
217
+ };
218
+ export type PublishRequest = {
219
+ writer?: string;
220
+ base_seq?: number;
221
+ changes: ChangeItem[];
222
+ };
223
+ export type PublishResponse = {
224
+ seq: number;
225
+ manifest_id: string;
226
+ tree_checksum: string;
227
+ applied: number;
228
+ conflicts?: ConflictRecord[];
229
+ };
230
+ export type BlobGrantItem = {
231
+ digest: string;
232
+ size: number;
233
+ };
234
+ export type UploadGrantRequest = {
235
+ items: BlobGrantItem[];
236
+ };
237
+ export type DownloadGrantRequest = {
238
+ digests: string[];
239
+ };
240
+ export type PresignedTransfer = {
241
+ url?: string;
242
+ method?: string;
243
+ headers?: {
244
+ [key: string]: string;
245
+ };
246
+ expires_at?: string;
247
+ already_present?: boolean;
248
+ };
249
+ export type GrantResponse = {
250
+ grants: {
251
+ [key: string]: PresignedTransfer;
252
+ };
253
+ };
254
+ export type BinaryFile = Blob;
255
+ export type WorkspacePublishedEvent = {
256
+ /**
257
+ * Workspace identifier.
258
+ */
259
+ workspace_id: string;
260
+ /**
261
+ * Monotonic workspace sequence number.
262
+ */
263
+ seq: number;
264
+ /**
265
+ * Manifest identifier of the committed head.
266
+ */
267
+ manifest_id: string;
268
+ /**
269
+ * Writer that committed the publish.
270
+ */
271
+ writer: string;
272
+ /**
273
+ * Number of applied path changes.
274
+ */
275
+ changed_count: number;
276
+ };
277
+ export type WorkspaceConflictEvent = {
278
+ /**
279
+ * Workspace identifier.
280
+ */
281
+ workspace_id: string;
282
+ /**
283
+ * Conflict record identifier.
284
+ */
285
+ conflict_id: string;
286
+ /**
287
+ * Workspace sequence number at which the conflict occurred.
288
+ */
289
+ seq: number;
290
+ /**
291
+ * Conflicting file path.
292
+ */
293
+ path: string;
294
+ /**
295
+ * Winning content digest.
296
+ */
297
+ winner_digest: string;
298
+ /**
299
+ * Preserved losing content digest.
300
+ */
301
+ loser_digest: string;
302
+ /**
303
+ * Writer whose concurrent edit lost the race.
304
+ */
305
+ loser_writer: string;
306
+ };
307
+ export type WorkspaceDeletedEvent = {
308
+ /**
309
+ * Deleted workspace identifier.
310
+ */
311
+ workspace_id: string;
312
+ /**
313
+ * Deleted workspace name.
314
+ */
315
+ name: string;
316
+ };
317
+ /** The events this module sends the project's webhooks (x-palbase-events), by type: each one's payload, the event's data. */
318
+ export interface Events {
319
+ /**
320
+ * workspace.published: a sync publish, API write, or S3 write committed a new workspace sequence number.
321
+ */
322
+ "workspace.published": WorkspacePublishedEvent;
323
+ /**
324
+ * workspace.conflict: two concurrent writers raced on the same path and the losing edit was preserved as a conflict record.
325
+ */
326
+ "workspace.conflict": WorkspaceConflictEvent;
327
+ /**
328
+ * workspace.deleted: a workspace was deleted from the project.
329
+ */
330
+ "workspace.deleted": WorkspaceDeletedEvent;
331
+ }
332
+ /** Palbase Workspaces API */
333
+ export declare function client(t: Transport): {
334
+ /**
335
+ * List workspaces
336
+ *
337
+ * Lists all workspaces in the project.
338
+ */
339
+ listWorkspaces(input?: {
340
+ signal?: AbortSignal;
341
+ }): Promise<Reply<200, WorkspaceListResponse>>;
342
+ /**
343
+ * Create a workspace
344
+ *
345
+ * Creates a new synchronized workspace seeded with the editable default .palbasesync template.
346
+ */
347
+ createWorkspace(input?: {
348
+ body?: CreateWorkspaceRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
349
+ signal?: AbortSignal;
350
+ }): Promise<Reply<201, Workspace>>;
351
+ /**
352
+ * Test a BYOS S3 bucket connection
353
+ *
354
+ * Validates SSRF safety and runs a live Put/Head/Delete/Presign connectivity probe against a customer S3-compatible bucket without persisting credentials.
355
+ */
356
+ testWorkspaceByos(input: {
357
+ body: WorkspaceStorageInput; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
358
+ signal?: AbortSignal;
359
+ }): Promise<Reply<200, TestBYOSResponse>>;
360
+ /**
361
+ * List project-wide S3 keys
362
+ *
363
+ * Lists S3 access keys scoped across all workspaces in the project.
364
+ */
365
+ listProjectS3Keys(input?: {
366
+ signal?: AbortSignal;
367
+ }): Promise<Reply<200, S3KeyListResponse>>;
368
+ /**
369
+ * Create a project-wide S3 key
370
+ *
371
+ * Mints an S3 SigV4 access key and secret spanning every workspace in the project.
372
+ */
373
+ createProjectS3Key(input?: {
374
+ body?: CreateProjectS3KeyRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
375
+ signal?: AbortSignal;
376
+ }): Promise<Reply<201, CreatedTokenResponse>>;
377
+ /**
378
+ * Revoke a project-wide S3 key
379
+ *
380
+ * Deletes a project-wide S3 access key immediately.
381
+ */
382
+ deleteProjectS3Key(input: {
383
+ path: {
384
+ token_id: string;
385
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
386
+ signal?: AbortSignal;
387
+ }): Promise<Reply<204, undefined>>;
388
+ /**
389
+ * Get a workspace
390
+ *
391
+ * Reads one workspace by ID or name.
392
+ */
393
+ getWorkspace(input: {
394
+ path: {
395
+ id: string;
396
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
397
+ signal?: AbortSignal;
398
+ }): Promise<Reply<200, Workspace>>;
399
+ /**
400
+ * Delete a workspace
401
+ *
402
+ * Deletes a workspace. Returns 409 workspace_attached naming active attachments unless force=true.
403
+ */
404
+ deleteWorkspace(input: {
405
+ path: {
406
+ id: string;
407
+ };
408
+ query?: {
409
+ force?: boolean;
410
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
411
+ signal?: AbortSignal;
412
+ }): Promise<Reply<204, undefined>>;
413
+ /**
414
+ * Update or rotate BYOS storage configuration
415
+ *
416
+ * Validates, probes, and seals updated BYOS S3 credentials or endpoint settings for an existing BYOS workspace.
417
+ */
418
+ updateWorkspaceStorage(input: {
419
+ path: {
420
+ id: string;
421
+ };
422
+ body: WorkspaceStorageInput; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
423
+ signal?: AbortSignal;
424
+ }): Promise<Reply<200, Workspace>>;
425
+ /**
426
+ * List or read workspace files
427
+ *
428
+ * Lists all files in the workspace when path is omitted, or downloads a single file when path is provided.
429
+ */
430
+ getWorkspaceFiles(input: {
431
+ path: {
432
+ id: string;
433
+ };
434
+ query?: {
435
+ path?: string;
436
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
437
+ signal?: AbortSignal;
438
+ }): Promise<Reply<200, HeadResponse>>;
439
+ /**
440
+ * Write a workspace file
441
+ *
442
+ * Writes a single file into the workspace and broadcasts the new head to all synced machines.
443
+ */
444
+ putWorkspaceFile(input: {
445
+ path: {
446
+ id: string;
447
+ };
448
+ query: {
449
+ path: string;
450
+ };
451
+ body: BodyInit;
452
+ contentType?: string; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
453
+ signal?: AbortSignal;
454
+ }): Promise<Reply<200, FileInfo>>;
455
+ /**
456
+ * Delete a workspace file
457
+ *
458
+ * Deletes a single file from the workspace and notifies synced machines.
459
+ */
460
+ deleteWorkspaceFile(input: {
461
+ path: {
462
+ id: string;
463
+ };
464
+ query: {
465
+ path: string;
466
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
467
+ signal?: AbortSignal;
468
+ }): Promise<Reply<204, undefined>>;
469
+ /**
470
+ * List workspace tokens and S3 keys
471
+ *
472
+ * Lists sync tokens and workspace-scoped S3 access keys for a workspace.
473
+ */
474
+ listWorkspaceTokens(input: {
475
+ path: {
476
+ id: string;
477
+ };
478
+ query?: {
479
+ kind?: "sync" | "s3";
480
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
481
+ signal?: AbortSignal;
482
+ }): Promise<Reply<200, TokenListResponse>>;
483
+ /**
484
+ * Create a workspace sync token or S3 key
485
+ *
486
+ * Mints a sync bearer token or workspace-scoped S3 SigV4 key pair.
487
+ */
488
+ createWorkspaceToken(input: {
489
+ path: {
490
+ id: string;
491
+ };
492
+ body?: CreateWorkspaceTokenRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
493
+ signal?: AbortSignal;
494
+ }): Promise<Reply<201, CreatedTokenResponse>>;
495
+ /**
496
+ * Revoke a workspace token or S3 key
497
+ *
498
+ * Revokes a workspace sync token or S3 access key immediately.
499
+ */
500
+ deleteWorkspaceToken(input: {
501
+ path: {
502
+ id: string;
503
+ token_id: string;
504
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
505
+ signal?: AbortSignal;
506
+ }): Promise<Reply<204, undefined>>;
507
+ /**
508
+ * List active advisory locks
509
+ *
510
+ * Lists non-expired advisory locks on the workspace.
511
+ */
512
+ listWorkspaceLocks(input: {
513
+ path: {
514
+ id: string;
515
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
516
+ signal?: AbortSignal;
517
+ }): Promise<Reply<200, LockListResponse>>;
518
+ /**
519
+ * Acquire or renew an advisory lock
520
+ *
521
+ * Acquires or renews a TTL-based advisory lock on the workspace or a path prefix.
522
+ */
523
+ acquireWorkspaceLock(input: {
524
+ path: {
525
+ id: string;
526
+ };
527
+ body: AcquireLockRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
528
+ signal?: AbortSignal;
529
+ }): Promise<Reply<200, Lock>>;
530
+ /**
531
+ * Release an advisory lock
532
+ *
533
+ * Releases an advisory lock matching the supplied scope and lock token.
534
+ */
535
+ releaseWorkspaceLock(input: {
536
+ path: {
537
+ id: string;
538
+ };
539
+ query: {
540
+ scope?: string;
541
+ token: string;
542
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
543
+ signal?: AbortSignal;
544
+ }): Promise<Reply<204, undefined>>;
545
+ /**
546
+ * Read workspace sync head
547
+ *
548
+ * Reads the current head metadata and file tree for the workspace identified by the Bearer sync token.
549
+ */
550
+ getSyncHead(input?: {
551
+ query?: {
552
+ summary?: boolean;
553
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
554
+ signal?: AbortSignal;
555
+ }): Promise<Reply<200, HeadResponse>>;
556
+ /**
557
+ * Read incremental workspace changes
558
+ *
559
+ * Returns sequenced changes since a sequence number, embedding small files inline up to inline_limit.
560
+ */
561
+ getSyncChanges(input?: {
562
+ query?: {
563
+ since?: number;
564
+ inline_limit?: number;
565
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
566
+ signal?: AbortSignal;
567
+ }): Promise<Reply<200, ChangesResponse>>;
568
+ /**
569
+ * Publish workspace changes
570
+ *
571
+ * Atomically applies optimistic-concurrency changes with inline small-file support and zero-loss conflict preservation.
572
+ */
573
+ publishSyncChanges(input: {
574
+ body: PublishRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
575
+ signal?: AbortSignal;
576
+ }): Promise<Reply<200, PublishResponse>>;
577
+ /**
578
+ * Request direct presigned blob upload URLs
579
+ *
580
+ * Returns presigned PUT URLs directly to managed R2/S3 object storage for missing content-addressed blobs or chunks.
581
+ */
582
+ requestSyncUploadGrants(input: {
583
+ body: UploadGrantRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
584
+ signal?: AbortSignal;
585
+ }): Promise<Reply<200, GrantResponse>>;
586
+ /**
587
+ * Request direct presigned blob download URLs
588
+ *
589
+ * Returns presigned GET URLs directly to managed R2/S3 object storage for project blobs or chunks.
590
+ */
591
+ requestSyncDownloadGrants(input: {
592
+ body: DownloadGrantRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
593
+ signal?: AbortSignal;
594
+ }): Promise<Reply<200, GrantResponse>>;
595
+ /**
596
+ * Download a decrypted blob via a short-lived signed grant URL
597
+ *
598
+ * Reads PBWS1 ciphertext from managed R2 or BYOS S3, authenticates and decrypts it with the workspace's WDEK, and streams verified plaintext.
599
+ */
600
+ downloadSignedSyncBlob(input: {
601
+ path: {
602
+ digest: string;
603
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
604
+ signal?: AbortSignal;
605
+ }): Promise<Reply<200, undefined>>;
606
+ /**
607
+ * Upload a blob via a short-lived signed grant URL for transparent PBWS1 encryption
608
+ *
609
+ * Accepts plaintext bytes matching the HMAC-signed grant URL, encrypts them with the workspace's per-workspace WDEK (PBWS1), and writes 100% ciphertext to managed R2 or BYOS S3.
610
+ */
611
+ uploadSignedSyncBlob(input: {
612
+ path: {
613
+ digest: string;
614
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
615
+ signal?: AbortSignal;
616
+ }): Promise<Reply<200, undefined>>;
617
+ /**
618
+ * Stream real-time workspace sync events
619
+ *
620
+ * Opens a Server-Sent Events stream delivering head and conflict notifications immediately on commit.
621
+ */
622
+ streamSyncEvents(input?: {
623
+ signal?: AbortSignal;
624
+ }): Promise<Reply<200, Response>>;
625
+ };
626
+ export type Client = ReturnType<typeof client>;
@@ -56,6 +56,11 @@ export interface PalbaseServer {
56
56
  secrets: ReturnType<typeof modules.secrets.client>;
57
57
  storage: ReturnType<typeof modules.storage.client>;
58
58
  stores: ReturnType<typeof modules.stores.client>;
59
+ /**
60
+ * Synchronized workspaces (network disks): create/list/delete workspaces (managed R2 or BYOS S3),
61
+ * read/write/delete files, mint sync tokens & S3 keys, test/rotate BYOS storage, and manage advisory locks.
62
+ */
63
+ workspaces: ReturnType<typeof modules.workspaces.client>;
59
64
  /**
60
65
  * The encrypted fields of a request to this backend and of its answer
61
66
  * (transit.ts): `await palbase.transit.load()` at startup, then the request's
@@ -1,6 +1,8 @@
1
- import { type AgentEvent, type ChatEvent, type GoalEvent, type ToolEvent, type TurnEnd, type TurnEvent, type VoiceEvent } from '../../internal/src/chat.js';
1
+ import { sessionSummary, type AgentEvent, type ChatEvent, type ContextCompactedEvent, type ContextOffloadedEvent, type GoalEvent, type SessionHandedOffEvent, type ToolEvent, type TurnEnd, type TurnEvent, type VoiceEvent } from '../../internal/src/chat.js';
2
+ import type { ai as aiModule } from '../../internal/src/modules/index.js';
2
3
  import { type Transport } from '../../internal/src/transport.js';
3
- export type { AgentEvent, ChatEvent, GoalEvent, HistoryEvent, HistoryItem, Publication, ThinkingEvent, ToolEvent, TranscriptEvent, TurnEnd, TurnEvent, VoiceEvent } from '../../internal/src/chat.js';
4
+ export { sessionSummary };
5
+ export type { AgentEvent, ChatEvent, ContextCompactedEvent, ContextOffloadedEvent, GoalEvent, HistoryEvent, HistoryItem, Publication, SessionHandedOffEvent, SessionMachineStatusEvent, SessionSummaryEvent, ThinkingEvent, ToolEvent, TranscriptEvent, TurnEnd, TurnEvent, VoiceEvent } from '../../internal/src/chat.js';
4
6
  /** A picture or a file a message carries: an image the model was shown, or a file put in the chat's workspace. */
5
7
  export interface ChatAttachment {
6
8
  kind: 'image' | 'file' | (string & {});
@@ -190,9 +192,21 @@ export interface ChatVoice {
190
192
  seconds: number | null;
191
193
  closeReason: string;
192
194
  }
195
+ /** Portable session execution state folded from `session.handed_off`, `session.machine_status`, `context.offloaded`, and `context.compacted` parts. */
196
+ export interface ChatExecutionState {
197
+ target: aiModule.ExecutionTarget | null;
198
+ generation: number;
199
+ workspaceSeq: number;
200
+ machineId: string | null;
201
+ machineStatus: 'online' | 'offline' | 'waking' | (string & {}) | null;
202
+ failoverAt: string | null;
203
+ lastHandoff: SessionHandedOffEvent | null;
204
+ compactions: ContextCompactedEvent[];
205
+ offloads: ContextOffloadedEvent[];
206
+ }
193
207
  /**
194
208
  * One thing of the conversation, in order: a message (a line said in the chat's voice too: kind voice), an answer, a
195
- * word of the chat's goal, or the chat's voice beginning or ending.
209
+ * word of the chat's goal, the chat's voice beginning or ending, a session handoff, or a context compaction.
196
210
  */
197
211
  export type ChatItem = {
198
212
  type: 'message';
@@ -206,6 +220,12 @@ export type ChatItem = {
206
220
  } | {
207
221
  type: 'voice';
208
222
  voice: VoiceEvent;
223
+ } | {
224
+ type: 'handoff';
225
+ handoff: SessionHandedOffEvent;
226
+ } | {
227
+ type: 'compaction';
228
+ compaction: ContextCompactedEvent;
209
229
  };
210
230
  export interface ChatState {
211
231
  /** The conversation in order: the members' messages and the agent's answers (a subagent's is in its parent's parts). */
@@ -234,6 +254,8 @@ export interface ChatState {
234
254
  } | null;
235
255
  /** The chat's voice — the last that began in it, live or ended; null: none yet. */
236
256
  voice: ChatVoice | null;
257
+ /** Live execution target, generation, machine health, handoffs, and compaction history folded from stream parts. */
258
+ execution: ChatExecutionState;
237
259
  }
238
260
  /** A gateway's chat: its state now, and told each time it changes. */
239
261
  export interface GatewayChat extends AsyncIterable<ChatState> {
@@ -288,6 +310,11 @@ export declare class ChatLog implements GatewayChat {
288
310
  private readonly voiceWords;
289
311
  /** The chat's voice: the last that began in it, live or ended. */
290
312
  private voice;
313
+ /** Portable execution state folded from handoff, machine_status, offload, and compaction parts. */
314
+ private execution;
315
+ private readonly handoffGens;
316
+ private readonly compactionSeqs;
317
+ private readonly offloadKeys;
291
318
  /** A fork's history, by its part's place: whenever a part comes, what it holds goes before the rest of the chat. */
292
319
  private readonly history;
293
320
  private forkedFrom;
@@ -383,6 +410,5 @@ export declare class ChatLog implements GatewayChat {
383
410
  */
384
411
  export interface ChatReads extends ChatHistoryReader {
385
412
  toolCall(chatId: string, callId: string, signal?: AbortSignal): Promise<ChatToolCall>;
386
- workspaceFile(chatId: string, path: string, manifest?: string, signal?: AbortSignal): Promise<Blob>;
387
413
  }
388
414
  export declare function chatReader(transport: Transport): ChatReads;