@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.mjs CHANGED
@@ -1269,8 +1269,8 @@ function buildUserAgent(sdkVersion, appInfo) {
1269
1269
  }
1270
1270
 
1271
1271
  // src/version.ts
1272
- var SDK_VERSION = "0.8.4";
1273
- var DEFAULT_API_VERSION = "2026-03-11";
1272
+ var SDK_VERSION = "0.8.5";
1273
+ var DEFAULT_API_VERSION = "2026-03-19";
1274
1274
 
1275
1275
  // src/base-client.ts
1276
1276
  function generateUUID() {
@@ -8516,16 +8516,16 @@ function createAgentsNamespace(rb) {
8516
8516
  * @param agentId - The UUID of the agent to execute.
8517
8517
  * @param input - Input data for the agent (task description, documents, etc.).
8518
8518
  * @param opts - Additional execution options.
8519
+ * @param opts.workspace_id - The workspace to execute in. Required for `sk_app_` key auth.
8519
8520
  * @param opts.model_id - Override model for this execution only (e.g., "anthropic/claude-sonnet-4").
8520
8521
  * Highest priority in the model resolution chain.
8521
- * @param reqOptions - Optional request options. Use `idempotencyKey` to prevent duplicate executions.
8522
8522
  * @returns The created execution record with status `pending`.
8523
8523
  *
8524
8524
  * @example
8525
8525
  * const exec = await client.agents.executions.start('agt_01...', {
8526
8526
  * task: 'Extract invoice fields',
8527
8527
  * document_id: 'doc_01...',
8528
- * });
8528
+ * }, { workspace_id: 'ws_abc123' });
8529
8529
  * console.log(exec.id, exec.status); // 'pending'
8530
8530
  *
8531
8531
  * @example
