@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.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.3";
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() {
@@ -6392,6 +6392,11 @@ var postWatcherEvents = (options) => (options.client ?? client).post({
6392
6392
  ...options.headers
6393
6393
  }
6394
6394
  });
6395
+ var getAgentsBySlugBySlug = (options) => (options.client ?? client).get({
6396
+ security: [{ scheme: "bearer", type: "http" }],
6397
+ url: "/agents/by-slug/{slug}",
6398
+ ...options
6399
+ });
6395
6400
  var getFeatureDefinitionsByApplicationByApplicationId = (options) => (options.client ?? client).get({
6396
6401
  security: [{ scheme: "bearer", type: "http" }],
6397
6402
  url: "/feature-definitions/by-application/{application_id}",
@@ -7196,6 +7201,26 @@ function createAgentsNamespace(rb) {
7196
7201
  get: async (id, options) => {
7197
7202
  return rb.execute(getAgentsById, { path: { id } }, options);
7198
7203
  },
7204
+ /**
7205
+ * Look up an agent by its system_slug. Use this for ISV-provisioned agents
7206
+ * where the slug is a stable identifier that survives database resets.
7207
+ *
7208
+ * @param slug - The system_slug of the agent (e.g., "chartless-session-prep-briefing").
7209
+ * @param options - Optional request options.
7210
+ * @returns The Agent record.
7211
+ *
7212
+ * @example
7213
+ * ```ts
7214
+ * const agent = await client.agents.getBySlug("chartless-session-prep-briefing");
7215
+ * ```
7216
+ */
7217
+ getBySlug: async (slug, options) => {
7218
+ return rb.execute(
7219
+ getAgentsBySlugBySlug,
7220
+ { path: { slug } },
7221
+ options
7222
+ );
7223
+ },
7199
7224
  /**
7200
7225
  * Creates a new agent with a blank initial version (v1).
7201
7226
  *
@@ -8491,16 +8516,16 @@ function createAgentsNamespace(rb) {
8491
8516
  * @param agentId - The UUID of the agent to execute.
8492
8517
  * @param input - Input data for the agent (task description, documents, etc.).
8493
8518
  * @param opts - Additional execution options.
8519
+ * @param opts.workspace_id - The workspace to execute in. Required for `sk_app_` key auth.
8494
8520
  * @param opts.model_id - Override model for this execution only (e.g., "anthropic/claude-sonnet-4").
8495
8521
  * Highest priority in the model resolution chain.
8496
- * @param reqOptions - Optional request options. Use `idempotencyKey` to prevent duplicate executions.
8497
8522
  * @returns The created execution record with status `pending`.
8498
8523
  *
8499
8524
  * @example
8500
8525
  * const exec = await client.agents.executions.start('agt_01...', {
8501
8526
  * task: 'Extract invoice fields',
8502
8527
  * document_id: 'doc_01...',
8503
- * });
8528
+ * }, { workspace_id: 'ws_abc123' });
8504
8529
  * console.log(exec.id, exec.status); // 'pending'
8505
8530
  *
8506
8531
  * @example
@@ -8508,12 +8533,13 @@ function createAgentsNamespace(rb) {
8508
8533
  * const exec = await client.agents.executions.start(
8509
8534
  * 'agt_01...',
8510
8535
  * { task: 'Complex reasoning' },
8511
- * { model_id: 'anthropic/claude-sonnet-4' },
8536
+ * { workspace_id: 'ws_abc123', model_id: 'anthropic/claude-sonnet-4' },
8512
8537
  * );
8513
8538
  */
8514
8539
  start: async (agentId, input, opts) => {
8515
- const { model_id, ...reqOptions } = opts ?? {};
8540
+ const { workspace_id, model_id, ...reqOptions } = opts ?? {};
8516
8541
  const body = { input };
8542
+ if (workspace_id) body.workspace_id = workspace_id;
8517
8543
  if (model_id) body.model_id = model_id;
8518
8544
  return rb.rawPost(
8519
8545
  `/agents/${agentId}/execute`,
@@ -8530,20 +8556,24 @@ function createAgentsNamespace(rb) {
8530
8556
  *
8531
8557
  * @param agentId - The UUID of the agent.
8532
8558
  * @param input - Input data (same format as {@link start}).
8533
- * @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.
8534
8561
  * @returns Cost estimate with min/max credit ranges.
8535
8562
  *
8536
8563
  * @example
8537
8564
  * const estimate = await client.agents.executions.estimate('agt_01...', {
8538
8565
  * task: 'Process batch',
8539
- * });
8566
+ * }, { workspace_id: 'ws_abc123' });
8540
8567
  * console.log(`Estimated cost: ${estimate.min_credits} - ${estimate.max_credits}`);
8541
8568
  */
8542
- 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;
8543
8573
  return rb.rawPost(
8544
8574
  `/agents/${agentId}/estimate`,
8545
- { input },
8546
- options
8575
+ body,
8576
+ Object.keys(reqOptions).length > 0 ? reqOptions : void 0
8547
8577
  );
8548
8578
  },
8549
8579
  /**
@@ -8569,14 +8599,20 @@ function createAgentsNamespace(rb) {
8569
8599
  * Returns only executions triggered by the authenticated user,
8570
8600
  * ordered by creation time descending.
8571
8601
  *
8572
- * @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.
8573
8604
  * @returns Array of execution records.
8574
8605
  *
8575
8606
  * @example
8576
- * const executions = await client.agents.executions.list();
8607
+ * const executions = await client.agents.executions.list({ workspace_id: 'ws_abc123' });
8577
8608
  */
8578
- list: async (options) => {
8579
- 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
+ );
8580
8616
  },
8581
8617
  /**
8582
8618
  * Opens an SSE stream for real-time execution events.
@@ -9064,7 +9100,8 @@ function createAiNamespace(rb) {
9064
9100
  body: {
9065
9101
  data: {
9066
9102
  type: "ai-message",
9067
- attributes: { ...body, conversation_id: conversationId }
9103
+ ...body,
9104
+ conversation_id: conversationId
9068
9105
  }
9069
9106
  }
9070
9107
  },
@@ -10871,7 +10908,7 @@ function createContentNamespace(rb) {
10871
10908
  postContentGenerateText,
10872
10909
  {
10873
10910
  body: {
10874
- data: { type: "content-generation", attributes }
10911
+ data: { type: "content-generation", ...attributes }
10875
10912
  }
10876
10913
  },
10877
10914
  options
@@ -10894,7 +10931,7 @@ function createContentNamespace(rb) {
10894
10931
  postContentGenerateImage,
10895
10932
  {
10896
10933
  body: {
10897
- data: { type: "content-generation", attributes }
10934
+ data: { type: "content-generation", ...attributes }
10898
10935
  }
10899
10936
  },
10900
10937
  options
@@ -10918,7 +10955,7 @@ function createContentNamespace(rb) {
10918
10955
  postContentEditImage,
10919
10956
  {
10920
10957
  body: {
10921
- data: { type: "content-generation", attributes }
10958
+ data: { type: "content-generation", ...attributes }
10922
10959
  }
10923
10960
  },
10924
10961
  options
@@ -10942,7 +10979,7 @@ function createContentNamespace(rb) {
10942
10979
  postContentRewriteTone,
10943
10980
  {
10944
10981
  body: {
10945
- data: { type: "content-generation", attributes }
10982
+ data: { type: "content-generation", ...attributes }
10946
10983
  }
10947
10984
  },
10948
10985
  options
@@ -10966,7 +11003,7 @@ function createContentNamespace(rb) {
10966
11003
  postContentShorten,
10967
11004
  {
10968
11005
  body: {
10969
- data: { type: "content-generation", attributes }
11006
+ data: { type: "content-generation", ...attributes }
10970
11007
  }
10971
11008
  },
10972
11009
  options
@@ -10990,7 +11027,7 @@ function createContentNamespace(rb) {
10990
11027
  postContentRefine,
10991
11028
  {
10992
11029
  body: {
10993
- data: { type: "content-generation", attributes }
11030
+ data: { type: "content-generation", ...attributes }
10994
11031
  }
10995
11032
  },
10996
11033
  options
@@ -11014,7 +11051,7 @@ function createContentNamespace(rb) {
11014
11051
  postContentSuggestTopics,
11015
11052
  {
11016
11053
  body: {
11017
- data: { type: "content-generation", attributes }
11054
+ data: { type: "content-generation", ...attributes }
11018
11055
  }
11019
11056
  },
11020
11057
  options
@@ -11037,7 +11074,7 @@ function createContentNamespace(rb) {
11037
11074
  postContentGenerateImagePrompt,
11038
11075
  {
11039
11076
  body: {
11040
- data: { type: "content-generation", attributes }
11077
+ data: { type: "content-generation", ...attributes }
11041
11078
  }
11042
11079
  },
11043
11080
  options
@@ -11061,7 +11098,7 @@ function createContentNamespace(rb) {
11061
11098
  postContentGenerateHashtags,
11062
11099
  {
11063
11100
  body: {
11064
- data: { type: "content-generation", attributes }
11101
+ data: { type: "content-generation", ...attributes }
11065
11102
  }
11066
11103
  },
11067
11104
  options
@@ -11085,7 +11122,7 @@ function createContentNamespace(rb) {
11085
11122
  postContentSeoEnrich,
11086
11123
  {
11087
11124
  body: {
11088
- data: { type: "content-generation", attributes }
11125
+ data: { type: "content-generation", ...attributes }
11089
11126
  }
11090
11127
  },
11091
11128
  options
@@ -11779,6 +11816,27 @@ function createClinicalNamespace(rb) {
11779
11816
  deleteClinicalClientGoalsById,
11780
11817
  { path: { id } },
11781
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
11782
11840
  )
11783
11841
  },
11784
11842
  /**
@@ -16225,7 +16283,7 @@ function createConnectorsNamespace(rb) {
16225
16283
  body: {
16226
16284
  data: {
16227
16285
  type: "credential",
16228
- attributes: { workspace_id: workspaceId }
16286
+ workspace_id: workspaceId
16229
16287
  }
16230
16288
  }
16231
16289
  },
@@ -16259,7 +16317,7 @@ function createConnectorsNamespace(rb) {
16259
16317
  body: {
16260
16318
  data: {
16261
16319
  type: "credential",
16262
- attributes
16320
+ ...attributes
16263
16321
  }
16264
16322
  }
16265
16323
  },
@@ -16290,11 +16348,9 @@ function createConnectorsNamespace(rb) {
16290
16348
  body: {
16291
16349
  data: {
16292
16350
  type: "credential",
16293
- attributes: {
16294
- workspace_id: workspaceId,
16295
- connector_type: connectorType,
16296
- scope_level: scopeLevel
16297
- }
16351
+ workspace_id: workspaceId,
16352
+ connector_type: connectorType,
16353
+ scope_level: scopeLevel
16298
16354
  }
16299
16355
  }
16300
16356
  },
@@ -16339,10 +16395,8 @@ function createConnectorsNamespace(rb) {
16339
16395
  body: {
16340
16396
  data: {
16341
16397
  type: "connector_instance",
16342
- attributes: {
16343
- connector_type: connectorType,
16344
- workspace_id: workspaceId
16345
- }
16398
+ connector_type: connectorType,
16399
+ workspace_id: workspaceId
16346
16400
  }
16347
16401
  }
16348
16402
  },
@@ -16388,14 +16442,12 @@ function createConnectorsNamespace(rb) {
16388
16442
  body: {
16389
16443
  data: {
16390
16444
  type: "connector_instance",
16391
- attributes: {
16392
- connector_type: connectorType,
16393
- code,
16394
- state,
16395
- workspace_id: workspaceId,
16396
- ...redirectUri !== void 0 && {
16397
- redirect_uri: redirectUri
16398
- }
16445
+ connector_type: connectorType,
16446
+ code,
16447
+ state,
16448
+ workspace_id: workspaceId,
16449
+ ...redirectUri !== void 0 && {
16450
+ redirect_uri: redirectUri
16399
16451
  }
16400
16452
  }
16401
16453
  }
@@ -16671,11 +16723,9 @@ function createConnectorsNamespace(rb) {
16671
16723
  body: {
16672
16724
  data: {
16673
16725
  type: "connector_instance",
16674
- attributes: {
16675
- connector_id: connectorId,
16676
- workspace_id: workspaceId,
16677
- email
16678
- }
16726
+ connector_id: connectorId,
16727
+ workspace_id: workspaceId,
16728
+ email
16679
16729
  }
16680
16730
  }
16681
16731
  },
@@ -16718,11 +16768,9 @@ function createConnectorsNamespace(rb) {
16718
16768
  body: {
16719
16769
  data: {
16720
16770
  type: "connector_instance",
16721
- attributes: {
16722
- connector_id: connectorId,
16723
- workspace_id: workspaceId,
16724
- ...attrs
16725
- }
16771
+ connector_id: connectorId,
16772
+ workspace_id: workspaceId,
16773
+ ...attrs
16726
16774
  }
16727
16775
  }
16728
16776
  },
@@ -16760,11 +16808,9 @@ function createConnectorsNamespace(rb) {
16760
16808
  body: {
16761
16809
  data: {
16762
16810
  type: "connector_instance",
16763
- attributes: {
16764
- connector_id: connectorId,
16765
- workspace_id: workspaceId,
16766
- patient_id: patientId
16767
- }
16811
+ connector_id: connectorId,
16812
+ workspace_id: workspaceId,
16813
+ patient_id: patientId
16768
16814
  }
16769
16815
  }
16770
16816
  },
@@ -16804,10 +16850,8 @@ function createConnectorsNamespace(rb) {
16804
16850
  body: {
16805
16851
  data: {
16806
16852
  type: "connector_instance",
16807
- attributes: {
16808
- connector_type: "fullscript",
16809
- workspace_id: workspaceId
16810
- }
16853
+ connector_type: "fullscript",
16854
+ workspace_id: workspaceId
16811
16855
  }
16812
16856
  }
16813
16857
  },
@@ -16849,14 +16893,12 @@ function createConnectorsNamespace(rb) {
16849
16893
  body: {
16850
16894
  data: {
16851
16895
  type: "connector_instance",
16852
- attributes: {
16853
- connector_type: "fullscript",
16854
- code,
16855
- state,
16856
- workspace_id: workspaceId,
16857
- ...redirectUri !== void 0 && {
16858
- redirect_uri: redirectUri
16859
- }
16896
+ connector_type: "fullscript",
16897
+ code,
16898
+ state,
16899
+ workspace_id: workspaceId,
16900
+ ...redirectUri !== void 0 && {
16901
+ redirect_uri: redirectUri
16860
16902
  }
16861
16903
  }
16862
16904
  }
@@ -17545,7 +17587,7 @@ function createCrmNamespace(rb) {
17545
17587
  archive: async (id, options) => {
17546
17588
  return rb.execute(
17547
17589
  patchCrmContactsByIdArchive,
17548
- { path: { id } },
17590
+ { path: { id }, body: { data: { type: "crm_contact", id } } },
17549
17591
  options
17550
17592
  );
17551
17593
  },
@@ -19321,7 +19363,7 @@ function createCampaignsNamespace(rb) {
19321
19363
  postEmailMarketingCampaignsByIdCreateFollowup,
19322
19364
  {
19323
19365
  path: { id },
19324
- body: { data: { type: "email_marketing_campaign", attributes } }
19366
+ body: { data: { type: "email_marketing_campaign", ...attributes } }
19325
19367
  },
19326
19368
  options
19327
19369
  );
@@ -19383,7 +19425,7 @@ function createCampaignsNamespace(rb) {
19383
19425
  {
19384
19426
  data: {
19385
19427
  type: "campaign-template",
19386
- attributes: { body_mjml: mjml }
19428
+ body_mjml: mjml
19387
19429
  }
19388
19430
  },
19389
19431
  options
@@ -27166,13 +27208,11 @@ function createThreadsNamespace(rb) {
27166
27208
  body: {
27167
27209
  data: {
27168
27210
  type: "thread",
27169
- attributes: {
27170
- content,
27171
- ...rest,
27172
- metadata: mergeWithBrowserContext(
27173
- metadata
27174
- )
27175
- }
27211
+ content,
27212
+ ...rest,
27213
+ metadata: mergeWithBrowserContext(
27214
+ metadata
27215
+ )
27176
27216
  }
27177
27217
  }
27178
27218
  },
@@ -27220,13 +27260,11 @@ function createThreadsNamespace(rb) {
27220
27260
  {
27221
27261
  data: {
27222
27262
  type: "message",
27223
- attributes: {
27224
- content,
27225
- ...rest,
27226
- metadata: mergeWithBrowserContext(
27227
- metadata
27228
- )
27229
- }
27263
+ content,
27264
+ ...rest,
27265
+ metadata: mergeWithBrowserContext(
27266
+ metadata
27267
+ )
27230
27268
  }
27231
27269
  },
27232
27270
  options,
@@ -27304,7 +27342,7 @@ function createThreadsNamespace(rb) {
27304
27342
  postThreadsByIdComplete,
27305
27343
  {
27306
27344
  path: { id: threadId },
27307
- body: { data: { type: "thread", attributes: {} } }
27345
+ body: { data: { type: "thread" } }
27308
27346
  },
27309
27347
  options
27310
27348
  );
@@ -29580,10 +29618,8 @@ function createSocialNamespace(rb) {
29580
29618
  body: {
29581
29619
  data: {
29582
29620
  type: "social_campaign",
29583
- attributes: {
29584
- campaign_id: id,
29585
- workspace_id: workspaceId
29586
- }
29621
+ campaign_id: id,
29622
+ workspace_id: workspaceId
29587
29623
  }
29588
29624
  }
29589
29625
  },
@@ -29599,11 +29635,9 @@ function createSocialNamespace(rb) {
29599
29635
  body: {
29600
29636
  data: {
29601
29637
  type: "social_campaign",
29602
- attributes: {
29603
- campaign_id: id,
29604
- workspace_id: workspaceId,
29605
- social_account_id: socialAccountId
29606
- }
29638
+ campaign_id: id,
29639
+ workspace_id: workspaceId,
29640
+ social_account_id: socialAccountId
29607
29641
  }
29608
29642
  }
29609
29643
  },