@gpt-platform/client 0.8.4 → 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.4";
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-11";
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
+ * ```
838
865
  */
839
- interface StreamMessageChunk {
840
- type: "content" | "done" | "error";
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"`.
870
+ */
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,13 @@ type ClinicalClientSupplement = {
4590
4919
  * Field included by default.
4591
4920
  */
4592
4921
  instructions?: string | null | unknown;
4922
+ is_archived?: boolean | null | unknown;
4923
+ /**
4924
+ * Field included by default.
4925
+ */
4926
+ metadata: {
4927
+ [key: string]: unknown;
4928
+ };
4593
4929
  /**
4594
4930
  * Field included by default.
4595
4931
  */
@@ -4921,11 +5257,19 @@ type Permission = {
4921
5257
  /**
4922
5258
  * Field included by default.
4923
5259
  */
4924
- category?: string | null | unknown;
5260
+ action: string;
4925
5261
  /**
4926
5262
  * Field included by default.
4927
5263
  */
4928
- 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>;
4929
5273
  /**
4930
5274
  * Field included by default.
4931
5275
  */
@@ -4937,11 +5281,11 @@ type Permission = {
4937
5281
  /**
4938
5282
  * Field included by default.
4939
5283
  */
4940
- permissions?: Array<string> | null | unknown;
5284
+ resource: string;
4941
5285
  /**
4942
5286
  * Field included by default.
4943
5287
  */
4944
- role?: string | null | unknown;
5288
+ scope: string;
4945
5289
  };
4946
5290
  id: string;
4947
5291
  /**
@@ -6039,6 +6383,12 @@ type ClinicalSession = {
6039
6383
  * Field included by default.
6040
6384
  */
6041
6385
  event_id?: string | null | unknown;
6386
+ /**
6387
+ * Field included by default.
6388
+ */
6389
+ metadata: {
6390
+ [key: string]: unknown;
6391
+ };
6042
6392
  /**
6043
6393
  * Field included by default.
6044
6394
  */
@@ -6055,6 +6405,10 @@ type ClinicalSession = {
6055
6405
  * Field included by default.
6056
6406
  */
6057
6407
  practitioner_id?: string | null | unknown;
6408
+ /**
6409
+ * Field included by default.
6410
+ */
6411
+ prep_execution_id?: string | null | unknown;
6058
6412
  /**
6059
6413
  * Field included by default.
6060
6414
  */
@@ -6217,6 +6571,13 @@ type ClinicalMealPlan = {
6217
6571
  * Field included by default.
6218
6572
  */
6219
6573
  goal_calories?: number | null | unknown;
6574
+ is_archived?: boolean | null | unknown;
6575
+ /**
6576
+ * Field included by default.
6577
+ */
6578
+ metadata: {
6579
+ [key: string]: unknown;
6580
+ };
6220
6581
  /**
6221
6582
  * Field included by default.
6222
6583
  */
@@ -6236,7 +6597,7 @@ type ClinicalMealPlan = {
6236
6597
  /**
6237
6598
  * Field included by default.
6238
6599
  */
6239
- status: "draft" | "approved" | "archived";
6600
+ status: "draft" | "approved" | "archived" | "sent_to_client";
6240
6601
  };
6241
6602
  id: string;
6242
6603
  /**
@@ -6798,7 +7159,7 @@ type AgentVersion = {
6798
7159
  /**
6799
7160
  * Field included by default.
6800
7161
  */
6801
- version_number: string;
7162
+ version_number: number;
6802
7163
  };
6803
7164
  id: string;
6804
7165
  /**
@@ -7018,6 +7379,7 @@ type User = {
7018
7379
  * Field included by default.
7019
7380
  */
7020
7381
  is_platform_admin: boolean;
7382
+ refresh_token?: string | null | unknown;
7021
7383
  tenant_id?: string | null | unknown;
7022
7384
  /**
7023
7385
  * Field included by default.
@@ -7122,6 +7484,12 @@ type ClinicalPatient = {
7122
7484
  * Field included by default.
7123
7485
  */
7124
7486
  followup_interval_value?: number | null | unknown;
7487
+ /**
7488
+ * Field included by default.
7489
+ */
7490
+ metadata: {
7491
+ [key: string]: unknown;
7492
+ };
7125
7493
  /**
7126
7494
  * Field included by default.
7127
7495
  */
@@ -7304,6 +7672,14 @@ type ClinicalPracticeResource = {
7304
7672
  * Field included by default.
7305
7673
  */
7306
7674
  author?: string | null | unknown;
7675
+ /**
7676
+ * Field included by default.
7677
+ */
7678
+ category?: string | null | unknown;
7679
+ /**
7680
+ * Field included by default.
7681
+ */
7682
+ condition_tags: Array<string>;
7307
7683
  /**
7308
7684
  * Field included by default.
7309
7685
  */
@@ -7324,6 +7700,8 @@ type ClinicalPracticeResource = {
7324
7700
  * Field included by default.
7325
7701
  */
7326
7702
  is_active: boolean;
7703
+ is_archived?: boolean | null | unknown;
7704
+ is_catalog?: boolean | null | unknown;
7327
7705
  /**
7328
7706
  * Field included by default.
7329
7707
  */
@@ -7332,6 +7710,12 @@ type ClinicalPracticeResource = {
7332
7710
  * Field included by default.
7333
7711
  */
7334
7712
  license?: string | null | unknown;
7713
+ /**
7714
+ * Field included by default.
7715
+ */
7716
+ metadata: {
7717
+ [key: string]: unknown;
7718
+ };
7335
7719
  /**
7336
7720
  * Field included by default.
7337
7721
  */
@@ -7347,7 +7731,7 @@ type ClinicalPracticeResource = {
7347
7731
  /**
7348
7732
  * Field included by default.
7349
7733
  */
7350
- resource_type: "article" | "video" | "handout" | "worksheet" | "tool_link" | "infographic" | "audio" | "recipe" | "checklist" | "protocol" | "assessment" | "exercise" | "template" | "presentation" | "ebook";
7734
+ resource_type: "article" | "video" | "handout" | "worksheet" | "tool_link" | "infographic" | "audio" | "recipe" | "checklist" | "protocol" | "assessment" | "exercise" | "template" | "presentation" | "ebook" | "other";
7351
7735
  /**
7352
7736
  * Field included by default.
7353
7737
  */
@@ -7595,44 +7979,6 @@ type StorageFile = {
7595
7979
  };
7596
7980
  type: string;
7597
7981
  };
7598
- /**
7599
- * A "Resource object" representing a permission_meta
7600
- */
7601
- type PermissionMeta = {
7602
- /**
7603
- * An attributes object for a permission_meta
7604
- */
7605
- attributes?: {
7606
- /**
7607
- * Field included by default.
7608
- */
7609
- apps: Array<string>;
7610
- /**
7611
- * Field included by default.
7612
- */
7613
- cache_ttl: number;
7614
- /**
7615
- * Field included by default.
7616
- */
7617
- categories: Array<string>;
7618
- /**
7619
- * Field included by default.
7620
- */
7621
- scopes: Array<string>;
7622
- /**
7623
- * Field included by default.
7624
- */
7625
- version: string;
7626
- };
7627
- id: string;
7628
- /**
7629
- * A relationships object for a permission_meta
7630
- */
7631
- relationships?: {
7632
- [key: string]: never;
7633
- };
7634
- type: string;
7635
- };
7636
7982
  /**
7637
7983
  * A "Resource object" representing a document-section
7638
7984
  */
@@ -7765,6 +8111,12 @@ type ClinicalDelivery = {
7765
8111
  * Field included by default.
7766
8112
  */
7767
8113
  included_supplement_ids: Array<string>;
8114
+ /**
8115
+ * Field included by default.
8116
+ */
8117
+ metadata: {
8118
+ [key: string]: unknown;
8119
+ };
7768
8120
  /**
7769
8121
  * Field included by default.
7770
8122
  */
@@ -7888,6 +8240,44 @@ type TrendingSnapshotItem = {
7888
8240
  };
7889
8241
  type: string;
7890
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
+ };
7891
8281
  /**
7892
8282
  * A "Resource object" representing a crm_deal
7893
8283
  */
@@ -8707,6 +9097,85 @@ type EmailMarketingTemplate = {
8707
9097
  };
8708
9098
  type: string;
8709
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
+ };
8710
9179
  /**
8711
9180
  * A "Resource object" representing a email-marketing-generated-email
8712
9181
  */
@@ -8819,10 +9288,17 @@ type ClinicalHealthMetric = {
8819
9288
  * Field included by default.
8820
9289
  */
8821
9290
  extracted_from?: string | null | unknown;
9291
+ is_archived?: boolean | null | unknown;
8822
9292
  /**
8823
9293
  * Field included by default.
8824
9294
  */
8825
9295
  measured_at?: string | null | unknown;
9296
+ /**
9297
+ * Field included by default.
9298
+ */
9299
+ metadata: {
9300
+ [key: string]: unknown;
9301
+ };
8826
9302
  /**
8827
9303
  * Field included by default.
8828
9304
  */
@@ -8964,48 +9440,6 @@ type RiskAssessment = {
8964
9440
  };
8965
9441
  type: string;
8966
9442
  };
8967
- /**
8968
- * A "Resource object" representing a permission_preset
8969
- */
8970
- type PermissionPreset = {
8971
- /**
8972
- * An attributes object for a permission_preset
8973
- */
8974
- attributes?: {
8975
- /**
8976
- * Field included by default.
8977
- */
8978
- app: string;
8979
- /**
8980
- * Field included by default.
8981
- */
8982
- context: string;
8983
- /**
8984
- * Field included by default.
8985
- */
8986
- description: string;
8987
- /**
8988
- * Field included by default.
8989
- */
8990
- name: string;
8991
- /**
8992
- * Field included by default.
8993
- */
8994
- permissions: Array<string>;
8995
- /**
8996
- * Field included by default.
8997
- */
8998
- role: string;
8999
- };
9000
- id: string;
9001
- /**
9002
- * A relationships object for a permission_preset
9003
- */
9004
- relationships?: {
9005
- [key: string]: never;
9006
- };
9007
- type: string;
9008
- };
9009
9443
  /**
9010
9444
  * A "Resource object" representing a crawler_schedule
9011
9445
  */
@@ -9655,6 +10089,13 @@ type ClinicalNote = {
9655
10089
  * An attributes object for a clinical-note
9656
10090
  */
9657
10091
  attributes?: {
10092
+ is_archived?: boolean | null | unknown;
10093
+ /**
10094
+ * Field included by default.
10095
+ */
10096
+ metadata: {
10097
+ [key: string]: unknown;
10098
+ };
9658
10099
  /**
9659
10100
  * Field included by default.
9660
10101
  */
@@ -10358,6 +10799,7 @@ type ClinicalClientGoal = {
10358
10799
  * Field included by default.
10359
10800
  */
10360
10801
  goal_type: string;
10802
+ is_archived?: boolean | null | unknown;
10361
10803
  /**
10362
10804
  * Field included by default.
10363
10805
  */
@@ -11751,7 +12193,27 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
11751
12193
  list: (options?: {
11752
12194
  page?: number;
11753
12195
  pageSize?: number;
11754
- } & 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[]>;
11755
12217
  /**
11756
12218
  * Fetches all threads in the workspace by transparently paginating through
11757
12219
  * every page until exhausted.
@@ -11768,7 +12230,7 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
11768
12230
  * const allThreads = await client.threads.listAll();
11769
12231
  * console.log(`Total threads: ${allThreads.length}`);
11770
12232
  */
11771
- listAll: (options?: RequestOptions) => Promise<Thread[]>;
12233
+ listAll: (options?: RequestOptions) => Promise<ChatThread[]>;
11772
12234
  /**
11773
12235
  * Creates a new conversation thread.
11774
12236
  *
@@ -11790,7 +12252,7 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
11790
12252
  * });
11791
12253
  * console.log(`Thread ID: ${thread.id}`);
11792
12254
  */
11793
- create: (attributes: CreateThreadAttributes, options?: RequestOptions) => Promise<Thread>;
12255
+ create: (attributes: CreateThreadAttributes, options?: RequestOptions) => Promise<ChatThread>;
11794
12256
  /**
11795
12257
  * Updates one or more attributes of an existing thread.
11796
12258
  *
@@ -11810,7 +12272,7 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
11810
12272
  * title: 'Q2 Invoice Review',
11811
12273
  * });
11812
12274
  */
11813
- update: (id: string, attributes: UpdateThreadAttributes, options?: RequestOptions) => Promise<Thread>;
12275
+ update: (id: string, attributes: UpdateThreadAttributes, options?: RequestOptions) => Promise<ChatThread>;
11814
12276
  /**
11815
12277
  * Generates an AI-produced summary of the thread's conversation history.
11816
12278
  *
@@ -11829,7 +12291,7 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
11829
12291
  * const thread = await client.threads.summarize('thr_01HXYZ...');
11830
12292
  * console.log(thread.attributes.summary);
11831
12293
  */
11832
- summarize: (id: string, options?: RequestOptions) => Promise<Thread>;
12294
+ summarize: (id: string, options?: RequestOptions) => Promise<ChatThread>;
11833
12295
  /**
11834
12296
  * Forks a thread by creating a new thread that is a full copy of the original,
11835
12297
  * including all of its messages.
@@ -11848,7 +12310,7 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
11848
12310
  * const fork = await client.threads.fork('thr_01HXYZ...');
11849
12311
  * console.log(`Forked into new thread: ${fork.id}`);
11850
12312
  */
11851
- fork: (id: string, options?: RequestOptions) => Promise<Thread>;
12313
+ fork: (id: string, options?: RequestOptions) => Promise<ChatThread>;
11852
12314
  /**
11853
12315
  * Exports a thread and all of its messages in a portable format.
11854
12316
  *
@@ -11868,7 +12330,7 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
11868
12330
  * const exported = await client.threads.export('thr_01HXYZ...');
11869
12331
  * console.log(exported.attributes.export); // Markdown or JSON string
11870
12332
  */
11871
- export: (id: string, options?: RequestOptions) => Promise<Thread>;
12333
+ export: (id: string, options?: RequestOptions) => Promise<ChatThread>;
11872
12334
  /**
11873
12335
  * Fetches a single thread by its ID.
11874
12336
  *
@@ -11881,7 +12343,7 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
11881
12343
  * const thread = await client.threads.get('thr_01HXYZ...');
11882
12344
  * console.log(thread.attributes.title);
11883
12345
  */
11884
- get: (id: string, options?: RequestOptions) => Promise<Thread>;
12346
+ get: (id: string, options?: RequestOptions) => Promise<ChatThread>;
11885
12347
  /**
11886
12348
  * Archives a thread, soft-deleting it by hiding it from default listings.
11887
12349
  *
@@ -11901,7 +12363,7 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
11901
12363
  * const archived = await client.threads.archive('thr_01HXYZ...');
11902
12364
  * console.log(`Archived at: ${archived.attributes.archived_at}`);
11903
12365
  */
11904
- archive: (id: string, options?: RequestOptions) => Promise<Thread>;
12366
+ archive: (id: string, options?: RequestOptions) => Promise<ChatThread>;
11905
12367
  /**
11906
12368
  * Restores a previously archived thread back to active status.
11907
12369
  *
@@ -11918,7 +12380,7 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
11918
12380
  * const restored = await client.threads.unarchive('thr_01HXYZ...');
11919
12381
  * console.log(`Archived at: ${restored.attributes.archived_at}`); // null
11920
12382
  */
11921
- unarchive: (id: string, options?: RequestOptions) => Promise<Thread>;
12383
+ unarchive: (id: string, options?: RequestOptions) => Promise<ChatThread>;
11922
12384
  /**
11923
12385
  * Sub-namespace for reading and sending messages within a thread.
11924
12386
  *
@@ -11935,7 +12397,7 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
11935
12397
  * // Streaming
11936
12398
  * const stream = await client.threads.messages.stream('thr_01HXYZ...', { content: 'Hello!' });
11937
12399
  * for await (const chunk of stream) {
11938
- * process.stdout.write(chunk.delta ?? '');
12400
+ * if (chunk.type === 'token') process.stdout.write(chunk.content ?? '');
11939
12401
  * }
11940
12402
  */
11941
12403
  messages: {
@@ -11956,7 +12418,7 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
11956
12418
  * const messages = await client.threads.messages.list('thr_01HXYZ...');
11957
12419
  * messages.forEach(m => console.log(`${m.attributes.role}: ${m.attributes.content}`));
11958
12420
  */
11959
- list: (threadId: string, options?: RequestOptions) => Promise<Message[]>;
12421
+ list: (threadId: string, options?: RequestOptions) => Promise<ChatMessage[]>;
11960
12422
  /**
11961
12423
  * Sends a message to a thread and waits for the full AI response before
11962
12424
  * returning (non-streaming).
@@ -11983,40 +12445,50 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
11983
12445
  * );
11984
12446
  * console.log(`Assistant: ${reply.attributes.content}`);
11985
12447
  */
11986
- send: (threadId: string, content: string, attributes?: SendMessageAttributes, options?: RequestOptions) => Promise<Message>;
12448
+ send: (threadId: string, content: string, attributes?: SendMessageAttributes, options?: RequestOptions) => Promise<ChatMessage>;
11987
12449
  /**
11988
- * Sends a message to a thread and streams the AI response token-by-token
11989
- * via Server-Sent Events (SSE).
12450
+ * Sends a message to a thread and streams the AI response via Server-Sent Events (SSE).
12451
+ *
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
11990
12460
  *
11991
- * Returns an `AsyncIterableIterator` that yields `StreamMessageChunk`
11992
- * objects as tokens are generated. Consume with a `for await` loop. The
11993
- * stream closes automatically when the assistant finishes generating its
11994
- * response.
12461
+ * For RAG threads (no agent), only `token`, `done`, and `error` are emitted.
11995
12462
  *
11996
12463
  * SSE security limits: 5-minute idle timeout, 10,000 chunk maximum,
11997
12464
  * 10 MB buffer size limit.
11998
12465
  *
11999
12466
  * @param threadId - The UUID of the thread to stream a message to.
12000
12467
  * @param body - The message payload, including at minimum `content` (string).
12001
- * Additional fields such as `role` or `metadata` are passed through.
12002
12468
  * @param options - Optional request options (e.g. custom headers, abort signal).
12003
12469
  * @param streamOptions - Optional streaming configuration (e.g. chunk timeout).
12004
12470
  * @returns A promise that resolves to an `AsyncIterableIterator<StreamMessageChunk>`.
12005
- * Each yielded chunk contains a `delta` string (the new token text) and
12006
- * optional event metadata.
12007
12471
  *
12008
12472
  * @example
12009
- * const client = new GptClient({ apiKey: 'sk_app_...' });
12010
- *
12011
- * const stream = await client.threads.messages.stream(
12012
- * 'thr_01HXYZ...',
12013
- * { content: 'Summarize the key clauses in this contract.' },
12014
- * );
12015
- *
12016
- * for await (const chunk of stream) {
12017
- * 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
+ * }
12018
12490
  * }
12019
- * console.log(); // newline after streaming completes
12491
+ * ```
12020
12492
  */
12021
12493
  stream: (threadId: string, body: Record<string, unknown>, options?: RequestOptions, streamOptions?: StreamOptions) => Promise<AsyncIterableIterator<StreamMessageChunk>>;
12022
12494
  /**
@@ -12030,7 +12502,7 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
12030
12502
  * const client = new GptClient({ apiKey: 'sk_app_...' });
12031
12503
  * const results = await client.threads.messages.search('deadline');
12032
12504
  */
12033
- search: (query: string, options?: RequestOptions) => Promise<Message[]>;
12505
+ search: (query: string, options?: RequestOptions) => Promise<ChatMessage[]>;
12034
12506
  /**
12035
12507
  * Vector similarity search across messages using a generated embedding.
12036
12508
  *
@@ -12046,7 +12518,7 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
12046
12518
  * const client = new GptClient({ apiKey: 'sk_app_...' });
12047
12519
  * const results = await client.threads.messages.semanticSearch('unpaid invoices', 5);
12048
12520
  */
12049
- semanticSearch: (query: string, limit?: number, options?: RequestOptions) => Promise<Message[]>;
12521
+ semanticSearch: (query: string, limit?: number, options?: RequestOptions) => Promise<ChatMessage[]>;
12050
12522
  };
12051
12523
  /**
12052
12524
  * Trigger AI inference on a thread without sending a new user message.
@@ -12073,17 +12545,16 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
12073
12545
  * console.log(`Thread updated at: ${thread.attributes?.updated_at}`);
12074
12546
  * ```
12075
12547
  */
12076
- complete: (threadId: string, options?: RequestOptions) => Promise<Thread>;
12548
+ complete: (threadId: string, options?: RequestOptions) => Promise<ChatThread>;
12077
12549
  /**
12078
12550
  * Trigger AI inference on a thread and receive the response via Server-Sent Events.
12079
12551
  *
12080
- * Identical to {@link complete} in behavior but delivers the result as an SSE
12081
- * stream. The stream yields a single `StreamMessageChunk` with `done: true`
12082
- * 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.
12083
12555
  *
12084
- * Note: This endpoint delivers the full response as one event (not token-by-token).
12085
- * It gives the frontend a consistent SSE interface for uniform handling of both
12086
- * 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.
12087
12558
  *
12088
12559
  * @param threadId - The UUID of the thread to run AI completion on.
12089
12560
  * @param options - Optional request options (e.g. abort signal).
@@ -12092,11 +12563,19 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
12092
12563
  *
12093
12564
  * @example
12094
12565
  * ```typescript
12095
- * const client = new GptClient({ apiKey: 'sk_app_...' });
12096
- *
12097
12566
  * const stream = await client.threads.completeStream('thr_01HXYZ...');
12098
- * for await (const chunk of stream) {
12099
- * 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
+ * }
12100
12579
  * }
12101
12580
  * ```
12102
12581
  */
@@ -12114,7 +12593,7 @@ declare function createThreadsNamespace(rb: RequestBuilder): {
12114
12593
  * const results = await client.threads.search('invoice review');
12115
12594
  * ```
12116
12595
  */
12117
- search: (query: string, options?: RequestOptions) => Promise<Thread[]>;
12596
+ search: (query: string, options?: RequestOptions) => Promise<ChatThread[]>;
12118
12597
  };
12119
12598
 
12120
12599
  /** Response from a presigned upload request. */
@@ -13681,15 +14160,27 @@ type UpdateTenantAttributes = {
13681
14160
  contact_phone?: string;
13682
14161
  [key: string]: unknown;
13683
14162
  };
13684
- /** 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
+ */
13685
14170
  type CreateInvitationAttributes = {
13686
14171
  email: string;
13687
- scope_type: "tenant" | "workspace";
13688
- scope_id: string;
13689
14172
  role: "admin" | "member" | "editor" | "viewer";
13690
14173
  custom_message?: string;
13691
14174
  permissions?: string[];
13692
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;
13693
14184
  [key: string]: unknown;
13694
14185
  };
13695
14186
  /** Attributes accepted when creating a brand identity. */
@@ -14439,13 +14930,20 @@ declare function createPlatformNamespace(rb: RequestBuilder): {
14439
14930
  *
14440
14931
  * @example
14441
14932
  * ```typescript
14442
- * const client = new GptClient({ apiKey: 'sk_app_...' });
14933
+ * // Using workspace_id shorthand (recommended):
14443
14934
  * const invite = await client.platform.invitations.create({
14444
14935
  * email: 'new.clinician@hospital.org',
14445
14936
  * workspace_id: 'ws_abc123',
14446
14937
  * role: 'member',
14447
14938
  * });
14448
- * 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
+ * });
14449
14947
  * ```
14450
14948
  */
14451
14949
  create: (attributes: CreateInvitationAttributes, options?: RequestOptions) => Promise<Invitation>;
@@ -15073,6 +15571,15 @@ interface AuthResponse {
15073
15571
  token?: string;
15074
15572
  [key: string]: unknown;
15075
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
+ }
15076
15583
  /** Dashboard summary data for the current user. */
15077
15584
  interface DashboardResponse {
15078
15585
  [key: string]: unknown;
@@ -15142,6 +15649,23 @@ declare function createIdentityNamespace(rb: RequestBuilder, baseUrl?: string):
15142
15649
  * The session token is available as `result.token` (flattened from `data.attributes.token`).
15143
15650
  */
15144
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>;
15145
15669
  /**
15146
15670
  * Register a new user account — returns the newly created user.
15147
15671
  * The session token is available as `result.token` (flattened from `data.attributes.token`).
@@ -18174,6 +18698,35 @@ interface FullscriptSessionGrant {
18174
18698
  expires_at: string;
18175
18699
  patient_id: string;
18176
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
+ }
18177
18730
  /** Attributes for upserting connector credentials. */
18178
18731
  type UpsertCredentialAttributes = {
18179
18732
  workspace_id: string;
@@ -19530,8 +20083,8 @@ declare function createBillingNamespace(rb: RequestBuilder): {
19530
20083
  /**
19531
20084
  * Feature usage records — per-tenant usage tracking for metered features.
19532
20085
  *
19533
- * Read-only access to usage records that track how many times each tenant
19534
- * 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.
19535
20088
  */
19536
20089
  featureUsages: {
19537
20090
  /** List all feature usage records. */
@@ -19540,6 +20093,26 @@ declare function createBillingNamespace(rb: RequestBuilder): {
19540
20093
  get: (id: string, options?: RequestOptions) => Promise<FeatureUsage>;
19541
20094
  /** List usage records for a specific tenant. */
19542
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
+ }>;
19543
20116
  };
19544
20117
  /**
19545
20118
  * Plan-feature allocations — per-plan overrides for feature definitions (read-only).
@@ -20217,7 +20790,7 @@ type CreateAgentAttributes = {
20217
20790
  type CreateAgentVersionAttributes = {
20218
20791
  agent_id: string;
20219
20792
  prompt_template?: unknown;
20220
- version_number: string;
20793
+ version_number?: number;
20221
20794
  changes_summary?: string;
20222
20795
  output_schema?: Record<string, unknown>;
20223
20796
  input_schema?: Record<string, unknown>;
@@ -20276,9 +20849,12 @@ interface Execution {
20276
20849
  total_credits_charged: string | null;
20277
20850
  model_used: string | null;
20278
20851
  requested_model_id: string | null;
20852
+ execution_mode: string | null;
20853
+ error: Record<string, unknown> | null;
20279
20854
  started_at: string | null;
20280
20855
  completed_at: string | null;
20281
20856
  created_at: string;
20857
+ updated_at: string;
20282
20858
  }
20283
20859
  /**
20284
20860
  * Creates the `agents` namespace, providing methods for managing AI agents,
@@ -21282,16 +21858,17 @@ declare function createAgentsNamespace(rb: RequestBuilder): {
21282
21858
  * @param agentId - The UUID of the agent to execute.
21283
21859
  * @param input - Input data for the agent (task description, documents, etc.).
21284
21860
  * @param opts - Additional execution options.
21861
+ * @param opts.workspace_id - The workspace to execute in. **Required** unless
21862
+ * `workspaceId` was set in the `GptClient` constructor config.
21285
21863
  * @param opts.model_id - Override model for this execution only (e.g., "anthropic/claude-sonnet-4").
21286
21864
  * Highest priority in the model resolution chain.
21287
- * @param reqOptions - Optional request options. Use `idempotencyKey` to prevent duplicate executions.
21288
21865
  * @returns The created execution record with status `pending`.
21289
21866
  *
21290
21867
  * @example
21291
21868
  * const exec = await client.agents.executions.start('agt_01...', {
21292
21869
  * task: 'Extract invoice fields',
21293
21870
  * document_id: 'doc_01...',
21294
- * });
21871
+ * }, { workspace_id: 'ws_abc123' });
21295
21872
  * console.log(exec.id, exec.status); // 'pending'
21296
21873
  *
21297
21874
  * @example
@@ -21299,10 +21876,11 @@ declare function createAgentsNamespace(rb: RequestBuilder): {
21299
21876
  * const exec = await client.agents.executions.start(
21300
21877
  * 'agt_01...',
21301
21878
  * { task: 'Complex reasoning' },
21302
- * { model_id: 'anthropic/claude-sonnet-4' },
21879
+ * { workspace_id: 'ws_abc123', model_id: 'anthropic/claude-sonnet-4' },
21303
21880
  * );
21304
21881
  */
21305
21882
  start: (agentId: string, input: Record<string, unknown>, opts?: {
21883
+ workspace_id?: string;
21306
21884
  model_id?: string;
21307
21885
  } & RequestOptions) => Promise<Execution>;
21308
21886
  /**
@@ -21314,16 +21892,19 @@ declare function createAgentsNamespace(rb: RequestBuilder): {
21314
21892
  *
21315
21893
  * @param agentId - The UUID of the agent.
21316
21894
  * @param input - Input data (same format as {@link start}).
21317
- * @param options - Optional request options.
21895
+ * @param opts - Additional options.
21896
+ * @param opts.workspace_id - The workspace to estimate for. Required for `sk_app_` key auth.
21318
21897
  * @returns Cost estimate with min/max credit ranges.
21319
21898
  *
21320
21899
  * @example
21321
21900
  * const estimate = await client.agents.executions.estimate('agt_01...', {
21322
21901
  * task: 'Process batch',
21323
- * });
21902
+ * }, { workspace_id: 'ws_abc123' });
21324
21903
  * console.log(`Estimated cost: ${estimate.min_credits} - ${estimate.max_credits}`);
21325
21904
  */
21326
- estimate: (agentId: string, input: Record<string, unknown>, options?: RequestOptions) => Promise<ExecutionEstimateResponse>;
21905
+ estimate: (agentId: string, input: Record<string, unknown>, opts?: {
21906
+ workspace_id?: string;
21907
+ } & RequestOptions) => Promise<ExecutionEstimateResponse>;
21327
21908
  /**
21328
21909
  * Fetches a single execution by ID.
21329
21910
  *
@@ -21345,13 +21926,16 @@ declare function createAgentsNamespace(rb: RequestBuilder): {
21345
21926
  * Returns only executions triggered by the authenticated user,
21346
21927
  * ordered by creation time descending.
21347
21928
  *
21348
- * @param options - Optional request options.
21929
+ * @param opts - Optional filtering and request options.
21930
+ * @param opts.workspace_id - Filter to a specific workspace. Required for `sk_app_` key auth.
21349
21931
  * @returns Array of execution records.
21350
21932
  *
21351
21933
  * @example
21352
- * const executions = await client.agents.executions.list();
21934
+ * const executions = await client.agents.executions.list({ workspace_id: 'ws_abc123' });
21353
21935
  */
21354
- list: (options?: RequestOptions) => Promise<Execution[]>;
21936
+ list: (opts?: {
21937
+ workspace_id?: string;
21938
+ } & RequestOptions) => Promise<Execution[]>;
21355
21939
  /**
21356
21940
  * Opens an SSE stream for real-time execution events.
21357
21941
  *
@@ -21526,8 +22110,8 @@ declare function createAgentsNamespace(rb: RequestBuilder): {
21526
22110
  interface AuditLog {
21527
22111
  id: string;
21528
22112
  action: string;
21529
- resource_type: string | null;
21530
- resource_id: string | null;
22113
+ resource_type: string;
22114
+ resource_id: string;
21531
22115
  changes: Record<string, unknown> | null;
21532
22116
  target_type: string | null;
21533
22117
  target_id: string | null;
@@ -21574,6 +22158,7 @@ interface CreateClinicalPatientAttributes {
21574
22158
  timezone?: string;
21575
22159
  state?: string;
21576
22160
  tags?: string[];
22161
+ metadata?: Record<string, unknown>;
21577
22162
  }
21578
22163
  interface UpdateClinicalPatientAttributes {
21579
22164
  contact_id?: string;
@@ -21584,6 +22169,7 @@ interface UpdateClinicalPatientAttributes {
21584
22169
  tags?: string[];
21585
22170
  followup_interval_value?: number;
21586
22171
  followup_interval_unit?: string;
22172
+ metadata?: Record<string, unknown>;
21587
22173
  }
21588
22174
  interface CreateClinicalSessionAttributes {
21589
22175
  workspace_id: string;
@@ -21599,6 +22185,8 @@ interface CreateClinicalSessionAttributes {
21599
22185
  session_summary?: string;
21600
22186
  notes?: string;
21601
22187
  external_ids?: Record<string, string>;
22188
+ prep_execution_id?: string;
22189
+ metadata?: Record<string, unknown>;
21602
22190
  }
21603
22191
  interface UpdateClinicalSessionAttributes {
21604
22192
  practitioner_id?: string;
@@ -21613,6 +22201,8 @@ interface UpdateClinicalSessionAttributes {
21613
22201
  session_summary?: string;
21614
22202
  notes?: string;
21615
22203
  external_ids?: Record<string, string>;
22204
+ prep_execution_id?: string;
22205
+ metadata?: Record<string, unknown>;
21616
22206
  }
21617
22207
  interface CreateClinicalNoteAttributes {
21618
22208
  workspace_id: string;
@@ -21620,11 +22210,13 @@ interface CreateClinicalNoteAttributes {
21620
22210
  pipeline_execution_id?: string;
21621
22211
  note_type?: string;
21622
22212
  note_content?: string;
22213
+ metadata?: Record<string, unknown>;
21623
22214
  }
21624
22215
  interface UpdateClinicalNoteAttributes {
21625
22216
  pipeline_execution_id?: string;
21626
22217
  note_type?: string;
21627
22218
  note_content?: string;
22219
+ metadata?: Record<string, unknown>;
21628
22220
  }
21629
22221
  interface CreateHealthMetricAttributes {
21630
22222
  workspace_id: string;
@@ -21641,6 +22233,7 @@ interface CreateHealthMetricAttributes {
21641
22233
  extracted_from?: string;
21642
22234
  confidence?: number;
21643
22235
  raw_extract?: string;
22236
+ metadata?: Record<string, unknown>;
21644
22237
  }
21645
22238
  interface UpdateHealthMetricAttributes {
21646
22239
  metric_type?: string;
@@ -21651,6 +22244,7 @@ interface UpdateHealthMetricAttributes {
21651
22244
  measured_at?: string;
21652
22245
  source?: string;
21653
22246
  confidence?: number;
22247
+ metadata?: Record<string, unknown>;
21654
22248
  }
21655
22249
  interface CreateMealPlanAttributes {
21656
22250
  workspace_id: string;
@@ -21663,6 +22257,7 @@ interface CreateMealPlanAttributes {
21663
22257
  plan_content?: string;
21664
22258
  patient_notes?: string;
21665
22259
  parent_plan_id?: string;
22260
+ metadata?: Record<string, unknown>;
21666
22261
  }
21667
22262
  interface UpdateMealPlanAttributes {
21668
22263
  status?: string;
@@ -21671,6 +22266,7 @@ interface UpdateMealPlanAttributes {
21671
22266
  macro_targets?: Record<string, unknown>;
21672
22267
  plan_content?: string;
21673
22268
  patient_notes?: string;
22269
+ metadata?: Record<string, unknown>;
21674
22270
  }
21675
22271
  interface CreateClientGoalAttributes {
21676
22272
  workspace_id: string;
@@ -21736,6 +22332,7 @@ interface CreateClientSupplementAttributes {
21736
22332
  fullscript_variant_id?: string;
21737
22333
  prescribed_at?: string;
21738
22334
  discontinued_at?: string;
22335
+ metadata?: Record<string, unknown>;
21739
22336
  }
21740
22337
  interface UpdateClientSupplementAttributes {
21741
22338
  status?: string;
@@ -21749,6 +22346,7 @@ interface UpdateClientSupplementAttributes {
21749
22346
  fullscript_variant_id?: string;
21750
22347
  prescribed_at?: string;
21751
22348
  discontinued_at?: string;
22349
+ metadata?: Record<string, unknown>;
21752
22350
  }
21753
22351
  interface CreateDeliveryAttributes {
21754
22352
  workspace_id: string;
@@ -21761,17 +22359,19 @@ interface CreateDeliveryAttributes {
21761
22359
  included_supplement_ids?: string[];
21762
22360
  included_resource_ids?: string[];
21763
22361
  delivered_at?: string;
22362
+ metadata?: Record<string, unknown>;
21764
22363
  }
21765
22364
  interface UpdateDeliveryAttributes {
21766
22365
  status?: string;
21767
22366
  delivered_at?: string;
21768
22367
  email_message_id?: string;
22368
+ metadata?: Record<string, unknown>;
21769
22369
  }
21770
22370
  interface CreatePracticeResourceAttributes {
21771
22371
  workspace_id: string;
21772
22372
  title: string;
21773
22373
  description?: string;
21774
- resource_type?: "article" | "video" | "handout" | "worksheet" | "tool_link" | "infographic" | "audio" | "recipe" | "checklist" | "protocol" | "assessment" | "exercise" | "template" | "presentation" | "ebook";
22374
+ resource_type?: "article" | "video" | "handout" | "worksheet" | "tool_link" | "infographic" | "audio" | "recipe" | "checklist" | "protocol" | "assessment" | "exercise" | "template" | "presentation" | "ebook" | "other";
21775
22375
  storage_key?: string;
21776
22376
  url?: string;
21777
22377
  tags?: string[];
@@ -21787,11 +22387,14 @@ interface CreatePracticeResourceAttributes {
21787
22387
  applicable_conditions?: string[];
21788
22388
  related_goal_types?: string[];
21789
22389
  icon_url?: string;
22390
+ category?: string;
22391
+ condition_tags?: string[];
22392
+ metadata?: Record<string, unknown>;
21790
22393
  }
21791
22394
  interface UpdatePracticeResourceAttributes {
21792
22395
  title?: string;
21793
22396
  description?: string;
21794
- resource_type?: "article" | "video" | "handout" | "worksheet" | "tool_link" | "infographic" | "audio" | "recipe" | "checklist" | "protocol" | "assessment" | "exercise" | "template" | "presentation" | "ebook";
22397
+ resource_type?: "article" | "video" | "handout" | "worksheet" | "tool_link" | "infographic" | "audio" | "recipe" | "checklist" | "protocol" | "assessment" | "exercise" | "template" | "presentation" | "ebook" | "other";
21795
22398
  storage_key?: string;
21796
22399
  url?: string;
21797
22400
  tags?: string[];
@@ -21807,6 +22410,9 @@ interface UpdatePracticeResourceAttributes {
21807
22410
  applicable_conditions?: string[];
21808
22411
  related_goal_types?: string[];
21809
22412
  icon_url?: string;
22413
+ category?: string;
22414
+ condition_tags?: string[];
22415
+ metadata?: Record<string, unknown>;
21810
22416
  }
21811
22417
  interface CreatePracticeToolAttributes {
21812
22418
  workspace_id: string;
@@ -21828,6 +22434,7 @@ interface CreatePracticeToolAttributes {
21828
22434
  rating?: string;
21829
22435
  privacy_rating?: "hipaa_compliant" | "hipaa_partial" | "standard" | "unknown";
21830
22436
  tags?: string[];
22437
+ metadata?: Record<string, unknown>;
21831
22438
  }
21832
22439
  interface UpdatePracticeToolAttributes {
21833
22440
  name?: string;
@@ -21848,6 +22455,7 @@ interface UpdatePracticeToolAttributes {
21848
22455
  rating?: string;
21849
22456
  privacy_rating?: "hipaa_compliant" | "hipaa_partial" | "standard" | "unknown";
21850
22457
  tags?: string[];
22458
+ metadata?: Record<string, unknown>;
21851
22459
  }
21852
22460
  /** Parameters for listing practice tools. */
21853
22461
  interface ListPracticeToolsParams {
@@ -21877,11 +22485,13 @@ interface CreateClientResourceAssignmentAttributes {
21877
22485
  status?: string;
21878
22486
  assigned_at?: string;
21879
22487
  notes?: string;
22488
+ metadata?: Record<string, unknown>;
21880
22489
  }
21881
22490
  interface UpdateClientResourceAssignmentAttributes {
21882
22491
  status?: string;
21883
22492
  completed_at?: string;
21884
22493
  notes?: string;
22494
+ metadata?: Record<string, unknown>;
21885
22495
  }
21886
22496
  interface TriggerPipelineResponse {
21887
22497
  execution_id: string | null;
@@ -21903,6 +22513,15 @@ interface PatientAdherenceResponse {
21903
22513
  goals: PatientAdherenceGoals;
21904
22514
  health_metrics: PatientAdherenceHealthMetrics;
21905
22515
  }
22516
+ /** Item in a batch reorder request. */
22517
+ interface ReorderGoalItem {
22518
+ id: string;
22519
+ position: number;
22520
+ }
22521
+ /** Server response from a batch reorder operation. */
22522
+ interface ReorderGoalsResponse {
22523
+ reordered: number;
22524
+ }
21906
22525
  interface CreateGoalTemplateAttributes {
21907
22526
  workspace_id: string;
21908
22527
  goal_type: string;
@@ -21975,6 +22594,46 @@ interface RecipeSearchParams {
21975
22594
  interface GenerateSupplementRecsResponse {
21976
22595
  execution_id: string | null;
21977
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
+ }
21978
22637
  /**
21979
22638
  * Clinical namespace — patient management, sessions, notes, health data, and care plans.
21980
22639
  *
@@ -22158,7 +22817,7 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
22158
22817
  getAdherence: (patientId: string, workspaceId: string, days?: number, options?: RequestOptions) => Promise<PatientAdherenceResponse>;
22159
22818
  };
22160
22819
  /**
22161
- * Manage clinical sessions (practitionerpatient encounters).
22820
+ * Manage clinical sessions (practitioner-patient encounters).
22162
22821
  */
22163
22822
  sessions: {
22164
22823
  /**
@@ -22281,13 +22940,47 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
22281
22940
  */
22282
22941
  update: (id: string, attributes: UpdateClinicalNoteAttributes, options?: RequestOptions) => Promise<ClinicalNote>;
22283
22942
  /**
22284
- * Delete a clinical note.
22943
+ * Archive (soft-delete) a note.
22285
22944
  *
22945
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
22946
+ * Use `permanentDelete()` for irreversible removal.
22286
22947
  * @param id - Note UUID
22287
22948
  * @param options - Request options
22288
- * @returns `true` on successful deletion
22949
+ * @returns Archived {@link ClinicalNote} record
22289
22950
  */
22290
- 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[]>;
22291
22984
  /**
22292
22985
  * Approve a clinical note (HITL workflow).
22293
22986
  *
@@ -22396,13 +23089,47 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
22396
23089
  */
22397
23090
  update: (id: string, attributes: UpdateHealthMetricAttributes, options?: RequestOptions) => Promise<ClinicalHealthMetric>;
22398
23091
  /**
22399
- * Delete a health metric entry.
23092
+ * Archive (soft-delete) a health metric.
22400
23093
  *
23094
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
23095
+ * Use `permanentDelete()` for irreversible removal.
22401
23096
  * @param id - HealthMetric UUID
22402
23097
  * @param options - Request options
22403
- * @returns `true` on successful deletion
23098
+ * @returns Archived {@link ClinicalHealthMetric} record
22404
23099
  */
22405
- 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[]>;
22406
23133
  };
22407
23134
  /**
22408
23135
  * Manage meal plans for clinical patients.
@@ -22442,13 +23169,47 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
22442
23169
  */
22443
23170
  update: (id: string, attributes: UpdateMealPlanAttributes, options?: RequestOptions) => Promise<ClinicalMealPlan>;
22444
23171
  /**
22445
- * Delete a meal plan.
23172
+ * Archive (soft-delete) a meal plan.
22446
23173
  *
23174
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
23175
+ * Use `permanentDelete()` for irreversible removal.
22447
23176
  * @param id - MealPlan UUID
22448
23177
  * @param options - Request options
22449
- * @returns `true` on successful deletion
23178
+ * @returns Archived {@link ClinicalMealPlan} record
22450
23179
  */
22451
- 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[]>;
22452
23213
  };
22453
23214
  /**
22454
23215
  * Manage client goals (therapeutic targets and wellness milestones).
@@ -22488,13 +23249,64 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
22488
23249
  */
22489
23250
  update: (id: string, attributes: UpdateClientGoalAttributes, options?: RequestOptions) => Promise<ClinicalClientGoal>;
22490
23251
  /**
22491
- * Delete a client goal.
23252
+ * Archive (soft-delete) a client goal.
22492
23253
  *
23254
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
23255
+ * Use `permanentDelete()` for irreversible removal.
22493
23256
  * @param id - ClientGoal UUID
22494
23257
  * @param options - Request options
22495
- * @returns `true` on successful deletion
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>;
23285
+ /**
23286
+ * List archived (soft-deleted) client goals.
23287
+ *
23288
+ * @param params - Filter/pagination parameters
23289
+ * @param options - Request options
23290
+ * @returns Array of archived {@link ClinicalClientGoal} records
23291
+ */
23292
+ listArchived: (params?: Record<string, unknown>, options?: RequestOptions) => Promise<ClinicalClientGoal[]>;
23293
+ /**
23294
+ * Batch reorder client goals by updating their positions.
23295
+ *
23296
+ * @param items - Array of `{ id, position }` pairs specifying new order
23297
+ * @param options - Request options
23298
+ * @returns `{ reordered: number }` — count of updated goals
23299
+ *
23300
+ * @example
23301
+ * ```typescript
23302
+ * await client.clinical.clientGoals.reorder([
23303
+ * { id: "goal-uuid-1", position: 0 },
23304
+ * { id: "goal-uuid-2", position: 1 },
23305
+ * { id: "goal-uuid-3", position: 2 },
23306
+ * ]);
23307
+ * ```
22496
23308
  */
22497
- delete: (id: string, options?: RequestOptions) => Promise<true>;
23309
+ reorder: (items: ReorderGoalItem[], options?: RequestOptions) => Promise<ReorderGoalsResponse>;
22498
23310
  };
22499
23311
  /**
22500
23312
  * Manage supplement prescriptions for clinical patients.
@@ -22535,13 +23347,47 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
22535
23347
  */
22536
23348
  update: (id: string, attributes: UpdateClientSupplementAttributes, options?: RequestOptions) => Promise<ClinicalClientSupplement>;
22537
23349
  /**
22538
- * Delete a supplement prescription.
23350
+ * Archive (soft-delete) a supplement prescription.
22539
23351
  *
23352
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
23353
+ * Use `permanentDelete()` for irreversible removal.
22540
23354
  * @param id - ClientSupplement UUID
22541
23355
  * @param options - Request options
22542
- * @returns `true` on successful deletion
23356
+ * @returns Archived {@link ClinicalClientSupplement} record
22543
23357
  */
22544
- 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[]>;
22545
23391
  };
22546
23392
  /**
22547
23393
  * Manage clinical deliveries (care plan items sent to patients).
@@ -22620,13 +23466,47 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
22620
23466
  */
22621
23467
  update: (id: string, attributes: UpdatePracticeResourceAttributes, options?: RequestOptions) => Promise<ClinicalPracticeResource>;
22622
23468
  /**
22623
- * Delete a practice resource.
23469
+ * Archive (soft-delete) a practice resource.
22624
23470
  *
23471
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
23472
+ * Use `permanentDelete()` for irreversible removal.
22625
23473
  * @param id - PracticeResource UUID
22626
23474
  * @param options - Request options
22627
- * @returns `true` on successful deletion
23475
+ * @returns Archived {@link ClinicalPracticeResource} record
22628
23476
  */
22629
- 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[]>;
22630
23510
  /**
22631
23511
  * List application-level catalog practice resources.
22632
23512
  *
@@ -22638,6 +23518,38 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
22638
23518
  filter?: Record<string, unknown>;
22639
23519
  sort?: string;
22640
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[]>;
22641
23553
  /**
22642
23554
  * List distinct practice resource categories in a workspace.
22643
23555
  *
@@ -22674,6 +23586,45 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
22674
23586
  * ```
22675
23587
  */
22676
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[]>;
22677
23628
  };
22678
23629
  /**
22679
23630
  * Manage practice-level assessment and therapeutic tools.
@@ -22713,13 +23664,47 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
22713
23664
  */
22714
23665
  update: (id: string, attributes: UpdatePracticeToolAttributes, options?: RequestOptions) => Promise<ClinicalPracticeTool>;
22715
23666
  /**
22716
- * Delete a practice tool.
23667
+ * Archive (soft-delete) a practice tool.
22717
23668
  *
23669
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
23670
+ * Use `permanentDelete()` for irreversible removal.
22718
23671
  * @param id - PracticeTool UUID
22719
23672
  * @param options - Request options
22720
- * @returns `true` on successful deletion
23673
+ * @returns Archived {@link ClinicalPracticeTool} record
22721
23674
  */
22722
- 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[]>;
22723
23708
  /**
22724
23709
  * List distinct practice tool categories in a workspace.
22725
23710
  *
@@ -22752,6 +23737,38 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
22752
23737
  filter?: Record<string, unknown>;
22753
23738
  sort?: string;
22754
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[]>;
22755
23772
  /**
22756
23773
  * List distinct catalog practice tool categories.
22757
23774
  *
@@ -22767,6 +23784,44 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
22767
23784
  * ```
22768
23785
  */
22769
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[]>;
22770
23825
  };
22771
23826
  /**
22772
23827
  * Manage assignments of practice resources to patients.
@@ -22807,13 +23862,47 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
22807
23862
  */
22808
23863
  update: (id: string, attributes: UpdateClientResourceAssignmentAttributes, options?: RequestOptions) => Promise<ClinicalClientResourceAssignment>;
22809
23864
  /**
22810
- * Delete a resource assignment.
23865
+ * Archive (soft-delete) a resource assignment.
22811
23866
  *
23867
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
23868
+ * Use `permanentDelete()` for irreversible removal.
22812
23869
  * @param id - ClientResourceAssignment UUID
22813
23870
  * @param options - Request options
22814
- * @returns `true` on successful deletion
23871
+ * @returns Archived {@link ClinicalClientResourceAssignment} record
22815
23872
  */
22816
- 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[]>;
22817
23906
  };
22818
23907
  /**
22819
23908
  * Read-only access to the AI-generated supplement recommendation cache.
@@ -22955,13 +24044,47 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
22955
24044
  */
22956
24045
  update: (id: string, attributes: UpdateGoalTemplateAttributes, options?: RequestOptions) => Promise<ClinicalGoalTemplate>;
22957
24046
  /**
22958
- * Delete a goal template.
24047
+ * Archive (soft-delete) a goal template.
22959
24048
  *
24049
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
24050
+ * Use `permanentDelete()` for irreversible removal.
22960
24051
  * @param id - GoalTemplate UUID
22961
24052
  * @param options - Request options
22962
- * @returns `true` on successful deletion
24053
+ * @returns Archived {@link ClinicalGoalTemplate} record
22963
24054
  */
22964
- 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[]>;
22965
24088
  /**
22966
24089
  * List application-level catalog goal templates.
22967
24090
  *
@@ -22973,6 +24096,38 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
22973
24096
  filter?: Record<string, unknown>;
22974
24097
  sort?: string;
22975
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[]>;
22976
24131
  /**
22977
24132
  * List distinct catalog goal template categories.
22978
24133
  *
@@ -22988,6 +24143,44 @@ declare function createClinicalNamespace(rb: RequestBuilder): {
22988
24143
  * ```
22989
24144
  */
22990
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[]>;
22991
24184
  };
22992
24185
  /**
22993
24186
  * Recipe search via configured Edamam connector.
@@ -23134,11 +24327,16 @@ declare class GptClient extends BaseClient {
23134
24327
  };
23135
24328
  executions: {
23136
24329
  start: (agentId: string, input: Record<string, unknown>, opts?: {
24330
+ workspace_id?: string;
23137
24331
  model_id?: string;
23138
24332
  } & RequestOptions) => Promise<Execution>;
23139
- estimate: (agentId: string, input: Record<string, unknown>, options?: RequestOptions) => Promise<ExecutionEstimateResponse>;
24333
+ estimate: (agentId: string, input: Record<string, unknown>, opts?: {
24334
+ workspace_id?: string;
24335
+ } & RequestOptions) => Promise<ExecutionEstimateResponse>;
23140
24336
  get: (id: string, options?: RequestOptions) => Promise<Execution>;
23141
- list: (options?: RequestOptions) => Promise<Execution[]>;
24337
+ list: (opts?: {
24338
+ workspace_id?: string;
24339
+ } & RequestOptions) => Promise<Execution[]>;
23142
24340
  stream: (id: string, options?: RequestOptions & StreamOptions) => Promise<AsyncIterableIterator<ExecutionEvent>>;
23143
24341
  approve: (id: string, approvedData?: Record<string, unknown>, options?: RequestOptions) => Promise<Execution>;
23144
24342
  deny: (id: string, reason: string, options?: RequestOptions) => Promise<Execution>;
@@ -23260,6 +24458,10 @@ declare class GptClient extends BaseClient {
23260
24458
  list: (options?: RequestOptions) => Promise<FeatureUsage[]>;
23261
24459
  get: (id: string, options?: RequestOptions) => Promise<FeatureUsage>;
23262
24460
  listByTenant: (tenantId: string, options?: RequestOptions) => Promise<FeatureUsage[]>;
24461
+ increment: (featureKey: string, options?: RequestOptions) => Promise<{
24462
+ used: number;
24463
+ remaining: number | null;
24464
+ }>;
23263
24465
  };
23264
24466
  planFeatureAllocations: {
23265
24467
  list: (options?: {
@@ -23280,7 +24482,7 @@ declare class GptClient extends BaseClient {
23280
24482
  products: {
23281
24483
  list: (workspaceId: string, options?: {
23282
24484
  page?: number;
23283
- pageSize?: number;
24485
+ pageSize? /** Workspaces, applications, tenants, and invitations */: number;
23284
24486
  } & RequestOptions) => Promise<CatalogProduct[]>;
23285
24487
  get: (id: string, options?: RequestOptions) => Promise<CatalogProduct>;
23286
24488
  create: (attributes: CreateCatalogProductAttributes, options?: RequestOptions) => Promise<CatalogProduct>;
@@ -23654,6 +24856,14 @@ declare class GptClient extends BaseClient {
23654
24856
  date_of_birth?: string;
23655
24857
  }, options?: RequestOptions) => Promise<FullscriptPatient>;
23656
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>;
23657
24867
  oauth: {
23658
24868
  connect: (workspaceId: string, options?: RequestOptions) => Promise<OAuthInitiateResult>;
23659
24869
  callback: (code: string, state: string, workspaceId: string, redirectUri?: string, options?: RequestOptions) => Promise<ConnectorInstance>;
@@ -23851,7 +25061,7 @@ declare class GptClient extends BaseClient {
23851
25061
  suggestTopics: (attributes: {
23852
25062
  workspace_id: string;
23853
25063
  industry?: string;
23854
- brand_identity_id? /** Pipeline trigger — execute multi-node agent pipelines */: string;
25064
+ brand_identity_id?: string;
23855
25065
  count?: number;
23856
25066
  }, options?: RequestOptions) => Promise<unknown>;
23857
25067
  generateImagePrompt: (attributes: {
@@ -24152,6 +25362,7 @@ declare class GptClient extends BaseClient {
24152
25362
  /** User authentication, profiles, and API key management */
24153
25363
  readonly identity: {
24154
25364
  login: (email: string, password: string, options?: RequestOptions) => Promise<User>;
25365
+ refresh: (refreshToken: string, options?: RequestOptions) => Promise<RefreshResponse>;
24155
25366
  register: (email: string, password: string, passwordConfirmation: string, tenantName: string, attrs?: RegisterExtraAttributes, options?: RequestOptions) => Promise<User>;
24156
25367
  registerViaInvitation: (email: string, password: string, passwordConfirmation: string, invitationToken: string, attrs?: RegisterExtraAttributes, options?: RequestOptions) => Promise<User>;
24157
25368
  me: (options?: RequestOptions) => Promise<User>;
@@ -24561,26 +25772,32 @@ declare class GptClient extends BaseClient {
24561
25772
  list: (options?: {
24562
25773
  page?: number;
24563
25774
  pageSize?: number;
24564
- } & RequestOptions) => Promise<Thread[]>;
24565
- listAll: (options?: RequestOptions) => Promise<Thread[]>;
24566
- create: (attributes: CreateThreadAttributes, options?: RequestOptions) => Promise<Thread>;
24567
- update: (id: string, attributes: UpdateThreadAttributes, options?: RequestOptions) => Promise<Thread>;
24568
- summarize: (id: string, options?: RequestOptions) => Promise<Thread>;
24569
- fork: (id: string, options?: RequestOptions) => Promise<Thread>;
24570
- export: (id: string, options?: RequestOptions) => Promise<Thread>;
24571
- get: (id: string, options?: RequestOptions) => Promise<Thread>;
24572
- archive: (id: string, options?: RequestOptions) => Promise<Thread>;
24573
- 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>;
24574
25791
  messages: {
24575
- list: (threadId: string, options?: RequestOptions) => Promise<Message[]>;
24576
- 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>;
24577
25794
  stream: (threadId: string, body: Record<string, unknown>, options?: RequestOptions, streamOptions?: StreamOptions) => Promise<AsyncIterableIterator<StreamMessageChunk>>;
24578
- search: (query: string, options?: RequestOptions) => Promise<Message[]>;
24579
- 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[]>;
24580
25797
  };
24581
- complete: (threadId: string, options?: RequestOptions) => Promise<Thread>;
25798
+ complete: (threadId: string, options?: RequestOptions) => Promise<ChatThread>;
24582
25799
  completeStream: (threadId: string, options?: RequestOptions, streamOptions?: StreamOptions) => Promise<AsyncIterableIterator<StreamMessageChunk>>;
24583
- search: (query: string, options?: RequestOptions) => Promise<Thread[]>;
25800
+ search: (query: string, options?: RequestOptions) => Promise<ChatThread[]>;
24584
25801
  };
24585
25802
  /** Training examples and sessions */
24586
25803
  readonly training: {
@@ -24760,6 +25977,7 @@ declare class GptClient extends BaseClient {
24760
25977
  listByWorkspace: (workspaceId: string, options?: RequestOptions) => Promise<unknown>;
24761
25978
  create: (attributes: Record<string, unknown>, options?: RequestOptions) => Promise<unknown>;
24762
25979
  delete: (id: string, options?: RequestOptions) => Promise<unknown>;
25980
+ listByDateRange: (from: string, to: string, options?: RequestOptions) => Promise<unknown>;
24763
25981
  items: {
24764
25982
  get: (id: string, options?: RequestOptions) => Promise<unknown>;
24765
25983
  listBySnapshot: (snapshotId: string, options?: RequestOptions) => Promise<unknown>;
@@ -24771,7 +25989,6 @@ declare class GptClient extends BaseClient {
24771
25989
  create: (attributes: Record<string, unknown>, options?: RequestOptions) => Promise<unknown>;
24772
25990
  update: (id: string, attributes: Record<string, unknown>, options?: RequestOptions) => Promise<unknown>;
24773
25991
  delete: (id: string, options?: RequestOptions) => Promise<unknown>;
24774
- markTriggered: (id: string, options?: RequestOptions) => Promise<unknown>;
24775
25992
  };
24776
25993
  };
24777
25994
  /** Project, milestone, task, time entry, member, risk, and AI management */
@@ -24874,12 +26091,83 @@ declare class GptClient extends BaseClient {
24874
26091
  };
24875
26092
  documentSections: {
24876
26093
  list: (params?: {
24877
- 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;
24878
26097
  pageSize?: number;
24879
26098
  }, options?: RequestOptions) => Promise<DocumentSection[]>;
24880
26099
  get: (id: string, options?: RequestOptions) => Promise<DocumentSection>;
24881
26100
  };
24882
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
+ };
24883
26171
  constructor(config?: BaseClientConfig);
24884
26172
  /**
24885
26173
  * Subscribe to SDK lifecycle events.
@@ -25154,6 +26442,20 @@ declare function createSocialNamespace(rb: RequestBuilder): {
25154
26442
  create: (attributes: Record<string, unknown>, options?: RequestOptions) => Promise<unknown>;
25155
26443
  /** Delete a trending snapshot by ID. */
25156
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>;
25157
26459
  /** Trending snapshot items — individual content pieces within a snapshot. */
25158
26460
  items: {
25159
26461
  /** Get a single trending item by ID. */
@@ -25212,11 +26514,6 @@ declare function createSocialNamespace(rb: RequestBuilder): {
25212
26514
  update: (id: string, attributes: Record<string, unknown>, options?: RequestOptions) => Promise<unknown>;
25213
26515
  /** Delete a trending watch by ID. */
25214
26516
  delete: (id: string, options?: RequestOptions) => Promise<unknown>;
25215
- /**
25216
- * Mark a watch as triggered (updates last_triggered_at).
25217
- * @param id - Watch UUID
25218
- */
25219
- markTriggered: (id: string, options?: RequestOptions) => Promise<unknown>;
25220
26517
  };
25221
26518
  };
25222
26519
 
@@ -25340,4 +26637,4 @@ type SocialAPI = ReturnType<typeof createSocialNamespace>;
25340
26637
  type ModelsAPI = ReturnType<typeof createModelsNamespace>;
25341
26638
  type MemoryAPI = ReturnType<typeof createMemoryNamespace>;
25342
26639
 
25343
- 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 };