@superclerk/sdk 0.2.0 → 0.4.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,40 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ ## 0.4.0 (2026-11-25)
6
+
7
+ Still pinned to API version `2026-11-05`.
8
+
9
+ - `apiKey: null` sends no key, for a team app Superclerk hosts: its pages call their own address,
10
+ `${location.origin}/_superclerk`, as the `baseURL`, which acts as the teammate signed in to the app.
11
+ - Google Business Profile: `business_profile_update_chat_links` sets or removes the WhatsApp and text links behind a
12
+ location's Message button on Google Maps, and `business_profile_get_attributes` reads what the business set.
13
+ `business_profile_fetch_performance_metrics` takes `MESSAGING_CLICKS`, the taps on that button, and drops
14
+ `BUSINESS_CONVERSATIONS` and `BUSINESS_FOOD_ORDERS`, which Google retired.
15
+ - Conversations answer `contactDomain`: the domain of the email address a conversation reaches its customer at, such
16
+ as `acme.com`, or null where it doesn't reach them by email or where it is a free mailbox such as gmail.com.
17
+ - A chat's approval card answers `button`: what approving does, in the words of its button, such as
18
+ `Start cold email`, or null where the card doesn't say. A trigger's prompt is a `synthetic` message, as Superclerk's
19
+ words to the agent rather than the person's.
20
+ - A chat's user message answers `source`: who wrote it, the chat's `member`, their `team`, an `outsider`, the `agent`
21
+ that gave a subagent its task, a `trigger` the member set up (its prompt), or Superclerk itself (`runtime`).
22
+ Superclerk's words to the agent are never sent: a `trigger` or `runtime` message's text parts come with empty
23
+ `text`, text written for the model alone is left out, and a reply the agent chose to withhold comes with no text.
24
+ `synthetic` stays, true exactly for `trigger` and `runtime`, and is removed in a later version.
25
+
26
+ ## 0.3.0 (2026-11-17)
27
+
28
+ Still pinned to API version `2026-11-05`.
29
+
30
+ - The PlusVibe tools follow PlusVibe's current API. Lists page by cursor: `plusvibe_list_campaigns`,
31
+ `plusvibe_list_leads`, `plusvibe_search_lead` and `plusvibe_list_emails` take `startingAfter` and answer
32
+ `nextStartingAfter` while more remain. `skip`, `page`, `sort`, `direction` and `pageTrail` are gone.
33
+ - `plusvibe_save_reply_draft` takes `threadId` in place of `parentMessageId`.
34
+ - `plusvibe_get_email_account_stats` covers the whole workspace: `endDate` is required and `emailAccountId` is gone.
35
+ - `plusvibe_list_campaigns`' `campaignType` is `all`, `parent` or `subseq`, and `plusvibe_list_leads`' `status` adds
36
+ `PAUSED` and drops `PENDING` and `RESCHEDULED`.
37
+
3
38
  ## 0.2.0 (2026-11-12)
4
39
 
5
40
  Still pinned to API version `2026-11-05`.
package/README.md CHANGED
@@ -149,6 +149,21 @@ await superclerk.contacts.list({}, { workspace: "org_client" })
149
149
  An operation takes a client workspace only when its reference names the `Superclerk-Workspace` header. The rest act in
150
150
  the key's own workspace alone, and answer `403 workspace_not_supported` when a request names another.
151
151
 
152
+ ## Team apps Superclerk hosts
153
+
154
+ A team app's pages call the API in the browser through their own address, with no key: Superclerk signs in the
155
+ teammate using the app, and each call acts as them, with their own role.
156
+
157
+ ```ts
158
+ import { Superclerk } from "@superclerk/sdk"
159
+
160
+ const superclerk = new Superclerk({ apiKey: null, baseURL: `${location.origin}/_superclerk` })
161
+ const { items } = await superclerk.contacts.list({ limit: 20 })
162
+ ```
163
+
164
+ It reaches what Superclerk's own pages use, such as contacts, deals, tasks, conversations and the Inbox. Operations
165
+ that take only an API key, such as running a connection's tools, answer `403 not_available_to_team_apps`.
166
+
152
167
  ## Errors
153
168
 
154
169
  Everything the SDK throws is a `SuperclerkError`, apart from the reason you abort a call with. Branch on its `code`,
package/api.md CHANGED
@@ -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);
@@ -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
  /**
@@ -551,7 +559,7 @@ export declare class ConversationsMessages extends APIResource {
551
559
  /**
552
560
  * Reply as staff
553
561
  *
554
- * Queues the text for the customer at most once per idempotency key, and answers the message with status sending; list the messages to see it sent, or not_sent with why. The conversation is held for a person for ten minutes from the reply, an AI turn in flight stops, and the customer's earlier messages count as answered. inReplyTo quotes a message the customer sent.
562
+ * Queues the text for the customer at most once per idempotency key, and answers the message with status sending; list the messages to see it sent, or not_sent with why. The AI stays out for ten minutes from the reply, or until someone hands the conversation back if a person already held it, an AI turn in flight stops, and the customer's earlier messages count as answered. inReplyTo quotes a message the customer sent.
555
563
  *
556
564
  * `POST /v1/conversations/{conversationID}/messages`
557
565
  */
@@ -586,7 +594,7 @@ export declare class Conversations extends APIResource {
586
594
  /**
587
595
  * Take a conversation over from the AI
588
596
  *
589
- * A person holds the conversation for ten minutes; one already held until someone hands it back stays held.
597
+ * A person holds the conversation until someone hands it back.
590
598
  *
591
599
  * Formerly `POST /v1/conversations/{conversationID}/take-over`, which still answers, marked deprecated.
592
600
  *
@@ -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
  /**
@@ -794,7 +809,7 @@ export class ConversationsMessages extends APIResource {
794
809
  /**
795
810
  * Reply as staff
796
811
  *
797
- * Queues the text for the customer at most once per idempotency key, and answers the message with status sending; list the messages to see it sent, or not_sent with why. The conversation is held for a person for ten minutes from the reply, an AI turn in flight stops, and the customer's earlier messages count as answered. inReplyTo quotes a message the customer sent.
812
+ * Queues the text for the customer at most once per idempotency key, and answers the message with status sending; list the messages to see it sent, or not_sent with why. The AI stays out for ten minutes from the reply, or until someone hands the conversation back if a person already held it, an AI turn in flight stops, and the customer's earlier messages count as answered. inReplyTo quotes a message the customer sent.
798
813
  *
799
814
  * `POST /v1/conversations/{conversationID}/messages`
800
815
  */
@@ -849,7 +864,7 @@ export class Conversations extends APIResource {
849
864
  /**
850
865
  * Take a conversation over from the AI
851
866
  *
852
- * A person holds the conversation for ten minutes; one already held until someone hands it back stays held.
867
+ * A person holds the conversation until someone hands it back.
853
868
  *
854
869
  * Formerly `POST /v1/conversations/{conversationID}/take-over`, which still answers, marked deprecated.
855
870
  *