@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.js CHANGED
@@ -1339,7 +1339,7 @@ function buildUserAgent(sdkVersion, appInfo) {
1339
1339
  }
1340
1340
 
1341
1341
  // src/version.ts
1342
- var SDK_VERSION = "0.10.3";
1342
+ var SDK_VERSION = "0.10.5";
1343
1343
  var DEFAULT_API_VERSION = "2026-03-23";
1344
1344
 
1345
1345
  // src/base-client.ts
@@ -2305,6 +2305,11 @@ var getSupportTagsWorkspaceByWorkspaceId = (options) => (options.client ?? clien
2305
2305
  url: "/support/tags/workspace/{workspace_id}",
2306
2306
  ...options
2307
2307
  });
2308
+ var getClinicalPatientsByIdMedications = (options) => (options.client ?? client).get({
2309
+ security: [{ scheme: "bearer", type: "http" }],
2310
+ url: "/clinical/patients/{id}/medications",
2311
+ ...options
2312
+ });
2308
2313
  var getSearchIndexes = (options) => (options.client ?? client).get({
2309
2314
  security: [{ scheme: "bearer", type: "http" }],
2310
2315
  url: "/search/indexes",
@@ -2460,6 +2465,11 @@ var getExtractionBatchesWorkspaceByWorkspaceId = (options) => (options.client ??
2460
2465
  url: "/extraction/batches/workspace/{workspace_id}",
2461
2466
  ...options
2462
2467
  });
2468
+ var getExtractionAgents = (options) => (options.client ?? client).get({
2469
+ security: [{ scheme: "bearer", type: "http" }],
2470
+ url: "/extraction/agents",
2471
+ ...options
2472
+ });
2463
2473
  var deleteClinicalPracticeResourcesByIdPermanent = (options) => (options.client ?? client).delete({
2464
2474
  security: [{ scheme: "bearer", type: "http" }],
2465
2475
  url: "/clinical/practice-resources/{id}/permanent",
@@ -2651,6 +2661,15 @@ var patchInvitationsByIdRevoke = (options) => (options.client ?? client).patch({
2651
2661
  ...options.headers
2652
2662
  }
2653
2663
  });
2664
+ var postExtractionAgentsPredict = (options) => (options.client ?? client).post({
2665
+ security: [{ scheme: "bearer", type: "http" }],
2666
+ url: "/extraction/agents/predict",
2667
+ ...options,
2668
+ headers: {
2669
+ "Content-Type": "application/vnd.api+json",
2670
+ ...options.headers
2671
+ }
2672
+ });
2654
2673
  var getCatalogTaxonomiesApplicationByApplicationId = (options) => (options.client ?? client).get({
2655
2674
  security: [{ scheme: "bearer", type: "http" }],
2656
2675
  url: "/catalog/taxonomies/application/{application_id}",
@@ -3256,6 +3275,11 @@ var patchStorageFilesByIdRestore = (options) => (options.client ?? client).patch
3256
3275
  ...options.headers
3257
3276
  }
3258
3277
  });
3278
+ var getWorkspacesByWorkspaceIdTrainingAnalytics = (options) => (options.client ?? client).get({
3279
+ security: [{ scheme: "bearer", type: "http" }],
3280
+ url: "/workspaces/{workspace_id}/training/analytics",
3281
+ ...options
3282
+ });
3259
3283
  var patchSocialCampaignsByIdCancel = (options) => (options.client ?? client).patch({
3260
3284
  security: [{ scheme: "bearer", type: "http" }],
3261
3285
  url: "/social/campaigns/{id}/cancel",
@@ -5072,6 +5096,11 @@ var getAuditLogs = (options) => (options.client ?? client).get({
5072
5096
  url: "/audit-logs",
5073
5097
  ...options
5074
5098
  });
5099
+ var getClinicalClientMedicationsArchived = (options) => (options.client ?? client).get({
5100
+ security: [{ scheme: "bearer", type: "http" }],
5101
+ url: "/clinical/client-medications/archived",
5102
+ ...options
5103
+ });
5075
5104
  var getEmailInclusionsEmailByOutboundEmailId = (options) => (options.client ?? client).get({
5076
5105
  security: [{ scheme: "bearer", type: "http" }],
5077
5106
  url: "/email/inclusions/email/{outbound_email_id}",
@@ -5666,6 +5695,15 @@ var patchApplicationsById = (options) => (options.client ?? client).patch({
5666
5695
  ...options.headers
5667
5696
  }
5668
5697
  });
5698
+ var patchClinicalClientMedicationsByIdRestore = (options) => (options.client ?? client).patch({
5699
+ security: [{ scheme: "bearer", type: "http" }],
5700
+ url: "/clinical/client-medications/{id}/restore",
5701
+ ...options,
5702
+ headers: {
5703
+ "Content-Type": "application/vnd.api+json",
5704
+ ...options.headers
5705
+ }
5706
+ });
5669
5707
  var patchEmailOutboundEmailsByIdSchedule = (options) => (options.client ?? client).patch({
5670
5708
  security: [{ scheme: "bearer", type: "http" }],
5671
5709
  url: "/email/outbound-emails/{id}/schedule",
@@ -6410,6 +6448,15 @@ var postContentRewriteTone = (options) => (options.client ?? client).post({
6410
6448
  ...options.headers
6411
6449
  }
6412
6450
  });
6451
+ var patchClinicalClientMedicationsByIdArchive = (options) => (options.client ?? client).patch({
6452
+ security: [{ scheme: "bearer", type: "http" }],
6453
+ url: "/clinical/client-medications/{id}/archive",
6454
+ ...options,
6455
+ headers: {
6456
+ "Content-Type": "application/vnd.api+json",
6457
+ ...options.headers
6458
+ }
6459
+ });
6413
6460
  var patchStorageFilesByIdSoftDelete = (options) => (options.client ?? client).patch({
6414
6461
  security: [{ scheme: "bearer", type: "http" }],
6415
6462
  url: "/storage-files/{id}/soft-delete",
@@ -6722,6 +6769,20 @@ var getPlans = (options) => (options.client ?? client).get({
6722
6769
  url: "/plans",
6723
6770
  ...options
6724
6771
  });
6772
+ var getClinicalClientMedications = (options) => (options.client ?? client).get({
6773
+ security: [{ scheme: "bearer", type: "http" }],
6774
+ url: "/clinical/client-medications",
6775
+ ...options
6776
+ });
6777
+ var postClinicalClientMedications = (options) => (options.client ?? client).post({
6778
+ security: [{ scheme: "bearer", type: "http" }],
6779
+ url: "/clinical/client-medications",
6780
+ ...options,
6781
+ headers: {
6782
+ "Content-Type": "application/vnd.api+json",
6783
+ ...options.headers
6784
+ }
6785
+ });
6725
6786
  var postCrmActivities = (options) => (options.client ?? client).post({
6726
6787
  security: [{ scheme: "bearer", type: "http" }],
6727
6788
  url: "/crm/activities",
@@ -6819,6 +6880,20 @@ var patchSchedulingParticipantsByIdRespond = (options) => (options.client ?? cli
6819
6880
  ...options.headers
6820
6881
  }
6821
6882
  });
6883
+ var getClinicalClientMedicationsById = (options) => (options.client ?? client).get({
6884
+ security: [{ scheme: "bearer", type: "http" }],
6885
+ url: "/clinical/client-medications/{id}",
6886
+ ...options
6887
+ });
6888
+ var patchClinicalClientMedicationsById = (options) => (options.client ?? client).patch({
6889
+ security: [{ scheme: "bearer", type: "http" }],
6890
+ url: "/clinical/client-medications/{id}",
6891
+ ...options,
6892
+ headers: {
6893
+ "Content-Type": "application/vnd.api+json",
6894
+ ...options.headers
6895
+ }
6896
+ });
6822
6897
  var postAgentsByIdTest = (options) => (options.client ?? client).post({
6823
6898
  security: [{ scheme: "bearer", type: "http" }],
6824
6899
  url: "/agents/{id}/test",
@@ -7021,6 +7096,15 @@ var postUsersAuthResendConfirmation = (options) => (options.client ?? client).po
7021
7096
  ...options.headers
7022
7097
  }
7023
7098
  });
7099
+ var postSocialCampaignsByIdPreviewAdaptations = (options) => (options.client ?? client).post({
7100
+ security: [{ scheme: "bearer", type: "http" }],
7101
+ url: "/social/campaigns/{id}/preview-adaptations",
7102
+ ...options,
7103
+ headers: {
7104
+ "Content-Type": "application/vnd.api+json",
7105
+ ...options.headers
7106
+ }
7107
+ });
7024
7108
  var getCrawlerResultsById = (options) => (options.client ?? client).get({
7025
7109
  security: [{ scheme: "bearer", type: "http" }],
7026
7110
  url: "/crawler/results/{id}",
@@ -7236,6 +7320,11 @@ var postEmailInclusions = (options) => (options.client ?? client).post({
7236
7320
  ...options.headers
7237
7321
  }
7238
7322
  });
7323
+ var deleteClinicalClientMedicationsByIdPermanent = (options) => (options.client ?? client).delete({
7324
+ security: [{ scheme: "bearer", type: "http" }],
7325
+ url: "/clinical/client-medications/{id}/permanent",
7326
+ ...options
7327
+ });
7239
7328
  var getAccessLogs = (options) => (options.client ?? client).get({
7240
7329
  security: [{ scheme: "bearer", type: "http" }],
7241
7330
  url: "/access-logs",
@@ -7404,6 +7493,11 @@ var postExtractionDocumentsBulkReprocess = (options) => (options.client ?? clien
7404
7493
  ...options.headers
7405
7494
  }
7406
7495
  });
7496
+ var getExtractionAgentsById = (options) => (options.client ?? client).get({
7497
+ security: [{ scheme: "bearer", type: "http" }],
7498
+ url: "/extraction/agents/{id}",
7499
+ ...options
7500
+ });
7407
7501
  var getApplicationsBySlugBySlug = (options) => (options.client ?? client).get({
7408
7502
  security: [{ scheme: "bearer", type: "http" }],
7409
7503
  url: "/applications/by-slug/{slug}",
@@ -12577,6 +12671,18 @@ function createClinicalNamespace(rb) {
12577
12671
  { path: { id: patientId } },
12578
12672
  options
12579
12673
  ),
12674
+ /**
12675
+ * List medications for a patient (related resource).
12676
+ *
12677
+ * @param patientId - Patient UUID or CRM Contact UUID
12678
+ * @param options - Request options
12679
+ * @returns Array of {@link ClinicalClientMedication} records
12680
+ */
12681
+ medications: async (patientId, options) => rb.execute(
12682
+ getClinicalPatientsByIdMedications,
12683
+ { path: { id: patientId } },
12684
+ options
12685
+ ),
12580
12686
  /**
12581
12687
  * List resource assignments for a patient (related resource).
12582
12688
  *
@@ -13607,6 +13713,163 @@ function createClinicalNamespace(rb) {
13607
13713
  */
13608
13714
  bulkCreate: async (attrs, options) => rb.rawPost(`/clinical/client-supplements/bulk`, { data: attrs }, options).then((r) => r.data)
13609
13715
  },
13716
+ /**
13717
+ * Manage medication prescriptions for clinical patients.
13718
+ */
13719
+ clientMedications: {
13720
+ /**
13721
+ * List medication prescriptions, filtered by patient/workspace.
13722
+ *
13723
+ * @param params - Filter/pagination parameters
13724
+ * @param options - Request options
13725
+ * @returns Array of {@link ClinicalClientMedication} records
13726
+ */
13727
+ list: async (params, options) => rb.execute(
13728
+ getClinicalClientMedications,
13729
+ { query: params ?? {} },
13730
+ options
13731
+ ),
13732
+ /**
13733
+ * Get a single medication prescription by ID.
13734
+ *
13735
+ * @param id - ClientMedication UUID
13736
+ * @param options - Request options
13737
+ * @returns {@link ClinicalClientMedication} record
13738
+ */
13739
+ get: async (id, options) => rb.execute(
13740
+ getClinicalClientMedicationsById,
13741
+ { path: { id } },
13742
+ options
13743
+ ),
13744
+ /**
13745
+ * Create a new medication prescription.
13746
+ *
13747
+ * @param attributes - Medication creation attributes. Must include `workspace_id`,
13748
+ * `patient_id`, and `name`.
13749
+ * @param options - Request options
13750
+ * @returns Created {@link ClinicalClientMedication} record
13751
+ */
13752
+ create: async (attributes, options) => rb.execute(
13753
+ postClinicalClientMedications,
13754
+ {
13755
+ body: { data: { type: "clinical-client-medication", attributes } }
13756
+ },
13757
+ options
13758
+ ),
13759
+ /**
13760
+ * Update a medication prescription.
13761
+ *
13762
+ * @param id - ClientMedication UUID
13763
+ * @param attributes - Fields to update (PATCH semantics)
13764
+ * @param options - Request options
13765
+ * @returns Updated {@link ClinicalClientMedication} record
13766
+ */
13767
+ update: async (id, attributes, options) => rb.execute(
13768
+ patchClinicalClientMedicationsById,
13769
+ {
13770
+ path: { id },
13771
+ body: {
13772
+ data: { type: "clinical-client-medication", id, attributes }
13773
+ }
13774
+ },
13775
+ options
13776
+ ),
13777
+ /**
13778
+ * Delete (archive) a medication prescription.
13779
+ *
13780
+ * @deprecated Use {@link archive} instead.
13781
+ * @param id - ClientMedication UUID
13782
+ * @param options - Request options
13783
+ * @returns Archived {@link ClinicalClientMedication} record
13784
+ */
13785
+ delete: async (id, options) => rb.execute(
13786
+ patchClinicalClientMedicationsByIdArchive,
13787
+ {
13788
+ path: { id },
13789
+ body: {
13790
+ data: { type: "clinical-client-medication", id, attributes: {} }
13791
+ }
13792
+ },
13793
+ options
13794
+ ),
13795
+ /**
13796
+ * Archive (soft-delete) a medication prescription.
13797
+ *
13798
+ * @param id - ClientMedication UUID
13799
+ * @param options - Request options
13800
+ * @returns Archived {@link ClinicalClientMedication} record
13801
+ */
13802
+ archive: async (id, options) => rb.execute(
13803
+ patchClinicalClientMedicationsByIdArchive,
13804
+ {
13805
+ path: { id },
13806
+ body: {
13807
+ data: { type: "clinical-client-medication", id, attributes: {} }
13808
+ }
13809
+ },
13810
+ options
13811
+ ),
13812
+ /**
13813
+ * Restore an archived medication prescription.
13814
+ *
13815
+ * @param id - ClientMedication UUID
13816
+ * @param options - Request options
13817
+ * @returns Restored {@link ClinicalClientMedication} record
13818
+ */
13819
+ restore: async (id, options) => rb.execute(
13820
+ patchClinicalClientMedicationsByIdRestore,
13821
+ {
13822
+ path: { id },
13823
+ body: {
13824
+ data: { type: "clinical-client-medication", id, attributes: {} }
13825
+ }
13826
+ },
13827
+ options
13828
+ ),
13829
+ /**
13830
+ * Permanently delete a medication prescription. Irreversible.
13831
+ *
13832
+ * @param id - ClientMedication UUID
13833
+ * @param options - Request options
13834
+ * @returns `true` on success
13835
+ */
13836
+ permanentDelete: async (id, options) => rb.executeDelete(
13837
+ deleteClinicalClientMedicationsByIdPermanent,
13838
+ { path: { id } },
13839
+ options
13840
+ ),
13841
+ /**
13842
+ * List archived (soft-deleted) medication prescriptions.
13843
+ *
13844
+ * @param params - Filter/pagination parameters
13845
+ * @param options - Request options
13846
+ * @returns Array of archived {@link ClinicalClientMedication} records
13847
+ */
13848
+ listArchived: async (params, options) => rb.execute(
13849
+ getClinicalClientMedicationsArchived,
13850
+ { query: params ?? {} },
13851
+ options
13852
+ ),
13853
+ /**
13854
+ * Create multiple medications in a single request.
13855
+ *
13856
+ * @param attrs - Bulk creation attributes with workspace_id and medications array
13857
+ * @param options - Request options
13858
+ * @returns Array of creation results with id and status per medication
13859
+ *
13860
+ * @example
13861
+ * ```typescript
13862
+ * const results = await client.clinical.clientMedications.bulkCreate({
13863
+ * workspace_id: 'ws_123',
13864
+ * medications: [
13865
+ * { patient_id: 'pat_1', name: 'Metformin', source: 'ehr_import' },
13866
+ * { patient_id: 'pat_1', name: 'Lisinopril', source: 'ehr_import' },
13867
+ * ],
13868
+ * });
13869
+ * ```
13870
+ */
13871
+ bulkCreate: async (attrs, options) => rb.rawPost(`/clinical/client-medications/bulk`, { data: attrs }, options).then((r) => r.data)
13872
+ },
13610
13873
  /**
13611
13874
  * Manage clinical deliveries (care plan items sent to patients).
13612
13875
  */
@@ -25485,6 +25748,94 @@ function createExtractionNamespace(rb) {
25485
25748
  options
25486
25749
  );
25487
25750
  }
25751
+ },
25752
+ /** Extraction agents — list and predict best extraction agents for documents. */
25753
+ extractionAgents: {
25754
+ /**
25755
+ * Lists all available extraction agents (system agents tagged with
25756
+ * "extraction" category).
25757
+ *
25758
+ * @param options - Optional request options (abort signal, custom headers).
25759
+ * @returns An array of extraction agent objects.
25760
+ *
25761
+ * @example
25762
+ * ```typescript
25763
+ * const agents = await client.extraction.extractionAgents.list();
25764
+ * ```
25765
+ */
25766
+ list: async (options) => {
25767
+ return rb.execute(getExtractionAgents, {}, options);
25768
+ },
25769
+ /**
25770
+ * Retrieves a single extraction agent by its unique identifier.
25771
+ *
25772
+ * @param id - The UUID of the extraction agent.
25773
+ * @param options - Optional request options (abort signal, custom headers).
25774
+ * @returns The matching extraction agent object.
25775
+ *
25776
+ * @example
25777
+ * ```typescript
25778
+ * const agent = await client.extraction.extractionAgents.get('agent-uuid');
25779
+ * ```
25780
+ */
25781
+ get: async (id, options) => {
25782
+ return rb.execute(
25783
+ getExtractionAgentsById,
25784
+ { path: { id } },
25785
+ options
25786
+ );
25787
+ },
25788
+ /**
25789
+ * Predicts the best extraction agent for a given document based on its
25790
+ * name, description, or file content.
25791
+ *
25792
+ * @param attributes - Prediction input (name, description, file_content, document_id).
25793
+ * @param options - Optional request options (abort signal, custom headers).
25794
+ * @returns A prediction result with recommended agents.
25795
+ *
25796
+ * @example
25797
+ * ```typescript
25798
+ * const prediction = await client.extraction.extractionAgents.predict({
25799
+ * name: 'invoice.pdf',
25800
+ * file_content: 'Invoice #12345...',
25801
+ * });
25802
+ * ```
25803
+ */
25804
+ predict: async (attributes, options) => {
25805
+ return rb.execute(
25806
+ postExtractionAgentsPredict,
25807
+ {
25808
+ body: {
25809
+ data: { type: "extraction-agent", attributes }
25810
+ }
25811
+ },
25812
+ options
25813
+ );
25814
+ }
25815
+ },
25816
+ /** Training analytics — workspace-level extraction training metrics. */
25817
+ trainingAnalytics: {
25818
+ /**
25819
+ * Retrieves training analytics for a specific workspace, including
25820
+ * accuracy trends, correction counts, and low-confidence documents.
25821
+ *
25822
+ * @param workspaceId - The UUID of the workspace.
25823
+ * @param options - Optional request options (abort signal, custom headers).
25824
+ * @returns The training analytics object for the workspace.
25825
+ *
25826
+ * @example
25827
+ * ```typescript
25828
+ * const analytics = await client.extraction.trainingAnalytics.forWorkspace('ws-uuid');
25829
+ * console.log(analytics.avg_confidence, analytics.total_examples);
25830
+ * ```
25831
+ */
25832
+ forWorkspace: async (workspaceId, options) => {
25833
+ return rb.execute(
25834
+ getWorkspacesByWorkspaceIdTrainingAnalytics,
25835
+ { path: { workspace_id: workspaceId } },
25836
+ options
25837
+ );
25838
+ }
25488
25839
  }
25489
25840
  };
25490
25841
  }
@@ -30062,11 +30413,108 @@ function createStorageNamespace(rb) {
30062
30413
  { query: { parent_id: parentId } },
30063
30414
  options
30064
30415
  );
30416
+ },
30417
+ /**
30418
+ * Generate a short-lived presigned download URL for a file.
30419
+ *
30420
+ * Returns a URL that can be used to download the file directly from
30421
+ * object storage (GCS in production, MinIO in dev) without routing
30422
+ * through the application server.
30423
+ *
30424
+ * @param id - The UUID of the file to download.
30425
+ * @param params - Optional parameters (e.g., custom `expires_in` seconds).
30426
+ * @param options - Optional request options (abort signal, custom headers).
30427
+ * @returns A promise resolving to the presigned URL and its expiry.
30428
+ *
30429
+ * @example
30430
+ * ```typescript
30431
+ * const { url, expires_at } = await client.storage.files.requestDownloadUrl(
30432
+ * 'file-uuid',
30433
+ * { expires_in: 300 }, // 5 minutes
30434
+ * );
30435
+ * // Redirect browser to `url` for direct download
30436
+ * ```
30437
+ */
30438
+ requestDownloadUrl: async (id, params, options) => {
30439
+ return rb.rawPostDirect(
30440
+ `/storage-files/${id}/download-url`,
30441
+ params?.expires_in != null ? { data: { expires_in: params.expires_in } } : void 0,
30442
+ options
30443
+ );
30065
30444
  }
30066
30445
  }
30067
30446
  };
30068
30447
  }
