@superclerk/sdk 0.3.0 → 0.5.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ ## 0.5.0 (2026-11-28)
6
+
7
+ Still pinned to API version `2026-11-05`.
8
+
9
+ - `connections.tools.run(connectionID, { tool, input })` runs one of a connection's tools by its name and answers its
10
+ output, waiting and throwing `ToolRunError` as `tools.run` does. It is for a tool `tools.run` can't type, such as a
11
+ connected MCP server's: an MCP server a member connected with a sign-in or a key is now a connection with `appID`
12
+ `mcp`, listed by `connections.list`, whose tools `connections.tools.list` describes as the server does.
13
+
14
+ ## 0.4.0 (2026-11-25)
15
+
16
+ Still pinned to API version `2026-11-05`.
17
+
18
+ - `apiKey: null` sends no key, for a team app Superclerk hosts: its pages call their own address,
19
+ `${location.origin}/_superclerk`, as the `baseURL`, which acts as the teammate signed in to the app.
20
+ - Google Business Profile: `business_profile_update_chat_links` sets or removes the WhatsApp and text links behind a
21
+ location's Message button on Google Maps, and `business_profile_get_attributes` reads what the business set.
22
+ `business_profile_fetch_performance_metrics` takes `MESSAGING_CLICKS`, the taps on that button, and drops
23
+ `BUSINESS_CONVERSATIONS` and `BUSINESS_FOOD_ORDERS`, which Google retired.
24
+ - Conversations answer `contactDomain`: the domain of the email address a conversation reaches its customer at, such
25
+ as `acme.com`, or null where it doesn't reach them by email or where it is a free mailbox such as gmail.com.
26
+ - A chat's approval card answers `button`: what approving does, in the words of its button, such as
27
+ `Start cold email`, or null where the card doesn't say. A trigger's prompt is a `synthetic` message, as Superclerk's
28
+ words to the agent rather than the person's.
29
+ - A chat's user message answers `source`: who wrote it, the chat's `member`, their `team`, an `outsider`, the `agent`
30
+ that gave a subagent its task, a `trigger` the member set up (its prompt), or Superclerk itself (`runtime`).
31
+ Superclerk's words to the agent are never sent: a `trigger` or `runtime` message's text parts come with empty
32
+ `text`, text written for the model alone is left out, and a reply the agent chose to withhold comes with no text.
33
+ `synthetic` stays, true exactly for `trigger` and `runtime`, and is removed in a later version.
34
+
3
35
  ## 0.3.0 (2026-11-17)
4
36
 
5
37
  Still pinned to API version `2026-11-05`.
package/README.md CHANGED
@@ -55,8 +55,15 @@ const { messageId } = await superclerk.tools.run({
55
55
  })
56
56
  ```
57
57
 
58
- A run that ends failed throws `ToolRunError`, whose `code` is the run's error kind. To start a run without waiting for
59
- it, call `tools.runs.create` and read it later with `tools.runs.wait`.
58
+ A run that ends failed throws `ToolRunError`, whose `code` is the run's error kind and whose `message` says what went
59
+ wrong. To start a run without waiting for it, call `tools.runs.create` and read it later with `tools.runs.wait`.
60
+
61
+ A connected MCP server's tools are its own, so `tools.run` can't type them. `connections.tools.run` runs one by its
62
+ name, the same way, and answers the server's output:
63
+
64
+ ```ts
65
+ const output = await superclerk.connections.tools.run("itn_456", { tool: "search_docs", input: { query: "webhooks" } })
66
+ ```
60
67
 
61
68
  ## Call a provider's API
62
69
 
@@ -149,6 +156,23 @@ await superclerk.contacts.list({}, { workspace: "org_client" })
149
156
  An operation takes a client workspace only when its reference names the `Superclerk-Workspace` header. The rest act in
150
157
  the key's own workspace alone, and answer `403 workspace_not_supported` when a request names another.
151
158
 
159
+ ## Team apps Superclerk hosts
160
+
161
+ A team app's pages call the API in the browser through their own address, with no key: Superclerk signs in the
162
+ teammate using the app, and each call acts as them, with their own role.
163
+
164
+ ```ts
165
+ import { Superclerk } from "@superclerk/sdk"
166
+
167
+ const superclerk = new Superclerk({ apiKey: null, baseURL: `${location.origin}/_superclerk` })
168
+ const { items } = await superclerk.contacts.list({ limit: 20 })
169
+ ```
170
+
171
+ It reaches what Superclerk's own pages use, such as contacts, deals, tasks, conversations and the Inbox, and it runs
172
+ connected apps' tools (`tools.run`) on the teammate's own connections and the ones shared with the workspace.
173
+ Operations that take only an API key, such as a connection's raw provider API (`connections.fetch`), connect links and
174
+ webhooks, answer `403 not_available_to_team_apps`.
175
+
152
176
  ## Errors
153
177
 
154
178
  Everything the SDK throws is a `SuperclerkError`, apart from the reason you abort a call with. Branch on its `code`,
@@ -249,7 +273,7 @@ this to your repository's `AGENTS.md` or `CLAUDE.md` so an agent reads them befo
249
273
 
250
274
  - Call the Superclerk API through `@superclerk/sdk`. Read `node_modules/@superclerk/sdk/README.md`, and `api.md`
251
275
  beside it for every method, before writing Superclerk code.
252
- - Run tools with `superclerk.tools.run`; it waits for the run and throws `ToolRunError` when the run fails.
276
+ - Run tools with `superclerk.tools.run`, or a connected MCP server's with `superclerk.connections.tools.run`; both wait for the run and throw `ToolRunError` when it fails.
253
277
  - Ask before running a tool that writes, sends or posts. Never print or commit the API key.
254
278
  - Docs: https://docs.superclerk.com/llms.txt, or the docs MCP server at https://docs.superclerk.com/mcp.
255
279
  ```
package/api.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Superclerk TypeScript SDK reference
2
2
 
3
- Generated from the public OpenAPI document. Every method returns an `APIPromise`; a list method returns a `PagePromise` you can await for one page or iterate for every item. See the README for the hand-written helpers: `tools.run`, `tools.runs.wait`, `connect.links.wait`, `connections.fetch`, `social.media.upload` and `webhooks.unwrap`.
3
+ Generated from the public OpenAPI document. Every method returns an `APIPromise`; a list method returns a `PagePromise` you can await for one page or iterate for every item. See the README for the hand-written helpers: `tools.run`, `tools.runs.wait`, `connections.tools.run`, `connect.links.wait`, `connections.fetch`, `social.media.upload` and `webhooks.unwrap`.
4
4
 
5
5
  ## connect
6
6
 
@@ -94,6 +94,7 @@ Generated from the public OpenAPI document. Every method returns an `APIPromise`
94
94
  - `client.social.media.confirm(mediaID)` → `SocialMediaConfirmResponse` — `POST /v1/social/media/{mediaID}/confirm`
95
95
  - `client.social.media.download(mediaID)` → `SocialMediaDownloadResponse` — `GET /v1/social/media/{mediaID}/download`
96
96
  - `client.social.media.get(mediaID)` → `SocialMediaGetResponse` — `GET /v1/social/media/{mediaID}`
97
+ - `client.social.media.delete(mediaID)` → `SocialMediaDeleteResponse` — `DELETE /v1/social/media/{mediaID}`
97
98
 
98
99
  ### social.posts
99
100
 
package/core/client.d.ts CHANGED
@@ -14,8 +14,11 @@ export interface Operation {
14
14
  response: "json" | "raw";
15
15
  }
