@gpt-platform/client 0.10.3 → 0.10.5

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.mjs CHANGED
@@ -1272,7 +1272,7 @@ function buildUserAgent(sdkVersion, appInfo) {
1272
1272
  }
1273
1273
 
1274
1274
  // src/version.ts
1275
- var SDK_VERSION = "0.10.3";
1275
+ var SDK_VERSION = "0.10.5";
1276
1276
  var DEFAULT_API_VERSION = "2026-03-23";
1277
1277
 
1278
1278
  // src/base-client.ts
@@ -2238,6 +2238,11 @@ var getSupportTagsWorkspaceByWorkspaceId = (options) => (options.client ?? clien
2238
2238
  url: "/support/tags/workspace/{workspace_id}",
2239
2239
  ...options
2240
2240
  });
2241
+ var getClinicalPatientsByIdMedications = (options) => (options.client ?? client).get({
2242
+ security: [{ scheme: "bearer", type: "http" }],
2243
+ url: "/clinical/patients/{id}/medications",
2244
+ ...options
2245
+ });
2241
2246
  var getSearchIndexes = (options) => (options.client ?? client).get({
2242
2247
  security: [{ scheme: "bearer", type: "http" }],
2243
2248
  url: "/search/indexes",
@@ -2393,6 +2398,11 @@ var getExtractionBatchesWorkspaceByWorkspaceId = (options) => (options.client ??
2393
2398
  url: "/extraction/batches/workspace/{workspace_id}",
2394
2399
  ...options
2395
2400
  });
2401
+ var getExtractionAgents = (options) => (options.client ?? client).get({
2402
+ security: [{ scheme: "bearer", type: "http" }],
2403
+ url: "/extraction/agents",
2404
+ ...options
2405
+ });
2396
2406
  var deleteClinicalPracticeResourcesByIdPermanent = (options) => (options.client ?? client).delete({
2397
2407
  security: [{ scheme: "bearer", type: "http" }],
2398
2408
  url: "/clinical/practice-resources/{id}/permanent",
@@ -2584,6 +2594,15 @@ var patchInvitationsByIdRevoke = (options) => (options.client ?? client).patch({
2584
2594
  ...options.headers
2585
2595
  }
2586
2596
  });
2597
+ var postExtractionAgentsPredict = (options) => (options.client ?? client).post({
2598
+ security: [{ scheme: "bearer", type: "http" }],
2599
+ url: "/extraction/agents/predict",
2600
+ ...options,
2601
+ headers: {
2602
+ "Content-Type": "application/vnd.api+json",
2603
+ ...options.headers
2604
+ }
2605
+ });
2587
2606
  var getCatalogTaxonomiesApplicationByApplicationId = (options) => (options.client ?? client).get({
2588
2607
  security: [{ scheme: "bearer", type: "http" }],
2589
2608
  url: "/catalog/taxonomies/application/{application_id}",
@@ -3189,6 +3208,11 @@ var patchStorageFilesByIdRestore = (options) => (options.client ?? client).patch
3189
3208
  ...options.headers
3190
3209
  }
3191
3210
  });
3211
+ var getWorkspacesByWorkspaceIdTrainingAnalytics = (options) => (options.client ?? client).get({
3212
+ security: [{ scheme: "bearer", type: "http" }],
3213
+ url: "/workspaces/{workspace_id}/training/analytics",
3214
+ ...options
3215
+ });
3192
3216
  var patchSocialCampaignsByIdCancel = (options) => (options.client ?? client).patch({
3193
3217
  security: [{ scheme: "bearer", type: "http" }],
3194
3218
  url: "/social/campaigns/{id}/cancel",
@@ -5005,6 +5029,11 @@ var getAuditLogs = (options) => (options.client ?? client).get({
5005
5029
  url: "/audit-logs",
5006
5030
  ...options
5007
5031
  });
5032
+ var getClinicalClientMedicationsArchived = (options) => (options.client ?? client).get({
5033
+ security: [{ scheme: "bearer", type: "http" }],
5034
+ url: "/clinical/client-medications/archived",
5035
+ ...options
5036
+ });
5008
5037
  var getEmailInclusionsEmailByOutboundEmailId = (options) => (options.client ?? client).get({
5009
5038
  security: [{ scheme: "bearer", type: "http" }],
5010
5039
  url: "/email/inclusions/email/{outbound_email_id}",
@@ -5599,6 +5628,15 @@ var patchApplicationsById = (options) => (options.client ?? client).patch({
5599
5628
  ...options.headers
5600
5629
  }
5601
5630
  });
5631
+ var patchClinicalClientMedicationsByIdRestore = (options) => (options.client ?? client).patch({
5632
+ security: [{ scheme: "bearer", type: "http" }],
5633
+ url: "/clinical/client-medications/{id}/restore",
5634
+ ...options,
5635
+ headers: {
5636
+ "Content-Type": "application/vnd.api+json",
5637
+ ...options.headers
5638
+ }
5639
+ });
5602
5640
  var patchEmailOutboundEmailsByIdSchedule = (options) => (options.client ?? client).patch({
5603
5641
  security: [{ scheme: "bearer", type: "http" }],
5604
5642
  url: "/email/outbound-emails/{id}/schedule",
@@ -6343,6 +6381,15 @@ var postContentRewriteTone = (options) => (options.client ?? client).post({
6343
6381
  ...options.headers
6344
6382
  }
6345
6383
  });
6384
+ var patchClinicalClientMedicationsByIdArchive = (options) => (options.client ?? client).patch({
6385
+ security: [{ scheme: "bearer", type: "http" }],
6386
+ url: "/clinical/client-medications/{id}/archive",
6387
+ ...options,
6388
+ headers: {
6389
+ "Content-Type": "application/vnd.api+json",
6390
+ ...options.headers
6391
+ }
6392
+ });
6346
6393
  var patchStorageFilesByIdSoftDelete = (options) => (options.client ?? client).patch({
6347
6394
  security: [{ scheme: "bearer", type: "http" }],
6348
6395
  url: "/storage-files/{id}/soft-delete",
@@ -6655,6 +6702,20 @@ var getPlans = (options) => (options.client ?? client).get({
6655
6702
  url: "/plans",
6656
6703
  ...options
6657
6704
  });
6705
+ var getClinicalClientMedications = (options) => (options.client ?? client).get({
6706
+ security: [{ scheme: "bearer", type: "http" }],
6707
+ url: "/clinical/client-medications",
6708
+ ...options
6709
+ });
6710
+ var postClinicalClientMedications = (options) => (options.client ?? client).post({
6711
+ security: [{ scheme: "bearer", type: "http" }],
6712
+ url: "/clinical/client-medications",
6713
+ ...options,
6714
+ headers: {
6715
+ "Content-Type": "application/vnd.api+json",
6716
+ ...options.headers
6717
+ }
6718
+ });
6658
6719
  var postCrmActivities = (options) => (options.client ?? client).post({
6659
6720
  security: [{ scheme: "bearer", type: "http" }],
6660
6721
  url: "/crm/activities",
@@ -6752,6 +6813,20 @@ var patchSchedulingParticipantsByIdRespond = (options) => (options.client ?? cli
6752
6813
  ...options.headers
6753
6814
  }
6754
6815
  });
6816
+ var getClinicalClientMedicationsById = (options) => (options.client ?? client).get({
6817
+ security: [{ scheme: "bearer", type: "http" }],
6818
+ url: "/clinical/client-medications/{id}",
6819
+ ...options
6820
+ });
6821
+ var patchClinicalClientMedicationsById = (options) => (options.client ?? client).patch({
6822
+ security: [{ scheme: "bearer", type: "http" }],
6823
+ url: "/clinical/client-medications/{id}",
6824
+ ...options,
6825
+ headers: {
6826
+ "Content-Type": "application/vnd.api+json",
6827
+ ...options.headers
6828
+ }
6829
+ });
6755
6830
  var postAgentsByIdTest = (options) => (options.client ?? client).post({
6756
6831
  security: [{ scheme: "bearer", type: "http" }],
6757
6832
  url: "/agents/{id}/test",
@@ -6954,6 +7029,15 @@ var postUsersAuthResendConfirmation = (options) => (options.client ?? client).po
6954
7029
  ...options.headers
6955
7030
  }
6956
7031
  });
7032
+ var postSocialCampaignsByIdPreviewAdaptations = (options) => (options.client ?? client).post({
7033
+ security: [{ scheme: "bearer", type: "http" }],
7034
+ url: "/social/campaigns/{id}/preview-adaptations",
7035
+ ...options,
7036
+ headers: {
7037
+ "Content-Type": "application/vnd.api+json",
7038
+ ...options.headers
7039
+ }
7040
+ });
6957
7041
  var getCrawlerResultsById = (options) => (options.client ?? client).get({
6958
7042
  security: [{ scheme: "bearer", type: "http" }],
6959
7043
  url: "/crawler/results/{id}",
@@ -7169,6 +7253,11 @@ var postEmailInclusions = (options) => (options.client ?? client).post({
7169
7253
  ...options.headers
7170
7254
  }
7171
7255
  });
7256
+ var deleteClinicalClientMedicationsByIdPermanent = (options) => (options.client ?? client).delete({
7257
+ security: [{ scheme: "bearer", type: "http" }],
7258
+ url: "/clinical/client-medications/{id}/permanent",
7259
+ ...options
7260
+ });
7172
7261
  var getAccessLogs = (options) => (options.client ?? client).get({
7173
7262
  security: [{ scheme: "bearer", type: "http" }],
7174
7263
  url: "/access-logs",
@@ -7337,6 +7426,11 @@ var postExtractionDocumentsBulkReprocess = (options) => (options.client ?? clien
7337
7426
  ...options.headers
7338
7427
  }
7339
7428
  });
7429
+ var getExtractionAgentsById = (options) => (options.client ?? client).get({
7430
+ security: [{ scheme: "bearer", type: "http" }],
7431
+ url: "/extraction/agents/{id}",
7432
+ ...options
7433
+ });
7340
7434
  var getApplicationsBySlugBySlug = (options) => (options.client ?? client).get({
7341
7435
  security: [{ scheme: "bearer", type: "http" }],
7342
7436
  url: "/applications/by-slug/{slug}",
@@ -12510,6 +12604,18 @@ function createClinicalNamespace(rb) {
12510
12604
  { path: { id: patientId } },
12511
12605
  options
12512
12606
  ),
12607
+ /**
12608
+ * List medications for a patient (related resource).
12609
+ *
12610
+ * @param patientId - Patient UUID or CRM Contact UUID
12611
+ * @param options - Request options
12612
+ * @returns Array of {@link ClinicalClientMedication} records
12613
+ */
12614
+ medications: async (patientId, options) => rb.execute(
12615
+ getClinicalPatientsByIdMedications,
12616
+ { path: { id: patientId } },
12617
+ options
12618
+ ),
12513
12619
  /**
12514
12620
  * List resource assignments for a patient (related resource).
12515
12621
  *
@@ -13540,6 +13646,163 @@ function createClinicalNamespace(rb) {
13540
13646
  */
13541
13647
  bulkCreate: async (attrs, options) => rb.rawPost(`/clinical/client-supplements/bulk`, { data: attrs }, options).then((r) => r.data)
13542
13648
  },
13649
+ /**
13650
+ * Manage medication prescriptions for clinical patients.
13651
+ */
13652
+ clientMedications: {
13653
+ /**
13654
+ * List medication prescriptions, filtered by patient/workspace.
13655
+ *
13656
+ * @param params - Filter/pagination parameters
13657
+ * @param options - Request options
13658
+ * @returns Array of {@link ClinicalClientMedication} records
13659
+ */
13660
+ list: async (params, options) => rb.execute(
13661
+ getClinicalClientMedications,
13662
+ { query: params ?? {} },
13663
+ options
13664
+ ),
13665
+ /**
13666
+ * Get a single medication prescription by ID.
13667
+ *
13668
+ * @param id - ClientMedication UUID
13669
+ * @param options - Request options
13670
+ * @returns {@link ClinicalClientMedication} record
13671
+ */
13672
+ get: async (id, options) => rb.execute(
13673
+ getClinicalClientMedicationsById,
13674
+ { path: { id } },
13675
+ options
13676
+ ),
13677
+ /**
13678
+ * Create a new medication prescription.
13679
+ *
13680
+ * @param attributes - Medication creation attributes. Must include `workspace_id`,
13681
+ * `patient_id`, and `name`.
13682
+ * @param options - Request options
13683
+ * @returns Created {@link ClinicalClientMedication} record
13684
+ */
13685
+ create: async (attributes, options) => rb.execute(
13686
+ postClinicalClientMedications,
13687
+ {
13688
+ body: { data: { type: "clinical-client-medication", attributes } }
13689
+ },
13690
+ options
13691
+ ),
13692
+ /**
13693
+ * Update a medication prescription.
13694
+ *
13695
+ * @param id - ClientMedication UUID
13696
+ * @param attributes - Fields to update (PATCH semantics)
13697
+ * @param options - Request options
13698
+ * @returns Updated {@link ClinicalClientMedication} record
13699
+ */
13700
+ update: async (id, attributes, options) => rb.execute(
13701
+ patchClinicalClientMedicationsById,
13702
+ {
13703
+ path: { id },
13704
+ body: {
13705
+ data: { type: "clinical-client-medication", id, attributes }
13706
+ }
13707
+ },
13708
+ options
13709
+ ),
13710
+ /**
13711
+ * Delete (archive) a medication prescription.
13712
+ *
13713
+ * @deprecated Use {@link archive} instead.
13714
+ * @param id - ClientMedication UUID
13715
+ * @param options - Request options
13716
+ * @returns Archived {@link ClinicalClientMedication} record
13717
+ */
13718
+ delete: async (id, options) => rb.execute(
13719
+ patchClinicalClientMedicationsByIdArchive,
13720
+ {
13721
+ path: { id },
13722
+ body: {
13723
+ data: { type: "clinical-client-medication", id, attributes: {} }
13724
+ }
13725
+ },
13726
+ options
13727
+ ),
13728
+ /**
13729
+ * Archive (soft-delete) a medication prescription.
13730
+ *
13731
+ * @param id - ClientMedication UUID
13732
+ * @param options - Request options
13733
+ * @returns Archived {@link ClinicalClientMedication} record
13734
+ */
13735
+ archive: async (id, options) => rb.execute(
13736
+ patchClinicalClientMedicationsByIdArchive,
13737
+ {
13738
+ path: { id },
13739
+ body: {
13740
+ data: { type: "clinical-client-medication", id, attributes: {} }
13741
+ }
13742
+ },
13743
+ options
13744
+ ),
13745
+ /**
13746
+ * Restore an archived medication prescription.
13747
+ *
13748
+ * @param id - ClientMedication UUID
13749
+ * @param options - Request options
13750
+ * @returns Restored {@link ClinicalClientMedication} record
13751
+ */
13752
+ restore: async (id, options) => rb.execute(
13753
+ patchClinicalClientMedicationsByIdRestore,
13754
+ {
13755
+ path: { id },
13756
+ body: {
13757
+ data: { type: "clinical-client-medication", id, attributes: {} }
13758
+ }
13759
+ },
13760
+ options
13761
+ ),
13762
+ /**
13763
+ * Permanently delete a medication prescription. Irreversible.
13764
+ *
13765
+ * @param id - ClientMedication UUID
13766
+ * @param options - Request options
13767
+ * @returns `true` on success
13768
+ */
13769
+ permanentDelete: async (id, options) => rb.executeDelete(
13770
+ deleteClinicalClientMedicationsByIdPermanent,
13771
+ { path: { id } },
13772
+ options
13773
+ ),
13774
+ /**
13775
+ * List archived (soft-deleted) medication prescriptions.
13776
+ *
13777
+ * @param params - Filter/pagination parameters
13778
+ * @param options - Request options
13779
+ * @returns Array of archived {@link ClinicalClientMedication} records
13780
+ */
13781
+ listArchived: async (params, options) => rb.execute(
13782
+ getClinicalClientMedicationsArchived,
13783
+ { query: params ?? {} },
13784
+ options
13785
+ ),
13786
+ /**
13787
+ * Create multiple medications in a single request.
13788
+ *
13789
+ * @param attrs - Bulk creation attributes with workspace_id and medications array
13790
+ * @param options - Request options
13791
+ * @returns Array of creation results with id and status per medication
13792
+ *
13793
+ * @example
13794
+ * ```typescript
13795
+ * const results = await client.clinical.clientMedications.bulkCreate({
13796
+ * workspace_id: 'ws_123',
13797
+ * medications: [
13798
+ * { patient_id: 'pat_1', name: 'Metformin', source: 'ehr_import' },
13799
+ * { patient_id: 'pat_1', name: 'Lisinopril', source: 'ehr_import' },
13800
+ * ],
13801
+ * });
13802
+ * ```
13803
+ */
13804
+ bulkCreate: async (attrs, options) => rb.rawPost(`/clinical/client-medications/bulk`, { data: attrs }, options).then((r) => r.data)
13805
+ },
13543
13806
  /**
13544
13807
  * Manage clinical deliveries (care plan items sent to patients).
13545
13808
  */
@@ -25418,6 +25681,94 @@ function createExtractionNamespace(rb) {
25418
25681
  options
25419
25682
  );
25420
25683
  }
25684
+ },
25685
+ /** Extraction agents — list and predict best extraction agents for documents. */
25686
+ extractionAgents: {
25687
+ /**
25688
+ * Lists all available extraction agents (system agents tagged with
25689
+ * "extraction" category).
25690
+ *
25691
+ * @param options - Optional request options (abort signal, custom headers).
25692
+ * @returns An array of extraction agent objects.
25693
+ *
25694
+ * @example
25695
+ * ```typescript
25696
+ * const agents = await client.extraction.extractionAgents.list();
25697
+ * ```
25698
+ */
25699
+ list: async (options) => {
25700
+ return rb.execute(getExtractionAgents, {}, options);
25701
+ },
25702
+ /**
25703
+ * Retrieves a single extraction agent by its unique identifier.
25704
+ *
25705
+ * @param id - The UUID of the extraction agent.
25706
+ * @param options - Optional request options (abort signal, custom headers).
25707
+ * @returns The matching extraction agent object.
25708
+ *
25709
+ * @example
25710
+ * ```typescript
25711
+ * const agent = await client.extraction.extractionAgents.get('agent-uuid');
25712
+ * ```
25713
+ */
25714
+ get: async (id, options) => {
25715
+ return rb.execute(
25716
+ getExtractionAgentsById,
25717
+ { path: { id } },
25718
+ options
25719
+ );
25720
+ },
25721
+ /**
25722
+ * Predicts the best extraction agent for a given document based on its
25723
+ * name, description, or file content.
25724
+ *
25725
+ * @param attributes - Prediction input (name, description, file_content, document_id).
25726
+ * @param options - Optional request options (abort signal, custom headers).
25727
+ * @returns A prediction result with recommended agents.
25728
+ *
25729
+ * @example
25730
+ * ```typescript
25731
+ * const prediction = await client.extraction.extractionAgents.predict({
25732
+ * name: 'invoice.pdf',
25733
+ * file_content: 'Invoice #12345...',
25734
+ * });
25735
+ * ```
25736
+ */
25737
+ predict: async (attributes, options) => {
25738
+ return rb.execute(
25739
+ postExtractionAgentsPredict,
25740
+ {
25741
+ body: {
25742
+ data: { type: "extraction-agent", attributes }
25743
+ }
25744
+ },
25745
+ options
25746
+ );
25747
+ }
25748
+ },
25749
+ /** Training analytics — workspace-level extraction training metrics. */
25750
+ trainingAnalytics: {
25751
+ /**
25752
+ * Retrieves training analytics for a specific workspace, including
25753
+ * accuracy trends, correction counts, and low-confidence documents.
25754
+ *
25755
+ * @param workspaceId - The UUID of the workspace.
25756
+ * @param options - Optional request options (abort signal, custom headers).
25757
+ * @returns The training analytics object for the workspace.
25758
+ *
25759
+ * @example
25760
+ * ```typescript
25761
+ * const analytics = await client.extraction.trainingAnalytics.forWorkspace('ws-uuid');
25762
+ * console.log(analytics.avg_confidence, analytics.total_examples);
25763
+ * ```
25764
+ */
25765
+ forWorkspace: async (workspaceId, options) => {
25766
+ return rb.execute(
25767
+ getWorkspacesByWorkspaceIdTrainingAnalytics,
25768
+ { path: { workspace_id: workspaceId } },
25769
+ options
25770
+ );
25771
+ }
25421
25772
  }
25422
25773
  };
25423
25774
  }
@@ -29995,11 +30346,108 @@ function createStorageNamespace(rb) {
29995
30346
  { query: { parent_id: parentId } },
29996
30347
  options
29997
30348
  );
30349
+ },
30350
+ /**
30351
+ * Generate a short-lived presigned download URL for a file.
30352
+ *
30353
+ * Returns a URL that can be used to download the file directly from
30354
+ * object storage (GCS in production, MinIO in dev) without routing
30355
+ * through the application server.
30356
+ *
30357
+ * @param id - The UUID of the file to download.
30358
+ * @param params - Optional parameters (e.g., custom `expires_in` seconds).
30359
+ * @param options - Optional request options (abort signal, custom headers).
30360
+ * @returns A promise resolving to the presigned URL and its expiry.
30361
+ *
30362
+ * @example
30363
+ * ```typescript
30364
+ * const { url, expires_at } = await client.storage.files.requestDownloadUrl(
30365
+ * 'file-uuid',
30366
+ * { expires_in: 300 }, // 5 minutes
30367
+ * );
30368
+ * // Redirect browser to `url` for direct download
30369
+ * ```
30370
+ */
30371
+ requestDownloadUrl: async (id, params, options) => {
30372
+ return rb.rawPostDirect(
30373
+ `/storage-files/${id}/download-url`,
30374
+ params?.expires_in != null ? { data: { expires_in: params.expires_in } } : void 0,
30375
+ options
30376
+ );
29998
30377
  }
29999
30378
  }
30000
30379
  };
30001
30380
  }