30069
30448
 
30449
+ // src/namespaces/documents.ts
30450
+ function createDocumentsNamespace(rb) {
30451
+ return {
30452
+ /**
30453
+ * Generate a PDF from HTML content and store it in platform Storage.
30454
+ *
30455
+ * Always pass `store: true` and `workspace_id` to get a JSON response with
30456
+ * a `storage_key`. Without `store: true`, the server returns raw
30457
+ * `application/pdf` binary which cannot be parsed as JSON by this SDK method.
30458
+ *
30459
+ * HTML input is capped at 2MB by the server.
30460
+ *
30461
+ * @param params - PDF generation parameters. Set `store: true` and provide
30462
+ * `workspace_id` for JSON response.
30463
+ * @param options - Optional request options (abort signal, custom headers).
30464
+ * @returns A storage key reference for the generated PDF.
30465
+ *
30466
+ * @example
30467
+ * ```typescript
30468
+ * const { storage_key } = await client.documents.generatePdf({
30469
+ * html: '<html><body>Report</body></html>',
30470
+ * store: true,
30471
+ * workspace_id: 'ws-123',
30472
+ * });
30473
+ * ```
30474
+ */
30475
+ generatePdf: async (params, options) => {
30476
+ return rb.rawPostDirect(
30477
+ "/documents/pdf",
30478
+ params,
30479
+ options
30480
+ );
30481
+ },
30482
+ /**
30483
+ * Generate a PDF from HTML and email it as an attachment.
30484
+ *
30485
+ * The PDF is generated server-side and delivered via platform SMTP.
30486
+ * Optionally stores the PDF in platform Storage alongside the email delivery.
30487
+ *
30488
+ * If storage fails but the email succeeds, the response includes
30489
+ * `storage_error` with the failure reason (email is still delivered).
30490
+ *
30491
+ * @param params - Email report parameters.
30492
+ * @param options - Optional request options (abort signal, custom headers).
30493
+ * @returns Delivery status, optional storage key, and any storage error.
30494
+ *
30495
+ * @example
30496
+ * ```typescript
30497
+ * const result = await client.documents.emailReport({
30498
+ * html: '<html><body><h1>Q1 Summary</h1></body></html>',
30499
+ * to: 'finance@company.com',
30500
+ * subject: 'Q1 Financial Summary',
30501
+ * store: true,
30502
+ * workspace_id: 'ws-123',
30503
+ * });
30504
+ * console.log(result.sent); // true
30505
+ * console.log(result.storage_key); // 'ws-123/documents/...'
30506
+ * ```
30507
+ */
30508
+ emailReport: async (params, options) => {
30509
+ return rb.rawPostDirect(
30510
+ "/documents/pdf/email",
30511
+ params,
30512
+ options
30513
+ );
30514
+ }
30515
+ };
30516
+ }
30517
+
30070
30518
  // src/namespaces/threads.ts
