@gpt-platform/client 0.8.4 → 0.8.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
@@ -1333,8 +1333,8 @@ function buildUserAgent(sdkVersion, appInfo) {
1333
1333
  }
1334
1334
 
1335
1335
  // src/version.ts
1336
- var SDK_VERSION = "0.8.4";
1337
- var DEFAULT_API_VERSION = "2026-03-11";
1336
+ var SDK_VERSION = "0.8.5";
1337
+ var DEFAULT_API_VERSION = "2026-03-19";
1338
1338
 
1339
1339
  // src/base-client.ts
1340
1340
  function generateUUID() {
@@ -8580,16 +8580,16 @@ function createAgentsNamespace(rb) {
8580
8580
  * @param agentId - The UUID of the agent to execute.
8581
8581
  * @param input - Input data for the agent (task description, documents, etc.).
8582
8582
  * @param opts - Additional execution options.
8583
+ * @param opts.workspace_id - The workspace to execute in. Required for `sk_app_` key auth.
8583
8584
  * @param opts.model_id - Override model for this execution only (e.g., "anthropic/claude-sonnet-4").
8584
8585
  * Highest priority in the model resolution chain.
8585
- * @param reqOptions - Optional request options. Use `idempotencyKey` to prevent duplicate executions.
8586
8586
  * @returns The created execution record with status `pending`.
8587
8587
  *
8588
8588
  * @example
8589
8589
  * const exec = await client.agents.executions.start('agt_01...', {
8590
8590
  * task: 'Extract invoice fields',
8591
8591
  * document_id: 'doc_01...',
8592
- * });
8592
+ * }, { workspace_id: 'ws_abc123' });
8593
8593
  * console.log(exec.id, exec.status); // 'pending'
8594
8594
  *
8595
8595
  * @example
