js-bao-wss-client 3.4.1 → 3.5.0-alpha.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.
package/README.md CHANGED
@@ -889,7 +889,7 @@ Additional flags:
889
889
  ### Pagination and tags
890
890
 
891
891
  - Paging params: `limit`, `cursor`, `forward`, `returnPage`. Default sort is by `grantedAt` (document permission grant time) descending; pass `forward: true` for ascending.
892
- - `returnPage: true` returns `{ items, cursor }` (backward-compatible array when omitted). With `refreshFromServer: true`, a background page walker fetches the remaining pages and updates the cache/`documentMetadataChanged` events; set `refreshFromServer: false` if you only want the first page. Note: cursors come from server responses; local-only/local-first paths do not fabricate cursors or enforce `limit` sizing—use `returnPage: true` when you need a cursor even if data is cached. To synchronously walk all pages yourself, loop on `{ returnPage: true, limit, cursor }` until `cursor` is null. To hydrate the full cache in one call, use `client.syncMetadata({ scope: "all", pageSize, includeRoot })` and then list with `refreshFromServer: false`.
892
+ - `returnPage: true` returns `{ items, hasMore, nextCursor }` (backward-compatible array when omitted). With `refreshFromServer: true`, a background page walker fetches the remaining pages and updates the cache/`documentMetadataChanged` events; set `refreshFromServer: false` if you only want the first page. Note: cursors come from server responses; local-only/local-first paths do not fabricate cursors or enforce `limit` sizing—use `returnPage: true` when you need a cursor even if data is cached. To synchronously walk all pages yourself, loop on `{ returnPage: true, limit, cursor }`, passing each page's `nextCursor` back as `cursor`, until `nextCursor` is absent. To hydrate the full cache in one call, use `client.syncMetadata({ scope: "all", pageSize, includeRoot })` and then list with `refreshFromServer: false`.
893
893
  - Server page size defaults to 100 when `limit` is omitted; you can request smaller/larger pages within server limits.
894
894
  - Tag filtering: `tag: string` performs an exact-match filter server-side. Responses include `tags: string[]` and `grantedAt`; both are cached locally and usable offline (e.g., list + `tag` will be filtered from cache when offline/local-only). Root is also considered for tag queries—if you tag the root, it can appear in tag-filtered results even when the default list filters root out. When `refreshFromServer` is true with a tag, the client still fetches the full dataset in the background to keep the cache complete, then filters locally for the tag.
895
895
  - Tag CRUD: server endpoints exist (`POST /documents/:id/tags { tag }`, `DELETE /documents/:id/tags/:tag`) and document create accepts optional tags; the high-level client currently exposes tagging via HTTP helpers or `client.makeRequest`.
@@ -1410,8 +1410,8 @@ const page1 = await client.document(documentId).blobs().list({ limit: 10 });
1410
1410
  page1.items.forEach((b) => {
1411
1411
  console.log(b.blobId, b.filename, b.size);
1412
1412
  });