30071
30519
  function getBrowserContext() {
30072
30520
  const ctx = {};
@@ -33286,6 +33734,32 @@ function createSocialNamespace(rb) {
33286
33734
  },
33287
33735
  options
33288
33736
  );
33737
+ },
33738
+ /**
33739
+ * Preview adapted copy per platform without creating SocialPost records.
33740
+ *
33741
+ * Returns the AI-adapted text for each target platform so the user can
33742
+ * review before committing via `adaptForPlatforms`.
33743
+ *
33744
+ * @param id - Campaign UUID.
33745
+ * @param workspaceId - Workspace UUID.
33746
+ * @param options - Optional request options.
33747
+ * @returns `{ adaptations: [{ platform: string, content: string }] }`
33748
+ */
33749
+ previewAdaptations: async (id, workspaceId, options) => {
33750
+ return rb.execute(
33751
+ postSocialCampaignsByIdPreviewAdaptations,
33752
+ {
33753
+ path: { id },
33754
+ body: {
33755
+ data: {
33756
+ campaign_id: id,
33757
+ workspace_id: workspaceId
33758
+ }
33759
+ }
33760
+ },
33761
+ options
33762
+ );
33289
33763
  }
33290
33764
  },
33291
33765
  /** Trending content discovery — snapshots, items, and watch alerts. */
