@gpt-platform/client 0.8.3 → 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.3";
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() {
@@ -6456,6 +6456,11 @@ var postWatcherEvents = (options) => (options.client ?? client).post({
6456
6456
  ...options.headers
6457
6457
  }
6458
6458
  });
6459
+ var getAgentsBySlugBySlug = (options) => (options.client ?? client).get({
6460
+ security: [{ scheme: "bearer", type: "http" }],
6461
+ url: "/agents/by-slug/{slug}",
6462
+ ...options
6463
+ });
6459
6464
  var getFeatureDefinitionsByApplicationByApplicationId = (options) => (options.client ?? client).get({
6460
6465
  security: [{ scheme: "bearer", type: "http" }],
6461
6466
  url: "/feature-definitions/by-application/{application_id}",
@@ -7260,6 +7265,26 @@ function createAgentsNamespace(rb) {
7260
7265
  get: async (id, options) => {
7261
7266
  return rb.execute(getAgentsById, { path: { id } }, options);
7262
7267
  },
7268
+ /**
7269
+ * Look up an agent by its system_slug. Use this for ISV-provisioned agents
7270
+ * where the slug is a stable identifier that survives database resets.
7271
+ *
7272
+ * @param slug - The system_slug of the agent (e.g., "chartless-session-prep-briefing").
7273
+ * @param options - Optional request options.
7274
+ * @returns The Agent record.
7275
+ *
7276
+ * @example
7277
+ * ```ts
7278
+ * const agent = await client.agents.getBySlug("chartless-session-prep-briefing");
7279
+ * ```
7280
+ */
7281
+ getBySlug: async (slug, options) => {
7282
+ return rb.execute(
7283
+ getAgentsBySlugBySlug,
7284
+ { path: { slug } },
7285
+ options
7286
+ );
7287
+ },
7263
7288
  /**
7264
7289
  * Creates a new agent with a blank initial version (v1).
7265
7290
  *
@@ -8555,16 +8580,16 @@ function createAgentsNamespace(rb) {
8555
8580
  * @param agentId - The UUID of the agent to execute.
8556
8581
  * @param input - Input data for the agent (task description, documents, etc.).
8557
8582
  * @param opts - Additional execution options.
8583
+ * @param opts.workspace_id - The workspace to execute in. Required for `sk_app_` key auth.
8558
8584
  * @param opts.model_id - Override model for this execution only (e.g., "anthropic/claude-sonnet-4").
8559
8585
  * Highest priority in the model resolution chain.
8560
- * @param reqOptions - Optional request options. Use `idempotencyKey` to prevent duplicate executions.
8561
8586
  * @returns The created execution record with status `pending`.
8562
8587
  *
8563
8588
  * @example
8564
8589
  * const exec = await client.agents.executions.start('agt_01...', {
8565
8590
  * task: 'Extract invoice fields',
8566
8591
  * document_id: 'doc_01...',
8567
- * });
8592
+ * }, { workspace_id: 'ws_abc123' });
8568
8593
  * console.log(exec.id, exec.status); // 'pending'
8569
8594
  *
8570
8595
  * @example
@@ -8572,12 +8597,13 @@ function createAgentsNamespace(rb) {
8572
8597
  * const exec = await client.agents.executions.start(
8573
8598
  * 'agt_01...',
8574
8599
  * { task: 'Complex reasoning' },
8575
- * { model_id: 'anthropic/claude-sonnet-4' },
8600
+ * { workspace_id: 'ws_abc123', model_id: 'anthropic/claude-sonnet-4' },
8576
8601
  * );
8577
8602
  */
8578
8603
  start: async (agentId, input, opts) => {
8579
- const { model_id, ...reqOptions } = opts ?? {};
8604
+ const { workspace_id, model_id, ...reqOptions } = opts ?? {};
8580
8605
  const body = { input };
8606
+ if (workspace_id) body.workspace_id = workspace_id;
8581
8607
  if (model_id) body.model_id = model_id;
8582
8608
  return rb.rawPost(
8583
8609
  `/agents/${agentId}/execute`,
@@ -8594,20 +8620,24 @@ function createAgentsNamespace(rb) {
8594
8620
  *
8595
8621
  * @param agentId - The UUID of the agent.
8596
8622
  * @param input - Input data (same format as {@link start}).
8597
- * @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.
8598
8625
  * @returns Cost estimate with min/max credit ranges.
8599
8626
  *
8600
8627
  * @example
8601
8628
  * const estimate = await client.agents.executions.estimate('agt_01...', {
8602
8629
  * task: 'Process batch',
8603
- * });
8630
+ * }, { workspace_id: 'ws_abc123' });
8604
8631
  * console.log(`Estimated cost: ${estimate.min_credits} - ${estimate.max_credits}`);
8605
8632
  */
8606
- 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;
8607
8637
  return rb.rawPost(
8608
8638
  `/agents/${agentId}/estimate`,
8609
- { input },
8610
- options
8639
+ body,
8640
+ Object.keys(reqOptions).length > 0 ? reqOptions : void 0
8611
8641
  );
8612
8642
  },
8613
8643
  /**
@@ -8633,14 +8663,20 @@ function createAgentsNamespace(rb) {
8633
8663
  * Returns only executions triggered by the authenticated user,
8634
8664
  * ordered by creation time descending.
8635
8665
  *
8636
- * @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.
8637
8668
  * @returns Array of execution records.
8638
8669
  *
8639
8670
  * @example
8640
- * const executions = await client.agents.executions.list();
8671
+ * const executions = await client.agents.executions.list({ workspace_id: 'ws_abc123' });
8641
8672
  */
8642
- list: async (options) => {
8643
- 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
+ );
8644
8680
  },
8645
8681
  /**
8646
8682
  * Opens an SSE stream for real-time execution events.
@@ -9128,7 +9164,8 @@ function createAiNamespace(rb) {
9128
9164
  body: {
9129
9165
  data: {
9130
9166
  type: "ai-message",
9131
- attributes: { ...body, conversation_id: conversationId }
9167
+ ...body,
9168
+ conversation_id: conversationId
9132
9169
  }
9133
9170
  }
9134
9171
  },
@@ -10935,7 +10972,7 @@ function createContentNamespace(rb) {
10935
10972
  postContentGenerateText,
10936
10973
  {
10937
10974
  body: {
10938
- data: { type: "content-generation", attributes }
10975
+ data: { type: "content-generation", ...attributes }
10939
10976
  }
10940
10977
  },
10941
10978
  options
@@ -10958,7 +10995,7 @@ function createContentNamespace(rb) {
10958
10995
  postContentGenerateImage,
10959
10996
  {
10960
10997
  body: {
10961
- data: { type: "content-generation", attributes }
10998
+ data: { type: "content-generation", ...attributes }
10962
10999
  }
10963
11000
  },
10964
11001
  options
@@ -10982,7 +11019,7 @@ function createContentNamespace(rb) {
10982
11019
  postContentEditImage,
10983
11020
  {
10984
11021
  body: {
10985
- data: { type: "content-generation", attributes }
11022
+ data: { type: "content-generation", ...attributes }
10986
11023
  }
10987
11024
  },
10988
11025
  options
@@ -11006,7 +11043,7 @@ function createContentNamespace(rb) {
11006
11043
  postContentRewriteTone,
11007
11044
  {
11008
11045
  body: {
11009
- data: { type: "content-generation", attributes }
11046
+ data: { type: "content-generation", ...attributes }
11010
11047
  }
11011
11048
  },
11012
11049
  options
@@ -11030,7 +11067,7 @@ function createContentNamespace(rb) {
11030
11067
  postContentShorten,
11031
11068
  {
11032
11069
  body: {
11033
- data: { type: "content-generation", attributes }
11070
+ data: { type: "content-generation", ...attributes }
11034
11071
  }
11035
11072
  },
11036
11073
  options
@@ -11054,7 +11091,7 @@ function createContentNamespace(rb) {
11054
11091
  postContentRefine,
11055
11092
  {
11056
11093
  body: {
11057
- data: { type: "content-generation", attributes }
11094
+ data: { type: "content-generation", ...attributes }
11058
11095
  }
11059
11096
  },
11060
11097
  options
@@ -11078,7 +11115,7 @@ function createContentNamespace(rb) {
11078
11115
  postContentSuggestTopics,
11079
11116
  {
11080
11117
  body: {
11081
- data: { type: "content-generation", attributes }
11118
+ data: { type: "content-generation", ...attributes }
11082
11119
  }
11083
11120
  },
11084
11121
  options
@@ -11101,7 +11138,7 @@ function createContentNamespace(rb) {
11101
11138
  postContentGenerateImagePrompt,
11102
11139
  {
11103
11140
  body: {
11104
- data: { type: "content-generation", attributes }
11141
+ data: { type: "content-generation", ...attributes }
11105
11142
  }
11106
11143
  },
11107
11144
  options
@@ -11125,7 +11162,7 @@ function createContentNamespace(rb) {
11125
11162
  postContentGenerateHashtags,
11126
11163
  {
11127
11164
  body: {
11128
- data: { type: "content-generation", attributes }
11165
+ data: { type: "content-generation", ...attributes }
11129
11166
  }
11130
11167
  },
11131
11168
  options
@@ -11149,7 +11186,7 @@ function createContentNamespace(rb) {
11149
11186
  postContentSeoEnrich,
11150
11187
  {
11151
11188
  body: {
11152
- data: { type: "content-generation", attributes }
11189
+ data: { type: "content-generation", ...attributes }
11153
11190
  }
11154
11191
  },
11155
11192
  options
@@ -11843,6 +11880,27 @@ function createClinicalNamespace(rb) {
11843
11880
  deleteClinicalClientGoalsById,
11844
11881
  { path: { id } },
11845
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
11846
11904
  )
11847
11905
  },
11848
11906
  /**
@@ -16289,7 +16347,7 @@ function createConnectorsNamespace(rb) {
16289
16347
  body: {
16290
16348
  data: {
16291
16349
  type: "credential",
16292
- attributes: { workspace_id: workspaceId }
16350
+ workspace_id: workspaceId
16293
16351
  }
16294
16352
  }
16295
16353
  },
@@ -16323,7 +16381,7 @@ function createConnectorsNamespace(rb) {
16323
16381
  body: {
16324
16382
  data: {
16325
16383
  type: "credential",
16326
- attributes
16384
+ ...attributes
16327
16385
  }
16328
16386
  }
16329
16387
  },
@@ -16354,11 +16412,9 @@ function createConnectorsNamespace(rb) {
16354
16412
  body: {
16355
16413
  data: {
16356
16414
  type: "credential",
16357
- attributes: {
16358
- workspace_id: workspaceId,
16359
- connector_type: connectorType,
16360
- scope_level: scopeLevel
16361
- }
16415
+ workspace_id: workspaceId,
16416
+ connector_type: connectorType,
16417
+ scope_level: scopeLevel
16362
16418
  }
16363
16419
  }
16364
16420
  },
@@ -16403,10 +16459,8 @@ function createConnectorsNamespace(rb) {
16403
16459
  body: {
16404
16460
  data: {
16405
16461
  type: "connector_instance",
16406
- attributes: {
16407
- connector_type: connectorType,
16408
- workspace_id: workspaceId
16409
- }
16462
+ connector_type: connectorType,
16463
+ workspace_id: workspaceId
16410
16464
  }
16411
16465
  }
16412
16466
  },
@@ -16452,14 +16506,12 @@ function createConnectorsNamespace(rb) {
16452
16506
  body: {
16453
16507
  data: {
16454
16508
  type: "connector_instance",
16455
- attributes: {
16456
- connector_type: connectorType,
16457
- code,
16458
- state,
16459
- workspace_id: workspaceId,
16460
- ...redirectUri !== void 0 && {
16461
- redirect_uri: redirectUri
16462
- }
16509
+ connector_type: connectorType,
16510
+ code,
16511
+ state,
16512
+ workspace_id: workspaceId,
16513
+ ...redirectUri !== void 0 && {
16514
+ redirect_uri: redirectUri
16463
16515
  }
16464
16516
  }
16465
16517
  }
@@ -16735,11 +16787,9 @@ function createConnectorsNamespace(rb) {
16735
16787
  body: {
16736
16788
  data: {
16737
16789
  type: "connector_instance",
16738
- attributes: {
16739
- connector_id: connectorId,
16740
- workspace_id: workspaceId,
16741
- email
16742
- }
16790
+ connector_id: connectorId,
16791
+ workspace_id: workspaceId,
16792
+ email
16743
16793
  }
16744
16794
  }
16745
16795
  },
@@ -16782,11 +16832,9 @@ function createConnectorsNamespace(rb) {
16782
16832
  body: {
16783
16833
  data: {
16784
16834
  type: "connector_instance",
16785
- attributes: {
16786
- connector_id: connectorId,
16787
- workspace_id: workspaceId,
16788
- ...attrs
16789
- }
16835
+ connector_id: connectorId,
16836
+ workspace_id: workspaceId,
16837
+ ...attrs
16790
16838
  }
16791
16839
  }
16792
16840
  },
@@ -16824,11 +16872,9 @@ function createConnectorsNamespace(rb) {
16824
16872
  body: {
16825
16873
  data: {
16826
16874
  type: "connector_instance",
16827
- attributes: {
16828
- connector_id: connectorId,
16829
- workspace_id: workspaceId,
16830
- patient_id: patientId
16831
- }
16875
+ connector_id: connectorId,
16876
+ workspace_id: workspaceId,
16877
+ patient_id: patientId
16832
16878
  }
16833
16879
  }
16834
16880
  },
@@ -16868,10 +16914,8 @@ function createConnectorsNamespace(rb) {
16868
16914
  body: {
16869
16915
  data: {
16870
16916
  type: "connector_instance",
16871
- attributes: {
16872
- connector_type: "fullscript",
16873
- workspace_id: workspaceId
16874
- }
16917
+ connector_type: "fullscript",
16918
+ workspace_id: workspaceId
16875
16919
  }
16876
16920
  }
16877
16921
  },
@@ -16913,14 +16957,12 @@ function createConnectorsNamespace(rb) {
16913
16957
  body: {
16914
16958
  data: {
16915
16959
  type: "connector_instance",
16916
- attributes: {
16917
- connector_type: "fullscript",
16918
- code,
16919
- state,
16920
- workspace_id: workspaceId,
16921
- ...redirectUri !== void 0 && {
16922
- redirect_uri: redirectUri
16923
- }
16960
+ connector_type: "fullscript",
16961
+ code,
16962
+ state,
16963
+ workspace_id: workspaceId,
16964
+ ...redirectUri !== void 0 && {
16965
+ redirect_uri: redirectUri
16924
16966
  }
16925
16967
  }
16926
16968
  }
@@ -17609,7 +17651,7 @@ function createCrmNamespace(rb) {
17609
17651
  archive: async (id, options) => {
17610
17652
  return rb.execute(
17611
17653
  patchCrmContactsByIdArchive,
17612
- { path: { id } },
17654
+ { path: { id }, body: { data: { type: "crm_contact", id } } },
17613
17655
  options
17614
17656
  );
17615
17657
  },
@@ -19385,7 +19427,7 @@ function createCampaignsNamespace(rb) {
19385
19427
  postEmailMarketingCampaignsByIdCreateFollowup,
19386
19428
  {
19387
19429
  path: { id },
19388
- body: { data: { type: "email_marketing_campaign", attributes } }
19430
+ body: { data: { type: "email_marketing_campaign", ...attributes } }
19389
19431
  },
19390
19432
  options
19391
19433
  );
@@ -19447,7 +19489,7 @@ function createCampaignsNamespace(rb) {
19447
19489
  {
19448
19490
  data: {
19449
19491
  type: "campaign-template",
19450
- attributes: { body_mjml: mjml }
19492
+ body_mjml: mjml
19451
19493
  }
19452
19494
  },
19453
19495
  options
@@ -27230,13 +27272,11 @@ function createThreadsNamespace(rb) {
27230
27272
  body: {
27231
27273
  data: {
27232
27274
  type: "thread",
27233
- attributes: {
27234
- content,
27235
- ...rest,
27236
- metadata: mergeWithBrowserContext(
27237
- metadata
27238
- )
27239
- }
27275
+ content,
27276
+ ...rest,
27277
+ metadata: mergeWithBrowserContext(
27278
+ metadata
27279
+ )
27240
27280
  }
27241
27281
  }
27242
27282
  },
@@ -27284,13 +27324,11 @@ function createThreadsNamespace(rb) {
27284
27324
  {
27285
27325
  data: {
27286
27326
  type: "message",
27287
- attributes: {
27288
- content,
27289
- ...rest,
27290
- metadata: mergeWithBrowserContext(
27291
- metadata
27292
- )
27293
- }
27327
+ content,
27328
+ ...rest,
27329
+ metadata: mergeWithBrowserContext(
27330
+ metadata
27331
+ )
27294
27332
  }
27295
27333
  },
27296
27334
  options,
@@ -27368,7 +27406,7 @@ function createThreadsNamespace(rb) {
27368
27406
  postThreadsByIdComplete,
27369
27407
  {
27370
27408
  path: { id: threadId },
27371
- body: { data: { type: "thread", attributes: {} } }
27409
+ body: { data: { type: "thread" } }
27372
27410
  },
27373
27411
  options
27374
27412
  );
@@ -29644,10 +29682,8 @@ function createSocialNamespace(rb) {
29644
29682
  body: {
29645
29683
  data: {
29646
29684
  type: "social_campaign",
29647
- attributes: {
29648
- campaign_id: id,
29649
- workspace_id: workspaceId
29650
- }
29685
+ campaign_id: id,
29686
+ workspace_id: workspaceId
29651
29687
  }
29652
29688
  }
29653
29689
  },
@@ -29663,11 +29699,9 @@ function createSocialNamespace(rb) {
29663
29699
  body: {
29664
29700
  data: {
29665
29701
  type: "social_campaign",
29666
- attributes: {
29667
- campaign_id: id,
29668
- workspace_id: workspaceId,
29669
- social_account_id: socialAccountId
29670
- }
29702
+ campaign_id: id,
29703
+ workspace_id: workspaceId,
29704
+ social_account_id: socialAccountId
29671
29705
  }
29672
29706
  }
29673
29707
  },