30002
30381
 
30382
+ // src/namespaces/documents.ts
30383
+ function createDocumentsNamespace(rb) {
30384
+ return {
30385
+ /**
30386
+ * Generate a PDF from HTML content and store it in platform Storage.
30387
+ *
30388
+ * Always pass `store: true` and `workspace_id` to get a JSON response with
30389
+ * a `storage_key`. Without `store: true`, the server returns raw
30390
+ * `application/pdf` binary which cannot be parsed as JSON by this SDK method.
30391
+ *
30392
+ * HTML input is capped at 2MB by the server.
30393
+ *
30394
+ * @param params - PDF generation parameters. Set `store: true` and provide
30395
+ * `workspace_id` for JSON response.
30396
+ * @param options - Optional request options (abort signal, custom headers).
30397
+ * @returns A storage key reference for the generated PDF.
30398
+ *
30399
+ * @example
30400
+ * ```typescript
30401
+ * const { storage_key } = await client.documents.generatePdf({
30402
+ * html: '<html><body>Report</body></html>',
30403
+ * store: true,
30404
+ * workspace_id: 'ws-123',
30405
+ * });
30406
+ * ```
30407
+ */
30408
+ generatePdf: async (params, options) => {
30409
+ return rb.rawPostDirect(
30410
+ "/documents/pdf",
30411
+ params,
30412
+ options
30413
+ );
30414
+ },
30415
+ /**
30416
+ * Generate a PDF from HTML and email it as an attachment.
30417
+ *
30418
+ * The PDF is generated server-side and delivered via platform SMTP.
30419
+ * Optionally stores the PDF in platform Storage alongside the email delivery.
30420
+ *
30421
+ * If storage fails but the email succeeds, the response includes
30422
+ * `storage_error` with the failure reason (email is still delivered).
30423
+ *
30424
+ * @param params - Email report parameters.
30425
+ * @param options - Optional request options (abort signal, custom headers).
30426
+ * @returns Delivery status, optional storage key, and any storage error.
30427
+ *
30428
+ * @example
30429
+ * ```typescript
30430
+ * const result = await client.documents.emailReport({
30431
+ * html: '<html><body><h1>Q1 Summary</h1></body></html>',
30432
+ * to: 'finance@company.com',
30433
+ * subject: 'Q1 Financial Summary',
30434
+ * store: true,
30435
+ * workspace_id: 'ws-123',
30436
+ * });
30437
+ * console.log(result.sent); // true
30438
+ * console.log(result.storage_key); // 'ws-123/documents/...'
30439
+ * ```
30440
+ */
30441
+ emailReport: async (params, options) => {
30442
+ return rb.rawPostDirect(
30443
+ "/documents/pdf/email",
30444
+ params,
30445
+ options
30446
+ );
30447
+ }
30448
+ };
30449
+ }
30450
+
30003
30451
  // src/namespaces/threads.ts