@@ -33561,28 +34035,251 @@ function createCrmClustersNamespace(rb) {
33561
34035
  };
33562
34036
  }
33563
34037
 
34038
+ // src/namespaces/pipeline-executions.ts
34039
+ function createPipelineExecutionsNamespace(rb) {
34040
+ return {
34041
+ /**
34042
+ * Get a pipeline execution by ID.
34043
+ *
34044
+ * @param id - Execution UUID.
34045
+ * @param options - Optional request options.
34046
+ * @returns PipelineExecution resource.
34047
+ */
34048
+ async get(id, options) {
34049
+ return rb.rawGet(
34050
+ `/pipeline-executions/${id}`,
34051
+ options
34052
+ );
34053
+ },
34054
+ /**
34055
+ * List pipeline executions for a workspace.
34056
+ *
34057
+ * @param workspaceId - Workspace UUID to filter by.
34058
+ * @param filters - Optional filters (status, pipeline_id).
34059
+ * @param options - Optional request options.
34060
+ * @returns Array of PipelineExecution resources.
34061
+ */
34062
+ async list(workspaceId, filters, options) {
34063
+ const params = new URLSearchParams({ workspace_id: workspaceId });
34064
+ if (filters?.status) params.set("filter[status]", filters.status);
34065
+ if (filters?.pipeline_id)
34066
+ params.set("filter[pipeline_id]", filters.pipeline_id);
34067
+ return rb.rawGet(
34068
+ `/pipeline-executions?${params.toString()}`,
34069
+ options
34070
+ );
34071
+ },
34072
+ /**
34073
+ * List pipeline executions for a specific pipeline.
34074
+ *
34075
+ * @param pipelineId - Pipeline UUID to filter by.
34076
+ * @param options - Optional request options.
34077
+ * @returns Array of PipelineExecution resources for this pipeline.
34078
+ */
34079
+ async listByPipeline(pipelineId, options) {
34080
+ return rb.rawGet(
34081
+ `/pipeline-executions/by-pipeline/${pipelineId}`,
34082
+ options
34083
+ );
34084
+ },
34085
+ /**
34086
+ * Approve the current HITL checkpoint. Pipeline resumes execution.
34087
+ * Only valid when status === "awaiting_approval".
34088
+ *
34089
+ * @param id - Execution UUID.
34090
+ * @param options - Optional request options.
34091
+ * @returns Updated PipelineExecution resource.
34092
+ */
34093
+ async approve(id, options) {
34094
+ return rb.rawPatch(
34095
+ `/pipeline-executions/${id}/approve`,
34096
+ {
34097
+ data: { type: "pipeline-execution", id, attributes: {} }
34098
+ },
34099
+ {
34100
+ ...options,
34101
+ headers: {
34102
+ "Content-Type": "application/vnd.api+json",
34103
+ ...options?.headers
34104
+ }
34105
+ }
34106
+ );
34107
+ },
34108
+ /**
34109
+ * Reject the current HITL checkpoint. Pipeline halts permanently.
34110
+ * Only valid when status === "awaiting_approval".
34111
+ *
34112
+ * @param id - Execution UUID.
34113
+ * @param options - Optional request options.
34114
+ * @returns Updated PipelineExecution resource.
34115
+ */
34116
+ async reject(id, options) {
34117
+ return rb.rawPatch(
34118
+ `/pipeline-executions/${id}/reject`,
34119
+ {
34120
+ data: { type: "pipeline-execution", id, attributes: {} }
34121
+ },
34122
+ {
34123
+ ...options,
34124
+ headers: {
34125
+ "Content-Type": "application/vnd.api+json",
34126
+ ...options?.headers
34127
+ }
34128
+ }
34129
+ );
34130
+ },
34131
+ /**
34132
+ * Edit checkpoint data before approving.
34133
+ * Corrected values flow into downstream pipeline nodes.
34134
+ * Only valid when status === "awaiting_approval".
34135
+ *
34136
+ * @param id - Execution UUID.
34137
+ * @param attributes - Checkpoint data updates.
34138
+ * @param options - Optional request options.
34139
+ * @returns Updated PipelineExecution resource.
34140
+ */
34141
+ async updateCheckpoint(id, attributes, options) {
34142
+ return rb.rawPatch(
34143
+ `/pipeline-executions/${id}/checkpoint`,
34144
+ {
34145
+ data: { type: "pipeline-execution", id, attributes }
34146
+ },
34147
+ {
34148
+ ...options,
34149
+ headers: {
34150
+ "Content-Type": "application/vnd.api+json",
34151
+ ...options?.headers
34152
+ }
34153
+ }
34154
+ );
34155
+ },
34156
+ /**
34157
+ * Set the checkpoint note. Replaces any existing note.
34158
+ * Only valid when status === "awaiting_approval".
34159
+ *
34160
+ * @param id - Execution UUID.
34161
+ * @param note - Note text.
34162
+ * @param options - Optional request options.
34163
+ * @returns Updated PipelineExecution resource.
34164
+ */
34165
+ async addNote(id, note, options) {
34166
+ return rb.rawPatch(
34167
+ `/pipeline-executions/${id}/note`,
34168
+ {
34169
+ data: {
34170
+ type: "pipeline-execution",
34171
+ id,
34172
+ attributes: { checkpoint_notes: note }
34173
+ }
34174
+ },
34175
+ {
34176
+ ...options,
34177
+ headers: {
34178
+ "Content-Type": "application/vnd.api+json",
34179
+ ...options?.headers
34180
+ }
34181
+ }
34182
+ );
34183
+ },
34184
+ /**
34185
+ * Request AI refinement of a specific checkpoint node.
34186
+ * The AI re-runs the node with the given instruction and updates checkpoint_data.
34187
+ * Only valid when status === "awaiting_approval".
34188
+ *
34189
+ * @param id - Execution UUID.
34190
+ * @param nodeId - The pipeline node ID to refine.
34191
+ * @param instruction - Natural language instruction for refinement.
34192
+ * @param options - Optional request options.
34193
+ * @returns Updated PipelineExecution resource.
34194
+ */
34195
+ async aiRefine(id, nodeId, instruction, options) {
34196
+ return rb.rawPatch(
34197
+ `/pipeline-executions/${id}/refine`,
34198
+ {
34199
+ data: {
34200
+ type: "pipeline-execution",
34201
+ id,
34202
+ attributes: { node_id: nodeId, instruction }
34203
+ }
34204
+ },
34205
+ {
34206
+ ...options,
34207
+ headers: {
34208
+ "Content-Type": "application/vnd.api+json",
34209
+ ...options?.headers
34210
+ }
34211
+ }
34212
+ );
34213
+ }
34214
+ };
34215
+ }
34216
+
33564
34217
  // src/namespaces/pipelines.ts