@@ -8533,12 +8533,13 @@ function createAgentsNamespace(rb) {
8533
8533
  * const exec = await client.agents.executions.start(
8534
8534
  * 'agt_01...',
8535
8535
  * { task: 'Complex reasoning' },
8536
- * { model_id: 'anthropic/claude-sonnet-4' },
8536
+ * { workspace_id: 'ws_abc123', model_id: 'anthropic/claude-sonnet-4' },
8537
8537
  * );
8538
8538
  */
8539
8539
  start: async (agentId, input, opts) => {
8540
- const { model_id, ...reqOptions } = opts ?? {};
8540
+ const { workspace_id, model_id, ...reqOptions } = opts ?? {};
8541
8541
  const body = { input };
8542
+ if (workspace_id) body.workspace_id = workspace_id;
8542
8543
  if (model_id) body.model_id = model_id;
8543
8544
  return rb.rawPost(
8544
8545
  `/agents/${agentId}/execute`,
@@ -8555,20 +8556,24 @@ function createAgentsNamespace(rb) {
8555
8556
  *
8556
8557
  * @param agentId - The UUID of the agent.
8557
8558
  * @param input - Input data (same format as {@link start}).
8558
- * @param options - Optional request options.
8559
+ * @param opts - Additional options.
8560
+ * @param opts.workspace_id - The workspace to estimate for. Required for `sk_app_` key auth.
8559
8561
  * @returns Cost estimate with min/max credit ranges.
8560
8562
  *
8561
8563
  * @example
8562
8564
  * const estimate = await client.agents.executions.estimate('agt_01...', {
8563
8565
  * task: 'Process batch',
8564
- * });
8566
+ * }, { workspace_id: 'ws_abc123' });
8565
8567
  * console.log(`Estimated cost: ${estimate.min_credits} - ${estimate.max_credits}`);
8566
8568
  */
8567
- estimate: async (agentId, input, options) => {
8569
+ estimate: async (agentId, input, opts) => {
8570
+ const { workspace_id, ...reqOptions } = opts ?? {};
8571
+ const body = { input };
8572
+ if (workspace_id) body.workspace_id = workspace_id;
8568
8573
  return rb.rawPost(
8569
8574
  `/agents/${agentId}/estimate`,
8570
- { input },
8571
- options
8575
+ body,
8576
+ Object.keys(reqOptions).length > 0 ? reqOptions : void 0
8572
8577
  );
8573
8578
  },
8574
8579
  /**
@@ -8594,14 +8599,20 @@ function createAgentsNamespace(rb) {
8594
8599
  * Returns only executions triggered by the authenticated user,
8595
8600
  * ordered by creation time descending.
8596
8601
  *
8597
- * @param options - Optional request options.
8602
+ * @param opts - Optional filtering and request options.
8603
+ * @param opts.workspace_id - Filter to a specific workspace. Required for `sk_app_` key auth.
8598
8604
  * @returns Array of execution records.
8599
8605
  *
8600
8606
  * @example
8601
- * const executions = await client.agents.executions.list();
8607
+ * const executions = await client.agents.executions.list({ workspace_id: 'ws_abc123' });
8602
8608
  */
8603
- list: async (options) => {
8604
- return rb.rawGet("/agent-executions", options);
8609
+ list: async (opts) => {
8610
+ const { workspace_id, ...reqOptions } = opts ?? {};
8611
+ const query = workspace_id ? `?workspace_id=${encodeURIComponent(workspace_id)}` : "";
8612
+ return rb.rawGet(
8613
+ `/agent-executions${query}`,
8614
+ Object.keys(reqOptions).length > 0 ? reqOptions : void 0
8615
+ );
8605
8616
  },
8606
8617
  /**
8607
8618
  * Opens an SSE stream for real-time execution events.
@@ -9089,7 +9100,8 @@ function createAiNamespace(rb) {
9089
9100
  body: {
9090
9101
  data: {
9091
9102
  type: "ai-message",
9092
- attributes: { ...body, conversation_id: conversationId }
9103
+ ...body,
9104
+ conversation_id: conversationId
9093
9105
  }
9094
9106
  }
9095
9107
  },
@@ -10896,7 +10908,7 @@ function createContentNamespace(rb) {
10896
10908
  postContentGenerateText,
10897
10909
  {
10898
10910
  body: {
10899
- data: { type: "content-generation", attributes }
10911
+ data: { type: "content-generation", ...attributes }
10900
10912
  }
10901
10913
  },
10902
10914
  options
@@ -10919,7 +10931,7 @@ function createContentNamespace(rb) {
10919
10931
  postContentGenerateImage,
10920
10932
  {
10921
10933
  body: {
10922
- data: { type: "content-generation", attributes }
10934
+ data: { type: "content-generation", ...attributes }
10923
10935
  }
10924
10936
  },
10925
10937
  options
@@ -10943,7 +10955,7 @@ function createContentNamespace(rb) {
10943
10955
  postContentEditImage,
10944
10956
  {
10945
10957
  body: {
10946
- data: { type: "content-generation", attributes }
10958
+ data: { type: "content-generation", ...attributes }
10947
10959
  }
10948
10960
  },
10949
10961
  options
@@ -10967,7 +10979,7 @@ function createContentNamespace(rb) {
10967
10979
  postContentRewriteTone,
10968
10980
  {
10969
10981
  body: {
10970
- data: { type: "content-generation", attributes }
10982
+ data: { type: "content-generation", ...attributes }
10971
10983
  }
10972
10984
  },
10973
10985
  options
@@ -10991,7 +11003,7 @@ function createContentNamespace(rb) {
10991
11003
  postContentShorten,
10992
11004
  {
10993
11005
  body: {
10994
- data: { type: "content-generation", attributes }
11006
+ data: { type: "content-generation", ...attributes }
10995
11007
  }
10996
11008
  },
10997
11009
  options
@@ -11015,7 +11027,7 @@ function createContentNamespace(rb) {
11015
11027
  postContentRefine,
11016
11028
  {
11017
11029
  body: {
11018
- data: { type: "content-generation", attributes }
11030
+ data: { type: "content-generation", ...attributes }
11019
11031
  }
11020
11032
  },
11021
11033
  options
@@ -11039,7 +11051,7 @@ function createContentNamespace(rb) {
11039
11051
  postContentSuggestTopics,
11040
11052
  {
11041
11053
  body: {
11042
- data: { type: "content-generation", attributes }
11054
+ data: { type: "content-generation", ...attributes }
11043
11055
  }
11044
11056
  },
11045
11057
  options
@@ -11062,7 +11074,7 @@ function createContentNamespace(rb) {
11062
11074
  postContentGenerateImagePrompt,
11063
11075
  {
11064
11076
  body: {
11065
- data: { type: "content-generation", attributes }
11077
+ data: { type: "content-generation", ...attributes }
11066
11078
  }
11067
11079
  },
11068
11080
  options
@@ -11086,7 +11098,7 @@ function createContentNamespace(rb) {
11086
11098
  postContentGenerateHashtags,
11087
11099
  {
11088
11100
  body: {
11089
- data: { type: "content-generation", attributes }
11101
+ data: { type: "content-generation", ...attributes }
11090
11102
  }
11091
11103
  },
11092
11104
  options
@@ -11110,7 +11122,7 @@ function createContentNamespace(rb) {
11110
11122
  postContentSeoEnrich,
11111
11123
  {
11112
11124
  body: {
11113
- data: { type: "content-generation", attributes }
11125
+ data: { type: "content-generation", ...attributes }
11114
11126
  }
11115
11127
  },
11116
11128
  options
@@ -11804,6 +11816,27 @@ function createClinicalNamespace(rb) {
11804
11816
  deleteClinicalClientGoalsById,
11805
11817
  { path: { id } },
11806
11818
  options
11819
+ ),
11820
+ /**
11821
+ * Batch reorder client goals by updating their positions.
11822
+ *
11823
+ * @param items - Array of `{ id, position }` pairs specifying new order
11824
+ * @param options - Request options
11825
+ * @returns `{ reordered: number }` — count of updated goals
11826
+ *
11827
+ * @example
11828
+ * ```typescript
11829
+ * await client.clinical.clientGoals.reorder([
11830
+ * { id: "goal-uuid-1", position: 0 },
11831
+ * { id: "goal-uuid-2", position: 1 },
11832
+ * { id: "goal-uuid-3", position: 2 },
11833
+ * ]);
11834
+ * ```
11835
+ */
11836
+ reorder: async (items, options) => rb.rawPost(
11837
+ "/clinical/client-goals/reorder",
11838
+ { items },
11839
+ options
11807
11840
  )
11808
11841
  },
11809
11842
  /**
@@ -16250,7 +16283,7 @@ function createConnectorsNamespace(rb) {
16250
16283
  body: {
16251
16284
  data: {
16252
16285
  type: "credential",
16253
- attributes: { workspace_id: workspaceId }
16286
+ workspace_id: workspaceId
16254
16287
  }
16255
16288
  }
16256
16289
  },
@@ -16284,7 +16317,7 @@ function createConnectorsNamespace(rb) {
16284
16317
  body: {
16285
16318
  data: {
16286
16319
  type: "credential",
16287
- attributes
16320
+ ...attributes
16288
16321
  }
16289
16322
  }
16290
16323
  },
@@ -16315,11 +16348,9 @@ function createConnectorsNamespace(rb) {
16315
16348
  body: {
16316
16349
  data: {
16317
16350
  type: "credential",
16318
- attributes: {
16319
- workspace_id: workspaceId,
16320
- connector_type: connectorType,
16321
- scope_level: scopeLevel
16322
- }
16351
+ workspace_id: workspaceId,
16352
+ connector_type: connectorType,
16353
+ scope_level: scopeLevel
16323
16354
  }
16324
16355
  }
16325
16356
  },
@@ -16364,10 +16395,8 @@ function createConnectorsNamespace(rb) {
16364
16395
  body: {
16365
16396
  data: {
16366
16397
  type: "connector_instance",
16367
- attributes: {
16368
- connector_type: connectorType,
16369
- workspace_id: workspaceId
16370
- }
16398
+ connector_type: connectorType,
16399
+ workspace_id: workspaceId
16371
16400
  }
16372
16401
  }
16373
16402
  },
@@ -16413,14 +16442,12 @@ function createConnectorsNamespace(rb) {
16413
16442
  body: {
16414
16443
  data: {
16415
16444
  type: "connector_instance",
16416
- attributes: {
16417
- connector_type: connectorType,
16418
- code,
16419
- state,
16420
- workspace_id: workspaceId,
16421
- ...redirectUri !== void 0 && {
16422
- redirect_uri: redirectUri
16423
- }
16445
+ connector_type: connectorType,
16446
+ code,
16447
+ state,
16448
+ workspace_id: workspaceId,
16449
+ ...redirectUri !== void 0 && {
16450
+ redirect_uri: redirectUri
16424
16451
  }
16425
16452
  }
16426
16453
  }
@@ -16696,11 +16723,9 @@ function createConnectorsNamespace(rb) {
16696
16723
  body: {
16697
16724
  data: {
16698
16725
  type: "connector_instance",
16699
- attributes: {
16700
- connector_id: connectorId,
16701
- workspace_id: workspaceId,
16702
- email
16703
- }
16726
+ connector_id: connectorId,
16727
+ workspace_id: workspaceId,
16728
+ email
16704
16729
  }
16705
16730
  }
16706
16731
  },
@@ -16743,11 +16768,9 @@ function createConnectorsNamespace(rb) {
16743
16768
  body: {
16744
16769
  data: {
16745
16770
  type: "connector_instance",
16746
- attributes: {
16747
- connector_id: connectorId,
16748
- workspace_id: workspaceId,
16749
- ...attrs
16750
- }
16771
+ connector_id: connectorId,
16772
+ workspace_id: workspaceId,
16773
+ ...attrs
16751
16774
  }
16752
16775
  }
16753
16776
  },
@@ -16785,11 +16808,9 @@ function createConnectorsNamespace(rb) {
16785
16808
  body: {
16786
16809
  data: {
16787
16810
  type: "connector_instance",
16788
- attributes: {
16789
- connector_id: connectorId,
16790
- workspace_id: workspaceId,
16791
- patient_id: patientId
16792
- }
16811
+ connector_id: connectorId,
16812
+ workspace_id: workspaceId,
16813
+ patient_id: patientId
16793
16814
  }
16794
16815
  }
16795
16816
  },
@@ -16829,10 +16850,8 @@ function createConnectorsNamespace(rb) {
16829
16850
  body: {
16830
16851
  data: {
16831
16852
  type: "connector_instance",
16832
- attributes: {
16833
- connector_type: "fullscript",
16834
- workspace_id: workspaceId
16835
- }
16853
+ connector_type: "fullscript",
16854
+ workspace_id: workspaceId
16836
16855
  }
16837
16856
  }
16838
16857
  },
@@ -16874,14 +16893,12 @@ function createConnectorsNamespace(rb) {
16874
16893
  body: {
16875
16894
  data: {
16876
16895
  type: "connector_instance",
16877
- attributes: {
16878
- connector_type: "fullscript",
16879
- code,
16880
- state,
16881
- workspace_id: workspaceId,
16882
- ...redirectUri !== void 0 && {
16883
- redirect_uri: redirectUri
16884
- }
16896
+ connector_type: "fullscript",
16897
+ code,
16898
+ state,
16899
+ workspace_id: workspaceId,
16900
+ ...redirectUri !== void 0 && {
16901
+ redirect_uri: redirectUri
16885
16902
  }
16886
16903
  }
16887
16904
  }
@@ -17570,7 +17587,7 @@ function createCrmNamespace(rb) {
17570
17587
  archive: async (id, options) => {
17571
17588
  return rb.execute(
17572
17589
  patchCrmContactsByIdArchive,
17573
- { path: { id } },
17590
+ { path: { id }, body: { data: { type: "crm_contact", id } } },
17574
17591
  options
17575
17592
  );
17576
17593
  },
@@ -19346,7 +19363,7 @@ function createCampaignsNamespace(rb) {
19346
19363
  postEmailMarketingCampaignsByIdCreateFollowup,
19347
19364
  {
19348
19365
  path: { id },
19349
- body: { data: { type: "email_marketing_campaign", attributes } }
19366
+ body: { data: { type: "email_marketing_campaign", ...attributes } }
19350
19367
  },
19351
19368
  options
19352
19369
  );
@@ -19408,7 +19425,7 @@ function createCampaignsNamespace(rb) {
19408
19425
  {
19409
19426
  data: {
19410
19427
  type: "campaign-template",
19411
- attributes: { body_mjml: mjml }
19428
+ body_mjml: mjml
19412
19429
  }
19413
19430
  },
19414
19431
  options
@@ -27191,13 +27208,11 @@ function createThreadsNamespace(rb) {
27191
27208
  body: {
27192
27209
  data: {
27193
27210
  type: "thread",
27194
- attributes: {
27195
- content,
27196
- ...rest,
27197
- metadata: mergeWithBrowserContext(
27198
- metadata
27199
- )
27200
- }
27211
+ content,
27212
+ ...rest,
27213
+ metadata: mergeWithBrowserContext(
27214
+ metadata
27215
+ )
27201
27216
  }
27202
27217
  }
27203
27218
  },
@@ -27245,13 +27260,11 @@ function createThreadsNamespace(rb) {
27245
27260
  {
27246
27261
  data: {
27247
27262
  type: "message",
27248
- attributes: {
27249
- content,
27250
- ...rest,
27251
- metadata: mergeWithBrowserContext(
27252
- metadata
27253
- )
27254
- }
27263
+ content,
27264
+ ...rest,
27265
+ metadata: mergeWithBrowserContext(
27266
+ metadata
27267
+ )
27255
27268
  }
27256
27269
  },
27257
27270
  options,
@@ -27329,7 +27342,7 @@ function createThreadsNamespace(rb) {
27329
27342
  postThreadsByIdComplete,
27330
27343
  {
27331
27344
  path: { id: threadId },
27332
- body: { data: { type: "thread", attributes: {} } }
27345
+ body: { data: { type: "thread" } }
27333
27346
  },
27334
27347
  options
27335
27348
  );
@@ -29605,10 +29618,8 @@ function createSocialNamespace(rb) {
29605
29618
  body: {
29606
29619
  data: {
29607
29620
  type: "social_campaign",
29608
- attributes: {
29609
- campaign_id: id,
29610
- workspace_id: workspaceId
29611
- }
29621
+ campaign_id: id,
29622
+ workspace_id: workspaceId
29612
29623
  }
29613
29624
  }
29614
29625
  },
@@ -29624,11 +29635,9 @@ function createSocialNamespace(rb) {
29624
29635
  body: {
29625
29636
  data: {
29626
29637
  type: "social_campaign",
29627
- attributes: {
29628
- campaign_id: id,
29629
- workspace_id: workspaceId,
29630
- social_account_id: socialAccountId
29631
- }
29638
+ campaign_id: id,
29639
+ workspace_id: workspaceId,
29640
+ social_account_id: socialAccountId
29632
29641
  }
29633
29642
  }
29634
29643
  },