30004
30452
  function getBrowserContext() {
30005
30453
  const ctx = {};
@@ -33219,6 +33667,32 @@ function createSocialNamespace(rb) {
33219
33667
  },
33220
33668
  options
33221
33669
  );
33670
+ },
33671
+ /**
33672
+ * Preview adapted copy per platform without creating SocialPost records.
33673
+ *
33674
+ * Returns the AI-adapted text for each target platform so the user can
33675
+ * review before committing via `adaptForPlatforms`.
33676
+ *
33677
+ * @param id - Campaign UUID.
33678
+ * @param workspaceId - Workspace UUID.
33679
+ * @param options - Optional request options.
33680
+ * @returns `{ adaptations: [{ platform: string, content: string }] }`
33681
+ */
33682
+ previewAdaptations: async (id, workspaceId, options) => {
33683
+ return rb.execute(
33684
+ postSocialCampaignsByIdPreviewAdaptations,
33685
+ {
33686
+ path: { id },
33687
+ body: {
33688
+ data: {
33689
+ campaign_id: id,
33690
+ workspace_id: workspaceId
33691
+ }
33692
+ }
33693
+ },
33694
+ options
33695
+ );
33222
33696
  }
33223
33697
  },
33224
33698
  /** Trending content discovery — snapshots, items, and watch alerts. */