33565
34218
  function createPipelinesNamespace(rb) {
33566
34219
  return {
34220
+ /**
34221
+ * List available pipelines.
34222
+ *
34223
+ * @param options - Optional request options.
34224
+ * @returns Array of Pipeline resources.
34225
+ */
34226
+ async list(options) {
34227
+ return rb.rawGet(`/pipelines`, options);
34228
+ },
34229
+ /**
34230
+ * Get a pipeline by ID.
34231
+ *
34232
+ * @param id - Pipeline UUID.
34233
+ * @param options - Optional request options.
34234
+ * @returns Pipeline resource.
34235
+ */
34236
+ async get(id, options) {
34237
+ return rb.rawGet(`/pipelines/${id}`, options);
34238
+ },
34239
+ /**
34240
+ * Get a pipeline by its system slug.
34241
+ *
34242
+ * @param slug - Pipeline system_slug.
34243
+ * @param options - Optional request options.
34244
+ * @returns Pipeline resource.
34245
+ */
34246
+ async getBySlug(slug, options) {
34247
+ return rb.rawGet(`/pipelines/by-slug/${slug}`, options);
34248
+ },
33567
34249
  /**
33568
34250
  * Trigger pipeline execution.
33569
34251
  *
33570
34252
  * @param id - Pipeline UUID.
33571
- * @param attributes - Execution parameters including workspace_id and input.
34253
+ * @param attributes - Execution parameters including workspace_id and optional input.
33572
34254
  * @param options - Optional request options.
33573
- * @returns Pipeline execution result map.
34255
+ * @returns Trigger response with execution_id and status.
33574
34256
  */
33575
34257
  async trigger(id, attributes, options) {
33576
- return rb.rawPost(
34258
+ return rb.rawPostDirect(
33577
34259
  `/pipelines/${id}/trigger`,
33578
34260
  {
33579
- data: {
33580
- type: "pipeline",
33581
- attributes: {
33582
- pipeline_id: id,
33583
- ...attributes
33584
- }
33585
- }
34261
+ workspace_id: attributes.workspace_id,
34262
+ ...attributes.input ? { input: attributes.input } : {}
34263
+ },
34264
+ options
34265
+ );
34266
+ },
34267
+ /**
34268
+ * Validate pipeline can execute without running it (dry-run).
34269
+ *
34270
+ * Checks: nodes exist, agents are resolvable, graph is valid, permissions OK.
34271
+ * Use this for onboarding validation or pre-flight checks.
34272
+ *
34273
+ * @param id - Pipeline UUID.
34274
+ * @param attributes - Validation parameters including workspace_id.
34275
+ * @param options - Optional request options.
34276
+ * @returns Validation result with validity flag and diagnostic info.
34277
+ */
34278
+ async dryRun(id, attributes, options) {
34279
+ return rb.rawPostDirect(
34280
+ `/pipelines/${id}/dry-run`,
34281
+ {
34282
+ workspace_id: attributes.workspace_id
33586
34283
  },
33587
34284
  options
33588
34285
  );
@@ -34387,6 +35084,31 @@ var RequestBuilder = class {
34387
35084
  throw handleApiError(error);
34388
35085
  }
34389
35086
  }
35087
+ /**
35088
+ * Execute a raw POST to a custom endpoint that returns flat JSON (no data wrapper).
35089
+ * Unlike rawPost (which unwraps data.data), this returns the response body directly.
35090
+ * Used for hand-written Phoenix controllers like DocumentsController.
35091
+ */
35092
+ async rawPostDirect(url, body, options) {
35093
+ const headers = buildHeaders(this.getHeaders, options);
35094
+ try {
35095
+ const result = await this.requestWithRetry(
35096
+ () => this.clientInstance.post({
35097
+ url,
35098
+ headers,
35099
+ ...body !== void 0 && { body },
35100
+ ...options?.signal && { signal: options.signal }
35101
+ })
35102
+ );
35103
+ const { data, error } = result;
35104
+ if (error) {
35105
+ throw handleApiError(enrichError(error, result));
35106
+ }
35107
+ return data;
35108
+ } catch (error) {
35109
+ throw handleApiError(error);
35110
+ }
35111
+ }
34390
35112
  /**
34391
35113
  * Execute a raw PUT request to a custom (non-generated) endpoint.
34392
35114
  */
@@ -34606,6 +35328,7 @@ var GptClient = class extends BaseClient {
34606
35328
  this.campaigns = createCampaignsNamespace(rb);
34607
35329
  this.email = createEmailNamespace(rb);
34608
35330
  this.support = createSupportNamespace(rb);
35331
+ this.documents = createDocumentsNamespace(rb);
34609
35332
  this.extraction = createExtractionNamespace(rb);
34610
35333
  this.identity = createIdentityNamespace(rb, this.config?.baseUrl);
34611
35334
  this.portal = createPortalNamespace(rb);
@@ -34621,6 +35344,7 @@ var GptClient = class extends BaseClient {
34621
35344
  this.projects = createProjectsNamespace(rb);
34622
35345
  this.models = createModelsNamespace(rb);
34623
35346
  this.crmClusters = createCrmClustersNamespace(rb);
35347
+ this.pipelineExecutions = createPipelineExecutionsNamespace(rb);
34624
35348
  this.pipelines = createPipelinesNamespace(rb);
34625
35349
  this.accessGrants = createAccessGrantsNamespace(rb);
34626
35350
  this.roles = createRolesNamespace(rb);