@@ -8597,12 +8597,13 @@ function createAgentsNamespace(rb) {
8597
8597
  * const exec = await client.agents.executions.start(
8598
8598
  * 'agt_01...',
8599
8599
  * { task: 'Complex reasoning' },
8600
- * { model_id: 'anthropic/claude-sonnet-4' },
8600
+ * { workspace_id: 'ws_abc123', model_id: 'anthropic/claude-sonnet-4' },
8601
8601
  * );
8602
8602
  */
8603
8603
  start: async (agentId, input, opts) => {
8604
- const { model_id, ...reqOptions } = opts ?? {};
8604
+ const { workspace_id, model_id, ...reqOptions } = opts ?? {};
8605
8605
  const body = { input };
8606
+ if (workspace_id) body.workspace_id = workspace_id;
8606
8607
  if (model_id) body.model_id = model_id;
8607
8608
  return rb.rawPost(
8608
8609
  `/agents/${agentId}/execute`,
@@ -8619,20 +8620,24 @@ function createAgentsNamespace(rb) {
8619
8620
  *
8620
8621
  * @param agentId - The UUID of the agent.
8621
8622
  * @param input - Input data (same format as {@link start}).
8622
- * @param options - Optional request options.
8623
+ * @param opts - Additional options.
8624
+ * @param opts.workspace_id - The workspace to estimate for. Required for `sk_app_` key auth.
8623
8625
  * @returns Cost estimate with min/max credit ranges.
8624
8626
  *
8625
8627
  * @example
8626
8628
  * const estimate = await client.agents.executions.estimate('agt_01...', {
8627
8629
  * task: 'Process batch',
8628
- * });
8630
+ * }, { workspace_id: 'ws_abc123' });
8629
8631
  * console.log(`Estimated cost: ${estimate.min_credits} - ${estimate.max_credits}`);
8630
8632
  */
8631
- estimate: async (agentId, input, options) => {
8633
+ estimate: async (agentId, input, opts) => {
8634
+ const { workspace_id, ...reqOptions } = opts ?? {};
8635
+ const body = { input };
8636
+ if (workspace_id) body.workspace_id = workspace_id;
8632
8637
  return rb.rawPost(
8633
8638
  `/agents/${agentId}/estimate`,
8634
- { input },
8635
- options
8639
+ body,
8640
+ Object.keys(reqOptions).length > 0 ? reqOptions : void 0
8636
8641
  );
8637
8642
  },
8638
8643
  /**
@@ -8658,14 +8663,20 @@ function createAgentsNamespace(rb) {
8658
8663
  * Returns only executions triggered by the authenticated user,
8659
8664
  * ordered by creation time descending.
8660
8665
  *
8661
- * @param options - Optional request options.
8666
+ * @param opts - Optional filtering and request options.
8667
+ * @param opts.workspace_id - Filter to a specific workspace. Required for `sk_app_` key auth.
8662
8668
  * @returns Array of execution records.
8663
8669
  *
8664
8670
  * @example
8665
- * const executions = await client.agents.executions.list();
8671
+ * const executions = await client.agents.executions.list({ workspace_id: 'ws_abc123' });
8666
8672
  */
8667
- list: async (options) => {
8668
- return rb.rawGet("/agent-executions", options);
8673
+ list: async (opts) => {
8674
+ const { workspace_id, ...reqOptions } = opts ?? {};
8675
+ const query = workspace_id ? `?workspace_id=${encodeURIComponent(workspace_id)}` : "";
8676
+ return rb.rawGet(
8677
+ `/agent-executions${query}`,
8678
+ Object.keys(reqOptions).length > 0 ? reqOptions : void 0
8679
+ );
8669
8680
  },
8670
8681
  /**
8671
8682
  * Opens an SSE stream for real-time execution events.
@@ -9153,7 +9164,8 @@ function createAiNamespace(rb) {
9153
9164
  body: {
9154
9165
  data: {
9155
9166
  type: "ai-message",
9156
- attributes: { ...body, conversation_id: conversationId }
9167
+ ...body,
9168
+ conversation_id: conversationId
9157
9169
  }
9158
9170
  }
9159
9171
  },
@@ -10960,7 +10972,7 @@ function createContentNamespace(rb) {
10960
10972
  postContentGenerateText,
10961
10973
  {
10962
10974
  body: {
10963
- data: { type: "content-generation", attributes }
10975
+ data: { type: "content-generation", ...attributes }
10964
10976
  }
10965
10977
  },
10966
10978
  options
@@ -10983,7 +10995,7 @@ function createContentNamespace(rb) {
10983
10995
  postContentGenerateImage,
10984
10996
  {
10985
10997
  body: {
10986
- data: { type: "content-generation", attributes }
10998
+ data: { type: "content-generation", ...attributes }
10987
10999
  }
10988
11000
  },
10989
11001
  options
@@ -11007,7 +11019,7 @@ function createContentNamespace(rb) {
11007
11019
  postContentEditImage,
11008
11020
  {
11009
11021
  body: {
11010
- data: { type: "content-generation", attributes }
11022
+ data: { type: "content-generation", ...attributes }
11011
11023
  }
11012
11024
  },
11013
11025
  options
@@ -11031,7 +11043,7 @@ function createContentNamespace(rb) {
11031
11043
  postContentRewriteTone,
11032
11044
  {
11033
11045
  body: {
11034
- data: { type: "content-generation", attributes }
11046
+ data: { type: "content-generation", ...attributes }
11035
11047
  }
11036
11048
  },
11037
11049
  options
@@ -11055,7 +11067,7 @@ function createContentNamespace(rb) {
11055
11067
  postContentShorten,
11056
11068
  {
11057
11069
  body: {
11058
- data: { type: "content-generation", attributes }
11070
+ data: { type: "content-generation", ...attributes }
11059
11071
  }
11060
11072
  },
11061
11073
  options
@@ -11079,7 +11091,7 @@ function createContentNamespace(rb) {
11079
11091
  postContentRefine,
11080
11092
  {
11081
11093
  body: {
11082
- data: { type: "content-generation", attributes }
11094
+ data: { type: "content-generation", ...attributes }
11083
11095
  }
11084
11096
  },
11085
11097
  options
@@ -11103,7 +11115,7 @@ function createContentNamespace(rb) {
11103
11115
  postContentSuggestTopics,
11104
11116
  {
11105
11117
  body: {
11106
- data: { type: "content-generation", attributes }
11118
+ data: { type: "content-generation", ...attributes }
11107
11119
  }
11108
11120
  },
11109
11121
  options
@@ -11126,7 +11138,7 @@ function createContentNamespace(rb) {
11126
11138
  postContentGenerateImagePrompt,
11127
11139
  {
11128
11140
  body: {
11129
- data: { type: "content-generation", attributes }
11141
+ data: { type: "content-generation", ...attributes }
11130
11142
  }
11131
11143
  },
11132
11144
  options
@@ -11150,7 +11162,7 @@ function createContentNamespace(rb) {
11150
11162
  postContentGenerateHashtags,
11151
11163
  {
11152
11164
  body: {
11153
- data: { type: "content-generation", attributes }
11165
+ data: { type: "content-generation", ...attributes }
11154
11166
  }
11155
11167
  },
11156
11168
  options
@@ -11174,7 +11186,7 @@ function createContentNamespace(rb) {
11174
11186
  postContentSeoEnrich,
11175
11187
  {
11176
11188
  body: {
11177
- data: { type: "content-generation", attributes }
11189
+ data: { type: "content-generation", ...attributes }
11178
11190
  }
11179
11191
  },
11180
11192
  options
@@ -11868,6 +11880,27 @@ function createClinicalNamespace(rb) {
11868
11880
  deleteClinicalClientGoalsById,
11869
11881
  { path: { id } },
11870
11882
  options
11883
+ ),
11884
+ /**
11885
+ * Batch reorder client goals by updating their positions.
11886
+ *
11887
+ * @param items - Array of `{ id, position }` pairs specifying new order
11888
+ * @param options - Request options
11889
+ * @returns `{ reordered: number }` — count of updated goals
11890
+ *
11891
+ * @example
11892
+ * ```typescript
11893
+ * await client.clinical.clientGoals.reorder([
11894
+ * { id: "goal-uuid-1", position: 0 },
11895
+ * { id: "goal-uuid-2", position: 1 },
11896
+ * { id: "goal-uuid-3", position: 2 },
11897
+ * ]);
11898
+ * ```
11899
+ */
11900
+ reorder: async (items, options) => rb.rawPost(
11901
+ "/clinical/client-goals/reorder",
11902
+ { items },
11903
+ options
11871
11904
  )
11872
11905
  },
11873
11906
  /**
@@ -16314,7 +16347,7 @@ function createConnectorsNamespace(rb) {
16314
16347
  body: {
16315
16348
  data: {
16316
16349
  type: "credential",
16317
- attributes: { workspace_id: workspaceId }
16350
+ workspace_id: workspaceId
16318
16351
  }
16319
16352
  }
16320
16353
  },
@@ -16348,7 +16381,7 @@ function createConnectorsNamespace(rb) {
16348
16381
  body: {
16349
16382
  data: {
16350
16383
  type: "credential",
16351
- attributes
16384
+ ...attributes
16352
16385
  }
16353
16386
  }
16354
16387
  },
@@ -16379,11 +16412,9 @@ function createConnectorsNamespace(rb) {
16379
16412
  body: {
16380
16413
  data: {
16381
16414
  type: "credential",
16382
- attributes: {
16383
- workspace_id: workspaceId,
16384
- connector_type: connectorType,
16385
- scope_level: scopeLevel
16386
- }
16415
+ workspace_id: workspaceId,
16416
+ connector_type: connectorType,
16417
+ scope_level: scopeLevel
16387
16418
  }
16388
16419
  }
16389
16420
  },
@@ -16428,10 +16459,8 @@ function createConnectorsNamespace(rb) {
16428
16459
  body: {
16429
16460
  data: {
16430
16461
  type: "connector_instance",
16431
- attributes: {
16432
- connector_type: connectorType,
16433
- workspace_id: workspaceId
16434
- }
16462
+ connector_type: connectorType,
16463
+ workspace_id: workspaceId
16435
16464
  }
16436
16465
  }
16437
16466
  },
@@ -16477,14 +16506,12 @@ function createConnectorsNamespace(rb) {
16477
16506
  body: {
16478
16507
  data: {
16479
16508
  type: "connector_instance",
16480
- attributes: {
16481
- connector_type: connectorType,
16482
- code,
16483
- state,
16484
- workspace_id: workspaceId,
16485
- ...redirectUri !== void 0 && {
16486
- redirect_uri: redirectUri
16487
- }
16509
+ connector_type: connectorType,
16510
+ code,
16511
+ state,
16512
+ workspace_id: workspaceId,
16513
+ ...redirectUri !== void 0 && {
16514
+ redirect_uri: redirectUri
16488
16515
  }
16489
16516
  }
16490
16517
  }
@@ -16760,11 +16787,9 @@ function createConnectorsNamespace(rb) {
16760
16787
  body: {
16761
16788
  data: {
16762
16789
  type: "connector_instance",
16763
- attributes: {
16764
- connector_id: connectorId,
16765
- workspace_id: workspaceId,
16766
- email
16767
- }
16790
+ connector_id: connectorId,
16791
+ workspace_id: workspaceId,
16792
+ email
16768
16793
  }
16769
16794
  }
16770
16795
  },
@@ -16807,11 +16832,9 @@ function createConnectorsNamespace(rb) {
16807
16832
  body: {
16808
16833
  data: {
16809
16834
  type: "connector_instance",
16810
- attributes: {
16811
- connector_id: connectorId,
16812
- workspace_id: workspaceId,
16813
- ...attrs
16814
- }
16835
+ connector_id: connectorId,
16836
+ workspace_id: workspaceId,
16837
+ ...attrs
16815
16838
  }
16816
16839
  }
16817
16840
  },
@@ -16849,11 +16872,9 @@ function createConnectorsNamespace(rb) {
16849
16872
  body: {
16850
16873
  data: {
16851
16874
  type: "connector_instance",
16852
- attributes: {
16853
- connector_id: connectorId,
16854
- workspace_id: workspaceId,
16855
- patient_id: patientId
16856
- }
16875
+ connector_id: connectorId,
16876
+ workspace_id: workspaceId,
16877
+ patient_id: patientId
16857
16878
  }
16858
16879
  }
16859
16880
  },
@@ -16893,10 +16914,8 @@ function createConnectorsNamespace(rb) {
16893
16914
  body: {
16894
16915
  data: {
16895
16916
  type: "connector_instance",
16896
- attributes: {
16897
- connector_type: "fullscript",
16898
- workspace_id: workspaceId
16899
- }
16917
+ connector_type: "fullscript",
16918
+ workspace_id: workspaceId
16900
16919
  }
16901
16920
  }
16902
16921
  },
@@ -16938,14 +16957,12 @@ function createConnectorsNamespace(rb) {
16938
16957
  body: {
16939
16958
  data: {
16940
16959
  type: "connector_instance",
16941
- attributes: {
16942
- connector_type: "fullscript",
16943
- code,
16944
- state,
16945
- workspace_id: workspaceId,
16946
- ...redirectUri !== void 0 && {
16947
- redirect_uri: redirectUri
16948
- }
16960
+ connector_type: "fullscript",
16961
+ code,
16962
+ state,
16963
+ workspace_id: workspaceId,
16964
+ ...redirectUri !== void 0 && {
16965
+ redirect_uri: redirectUri
16949
16966
  }
16950
16967
  }
16951
16968
  }
@@ -17634,7 +17651,7 @@ function createCrmNamespace(rb) {
17634
17651
  archive: async (id, options) => {
17635
17652
  return rb.execute(
17636
17653
  patchCrmContactsByIdArchive,
17637
- { path: { id } },
17654
+ { path: { id }, body: { data: { type: "crm_contact", id } } },
17638
17655
  options
17639
17656
  );
17640
17657
  },
@@ -19410,7 +19427,7 @@ function createCampaignsNamespace(rb) {
19410
19427
  postEmailMarketingCampaignsByIdCreateFollowup,
19411
19428
  {
19412
19429
  path: { id },
19413
- body: { data: { type: "email_marketing_campaign", attributes } }
19430
+ body: { data: { type: "email_marketing_campaign", ...attributes } }
19414
19431
  },
19415
19432
  options
19416
19433
  );
@@ -19472,7 +19489,7 @@ function createCampaignsNamespace(rb) {
19472
19489
  {
19473
19490
  data: {
19474
19491
  type: "campaign-template",
19475
- attributes: { body_mjml: mjml }
19492
+ body_mjml: mjml
19476
19493
  }
19477
19494
  },
19478
19495
  options
@@ -27255,13 +27272,11 @@ function createThreadsNamespace(rb) {
27255
27272
  body: {
27256
27273
  data: {
27257
27274
  type: "thread",
27258
- attributes: {
27259
- content,
27260
- ...rest,
27261
- metadata: mergeWithBrowserContext(
27262
- metadata
27263
- )
27264
- }
27275
+ content,
27276
+ ...rest,
27277
+ metadata: mergeWithBrowserContext(
27278
+ metadata
27279
+ )
27265
27280
  }
27266
27281
  }
27267
27282
  },
@@ -27309,13 +27324,11 @@ function createThreadsNamespace(rb) {
27309
27324
  {
27310
27325
  data: {
27311
27326
  type: "message",
27312
- attributes: {
27313
- content,
27314
- ...rest,
27315
- metadata: mergeWithBrowserContext(
27316
- metadata
27317
- )
27318
- }
27327
+ content,
27328
+ ...rest,
27329
+ metadata: mergeWithBrowserContext(
27330
+ metadata
27331
+ )
27319
27332
  }
27320
27333
  },
27321
27334
  options,
@@ -27393,7 +27406,7 @@ function createThreadsNamespace(rb) {
27393
27406
  postThreadsByIdComplete,
27394
27407
  {
27395
27408
  path: { id: threadId },
27396
- body: { data: { type: "thread", attributes: {} } }
27409
+ body: { data: { type: "thread" } }
27397
27410
  },
27398
27411
  options
27399
27412
  );
@@ -29669,10 +29682,8 @@ function createSocialNamespace(rb) {
29669
29682
  body: {
29670
29683
  data: {
29671
29684
  type: "social_campaign",
29672
- attributes: {
29673
- campaign_id: id,
29674
- workspace_id: workspaceId
29675
- }
29685
+ campaign_id: id,
29686
+ workspace_id: workspaceId
29676
29687
  }
29677
29688
  }
29678
29689
  },
@@ -29688,11 +29699,9 @@ function createSocialNamespace(rb) {
29688
29699
  body: {
29689
29700
  data: {
29690
29701
  type: "social_campaign",
29691
- attributes: {
29692
- campaign_id: id,
29693
- workspace_id: workspaceId,
29694
- social_account_id: socialAccountId
29695
- }
29702
+ campaign_id: id,
29703
+ workspace_id: workspaceId,
29704
+ social_account_id: socialAccountId
29696
29705
  }
29697
29706
  }
29698
29707
  },