@@ -33494,28 +33968,251 @@ function createCrmClustersNamespace(rb) {
33494
33968
  };
33495
33969
  }
33496
33970
 
33971
+ // src/namespaces/pipeline-executions.ts
33972
+ function createPipelineExecutionsNamespace(rb) {
33973
+ return {
33974
+ /**
33975
+ * Get a pipeline execution by ID.
33976
+ *
33977
+ * @param id - Execution UUID.
33978
+ * @param options - Optional request options.
33979
+ * @returns PipelineExecution resource.
33980
+ */
33981
+ async get(id, options) {
33982
+ return rb.rawGet(
33983
+ `/pipeline-executions/${id}`,
33984
+ options
33985
+ );
33986
+ },
33987
+ /**
33988
+ * List pipeline executions for a workspace.
33989
+ *
33990
+ * @param workspaceId - Workspace UUID to filter by.
33991
+ * @param filters - Optional filters (status, pipeline_id).
33992
+ * @param options - Optional request options.
33993
+ * @returns Array of PipelineExecution resources.
33994
+ */
33995
+ async list(workspaceId, filters, options) {
33996
+ const params = new URLSearchParams({ workspace_id: workspaceId });
33997
+ if (filters?.status) params.set("filter[status]", filters.status);
33998
+ if (filters?.pipeline_id)
33999
+ params.set("filter[pipeline_id]", filters.pipeline_id);
34000
+ return rb.rawGet(
34001
+ `/pipeline-executions?${params.toString()}`,
34002
+ options
34003
+ );
34004
+ },
34005
+ /**
34006
+ * List pipeline executions for a specific pipeline.
34007
+ *
34008
+ * @param pipelineId - Pipeline UUID to filter by.
34009
+ * @param options - Optional request options.
34010
+ * @returns Array of PipelineExecution resources for this pipeline.
34011
+ */
34012
+ async listByPipeline(pipelineId, options) {
34013
+ return rb.rawGet(
34014
+ `/pipeline-executions/by-pipeline/${pipelineId}`,
34015
+ options
34016
+ );
34017
+ },
34018
+ /**
34019
+ * Approve the current HITL checkpoint. Pipeline resumes execution.
34020
+ * Only valid when status === "awaiting_approval".
34021
+ *
34022
+ * @param id - Execution UUID.
34023
+ * @param options - Optional request options.
34024
+ * @returns Updated PipelineExecution resource.
34025
+ */
34026
+ async approve(id, options) {
34027
+ return rb.rawPatch(
34028
+ `/pipeline-executions/${id}/approve`,
34029
+ {
34030
+ data: { type: "pipeline-execution", id, attributes: {} }
34031
+ },
34032
+ {
34033
+ ...options,
34034
+ headers: {
34035
+ "Content-Type": "application/vnd.api+json",
34036
+ ...options?.headers
34037
+ }
34038
+ }
34039
+ );
34040
+ },
34041
+ /**
34042
+ * Reject the current HITL checkpoint. Pipeline halts permanently.
34043
+ * Only valid when status === "awaiting_approval".
34044
+ *
34045
+ * @param id - Execution UUID.
34046
+ * @param options - Optional request options.
34047
+ * @returns Updated PipelineExecution resource.
34048
+ */
34049
+ async reject(id, options) {
34050
+ return rb.rawPatch(
34051
+ `/pipeline-executions/${id}/reject`,
34052
+ {
34053
+ data: { type: "pipeline-execution", id, attributes: {} }
34054
+ },
34055
+ {
34056
+ ...options,
34057
+ headers: {
34058
+ "Content-Type": "application/vnd.api+json",
34059
+ ...options?.headers
34060
+ }
34061
+ }
34062
+ );
34063
+ },
34064
+ /**
34065
+ * Edit checkpoint data before approving.
34066
+ * Corrected values flow into downstream pipeline nodes.
34067
+ * Only valid when status === "awaiting_approval".
34068
+ *
34069
+ * @param id - Execution UUID.
34070
+ * @param attributes - Checkpoint data updates.
34071
+ * @param options - Optional request options.
34072
+ * @returns Updated PipelineExecution resource.
34073
+ */
34074
+ async updateCheckpoint(id, attributes, options) {
34075
+ return rb.rawPatch(
34076
+ `/pipeline-executions/${id}/checkpoint`,
34077
+ {
34078
+ data: { type: "pipeline-execution", id, attributes }
34079
+ },
34080
+ {
34081
+ ...options,
34082
+ headers: {
34083
+ "Content-Type": "application/vnd.api+json",
34084
+ ...options?.headers
34085
+ }
34086
+ }
34087
+ );
34088
+ },
34089
+ /**
34090
+ * Set the checkpoint note. Replaces any existing note.
34091
+ * Only valid when status === "awaiting_approval".
34092
+ *
34093
+ * @param id - Execution UUID.
34094
+ * @param note - Note text.
34095
+ * @param options - Optional request options.
34096
+ * @returns Updated PipelineExecution resource.
34097
+ */
34098
+ async addNote(id, note, options) {
34099
+ return rb.rawPatch(
34100
+ `/pipeline-executions/${id}/note`,
34101
+ {
34102
+ data: {
34103
+ type: "pipeline-execution",
34104
+ id,
34105
+ attributes: { checkpoint_notes: note }
34106
+ }
34107
+ },
34108
+ {
34109
+ ...options,
34110
+ headers: {
34111
+ "Content-Type": "application/vnd.api+json",
34112
+ ...options?.headers
34113
+ }
34114
+ }
34115
+ );
34116
+ },
34117
+ /**
34118
+ * Request AI refinement of a specific checkpoint node.
34119
+ * The AI re-runs the node with the given instruction and updates checkpoint_data.
34120
+ * Only valid when status === "awaiting_approval".
34121
+ *
34122
+ * @param id - Execution UUID.
34123
+ * @param nodeId - The pipeline node ID to refine.
34124
+ * @param instruction - Natural language instruction for refinement.
34125
+ * @param options - Optional request options.
34126
+ * @returns Updated PipelineExecution resource.
34127
+ */
34128
+ async aiRefine(id, nodeId, instruction, options) {
34129
+ return rb.rawPatch(
34130
+ `/pipeline-executions/${id}/refine`,
34131
+ {
34132
+ data: {
34133
+ type: "pipeline-execution",
34134
+ id,
34135
+ attributes: { node_id: nodeId, instruction }
34136
+ }
34137
+ },
34138
+ {
34139
+ ...options,
34140
+ headers: {
34141
+ "Content-Type": "application/vnd.api+json",
34142
+ ...options?.headers
34143
+ }
34144
+ }
34145
+ );
34146
+ }
34147
+ };
34148
+ }
34149
+
33497
34150
  // src/namespaces/pipelines.ts