16
16
  export interface ClientOptions {
17
- /** Defaults to the `SUPERCLERK_API_KEY` environment variable. */
18
- apiKey?: string;
17
+ /**
18
+ * Defaults to the `SUPERCLERK_API_KEY` environment variable. `null` sends no key, for a team app Superclerk hosts: its
19
+ * pages call their own address, `${location.origin}/_superclerk`, which acts as the person signed in to the app.
20
+ */
21
+ apiKey?: string | null;
19
22
  /** Defaults to the `SUPERCLERK_BASE_URL` environment variable, then `https://api.superclerk.com`. */
20
23
  baseURL?: string;
21
24
  /** A client workspace of the key's agency to act in, as `workspaces.list` returns it. */
package/core/client.js CHANGED
@@ -25,8 +25,8 @@ export class Core {
25
25
  // names, and only the server running a chat's turn streams the agent's text as it's written.
26
26
  #cookies = new Map();
27
27
  constructor(options = {}) {
28
- const apiKey = options.apiKey ?? readEnv("SUPERCLERK_API_KEY");
29
- if (!apiKey)
28
+ const apiKey = options.apiKey === null ? null : (options.apiKey ?? readEnv("SUPERCLERK_API_KEY"));
29
+ if (apiKey === undefined || apiKey === "")
30
30
  throw new SuperclerkError("missing_api_key", "Pass apiKey, or set the SUPERCLERK_API_KEY environment variable. To create a key: https://docs.superclerk.com/authentication");
31
31
  this.#apiKey = apiKey;
32
32
  this.baseURL = (options.baseURL ?? readEnv("SUPERCLERK_BASE_URL") ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
@@ -133,7 +133,8 @@ export class Core {
133
133
  }
134
134
  headers(operation, options) {
135
135
  const headers = new Headers(this.#defaultHeaders);
136
- headers.set("Authorization", `Bearer ${this.#apiKey}`);
136
+ if (this.#apiKey !== null)
137
+ headers.set("Authorization", `Bearer ${this.#apiKey}`);
137
138
  headers.set("Accept", "application/json");
138
139
  headers.set("Superclerk-Version", API_VERSION);
139
140
  headers.set("User-Agent", this.#userAgent);
@@ -94,7 +94,7 @@ export declare class ToolsRuns extends APIResource {
94
94
  /**
95
95
  * Run a built-in or connected tool
96
96
  *
97
- * Target a built-in tool with appID or a connected tool with connectionID; provide exactly one. Every call requires the key's current issuing administrator; built-in calls create no installation. New submissions validate tool-specific input before reserving a run or idempotency key. Invalid arguments return invalid_tool_input with bounded field paths and safe constraint messages. A field the tool does not take is refused, not ignored, and fields names it by its path, unless it sits in a value of several undiscriminated shapes and not exactly one of them would fit without such fields; fields then names that value as a whole. Terminal failures may include an allowlisted providerCode; raw provider error messages are not exposed.
97
+ * Target a built-in tool with appID or a connected tool with connectionID; provide exactly one. A key's call requires its issuing administrator to be current; a team app's runs as the person signed in, on their own connections and the ones a teammate shared. Built-in calls create no installation. New submissions validate tool-specific input before reserving a run or idempotency key. Invalid arguments return invalid_tool_input with bounded field paths and safe constraint messages. A field the tool does not take is refused, not ignored, and fields names it by its path, unless it sits in a value of several undiscriminated shapes and not exactly one of them would fit without such fields; fields then names that value as a whole. A connected MCP server's tool takes the input its server's schema allows. A terminal failure's message says what went wrong, with the provider's documented reason where it says what to change; it may include an allowlisted providerCode. Raw provider response bodies are never exposed.
98
98
  *
99
99
  * Formerly `POST /v1/tool-runs`, which still answers, marked deprecated.
100
100
  *
@@ -102,9 +102,9 @@ export declare class ToolsRuns extends APIResource {
102
102
  */
103
103
  create(params: Types.ToolsRunsCreateParams, options?: RequestOptions): APIPromise<Types.ToolsRunsCreateResponse>;
104
104
  /**
105
- * Get a tool run created by an API key in this organization
105
+ * Get a tool run
106
106
  *
107
- * Polling never runs the tool again. A completed run's result expires after 24 hours; a failed or cancelled run, outcome_unknown included, stays readable.
107
+ * Polling never runs the tool again. A key reads every run in its workspace; a team app's person only their own. A completed run's result expires after 24 hours; a failed or cancelled run, outcome_unknown included, stays readable.
108
108
  *
109
109
  * Formerly `GET /v1/tool-runs/{runID}`, which still answers, marked deprecated.
110
110
  *
@@ -117,7 +117,7 @@ export declare class ToolsBase extends APIResource {
117
117
  /**
118
118
  * List built-in public tools
119
119
  *
120
- * These tools use appID targets and require no connected account or installation. Executing them requires a key bound to a current issuing administrator.
120
+ * These tools use appID targets and require no connected account or installation. Running one takes a key whose issuing administrator is current, or a person signed in to a team app.
121
121
  *
122
122
  * `GET /v1/tools`
123
123
  */
@@ -154,7 +154,7 @@ export declare class AppsTools extends APIResource {
154
154
  export declare class Apps extends APIResource {
155
155
  readonly tools: AppsTools;
156
156
  /**
157
- * List the apps an API key can use
157
+ * List the apps the API reaches
158
158
  *
159
159
  * Every app Superclerk connects to, with how its accounts sign in and how many tools it offers. A connected app's tools run on a connection; a built-in app's run on Superclerk's own account with appID.
160
160
  *
@@ -248,7 +248,7 @@ export declare class ConnectionsBase extends APIResource {
248
248
  /**
249
249
  * List the organization's connections
250
250
  *
251
- * Every connection the key reaches, with its status and, when it isn't ready, the one request that readies it. memberID narrows it to the connections one member made, such as the ones a workflow's executionMemberID can bind. MCP servers are left to the Superclerk app.
251
+ * Every connection the request reaches, with its status and, when it isn't ready, the one request that readies it: a key's, every connection of the apps it was granted; a team app's, the signed-in person's own and the ones a teammate shared. memberID narrows it to the connections one member made, such as the ones a workflow's executionMemberID can bind. An MCP server connected with a sign-in or a key is one too, with appID mcp.
252
252
  *
253
253
  * `GET /v1/connections`
254
254
  */
@@ -367,6 +367,14 @@ export declare class SocialMedia extends APIResource {
367
367
  * `GET /v1/social/media/{mediaID}`
368
368
  */
369
369
  get(mediaID: string, options?: RequestOptions): APIPromise<Types.SocialMediaGetResponse>;
370
+ /**
371
+ * Delete media no post uses
372
+ *
373
+ * Its file stops being served within minutes. Media a post uses can't be deleted.
374
+ *
375
+ * `DELETE /v1/social/media/{mediaID}`
376
+ */
377
+ delete(mediaID: string, options?: RequestOptions): APIPromise<Types.SocialMediaDeleteResponse>;
370
378
  }
371
379
  export declare class SocialPosts extends APIResource {
372
380
  /**
@@ -121,7 +121,7 @@ export class ToolsRuns extends APIResource {
121
121
  /**
122
122
  * Run a built-in or connected tool
123
123
  *
124
- * Target a built-in tool with appID or a connected tool with connectionID; provide exactly one. Every call requires the key's current issuing administrator; built-in calls create no installation. New submissions validate tool-specific input before reserving a run or idempotency key. Invalid arguments return invalid_tool_input with bounded field paths and safe constraint messages. A field the tool does not take is refused, not ignored, and fields names it by its path, unless it sits in a value of several undiscriminated shapes and not exactly one of them would fit without such fields; fields then names that value as a whole. Terminal failures may include an allowlisted providerCode; raw provider error messages are not exposed.
124
+ * Target a built-in tool with appID or a connected tool with connectionID; provide exactly one. A key's call requires its issuing administrator to be current; a team app's runs as the person signed in, on their own connections and the ones a teammate shared. Built-in calls create no installation. New submissions validate tool-specific input before reserving a run or idempotency key. Invalid arguments return invalid_tool_input with bounded field paths and safe constraint messages. A field the tool does not take is refused, not ignored, and fields names it by its path, unless it sits in a value of several undiscriminated shapes and not exactly one of them would fit without such fields; fields then names that value as a whole. A connected MCP server's tool takes the input its server's schema allows. A terminal failure's message says what went wrong, with the provider's documented reason where it says what to change; it may include an allowlisted providerCode. Raw provider response bodies are never exposed.
125
125
  *
126
126
  * Formerly `POST /v1/tool-runs`, which still answers, marked deprecated.
127
127
  *
@@ -131,9 +131,9 @@ export class ToolsRuns extends APIResource {
131
131
  return this._client.request({ method: "POST", path: `/v1/tools/runs`, body: params, idempotent: true, response: "json" }, options);
132
132
  }
133
133
  /**
134
- * Get a tool run created by an API key in this organization
134
+ * Get a tool run
135
135
  *
136
- * Polling never runs the tool again. A completed run's result expires after 24 hours; a failed or cancelled run, outcome_unknown included, stays readable.
136
+ * Polling never runs the tool again. A key reads every run in its workspace; a team app's person only their own. A completed run's result expires after 24 hours; a failed or cancelled run, outcome_unknown included, stays readable.
137
137
  *
138
138
  * Formerly `GET /v1/tool-runs/{runID}`, which still answers, marked deprecated.
139
139
  *
@@ -148,7 +148,7 @@ export class ToolsBase extends APIResource {
148
148
  /**
149
149
  * List built-in public tools
150
150
  *
151
- * These tools use appID targets and require no connected account or installation. Executing them requires a key bound to a current issuing administrator.
151
+ * These tools use appID targets and require no connected account or installation. Running one takes a key whose issuing administrator is current, or a person signed in to a team app.
152
152
  *
153
153
  * `GET /v1/tools`
154
154
  */
@@ -196,7 +196,7 @@ export class AppsTools extends APIResource {
196
196
  export class Apps extends APIResource {
197
197
  tools = new AppsTools(this._client);
198
198
  /**
199
- * List the apps an API key can use
199
+ * List the apps the API reaches
200
200
  *
201
201
  * Every app Superclerk connects to, with how its accounts sign in and how many tools it offers. A connected app's tools run on a connection; a built-in app's run on Superclerk's own account with appID.
202
202
  *
@@ -358,7 +358,7 @@ export class ConnectionsBase extends APIResource {
358
358
  /**
359
359
  * List the organization's connections
360
360
  *
361
- * Every connection the key reaches, with its status and, when it isn't ready, the one request that readies it. memberID narrows it to the connections one member made, such as the ones a workflow's executionMemberID can bind. MCP servers are left to the Superclerk app.
361
+ * Every connection the request reaches, with its status and, when it isn't ready, the one request that readies it: a key's, every connection of the apps it was granted; a team app's, the signed-in person's own and the ones a teammate shared. memberID narrows it to the connections one member made, such as the ones a workflow's executionMemberID can bind. An MCP server connected with a sign-in or a key is one too, with appID mcp.
362
362
  *
363
363
  * `GET /v1/connections`
364
364
  */
@@ -476,8 +476,13 @@ export class SocialMedia extends APIResource {
476
476
  * `GET /v1/social/media`
477
477
  */
478
478
  list(params = {}, options) {
479
- const { limit, cursor, search } = params;
480
- return this._client.list({ method: "GET", path: `/v1/social/media`, query: { limit, cursor, search }, response: "json" }, options);
479
+ const { limit, cursor, search, aiGenerated, posted } = params;
480
+ return this._client.list({
481
+ method: "GET",
482
+ path: `/v1/social/media`,
483
+ query: { limit, cursor, search, aiGenerated, posted },
484
+ response: "json",
485
+ }, options);
481
486
  }
482
487
  /**
483
488
  * Reserve a verified social media upload
@@ -519,6 +524,16 @@ export class SocialMedia extends APIResource {
519
524
  get(mediaID, options) {
520
525
  return this._client.request({ method: "GET", path: `/v1/social/media/${pathParam(mediaID)}`, response: "json" }, options);
521
526
  }
527
+ /**
528
+ * Delete media no post uses
529
+ *
530
+ * Its file stops being served within minutes. Media a post uses can't be deleted.
531
+ *
532
+ * `DELETE /v1/social/media/{mediaID}`
533
+ */
534
+ delete(mediaID, options) {
535
+ return this._client.request({ method: "DELETE", path: `/v1/social/media/${pathParam(mediaID)}`, response: "json" }, options);
536
+ }
522
537
  }
523
538
  export class SocialPosts extends APIResource {
524
539
  /**
@@ -10266,7 +10266,7 @@ export interface Tools {
10266
10266
  business_profile_fetch_performance_metrics: {
10267
10267
  input: {
10268
10268
  locationName: string;
10269
- dailyMetrics: Array<"BUSINESS_IMPRESSIONS_DESKTOP_MAPS" | "BUSINESS_IMPRESSIONS_DESKTOP_SEARCH" | "BUSINESS_IMPRESSIONS_MOBILE_MAPS" | "BUSINESS_IMPRESSIONS_MOBILE_SEARCH" | "BUSINESS_CONVERSATIONS" | "BUSINESS_DIRECTION_REQUESTS" | "CALL_CLICKS" | "WEBSITE_CLICKS" | "BUSINESS_BOOKINGS" | "BUSINESS_FOOD_ORDERS" | "BUSINESS_FOOD_MENU_CLICKS">;
10269
+ dailyMetrics: Array<"BUSINESS_IMPRESSIONS_DESKTOP_MAPS" | "BUSINESS_IMPRESSIONS_DESKTOP_SEARCH" | "BUSINESS_IMPRESSIONS_MOBILE_MAPS" | "BUSINESS_IMPRESSIONS_MOBILE_SEARCH" | "BUSINESS_DIRECTION_REQUESTS" | "CALL_CLICKS" | "WEBSITE_CLICKS" | "MESSAGING_CLICKS" | "BUSINESS_BOOKINGS" | "BUSINESS_FOOD_MENU_CLICKS">;
10270
10270
  dailyRange: {
10271
10271
  startDate: {
10272
10272
  year: number;
@@ -10286,6 +10286,17 @@ export interface Tools {
10286
10286
  }>;
10287
10287
  };
10288
10288
  };
10289
+ /** Read the attributes the business set on one location, its chat links among them. */
10290
+ business_profile_get_attributes: {
10291
+ input: {
10292
+ locationName: string;
10293
+ };
10294
+ output: {
10295
+ attributes: Array<{
10296
+ [key: string]: unknown;
10297
+ }>;
10298
+ };
10299
+ };
10289
10300
  /** Get one Google Business Profile location with an explicit read mask. */
10290
10301
  business_profile_get_location: {
10291
10302
  input: {
@@ -10444,6 +10455,21 @@ export interface Tools {
10444
10455
  nextPageToken?: string;
10445
10456
  };
10446
10457
  };
10458
+ /** Set or remove the WhatsApp and text links behind the location's Message button on Google Maps and Search. */
10459
+ business_profile_update_chat_links: {
10460
+ input: {
10461
+ locationName: string;
10462
+ /** The WhatsApp number customers message. Set null to remove the WhatsApp link; omit to leave it. */
10463
+ whatsapp?: string | null;
10464
+ /** The number that receives customers' texts. Set null to remove the text link; omit to leave it. */
10465
+ text?: string | null;
10466
+ };
10467
+ output: {
10468
+ attributes: Array<{
10469
+ [key: string]: unknown;
10470
+ }>;
10471
+ };
10472
+ };
10447
10473
  /** Update selected fields on a public Business Profile local post. */
10448
10474
  business_profile_update_local_post: {
10449
10475
  input: {
@@ -27389,6 +27415,75 @@ export interface Tools {
27389
27415
  after?: string;
27390
27416
  };
27391
27417
  };
27418
+ /** Add a video to the end of one of the channel's playlists. */
27419
+ youtube_add_to_playlist: {
27420
+ input: {
27421
+ playlistId: string;
27422
+ videoId: string;
27423
+ };
27424
+ output: {
27425
+ playlistItemId: string;
27426
+ playlistId: string;
27427
+ videoId: string;
27428
+ };
27429
+ };
27430
+ /** Publish comments that YouTube is holding for review or marked as likely spam. */
27431
+ youtube_approve_comments: {
27432
+ input: {
27433
+ commentIds: Array<string>;
27434
+ };
27435
+ output: {
27436
+ commentIds: Array<string>;
27437
+ };
27438
+ };
27439
+ /** Create a playlist on the channel. */
27440
+ youtube_create_playlist: {
27441
+ input: {
27442
+ title: string;
27443
+ description: string;
27444
+ privacyStatus: "private" | "public" | "unlisted";
27445
+ };
27446
+ output: {
27447
+ playlistId: string;
27448
+ title: string;
27449
+ privacyStatus: "private" | "public" | "unlisted";
27450
+ url: string;
27451
+ };
27452
+ };
27453
+ /** Delete a comment or reply the channel itself wrote. */
27454
+ youtube_delete_comment: {
27455
+ input: {
27456
+ commentId: string;
27457
+ };
27458
+ output: {
27459
+ commentId: string;
27460
+ };
27461
+ };
27462
+ /** Delete a video from the channel for good. */
27463
+ youtube_delete_video: {
27464
+ input: {
27465
+ videoId: string;
27466
+ };
27467
+ output: {
27468
+ videoId: string;
27469
+ };
27470
+ };
27471
+ /** Read the channel's YouTube Analytics for a date range: totals, or by day, video, country, device, traffic source, age and gender, or a video's audience retention. */
27472
+ youtube_get_analytics: {
27473
+ input: {
27474
+ startDate: string;
27475
+ endDate: string;
27476
+ /** none gives the period's totals; video ranks the top 50 videos by views. */
27477
+ breakdown: "none" | "day" | "video" | "country" | "device" | "traffic_source" | "age_gender" | "retention";
27478
+ /** Only this video's numbers. retention needs it. */
27479
+ videoId?: string;
27480
+ };
27481
+ output: {
27482
+ rows: Array<{
27483
+ [key: string]: string | number;
27484
+ }>;
27485
+ };
27486
+ };
27392
27487
  /** Read the connected channel: its ID, title, handle, subscribers, lifetime views and public videos. */
27393
27488
  youtube_get_channel: {
27394
27489
  input: {
@@ -27405,6 +27500,74 @@ export interface Tools {
27405
27500
  videos: number;
27406
27501
  };
27407
27502
  };
27503
+ /** List a video's caption tracks: each one's language, name and whether it's live. */
27504
+ youtube_list_captions: {
27505
+ input: {
27506
+ videoId: string;
27507
+ };
27508
+ output: {
27509
+ tracks: Array<{
27510
+ captionId: string;
27511
+ language: string;
27512
+ name: string;
27513
+ /** ASR tracks are YouTube's automatic captions. */
27514
+ kind: "standard" | "ASR" | "forced";
27515
+ isDraft: boolean;
27516
+ status: "serving" | "syncing" | "failed";
27517
+ }>;
27518
+ };
27519
+ };
27520
+ /** List comment threads on the channel's videos, newest first, with their first replies. */
27521
+ youtube_list_comments: {
27522
+ input: {
27523
+ /** Only this video's comments; omit for every video on the channel. */
27524
+ videoId?: string;
27525
+ /** heldForReview and likelySpam list what YouTube is holding back from public view. */
27526
+ moderationStatus?: "published" | "heldForReview" | "likelySpam";
27527
+ cursor?: string;
27528
+ };
27529
+ output: {
27530
+ threads: Array<{
27531
+ commentId: string;
27532
+ author: string;
27533
+ authorChannelId: string | null;
27534
+ text: string;
27535
+ likes: number;
27536
+ publishedAt: string;
27537
+ /** Null for a comment on the channel itself. */
27538
+ videoId: string | null;
27539
+ replyCount: number;
27540
+ canReply: boolean;
27541
+ /** The first few replies; replyCount is the total. */
27542
+ replies: Array<{
27543
+ commentId: string;
27544
+ author: string;
27545
+ authorChannelId: string | null;
27546
+ text: string;
27547
+ likes: number;
27548
+ publishedAt: string;
27549
+ }>;
27550
+ }>;
27551
+ nextCursor: string | null;
27552
+ };
27553
+ };
27554
+ /** List the channel's playlists, including private and unlisted ones, with how many videos each holds. */
27555
+ youtube_list_playlists: {
27556
+ input: {
27557
+ cursor?: string;
27558
+ };
27559
+ output: {
27560
+ playlists: Array<{
27561
+ playlistId: string;
27562
+ title: string;
27563
+ description: string;
27564
+ privacyStatus: "private" | "public" | "unlisted";
27565
+ videoCount: number;
27566
+ url: string;
27567
+ }>;
27568
+ nextCursor: string | null;
27569
+ };
27570
+ };
27408
27571
  /** List this channel's uploads from Superclerk, newest first, with each one's status and video link. */
27409
27572
  youtube_list_uploads: {
27410
27573
  input: {
@@ -27421,7 +27584,7 @@ export interface Tools {
27421
27584
  videoId: string | null;
27422
27585
  url: string | null;
27423
27586
  error: {
27424
- kind: "validation" | "permission" | "auth" | "quota_exhausted" | "provider_rejected" | "rate_limited" | "retryable_upstream" | "outcome_unknown" | "result_unavailable" | "upstream" | "timeout" | "internal" | "cancelled";
27587
+ kind: "validation" | "permission" | "auth" | "quota_exhausted" | "provider_rejected" | "rate_limited" | "retryable_upstream" | "outcome_unknown" | "result_unavailable" | "upstream" | "timeout" | "internal" | "cancelled" | "sender_restricted" | "recipient_refused";
27425
27588
  message: string;
27426
27589
  } | null;
27427
27590
  }>;
@@ -27450,6 +27613,72 @@ export interface Tools {
27450
27613
  description: string;
27451
27614
  };
27452
27615
  };
27616
+ /** Remove comments on the channel's videos from public view, with their replies. */
27617
+ youtube_remove_comments: {
27618
+ input: {
27619
+ commentIds: Array<string>;
27620
+ /** Also hide everything these authors write on the channel from now on. */
27621
+ banAuthor: boolean;
27622
+ };
27623
+ output: {
27624
+ commentIds: Array<string>;
27625
+ };
27626
+ };
27627
+ /** Reply to a comment thread as the channel. */
27628
+ youtube_reply_to_comment: {
27629
+ input: {
27630
+ /** The thread's commentId from youtube_list_comments. */
27631
+ commentId: string;
27632
+ text: string;
27633
+ };
27634
+ output: {
27635
+ commentId: string;
27636
+ parentId: string;
27637
+ };
27638
+ };
27639
+ /** Change a video's title, description, tags, category, privacy or the time it goes public. */
27640
+ youtube_update_video: {
27641
+ input: {
27642
+ videoId: string;
27643
+ title?: string;
27644
+ description?: string;
27645
+ /** Replaces every tag. */
27646
+ tags?: Array<string>;
27647
+ categoryId?: string;
27648
+ privacyStatus?: "private" | "public" | "unlisted";
27649
+ /** Make a private video that was never public go public at this time. */
27650
+ publishAt?: string;
27651
+ };
27652
+ output: {
27653
+ videoId: string;
27654
+ title: string;
27655
+ privacyStatus: "private" | "public" | "unlisted";
27656
+ publishAt: string | null;
27657
+ url: string;
27658
+ };
27659
+ };
27660
+ /** Add a caption track to a video from SubRip or WebVTT text. */
27661
+ youtube_upload_captions: {
27662
+ input: {
27663
+ videoId: string;
27664
+ language: string;
27665
+ /** Shown beside the language in YouTube's captions menu; may be empty. */
27666
+ name: string;
27667
+ /** The caption file's text, such as SubRip (.srt) or WebVTT (.vtt). */
27668
+ captions: string;
27669
+ /** true keeps the track hidden from viewers. */
27670
+ isDraft?: boolean;
27671
+ };
27672
+ output: {
27673
+ captionId: string;
27674
+ language: string;
27675
+ name: string;
27676
+ /** ASR tracks are YouTube's automatic captions. */
27677
+ kind: "standard" | "ASR" | "forced";
27678
+ isDraft: boolean;
27679
+ status: "serving" | "syncing" | "failed";
27680
+ };
27681
+ };
27453
27682
  /** Upload an MP4 to the connected channel now, or schedule when it goes live. */
27454
27683
  youtube_upload_video: {
27455
27684
  input: {
@@ -27479,7 +27708,7 @@ export interface Tools {
27479
27708
  videoId: string | null;
27480
27709
  url: string | null;
27481
27710
  error: {
27482
- kind: "validation" | "permission" | "auth" | "quota_exhausted" | "provider_rejected" | "rate_limited" | "retryable_upstream" | "outcome_unknown" | "result_unavailable" | "upstream" | "timeout" | "internal" | "cancelled";
27711
+ kind: "validation" | "permission" | "auth" | "quota_exhausted" | "provider_rejected" | "rate_limited" | "retryable_upstream" | "outcome_unknown" | "result_unavailable" | "upstream" | "timeout" | "internal" | "cancelled" | "sender_restricted" | "recipient_refused";
27483
27712
  message: string;
27484
27713
  } | null;
27485
27714
  };
@@ -1,8 +1,8 @@
1
1
  export interface Connection {
2
2
  id: string;
3
- /** Its app's title, icon, tools and proxy are on GET /v1/apps/{appID}. */
3
+ /** Its app's title, icon, tools and proxy are on GET /v1/apps/{appID}. A connected MCP server's is mcp, which isn't there: its tools are the server's own, on GET /v1/connections/{connectionID}/tools. */
4
4
  appID: string;
5
- /** The provider account the grant reaches, such as an email address or a workspace. */
5
+ /** The provider account the grant reaches, such as an email address or a workspace, or a connected MCP server's name. */
6
6
  label: string;
7
7
  /** The member who connected it, as GET /v1/members lists them. A workflow binds only the connections of its executionMemberID. */
8
8
  memberID: string;
@@ -145,7 +145,7 @@ export interface Chat {
145
145
  nextAt: string;
146
146
  } | null;
147
147
  /** What the agent waits on. */
148
- pending: Array<ChatApproval | ChatQuestion | ChatConnectionRequest | ChatSubagent | ChatSubagentWait>;
148
+ pending: Array<ChatApproval | ChatQuestion | ChatConnectionRequest | ChatSubagent | ChatSubagentWait | ChatVideo>;
149
149
  /** Why the agent's latest message ended without an answer. */
150
150
  error: ChatError | null;
151
151
  /** What the key started the chat with; null for a chat started in the app. */
@@ -242,6 +242,18 @@ export interface ChatSubagentWait {
242
242
  callID: string;
243
243
  };
244
244
  }
245
+ /** A video the agent is making; it arrives in the chat as a message, or the message says why it didn't. */
246
+ export interface ChatVideo {
247
+ type: "video";
248
+ id: string;
249
+ seconds: number;
250
+ /** The tool call that asked. */
251
+ call: {
252
+ messageID: string;
253
+ /** The tool call, as its tool part's callID names it. */
254
+ callID: string;
255
+ };
256
+ }
245
257
  export interface ChatError {
246
258
  /** stopped, context_too_long, output_too_long, provider_auth, provider_error, structured_output, failed, or the billing code that refused it, such as billing_credit_exhausted. */
247
259
  code: string;
@@ -260,12 +272,15 @@ export interface ChatUserMessage {
260
272
  /** The message's ID in the app it came in or went out through. */
261
273
  providerMessageID: string | null;
262
274
  role: "user";
263
- /** Written by Superclerk rather than the person. */
275
+ source: InputSource;
276
+ /** True exactly when source is trigger or runtime. Kept for older clients. */
264
277
  synthetic: boolean;
265
278
  context: ChatContext | null;
266
279
  /** A call filed in a phone line's thread as the caller's message: what happened, and which call's transcript and recording it belongs to. Null for anything else. */
267
280
  phone: PhoneEvent | null;
268
281
  }
282
+ /** Who wrote a message to the agent: the chat's member, their team or someone outside the workspace, the agent that gave a subagent its task, an automation the member set up (trigger: a trigger's or a workflow step's prompt), or Superclerk itself (runtime), such as a runtime notice or a subagent's report. A trigger's and the runtime's words are for the agent and never shown. */
283
+ export type InputSource = "member" | "team" | "outsider" | "agent" | "trigger" | "runtime";
269
284
  /** The page of the app the person had open, which the agent reads with the message. */
270
285
  export type ChatContext = {
271
286
  kind: "website";
@@ -309,6 +324,8 @@ export interface ChatAssistantMessage {
309
324
  } | null;
310
325
  /** Why the model stopped, such as stop, length or tool-calls. */
311
326
  finish: string | null;
327
+ /** True for the agent's summary of the chat so far, which it reads in place of the earlier messages. Its words are for the agent, so it has no parts. */
328
+ summary: boolean;
312
329
  /** Who wrote it when the agent didn't: a teammate, a workflow run, or Superclerk. */
313
330
  authoredBy: {
314
331
  kind: "operator";
@@ -326,8 +343,9 @@ export interface ChatTextPart {
326
343
  id: string;
327
344
  chatID: string;
328
345
  messageID: string;
346
+ /** Empty in a message Superclerk wrote for the agent (source trigger or runtime): those words are never sent. */
329
347
  text: string;
330
- /** Written by Superclerk rather than the person or the agent. */
348
+ /** Always false: text Superclerk writes for the agent alone is never sent. Kept for older clients. */
331
349
  synthetic: boolean;
332
350
  startedAt: string | null;
333
351
  endedAt: string | null;
@@ -383,6 +401,8 @@ export type ChatToolState = {
383
401
  label: string;
384
402
  value: string;
385
403
  }> | null;
404
+ /** What approving does, in the words of its button, for a card that does one thing. */
405
+ button: string | null;
386
406
  metadata: {
387
407
  [key: string]: unknown;
388
408
  } | null;
@@ -443,13 +463,15 @@ export interface ChatSubtaskPart {
443
463
  description: string;
444
464
  agent: string;
445
465
  }
446
- /** Where the agent summarized the chat so far to make room. */
466
+ /** Where the agent summarized the chat so far to make room. It marks a message Superclerk wrote, and the summary is the assistant message that answers it. */
447
467
  export interface ChatCompactionPart {
448
468
  type: "compaction";
449
469
  id: string;
450
470
  chatID: string;
451
471
  messageID: string;
452
472
  auto: boolean;
473
+ /** The message whose turn an automatic summary belongs to: the one the agent was answering when the chat grew too long. Null for a summary someone asked for. */
474
+ continues: string | null;
453
475
  }
454
476
  export type ChatStreamEvent = {
455
477
  event: "chat";
@@ -523,6 +545,8 @@ export interface Conversation {
523
545
  };
524
546
  contactID: string | null;
525
547
  contactName: string | null;
548
+ /** The domain of the email address the conversation reaches the customer at, such as acme.com; null where it doesn't reach them by email. */
549
+ contactDomain: string | null;
526
550
  contactLink: "automatic" | "manual" | "none";
527
551
  /** False for a group or shared thread, which can't belong to one contact. */
528
552
  linkable: boolean;
@@ -1473,6 +1497,7 @@ export interface WorkflowCatalogResponse {
1473
1497
  attemptTimeoutMs: number;
1474
1498
  totalTimeoutMs: number;
1475
1499
  };
1500
+ recipientInput: string | null;
1476
1501
  }>;
1477
1502
  retainedActions: Array<{
1478
1503
  appID: string;
@@ -1514,6 +1539,7 @@ export interface WorkflowCatalogResponse {
1514
1539
  attemptTimeoutMs: number;
1515
1540
  totalTimeoutMs: number;
1516
1541
  };
1542
+ recipientInput: string | null;
1517
1543
  }>;
1518
1544
  triggers: Array<WorkflowTriggerCatalogEntry>;
1519
1545
  retainedTriggers: Array<WorkflowTriggerCatalogEntry>;
@@ -4172,11 +4198,11 @@ export type WorkflowFailureAlertDestination = {
4172
4198
  } | {
4173
4199
  state: "failed";
4174
4200
  terminalAt: number;
4175
- errorKind: "validation" | "permission" | "auth" | "quota_exhausted" | "provider_rejected" | "rate_limited" | "retryable_upstream" | "outcome_unknown" | "result_unavailable" | "upstream" | "timeout" | "internal" | "cancelled";
4201
+ errorKind: "validation" | "permission" | "auth" | "quota_exhausted" | "provider_rejected" | "rate_limited" | "retryable_upstream" | "outcome_unknown" | "result_unavailable" | "upstream" | "timeout" | "internal" | "cancelled" | "sender_restricted" | "recipient_refused";
4176
4202
  } | {
4177
4203
  state: "outcome_unknown";
4178
4204
  terminalAt: number;
4179
- errorKind: "validation" | "permission" | "auth" | "quota_exhausted" | "provider_rejected" | "rate_limited" | "retryable_upstream" | "outcome_unknown" | "result_unavailable" | "upstream" | "timeout" | "internal" | "cancelled";
4205
+ errorKind: "validation" | "permission" | "auth" | "quota_exhausted" | "provider_rejected" | "rate_limited" | "retryable_upstream" | "outcome_unknown" | "result_unavailable" | "upstream" | "timeout" | "internal" | "cancelled" | "sender_restricted" | "recipient_refused";
4180
4206
  } | null;
4181
4207
  provider: "slack";
4182
4208
  channelID: string;
@@ -4196,11 +4222,11 @@ export type WorkflowFailureAlertDestination = {
4196
4222
  } | {
4197
4223
  state: "failed";
4198
4224
  terminalAt: number;
4199
- errorKind: "validation" | "permission" | "auth" | "quota_exhausted" | "provider_rejected" | "rate_limited" | "retryable_upstream" | "outcome_unknown" | "result_unavailable" | "upstream" | "timeout" | "internal" | "cancelled";
4225
+ errorKind: "validation" | "permission" | "auth" | "quota_exhausted" | "provider_rejected" | "rate_limited" | "retryable_upstream" | "outcome_unknown" | "result_unavailable" | "upstream" | "timeout" | "internal" | "cancelled" | "sender_restricted" | "recipient_refused";
4200
4226
  } | {
4201
4227
  state: "outcome_unknown";
4202
4228
  terminalAt: number;
4203
- errorKind: "validation" | "permission" | "auth" | "quota_exhausted" | "provider_rejected" | "rate_limited" | "retryable_upstream" | "outcome_unknown" | "result_unavailable" | "upstream" | "timeout" | "internal" | "cancelled";
4229
+ errorKind: "validation" | "permission" | "auth" | "quota_exhausted" | "provider_rejected" | "rate_limited" | "retryable_upstream" | "outcome_unknown" | "result_unavailable" | "upstream" | "timeout" | "internal" | "cancelled" | "sender_restricted" | "recipient_refused";
4204
4230
  } | null;
4205
4231
  provider: "telegram";
4206
4232
  chatID: string;
@@ -4220,11 +4246,11 @@ export type WorkflowFailureAlertDestination = {
4220
4246
  } | {
4221
4247
  state: "failed";
4222
4248
  terminalAt: number;
4223
- errorKind: "validation" | "permission" | "auth" | "quota_exhausted" | "provider_rejected" | "rate_limited" | "retryable_upstream" | "outcome_unknown" | "result_unavailable" | "upstream" | "timeout" | "internal" | "cancelled";
4249
+ errorKind: "validation" | "permission" | "auth" | "quota_exhausted" | "provider_rejected" | "rate_limited" | "retryable_upstream" | "outcome_unknown" | "result_unavailable" | "upstream" | "timeout" | "internal" | "cancelled" | "sender_restricted" | "recipient_refused";
4224
4250
  } | {
4225
4251
  state: "outcome_unknown";
4226
4252
  terminalAt: number;
4227
- errorKind: "validation" | "permission" | "auth" | "quota_exhausted" | "provider_rejected" | "rate_limited" | "retryable_upstream" | "outcome_unknown" | "result_unavailable" | "upstream" | "timeout" | "internal" | "cancelled";
4253
+ errorKind: "validation" | "permission" | "auth" | "quota_exhausted" | "provider_rejected" | "rate_limited" | "retryable_upstream" | "outcome_unknown" | "result_unavailable" | "upstream" | "timeout" | "internal" | "cancelled" | "sender_restricted" | "recipient_refused";
4228
4254
  } | null;
4229
4255
  provider: "gmail";
4230
4256
  recipient: string;
@@ -4244,11 +4270,11 @@ export type WorkflowFailureAlertDestination = {
4244
4270
  } | {
4245
4271
  state: "failed";
4246
4272
  terminalAt: number;
4247
- errorKind: "validation" | "permission" | "auth" | "quota_exhausted" | "provider_rejected" | "rate_limited" | "retryable_upstream" | "outcome_unknown" | "result_unavailable" | "upstream" | "timeout" | "internal" | "cancelled";
4273
+ errorKind: "validation" | "permission" | "auth" | "quota_exhausted" | "provider_rejected" | "rate_limited" | "retryable_upstream" | "outcome_unknown" | "result_unavailable" | "upstream" | "timeout" | "internal" | "cancelled" | "sender_restricted" | "recipient_refused";
4248
4274
  } | {
4249
4275
  state: "outcome_unknown";
4250
4276
  terminalAt: number;
4251
- errorKind: "validation" | "permission" | "auth" | "quota_exhausted" | "provider_rejected" | "rate_limited" | "retryable_upstream" | "outcome_unknown" | "result_unavailable" | "upstream" | "timeout" | "internal" | "cancelled";
4277
+ errorKind: "validation" | "permission" | "auth" | "quota_exhausted" | "provider_rejected" | "rate_limited" | "retryable_upstream" | "outcome_unknown" | "result_unavailable" | "upstream" | "timeout" | "internal" | "cancelled" | "sender_restricted" | "recipient_refused";
4252
4278
  } | null;
4253
4279
  provider: "outlook";
4254
4280
  recipient: string;
@@ -5848,7 +5874,7 @@ export interface ToolRunFailedEvent {
5848
5874
  connectionID: string | null;
5849
5875
  status: "failed" | "cancelled";
5850
5876
  error: {
5851
- kind: "validation" | "permission" | "auth" | "quota_exhausted" | "provider_rejected" | "rate_limited" | "retryable_upstream" | "outcome_unknown" | "result_unavailable" | "upstream" | "timeout" | "internal" | "cancelled";
5877
+ kind: "validation" | "permission" | "auth" | "quota_exhausted" | "provider_rejected" | "rate_limited" | "retryable_upstream" | "outcome_unknown" | "result_unavailable" | "upstream" | "timeout" | "internal" | "cancelled" | "sender_restricted" | "recipient_refused";
5852
5878
  };
5853
5879
  };
5854
5880
  }
@@ -6343,6 +6369,7 @@ export type SocialAccountsAnalyticsOverviewResponse = {
6343
6369
  value: number | null;
6344
6370
  }>;
6345
6371
  }>;
6372
+ missingScopes?: Array<string>;
6346
6373
  status: "ready";
6347
6374
  retrievedAt: number;
6348
6375
  };
@@ -6423,6 +6450,10 @@ export interface SocialMediaListParams {
6423
6450
  limit?: number;
6424
6451
  cursor?: string;
6425
6452
  search?: string;
6453
+ /** true: only media AI made; false: only people's. */
6454
+ aiGenerated?: "true" | "false";
6455
+ /** true: only media a post published; false: only media none did. */
6456
+ posted?: "true" | "false";
6426
6457
  }
6427
6458
  export type SocialMediaListResponse = {
6428
6459
  items: Array<{
@@ -6434,9 +6465,19 @@ export type SocialMediaListResponse = {
6434
6465
  storageAccess: "private" | "public";
6435
6466
  status: "pending" | "ready";
6436
6467
  url: string | null;
6468
+ /** Whether AI made it: an agent's image or video, or a photo an agent edited. */
6469
+ aiGenerated: boolean;
6437
6470
  createdAt: number;
6438
6471
  updatedAt: number;
6439
6472
  confirmedAt: number | null;
6473
+ post: {
6474
+ postID: string;
6475
+ status: "posted" | "scheduled" | "draft" | "failed";
6476
+ /** Where that post goes. */
6477
+ platforms: Array<"x" | "instagram" | "facebook" | "linkedin" | "threads" | "tiktok" | "youtube" | "googlebusiness">;
6478
+ /** When it went out, goes out or failed; null for a draft. */
6479
+ at: string | null;
6480
+ } | null;
6440
6481
  }>;
6441
6482
  nextCursor: string | null;
6442
6483
  };
@@ -6463,6 +6504,8 @@ export type SocialMediaCreateResponse = {
6463
6504
  storageAccess: "private" | "public";
6464
6505
  status: "pending" | "ready";
6465
6506
  url: string | null;
6507
+ /** Whether AI made it: an agent's image or video, or a photo an agent edited. */
6508
+ aiGenerated: boolean;
6466
6509
  createdAt: number;
6467
6510
  updatedAt: number;
6468
6511
  confirmedAt: number | null;
@@ -6485,6 +6528,8 @@ export type SocialMediaConfirmResponse = {
6485
6528
  storageAccess: "private" | "public";
6486
6529
  status: "pending" | "ready";
6487
6530
  url: string | null;
6531
+ /** Whether AI made it: an agent's image or video, or a photo an agent edited. */
6532
+ aiGenerated: boolean;
6488
6533
  createdAt: number;
6489
6534
  updatedAt: number;
6490
6535
  confirmedAt: number | null;
@@ -6502,10 +6547,16 @@ export type SocialMediaGetResponse = {
6502
6547
  storageAccess: "private" | "public";
6503
6548
  status: "pending" | "ready";
6504
6549
  url: string | null;
6550
+ /** Whether AI made it: an agent's image or video, or a photo an agent edited. */
6551
+ aiGenerated: boolean;
6505
6552
  createdAt: number;
6506
6553
  updatedAt: number;
6507
6554
  confirmedAt: number | null;
6508
6555
  };
6556
+ export type SocialMediaDeleteResponse = {
6557
+ id: string;
6558
+ deleted: true;
6559
+ };
6509
6560
  export interface SocialPostsListParams {
6510
6561
  limit?: number;
6511
6562
  cursor?: string;
@@ -6531,6 +6582,8 @@ export type SocialPostsListResponse = {
6531
6582
  storageAccess: "private" | "public";
6532
6583
  status: "pending" | "ready";
6533
6584
  url: string | null;
6585
+ /** Whether AI made it: an agent's image or video, or a photo an agent edited. */
6586
+ aiGenerated: boolean;
6534
6587
  createdAt: number;
6535
6588
  updatedAt: number;
6536
6589
  confirmedAt: number | null;
@@ -6561,6 +6614,8 @@ export type SocialPostsListResponse = {
6561
6614
  storageAccess: "private" | "public";
6562
6615
  status: "pending" | "ready";
6563
6616
  url: string | null;
6617
+ /** Whether AI made it: an agent's image or video, or a photo an agent edited. */
6618
+ aiGenerated: boolean;
6564
6619
  createdAt: number;
6565
6620
  updatedAt: number;
6566
6621
  confirmedAt: number | null;
@@ -7320,6 +7375,8 @@ export type SocialPostsCreateResponse = {
7320
7375
  storageAccess: "private" | "public";
7321
7376
  status: "pending" | "ready";
7322
7377
  url: string | null;
7378
+ /** Whether AI made it: an agent's image or video, or a photo an agent edited. */
7379
+ aiGenerated: boolean;
7323
7380
  createdAt: number;
7324
7381
  updatedAt: number;
7325
7382
  confirmedAt: number | null;
@@ -7350,6 +7407,8 @@ export type SocialPostsCreateResponse = {
7350
7407
  storageAccess: "private" | "public";
7351
7408
  status: "pending" | "ready";
7352
7409
  url: string | null;
7410
+ /** Whether AI made it: an agent's image or video, or a photo an agent edited. */
7411
+ aiGenerated: boolean;
7353
7412
  createdAt: number;
7354
7413
  updatedAt: number;
7355
7414
  confirmedAt: number | null;
@@ -7385,6 +7444,8 @@ export type SocialPostsGetResponse = {
7385
7444
  storageAccess: "private" | "public";
7386
7445
  status: "pending" | "ready";
7387
7446
  url: string | null;
7447
+ /** Whether AI made it: an agent's image or video, or a photo an agent edited. */
7448
+ aiGenerated: boolean;
7388
7449
  createdAt: number;
7389
7450
  updatedAt: number;
7390
7451
  confirmedAt: number | null;
@@ -7415,6 +7476,8 @@ export type SocialPostsGetResponse = {
7415
7476
  storageAccess: "private" | "public";
7416
7477
  status: "pending" | "ready";
7417
7478
  url: string | null;
7479
+ /** Whether AI made it: an agent's image or video, or a photo an agent edited. */
7480
+ aiGenerated: boolean;
7418
7481
  createdAt: number;
7419
7482
  updatedAt: number;
7420
7483
  confirmedAt: number | null;
@@ -8174,6 +8237,8 @@ export type SocialPostsUpdateResponse = {
8174
8237
  storageAccess: "private" | "public";
8175
8238
  status: "pending" | "ready";
8176
8239
  url: string | null;
8240
+ /** Whether AI made it: an agent's image or video, or a photo an agent edited. */
8241
+ aiGenerated: boolean;
8177
8242
  createdAt: number;
8178
8243
  updatedAt: number;
8179
8244
  confirmedAt: number | null;
@@ -8204,6 +8269,8 @@ export type SocialPostsUpdateResponse = {
8204
8269
  storageAccess: "private" | "public";
8205
8270
  status: "pending" | "ready";
8206
8271
  url: string | null;
8272
+ /** Whether AI made it: an agent's image or video, or a photo an agent edited. */
8273
+ aiGenerated: boolean;
8207
8274
  createdAt: number;
8208
8275
  updatedAt: number;
8209
8276
  confirmedAt: number | null;
@@ -8247,6 +8314,8 @@ export type SocialPostsRescheduleResponse = {
8247
8314
  storageAccess: "private" | "public";
8248
8315
  status: "pending" | "ready";
8249
8316
  url: string | null;
8317
+ /** Whether AI made it: an agent's image or video, or a photo an agent edited. */
8318
+ aiGenerated: boolean;
8250
8319
  createdAt: number;
8251
8320
  updatedAt: number;
8252
8321
  confirmedAt: number | null;
@@ -8277,6 +8346,8 @@ export type SocialPostsRescheduleResponse = {
8277
8346
  storageAccess: "private" | "public";
8278
8347
  status: "pending" | "ready";
8279
8348
  url: string | null;
8349
+ /** Whether AI made it: an agent's image or video, or a photo an agent edited. */
8350
+ aiGenerated: boolean;
8280
8351
  createdAt: number;
8281
8352
  updatedAt: number;
8282
8353
  confirmedAt: number | null;
@@ -8315,6 +8386,8 @@ export type SocialPostsCancelResponse = {
8315
8386
  storageAccess: "private" | "public";
8316
8387
  status: "pending" | "ready";
8317
8388
  url: string | null;
8389
+ /** Whether AI made it: an agent's image or video, or a photo an agent edited. */
8390
+ aiGenerated: boolean;
8318
8391
  createdAt: number;
8319
8392
  updatedAt: number;
8320
8393
  confirmedAt: number | null;
@@ -8345,6 +8418,8 @@ export type SocialPostsCancelResponse = {
8345
8418
  storageAccess: "private" | "public";
8346
8419
  status: "pending" | "ready";
8347
8420
  url: string | null;
8421
+ /** Whether AI made it: an agent's image or video, or a photo an agent edited. */
8422
+ aiGenerated: boolean;
8348
8423
  createdAt: number;
8349
8424
  updatedAt: number;
8350
8425
  confirmedAt: number | null;
@@ -1,4 +1,4 @@
1
- export declare const SDK_VERSION = "0.3.0";
1
+ export declare const SDK_VERSION = "0.5.0";
2
2
  /** The API behavior this SDK was generated for. Every request pins it with the Superclerk-Version header. */
3
3
  export declare const API_VERSION = "2026-11-05";
4
4
  export declare const DEFAULT_BASE_URL = "https://api.superclerk.com";
@@ -1,5 +1,5 @@
1
1
  // Generated by script/generate.ts from the public OpenAPI document. Do not edit.
2
- export const SDK_VERSION = "0.3.0";
2
+ export const SDK_VERSION = "0.5.0";
3
3
  /** The API behavior this SDK was generated for. Every request pins it with the Superclerk-Version header. */
4
4
  export const API_VERSION = "2026-11-05";
5
5
  export const DEFAULT_BASE_URL = "https://api.superclerk.com";
@@ -1,12 +1,28 @@
1
1
  import { type RequestOptions } from "../core/client.js";
2
- import { ConnectionsBase } from "../generated/resources.js";
2
+ import { ConnectionsBase, ConnectionsTools as ConnectionsToolsBase } from "../generated/resources.js";
3
3
  export interface ProxyInit extends RequestOptions {
4
4
  /** GET, POST or DELETE, as the app's `proxy.methods` allows. Defaults to GET. */
5
5
  method?: "GET" | "POST" | "DELETE";
6
6
  /** A JSON value, or a string, Blob, FormData or URLSearchParams sent as it is. */
7
7
  body?: unknown;
8
8
  }
9
+ export declare class ConnectionsTools extends ConnectionsToolsBase {
10
+ #private;
11
+ /**
12
+ * Runs one of the connection's tools by its name and answers its output, waiting while the run goes on: for a tool
13
+ * `tools.run` can't type, such as a connected MCP server's, whose output is the server's. A run that ends failed or
14
+ * cancelled throws ToolRunError, whose `code` is the run's `error.kind`; a request the API refuses before any run
15
+ * starts throws APIError. Retries reuse one Idempotency-Key, so the tool runs once.
16
+ */
17
+ run(connectionID: string, { tool, input }: {
18
+ tool: string;
19
+ input: Record<string, unknown>;
20
+ }, options?: RequestOptions): Promise<string | number | boolean | unknown[] | {
21
+ [key: string]: unknown;
22
+ } | null>;
23
+ }
9
24
  export declare class Connections extends ConnectionsBase {
25
+ readonly tools: ConnectionsTools;
10
26
  /**
11
27
  * Calls the provider's own API through a connection, with its credentials added on the server, and answers the
12
28
  * provider's response whatever its status. `path` is the provider's path and query, sent as written, such as
@@ -1,7 +1,21 @@
1
1
  import { pathParam } from "../core/client.js";
2
2
  import { holding, isPending, settle } from "../core/timing.js";
3
- import { ConnectionsBase } from "../generated/resources.js";
3
+ import { ConnectionsBase, ConnectionsTools as ConnectionsToolsBase } from "../generated/resources.js";
4
+ import { runTool, ToolsRuns } from "./tools.js";
5
+ export class ConnectionsTools extends ConnectionsToolsBase {
6
+ #runs = new ToolsRuns(this._client);
7
+ /**
8
+ * Runs one of the connection's tools by its name and answers its output, waiting while the run goes on: for a tool
9
+ * `tools.run` can't type, such as a connected MCP server's, whose output is the server's. A run that ends failed or
10
+ * cancelled throws ToolRunError, whose `code` is the run's `error.kind`; a request the API refuses before any run
11
+ * starts throws APIError. Retries reuse one Idempotency-Key, so the tool runs once.
12
+ */
13
+ run(connectionID, { tool, input }, options = {}) {
14
+ return runTool(this._client, this.#runs, { connectionID, toolID: tool, input }, options);
15
+ }
16
+ }
4
17
  export class Connections extends ConnectionsBase {
18
+ tools = new ConnectionsTools(this._client);
5
19
  /**
6
20
  * Calls the provider's own API through a connection, with its credentials added on the server, and answers the
7
21
  * provider's response whatever its status. `path` is the provider's path and query, sent as written, such as
package/lib/social.d.ts CHANGED
@@ -22,6 +22,7 @@ export declare class SocialMedia extends SocialMediaBase {
22
22
  storageAccess: "private" | "public";
23
23
  status: "pending" | "ready";
24
24
  url: string | null;
25
+ aiGenerated: boolean;
25
26
  createdAt: number;
26
27
  updatedAt: number;
27
28
  confirmedAt: number | null;
package/lib/tools.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import type { RequestOptions } from "../core/client.js";
1
+ import type { Core, RequestOptions } from "../core/client.js";
2
2
  import { ToolsBase, ToolsRuns as ToolsRunsBase } from "../generated/resources.js";
3
3
  import type { ToolID, Tools as ToolTypes } from "../generated/tools.js";
4
- import type { ToolsRunsGetResponse } from "../generated/types.js";
4
+ import type { ToolsRunsCreateParams, ToolsRunsGetResponse } from "../generated/types.js";
5
5
  /** The tool to run, its input, and the connection or built-in app that runs it. */
6
6
  export type ToolRunParams<Tool extends ToolID> = {
7
7
  tool: Tool;
@@ -21,6 +21,9 @@ export declare class ToolsRuns extends ToolsRunsBase {
21
21
  /** Reads a run until it ends and answers it. Aborting the signal stops the waiting, not the run. */
22
22
  wait(runID: string, options?: RequestOptions): Promise<SettledToolRun>;
23
23
  }
24
+ export declare function runTool(client: Core, runs: ToolsRuns, params: ToolsRunsCreateParams, options: RequestOptions): Promise<string | number | boolean | unknown[] | {
25
+ [key: string]: unknown;
26
+ } | null>;
24
27
  export declare class Tools extends ToolsBase {
25
28
  readonly runs: ToolsRuns;
26
29
  /**
package/lib/tools.js CHANGED
@@ -7,6 +7,18 @@ export class ToolsRuns extends ToolsRunsBase {
7
7
  return settle(this._client, (held) => this.get(runID, held), options);
8
8
  }
9
9
  }
10
+ // What tools.run and connections.tools.run share: start the run, wait while it goes on, answer its output or throw.
11
+ export async function runTool(client, runs, params, options) {
12
+ const created = await runs.create(params, holding(client, options)).catch((error) => {
13
+ // A run that ended at submission answers with the run itself as its body, not the API's `{ error }`.
14
+ const run = error instanceof APIError ? error.body : undefined;
15
+ throw run?.status === "failed" || run?.status === "cancelled" ? new ToolRunError(run) : error;
16
+ });
17
+ const finished = created.status === "running" ? await runs.wait(created.id, options) : created;
18
+ if (finished.status !== "completed")
19
+ throw new ToolRunError(finished);
20
+ return finished.output;
21
+ }
10
22
  export class Tools extends ToolsBase {
11
23
  runs = new ToolsRuns(this._client);
12
24
  /**
@@ -16,16 +28,7 @@ export class Tools extends ToolsBase {
16
28
  * once.
17
29
  */
18
30
  async run({ tool, ...params }, options = {}) {
19
- const created = await this.runs
20
- .create({ toolID: tool, ...params }, holding(this._client, options))
21
- .catch((error) => {
22
- // A run that ended at submission answers with the run itself as its body, not the API's `{ error }`.
23
- const run = error instanceof APIError ? error.body : undefined;
24
- throw run?.status === "failed" || run?.status === "cancelled" ? new ToolRunError(run) : error;
25
- });
26
- const finished = created.status === "running" ? await this.runs.wait(created.id, options) : created;
27
- if (finished.status !== "completed")
28
- throw new ToolRunError(finished);
29
- return finished.output;
31
+ const output = await runTool(this._client, this.runs, { toolID: tool, ...params }, options);
32
+ return output;
30
33
  }
31
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superclerk/sdk",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "The official TypeScript SDK for the Superclerk API",
5
5
  "type": "module",
6
6
  "license": "MIT",