@gpt-platform/client 0.8.5 → 0.9.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/dist/index.d.ts CHANGED
@@ -606,9 +606,9 @@ declare class BrowserApiKeyError extends Error {
606
606
  }
607
607
 
608
608
  /** SDK version — updated automatically by mix update.sdks */
609
- declare const SDK_VERSION = "0.8.5";
609
+ declare const SDK_VERSION = "0.9.0";
610
610
  /** Default API version sent in every request — updated automatically by mix update.sdks */
611
- declare const DEFAULT_API_VERSION = "2026-03-19";
611
+ declare const DEFAULT_API_VERSION = "2026-03-21";
612
612
 
613
613
  /** Security configuration options */
614
614
  interface SecurityConfig {
@@ -834,20 +834,104 @@ interface StreamOptions {
834
834
  */
835
835
  declare function streamSSE<T = unknown>(response: Response, options?: StreamOptions): AsyncIterableIterator<T>;
836
836
  /**
837
- * Stream AI thread messages with Server-Sent Events
837
+ * Events emitted by thread message streaming.
838
+ *
839
+ * For threads backed by an agent, the stream emits the full execution event
840
+ * lifecycle including tool calls and results. For RAG threads (no agent),
841
+ * only `content`/`token`, `done`, and `error` events are emitted.
842
+ *
843
+ * The `type` field is a discriminant — use a `switch` statement to narrow.
844
+ *
845
+ * @example
846
+ * ```typescript
847
+ * const stream = await client.threads.messages.stream(threadId, { content: 'Hello' });
848
+ * for await (const event of stream) {
849
+ * switch (event.type) {
850
+ * case "token":
851
+ * process.stdout.write(event.content ?? '');
852
+ * break;
853
+ * case "tool_call":
854
+ * console.log(`Calling: ${event.data?.name}`);
855
+ * break;
856
+ * case "tool_result":
857
+ * console.log(`Result: ${event.data?.summary}`);
858
+ * break;
859
+ * case "done":
860
+ * console.log('Complete', event.metadata);
861
+ * break;
862
+ * }
863
+ * }
864
+ * ```
865
+ */
866
+ type StreamMessageChunk = StreamTokenEvent | StreamToolCallEvent | StreamToolResultEvent | StreamIterationCompleteEvent | StreamApprovalRequiredEvent | StreamDoneEvent | StreamErrorEvent;
867
+ /**
868
+ * Incremental token from LLM streaming output.
869
+ * `type: "content"` is a backward-compatible alias — new consumers should match on `"token"`.
838
870
  */
839
- interface StreamMessageChunk {
840
- type: "content" | "done" | "error";
871
+ interface StreamTokenEvent {
872
+ type: "token" | "content";
873
+ content?: string;
874
+ }
875
+ /** Tool invocation started (agent-backed threads only). */
876
+ interface StreamToolCallEvent {
877
+ type: "tool_call";
878
+ data: {
879
+ name: string;
880
+ arguments: Record<string, unknown>;
881
+ };
882
+ }
883
+ /** Tool invocation completed (agent-backed threads only). */
884
+ interface StreamToolResultEvent {
885
+ type: "tool_result";
886
+ data: {
887
+ name: string;
888
+ summary: string;
889
+ };
890
+ }
891
+ /** LLM loop iteration completed (agent-backed threads only). */
892
+ interface StreamIterationCompleteEvent {
893
+ type: "iteration_complete";
894
+ data: {
895
+ iteration: number;
896
+ tokens: number;
897
+ };
898
+ }
899
+ /** Human-in-the-loop approval required (agent-backed threads only). */
900
+ interface StreamApprovalRequiredEvent {
901
+ type: "approval_required";
902
+ data: {
903
+ tool_name: string;
904
+ arguments: Record<string, unknown>;
905
+ classification: string;
906
+ };
907
+ }
908
+ /** Metadata included with stream completion events. */
909
+ interface StreamDoneMetadata {
910
+ thread_id?: string;
911
+ execution_id?: string;
912
+ total_tokens?: number;
913
+ [key: string]: unknown;
914
+ }
915
+ /** Stream completed successfully. */
916
+ interface StreamDoneEvent {
917
+ type: "done";
918
+ content?: string;
919
+ error?: string;
920
+ metadata?: StreamDoneMetadata;
921
+ }
922
+ /** Stream error. */
923
+ interface StreamErrorEvent {
924
+ type: "error";
841
925
  content?: string;
842
926
  error?: string;
843
- metadata?: Record<string, unknown>;
844
927
  }
845
928
  /**
846
- * Parse streaming message response
929
+ * Parse streaming message response — stops on terminal events.
847
930
  */
848
931
  declare function streamMessage(response: Response, options?: StreamOptions): AsyncIterableIterator<StreamMessageChunk>;
849
932
  /**
850
- * Collect full message from stream chunks
933
+ * Collect full message from stream chunks.
934
+ * Handles both `type: "token"` (agent-backed) and `type: "content"` (RAG) events.
851
935
  */
852
936
  declare function collectStreamedMessage(stream: AsyncIterableIterator<StreamMessageChunk>): Promise<string>;
853
937
 
@@ -987,6 +1071,271 @@ declare class RequestBuilder {
987
1071
  streamGetRequest(url: string, options?: RequestOptions, streamOptions?: StreamOptions): Promise<AsyncIterableIterator<StreamMessageChunk>>;
988
1072
  }
989
1073
 
1074
+ /** Import adapter metadata returned by listAdapters. */
1075
+ interface ImportAdapter {
1076
+ key: string;
1077
+ display_name: string;
1078
+ domain: string;
1079
+ required_capability: string;
1080
+ commit_strategy: "atomic" | "chunked";
1081
+ required_fields: string[];
1082
+ optional_fields: string[];
1083
+ }
1084
+ /** Import job record. */
1085
+ interface Import {
1086
+ id: string;
1087
+ adapter_key: string;
1088
+ status: "pending" | "parsing" | "validated" | "validation_failed" | "committing" | "completed" | "commit_failed" | "cancelled";
1089
+ source_type: "csv" | "url" | "api_batch";
1090
+ source_ref: string | null;
1091
+ column_mapping: Record<string, string> | null;
1092
+ metadata: Record<string, unknown>;
1093
+ row_count: number;
1094
+ created_count: number;
1095
+ failed_count: number;
1096
+ error_report: Array<{
1097
+ row: number;
1098
+ errors: string[];
1099
+ }> | null;
1100
+ commit_strategy: "atomic" | "chunked";
1101
+ workspace_id: string;
1102
+ inserted_at: string;
1103
+ updated_at: string;
1104
+ }
1105
+ /** Per-row outcome for chunked imports. */
1106
+ interface ImportRow {
1107
+ id: string;
1108
+ import_id: string;
1109
+ workspace_id: string;
1110
+ row_index: number;
1111
+ status: "pending" | "committed" | "failed";
1112
+ error_messages: string[] | null;
1113
+ created_resource_id: string | null;
1114
+ created_resource_type: string | null;
1115
+ inserted_at: string;
1116
+ updated_at: string;
1117
+ }
1118
+ declare function createImportsNamespace(rb: RequestBuilder): {
1119
+ /**
1120
+ * List available import adapter types for the current application.
1121
+ * @returns Array of adapter metadata objects
1122
+ * @example
1123
+ * const adapters = await sdk.imports.listAdapters();
1124
+ * // [{ key: "clinical:goal", display_name: "Clinical Goals", ... }]
1125
+ */
1126
+ listAdapters: (options?: RequestOptions) => Promise<ImportAdapter[]>;
1127
+ /**
1128
+ * Submit a JSON batch import.
1129
+ * @param params - adapter key, workspace_id, and rows array
1130
+ * @returns Import job with id and initial status
1131
+ * @example
1132
+ * const result = await sdk.imports.batch({
1133
+ * adapter: "clinical:goal",
1134
+ * workspace_id: "ws_123",
1135
+ * rows: [{ contact_id: "...", title: "Increase water intake", goal_type: "hydration" }]
1136
+ * });
1137
+ */
1138
+ batch: (params: {
1139
+ adapter: string;
1140
+ workspace_id: string;
1141
+ rows: Record<string, unknown>[];
1142
+ metadata?: Record<string, unknown>;
1143
+ }, options?: RequestOptions) => Promise<{
1144
+ data: {
1145
+ import_id: string;
1146
+ status: string;
1147
+ };
1148
+ }>;
1149
+ /**
1150
+ * Upload a CSV file for import.
1151
+ * @param file - CSV file (File or Blob)
1152
+ * @param params - adapter key and workspace_id
1153
+ * @returns Import job with id and initial status
1154
+ * @example
1155
+ * const result = await sdk.imports.upload(csvFile, {
1156
+ * adapter: "clinical:patient_bundle",
1157
+ * workspace_id: "ws_123"
1158
+ * });
1159
+ */
1160
+ upload: (file: File | Blob, params: {
1161
+ adapter: string;
1162
+ workspace_id: string;
1163
+ column_mapping?: Record<string, string>;
1164
+ metadata?: Record<string, unknown>;
1165
+ }, options?: RequestOptions) => Promise<{
1166
+ data: {
1167
+ import_id: string;
1168
+ status: string;
1169
+ };
1170
+ }>;
1171
+ /**
1172
+ * List imports for a workspace with optional filters.
1173
+ * @param params - workspace_id required, adapter and status optional
1174
+ * @returns Paginated list of imports
1175
+ * @example
1176
+ * const imports = await sdk.imports.list({ workspace_id: "ws_123", adapter: "crm:contact" });
1177
+ */
1178
+ list: (params: {
1179
+ workspace_id: string;
1180
+ adapter?: string;
1181
+ status?: string;
1182
+ offset?: number;
1183
+ limit?: number;
1184
+ }, options?: RequestOptions) => Promise<{
1185
+ data: Import[];
1186
+ meta: {
1187
+ count: number;
1188
+ };
1189
+ }>;
1190
+ /**
1191
+ * Get a single import by ID.
1192
+ * @param id - Import UUID
1193
+ * @returns Full import record including error_report
1194
+ * @example
1195
+ * const imp = await sdk.imports.get("uuid-here");
1196
+ */
1197
+ get: (id: string, options?: RequestOptions) => Promise<Import>;
1198
+ /**
1199
+ * Get per-row outcomes for a chunked import.
1200
+ * @param importId - Import UUID
1201
+ * @param params - Pagination options
1202
+ * @returns Paginated list of row outcomes
1203
+ * @example
1204
+ * const rows = await sdk.imports.rows("uuid-here", { offset: 0, limit: 50 });
1205
+ */
1206
+ rows: (importId: string, params?: {
1207
+ offset?: number;
1208
+ limit?: number;
1209
+ }, options?: RequestOptions) => Promise<{
1210
+ data: ImportRow[];
1211
+ meta: {
1212
+ count: number;
1213
+ };
1214
+ }>;
1215
+ /**
1216
+ * Confirm a validated import for commit.
1217
+ * @param id - Import UUID
1218
+ * @param params - workspace_id for authorization
1219
+ * @returns Updated import with status "committing"
1220
+ * @example
1221
+ * await sdk.imports.confirm("uuid-here", { workspace_id: "ws_123" });
1222
+ */
1223
+ confirm: (id: string, params: {
1224
+ workspace_id: string;
1225
+ }, options?: RequestOptions) => Promise<{
1226
+ data: {
1227
+ import_id: string;
1228
+ status: string;
1229
+ };
1230
+ }>;
1231
+ /**
1232
+ * Cancel a validated import.
1233
+ * @param id - Import UUID
1234
+ * @param params - workspace_id for authorization
1235
+ * @returns Updated import with status "cancelled"
1236
+ * @example
1237
+ * await sdk.imports.cancel("uuid-here", { workspace_id: "ws_123" });
1238
+ */
1239
+ cancel: (id: string, params: {
1240
+ workspace_id: string;
1241
+ }, options?: RequestOptions) => Promise<{
1242
+ data: {
1243
+ import_id: string;
1244
+ status: string;
1245
+ };
1246
+ }>;
1247
+ };
1248
+
1249
+ /**
1250
+ * Request parameters for obtaining a scoped channel token.
1251
+ *
1252
+ * Available channel patterns:
1253
+ * - `"audit"` — Audit log events (log created, export completed, anomaly detected)
1254
+ * - `"chat_thread"` — Chat thread messages
1255
+ * - `"voice"` — Voice session events
1256
+ * - `"agent_execution"` — Agent execution progress (tokens, tools, approvals)
1257
+ * - `"pipeline_execution"` — Pipeline HITL checkpoint events (reached, approved, rejected)
1258
+ * - `"activity"` — Workspace activity feed
1259
+ * - `"workspace"` — Workspace-level notifications
1260
+ * - `"extraction_export"` — Document extraction exports
1261
+ * - `"campaigns_export"` — Campaign export progress
1262
+ * - `"email_builder"` — Email builder live preview
1263
+ * - `"watcher"` — File watcher events
1264
+ * - `"crm"` — CRM entity changes (contacts, companies, deals, activities, relationships)
1265
+ * - `"scheduling"` — Scheduling events (bookings, cancellations, rescheduling)
1266
+ * - `"clinical"` — Clinical events (patients, sessions, notes) — IDs only, no PHI
1267
+ * - `"import"` — Per-import progress events (topic: `import:{importId}`) — validation, progress, completion, failure
1268
+ * - `"social"` — Social media events (accounts, posts, metrics, trending, campaigns)
1269
+ */
1270
+ interface ChannelTokenRequest {
1271
+ /** The workspace UUID to scope the token to. */
1272
+ workspaceId: string;
1273
+ /**
1274
+ * Channel patterns to authorize.
1275
+ * @example ["crm", "scheduling"] — authorize CRM and Scheduling channels
1276
+ * @example ["clinical"] — authorize Clinical channel only
1277
+ */
1278
+ channels: string[];
1279
+ }
1280
+ /** Response from the channel token endpoint. */
1281
+ interface ChannelTokenResponse {
1282
+ /** The scoped channel token (prefixed with "cht_"). */
1283
+ channelToken: string;
1284
+ /** ISO 8601 expiry timestamp. */
1285
+ expiresAt: string;
1286
+ /** Authorized channel patterns. */
1287
+ channels: string[];
1288
+ /** The workspace this token is scoped to. */
1289
+ workspaceId: string;
1290
+ }
1291
+ /** Options for creating a managed socket connection. */
1292
+ interface SocketManagerOptions {
1293
+ /** The workspace UUID. */
1294
+ workspaceId: string;
1295
+ /** Channel patterns to authorize. */
1296
+ channels: string[];
1297
+ /** WebSocket URL (e.g., "wss://platform.example.com/socket"). */
1298
+ socketUrl: string;
1299
+ /**
1300
+ * Refresh buffer in milliseconds before expiry.
1301
+ * Default: 60000 (1 minute before the 5-minute TTL).
1302
+ */
1303
+ refreshBufferMs?: number;
1304
+ /**
1305
+ * Called when channel token refresh fails (e.g., expired JWT).
1306
+ * Use this to trigger re-authentication in your app.
1307
+ *
1308
+ * @example
1309
+ * ```typescript
1310
+ * onAuthError: async (error) => {
1311
+ * // Attempt to refresh the session JWT
1312
+ * const { token } = await client.identity.refresh(storedRefreshToken);
1313
+ * client.setBearerToken(token);
1314
+ * // Token manager will retry on next scheduled refresh
1315
+ * }
1316
+ * ```
1317
+ */
1318
+ onAuthError?: (error: Error) => void | Promise<void>;
1319
+ }
1320
+ /** A managed socket connection with automatic token refresh. */
1321
+ interface SocketManager {
1322
+ /**
1323
+ * The current channel token. Updates on refresh.
1324
+ * Use this to pass to Phoenix Socket params.
1325
+ */
1326
+ getToken(): string;
1327
+ /**
1328
+ * Fetches a fresh token immediately.
1329
+ * Useful if the managed socket detects an auth error.
1330
+ */
1331
+ refresh(): Promise<string>;
1332
+ /**
1333
+ * Stops the refresh timer and cleans up resources.
1334
+ * Call this when disconnecting.
1335
+ */
1336
+ destroy(): void;
1337
+ }
1338
+
990
1339
  /**
991
1340
  * A "Resource object" representing a ephi-asset
992
1341
  */
@@ -1153,7 +1502,7 @@ type TrendingWatch = {
1153
1502
  /**
1154
1503
  * Field included by default.
1155
1504
  */
1156
- sources: Array<string>;
1505
+ sources: Array<"twitter" | "reddit" | "linkedin" | "facebook" | "instagram" | "newsapi" | "gnews" | "bing_news">;
1157
1506
  /**
1158
1507
  * Field included by default.
1159
1508
  */
@@ -1277,6 +1626,8 @@ type ClinicalGoalTemplate = {
1277
1626
  * Field included by default.
1278
1627
  */
1279
1628
  is_active: boolean;
1629
+ is_archived?: boolean | null | unknown;
1630
+ is_catalog?: boolean | null | unknown;
1280
1631
  /**
1281
1632
  * Field included by default.
1282
1633
  */
@@ -1740,61 +2091,6 @@ type Wallet = {
1740
2091
  };
1741
2092
  type: string;
1742
2093
  };
1743
- /**
1744
- * A "Resource object" representing a message
1745
- */
1746
- type Message = {
1747
- /**
1748
- * An attributes object for a message
1749
- */
1750
- attributes?: {
1751
- /**
1752
- * Field included by default.
1753
- */
1754
- content: string;
1755
- /**
1756
- * Field included by default.
1757
- */
1758
- created_at: unknown;
1759
- /**
1760
- * Field included by default.
1761
- */
1762
- metadata?: {
1763
- [key: string]: unknown;
1764
- } | null | unknown;
1765
- /**
1766
- * Field included by default.
1767
- */
1768
- role: "user" | "assistant" | "system" | "tool";
1769
- /**
1770
- * Field included by default.
1771
- */
1772
- thread_id: string;
1773
- /**
1774
- * Field included by default.
1775
- */
1776
- updated_at: unknown;
1777
- };
1778
- id: string;
1779
- /**
1780
- * A relationships object for a message
1781
- */
1782
- relationships?: {
1783
- thread?: {
1784
- /**
1785
- * An identifier for thread
1786
- */
1787
- data?: {
1788
- id: string;
1789
- meta?: {
1790
- [key: string]: unknown;
1791
- };
1792
- type: string;
1793
- } | null;
1794
- };
1795
- };
1796
- type: string;
1797
- };
1798
2094
  /**
1799
2095
  * A "Resource object" representing a email-marketing-sender-profile
1800
2096
  */
@@ -2562,60 +2858,48 @@ type UserProfile = {
2562
2858
  type: string;
2563
2859
  };
2564
2860
  /**
2565
- * A "Resource object" representing a thread
2861
+ * A "Resource object" representing a chat-message
2566
2862
  */
2567
- type Thread = {
2863
+ type ChatMessage = {
2568
2864
  /**
2569
- * An attributes object for a thread
2865
+ * An attributes object for a chat-message
2570
2866
  */
2571
2867
  attributes?: {
2572
2868
  /**
2573
2869
  * Field included by default.
2574
2870
  */
2575
- agent_id?: string | null | unknown;
2871
+ content: string;
2576
2872
  /**
2577
2873
  * Field included by default.
2578
2874
  */
2579
- agent_version_id?: string | null | unknown;
2875
+ created_at: unknown;
2580
2876
  /**
2581
2877
  * Field included by default.
2582
2878
  */
2583
- archived_at?: unknown;
2879
+ metadata?: {
2880
+ [key: string]: unknown;
2881
+ } | null | unknown;
2584
2882
  /**
2585
2883
  * Field included by default.
2586
2884
  */
2587
- context_summary?: string | null | unknown;
2885
+ role: "user" | "assistant" | "system" | "tool";
2588
2886
  /**
2589
2887
  * Field included by default.
2590
2888
  */
2591
- metadata?: {
2592
- [key: string]: unknown;
2593
- } | null | unknown;
2889
+ thread_id: string;
2594
2890
  /**
2595
2891
  * Field included by default.
2596
2892
  */
2597
- title?: string | null | unknown;
2893
+ updated_at: unknown;
2598
2894
  };
2599
2895
  id: string;
2600
2896
  /**
2601
- * A relationships object for a thread
2897
+ * A relationships object for a chat-message
2602
2898
  */
2603
2899
  relationships?: {
2604
- agent?: {
2605
- /**
2606
- * An identifier for agent
2607
- */
2608
- data?: {
2609
- id: string;
2610
- meta?: {
2611
- [key: string]: unknown;
2612
- };
2613
- type: string;
2614
- } | null;
2615
- };
2616
- agent_version?: {
2900
+ thread?: {
2617
2901
  /**
2618
- * An identifier for agent_version
2902
+ * An identifier for thread
2619
2903
  */
2620
2904
  data?: {
2621
2905
  id: string;
@@ -2625,18 +2909,6 @@ type Thread = {
2625
2909
  type: string;
2626
2910
  } | null;
2627
2911
  };
2628
- messages?: {
2629
- /**
2630
- * Relationship data for messages
2631
- */
2632
- data?: Array<{
2633
- id: string;
2634
- meta?: {
2635
- [key: string]: unknown;
2636
- };
2637
- type: string;
2638
- }>;
2639
- };
2640
2912
  };
2641
2913
  type: string;
2642
2914
  };
@@ -2940,10 +3212,18 @@ type ClinicalPracticeTool = {
2940
3212
  * Field included by default.
2941
3213
  */
2942
3214
  is_active: boolean;
3215
+ is_archived?: boolean | null | unknown;
3216
+ is_catalog?: boolean | null | unknown;
2943
3217
  /**
2944
3218
  * Field included by default.
2945
3219
  */
2946
3220
  logo_url?: string | null | unknown;
3221
+ /**
3222
+ * Field included by default.
3223
+ */
3224
+ metadata: {
3225
+ [key: string]: unknown;
3226
+ };
2947
3227
  /**
2948
3228
  * Field included by default.
2949
3229
  */
@@ -3002,6 +3282,48 @@ type ClinicalPracticeTool = {
3002
3282
  };
3003
3283
  type: string;
3004
3284
  };
3285
+ /**
3286
+ * A "Resource object" representing a permission-preset
3287
+ */
3288
+ type PermissionPreset = {
3289
+ /**
3290
+ * An attributes object for a permission-preset
3291
+ */
3292
+ attributes?: {
3293
+ /**
3294
+ * Field included by default.
3295
+ */
3296
+ app: string;
3297
+ /**
3298
+ * Field included by default.
3299
+ */
3300
+ context: string;
3301
+ /**
3302
+ * Field included by default.
3303
+ */
3304
+ description: string;
3305
+ /**
3306
+ * Field included by default.
3307
+ */
3308
+ name: string;
3309
+ /**
3310
+ * Field included by default.
3311
+ */
3312
+ permissions: Array<string>;
3313
+ /**
3314
+ * Field included by default.
3315
+ */
3316
+ role: string;
3317
+ };
3318
+ id: string;
3319
+ /**
3320
+ * A relationships object for a permission-preset
3321
+ */
3322
+ relationships?: {
3323
+ [key: string]: never;
3324
+ };
3325
+ type: string;
3326
+ };
3005
3327
  /**
3006
3328
  * A "Resource object" representing a notification_log
3007
3329
  */
@@ -3542,6 +3864,13 @@ type ClinicalClientResourceAssignment = {
3542
3864
  * Field included by default.
3543
3865
  */
3544
3866
  completed_at?: string | null | unknown;
3867
+ is_archived?: boolean | null | unknown;
3868
+ /**
3869
+ * Field included by default.
3870
+ */
3871
+ metadata: {
3872
+ [key: string]: unknown;
3873
+ };
3545
3874
  /**
3546
3875
  * Field included by default.
3547
3876
  */
@@ -4590,6 +4919,7 @@ type ClinicalClientSupplement = {
4590
4919
  * Field included by default.
4591
4920
  */
4592
4921
  instructions?: string | null | unknown;
4922
+ is_archived?: boolean | null | unknown;
4593
4923
  /**
4594
4924
  * Field included by default.
4595
4925
  */
@@ -4927,11 +5257,19 @@ type Permission = {
4927
5257
  /**
4928
5258
  * Field included by default.
4929
5259
  */
4930
- category?: string | null | unknown;
5260
+ action: string;
4931
5261
  /**
4932
5262
  * Field included by default.
4933
5263
  */
4934
- context: "tenant" | "workspace";
5264
+ app: string;
5265
+ /**
5266
+ * Field included by default.
5267
+ */
5268
+ category: string;
5269
+ /**
5270
+ * Field included by default.
5271
+ */
5272
+ contexts: Array<string>;
4935
5273
  /**
4936
5274
  * Field included by default.
4937
5275
  */
@@ -4943,11 +5281,11 @@ type Permission = {
4943
5281
  /**
4944
5282
  * Field included by default.
4945
5283
  */
4946
- permissions?: Array<string> | null | unknown;
5284
+ resource: string;
4947
5285
  /**
4948
5286
  * Field included by default.
4949
5287
  */
4950
- role?: string | null | unknown;
5288
+ scope: string;
4951
5289
  };
4952
5290
  id: string;
4953
5291
  /**
@@ -6045,6 +6383,12 @@ type ClinicalSession = {
6045
6383
  * Field included by default.
6046
6384
  */
6047
6385
  event_id?: string | null | unknown;
6386
+ /**
6387
+ * Field included by default.
6388
+ */
6389
+ metadata: {
6390
+ [key: string]: unknown;
6391
+ };
6048
6392
  /**
6049
6393
  * Field included by default.
6050
6394
  */
@@ -6061,6 +6405,10 @@ type ClinicalSession = {
6061
6405
  * Field included by default.
6062
6406
  */
6063
6407
  practitioner_id?: string | null | unknown;
6408
+ /**
6409
+ * Field included by default.
6410
+ */
6411
+ prep_execution_id?: string | null | unknown;
6064
6412
  /**
6065
6413
  * Field included by default.
6066
6414
  */
@@ -6223,6 +6571,7 @@ type ClinicalMealPlan = {
6223
6571
  * Field included by default.
6224
6572
  */
6225
6573
  goal_calories?: number | null | unknown;
6574
+ is_archived?: boolean | null | unknown;
6226
6575
  /**
6227
6576
  * Field included by default.
6228
6577
  */
@@ -7030,6 +7379,7 @@ type User = {
7030
7379
  * Field included by default.
7031
7380
  */
7032
7381
  is_platform_admin: boolean;
7382
+ refresh_token?: string | null | unknown;
7033
7383
  tenant_id?: string | null | unknown;
7034
7384
  /**
7035
7385
  * Field included by default.
@@ -7134,6 +7484,12 @@ type ClinicalPatient = {
7134
7484
  * Field included by default.
7135
7485
  */
7136
7486
  followup_interval_value?: number | null | unknown;
7487
+ /**
7488
+ * Field included by default.
7489
+ */
7490
+ metadata: {
7491
+ [key: string]: unknown;
7492
+ };
7137
7493
  /**
7138
7494
  * Field included by default.
7139
7495
  */
@@ -7344,6 +7700,8 @@ type ClinicalPracticeResource = {
7344
7700
  * Field included by default.
7345
7701
  */
7346
7702
  is_active: boolean;
7703
+ is_archived?: boolean | null | unknown;
7704
+ is_catalog?: boolean | null | unknown;
7347
7705
  /**
7348
7706
  * Field included by default.
7349
7707
  */
@@ -7621,44 +7979,6 @@ type StorageFile = {
7621
7979
  };
7622
7980
  type: string;
7623
7981
  };
7624
- /**
7625
- * A "Resource object" representing a permission_meta
7626
- */
7627
- type PermissionMeta = {
7628
- /**
7629
- * An attributes object for a permission_meta
7630
- */
7631
- attributes?: {
7632
- /**
7633
- * Field included by default.
7634
- */
7635
- apps: Array<string>;
7636
- /**
7637
- * Field included by default.
7638
- */
7639
- cache_ttl: number;
7640
- /**
7641
- * Field included by default.
7642
- */
7643
- categories: Array<string>;
7644
- /**
7645
- * Field included by default.
7646
- */
7647
- scopes: Array<string>;
7648
- /**
7649
- * Field included by default.
7650
- */
7651
- version: string;
7652
- };
7653
- id: string;
7654
- /**
7655
- * A relationships object for a permission_meta
7656
- */
7657
- relationships?: {
7658
- [key: string]: never;
7659
- };
7660
- type: string;
7661
- };
7662
7982
  /**
7663
7983
  * A "Resource object" representing a document-section
7664
7984
  */
@@ -7791,6 +8111,12 @@ type ClinicalDelivery = {
7791
8111
  * Field included by default.
7792
8112
  */
7793
8113
  included_supplement_ids: Array<string>;
8114
+ /**
8115
+ * Field included by default.
8116
+ */
8117
+ metadata: {
8118
+ [key: string]: unknown;
8119
+ };
7794
8120
  /**
7795
8121
  * Field included by default.
7796
8122
  */
@@ -7914,6 +8240,44 @@ type TrendingSnapshotItem = {
7914
8240
  };
7915
8241
  type: string;
7916
8242
  };
8243
+ /**
8244
+ * A "Resource object" representing a permission-meta
8245
+ */
8246
+ type PermissionMeta = {
8247
+ /**
8248
+ * An attributes object for a permission-meta
8249
+ */
8250
+ attributes?: {
8251
+ /**
8252
+ * Field included by default.
8253
+ */
8254
+ apps: Array<string>;
8255
+ /**
8256
+ * Field included by default.
8257
+ */
8258
+ cache_ttl: number;
8259
+ /**
8260
+ * Field included by default.
8261
+ */
8262
+ categories: Array<string>;
8263
+ /**
8264
+ * Field included by default.
8265
+ */
8266
+ scopes: Array<string>;
8267
+ /**
8268
+ * Field included by default.
8269
+ */
8270
+ version: string;
8271
+ };
8272
+ id: string;
8273
+ /**
8274
+ * A relationships object for a permission-meta
8275
+ */
8276
+ relationships?: {
8277
+ [key: string]: never;
8278
+ };
8279
+ type: string;
8280
+ };
7917
8281
  /**
7918
8282
  * A "Resource object" representing a crm_deal
7919
8283
  */
@@ -8733,6 +9097,85 @@ type EmailMarketingTemplate = {
8733
9097
  };
8734
9098
  type: string;
8735
9099
  };
9100
+ /**
9101
+ * A "Resource object" representing a chat-thread
9102
+ */
9103
+ type ChatThread = {
9104
+ /**
9105
+ * An attributes object for a chat-thread
9106
+ */
9107
+ attributes?: {
9108
+ /**
9109
+ * Field included by default.
9110
+ */
9111
+ agent_id?: string | null | unknown;
9112
+ /**
9113
+ * Field included by default.
9114
+ */
9115
+ agent_version_id?: string | null | unknown;
9116
+ /**
9117
+ * Field included by default.
9118
+ */
9119
+ archived_at?: unknown;
9120
+ /**
9121
+ * Field included by default.
9122
+ */
9123
+ context_summary?: string | null | unknown;
9124
+ /**
9125
+ * Field included by default.
9126
+ */
9127
+ metadata?: {
9128
+ [key: string]: unknown;
9129
+ } | null | unknown;
9130
+ /**
9131
+ * Field included by default.
9132
+ */
9133
+ title?: string | null | unknown;
9134
+ };
9135
+ id: string;
9136
+ /**
9137
+ * A relationships object for a chat-thread
9138
+ */
9139
+ relationships?: {
9140
+ agent?: {
9141
+ /**
9142
+ * An identifier for agent
9143
+ */
9144
+ data?: {
9145
+ id: string;
9146
+ meta?: {
9147
+ [key: string]: unknown;
9148
+ };
9149
+ type: string;
9150
+ } | null;
9151
+ };
9152
+ agent_version?: {
9153
+ /**
9154
+ * An identifier for agent_version
9155
+ */
9156
+ data?: {
9157
+ id: string;
9158
+ meta?: {
9159
+ [key: string]: unknown;
9160
+ };
9161
+ type: string;
9162
+ } | null;
9163
+ };
9164
+ messages?: {
9165
+ /**
9166
+ * Relationship data for messages
9167
+ */
9168
+ data?: Array<{
9169
+ id: string;
9170
+ meta?: {
9171
+ [key: string]: unknown;
9172
+ };
9173
+ type: string;
9174
+ }>;
9175
+ };
9176
+ };
9177
+ type: string;
9178
+ };
8736
9179
  /**
8737
9180
  * A "Resource object" representing a email-marketing-generated-email
8738
9181
  */
@@ -8845,10 +9288,17 @@ type ClinicalHealthMetric = {
8845
9288
  * Field included by default.
8846
9289
  */
8847
9290
  extracted_from?: string | null | unknown;
9291
+ is_archived?: boolean | null | unknown;
8848
9292
  /**
8849
9293
  * Field included by default.
8850
9294
  */
8851
9295
  measured_at?: string | null | unknown;
9296
+ /**
9297
+ * Field included by default.
9298
+ */
9299
+ metadata: {
9300
+ [key: string]: unknown;
9301
+ };
8852
9302
  /**
8853
9303
  * Field included by default.
8854
9304
  */
@@ -8990,48 +9440,6 @@ type RiskAssessment = {
8990
9440
  };
8991
9441
  type: string;
8992
9442
  };
8993
- /**
8994
- * A "Resource object" representing a permission_preset
8995
- */
8996
- type PermissionPreset = {
8997
- /**
8998
- * An attributes object for a permission_preset
8999
- */
9000
- attributes?: {
9001
- /**
9002
- * Field included by default.
9003
- */
9004
- app: string;
9005
- /**
9006
- * Field included by default.
9007
- */
9008
- context: string;
9009
- /**
9010
- * Field included by default.
9011
- */
9012
- description: string;
9013
- /**
9014
- * Field included by default.
9015
- */
9016
- name: string;
9017
- /**
9018
- * Field included by default.
9019
- */
9020
- permissions: Array<string>;
9021
- /**
9022
- * Field included by default.
9023
- */
9024
- role: string;
9025
- };
9026
- id: string;
9027
- /**
9028
- * A relationships object for a permission_preset
9029
- */
9030
- relationships?: {
9031
- [key: string]: never;
9032
- };
9033
- type: string;
9034
- };
9035
9443
  /**
9036
9444
  * A "Resource object" representing a crawler_schedule
9037
9445
  */
@@ -9681,6 +10089,13 @@ type ClinicalNote = {
9681
10089
  * An attributes object for a clinical-note
9682
10090
  */
9683
10091
  attributes?: {
10092
+ is_archived?: boolean | null | unknown;
10093
+ /**
10094
+ * Field included by default.
10095
+ */
10096
+ metadata: {
10097
+ [key: string]: unknown;
10098
+ };
9684
10099
  /**
9685
10100
  * Field included by default.
9686
10101
  */
@@ -10384,6 +10799,7 @@ type ClinicalClientGoal = {
10384
10799
  * Field included by default.
10385
10800
  */
10386
10801
  goal_type: string;
10802
+ is_archived?: boolean | null | unknown;
10387
10803
  /**
10388
10804
  * Field included by default.
10389
10805
  */
@@ -11777,7 +12193,27 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
11777
12193
  list: (options?: {
11778
12194
  page?: number;
11779
12195
  pageSize?: number;
11780
- } & RequestOptions) => Promise<Thread[]>;
12196
+ } & RequestOptions) => Promise<ChatThread[]>;
12197
+ /**
12198
+ * Lists only the calling user's threads within their current workspace.
12199
+ *
12200
+ * Unlike {@link list} which returns all threads in the workspace (for admin
12201
+ * visibility), `listMine` scopes results to threads owned by the
12202
+ * authenticated user. This is the recommended method for end-user UIs.
12203
+ *
12204
+ * @param options - Optional pagination and request options.
12205
+ * @returns A promise that resolves to an array of the user's `Thread` objects.
12206
+ *
12207
+ * @example
12208
+ * ```typescript
12209
+ * const myThreads = await client.threads.listMine();
12210
+ * myThreads.forEach(t => console.log(t.attributes.title));
12211
+ * ```
12212
+ */
12213
+ listMine: (options?: {
12214
+ page?: number;
12215
+ pageSize?: number;
12216
+ } & RequestOptions) => Promise<ChatThread[]>;
11781
12217
  /**
11782
12218
  * Fetches all threads in the workspace by transparently paginating through
11783
12219
  * every page until exhausted.
@@ -11794,7 +12230,7 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
11794
12230
  * const allThreads = await client.threads.listAll();
11795
12231
  * console.log(`Total threads: ${allThreads.length}`);
11796
12232
  */
11797
- listAll: (options?: RequestOptions) => Promise<Thread[]>;
12233
+ listAll: (options?: RequestOptions) => Promise<ChatThread[]>;
11798
12234
  /**
11799
12235
  * Creates a new conversation thread.
11800
12236
  *
@@ -11816,7 +12252,7 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
11816
12252
  * });
11817
12253
  * console.log(`Thread ID: ${thread.id}`);
11818
12254
  */
11819
- create: (attributes: CreateThreadAttributes, options?: RequestOptions) => Promise<Thread>;
12255
+ create: (attributes: CreateThreadAttributes, options?: RequestOptions) => Promise<ChatThread>;
11820
12256
  /**
11821
12257
  * Updates one or more attributes of an existing thread.
11822
12258
  *
@@ -11836,7 +12272,7 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
11836
12272
  * title: 'Q2 Invoice Review',
11837
12273
  * });
11838
12274
  */
11839
- update: (id: string, attributes: UpdateThreadAttributes, options?: RequestOptions) => Promise<Thread>;
12275
+ update: (id: string, attributes: UpdateThreadAttributes, options?: RequestOptions) => Promise<ChatThread>;
11840
12276
  /**
11841
12277
  * Generates an AI-produced summary of the thread's conversation history.
11842
12278
  *
@@ -11855,7 +12291,7 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
11855
12291
  * const thread = await client.threads.summarize('thr_01HXYZ...');
11856
12292
  * console.log(thread.attributes.summary);
11857
12293
  */
11858
- summarize: (id: string, options?: RequestOptions) => Promise<Thread>;
12294
+ summarize: (id: string, options?: RequestOptions) => Promise<ChatThread>;
11859
12295
  /**
11860
12296
  * Forks a thread by creating a new thread that is a full copy of the original,
11861
12297
  * including all of its messages.
@@ -11874,7 +12310,7 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
11874
12310
  * const fork = await client.threads.fork('thr_01HXYZ...');
11875
12311
  * console.log(`Forked into new thread: ${fork.id}`);
11876
12312
  */
11877
- fork: (id: string, options?: RequestOptions) => Promise<Thread>;
12313
+ fork: (id: string, options?: RequestOptions) => Promise<ChatThread>;
11878
12314
  /**
11879
12315
  * Exports a thread and all of its messages in a portable format.
11880
12316
  *
@@ -11894,7 +12330,7 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
11894
12330
  * const exported = await client.threads.export('thr_01HXYZ...');
11895
12331
  * console.log(exported.attributes.export); // Markdown or JSON string
11896
12332
  */
11897
- export: (id: string, options?: RequestOptions) => Promise<Thread>;
12333
+ export: (id: string, options?: RequestOptions) => Promise<ChatThread>;
11898
12334
  /**
11899
12335
  * Fetches a single thread by its ID.
11900
12336
  *
@@ -11907,7 +12343,7 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
11907
12343
  * const thread = await client.threads.get('thr_01HXYZ...');
11908
12344
  * console.log(thread.attributes.title);
11909
12345
  */
11910
- get: (id: string, options?: RequestOptions) => Promise<Thread>;
12346
+ get: (id: string, options?: RequestOptions) => Promise<ChatThread>;
11911
12347
  /**
11912
12348
  * Archives a thread, soft-deleting it by hiding it from default listings.
11913
12349
  *
@@ -11927,7 +12363,7 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
11927
12363
  * const archived = await client.threads.archive('thr_01HXYZ...');
11928
12364
  * console.log(`Archived at: ${archived.attributes.archived_at}`);
11929
12365
  */
11930
- archive: (id: string, options?: RequestOptions) => Promise<Thread>;
12366
+ archive: (id: string, options?: RequestOptions) => Promise<ChatThread>;
11931
12367
  /**
11932
12368
  * Restores a previously archived thread back to active status.
11933
12369
  *
@@ -11944,7 +12380,7 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
11944
12380
  * const restored = await client.threads.unarchive('thr_01HXYZ...');
11945
12381
  * console.log(`Archived at: ${restored.attributes.archived_at}`); // null
11946
12382
  */
11947
- unarchive: (id: string, options?: RequestOptions) => Promise<Thread>;
12383
+ unarchive: (id: string, options?: RequestOptions) => Promise<ChatThread>;
11948
12384
  /**
11949
12385
  * Sub-namespace for reading and sending messages within a thread.
11950
12386
  *
@@ -11961,7 +12397,7 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
11961
12397
  * // Streaming
11962
12398
  * const stream = await client.threads.messages.stream('thr_01HXYZ...', { content: 'Hello!' });
11963
12399
  * for await (const chunk of stream) {
11964
- * process.stdout.write(chunk.delta ?? '');
12400
+ * if (chunk.type === 'token') process.stdout.write(chunk.content ?? '');
11965
12401
  * }
11966
12402
  */
11967
12403
  messages: {
@@ -11982,7 +12418,7 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
11982
12418
  * const messages = await client.threads.messages.list('thr_01HXYZ...');
11983
12419
  * messages.forEach(m => console.log(`${m.attributes.role}: ${m.attributes.content}`));
11984
12420
  */
11985
- list: (threadId: string, options?: RequestOptions) => Promise<Message[]>;
12421
+ list: (threadId: string, options?: RequestOptions) => Promise<ChatMessage[]>;
11986
12422
  /**
11987
12423
  * Sends a message to a thread and waits for the full AI response before
11988
12424
  * returning (non-streaming).
@@ -12009,40 +12445,50 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
12009
12445
  * );
12010
12446
  * console.log(`Assistant: ${reply.attributes.content}`);
12011
12447
  */
12012
- send: (threadId: string, content: string, attributes?: SendMessageAttributes, options?: RequestOptions) => Promise<Message>;
12448
+ send: (threadId: string, content: string, attributes?: SendMessageAttributes, options?: RequestOptions) => Promise<ChatMessage>;
12013
12449
  /**
12014
- * Sends a message to a thread and streams the AI response token-by-token
12015
- * via Server-Sent Events (SSE).
12450
+ * Sends a message to a thread and streams the AI response via Server-Sent Events (SSE).
12016
12451
  *
12017
- * Returns an `AsyncIterableIterator` that yields `StreamMessageChunk`
12018
- * objects as tokens are generated. Consume with a `for await` loop. The
12019
- * stream closes automatically when the assistant finishes generating its
12020
- * response.
12452
+ * For agent-backed threads, the stream includes the full execution lifecycle:
12453
+ * - `token` incremental LLM output tokens
12454
+ * - `tool_call` agent is calling a tool (name + arguments)
12455
+ * - `tool_result` — tool execution completed (name + summary)
12456
+ * - `iteration_complete` — LLM loop iteration finished
12457
+ * - `approval_required` — human approval needed for a sensitive tool
12458
+ * - `done` — stream complete, includes metadata with execution_id
12459
+ * - `error` — stream error
12460
+ *
12461
+ * For RAG threads (no agent), only `token`, `done`, and `error` are emitted.
12021
12462
  *
12022
12463
  * SSE security limits: 5-minute idle timeout, 10,000 chunk maximum,
12023
12464
  * 10 MB buffer size limit.
12024
12465
  *
12025
12466
  * @param threadId - The UUID of the thread to stream a message to.
12026
12467
  * @param body - The message payload, including at minimum `content` (string).
12027
- * Additional fields such as `role` or `metadata` are passed through.
12028
12468
  * @param options - Optional request options (e.g. custom headers, abort signal).
12029
12469
  * @param streamOptions - Optional streaming configuration (e.g. chunk timeout).
12030
12470
  * @returns A promise that resolves to an `AsyncIterableIterator<StreamMessageChunk>`.
12031
- * Each yielded chunk contains a `delta` string (the new token text) and
12032
- * optional event metadata.
12033
12471
  *
12034
12472
  * @example
12035
- * const client = new GptClient({ apiKey: 'sk_app_...' });
12036
- *
12037
- * const stream = await client.threads.messages.stream(
12038
- * 'thr_01HXYZ...',
12039
- * { content: 'Summarize the key clauses in this contract.' },
12040
- * );
12041
- *
12042
- * for await (const chunk of stream) {
12043
- * process.stdout.write(chunk.delta ?? '');
12473
+ * ```typescript
12474
+ * const stream = await client.threads.messages.stream(threadId, { content: 'Summarize the contract.' });
12475
+ * for await (const event of stream) {
12476
+ * switch (event.type) {
12477
+ * case 'token':
12478
+ * process.stdout.write(event.content ?? '');
12479
+ * break;
12480
+ * case 'tool_call':
12481
+ * console.log(`Tool: ${event.data.name}`, event.data.arguments);
12482
+ * break;
12483
+ * case 'tool_result':
12484
+ * console.log(`Result: ${event.data.summary}`);
12485
+ * break;
12486
+ * case 'done':
12487
+ * console.log('Complete', event.metadata);
12488
+ * break;
12489
+ * }
12044
12490
  * }
12045
- * console.log(); // newline after streaming completes
12491
+ * ```
12046
12492
  */
12047
12493
  stream: (threadId: string, body: Record<string, unknown>, options?: RequestOptions, streamOptions?: StreamOptions) => Promise<AsyncIterableIterator<StreamMessageChunk>>;
12048
12494
  /**
@@ -12056,7 +12502,7 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
12056
12502
  * const client = new GptClient({ apiKey: 'sk_app_...' });
12057
12503
  * const results = await client.threads.messages.search('deadline');
12058
12504
  */
12059
- search: (query: string, options?: RequestOptions) => Promise<Message[]>;
12505
+ search: (query: string, options?: RequestOptions) => Promise<ChatMessage[]>;
12060
12506
  /**
12061
12507
  * Vector similarity search across messages using a generated embedding.
12062
12508
  *
@@ -12072,7 +12518,7 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
12072
12518
  * const client = new GptClient({ apiKey: 'sk_app_...' });
12073
12519
  * const results = await client.threads.messages.semanticSearch('unpaid invoices', 5);
12074
12520
  */
12075
- semanticSearch: (query: string, limit?: number, options?: RequestOptions) => Promise<Message[]>;
12521
+ semanticSearch: (query: string, limit?: number, options?: RequestOptions) => Promise<ChatMessage[]>;
12076
12522
  };
12077
12523
  /**
12078
12524
  * Trigger AI inference on a thread without sending a new user message.
@@ -12099,17 +12545,16 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
12099
12545
  * console.log(`Thread updated at: ${thread.attributes?.updated_at}`);
12100
12546
  * ```
12101
12547
  */
12102
- complete: (threadId: string, options?: RequestOptions) => Promise<Thread>;
12548
+ complete: (threadId: string, options?: RequestOptions) => Promise<ChatThread>;
12103
12549
  /**
12104
12550
  * Trigger AI inference on a thread and receive the response via Server-Sent Events.
12105
12551
  *
12106
- * Identical to {@link complete} in behavior but delivers the result as an SSE
12107
- * stream. The stream yields a single `StreamMessageChunk` with `done: true`
12108
- * when the AI response is ready.
12552
+ * For agent-backed threads (when execution bridge is enabled), this streams
12553
+ * the full execution lifecycle including `token`, `tool_call`, `tool_result`,
12554
+ * `iteration_complete`, `approval_required`, `done`, and `error` events.
12109
12555
  *
12110
- * Note: This endpoint delivers the full response as one event (not token-by-token).
12111
- * It gives the frontend a consistent SSE interface for uniform handling of both
12112
- * streaming and non-streaming completions.
12556
+ * For RAG threads or when the bridge is disabled, delivers the full response
12557
+ * as a single `done` event.
12113
12558
  *
12114
12559
  * @param threadId - The UUID of the thread to run AI completion on.
12115
12560
  * @param options - Optional request options (e.g. abort signal).
@@ -12118,11 +12563,19 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
12118
12563
  *
12119
12564
  * @example
12120
12565
  * ```typescript
12121
- * const client = new GptClient({ apiKey: 'sk_app_...' });
12122
- *
12123
12566
  * const stream = await client.threads.completeStream('thr_01HXYZ...');
12124
- * for await (const chunk of stream) {
12125
- * if (chunk.type === 'done') console.log(`AI response: ${chunk.content}`);
12567
+ * for await (const event of stream) {
12568
+ * switch (event.type) {
12569
+ * case 'token':
12570
+ * process.stdout.write(event.content ?? '');
12571
+ * break;
12572
+ * case 'tool_call':
12573
+ * console.log(`Tool: ${event.data.name}`);
12574
+ * break;
12575
+ * case 'done':
12576
+ * console.log('Complete', event.metadata);
12577
+ * break;
12578
+ * }
12126
12579
  * }
12127
12580
  * ```
12128
12581
  */
@@ -12140,7 +12593,7 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
12140
12593
  * const results = await client.threads.search('invoice review');
12141
12594
  * ```
12142
12595
  */
12143
- search: (query: string, options?: RequestOptions) => Promise<Thread[]>;
12596
+ search: (query: string, options?: RequestOptions) => Promise<ChatThread[]>;
12144
12597
  };
12145
12598
 
12146
12599
  /** Response from a presigned upload request. */
@@ -13707,15 +14160,27 @@ type UpdateTenantAttributes = {
13707
14160
  contact_phone?: string;
13708
14161
  [key: string]: unknown;
13709
14162
  };
13710
- /** Attributes accepted when creating an invitation. */
14163
+ /**
14164
+ * Attributes accepted when creating an invitation.
14165
+ *
14166
+ * Invitations target a scope: either a tenant or a workspace.
14167
+ * Use `scope_type` + `scope_id` to specify the target, or use
14168
+ * the convenience shorthand `workspace_id` or `tenant_id`.
14169
+ */
13711
14170
  type CreateInvitationAttributes = {
13712
14171
  email: string;
13713
- scope_type: "tenant" | "workspace";
13714
- scope_id: string;
13715
14172
  role: "admin" | "member" | "editor" | "viewer";
13716
14173
  custom_message?: string;
13717
14174
  permissions?: string[];
13718
14175
  application_id?: string;
14176
+ /** Shorthand: invite to a workspace. Sets scope_type: "workspace", scope_id: workspace_id */
14177
+ workspace_id?: string;
14178
+ /** Shorthand: invite to a tenant. Sets scope_type: "tenant", scope_id: tenant_id */
14179
+ tenant_id?: string;
14180
+ /** Explicit scope type (alternative to workspace_id/tenant_id shorthand) */
14181
+ scope_type?: "tenant" | "workspace";
14182
+ /** Explicit scope ID (use with scope_type) */
14183
+ scope_id?: string;
13719
14184
  [key: string]: unknown;
13720
14185
  };
13721
14186
  /** Attributes accepted when creating a brand identity. */
@@ -14465,13 +14930,20 @@ declare function createPlatformNamespace(rb: RequestBuilder): {
14465
14930
  *
14466
14931
  * @example
14467
14932
  * ```typescript
14468
- * const client = new GptClient({ apiKey: 'sk_app_...' });
14933
+ * // Using workspace_id shorthand (recommended):
14469
14934
  * const invite = await client.platform.invitations.create({
14470
14935
  * email: 'new.clinician@hospital.org',
14471
14936
  * workspace_id: 'ws_abc123',
14472
14937
  * role: 'member',
14473
14938
  * });
14474
- * console.log('Invitation sent:', invite.id);
14939
+ *
14940
+ * // Using explicit scope_type + scope_id:
14941
+ * const invite2 = await client.platform.invitations.create({
14942
+ * email: 'admin@hospital.org',
14943
+ * scope_type: 'tenant',
14944
+ * scope_id: tenantId,
14945
+ * role: 'admin',
14946
+ * });
14475
14947
  * ```
14476
14948
  */
14477
14949
  create: (attributes: CreateInvitationAttributes, options?: RequestOptions) => Promise<Invitation>;
@@ -15099,6 +15571,15 @@ interface AuthResponse {
15099
15571
  token?: string;
15100
15572
  [key: string]: unknown;
15101
15573
  }
15574
+ /** Response from the session refresh endpoint. */
15575
+ interface RefreshResponse {
15576
+ /** New JWT access token. */
15577
+ token: string;
15578
+ /** New refresh token (rotated — previous token is revoked). */
15579
+ refresh_token: string;
15580
+ /** The user's UUID. */
15581
+ user_id: string;
15582
+ }
15102
15583
  /** Dashboard summary data for the current user. */
15103
15584
  interface DashboardResponse {
15104
15585
  [key: string]: unknown;
@@ -15168,6 +15649,23 @@ declare function createIdentityNamespace(rb: RequestBuilder, baseUrl?: string):
15168
15649
  * The session token is available as `result.token` (flattened from `data.attributes.token`).
15169
15650
  */
15170
15651
  login: (email: string, password: string, options?: RequestOptions) => Promise<User>;
15652
+ /**
15653
+ * Exchange a refresh token for a new JWT + refresh token pair.
15654
+ *
15655
+ * The old refresh token is revoked on success (token rotation).
15656
+ * Use the new refresh token for subsequent refresh calls.
15657
+ *
15658
+ * @param refreshToken - The refresh token (srt_ prefix) from login or a previous refresh
15659
+ * @returns New token pair with rotated refresh token
15660
+ *
15661
+ * @example
15662
+ * ```typescript
15663
+ * const { token, refresh_token } = await client.identity.refresh(storedRefreshToken);
15664
+ * // Store the new refresh_token for next refresh
15665
+ * // Use token as the new Bearer token
15666
+ * ```
15667
+ */
15668
+ refresh: (refreshToken: string, options?: RequestOptions) => Promise<RefreshResponse>;
15171
15669
  /**
15172
15670
  * Register a new user account — returns the newly created user.
15173
15671
  * The session token is available as `result.token` (flattened from `data.attributes.token`).
@@ -18200,6 +18698,35 @@ interface FullscriptSessionGrant {
18200
18698
  expires_at: string;
18201
18699
  patient_id: string;
18202
18700
  }
18701
+ interface FullscriptTreatmentPlan {
18702
+ id: string;
18703
+ state: string;
18704
+ recommendations?: Array<{
18705
+ product_id?: string;
18706
+ dosage?: string;
18707
+ variant_id?: string;
18708
+ units_to_purchase?: number;
18709
+ }>;
18710
+ invitation_url?: string;
18711
+ [key: string]: unknown;
18712
+ }
18713
+ interface FullscriptProduct {
18714
+ id: string;
18715
+ name?: string;
18716
+ brand?: string;
18717
+ [key: string]: unknown;
18718
+ }
18719
+ interface FullscriptOrder {
18720
+ id: string;
18721
+ line_items?: Array<{
18722
+ product_id?: string;
18723
+ quantity?: number;
18724
+ }>;
18725
+ item_total?: string;
18726
+ payment_total?: string;
18727
+ msrp_total?: string;
18728
+ [key: string]: unknown;
18729
+ }
18203
18730
  /** Attributes for upserting connector credentials. */
18204
18731
  type UpsertCredentialAttributes = {
18205
18732
  workspace_id: string;
@@ -19556,8 +20083,8 @@ declare function createBillingNamespace(rb: RequestBuilder): {
19556
20083
  /**
19557
20084
  * Feature usage records — per-tenant usage tracking for metered features.
19558
20085
  *
19559
- * Read-only access to usage records that track how many times each tenant
19560
- * has used a feature in the current billing cycle.
20086
+ * Access usage records that track how many times each tenant
20087
+ * has used a feature in the current billing cycle, and increment usage.
19561
20088
  */
19562
20089
  featureUsages: {
19563
20090
  /** List all feature usage records. */
@@ -19566,6 +20093,26 @@ declare function createBillingNamespace(rb: RequestBuilder): {
19566
20093
  get: (id: string, options?: RequestOptions) => Promise<FeatureUsage>;
19567
20094
  /** List usage records for a specific tenant. */
19568
20095
  listByTenant: (tenantId: string, options?: RequestOptions) => Promise<FeatureUsage[]>;
20096
+ /**
20097
+ * Increment usage for a feature by key.
20098
+ *
20099
+ * Checks feature gate, enforces limits, charges credits for credit_cost
20100
+ * features, and atomically increments the usage counter. Returns the
20101
+ * updated usage count and remaining allowance.
20102
+ *
20103
+ * @param featureKey - The feature definition key (e.g., "meal_plans", "clients")
20104
+ * @returns Object with `used` (current cycle count) and `remaining` (null if unlimited)
20105
+ *
20106
+ * @example
20107
+ * ```typescript
20108
+ * const result = await client.billing.featureUsages.increment("meal_plans");
20109
+ * console.log(`Used: ${result.used}, Remaining: ${result.remaining}`);
20110
+ * ```
20111
+ */
20112
+ increment: (featureKey: string, options?: RequestOptions) => Promise<{
20113
+ used: number;
20114
+ remaining: number | null;
20115
+ }>;
19569
20116
  };
19570
20117
  /**
19571
20118
  * Plan-feature allocations — per-plan overrides for feature definitions (read-only).
@@ -20243,7 +20790,7 @@ type CreateAgentAttributes = {
20243
20790
  type CreateAgentVersionAttributes = {
20244
20791
  agent_id: string;
20245
20792
  prompt_template?: unknown;
20246
- version_number: string;
20793
+ version_number?: number;
20247
20794
  changes_summary?: string;
20248
20795
  output_schema?: Record<string, unknown>;
20249
20796
  input_schema?: Record<string, unknown>;
@@ -20302,9 +20849,12 @@ interface Execution {
20302
20849
  total_credits_charged: string | null;
20303
20850
  model_used: string | null;
20304
20851
  requested_model_id: string | null;
20852
+ execution_mode: string | null;
20853
+ error: Record<string, unknown> | null;
20305
20854
  started_at: string | null;
20306
20855
  completed_at: string | null;
20307
20856
  created_at: string;
20857
+ updated_at: string;
20308
20858
  }
20309
20859
  /**
20310
20860
  * Creates the `agents` namespace, providing methods for managing AI agents,
@@ -21308,7 +21858,8 @@ declare function createAgentsNamespace(rb: RequestBuilder): {
21308
21858
  * @param agentId - The UUID of the agent to execute.
21309
21859
  * @param input - Input data for the agent (task description, documents, etc.).
21310
21860
  * @param opts - Additional execution options.
21311
- * @param opts.workspace_id - The workspace to execute in. Required for `sk_app_` key auth.
21861
+ * @param opts.workspace_id - The workspace to execute in. **Required** unless
21862
+ * `workspaceId` was set in the `GptClient` constructor config.
21312
21863
  * @param opts.model_id - Override model for this execution only (e.g., "anthropic/claude-sonnet-4").
21313
21864
  * Highest priority in the model resolution chain.
21314
21865
  * @returns The created execution record with status `pending`.
@@ -21559,8 +22110,8 @@ declare function createAgentsNamespace(rb: RequestBuilder): {
21559
22110
  interface AuditLog {
21560
22111
  id: string;
21561
22112
  action: string;
21562
- resource_type: string | null;
21563
- resource_id: string | null;
22113
+ resource_type: string;
22114
+ resource_id: string;
21564
22115
  changes: Record<string, unknown> | null;
21565
22116
  target_type: string | null;
21566
22117
  target_id: string | null;
@@ -21607,6 +22158,7 @@ interface CreateClinicalPatientAttributes {
21607
22158
  timezone?: string;
21608
22159
  state?: string;
21609
22160
  tags?: string[];
22161
+ metadata?: Record<string, unknown>;
21610
22162
  }
21611
22163
  interface UpdateClinicalPatientAttributes {
21612
22164
  contact_id?: string;
@@ -21617,6 +22169,7 @@ interface UpdateClinicalPatientAttributes {
21617
22169
  tags?: string[];
21618
22170
  followup_interval_value?: number;
21619
22171
  followup_interval_unit?: string;
22172
+ metadata?: Record<string, unknown>;
21620
22173
  }
21621
22174
  interface CreateClinicalSessionAttributes {
21622
22175
  workspace_id: string;
@@ -21632,6 +22185,8 @@ interface CreateClinicalSessionAttributes {
21632
22185
  session_summary?: string;
21633
22186
  notes?: string;
21634
22187
  external_ids?: Record<string, string>;
22188
+ prep_execution_id?: string;
22189
+ metadata?: Record<string, unknown>;
21635
22190
  }
21636
22191
  interface UpdateClinicalSessionAttributes {
21637
22192
  practitioner_id?: string;
@@ -21646,6 +22201,8 @@ interface UpdateClinicalSessionAttributes {
21646
22201
  session_summary?: string;
21647
22202
  notes?: string;
21648
22203
  external_ids?: Record<string, string>;
22204
+ prep_execution_id?: string;
22205
+ metadata?: Record<string, unknown>;
21649
22206
  }
21650
22207
  interface CreateClinicalNoteAttributes {
21651
22208
  workspace_id: string;
@@ -21653,11 +22210,13 @@ interface CreateClinicalNoteAttributes {
21653
22210
  pipeline_execution_id?: string;
21654
22211
  note_type?: string;
21655
22212
  note_content?: string;
22213
+ metadata?: Record<string, unknown>;
21656
22214
  }
21657
22215
  interface UpdateClinicalNoteAttributes {
21658
22216
  pipeline_execution_id?: string;
21659
22217
  note_type?: string;
21660
22218
  note_content?: string;
22219
+ metadata?: Record<string, unknown>;
21661
22220
  }
21662
22221
  interface CreateHealthMetricAttributes {
21663
22222
  workspace_id: string;
@@ -21674,6 +22233,7 @@ interface CreateHealthMetricAttributes {
21674
22233
  extracted_from?: string;
21675
22234
  confidence?: number;
21676
22235
  raw_extract?: string;
22236
+ metadata?: Record<string, unknown>;
21677
22237
  }
21678
22238
  interface UpdateHealthMetricAttributes {
21679
22239
  metric_type?: string;
@@ -21684,6 +22244,7 @@ interface UpdateHealthMetricAttributes {
21684
22244
  measured_at?: string;
21685
22245
  source?: string;
21686
22246
  confidence?: number;
22247
+ metadata?: Record<string, unknown>;
21687
22248
  }
21688
22249
  interface CreateMealPlanAttributes {
21689
22250
  workspace_id: string;
@@ -21798,11 +22359,13 @@ interface CreateDeliveryAttributes {
21798
22359
  included_supplement_ids?: string[];
21799
22360
  included_resource_ids?: string[];
21800
22361
  delivered_at?: string;
22362
+ metadata?: Record<string, unknown>;
21801
22363
  }
21802
22364
  interface UpdateDeliveryAttributes {
21803
22365
  status?: string;
21804
22366
  delivered_at?: string;
21805
22367
  email_message_id?: string;
22368
+ metadata?: Record<string, unknown>;
21806
22369
  }
21807
22370
  interface CreatePracticeResourceAttributes {
21808
22371
  workspace_id: string;
@@ -21871,6 +22434,7 @@ interface CreatePracticeToolAttributes {
21871
22434
  rating?: string;
21872
22435
  privacy_rating?: "hipaa_compliant" | "hipaa_partial" | "standard" | "unknown";
21873
22436
  tags?: string[];
22437
+ metadata?: Record<string, unknown>;
21874
22438
  }
21875
22439
  interface UpdatePracticeToolAttributes {
21876
22440
  name?: string;
@@ -21891,6 +22455,7 @@ interface UpdatePracticeToolAttributes {
21891
22455
  rating?: string;
21892
22456
  privacy_rating?: "hipaa_compliant" | "hipaa_partial" | "standard" | "unknown";
21893
22457
  tags?: string[];
22458
+ metadata?: Record<string, unknown>;
21894
22459
  }
21895
22460
  /** Parameters for listing practice tools. */
21896
22461
  interface ListPracticeToolsParams {
@@ -21920,11 +22485,13 @@ interface CreateClientResourceAssignmentAttributes {
21920
22485
  status?: string;
21921
22486
  assigned_at?: string;
21922
22487
  notes?: string;
22488
+ metadata?: Record<string, unknown>;
21923
22489
  }
21924
22490
  interface UpdateClientResourceAssignmentAttributes {
21925
22491
  status?: string;
21926
22492
  completed_at?: string;
21927
22493
  notes?: string;
22494
+ metadata?: Record<string, unknown>;
21928
22495
  }
21929
22496
  interface TriggerPipelineResponse {
21930
22497
  execution_id: string | null;
@@ -22027,6 +22594,46 @@ interface RecipeSearchParams {
22027
22594
  interface GenerateSupplementRecsResponse {
22028
22595
  execution_id: string | null;
22029
22596
  }
22597
+ /** Result of a tag rename operation. */
22598
+ interface TagRenameResult {
22599
+ updated_count: number;
22600
+ }
22601
+ /** Result of a tag delete operation. */
22602
+ interface TagDeleteResult {
22603
+ updated_count: number;
22604
+ }
22605
+ /** Result of a tag merge operation. */
22606
+ interface TagMergeResult {
22607
+ updated_count: number;
22608
+ }
22609
+ /** Duplicate detection statistics for a resource type in a workspace. */
22610
+ interface DuplicateStats {
22611
+ total_resources: number;
22612
+ duplicate_groups: number;
22613
+ affected_resources: number;
22614
+ }
22615
+ /** A group of duplicate resources identified by similarity. */
22616
+ interface DuplicateGroup {
22617
+ group_id: string;
22618
+ resource_ids: string[];
22619
+ match_type: string;
22620
+ confidence: number;
22621
+ sample_title: string;
22622
+ count: number;
22623
+ }
22624
+ /** Result of resolving a duplicate group. */
22625
+ interface DuplicateResolveResult {
22626
+ kept: string;
22627
+ archived: string[];
22628
+ }
22629
+ interface ClinicalSearchResult {
22630
+ type: string;
22631
+ id: string;
22632
+ attributes: Record<string, unknown>;
22633
+ meta: {
22634
+ similarity: number;
22635
+ };
22636
+ }
22030
22637
  /**
22031
22638
  * Clinical namespace — patient management, sessions, notes, health data, and care plans.
22032
22639
  *
@@ -22210,7 +22817,7 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
22210
22817
  getAdherence: (patientId: string, workspaceId: string, days?: number, options?: RequestOptions) => Promise<PatientAdherenceResponse>;
22211
22818
  };
22212
22819
  /**
22213
- * Manage clinical sessions (practitionerpatient encounters).
22820
+ * Manage clinical sessions (practitioner-patient encounters).
22214
22821
  */
22215
22822
  sessions: {
22216
22823
  /**
@@ -22333,13 +22940,47 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
22333
22940
  */
22334
22941
  update: (id: string, attributes: UpdateClinicalNoteAttributes, options?: RequestOptions) => Promise<ClinicalNote>;
22335
22942
  /**
22336
- * Delete a clinical note.
22943
+ * Archive (soft-delete) a note.
22337
22944
  *
22945
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
22946
+ * Use `permanentDelete()` for irreversible removal.
22338
22947
  * @param id - Note UUID
22339
22948
  * @param options - Request options
22340
- * @returns `true` on successful deletion
22949
+ * @returns Archived {@link ClinicalNote} record
22341
22950
  */
22342
- delete: (id: string, options?: RequestOptions) => Promise<true>;
22951
+ delete: (id: string, options?: RequestOptions) => Promise<ClinicalNote>;
22952
+ /**
22953
+ * Archive (soft-delete) a note.
22954
+ *
22955
+ * @param id - Note UUID
22956
+ * @param options - Request options
22957
+ * @returns Archived {@link ClinicalNote} record
22958
+ */
22959
+ archive: (id: string, options?: RequestOptions) => Promise<ClinicalNote>;
22960
+ /**
22961
+ * Restore an archived note.
22962
+ *
22963
+ * @param id - Note UUID
22964
+ * @param options - Request options
22965
+ * @returns Restored {@link ClinicalNote} record
22966
+ */
22967
+ restore: (id: string, options?: RequestOptions) => Promise<ClinicalNote>;
22968
+ /**
22969
+ * Permanently delete a note. Irreversible.
22970
+ *
22971
+ * @param id - Note UUID
22972
+ * @param options - Request options
22973
+ * @returns `true` on success
22974
+ */
22975
+ permanentDelete: (id: string, options?: RequestOptions) => Promise<true>;
22976
+ /**
22977
+ * List archived (soft-deleted) notes.
22978
+ *
22979
+ * @param params - Filter/pagination parameters
22980
+ * @param options - Request options
22981
+ * @returns Array of archived {@link ClinicalNote} records
22982
+ */
22983
+ listArchived: (params?: Record<string, unknown>, options?: RequestOptions) => Promise<ClinicalNote[]>;
22343
22984
  /**
22344
22985
  * Approve a clinical note (HITL workflow).
22345
22986
  *
@@ -22448,13 +23089,47 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
22448
23089
  */
22449
23090
  update: (id: string, attributes: UpdateHealthMetricAttributes, options?: RequestOptions) => Promise<ClinicalHealthMetric>;
22450
23091
  /**
22451
- * Delete a health metric entry.
23092
+ * Archive (soft-delete) a health metric.
22452
23093
  *
23094
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
23095
+ * Use `permanentDelete()` for irreversible removal.
22453
23096
  * @param id - HealthMetric UUID
22454
23097
  * @param options - Request options
22455
- * @returns `true` on successful deletion
23098
+ * @returns Archived {@link ClinicalHealthMetric} record
22456
23099
  */
22457
- delete: (id: string, options?: RequestOptions) => Promise<true>;
23100
+ delete: (id: string, options?: RequestOptions) => Promise<ClinicalHealthMetric>;
23101
+ /**
23102
+ * Archive (soft-delete) a health metric.
23103
+ *
23104
+ * @param id - HealthMetric UUID
23105
+ * @param options - Request options
23106
+ * @returns Archived {@link ClinicalHealthMetric} record
23107
+ */
23108
+ archive: (id: string, options?: RequestOptions) => Promise<ClinicalHealthMetric>;
23109
+ /**
23110
+ * Restore an archived health metric.
23111
+ *
23112
+ * @param id - HealthMetric UUID
23113
+ * @param options - Request options
23114
+ * @returns Restored {@link ClinicalHealthMetric} record
23115
+ */
23116
+ restore: (id: string, options?: RequestOptions) => Promise<ClinicalHealthMetric>;
23117
+ /**
23118
+ * Permanently delete a health metric. Irreversible.
23119
+ *
23120
+ * @param id - HealthMetric UUID
23121
+ * @param options - Request options
23122
+ * @returns `true` on success
23123
+ */
23124
+ permanentDelete: (id: string, options?: RequestOptions) => Promise<true>;
23125
+ /**
23126
+ * List archived (soft-deleted) health metrics.
23127
+ *
23128
+ * @param params - Filter/pagination parameters
23129
+ * @param options - Request options
23130
+ * @returns Array of archived {@link ClinicalHealthMetric} records
23131
+ */
23132
+ listArchived: (params?: Record<string, unknown>, options?: RequestOptions) => Promise<ClinicalHealthMetric[]>;
22458
23133
  };
22459
23134
  /**
22460
23135
  * Manage meal plans for clinical patients.
@@ -22494,13 +23169,47 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
22494
23169
  */
22495
23170
  update: (id: string, attributes: UpdateMealPlanAttributes, options?: RequestOptions) => Promise<ClinicalMealPlan>;
22496
23171
  /**
22497
- * Delete a meal plan.
23172
+ * Archive (soft-delete) a meal plan.
22498
23173
  *
23174
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
23175
+ * Use `permanentDelete()` for irreversible removal.
22499
23176
  * @param id - MealPlan UUID
22500
23177
  * @param options - Request options
22501
- * @returns `true` on successful deletion
23178
+ * @returns Archived {@link ClinicalMealPlan} record
22502
23179
  */
22503
- delete: (id: string, options?: RequestOptions) => Promise<true>;
23180
+ delete: (id: string, options?: RequestOptions) => Promise<ClinicalMealPlan>;
23181
+ /**
23182
+ * Archive (soft-delete) a meal plan.
23183
+ *
23184
+ * @param id - MealPlan UUID
23185
+ * @param options - Request options
23186
+ * @returns Archived {@link ClinicalMealPlan} record
23187
+ */
23188
+ archive: (id: string, options?: RequestOptions) => Promise<ClinicalMealPlan>;
23189
+ /**
23190
+ * Restore an archived meal plan.
23191
+ *
23192
+ * @param id - MealPlan UUID
23193
+ * @param options - Request options
23194
+ * @returns Restored {@link ClinicalMealPlan} record
23195
+ */
23196
+ restore: (id: string, options?: RequestOptions) => Promise<ClinicalMealPlan>;
23197
+ /**
23198
+ * Permanently delete a meal plan. Irreversible.
23199
+ *
23200
+ * @param id - MealPlan UUID
23201
+ * @param options - Request options
23202
+ * @returns `true` on success
23203
+ */
23204
+ permanentDelete: (id: string, options?: RequestOptions) => Promise<true>;
23205
+ /**
23206
+ * List archived (soft-deleted) meal plans.
23207
+ *
23208
+ * @param params - Filter/pagination parameters
23209
+ * @param options - Request options
23210
+ * @returns Array of archived {@link ClinicalMealPlan} records
23211
+ */
23212
+ listArchived: (params?: Record<string, unknown>, options?: RequestOptions) => Promise<ClinicalMealPlan[]>;
22504
23213
  };
22505
23214
  /**
22506
23215
  * Manage client goals (therapeutic targets and wellness milestones).
@@ -22538,15 +23247,49 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
22538
23247
  * @param options - Request options
22539
23248
  * @returns Updated {@link ClinicalClientGoal} record
22540
23249
  */
22541
- update: (id: string, attributes: UpdateClientGoalAttributes, options?: RequestOptions) => Promise<ClinicalClientGoal>;
23250
+ update: (id: string, attributes: UpdateClientGoalAttributes, options?: RequestOptions) => Promise<ClinicalClientGoal>;
23251
+ /**
23252
+ * Archive (soft-delete) a client goal.
23253
+ *
23254
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
23255
+ * Use `permanentDelete()` for irreversible removal.
23256
+ * @param id - ClientGoal UUID
23257
+ * @param options - Request options
23258
+ * @returns Archived {@link ClinicalClientGoal} record
23259
+ */
23260
+ delete: (id: string, options?: RequestOptions) => Promise<ClinicalClientGoal>;
23261
+ /**
23262
+ * Archive (soft-delete) a client goal.
23263
+ *
23264
+ * @param id - ClientGoal UUID
23265
+ * @param options - Request options
23266
+ * @returns Archived {@link ClinicalClientGoal} record
23267
+ */
23268
+ archive: (id: string, options?: RequestOptions) => Promise<ClinicalClientGoal>;
23269
+ /**
23270
+ * Restore an archived client goal.
23271
+ *
23272
+ * @param id - ClientGoal UUID
23273
+ * @param options - Request options
23274
+ * @returns Restored {@link ClinicalClientGoal} record
23275
+ */
23276
+ restore: (id: string, options?: RequestOptions) => Promise<ClinicalClientGoal>;
23277
+ /**
23278
+ * Permanently delete a client goal. Irreversible.
23279
+ *
23280
+ * @param id - ClientGoal UUID
23281
+ * @param options - Request options
23282
+ * @returns `true` on success
23283
+ */
23284
+ permanentDelete: (id: string, options?: RequestOptions) => Promise<true>;
22542
23285
  /**
22543
- * Delete a client goal.
23286
+ * List archived (soft-deleted) client goals.
22544
23287
  *
22545
- * @param id - ClientGoal UUID
23288
+ * @param params - Filter/pagination parameters
22546
23289
  * @param options - Request options
22547
- * @returns `true` on successful deletion
23290
+ * @returns Array of archived {@link ClinicalClientGoal} records
22548
23291
  */
22549
- delete: (id: string, options?: RequestOptions) => Promise<true>;
23292
+ listArchived: (params?: Record<string, unknown>, options?: RequestOptions) => Promise<ClinicalClientGoal[]>;
22550
23293
  /**
22551
23294
  * Batch reorder client goals by updating their positions.
22552
23295
  *
@@ -22604,13 +23347,47 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
22604
23347
  */
22605
23348
  update: (id: string, attributes: UpdateClientSupplementAttributes, options?: RequestOptions) => Promise<ClinicalClientSupplement>;
22606
23349
  /**
22607
- * Delete a supplement prescription.
23350
+ * Archive (soft-delete) a supplement prescription.
22608
23351
  *
23352
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
23353
+ * Use `permanentDelete()` for irreversible removal.
22609
23354
  * @param id - ClientSupplement UUID
22610
23355
  * @param options - Request options
22611
- * @returns `true` on successful deletion
23356
+ * @returns Archived {@link ClinicalClientSupplement} record
22612
23357
  */
22613
- delete: (id: string, options?: RequestOptions) => Promise<true>;
23358
+ delete: (id: string, options?: RequestOptions) => Promise<ClinicalClientSupplement>;
23359
+ /**
23360
+ * Archive (soft-delete) a supplement prescription.
23361
+ *
23362
+ * @param id - ClientSupplement UUID
23363
+ * @param options - Request options
23364
+ * @returns Archived {@link ClinicalClientSupplement} record
23365
+ */
23366
+ archive: (id: string, options?: RequestOptions) => Promise<ClinicalClientSupplement>;
23367
+ /**
23368
+ * Restore an archived supplement prescription.
23369
+ *
23370
+ * @param id - ClientSupplement UUID
23371
+ * @param options - Request options
23372
+ * @returns Restored {@link ClinicalClientSupplement} record
23373
+ */
23374
+ restore: (id: string, options?: RequestOptions) => Promise<ClinicalClientSupplement>;
23375
+ /**
23376
+ * Permanently delete a supplement prescription. Irreversible.
23377
+ *
23378
+ * @param id - ClientSupplement UUID
23379
+ * @param options - Request options
23380
+ * @returns `true` on success
23381
+ */
23382
+ permanentDelete: (id: string, options?: RequestOptions) => Promise<true>;
23383
+ /**
23384
+ * List archived (soft-deleted) supplement prescriptions.
23385
+ *
23386
+ * @param params - Filter/pagination parameters
23387
+ * @param options - Request options
23388
+ * @returns Array of archived {@link ClinicalClientSupplement} records
23389
+ */
23390
+ listArchived: (params?: Record<string, unknown>, options?: RequestOptions) => Promise<ClinicalClientSupplement[]>;
22614
23391
  };
22615
23392
  /**
22616
23393
  * Manage clinical deliveries (care plan items sent to patients).
@@ -22689,13 +23466,47 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
22689
23466
  */
22690
23467
  update: (id: string, attributes: UpdatePracticeResourceAttributes, options?: RequestOptions) => Promise<ClinicalPracticeResource>;
22691
23468
  /**
22692
- * Delete a practice resource.
23469
+ * Archive (soft-delete) a practice resource.
22693
23470
  *
23471
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
23472
+ * Use `permanentDelete()` for irreversible removal.
22694
23473
  * @param id - PracticeResource UUID
22695
23474
  * @param options - Request options
22696
- * @returns `true` on successful deletion
23475
+ * @returns Archived {@link ClinicalPracticeResource} record
22697
23476
  */
22698
- delete: (id: string, options?: RequestOptions) => Promise<true>;
23477
+ delete: (id: string, options?: RequestOptions) => Promise<ClinicalPracticeResource>;
23478
+ /**
23479
+ * Archive (soft-delete) a practice resource.
23480
+ *
23481
+ * @param id - PracticeResource UUID
23482
+ * @param options - Request options
23483
+ * @returns Archived {@link ClinicalPracticeResource} record
23484
+ */
23485
+ archive: (id: string, options?: RequestOptions) => Promise<ClinicalPracticeResource>;
23486
+ /**
23487
+ * Restore an archived practice resource.
23488
+ *
23489
+ * @param id - PracticeResource UUID
23490
+ * @param options - Request options
23491
+ * @returns Restored {@link ClinicalPracticeResource} record
23492
+ */
23493
+ restore: (id: string, options?: RequestOptions) => Promise<ClinicalPracticeResource>;
23494
+ /**
23495
+ * Permanently delete a practice resource. Irreversible.
23496
+ *
23497
+ * @param id - PracticeResource UUID
23498
+ * @param options - Request options
23499
+ * @returns `true` on success
23500
+ */
23501
+ permanentDelete: (id: string, options?: RequestOptions) => Promise<true>;
23502
+ /**
23503
+ * List archived (soft-deleted) practice resources.
23504
+ *
23505
+ * @param params - Filter/pagination parameters
23506
+ * @param options - Request options
23507
+ * @returns Array of archived {@link ClinicalPracticeResource} records
23508
+ */
23509
+ listArchived: (params?: Record<string, unknown>, options?: RequestOptions) => Promise<ClinicalPracticeResource[]>;
22699
23510
  /**
22700
23511
  * List application-level catalog practice resources.
22701
23512
  *
@@ -22707,6 +23518,38 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
22707
23518
  filter?: Record<string, unknown>;
22708
23519
  sort?: string;
22709
23520
  }, options?: RequestOptions) => Promise<ClinicalPracticeResource[]>;
23521
+ /**
23522
+ * Archive (soft-delete) a catalog practice resource.
23523
+ *
23524
+ * @param id - PracticeResource UUID
23525
+ * @param options - Request options
23526
+ * @returns Archived {@link ClinicalPracticeResource} record
23527
+ */
23528
+ archiveCatalog: (id: string, options?: RequestOptions) => Promise<ClinicalPracticeResource>;
23529
+ /**
23530
+ * Restore an archived catalog practice resource.
23531
+ *
23532
+ * @param id - PracticeResource UUID
23533
+ * @param options - Request options
23534
+ * @returns Restored {@link ClinicalPracticeResource} record
23535
+ */
23536
+ restoreCatalog: (id: string, options?: RequestOptions) => Promise<ClinicalPracticeResource>;
23537
+ /**
23538
+ * Permanently delete a catalog practice resource. Irreversible.
23539
+ *
23540
+ * @param id - PracticeResource UUID
23541
+ * @param options - Request options
23542
+ * @returns `true` on success
23543
+ */
23544
+ permanentDeleteCatalog: (id: string, options?: RequestOptions) => Promise<true>;
23545
+ /**
23546
+ * List archived (soft-deleted) catalog practice resources.
23547
+ *
23548
+ * @param params - Filter/pagination parameters
23549
+ * @param options - Request options
23550
+ * @returns Array of archived {@link ClinicalPracticeResource} catalog records
23551
+ */
23552
+ listArchivedCatalog: (params?: Record<string, unknown>, options?: RequestOptions) => Promise<ClinicalPracticeResource[]>;
22710
23553
  /**
22711
23554
  * List distinct practice resource categories in a workspace.
22712
23555
  *
@@ -22743,6 +23586,45 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
22743
23586
  * ```
22744
23587
  */
22745
23588
  listCatalogCategories: (options?: RequestOptions) => Promise<PracticeResourceCategory[]>;
23589
+ tags: {
23590
+ rename: (workspaceId: string, oldTag: string, newTag: string, options?: RequestOptions) => Promise<TagRenameResult>;
23591
+ delete: (workspaceId: string, tag: string, options?: RequestOptions) => Promise<TagDeleteResult>;
23592
+ merge: (workspaceId: string, sourceTags: string[], targetTag: string, options?: RequestOptions) => Promise<TagMergeResult>;
23593
+ };
23594
+ imports: {
23595
+ fromFile: (workspaceId: string, file: File | Blob, options?: RequestOptions) => Promise<Record<string, unknown>>;
23596
+ fromUrl: (workspaceId: string, url: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
23597
+ };
23598
+ duplicates: {
23599
+ getStats: (workspaceId: string, options?: RequestOptions) => Promise<DuplicateStats>;
23600
+ listGroups: (workspaceId: string, opts?: {
23601
+ threshold?: number;
23602
+ limit?: number;
23603
+ }, options?: RequestOptions) => Promise<DuplicateGroup[]>;
23604
+ resolve: (workspaceId: string, groupId: string, keepId: string, options?: RequestOptions) => Promise<DuplicateResolveResult>;
23605
+ };
23606
+ /**
23607
+ * Search practice resources using semantic similarity.
23608
+ * Finds resources matching the query by meaning, not just keywords.
23609
+ *
23610
+ * @param workspaceId - The workspace to search in
23611
+ * @param params - Search parameters
23612
+ * @param params.query - Free-text search query
23613
+ * @param params.limit - Maximum results to return (default: 10)
23614
+ * @returns Array of matching practice resources with similarity scores
23615
+ *
23616
+ * @example
23617
+ * ```typescript
23618
+ * const results = await client.clinical.practiceResources.search(workspaceId, {
23619
+ * query: "diabetes management patient education",
23620
+ * limit: 5,
23621
+ * });
23622
+ * ```
23623
+ */
23624
+ search: (workspaceId: string, params: {
23625
+ query: string;
23626
+ limit?: number;
23627
+ }, options?: RequestOptions) => Promise<ClinicalSearchResult[]>;
22746
23628
  };
22747
23629
  /**
22748
23630
  * Manage practice-level assessment and therapeutic tools.
@@ -22782,13 +23664,47 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
22782
23664
  */
22783
23665
  update: (id: string, attributes: UpdatePracticeToolAttributes, options?: RequestOptions) => Promise<ClinicalPracticeTool>;
22784
23666
  /**
22785
- * Delete a practice tool.
23667
+ * Archive (soft-delete) a practice tool.
22786
23668
  *
23669
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
23670
+ * Use `permanentDelete()` for irreversible removal.
22787
23671
  * @param id - PracticeTool UUID
22788
23672
  * @param options - Request options
22789
- * @returns `true` on successful deletion
23673
+ * @returns Archived {@link ClinicalPracticeTool} record
22790
23674
  */
22791
- delete: (id: string, options?: RequestOptions) => Promise<true>;
23675
+ delete: (id: string, options?: RequestOptions) => Promise<ClinicalPracticeTool>;
23676
+ /**
23677
+ * Archive (soft-delete) a practice tool.
23678
+ *
23679
+ * @param id - PracticeTool UUID
23680
+ * @param options - Request options
23681
+ * @returns Archived {@link ClinicalPracticeTool} record
23682
+ */
23683
+ archive: (id: string, options?: RequestOptions) => Promise<ClinicalPracticeTool>;
23684
+ /**
23685
+ * Restore an archived practice tool.
23686
+ *
23687
+ * @param id - PracticeTool UUID
23688
+ * @param options - Request options
23689
+ * @returns Restored {@link ClinicalPracticeTool} record
23690
+ */
23691
+ restore: (id: string, options?: RequestOptions) => Promise<ClinicalPracticeTool>;
23692
+ /**
23693
+ * Permanently delete a practice tool. Irreversible.
23694
+ *
23695
+ * @param id - PracticeTool UUID
23696
+ * @param options - Request options
23697
+ * @returns `true` on success
23698
+ */
23699
+ permanentDelete: (id: string, options?: RequestOptions) => Promise<true>;
23700
+ /**
23701
+ * List archived (soft-deleted) practice tools.
23702
+ *
23703
+ * @param params - Filter/pagination parameters
23704
+ * @param options - Request options
23705
+ * @returns Array of archived {@link ClinicalPracticeTool} records
23706
+ */
23707
+ listArchived: (params?: Record<string, unknown>, options?: RequestOptions) => Promise<ClinicalPracticeTool[]>;
22792
23708
  /**
22793
23709
  * List distinct practice tool categories in a workspace.
22794
23710
  *
@@ -22821,6 +23737,38 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
22821
23737
  filter?: Record<string, unknown>;
22822
23738
  sort?: string;
22823
23739
  }, options?: RequestOptions) => Promise<ClinicalPracticeTool[]>;
23740
+ /**
23741
+ * Archive (soft-delete) a catalog practice tool.
23742
+ *
23743
+ * @param id - PracticeTool UUID
23744
+ * @param options - Request options
23745
+ * @returns Archived {@link ClinicalPracticeTool} record
23746
+ */
23747
+ archiveCatalog: (id: string, options?: RequestOptions) => Promise<ClinicalPracticeTool>;
23748
+ /**
23749
+ * Restore an archived catalog practice tool.
23750
+ *
23751
+ * @param id - PracticeTool UUID
23752
+ * @param options - Request options
23753
+ * @returns Restored {@link ClinicalPracticeTool} record
23754
+ */
23755
+ restoreCatalog: (id: string, options?: RequestOptions) => Promise<ClinicalPracticeTool>;
23756
+ /**
23757
+ * Permanently delete a catalog practice tool. Irreversible.
23758
+ *
23759
+ * @param id - PracticeTool UUID
23760
+ * @param options - Request options
23761
+ * @returns `true` on success
23762
+ */
23763
+ permanentDeleteCatalog: (id: string, options?: RequestOptions) => Promise<true>;
23764
+ /**
23765
+ * List archived (soft-deleted) catalog practice tools.
23766
+ *
23767
+ * @param params - Filter/pagination parameters
23768
+ * @param options - Request options
23769
+ * @returns Array of archived {@link ClinicalPracticeTool} catalog records
23770
+ */
23771
+ listArchivedCatalog: (params?: Record<string, unknown>, options?: RequestOptions) => Promise<ClinicalPracticeTool[]>;
22824
23772
  /**
22825
23773
  * List distinct catalog practice tool categories.
22826
23774
  *
@@ -22836,6 +23784,44 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
22836
23784
  * ```
22837
23785
  */
22838
23786
  listCatalogCategories: (options?: RequestOptions) => Promise<PracticeToolCategory[]>;
23787
+ tags: {
23788
+ rename: (workspaceId: string, oldTag: string, newTag: string, options?: RequestOptions) => Promise<TagRenameResult>;
23789
+ delete: (workspaceId: string, tag: string, options?: RequestOptions) => Promise<TagDeleteResult>;
23790
+ merge: (workspaceId: string, sourceTags: string[], targetTag: string, options?: RequestOptions) => Promise<TagMergeResult>;
23791
+ };
23792
+ imports: {
23793
+ fromFile: (workspaceId: string, file: File | Blob, options?: RequestOptions) => Promise<Record<string, unknown>>;
23794
+ fromUrl: (workspaceId: string, url: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
23795
+ };
23796
+ duplicates: {
23797
+ getStats: (workspaceId: string, options?: RequestOptions) => Promise<DuplicateStats>;
23798
+ listGroups: (workspaceId: string, opts?: {
23799
+ threshold?: number;
23800
+ limit?: number;
23801
+ }, options?: RequestOptions) => Promise<DuplicateGroup[]>;
23802
+ resolve: (workspaceId: string, groupId: string, keepId: string, options?: RequestOptions) => Promise<DuplicateResolveResult>;
23803
+ };
23804
+ /**
23805
+ * Search practice tools using semantic similarity.
23806
+ *
23807
+ * @param workspaceId - The workspace to search in
23808
+ * @param params - Search parameters
23809
+ * @param params.query - Free-text search query
23810
+ * @param params.limit - Maximum results to return (default: 10)
23811
+ * @returns Array of matching practice tools with similarity scores
23812
+ *
23813
+ * @example
23814
+ * ```typescript
23815
+ * const results = await client.clinical.practiceTools.search(workspaceId, {
23816
+ * query: "stress assessment screening tool",
23817
+ * limit: 5,
23818
+ * });
23819
+ * ```
23820
+ */
23821
+ search: (workspaceId: string, params: {
23822
+ query: string;
23823
+ limit?: number;
23824
+ }, options?: RequestOptions) => Promise<ClinicalSearchResult[]>;
22839
23825
  };
22840
23826
  /**
22841
23827
  * Manage assignments of practice resources to patients.
@@ -22876,13 +23862,47 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
22876
23862
  */
22877
23863
  update: (id: string, attributes: UpdateClientResourceAssignmentAttributes, options?: RequestOptions) => Promise<ClinicalClientResourceAssignment>;
22878
23864
  /**
22879
- * Delete a resource assignment.
23865
+ * Archive (soft-delete) a resource assignment.
22880
23866
  *
23867
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
23868
+ * Use `permanentDelete()` for irreversible removal.
22881
23869
  * @param id - ClientResourceAssignment UUID
22882
23870
  * @param options - Request options
22883
- * @returns `true` on successful deletion
23871
+ * @returns Archived {@link ClinicalClientResourceAssignment} record
22884
23872
  */
22885
- delete: (id: string, options?: RequestOptions) => Promise<true>;
23873
+ delete: (id: string, options?: RequestOptions) => Promise<ClinicalClientResourceAssignment>;
23874
+ /**
23875
+ * Archive (soft-delete) a resource assignment.
23876
+ *
23877
+ * @param id - ClientResourceAssignment UUID
23878
+ * @param options - Request options
23879
+ * @returns Archived {@link ClinicalClientResourceAssignment} record
23880
+ */
23881
+ archive: (id: string, options?: RequestOptions) => Promise<ClinicalClientResourceAssignment>;
23882
+ /**
23883
+ * Restore an archived resource assignment.
23884
+ *
23885
+ * @param id - ClientResourceAssignment UUID
23886
+ * @param options - Request options
23887
+ * @returns Restored {@link ClinicalClientResourceAssignment} record
23888
+ */
23889
+ restore: (id: string, options?: RequestOptions) => Promise<ClinicalClientResourceAssignment>;
23890
+ /**
23891
+ * Permanently delete a resource assignment. Irreversible.
23892
+ *
23893
+ * @param id - ClientResourceAssignment UUID
23894
+ * @param options - Request options
23895
+ * @returns `true` on success
23896
+ */
23897
+ permanentDelete: (id: string, options?: RequestOptions) => Promise<true>;
23898
+ /**
23899
+ * List archived (soft-deleted) resource assignments.
23900
+ *
23901
+ * @param params - Filter/pagination parameters
23902
+ * @param options - Request options
23903
+ * @returns Array of archived {@link ClinicalClientResourceAssignment} records
23904
+ */
23905
+ listArchived: (params?: Record<string, unknown>, options?: RequestOptions) => Promise<ClinicalClientResourceAssignment[]>;
22886
23906
  };
22887
23907
  /**
22888
23908
  * Read-only access to the AI-generated supplement recommendation cache.
@@ -23024,13 +24044,47 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
23024
24044
  */
23025
24045
  update: (id: string, attributes: UpdateGoalTemplateAttributes, options?: RequestOptions) => Promise<ClinicalGoalTemplate>;
23026
24046
  /**
23027
- * Delete a goal template.
24047
+ * Archive (soft-delete) a goal template.
23028
24048
  *
24049
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
24050
+ * Use `permanentDelete()` for irreversible removal.
23029
24051
  * @param id - GoalTemplate UUID
23030
24052
  * @param options - Request options
23031
- * @returns `true` on successful deletion
24053
+ * @returns Archived {@link ClinicalGoalTemplate} record
23032
24054
  */
23033
- delete: (id: string, options?: RequestOptions) => Promise<true>;
24055
+ delete: (id: string, options?: RequestOptions) => Promise<ClinicalGoalTemplate>;
24056
+ /**
24057
+ * Archive (soft-delete) a goal template.
24058
+ *
24059
+ * @param id - GoalTemplate UUID
24060
+ * @param options - Request options
24061
+ * @returns Archived {@link ClinicalGoalTemplate} record
24062
+ */
24063
+ archive: (id: string, options?: RequestOptions) => Promise<ClinicalGoalTemplate>;
24064
+ /**
24065
+ * Restore an archived goal template.
24066
+ *
24067
+ * @param id - GoalTemplate UUID
24068
+ * @param options - Request options
24069
+ * @returns Restored {@link ClinicalGoalTemplate} record
24070
+ */
24071
+ restore: (id: string, options?: RequestOptions) => Promise<ClinicalGoalTemplate>;
24072
+ /**
24073
+ * Permanently delete a goal template. Irreversible.
24074
+ *
24075
+ * @param id - GoalTemplate UUID
24076
+ * @param options - Request options
24077
+ * @returns `true` on success
24078
+ */
24079
+ permanentDelete: (id: string, options?: RequestOptions) => Promise<true>;
24080
+ /**
24081
+ * List archived (soft-deleted) goal templates.
24082
+ *
24083
+ * @param params - Filter/pagination parameters
24084
+ * @param options - Request options
24085
+ * @returns Array of archived {@link ClinicalGoalTemplate} records
24086
+ */
24087
+ listArchived: (params?: Record<string, unknown>, options?: RequestOptions) => Promise<ClinicalGoalTemplate[]>;
23034
24088
  /**
23035
24089
  * List application-level catalog goal templates.
23036
24090
  *
@@ -23042,6 +24096,38 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
23042
24096
  filter?: Record<string, unknown>;
23043
24097
  sort?: string;
23044
24098
  }, options?: RequestOptions) => Promise<ClinicalGoalTemplate[]>;
24099
+ /**
24100
+ * Archive (soft-delete) a catalog goal template.
24101
+ *
24102
+ * @param id - GoalTemplate UUID
24103
+ * @param options - Request options
24104
+ * @returns Archived {@link ClinicalGoalTemplate} record
24105
+ */
24106
+ archiveCatalog: (id: string, options?: RequestOptions) => Promise<ClinicalGoalTemplate>;
24107
+ /**
24108
+ * Restore an archived catalog goal template.
24109
+ *
24110
+ * @param id - GoalTemplate UUID
24111
+ * @param options - Request options
24112
+ * @returns Restored {@link ClinicalGoalTemplate} record
24113
+ */
24114
+ restoreCatalog: (id: string, options?: RequestOptions) => Promise<ClinicalGoalTemplate>;
24115
+ /**
24116
+ * Permanently delete a catalog goal template. Irreversible.
24117
+ *
24118
+ * @param id - GoalTemplate UUID
24119
+ * @param options - Request options
24120
+ * @returns `true` on success
24121
+ */
24122
+ permanentDeleteCatalog: (id: string, options?: RequestOptions) => Promise<true>;
24123
+ /**
24124
+ * List archived (soft-deleted) catalog goal templates.
24125
+ *
24126
+ * @param params - Filter/pagination parameters
24127
+ * @param options - Request options
24128
+ * @returns Array of archived {@link ClinicalGoalTemplate} catalog records
24129
+ */
24130
+ listArchivedCatalog: (params?: Record<string, unknown>, options?: RequestOptions) => Promise<ClinicalGoalTemplate[]>;
23045
24131
  /**
23046
24132
  * List distinct catalog goal template categories.
23047
24133
  *
@@ -23057,6 +24143,44 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
23057
24143
  * ```
23058
24144
  */
23059
24145
  listCatalogCategories: (options?: RequestOptions) => Promise<ClinicalGoalTemplateCategory[]>;
24146
+ tags: {
24147
+ rename: (workspaceId: string, oldTag: string, newTag: string, options?: RequestOptions) => Promise<TagRenameResult>;
24148
+ delete: (workspaceId: string, tag: string, options?: RequestOptions) => Promise<TagDeleteResult>;
24149
+ merge: (workspaceId: string, sourceTags: string[], targetTag: string, options?: RequestOptions) => Promise<TagMergeResult>;
24150
+ };
24151
+ imports: {
24152
+ fromFile: (workspaceId: string, file: File | Blob, options?: RequestOptions) => Promise<Record<string, unknown>>;
24153
+ fromUrl: (workspaceId: string, url: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
24154
+ };
24155
+ duplicates: {
24156
+ getStats: (workspaceId: string, options?: RequestOptions) => Promise<DuplicateStats>;
24157
+ listGroups: (workspaceId: string, opts?: {
24158
+ threshold?: number;
24159
+ limit?: number;
24160
+ }, options?: RequestOptions) => Promise<DuplicateGroup[]>;
24161
+ resolve: (workspaceId: string, groupId: string, keepId: string, options?: RequestOptions) => Promise<DuplicateResolveResult>;
24162
+ };
24163
+ /**
24164
+ * Search goal templates using semantic similarity.
24165
+ *
24166
+ * @param workspaceId - The workspace to search in
24167
+ * @param params - Search parameters
24168
+ * @param params.query - Free-text search query
24169
+ * @param params.limit - Maximum results to return (default: 10)
24170
+ * @returns Array of matching goal templates with similarity scores
24171
+ *
24172
+ * @example
24173
+ * ```typescript
24174
+ * const results = await client.clinical.goalTemplates.search(workspaceId, {
24175
+ * query: "improve sleep quality and duration",
24176
+ * limit: 5,
24177
+ * });
24178
+ * ```
24179
+ */
24180
+ search: (workspaceId: string, params: {
24181
+ query: string;
24182
+ limit?: number;
24183
+ }, options?: RequestOptions) => Promise<ClinicalSearchResult[]>;
23060
24184
  };
23061
24185
  /**
23062
24186
  * Recipe search via configured Edamam connector.
@@ -23334,6 +24458,10 @@ declare class GptClient extends BaseClient {
23334
24458
  list: (options?: RequestOptions) => Promise<FeatureUsage[]>;
23335
24459
  get: (id: string, options?: RequestOptions) => Promise<FeatureUsage>;
23336
24460
  listByTenant: (tenantId: string, options?: RequestOptions) => Promise<FeatureUsage[]>;
24461
+ increment: (featureKey: string, options?: RequestOptions) => Promise<{
24462
+ used: number;
24463
+ remaining: number | null;
24464
+ }>;
23337
24465
  };
23338
24466
  planFeatureAllocations: {
23339
24467
  list: (options?: {
@@ -23354,7 +24482,7 @@ declare class GptClient extends BaseClient {
23354
24482
  products: {
23355
24483
  list: (workspaceId: string, options?: {
23356
24484
  page?: number;
23357
- pageSize?: number;
24485
+ pageSize? /** Workspaces, applications, tenants, and invitations */: number;
23358
24486
  } & RequestOptions) => Promise<CatalogProduct[]>;
23359
24487
  get: (id: string, options?: RequestOptions) => Promise<CatalogProduct>;
23360
24488
  create: (attributes: CreateCatalogProductAttributes, options?: RequestOptions) => Promise<CatalogProduct>;
@@ -23728,6 +24856,14 @@ declare class GptClient extends BaseClient {
23728
24856
  date_of_birth?: string;
23729
24857
  }, options?: RequestOptions) => Promise<FullscriptPatient>;
23730
24858
  sessionGrant: (connectorId: string, workspaceId: string, patientId: string, options?: RequestOptions) => Promise<FullscriptSessionGrant>;
24859
+ listTreatmentPlans: (connectorId: string, workspaceId: string, patientId: string, options?: RequestOptions) => Promise<FullscriptTreatmentPlan[]>;
24860
+ getTreatmentPlan: (connectorId: string, workspaceId: string, treatmentPlanId: string, options?: RequestOptions) => Promise<FullscriptTreatmentPlan>;
24861
+ cancelTreatmentPlan: (connectorId: string, workspaceId: string, treatmentPlanId: string, options?: RequestOptions) => Promise<FullscriptTreatmentPlan>;
24862
+ searchProducts: (connectorId: string, workspaceId: string, query: string, options?: RequestOptions) => Promise<FullscriptProduct[]>;
24863
+ getProduct: (connectorId: string, workspaceId: string, productId: string, options?: RequestOptions) => Promise<FullscriptProduct>;
24864
+ listSimilarProducts: (connectorId: string, workspaceId: string, productId: string, options?: RequestOptions) => Promise<FullscriptProduct[]>;
24865
+ listPatientOrders: (connectorId: string, workspaceId: string, patientId: string, options?: RequestOptions) => Promise<FullscriptOrder[]>;
24866
+ getOrder: (connectorId: string, workspaceId: string, orderId: string, options?: RequestOptions) => Promise<FullscriptOrder>;
23731
24867
  oauth: {
23732
24868
  connect: (workspaceId: string, options?: RequestOptions) => Promise<OAuthInitiateResult>;
23733
24869
  callback: (code: string, state: string, workspaceId: string, redirectUri?: string, options?: RequestOptions) => Promise<ConnectorInstance>;
@@ -23915,7 +25051,7 @@ declare class GptClient extends BaseClient {
23915
25051
  text: string;
23916
25052
  max_chars: number;
23917
25053
  workspace_id: string;
23918
- platform? /** Direct email composition, AI drafting, sender profiles, and tracking */: string;
25054
+ platform?: string;
23919
25055
  }, options?: RequestOptions) => Promise<unknown>;
23920
25056
  refine: (attributes: {
23921
25057
  text: string;
@@ -24226,6 +25362,7 @@ declare class GptClient extends BaseClient {
24226
25362
  /** User authentication, profiles, and API key management */
24227
25363
  readonly identity: {
24228
25364
  login: (email: string, password: string, options?: RequestOptions) => Promise<User>;
25365
+ refresh: (refreshToken: string, options?: RequestOptions) => Promise<RefreshResponse>;
24229
25366
  register: (email: string, password: string, passwordConfirmation: string, tenantName: string, attrs?: RegisterExtraAttributes, options?: RequestOptions) => Promise<User>;
24230
25367
  registerViaInvitation: (email: string, password: string, passwordConfirmation: string, invitationToken: string, attrs?: RegisterExtraAttributes, options?: RequestOptions) => Promise<User>;
24231
25368
  me: (options?: RequestOptions) => Promise<User>;
@@ -24635,26 +25772,32 @@ declare class GptClient extends BaseClient {
24635
25772
  list: (options?: {
24636
25773
  page?: number;
24637
25774
  pageSize?: number;
24638
- } & RequestOptions) => Promise<Thread[]>;
24639
- listAll: (options?: RequestOptions) => Promise<Thread[]>;
24640
- create: (attributes: CreateThreadAttributes, options?: RequestOptions) => Promise<Thread>;
24641
- update: (id: string, attributes: UpdateThreadAttributes, options?: RequestOptions) => Promise<Thread>;
24642
- summarize: (id: string, options?: RequestOptions) => Promise<Thread>;
24643
- fork: (id: string, options?: RequestOptions) => Promise<Thread>;
24644
- export: (id: string, options?: RequestOptions) => Promise<Thread>;
24645
- get: (id: string, options?: RequestOptions) => Promise<Thread>;
24646
- archive: (id: string, options?: RequestOptions) => Promise<Thread>;
24647
- unarchive: (id: string, options?: RequestOptions) => Promise<Thread>;
25775
+ } & RequestOptions) => Promise<ChatThread[]>;
25776
+ listMine: (options?: {
25777
+ page
25778
+ /** Permissions platform permission registry, presets, and metadata */
25779
+ ? /** Permissions — platform permission registry, presets, and metadata */: number;
25780
+ pageSize?: number;
25781
+ } & RequestOptions) => Promise<ChatThread[]>;
25782
+ listAll: (options?: RequestOptions) => Promise<ChatThread[]>;
25783
+ create: (attributes: CreateThreadAttributes, options?: RequestOptions) => Promise<ChatThread>;
25784
+ update: (id: string, attributes: UpdateThreadAttributes, options?: RequestOptions) => Promise<ChatThread>;
25785
+ summarize: (id: string, options?: RequestOptions) => Promise<ChatThread>;
25786
+ fork: (id: string, options?: RequestOptions) => Promise<ChatThread>;
25787
+ export: (id: string, options?: RequestOptions) => Promise<ChatThread>;
25788
+ get: (id: string, options?: RequestOptions) => Promise<ChatThread>;
25789
+ archive: (id: string, options?: RequestOptions) => Promise<ChatThread>;
25790
+ unarchive: (id: string, options?: RequestOptions) => Promise<ChatThread>;
24648
25791
  messages: {
24649
- list: (threadId: string, options?: RequestOptions) => Promise<Message[]>;
24650
- send: (threadId: string, content: string, attributes?: SendMessageAttributes, options?: RequestOptions) => Promise<Message>;
25792
+ list: (threadId: string, options?: RequestOptions) => Promise<ChatMessage[]>;
25793
+ send: (threadId: string, content: string, attributes?: SendMessageAttributes, options?: RequestOptions) => Promise<ChatMessage>;
24651
25794
  stream: (threadId: string, body: Record<string, unknown>, options?: RequestOptions, streamOptions?: StreamOptions) => Promise<AsyncIterableIterator<StreamMessageChunk>>;
24652
- search: (query: string, options?: RequestOptions) => Promise<Message[]>;
24653
- semanticSearch: (query: string, limit?: number, options?: RequestOptions) => Promise<Message[]>;
25795
+ search: (query: string, options?: RequestOptions) => Promise<ChatMessage[]>;
25796
+ semanticSearch: (query: string, limit?: number, options?: RequestOptions) => Promise<ChatMessage[]>;
24654
25797
  };
24655
- complete: (threadId: string, options?: RequestOptions) => Promise<Thread>;
25798
+ complete: (threadId: string, options?: RequestOptions) => Promise<ChatThread>;
24656
25799
  completeStream: (threadId: string, options?: RequestOptions, streamOptions?: StreamOptions) => Promise<AsyncIterableIterator<StreamMessageChunk>>;
24657
- search: (query: string, options?: RequestOptions) => Promise<Thread[]>;
25800
+ search: (query: string, options?: RequestOptions) => Promise<ChatThread[]>;
24658
25801
  };
24659
25802
  /** Training examples and sessions */
24660
25803
  readonly training: {
@@ -24834,6 +25977,7 @@ declare class GptClient extends BaseClient {
24834
25977
  listByWorkspace: (workspaceId: string, options?: RequestOptions) => Promise<unknown>;
24835
25978
  create: (attributes: Record<string, unknown>, options?: RequestOptions) => Promise<unknown>;
24836
25979
  delete: (id: string, options?: RequestOptions) => Promise<unknown>;
25980
+ listByDateRange: (from: string, to: string, options?: RequestOptions) => Promise<unknown>;
24837
25981
  items: {
24838
25982
  get: (id: string, options?: RequestOptions) => Promise<unknown>;
24839
25983
  listBySnapshot: (snapshotId: string, options?: RequestOptions) => Promise<unknown>;
@@ -24845,7 +25989,6 @@ declare class GptClient extends BaseClient {
24845
25989
  create: (attributes: Record<string, unknown>, options?: RequestOptions) => Promise<unknown>;
24846
25990
  update: (id: string, attributes: Record<string, unknown>, options?: RequestOptions) => Promise<unknown>;
24847
25991
  delete: (id: string, options?: RequestOptions) => Promise<unknown>;
24848
- markTriggered: (id: string, options?: RequestOptions) => Promise<unknown>;
24849
25992
  };
24850
25993
  };
24851
25994
  /** Project, milestone, task, time entry, member, risk, and AI management */
@@ -24948,12 +26091,83 @@ declare class GptClient extends BaseClient {
24948
26091
  };
24949
26092
  documentSections: {
24950
26093
  list: (params?: {
24951
- page?: number;
26094
+ page
26095
+ /** Contacts, companies, deals, activities, pipelines, relationships, and custom entities */
26096
+ ? /** Contacts, companies, deals, activities, pipelines, relationships, and custom entities */: number;
24952
26097
  pageSize?: number;
24953
26098
  }, options?: RequestOptions) => Promise<DocumentSection[]>;
24954
26099
  get: (id: string, options?: RequestOptions) => Promise<DocumentSection>;
24955
26100
  };
24956
26101
  };
26102
+ /** Scoped channel tokens for WebSocket authentication */
26103
+ readonly channels: {
26104
+ authorize(request: ChannelTokenRequest, options?: RequestOptions): Promise<ChannelTokenResponse>;
26105
+ createTokenManager(options: Omit<SocketManagerOptions, "socketUrl">): Promise<SocketManager>;
26106
+ };
26107
+ /** Unified import hub — CSV/JSON batch imports across Clinical, CRM, and Catalog */
26108
+ readonly imports: {
26109
+ listAdapters: (options?: RequestOptions) => Promise<ImportAdapter[]>;
26110
+ batch: (params: {
26111
+ adapter: string;
26112
+ workspace_id: string;
26113
+ rows: Record<string, unknown>[];
26114
+ metadata?: Record<string, unknown>;
26115
+ }, options?: RequestOptions) => Promise<{
26116
+ data: {
26117
+ import_id: string;
26118
+ status: string;
26119
+ };
26120
+ }>;
26121
+ upload: (file: File | Blob, params: {
26122
+ adapter: string;
26123
+ workspace_id: string;
26124
+ column_mapping?: Record<string, string>;
26125
+ metadata?: Record<string, unknown>;
26126
+ }, options?: RequestOptions) => Promise<{
26127
+ data: {
26128
+ import_id: string;
26129
+ status: string;
26130
+ };
26131
+ }>;
26132
+ list: (params: {
26133
+ workspace_id: string;
26134
+ adapter?: string;
26135
+ status?: string;
26136
+ offset?: number;
26137
+ limit?: number;
26138
+ }, options?: RequestOptions) => Promise<{
26139
+ data: Import[];
26140
+ meta: {
26141
+ count: number;
26142
+ };
26143
+ }>;
26144
+ get: (id: string, options?: RequestOptions) => Promise<Import>;
26145
+ rows: (importId: string, params?: {
26146
+ offset?: number;
26147
+ limit?: number;
26148
+ }, options?: RequestOptions) => Promise<{
26149
+ data: ImportRow[];
26150
+ meta: {
26151
+ count: number;
26152
+ };
26153
+ }>;
26154
+ confirm: (id: string, params: {
26155
+ workspace_id: string;
26156
+ }, options?: RequestOptions) => Promise<{
26157
+ data: {
26158
+ import_id: string;
26159
+ status: string;
26160
+ };
26161
+ }>;
26162
+ cancel: (id: string, params: {
26163
+ workspace_id: string;
26164
+ }, options?: RequestOptions) => Promise<{
26165
+ data: {
26166
+ import_id: string;
26167
+ status: string;
26168
+ };
26169
+ }>;
26170
+ };
24957
26171
  constructor(config?: BaseClientConfig);
24958
26172
  /**
24959
26173
  * Subscribe to SDK lifecycle events.
@@ -25228,6 +26442,20 @@ declare function createSocialNamespace(rb: RequestBuilder): {
25228
26442
  create: (attributes: Record<string, unknown>, options?: RequestOptions) => Promise<unknown>;
25229
26443
  /** Delete a trending snapshot by ID. */
25230
26444
  delete: (id: string, options?: RequestOptions) => Promise<unknown>;
26445
+ /**
26446
+ * List trending snapshots within a date range.
26447
+ * @param from - Start date (ISO 8601 string)
26448
+ * @param to - End date (ISO 8601 string)
26449
+ * @returns Array of TrendingSnapshot records in the range
26450
+ * @example
26451
+ * ```typescript
26452
+ * const snapshots = await client.social.trending.listByDateRange(
26453
+ * '2026-03-01T00:00:00Z',
26454
+ * '2026-03-21T23:59:59Z',
26455
+ * );
26456
+ * ```
26457
+ */
26458
+ listByDateRange: (from: string, to: string, options?: RequestOptions) => Promise<unknown>;
25231
26459
  /** Trending snapshot items — individual content pieces within a snapshot. */
25232
26460
  items: {
25233
26461
  /** Get a single trending item by ID. */
@@ -25286,11 +26514,6 @@ declare function createSocialNamespace(rb: RequestBuilder): {
25286
26514
  update: (id: string, attributes: Record<string, unknown>, options?: RequestOptions) => Promise<unknown>;
25287
26515
  /** Delete a trending watch by ID. */
25288
26516
  delete: (id: string, options?: RequestOptions) => Promise<unknown>;
25289
- /**
25290
- * Mark a watch as triggered (updates last_triggered_at).
25291
- * @param id - Watch UUID
25292
- */
25293
- markTriggered: (id: string, options?: RequestOptions) => Promise<unknown>;
25294
26517
  };
25295
26518
  };
25296
26519
 
@@ -25414,4 +26637,4 @@ type SocialAPI = ReturnType<typeof createSocialNamespace>;
25414
26637
  type ModelsAPI = ReturnType<typeof createModelsNamespace>;
25415
26638
  type MemoryAPI = ReturnType<typeof createMemoryNamespace>;
25416
26639
 
25417
- export { API_KEY_PREFIXES, type AccessGrant, type Agent, type AgentDeployment, type AgentVersion, type AgentsAPI, type AiAPI, type ApiKey, type AppInfo, type ApprovalRequiredEvent, type AttributeFilter$1 as AttributeFilter, AuthenticationError, AuthorizationError, type BaseClientConfig, type BillingAPI, type BillingAccount, BrowserApiKeyError, type BuyAddonAttributes, type CampaignsAPI, type CapacityCalculatorResponse, CardDeclinedError, type CommunicationAPI, type ComplianceFrameworkReadiness, type CompliancePosture, type ComposeWithAiAttributes, ConflictError, type CreditPackage, DEFAULT_API_VERSION, DEFAULT_RETRY_CONFIG, type DocumentSection, type DoneEvent, type EmailAPI, type ErrorEvent, type Execution, type ExecutionEvent, type ExtractionAPI, type ExtractionRowQueryParams, type ExtractionRowQueryResult, type FeatureDefinition, type FeatureUsage, GptClient, GptCoreError, type IdentityAPI, InsecureConnectionError, type Invitation, type Invoice, type IterationCompleteEvent, LOG_LEVELS, type ListModelsOptions, type ListPracticeToolsParams, type LogLevel, type Logger, type MemoryAPI, type MjmlCompileResult, type ModelInfo, type ModelTier, type ModelsAPI, NetworkError, NotFoundError, type PaginatedResponse, type PaginationLinks, type PaginationOptions, type PaymentMethod, type PaymentMethodCreateAttributes, type PaymentMethodTokenizeAttributes, type PaymentMethodUpdateAttributes, PaymentRequiredError, type Plan, type PlanFeatureAllocation, type PlatformAPI, type PracticeToolCategory, RateLimitError, RequestBuilder, type RequestOptions, type RetryConfig, RetryTimeoutError, SDK_VERSION, type SchedulingAPI, type SdkErrorEvent, SdkEventEmitter, type SdkEvents, type SdkRequestEvent, type SdkResponseEvent, type SdkRetryEvent, type SearchAPI, type SeatInfo, type SectionDocument, type SecurityConfig, ServerError, type SessionNoteType, type SessionNoteValue, type SocialAPI, type StorageAPI, type StreamMessageChunk, type StreamOptions, SubscriptionConflictError, type TemplateVariableSchema, type TemplateVersion, type Tenant, type ThreadsAPI, TimeoutError, type TokenDeltaEvent, type ToolCallEvent, type ToolResultEvent, type Transaction, type TrendingSnapshot, type TrendingSnapshotItem, type TrendingWatch, type TriggerPipelineAttributes, type UpdateFeatureDefinitionAttributes, type UsageHistoryEntry, type User, type UserProfile, ValidationError, type VoiceAPI, type VoiceFinalizeOptions, type VoiceRecording, type VoiceSession, type VoiceSessionStart, type VoiceStartOptions, type VoiceTranscribeOptions, type VoiceTranscribeResult, type VoiceTranscriptionResult, type Wallet, type WalletPaymentMethod, WebhookSignatureError, type WebhookVerifyOptions, Webhooks, type Workspace, type WorkspaceAgentConfig, buildHeaders, buildUserAgent, collectStreamedMessage, handleApiError, isBrowserEnvironment, isSecureUrl, paginateAll, paginateToArray, retryWithBackoff, streamMessage, streamSSE, validateApiKey, withRetry };
26640
+ export { API_KEY_PREFIXES, type AccessGrant, type ActivityFeedParams, type Agent, type AgentDeployment, type AgentVersion, type AgentsAPI, type AiAPI, type ApiKey, type AppInfo, type ApprovalRequiredEvent, type AttributeFilter$1 as AttributeFilter, type AuditLog, AuthenticationError, AuthorizationError, type BaseClientConfig, type BillingAPI, type BillingAccount, BrowserApiKeyError, type BuyAddonAttributes, type CampaignsAPI, type CapacityCalculatorResponse, CardDeclinedError, type ClinicalSearchResult, type CommunicationAPI, type ComplianceFrameworkReadiness, type CompliancePosture, type ComposeWithAiAttributes, ConflictError, type CreateAgentAttributes, type CreateAgentTrainingExampleAttributes, type CreateAgentVersionAttributes, type CreateFieldTemplateAttributes, type CreateTestResultAttributes, type CreditPackage, DEFAULT_API_VERSION, DEFAULT_RETRY_CONFIG, type DocumentSection, type DoneEvent, type EmailAPI, type ErrorEvent, type Execution, type ExecutionEvent, type ExtractionAPI, type ExtractionRowQueryParams, type ExtractionRowQueryResult, type FeatureDefinition, type FeatureUsage, type FullscriptOrder, type FullscriptProduct, type FullscriptTreatmentPlan, GptClient, GptCoreError, type IdentityAPI, type Import, type ImportAdapter, type ImportRow, InsecureConnectionError, type Invitation, type Invoice, type IterationCompleteEvent, LOG_LEVELS, type ListModelsOptions, type ListPracticeToolsParams, type LogLevel, type Logger, type MemoryAPI, type MjmlCompileResult, type ModelInfo, type ModelTier, type ModelsAPI, NetworkError, NotFoundError, type PaginatedResponse, type PaginationLinks, type PaginationOptions, type PaymentMethod, type PaymentMethodCreateAttributes, type PaymentMethodTokenizeAttributes, type PaymentMethodUpdateAttributes, PaymentRequiredError, type Plan, type PlanFeatureAllocation, type PlatformAPI, type PracticeToolCategory, RateLimitError, RequestBuilder, type RequestOptions, type RetryConfig, RetryTimeoutError, SDK_VERSION, type SchedulingAPI, type SdkErrorEvent, SdkEventEmitter, type SdkEvents, type SdkRequestEvent, type SdkResponseEvent, type SdkRetryEvent, type SearchAPI, type SeatInfo, type SectionDocument, type SecurityConfig, ServerError, type SessionNoteType, type SessionNoteValue, type SocialAPI, type StorageAPI, type StreamApprovalRequiredEvent, type StreamDoneEvent, type StreamDoneMetadata, type StreamErrorEvent, type StreamIterationCompleteEvent, type StreamMessageChunk, type StreamOptions, type StreamTokenEvent, type StreamToolCallEvent, type StreamToolResultEvent, SubscriptionConflictError, type TemplateVariableSchema, type TemplateVersion, type Tenant, type ThreadsAPI, TimeoutError, type TokenDeltaEvent, type ToolCallEvent, type ToolResultEvent, type Transaction, type TrendingSnapshot, type TrendingSnapshotItem, type TrendingWatch, type TriggerPipelineAttributes, type UpdateAgentAttributes, type UpdateAgentTrainingExampleAttributes, type UpdateAgentVersionAttributes, type UpdateFeatureDefinitionAttributes, type UsageHistoryEntry, type User, type UserProfile, ValidationError, type VoiceAPI, type VoiceFinalizeOptions, type VoiceRecording, type VoiceSession, type VoiceSessionStart, type VoiceStartOptions, type VoiceTranscribeOptions, type VoiceTranscribeResult, type VoiceTranscriptionResult, type Wallet, type WalletPaymentMethod, WebhookSignatureError, type WebhookVerifyOptions, Webhooks, type Workspace, type WorkspaceAgentConfig, buildHeaders, buildUserAgent, collectStreamedMessage, createImportsNamespace, handleApiError, isBrowserEnvironment, isSecureUrl, paginateAll, paginateToArray, retryWithBackoff, streamMessage, streamSSE, validateApiKey, withRetry };