33498
34151
  function createPipelinesNamespace(rb) {
33499
34152
  return {
34153
+ /**
34154
+ * List available pipelines.
34155
+ *
34156
+ * @param options - Optional request options.
34157
+ * @returns Array of Pipeline resources.
34158
+ */
34159
+ async list(options) {
34160
+ return rb.rawGet(`/pipelines`, options);
34161
+ },
34162
+ /**
34163
+ * Get a pipeline by ID.
34164
+ *
34165
+ * @param id - Pipeline UUID.
34166
+ * @param options - Optional request options.
34167
+ * @returns Pipeline resource.
34168
+ */
34169
+ async get(id, options) {
34170
+ return rb.rawGet(`/pipelines/${id}`, options);
34171
+ },
34172
+ /**
34173
+ * Get a pipeline by its system slug.
34174
+ *
34175
+ * @param slug - Pipeline system_slug.
34176
+ * @param options - Optional request options.
34177
+ * @returns Pipeline resource.
34178
+ */
34179
+ async getBySlug(slug, options) {
34180
+ return rb.rawGet(`/pipelines/by-slug/${slug}`, options);
34181
+ },
33500
34182
  /**
33501
34183
  * Trigger pipeline execution.
33502
34184
  *
33503
34185
  * @param id - Pipeline UUID.
33504
- * @param attributes - Execution parameters including workspace_id and input.
34186
+ * @param attributes - Execution parameters including workspace_id and optional input.
33505
34187
  * @param options - Optional request options.
33506
- * @returns Pipeline execution result map.
34188
+ * @returns Trigger response with execution_id and status.
33507
34189
  */
33508
34190
  async trigger(id, attributes, options) {
33509
- return rb.rawPost(
34191
+ return rb.rawPostDirect(
33510
34192
  `/pipelines/${id}/trigger`,
33511
34193
  {
33512
- data: {
33513
- type: "pipeline",
33514
- attributes: {
33515
- pipeline_id: id,
33516
- ...attributes
33517
- }
33518
- }
34194
+ workspace_id: attributes.workspace_id,
34195
+ ...attributes.input ? { input: attributes.input } : {}
34196
+ },
34197
+ options
34198
+ );
34199
+ },
34200
+ /**
34201
+ * Validate pipeline can execute without running it (dry-run).
34202
+ *
34203
+ * Checks: nodes exist, agents are resolvable, graph is valid, permissions OK.
34204
+ * Use this for onboarding validation or pre-flight checks.
34205
+ *
34206
+ * @param id - Pipeline UUID.
34207
+ * @param attributes - Validation parameters including workspace_id.
34208
+ * @param options - Optional request options.
34209
+ * @returns Validation result with validity flag and diagnostic info.
34210
+ */
34211
+ async dryRun(id, attributes, options) {
34212
+ return rb.rawPostDirect(
34213
+ `/pipelines/${id}/dry-run`,
34214
+ {
34215
+ workspace_id: attributes.workspace_id
33519
34216
  },
33520
34217
  options
33521
34218
  );
@@ -34320,6 +35017,31 @@ var RequestBuilder = class {
34320
35017
  throw handleApiError(error);
34321
35018
  }
34322
35019
  }
35020
+ /**
35021
+ * Execute a raw POST to a custom endpoint that returns flat JSON (no data wrapper).
35022
+ * Unlike rawPost (which unwraps data.data), this returns the response body directly.
35023
+ * Used for hand-written Phoenix controllers like DocumentsController.
35024
+ */
35025
+ async rawPostDirect(url, body, options) {
35026
+ const headers = buildHeaders(this.getHeaders, options);
35027
+ try {
35028
+ const result = await this.requestWithRetry(
35029
+ () => this.clientInstance.post({
35030
+ url,
35031
+ headers,
35032
+ ...body !== void 0 && { body },
35033
+ ...options?.signal && { signal: options.signal }
35034
+ })
35035
+ );
35036
+ const { data, error } = result;
35037
+ if (error) {
35038
+ throw handleApiError(enrichError(error, result));
35039
+ }
35040
+ return data;
35041
+ } catch (error) {
35042
+ throw handleApiError(error);
35043
+ }
35044
+ }
34323
35045
  /**
34324
35046
  * Execute a raw PUT request to a custom (non-generated) endpoint.
34325
35047
  */
@@ -34539,6 +35261,7 @@ var GptClient = class extends BaseClient {
34539
35261
  this.campaigns = createCampaignsNamespace(rb);
34540
35262
  this.email = createEmailNamespace(rb);
34541
35263
  this.support = createSupportNamespace(rb);
35264
+ this.documents = createDocumentsNamespace(rb);
34542
35265
  this.extraction = createExtractionNamespace(rb);
34543
35266
  this.identity = createIdentityNamespace(rb, this.config?.baseUrl);
34544
35267
  this.portal = createPortalNamespace(rb);
@@ -34554,6 +35277,7 @@ var GptClient = class extends BaseClient {
34554
35277
  this.projects = createProjectsNamespace(rb);
34555
35278
  this.models = createModelsNamespace(rb);
34556
35279
  this.crmClusters = createCrmClustersNamespace(rb);
35280
+ this.pipelineExecutions = createPipelineExecutionsNamespace(rb);
34557
35281
  this.pipelines = createPipelinesNamespace(rb);
34558
35282
  this.accessGrants = createAccessGrantsNamespace(rb);
34559
35283
  this.roles = createRolesNamespace(rb);