1413
- if (page1.cursor) {
1414
- const page2 = await blobs.list({ cursor: page1.cursor });
1413
+ if (page1.nextCursor) {
1414
+ const page2 = await blobs.list({ cursor: page1.nextCursor });
1415
1415
  }
1416
1416
  ```
1417
1417
 
@@ -1941,6 +1941,13 @@ const group = await client.groups.create({
1941
1941
  description: "All engineers",
1942
1942
  });
1943
1943
 
1944
+ // Create a group and stamp resource metadata on it in the same call
1945
+ const readingGroup = await client.groups.create({
1946
+ groupType: "class-reading-group",
1947
+ name: "Reading group",
1948
+ initialMetadata: { classLink: { classId: "class-A" } },
1949
+ });
1950
+
1944
1951
  // List groups
1945
1952
  const groups = await client.groups.list();
1946
1953
  const teams = await client.groups.list({ type: "team" });
@@ -43,7 +43,7 @@ export type { DocumentInfo, DocumentPermissionEntry, DocumentAccessResult, Docum
43
43
  export type { UserProfile, SharedDocument, SharedDocumentListResult, SharedDocumentsOptions, OwnedDocumentsOptions, } from "./api/meApi";
44
44
  export type { SessionInfo } from "./api/sessionApi";
45
45
  export type { BasicUserInfo, BatchUserProfile } from "./api/usersApi";
46
- export type { DatabaseInfo, DatabasePermissionEntry, DatabaseGroupPermissionEntry, GrantDatabaseGroupPermissionParams, DatabaseOwnershipTransferResult, DatabaseOperationInfo, AddManagerParams, GrantPermissionParams, CsvImportOptions, CsvImportProgress, CsvImportResult, CelContextResult, ExecuteOperationOptions, DatabaseChangeEvent, DatabaseChangePayload, DatabaseSubscribeOptions, ListDatabasesOptions, DatabaseListPage, OperationType, OperationFilter, QueryDefinition, MutationOperation, MutationDefinition, CountDefinition, AggregateOperation, AggregateDefinition, PipelineStep, PipelineDefinition, ApplyToQuerySource, ApplyToQueryAction, ApplyToQueryDefinition, OperationDefinition, CreateOperationParams, UpdateOperationParams, } from "./api/databasesApi";
46
+ export type { DatabaseInfo, DatabasePermissionEntry, DatabaseGroupPermissionEntry, GrantDatabaseGroupPermissionParams, DatabaseOwnershipTransferResult, DatabaseOperationInfo, AddManagerParams, CsvImportOptions, CsvImportProgress, CsvImportResult, CelContextResult, ExecuteOperationOptions, DatabaseChangeEvent, DatabaseChangePayload, DatabaseSubscribeOptions, ListDatabasesOptions, DatabaseListPage, OperationType, OperationFilter, QueryDefinition, MutationOperation, MutationDefinition, CountDefinition, AggregateOperation, AggregateDefinition, PipelineStep, PipelineDefinition, ApplyToQuerySource, ApplyToQueryAction, ApplyToQueryDefinition, OperationDefinition, CreateOperationParams, UpdateOperationParams, } from "./api/databasesApi";
47
47
  export type { GroupInfo, GroupMemberInfo, GroupMembershipInfo, GroupDocumentInfo, GroupDatabaseInfo, ListUserMembershipsOptions, DirectGroupAdd, DeferredGroupAdd, GroupAddMemberResult, } from "./api/groupsApi";
48
48
  export type { CollectionInfo, CollectionDocumentInfo, CollectionGroupPermissionInfo, CollectionMemberInfo, CollectionAccessInfo, DocumentCollectionInfo, AddCollectionMemberParams, DirectCollectionAdd, DeferredCollectionAdd, CollectionAddMemberResult, PendingCollectionInvitationEntry, } from "./api/collectionsApi";
49
49
  export type { RuleSetInfo, RuleSetSchema, RuleSetTestResult, RuleSetDebugResult, TraceEntry, TriggerDefInfo, ModelRulesInfo, PathDeclaration, RuleLoads, RuleExpression, CategoryRules, } from "./api/ruleSetsApi";
@@ -72,7 +72,7 @@ export type { CollectionTypeConfigsAPI } from "./api/collectionTypeConfigsApi";
72
72
  export type { DatabaseTypeConfigsAPI } from "./api/databaseTypeConfigsApi";
73
73
  export type { CronTriggersAPI } from "./api/cronTriggersApi";
74
74
  export type { CronTriggerInfo, CreateCronTriggerParams, UpdateCronTriggerParams, CronTriggerListResult, ObjectStatus, } from "./api/cronTriggersApi";
75
- export type { CreateDocumentOptions, CreateOfflineOptions, CreateWithAliasOptions, GetOrCreateWithAliasOptions, DeleteDocumentOptions, DocumentAccessRequest, DocumentAccessRequestResponse, DocumentListOptions, DocumentListPage, EvictAllDocumentsOptions, EvictDocumentOptions, GrantGroupPermissionParams, ResolveAliasParams, SetAliasParams, UpdateDocumentData, DocumentIngestSession, DocumentIngestCounterBucket, DocumentIngestStageCounters, DocumentIngestChunkUpload, DocumentIngestChunkUploadResult, DocumentIngestPage, DocumentSnapshotBuild, DocumentSnapshotPage, DocumentSnapshotRequest, } from "./api/documentsApi";
75
+ export type { CreateDocumentOptions, CreateWithAliasOptions, GetOrCreateWithAliasOptions, DeleteDocumentOptions, DocumentAccessRequest, DocumentAccessRequestResponse, DocumentListOptions, DocumentListPage, EvictAllDocumentsOptions, EvictDocumentOptions, GrantGroupPermissionParams, ResolveAliasParams, SetAliasParams, UpdateDocumentData, DocumentIngestSession, DocumentIngestCounterBucket, DocumentIngestStageCounters, DocumentIngestChunkUpload, DocumentIngestChunkUploadResult, DocumentIngestPage, DocumentSnapshotBuild, DocumentSnapshotPage, DocumentSnapshotRequest, } from "./api/documentsApi";
76
76
  export type { CreateDatabaseParams, UpdateDatabaseParams } from "./api/databasesApi";
77
77
  export type { CreateCollectionParams, UpdateCollectionParams, GrantCollectionGroupPermissionParams, ListCollectionsOptions, } from "./api/collectionsApi";
78
78
  export type { ListResult } from "./api/listResult";
@@ -91,7 +91,7 @@ export type { DocumentDebugSnapshot, DocumentPermission, LocalDocumentEntry, Loc
91
91
  export type { LogLevel } from "./internal/logger";
92
92
  export type { RequestOptions } from "./internal/httpClient";
93
93
  export type { LocksAPI } from "./api/locksApi";
94
- export type { FunctionsAPI, FunctionInvokeOptions, FunctionInvokeResult, FunctionInvokeStatus, FunctionInvokeLimits, FunctionStartOptions, FunctionStartResult, FunctionRunRef, FunctionWaitForResult, FunctionRun, FunctionRunError, FunctionRunErrorCode, FunctionRunSettled, FunctionRunSlice, FunctionRunStatus, FunctionRunStatusValue, FunctionRunTerminalStatus, FunctionWaitOptions, } from "./api/functionsApi";
94
+ export type { FunctionsAPI, FunctionInvokeOptions, FunctionInvokeResult, FunctionInvokeStatus, FunctionInvokeLimits, FunctionStartOptions, FunctionStartResult, FunctionRunRef, FunctionRun, FunctionRunError, FunctionRunErrorCode, FunctionRunSettled, FunctionRunSlice, FunctionRunStatus, FunctionRunStatusValue, FunctionRunTerminalStatus, FunctionWaitOptions, } from "./api/functionsApi";
95
95
  export type { LockHandle, LockContention, AcquireResponse, AcquireOptions, BlockingAcquireOptions, ReleaseResult, RenewResult, LockStatus, LockListEntry, LockListResult, } from "./api/locksApi";
96
96
  export type { ResourceMetadataAPI } from "./api/resourceMetadataApi";
97
97
  export type { ResourceMetadataReadResult, ResourceMetadataWriteResult, ResourceMetadataBatchRequestItem, ResourceMetadataBatchParams, ResourceMetadataBatchCategoryResult, ResourceMetadataBatchResourceResult, ResourceMetadataBatchResult, ResourceMetadataListEntry, ResourceMetadataListResult, ResourceMetadataDeleteResult, ResourceMetadataResolveParams, ResourceMetadataResolveResult, } from "./api/resourceMetadataApi";
@@ -1388,8 +1388,6 @@ export interface ListWorkflowRunsResult {
1388
1388
  nextCursor?: string;
1389
1389
  /** True when a next page exists. */
1390
1390
  hasMore?: boolean;
1391
- /** @deprecated Alias of `nextCursor` kept for one deprecation window. */
1392
- cursor?: string;
1393
1391
  /**
1394
1392
  * How many runs the server examined to produce this page.
1395
1393
  *
@@ -3037,14 +3035,6 @@ export declare class JsBaoClient extends Observable<any> {
3037
3035
  * @param documentId - The document to check for local persistence
3038
3036
  * @group Offline & Sync */
3039
3037
  hasIndexedDbPersistence(documentId: string): Promise<boolean>;
3040
- /** Update the local snapshot flag for a document.
3041
- * @param documentId - The document to update the snapshot flag for
3042
- * @param hasSnapshot - Whether the document has a local IndexedDB snapshot
3043
- * @deprecated No longer called internally — `hasIndexedDbSnapshot` is now
3044
- * ignored in favour of checking live ydoc content via `ydocHasData()`.
3045
- * Retained for external callers; will be removed in a future major version.
3046
- * @group Offline & Sync */
3047
- updateLocalSnapshotFlag(documentId: string, hasSnapshot: boolean): Promise<void>;
3048
3038
  private sendAwarenessState;
3049
3039
  /** Remove awareness states for specific clients.
3050
3040
  * @param documentId - The document to remove awareness from
@@ -4487,8 +4477,6 @@ export declare class JsBaoClient extends Observable<any> {
4487
4477
  * @param timeoutMs - Maximum time to wait before rejecting (ms, default 30000)
4488
4478
  * @group Offline & Sync */
4489
4479
  waitForInitialSync(documentId: string, timeoutMs?: number): Promise<void>;
4490
- /** @deprecated Use {@link waitForInitialSync} instead. */
4491
- waitForSync(documentId: string, timeoutMs?: number): Promise<void>;
4492
4480
  /**
4493
4481
  * Wait until the server confirms it has all of this client's writes.
4494
4482
  * Polls {@link checkStateVector} until `includesWrites` is true.
@@ -1755,14 +1755,12 @@ export class JsBaoClient extends Observable {
1755
1755
  const path = `/${endpoint}${qs.length ? `?${qs.join("&")}` : ""}`;
1756
1756
  const response = await this.makeRequest("GET", path);
1757
1757
  if (Array.isArray(response)) {
1758
- return { items: response, cursor: null };
1758
+ return { items: response, nextCursor: null };
1759
1759
  }
1760
1760
  const page = response;
1761
- // #1316: prefer `nextCursor`; fall back to the deprecated `cursor`
1762
- // alias for older servers.
1763
1761
  return {
1764
1762
  items: page.items || [],
1765
- cursor: page.nextCursor ?? page.cursor ?? null,
1763
+ nextCursor: page.nextCursor ?? null,
1766
1764
  };
1767
1765
  };
1768
1766
  const allItems = [];
@@ -1782,7 +1780,7 @@ export class JsBaoClient extends Observable {
1782
1780
  allIds.add(id);
1783
1781
  allItems.push(item);
1784
1782
  }
1785
- cursor = page.cursor || null;
1783
+ cursor = page.nextCursor || null;
1786
1784
  } while (cursor);
1787
1785
  }
1788
1786
  items = allItems;
@@ -2077,13 +2075,13 @@ export class JsBaoClient extends Observable {
2077
2075
  // response says nothing about where the scope ends.
2078
2076
  if (Array.isArray(response))
2079
2077
  return null;
2080
- const items = response?.items ?? response?.documents;
2078
+ const items = response?.items;
2081
2079
  // A body that never mentioned `items` is not a page of this scope, and
2082
2080
  // an empty list read as the whole scope evicts everything.
2083
2081
  if (!Array.isArray(items))
2084
2082
  return null;
2085
2083
  collected.push(...items);
2086
- const next = response?.nextCursor ?? response?.cursor ?? null;
2084
+ const next = response?.nextCursor ?? null;
2087
2085
  if (!next) {
2088
2086
  // No continuation token. If the page nevertheless says more rows
2089
2087
  // remain, the walk cannot ask for them and so never reached the end
@@ -3733,16 +3731,13 @@ export class JsBaoClient extends Observable {
3733
3731
  const path = `/workflows/runs${params.length ? `?${params.join("&")}` : ""}`;
3734
3732
  const response = await this.makeRequest("GET", path);
3735
3733
  const page = response;
3736
- // #1316: prefer `nextCursor`; fall back to the deprecated `cursor` alias
3737
- // for older servers.
3738
- const nextCursor = page?.nextCursor ?? page?.cursor ?? undefined;
3734
+ const nextCursor = page?.nextCursor ?? undefined;
3739
3735
  const result = {
3740
3736
  items: page?.items ?? [],
3741
3737
  hasMore: typeof page?.hasMore === "boolean" ? page.hasMore : !!nextCursor,
3742
3738
  };
3743
3739
  if (nextCursor != null) {
3744
3740
  result.nextCursor = nextCursor;
3745
- result.cursor = nextCursor;
3746
3741
  }
3747
3742
  // #2237: filtered listings report how far the server's walk got. Only
3748
3743
  // surfaced when the server actually sent a number — `undefined` means
@@ -4701,52 +4696,6 @@ export class JsBaoClient extends Observable {
4701
4696
  }
4702
4697
  return false;
4703
4698
  }
4704
- /** Update the local snapshot flag for a document.
4705
- * @param documentId - The document to update the snapshot flag for
4706
- * @param hasSnapshot - Whether the document has a local IndexedDB snapshot
4707
- * @deprecated No longer called internally — `hasIndexedDbSnapshot` is now
4708
- * ignored in favour of checking live ydoc content via `ydocHasData()`.
4709
- * Retained for external callers; will be removed in a future major version.
4710
- * @group Offline & Sync */
4711
- async updateLocalSnapshotFlag(documentId, hasSnapshot) {
4712
- const metaIndex = this.docManager.metadataIndex;
4713
- const existing = metaIndex.get(documentId);
4714
- const currentFlag = existing?.hasIndexedDbSnapshot === true;
4715
- if (hasSnapshot === currentFlag)
4716
- return;
4717
- const next = (existing || { documentId });
4718
- const changedFields = ["hasIndexedDbSnapshot"];
4719
- if (hasSnapshot) {
4720
- next.hasIndexedDbSnapshot = true;
4721
- if (typeof next.localBytes !== "number" || next.localBytes <= 0) {
4722
- next.localBytes = 1;
4723
- changedFields.push("localBytes");
4724
- }
4725
- }
4726
- else {
4727
- delete next.hasIndexedDbSnapshot;
4728
- if (typeof next.localBytes === "number" && next.localBytes > 0) {
4729
- next.localBytes = 0;
4730
- changedFields.push("localBytes");
4731
- }
4732
- }
4733
- metaIndex.set(documentId, next);
4734
- try {
4735
- await this._putMetadataToIdb(next);
4736
- }
4737
- catch (_) { }
4738
- try {
4739
- this.emit("documentMetadataChanged", [
4740
- {
4741
- documentId,
4742
- metadata: next,
4743
- changedFields,
4744
- source: "local",
4745
- },
4746
- ]);
4747
- }
4748
- catch (_) { }
4749
- }
4750
4699
  // Send awareness state to server
4751
4700
  sendAwarenessState(documentId) {
4752
4701
  if (!this.ws || !this.wsconnected)
@@ -11606,10 +11555,6 @@ export class JsBaoClient extends Observable {
11606
11555
  this.on("sync", onSync);
11607
11556
  });
11608
11557
  }
11609
- /** @deprecated Use {@link waitForInitialSync} instead. */
11610
- waitForSync(documentId, timeoutMs = 30000) {
11611
- return this.waitForInitialSync(documentId, timeoutMs);
11612
- }
11613
11558
  /**
11614
11559
  * Wait until the server confirms it has all of this client's writes.
11615
11560
  * Polls {@link checkStateVector} until `includesWrites` is true.
@@ -18,24 +18,31 @@ export { encodeJsonColumn, decodeJsonColumn } from "./sessionModelRuntime";
18
18
  export type { PrimitiveQueueEntry } from "./sessionModelRuntime";
19
19
  /** The schema version a session row carries in `schemaVersion`. */
20
20
  export declare const AGENT_SESSION_SCHEMA_VERSION = 1;
21
+ /** Values this client recognizes for `PrimitiveSessionStatus`. */
21
22
  export declare const PRIMITIVE_SESSION_STATUSES: readonly ["idle", "thinking", "running_tool", "awaiting_answer", "failed", "expired", "cancelled"];
22
23
  /** `"unknown"` is a value a newer server sent that this client does not know. */
23
24
  export type PrimitiveSessionStatus = (typeof PRIMITIVE_SESSION_STATUSES)[number] | "unknown";
25
+ /** Values this client recognizes for `PrimitivePartKind`. */
24
26
  export declare const PRIMITIVE_PART_KINDS: readonly ["text", "reasoning", "tool_call", "file", "event"];
25
27
  /** `"unknown"` is a value a newer server sent that this client does not know. */
26
28
  export type PrimitivePartKind = (typeof PRIMITIVE_PART_KINDS)[number] | "unknown";
29
+ /** Values this client recognizes for `PrimitiveTextState`. */
27
30
  export declare const PRIMITIVE_TEXT_STATES: readonly ["streaming", "done"];
28
31
  /** `"unknown"` is a value a newer server sent that this client does not know. */
29
32
  export type PrimitiveTextState = (typeof PRIMITIVE_TEXT_STATES)[number] | "unknown";
33
+ /** Values this client recognizes for `PrimitiveToolCallState`. */
30
34
  export declare const PRIMITIVE_TOOL_CALL_STATES: readonly ["input-streaming", "input-available", "approval-requested", "approval-responded", "output-available", "output-error", "output-denied"];
31
35
  /** `"unknown"` is a value a newer server sent that this client does not know. */
32
36
  export type PrimitiveToolCallState = (typeof PRIMITIVE_TOOL_CALL_STATES)[number] | "unknown";
37
+ /** Values this client recognizes for `PrimitiveAuthorKind`. */
33
38
  export declare const PRIMITIVE_AUTHOR_KINDS: readonly ["user", "agent", "app"];
34
39
  /** `"unknown"` is a value a newer server sent that this client does not know. */
35
40
  export type PrimitiveAuthorKind = (typeof PRIMITIVE_AUTHOR_KINDS)[number] | "unknown";
41
+ /** Values this client recognizes for `PrimitiveStepKind`. */
36
42
  export declare const PRIMITIVE_STEP_KINDS: readonly ["model_call", "tool_call"];
37
43
  /** `"unknown"` is a value a newer server sent that this client does not know. */
38
44
  export type PrimitiveStepKind = (typeof PRIMITIVE_STEP_KINDS)[number] | "unknown";
45
+ /** Values this client recognizes for `PrimitiveStepStatus`. */
39
46
  export declare const PRIMITIVE_STEP_STATUSES: readonly ["running", "completed", "failed"];
40
47
  /** `"unknown"` is a value a newer server sent that this client does not know. */
41
48
  export type PrimitiveStepStatus = (typeof PRIMITIVE_STEP_STATUSES)[number] | "unknown";
@@ -182,18 +189,21 @@ interface PrimitivePartRecordBase {
182
189
  modifiedAt?: string;
183
190
  row?: PrimitivePartRow;
184
191
  }
192
+ /** A decoded `PrimitivePart` record with `kind: "text"`. */
185
193
  export interface PrimitiveTextPartRecord extends PrimitivePartRecordBase {
186
194
  kind: "text";
187
195
  state?: PrimitiveTextState;
188
196
  text?: string;
189
197
  providerMetadata?: Record<string, unknown>;
190
198
  }
199
+ /** A decoded `PrimitivePart` record with `kind: "reasoning"`. */
191
200
  export interface PrimitiveReasoningPartRecord extends PrimitivePartRecordBase {
192
201
  kind: "reasoning";
193
202
  state?: PrimitiveTextState;
194
203
  text?: string;
195
204
  providerMetadata?: Record<string, unknown>;
196
205
  }
206
+ /** A decoded `PrimitivePart` record with `kind: "tool_call"`. */
197
207
  export interface PrimitiveToolCallPartRecord extends PrimitivePartRecordBase {
198
208
  kind: "tool_call";
199
209
  state?: PrimitiveToolCallState;
@@ -213,6 +223,7 @@ export interface PrimitiveToolCallPartRecord extends PrimitivePartRecordBase {
213
223
  artifactBlobId?: string;
214
224
  providerMetadata?: Record<string, unknown>;
215
225
  }
226
+ /** A decoded `PrimitivePart` record with `kind: "file"`. */
216
227
  export interface PrimitiveFilePartRecord extends PrimitivePartRecordBase {
217
228
  kind: "file";
218
229
  mediaType?: string;
@@ -220,6 +231,7 @@ export interface PrimitiveFilePartRecord extends PrimitivePartRecordBase {
220
231
  blobId?: string;
221
232
  sizeBytes?: number;
222
233
  }
234
+ /** A decoded `PrimitivePart` record with `kind: "event"`. */
223
235
  export interface PrimitiveEventPartRecord extends PrimitivePartRecordBase {
224
236
  kind: "event";
225
237
  eventKind?: string;
@@ -233,6 +245,7 @@ export interface PrimitiveUnknownPartRecord extends PrimitivePartRecordBase {
233
245
  rawKind: string;
234
246
  row: PrimitivePartRow;
235
247
  }
248
+ /** A decoded `PrimitivePart` record, including unrecognized kinds. */
236
249
  export type PrimitivePartRecord = PrimitiveTextPartRecord | PrimitiveReasoningPartRecord | PrimitiveToolCallPartRecord | PrimitiveFilePartRecord | PrimitiveEventPartRecord | PrimitiveUnknownPartRecord;
237
250
  /** The attributes of a `PrimitivePart` model instance. */
238
251
  export interface PrimitivePartAttrs {
@@ -20,6 +20,7 @@ import { decodeModelRow, encodeModelRecord, registerSessionModels, sessionRowInv
20
20
  export { encodeJsonColumn, decodeJsonColumn } from "./sessionModelRuntime";
21
21
  /** The schema version a session row carries in `schemaVersion`. */
22
22
  export const AGENT_SESSION_SCHEMA_VERSION = 1;
23
+ /** Values this client recognizes for `PrimitiveSessionStatus`. */
23
24
  export const PRIMITIVE_SESSION_STATUSES = [
24
25
  "idle",
25
26
  "thinking",
@@ -29,6 +30,7 @@ export const PRIMITIVE_SESSION_STATUSES = [
29
30
  "expired",
30
31
  "cancelled",
31
32
  ];
33
+ /** Values this client recognizes for `PrimitivePartKind`. */
32
34
  export const PRIMITIVE_PART_KINDS = [
33
35
  "text",
34
36
  "reasoning",
@@ -36,7 +38,9 @@ export const PRIMITIVE_PART_KINDS = [
36
38
  "file",
37
39
  "event",
38
40
  ];
41
+ /** Values this client recognizes for `PrimitiveTextState`. */
39
42
  export const PRIMITIVE_TEXT_STATES = ["streaming", "done"];
43
+ /** Values this client recognizes for `PrimitiveToolCallState`. */
40
44
  export const PRIMITIVE_TOOL_CALL_STATES = [
41
45
  "input-streaming",
42
46
  "input-available",
@@ -46,8 +50,11 @@ export const PRIMITIVE_TOOL_CALL_STATES = [
46
50
  "output-error",
47
51
  "output-denied",
48
52
  ];
53
+ /** Values this client recognizes for `PrimitiveAuthorKind`. */
49
54
  export const PRIMITIVE_AUTHOR_KINDS = ["user", "agent", "app"];
55
+ /** Values this client recognizes for `PrimitiveStepKind`. */
50
56
  export const PRIMITIVE_STEP_KINDS = ["model_call", "tool_call"];
57
+ /** Values this client recognizes for `PrimitiveStepStatus`. */
51
58
  export const PRIMITIVE_STEP_STATUSES = [
52
59
  "running",
53
60
  "completed",
@@ -128,8 +128,6 @@ export interface BucketBlobListResult {
128
128
  nextCursor?: string;
129
129
  /** True when a next page exists. */
130
130
  hasMore?: boolean;
131
- /** @deprecated Alias of `nextCursor` kept for one deprecation window. */
132
- cursor?: string;
133
131
  }
134
132
  /**
135
133
  * Pagination options for `blobBuckets.list()`: a page-size `limit` and the
@@ -15,8 +15,8 @@ export interface CollectionTypeConfigInfo {
15
15
  * The declared-access manifest for this type's CEL rule set, returned
16
16
  * parsed. `null` when none is set. A collection rule set can read a
17
17
  * metadata category as `md.self.<category>.<key>` only when the category is
18
- * declared here — this is the manifest prerequisite for migrating a
19
- * `collection.contextId` binding to a metadata category.
18
+ * declared here — the prerequisite for binding a collection to an external
19
+ * entity through a metadata category.
20
20
  */
21
21
  metadataManifest: DeclaredMetadataManifest | null;
22
22
  createdAt: string;
@@ -35,8 +35,8 @@ export interface CreateCollectionTypeConfigParams {
35
35
  /**
36
36
  * Optional declared-access manifest that lets this type's rule
37
37
  * set load metadata categories as `md.self.<category>.<key>`. Declaring a
38
- * category here is the prerequisite for migrating a `collection.contextId`
39
- * binding to a metadata category.
38
+ * category here is the prerequisite for binding a collection to an external
39
+ * entity through a metadata category.
40
40
  */
41
41
  metadataManifest?: DeclaredMetadataManifest;
42
42
  }
@@ -50,7 +50,7 @@ export interface UpdateCollectionTypeConfigParams {
50
50
  /**
51
51
  * Replacement declared-access manifest, or null to clear it.
52
52
  * Set this to make metadata categories reachable from this type's rule set as
53
- * `md.self.<category>.<key>` when migrating off `collection.contextId`.
53
+ * `md.self.<category>.<key>`.
54
54
  */
55
55
  metadataManifest?: DeclaredMetadataManifest | null;
56
56
  }
@@ -15,21 +15,6 @@ export interface CollectionInfo {
15
15
  * at create time. Immutable after create.
16
16
  */
17
17
  collectionType: string;
18
- /**
19
- * Per-instance context identifier. Parallels a group's `groupId`. Used by
20
- * CEL rules (`collection.contextId`) to identify the external entity the
21
- * collection is bound to (e.g. a class ID, project ID). `null` for
22
- * collections not bound to any context. Immutable after create.
23
- *
24
- * @deprecated Prefer resource metadata categories. Stamp a
25
- * category at create time via {@link CreateCollectionParams.initialMetadata}
26
- * and read it from CEL as `md.self.<category>.<key>`. Note the migration is
27
- * not 1:1: because `collection.contextId` is consumed inside rule sets, a rule
28
- * set can read `md.self.<category>.<key>` only when the collection type config
29
- * declares a `metadataManifest` for that category. See `collections.md`. The
30
- * field keeps working.
31
- */
32
- contextId: string | null;
33
18
  documentCount: number;
34
19
  createdAt: string;
35
20
  createdBy: string;
@@ -132,19 +117,6 @@ export interface CreateCollectionParams {
132
117
  * contain `"#"`. Immutable after create.
133
118
  */
134
119
  collectionType?: string;
135
- /**
136
- * Optional. Per-instance identifier that ties the collection to an
137
- * external entity (e.g. a class ID). Exposed to CEL rules as
138
- * `collection.contextId`. Must not contain `"#"`. Immutable after create.
139
- *
140
- * @deprecated Prefer resource metadata categories. Stamp the
141
- * binding via {@link initialMetadata} and read it from CEL as
142
- * `md.self.<category>.<key>`. The migration is not 1:1: a rule set can read
143
- * `md.self.<category>.<key>` only when the collection type config declares a
144
- * `metadataManifest` for that category. See `collections.md`. The field keeps
145
- * working.
146
- */
147
- contextId?: string;
148
120
  /**
149
121
  * Optional. Create-time resource metadata to stamp on the new collection,
150
122
  * keyed by category name → the category's values. Each entry is
@@ -48,8 +48,8 @@ export type DeclaredManifestPath = DeclaredManifestPathFrom | DeclaredManifestPa
48
48
  * load: `self` categories on the subject, declared traversal `paths`, and the
49
49
  * `secrets` / `vars` keys the rules reference. A category is reachable from a
50
50
  * rule as `md.self.<category>.<key>` only when it is declared here — this is the
51
- * manifest prerequisite for migrating off `metadataAccess` / `contextId` to
52
- * metadata categories. Persisted JSON-stringified; the API returns it parsed.
51
+ * manifest prerequisite for migrating off `metadataAccess` to metadata
52
+ * categories. Persisted JSON-stringified; the API returns it parsed.
53
53
  */
54
54
  export interface DeclaredMetadataManifest {
55
55
  /** Categories on the subject resource to load under `md.self`. */
@@ -70,7 +70,7 @@ export interface ListDatabasesOptions {
70
70
  * `returnPage: true`.
71
71
  *
72
72
  * An alias of the shared {@link ListResult} envelope every other paginated
73
- * surface returns — same `items`/`nextCursor`/`hasMore`/`cursor` fields, one
73
+ * surface returns — same `items`/`nextCursor`/`hasMore` fields, one
74
74
  * declaration, so the two can't drift.
75
75
  */
76
76
  export type DatabaseListPage = ListResult<DatabaseInfo>;
@@ -245,15 +245,6 @@ export interface AddManagerParams {
245
245
  /** The user ID to add as a manager */
246
246
  userId: string;
247
247
  }
248
- /**
249
- * @deprecated Use {@link AddManagerParams} instead.
250
- */
251
- export interface GrantPermissionParams {
252
- /** The user to receive the permission */
253
- userId: string;
254
- /** The access level to grant (must be "manager") */
255
- permission: "manager";
256
- }
257
248
  /**
258
249
  * Options for `databases.executeOperation()`: runtime `params`, pagination,
259
250
  * sort direction, and timing diagnostics. `P` types the operation's
@@ -599,26 +590,6 @@ export declare class DatabasesAPI {
599
590
  removeManager(databaseId: string, userId: string): Promise<{
600
591
  success: boolean;
601
592
  }>;
602
- /**
603
- * Grant a user permission to access a database.
604
- * @deprecated Call a server function instead: it manages databases with
605
- * `ctx.api.databases` (see the Working with Databases guide).
606
- * An alias of {@link addManager}.
607
- * @param databaseId - The unique identifier of the database to grant access to
608
- * @param params - Permission grant details
609
- */
610
- grantPermission(databaseId: string, params: GrantPermissionParams): Promise<DatabasePermissionEntry>;
611
- /**
612
- * Revoke a user's permission to a database.
613
- * @deprecated Call a server function instead: it manages databases with
614
- * `ctx.api.databases` (see the Working with Databases guide).
615
- * An alias of {@link removeManager}.
616
- * @param databaseId - The unique identifier of the database to revoke access from
617
- * @param userId - The user whose permission should be removed
618
- */
619
- revokePermission(databaseId: string, userId: string): Promise<{
620
- success: boolean;
621
- }>;
622
593
  /**
623
594
  * Transfer database ownership to another user.
624
595
  * @param databaseId - The unique identifier of the database to transfer
@@ -403,28 +403,6 @@ export class DatabasesAPI {
403
403
  async removeManager(databaseId, userId) {
404
404
  return this.client.makeRequest("DELETE", `/databases/${databaseId}/permissions/${userId}`);
405
405
  }
406
- /**
407
- * Grant a user permission to access a database.
408
- * @deprecated Call a server function instead: it manages databases with
409
- * `ctx.api.databases` (see the Working with Databases guide).
410
- * An alias of {@link addManager}.
411
- * @param databaseId - The unique identifier of the database to grant access to
412
- * @param params - Permission grant details
413
- */
414
- async grantPermission(databaseId, params) {
415
- return this.addManager(databaseId, { userId: params.userId });
416
- }
417
- /**
418
- * Revoke a user's permission to a database.
419
- * @deprecated Call a server function instead: it manages databases with
420
- * `ctx.api.databases` (see the Working with Databases guide).
421
- * An alias of {@link removeManager}.
422
- * @param databaseId - The unique identifier of the database to revoke access from
423
- * @param userId - The user whose permission should be removed
424
- */
425
- async revokePermission(databaseId, userId) {
426
- return this.client.makeRequest("DELETE", `/databases/${databaseId}/permissions/${userId}`);
427
- }
428
406
  /**
429
407
  * Transfer database ownership to another user.
430
408
  * @param databaseId - The unique identifier of the database to transfer
@@ -75,8 +75,6 @@ export interface DocumentListPage {
75
75
  nextCursor?: string;
76
76
  /** True when a next page exists. */
77
77
  hasMore?: boolean;
78
- /** @deprecated Alias of `nextCursor` kept for one deprecation window. */
79
- cursor?: string;
80
78
  }
81
79
  /**
82
80
  * Options for `me.ownedDocuments()` controlling loading strategy (local
@@ -294,24 +292,6 @@ export interface EvictAllDocumentsOptions {
294
292
  /** If true, only evicts documents whose local state is fully synced with the server, preserving unsynced documents. */
295
293
  onlySynced?: boolean;
296
294
  }
297
- /**
298
- * Options for creating a document offline.
299
- * @deprecated Use {@link CreateDocumentOptions} with `localOnly: true` instead.
300
- */
301
- export interface CreateOfflineOptions {
302
- /** The display title for the new document. */
303
- title?: string;
304
- /** Callback to populate the Yjs document with initial content before persistence. */
305
- initialContent?: (ydoc: Y.Doc) => void | Promise<void>;
306
- /** If true, retains the local copy after the document is closed. */
307
- retainLocal?: boolean;
308
- /** Controls when offline writes are persisted: "ifLastKnownWrite" only writes if the local state is the latest, "always" always writes, "never" never writes. */
309
- offlineWritePolicy?: "ifLastKnownWrite" | "always" | "never";
310
- /** If true, waits for IndexedDB persistence to complete before resolving. */
311
- waitForIndexedDb?: boolean;
312
- /** Controls when network sync starts: "immediate" starts right away, "afterIndexedDb" waits for local persistence, "manual" requires explicit start. */
313
- startNetwork?: "immediate" | "afterIndexedDb" | "manual";
314
- }
315
295
  /**
316
296
  * Client API for document aliases — stable user-scoped keys that resolve to
317
297
  * document IDs. Accessed as `client.documents.aliases`.
@@ -1370,12 +1350,6 @@ export declare class DocumentsAPI {
1370
1350
  * @param opts - Eviction options
1371
1351
  */
1372
1352
  evictAll(opts?: EvictAllDocumentsOptions): Promise<void>;
1373
- /**
1374
- * @deprecated Use {@link DocumentsAPI.create | documents.create}({ localOnly: true }) followed by
1375
- * {@link DocumentsAPI.open | documents.open}(id, { waitForLoad: 'local', enableNetworkSync: false }) instead.
1376
- * @see {@link CreateDocumentOptions}
1377
- */
1378
- createOffline(_options: CreateOfflineOptions): Promise<Y.Doc>;
1379
1353
  /**
1380
1354
  * Commit a locally created document to the server.
1381
1355
  * @param documentId - The unique identifier of the locally created document to commit