@superclerk/sdk 0.1.1 → 0.2.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 +26 -0
- package/api.md +32 -4
- package/core/client.js +11 -0
- package/generated/client.d.ts +3 -1
- package/generated/client.js +3 -1
- package/generated/resources.d.ts +134 -16
- package/generated/resources.js +203 -18
- package/generated/tools.d.ts +3977 -210
- package/generated/types.d.ts +1042 -101
- package/generated/version.d.ts +1 -1
- package/generated/version.js +1 -1
- package/generated/webhooks.d.ts +2 -2
- package/lib/chats.d.ts +79 -0
- package/lib/chats.js +122 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.0 (2026-11-12)
|
|
4
|
+
|
|
5
|
+
Still pinned to API version `2026-11-05`.
|
|
6
|
+
|
|
7
|
+
- `chats`: talk to your workspace's agents as the app's chat does. `chats.create` starts a chat with an agent,
|
|
8
|
+
`chats.messages.create` sends a message at most once per idempotency key, and `chats.get` with `Prefer: wait` waits
|
|
9
|
+
for the answer. `chats.approvals.decide`, `chats.questions.answer` and `chats.questions.dismiss` settle what a chat's
|
|
10
|
+
`pending` lists, `chats.files.get` reads a file the chat holds, and `chats.stop` stops the agent.
|
|
11
|
+
- `chats.send()` sends a message and waits until the agent stops working on the chat. It answers the chat and the
|
|
12
|
+
agent's replies.
|
|
13
|
+
- `chats.stream()` follows a chat's events. After a dropped connection, 30 s of silence or an API that can't answer
|
|
14
|
+
yet, it reconnects after the last event it received, and waits longer, at random, as failures repeat. A part the
|
|
15
|
+
agent is still writing comes first without an `id`, holding its text so far.
|
|
16
|
+
- The client sends back the cookies the API sets, so a chat's stream reaches the server running the agent's turn and
|
|
17
|
+
gets its text as it's written.
|
|
18
|
+
- `agents.list()` answers `AgentList`: every agent in the workspace, with its `mode`, `instructions`, `model`, `tools`
|
|
19
|
+
and other settings. It answered `WorkflowAgentsResponse`. `agents.get()` reads one agent.
|
|
20
|
+
- `WebhookEvent` includes `chat.waiting` and `chat.idle`.
|
|
21
|
+
- Typed tools for 15 more apps: Acuity Scheduling, Airtable, Calendly, Google Contacts, Google Forms, Google Tasks,
|
|
22
|
+
Jotform, Kajabi, Kit, Pipedrive, Salesforce, Square, TikTok Lead Forms, Typeform and Zoom. YouTube adds
|
|
23
|
+
`youtube_list_uploads`, `youtube_list_videos` and `youtube_upload_video`, and `instagram_publish_reel` takes
|
|
24
|
+
`trialGraduation`.
|
|
25
|
+
- `meta_ads_list_promotable_pages` takes only `accountId` and lists every Page the sign-in can run ads from; `limit`
|
|
26
|
+
and `after` are gone.
|
|
27
|
+
- A request a key's scopes don't allow throws `insufficient_scope`, which replaces `permission_required`.
|
|
28
|
+
|
|
3
29
|
## 0.1.1 (2026-11-07)
|
|
4
30
|
|
|
5
31
|
- The README installs the SDK with npm, pnpm, Yarn or Bun.
|
package/api.md
CHANGED
|
@@ -104,6 +104,33 @@ Generated from the public OpenAPI document. Every method returns an `APIPromise`
|
|
|
104
104
|
- `client.social.posts.reschedule(postID, params)` → `SocialPostsRescheduleResponse` — `POST /v1/social/posts/{postID}/reschedule`
|
|
105
105
|
- `client.social.posts.cancel(postID, params)` → `SocialPostsCancelResponse` — `POST /v1/social/posts/{postID}/cancel`
|
|
106
106
|
|
|
107
|
+
## chats
|
|
108
|
+
|
|
109
|
+
- `client.chats.list(params?)` → `ChatsListResponse (paged)` — `GET /v1/chats`
|
|
110
|
+
- `client.chats.create(params)` → `Chat` — `POST /v1/chats`
|
|
111
|
+
- `client.chats.get(chatID)` → `Chat` — `GET /v1/chats/{chatID}`
|
|
112
|
+
- `client.chats.events(chatID, params?)` → `Response` — `GET /v1/chats/{chatID}/events`
|
|
113
|
+
- `client.chats.stop(chatID)` → `Chat` — `POST /v1/chats/{chatID}/stop`
|
|
114
|
+
|
|
115
|
+
### chats.messages
|
|
116
|
+
|
|
117
|
+
- `client.chats.messages.list(chatID, params?)` → `ChatsMessagesListResponse (paged)` — `GET /v1/chats/{chatID}/messages`
|
|
118
|
+
- `client.chats.messages.create(chatID, params)` → `ChatMessage` — `POST /v1/chats/{chatID}/messages`
|
|
119
|
+
- `client.chats.messages.get(messageID, params)` → `ChatMessage` — `GET /v1/chats/{chatID}/messages/{messageID}`
|
|
120
|
+
|
|
121
|
+
### chats.approvals
|
|
122
|
+
|
|
123
|
+
- `client.chats.approvals.decide(approvalID, params)` → `Chat` — `POST /v1/chats/{chatID}/approvals/{approvalID}/decide`
|
|
124
|
+
|
|
125
|
+
### chats.questions
|
|
126
|
+
|
|
127
|
+
- `client.chats.questions.answer(questionID, params)` → `Chat` — `POST /v1/chats/{chatID}/questions/{questionID}/answer`
|
|
128
|
+
- `client.chats.questions.dismiss(questionID, params)` → `Chat` — `POST /v1/chats/{chatID}/questions/{questionID}/dismiss`
|
|
129
|
+
|
|
130
|
+
### chats.files
|
|
131
|
+
|
|
132
|
+
- `client.chats.files.get(fileID, params)` → `ChatFile` — `GET /v1/chats/{chatID}/files/{fileID}`
|
|
133
|
+
|
|
107
134
|
## conversations
|
|
108
135
|
|
|
109
136
|
- `client.conversations.list(params?)` → `ConversationsListResponse (paged)` — `GET /v1/conversations`
|
|
@@ -234,6 +261,11 @@ Generated from the public OpenAPI document. Every method returns an `APIPromise`
|
|
|
234
261
|
|
|
235
262
|
- `client.inbox.agents.republish(agentID)` → `InboxAgentUpdate` — `POST /v1/inbox/agents/{agentID}/republish`
|
|
236
263
|
|
|
264
|
+
## agents
|
|
265
|
+
|
|
266
|
+
- `client.agents.list()` → `AgentList` — `GET /v1/agents`
|
|
267
|
+
- `client.agents.get(agentID)` → `Agent` — `GET /v1/agents/{agentID}`
|
|
268
|
+
|
|
237
269
|
## workflows
|
|
238
270
|
|
|
239
271
|
- `client.workflows.list(params?)` → `WorkflowsListResponse` — `GET /v1/workflows`
|
|
@@ -301,10 +333,6 @@ Generated from the public OpenAPI document. Every method returns an `APIPromise`
|
|
|
301
333
|
- `client.workflows.versions.get(workflowVersionID, params)` → `WorkflowVersionSnapshot` — `GET /v1/workflows/{workflowID}/versions/{workflowVersionID}`
|
|
302
334
|
- `client.workflows.versions.activate(workflowVersionID, params)` → `WorkflowsVersionsActivateResponse` — `POST /v1/workflows/{workflowID}/versions/{workflowVersionID}/activate`
|
|
303
335
|
|
|
304
|
-
## agents
|
|
305
|
-
|
|
306
|
-
- `client.agents.list()` → `WorkflowAgentsResponse` — `GET /v1/agents`
|
|
307
|
-
|
|
308
336
|
## receptionists
|
|
309
337
|
|
|
310
338
|
- `client.receptionists.list()` → `ReceptionistsListResponse` — `GET /v1/receptionists`
|
package/core/client.js
CHANGED
|
@@ -21,6 +21,9 @@ export class Core {
|
|
|
21
21
|
#userAgent = userAgent();
|
|
22
22
|
// SUPERCLERK_LOG=debug writes each attempt and retry to stderr, for you or the agent debugging an integration.
|
|
23
23
|
#debug = readEnv("SUPERCLERK_LOG") === "debug";
|
|
24
|
+
// The cookies the API sets, sent back as a browser would: its load balancer keeps a client on the server its cookie
|
|
25
|
+
// names, and only the server running a chat's turn streams the agent's text as it's written.
|
|
26
|
+
#cookies = new Map();
|
|
24
27
|
constructor(options = {}) {
|
|
25
28
|
const apiKey = options.apiKey ?? readEnv("SUPERCLERK_API_KEY");
|
|
26
29
|
if (!apiKey)
|
|
@@ -100,6 +103,12 @@ export class Core {
|
|
|
100
103
|
const startedAt = Date.now();
|
|
101
104
|
try {
|
|
102
105
|
const response = await this.#fetch(new Request(url, { ...init, signal }));
|
|
106
|
+
if (url.startsWith(this.baseURL)) {
|
|
107
|
+
for (const cookie of response.headers.getSetCookie()) {
|
|
108
|
+
const [name, ...value] = cookie.split(";", 1)[0].split("=");
|
|
109
|
+
this.#cookies.set(name.trim(), value.join("=").trim());
|
|
110
|
+
}
|
|
111
|
+
}
|
|
103
112
|
// An upload URL's storage answers too, without a Superclerk request ID.
|
|
104
113
|
const requestID = response.headers.get("x-superclerk-request-id");
|
|
105
114
|
this.log(`${init.method} ${host}${pathname} → ${response.status} in ${Date.now() - startedAt} ms${requestID ? ` (${requestID})` : ""}`);
|
|
@@ -133,6 +142,8 @@ export class Core {
|
|
|
133
142
|
headers.set("Superclerk-Workspace", workspace);
|
|
134
143
|
if (operation.idempotent)
|
|
135
144
|
headers.set("Idempotency-Key", options.idempotencyKey ?? crypto.randomUUID());
|
|
145
|
+
if (this.#cookies.size > 0)
|
|
146
|
+
headers.set("Cookie", Array.from(this.#cookies, ([name, value]) => `${name}=${value}`).join("; "));
|
|
136
147
|
for (const [name, value] of Object.entries(options.headers ?? {}))
|
|
137
148
|
headers.set(name, value);
|
|
138
149
|
return headers;
|
package/generated/client.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Core, type ClientOptions } from "../core/client.js";
|
|
2
|
+
import { Chats } from "../lib/chats.js";
|
|
2
3
|
import { Connect } from "../lib/connect.js";
|
|
3
4
|
import { Connections } from "../lib/connections.js";
|
|
4
5
|
import { Social } from "../lib/social.js";
|
|
@@ -14,6 +15,7 @@ export declare class Superclerk extends Core {
|
|
|
14
15
|
readonly apps: Apps;
|
|
15
16
|
readonly connections: Connections;
|
|
16
17
|
readonly social: Social;
|
|
18
|
+
readonly chats: Chats;
|
|
17
19
|
readonly conversations: Conversations;
|
|
18
20
|
readonly tags: Tags;
|
|
19
21
|
readonly contacts: Contacts;
|
|
@@ -23,8 +25,8 @@ export declare class Superclerk extends Core {
|
|
|
23
25
|
readonly opportunities: Opportunities;
|
|
24
26
|
readonly tasks: Tasks;
|
|
25
27
|
readonly inbox: Inbox;
|
|
26
|
-
readonly workflows: Workflows;
|
|
27
28
|
readonly agents: Agents;
|
|
29
|
+
readonly workflows: Workflows;
|
|
28
30
|
readonly receptionists: Receptionists;
|
|
29
31
|
/** A copy of this client with some options changed, such as the client workspace it acts in. */
|
|
30
32
|
withOptions(options: ClientOptions): Superclerk;
|
package/generated/client.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Generated by script/generate.ts from the public OpenAPI document. Do not edit.
|
|
2
2
|
import { Core } from "../core/client.js";
|
|
3
|
+
import { Chats } from "../lib/chats.js";
|
|
3
4
|
import { Connect } from "../lib/connect.js";
|
|
4
5
|
import { Connections } from "../lib/connections.js";
|
|
5
6
|
import { Social } from "../lib/social.js";
|
|
@@ -15,6 +16,7 @@ export class Superclerk extends Core {
|
|
|
15
16
|
apps = new Apps(this);
|
|
16
17
|
connections = new Connections(this);
|
|
17
18
|
social = new Social(this);
|
|
19
|
+
chats = new Chats(this);
|
|
18
20
|
conversations = new Conversations(this);
|
|
19
21
|
tags = new Tags(this);
|
|
20
22
|
contacts = new Contacts(this);
|
|
@@ -24,8 +26,8 @@ export class Superclerk extends Core {
|
|
|
24
26
|
opportunities = new Opportunities(this);
|
|
25
27
|
tasks = new Tasks(this);
|
|
26
28
|
inbox = new Inbox(this);
|
|
27
|
-
workflows = new Workflows(this);
|
|
28
29
|
agents = new Agents(this);
|
|
30
|
+
workflows = new Workflows(this);
|
|
29
31
|
receptionists = new Receptionists(this);
|
|
30
32
|
/** A copy of this client with some options changed, such as the client workspace it acts in. */
|
|
31
33
|
withOptions(options) {
|
package/generated/resources.d.ts
CHANGED
|
@@ -172,7 +172,7 @@ export declare class ConnectionsAccounts extends APIResource {
|
|
|
172
172
|
/**
|
|
173
173
|
* List the accounts a connection can act as
|
|
174
174
|
*
|
|
175
|
-
* The accounts the connection's grant reaches, read from the provider now, and which of them the connection acts as: the pages, profiles, channels or locations a Social connection posts as, or the
|
|
175
|
+
* The accounts the connection's grant reaches, read from the provider now, and which of them the connection acts as: the pages, profiles, channels or locations a Social connection posts as, or the ad accounts an ads connection's tools act on, every one of which connecting turns on. A Social list is one page of the provider's list; follow nextCursor until it is null. An ads list comes in one page. A TikTok account carries the creator's settings, which a TikTok post names by creatorInfoFingerprint.
|
|
176
176
|
*
|
|
177
177
|
* `GET /v1/connections/{connectionID}/accounts`
|
|
178
178
|
*/
|
|
@@ -429,6 +429,116 @@ export declare class SocialBase extends APIResource {
|
|
|
429
429
|
readonly media: SocialMedia;
|
|
430
430
|
readonly posts: SocialPosts;
|
|
431
431
|
}
|
|
432
|
+
export declare class ChatsMessages extends APIResource {
|
|
433
|
+
/**
|
|
434
|
+
* List a chat's messages
|
|
435
|
+
*
|
|
436
|
+
* Newest first: what the person sent, and what the agent answered with its text, its reasoning and the tools it ran.
|
|
437
|
+
*
|
|
438
|
+
* `GET /v1/chats/{chatID}/messages`
|
|
439
|
+
*/
|
|
440
|
+
list(chatID: string, params?: Types.ChatsMessagesListParams, options?: RequestOptions): PagePromise<Types.ChatsMessagesListResponse>;
|
|
441
|
+
/**
|
|
442
|
+
* Send a message
|
|
443
|
+
*
|
|
444
|
+
* Sends the parts at most once per idempotency key and answers the message; the agent answers in the background, so read the chat to wait for it. A message sent while the agent works joins its turn at the next step, and one sent while it waits on a question is kept for once the question is answered or dismissed. A pending approval refuses a message: 409 approval_pending. A channel's conversation takes no message here: 409 read_only.
|
|
445
|
+
*
|
|
446
|
+
* `POST /v1/chats/{chatID}/messages`
|
|
447
|
+
*/
|
|
448
|
+
create(chatID: string, params: Types.ChatsMessagesCreateParams, options?: RequestOptions): APIPromise<Types.ChatMessage>;
|
|
449
|
+
/**
|
|
450
|
+
* Get a message
|
|
451
|
+
*
|
|
452
|
+
* One message of the chat.
|
|
453
|
+
*
|
|
454
|
+
* `GET /v1/chats/{chatID}/messages/{messageID}`
|
|
455
|
+
*/
|
|
456
|
+
get(messageID: string, params: Types.ChatsMessagesGetParams, options?: RequestOptions): APIPromise<Types.ChatMessage>;
|
|
457
|
+
}
|
|
458
|
+
export declare class ChatsApprovals extends APIResource {
|
|
459
|
+
/**
|
|
460
|
+
* Approve or deny a tool call
|
|
461
|
+
*
|
|
462
|
+
* Decides an approval the chat's pending lists; the agent then runs the tool, or not, and goes on. Sending the same decision again changes nothing; another one is a 409. A script's write plan is decided with its planDigest.
|
|
463
|
+
*
|
|
464
|
+
* `POST /v1/chats/{chatID}/approvals/{approvalID}/decide`
|
|
465
|
+
*/
|
|
466
|
+
decide(approvalID: string, params: Types.ChatsApprovalsDecideParams, options?: RequestOptions): APIPromise<Types.Chat>;
|
|
467
|
+
}
|
|
468
|
+
export declare class ChatsQuestions extends APIResource {
|
|
469
|
+
/**
|
|
470
|
+
* Answer the agent's question
|
|
471
|
+
*
|
|
472
|
+
* One answer per question, each the chosen option labels or, where the question allows, the person's own words; a connection request is answered with [[connectionID]]. The agent goes on with the answer. The same answer again changes nothing; another one is a 409.
|
|
473
|
+
*
|
|
474
|
+
* `POST /v1/chats/{chatID}/questions/{questionID}/answer`
|
|
475
|
+
*/
|
|
476
|
+
answer(questionID: string, params: Types.ChatsQuestionsAnswerParams, options?: RequestOptions): APIPromise<Types.Chat>;
|
|
477
|
+
/**
|
|
478
|
+
* Dismiss the agent's question
|
|
479
|
+
*
|
|
480
|
+
* Ends the turn that asked it; a message sent while it waited is answered next.
|
|
481
|
+
*
|
|
482
|
+
* `POST /v1/chats/{chatID}/questions/{questionID}/dismiss`
|
|
483
|
+
*/
|
|
484
|
+
dismiss(questionID: string, params: Types.ChatsQuestionsDismissParams, options?: RequestOptions): APIPromise<Types.Chat>;
|
|
485
|
+
}
|
|
486
|
+
export declare class ChatsFiles extends APIResource {
|
|
487
|
+
/**
|
|
488
|
+
* Get a file
|
|
489
|
+
*
|
|
490
|
+
* A file the chat holds, with a link that reads it for five minutes.
|
|
491
|
+
*
|
|
492
|
+
* `GET /v1/chats/{chatID}/files/{fileID}`
|
|
493
|
+
*/
|
|
494
|
+
get(fileID: string, params: Types.ChatsFilesGetParams, options?: RequestOptions): APIPromise<Types.ChatFile>;
|
|
495
|
+
}
|
|
496
|
+
export declare class ChatsBase extends APIResource {
|
|
497
|
+
readonly messages: ChatsMessages;
|
|
498
|
+
readonly approvals: ChatsApprovals;
|
|
499
|
+
readonly questions: ChatsQuestions;
|
|
500
|
+
readonly files: ChatsFiles;
|
|
501
|
+
/**
|
|
502
|
+
* List chats
|
|
503
|
+
*
|
|
504
|
+
* The chats the app lists, most recently active first: the member's own, outside any website and subagent. Archived chats are left out.
|
|
505
|
+
*
|
|
506
|
+
* `GET /v1/chats`
|
|
507
|
+
*/
|
|
508
|
+
list(params?: Types.ChatsListParams, options?: RequestOptions): PagePromise<Types.ChatsListResponse>;
|
|
509
|
+
/**
|
|
510
|
+
* Start a chat with an agent
|
|
511
|
+
*
|
|
512
|
+
* A chat with an agent agents.list returns whose mode is primary or all, which answers with its own instructions, model and tools. A subagent works only on tasks another agent gives it: 400 invalid_request.
|
|
513
|
+
*
|
|
514
|
+
* `POST /v1/chats`
|
|
515
|
+
*/
|
|
516
|
+
create(params: Types.ChatsCreateParams, options?: RequestOptions): APIPromise<Types.Chat>;
|
|
517
|
+
/**
|
|
518
|
+
* Get a chat
|
|
519
|
+
*
|
|
520
|
+
* The chat's status: running while the agent works, waiting while it needs an answer to what pending lists, idle otherwise, with the error that ended its latest message. Answers 202 while running.
|
|
521
|
+
*
|
|
522
|
+
* `GET /v1/chats/{chatID}`
|
|
523
|
+
*/
|
|
524
|
+
get(chatID: string, options?: RequestOptions): APIPromise<Types.Chat>;
|
|
525
|
+
/**
|
|
526
|
+
* Stream a chat
|
|
527
|
+
*
|
|
528
|
+
* Server-sent events: chat first and whenever it changes; on a new stream the transcript as messages; then message and part as each is written, delta as the agent's text streams (sent only by the server running the turn), and removed, deleted and error. Stored changes carry ids: reconnect with after, or the Last-Event-ID your client sends, to receive every change after it.
|
|
529
|
+
*
|
|
530
|
+
* `GET /v1/chats/{chatID}/events`
|
|
531
|
+
*/
|
|
532
|
+
events(chatID: string, params?: Types.ChatsEventsParams, options?: RequestOptions): APIPromise<Response>;
|
|
533
|
+
/**
|
|
534
|
+
* Stop the agent
|
|
535
|
+
*
|
|
536
|
+
* Stops the agent's turn, and dismisses what it waits on. Stopping an idle chat changes nothing.
|
|
537
|
+
*
|
|
538
|
+
* `POST /v1/chats/{chatID}/stop`
|
|
539
|
+
*/
|
|
540
|
+
stop(chatID: string, options?: RequestOptions): APIPromise<Types.Chat>;
|
|
541
|
+
}
|
|
432
542
|
export declare class ConversationsMessages extends APIResource {
|
|
433
543
|
/**
|
|
434
544
|
* List a conversation's messages
|
|
@@ -938,7 +1048,7 @@ export declare class InboxAccountsAi extends APIResource {
|
|
|
938
1048
|
/**
|
|
939
1049
|
* Set AI up on an account
|
|
940
1050
|
*
|
|
941
|
-
* Makes the account a workflow of its own from the template, with its settings or the given ones, and puts it live for everyone who writes there. The workflow
|
|
1051
|
+
* Makes the account a workflow of its own from the template, with its settings or the given ones, and puts it live for everyone who writes there. The Inbox manages that workflow: only these routes change it, and Automations doesn't list it. A retry with the same key answers the workflow the first call made.
|
|
942
1052
|
*
|
|
943
1053
|
* `POST /v1/inbox/accounts/{connectionID}/ai`
|
|
944
1054
|
*/
|
|
@@ -956,7 +1066,7 @@ export declare class InboxAccountsSettings extends APIResource {
|
|
|
956
1066
|
/**
|
|
957
1067
|
* Change an account's AI settings
|
|
958
1068
|
*
|
|
959
|
-
* Replaces the settings at expectedRevision and publishes them in one step, keeping the live version's approvals: the next conversation uses them, and ones under way finish as they started. Refused
|
|
1069
|
+
* Replaces the settings at expectedRevision and publishes them in one step, keeping the live version's approvals: the next conversation uses them, and ones under way finish as they started. Refused for an account whose AI was built in Automations, which changes it there. A retry with the same key answers what the first call made.
|
|
960
1070
|
*
|
|
961
1071
|
* `PUT /v1/inbox/accounts/{connectionID}/settings`
|
|
962
1072
|
*/
|
|
@@ -976,7 +1086,7 @@ export declare class InboxAccounts extends APIResource {
|
|
|
976
1086
|
/**
|
|
977
1087
|
* Take an account out of the Inbox
|
|
978
1088
|
*
|
|
979
|
-
* In one step, the account stops receiving messages here and each workflow the Inbox made for it is archived; its conversations stay. Refused with nothing changed for an account set up elsewhere, and while the AI is answering a conversation there. A retry with the same key answers what the first call did.
|
|
1089
|
+
* In one step, the account stops receiving messages here and each workflow the Inbox made for it is archived; its conversations stay. A phone line keeps receiving, since its calls run through it: only its AI goes, and its texts wait for your team. Refused with nothing changed for an account set up elsewhere, and while the AI is answering a conversation there. A retry with the same key answers what the first call did.
|
|
980
1090
|
*
|
|
981
1091
|
* Formerly `POST /v1/inbox/accounts/{connectionID}/ai/remove`, which still answers, marked deprecated.
|
|
982
1092
|
*
|
|
@@ -1011,6 +1121,26 @@ export declare class Inbox extends APIResource {
|
|
|
1011
1121
|
readonly templates: InboxTemplates;
|
|
1012
1122
|
readonly agents: InboxAgents;
|
|
1013
1123
|
}
|
|
1124
|
+
export declare class Agents extends APIResource {
|
|
1125
|
+
/**
|
|
1126
|
+
* List agents
|
|
1127
|
+
*
|
|
1128
|
+
* The workspace's agents: its own agent first, and the ones that work only for other agents last. A chat and the Inbox take one whose mode is primary or all; a Run Agent step takes any, by its exact ID.
|
|
1129
|
+
*
|
|
1130
|
+
* Formerly `GET /v1/workflows/agents`, which still answers, marked deprecated.
|
|
1131
|
+
*
|
|
1132
|
+
* `GET /v1/agents`
|
|
1133
|
+
*/
|
|
1134
|
+
list(options?: RequestOptions): APIPromise<Types.AgentList>;
|
|
1135
|
+
/**
|
|
1136
|
+
* Get an agent
|
|
1137
|
+
*
|
|
1138
|
+
* One of the agents agents.list returns.
|
|
1139
|
+
*
|
|
1140
|
+
* `GET /v1/agents/{agentID}`
|
|
1141
|
+
*/
|
|
1142
|
+
get(agentID: string, options?: RequestOptions): APIPromise<Types.Agent>;
|
|
1143
|
+
}
|
|
1014
1144
|
export declare class WorkflowsCatalog extends APIResource {
|
|
1015
1145
|
/**
|
|
1016
1146
|
* List workflow authoring capabilities
|
|
@@ -1297,18 +1427,6 @@ export declare class Workflows extends APIResource {
|
|
|
1297
1427
|
*/
|
|
1298
1428
|
resume(workflowID: string, options?: RequestOptions): APIPromise<Types.WorkflowsResumeResponse>;
|
|
1299
1429
|
}
|
|
1300
|
-
export declare class Agents extends APIResource {
|
|
1301
|
-
/**
|
|
1302
|
-
* List agents available to Run Agent workflow steps
|
|
1303
|
-
*
|
|
1304
|
-
* Use an exact returned ID. The active revision is resolved once when the workflow is published.
|
|
1305
|
-
*
|
|
1306
|
-
* Formerly `GET /v1/workflows/agents`, which still answers, marked deprecated.
|
|
1307
|
-
*
|
|
1308
|
-
* `GET /v1/agents`
|
|
1309
|
-
*/
|
|
1310
|
-
list(options?: RequestOptions): APIPromise<Types.WorkflowAgentsResponse>;
|
|
1311
|
-
}
|
|
1312
1430
|
export declare class Receptionists extends APIResource {
|
|
1313
1431
|
/**
|
|
1314
1432
|
* List receptionists available to workflows
|
package/generated/resources.js
CHANGED
|
@@ -219,7 +219,7 @@ export class ConnectionsAccounts extends APIResource {
|
|
|
219
219
|
/**
|
|
220
220
|
* List the accounts a connection can act as
|
|
221
221
|
*
|
|
222
|
-
* The accounts the connection's grant reaches, read from the provider now, and which of them the connection acts as: the pages, profiles, channels or locations a Social connection posts as, or the
|
|
222
|
+
* The accounts the connection's grant reaches, read from the provider now, and which of them the connection acts as: the pages, profiles, channels or locations a Social connection posts as, or the ad accounts an ads connection's tools act on, every one of which connecting turns on. A Social list is one page of the provider's list; follow nextCursor until it is null. An ads list comes in one page. A TikTok account carries the creator's settings, which a TikTok post names by creatorInfoFingerprint.
|
|
223
223
|
*
|
|
224
224
|
* `GET /v1/connections/{connectionID}/accounts`
|
|
225
225
|
*/
|
|
@@ -599,6 +599,181 @@ export class SocialBase extends APIResource {
|
|
|
599
599
|
media = new SocialMedia(this._client);
|
|
600
600
|
posts = new SocialPosts(this._client);
|
|
601
601
|
}
|
|
602
|
+
export class ChatsMessages extends APIResource {
|
|
603
|
+
/**
|
|
604
|
+
* List a chat's messages
|
|
605
|
+
*
|
|
606
|
+
* Newest first: what the person sent, and what the agent answered with its text, its reasoning and the tools it ran.
|
|
607
|
+
*
|
|
608
|
+
* `GET /v1/chats/{chatID}/messages`
|
|
609
|
+
*/
|
|
610
|
+
list(chatID, params = {}, options) {
|
|
611
|
+
const { limit, cursor } = params;
|
|
612
|
+
return this._client.list({ method: "GET", path: `/v1/chats/${pathParam(chatID)}/messages`, query: { limit, cursor }, response: "json" }, options);
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* Send a message
|
|
616
|
+
*
|
|
617
|
+
* Sends the parts at most once per idempotency key and answers the message; the agent answers in the background, so read the chat to wait for it. A message sent while the agent works joins its turn at the next step, and one sent while it waits on a question is kept for once the question is answered or dismissed. A pending approval refuses a message: 409 approval_pending. A channel's conversation takes no message here: 409 read_only.
|
|
618
|
+
*
|
|
619
|
+
* `POST /v1/chats/{chatID}/messages`
|
|
620
|
+
*/
|
|
621
|
+
create(chatID, params, options) {
|
|
622
|
+
return this._client.request({
|
|
623
|
+
method: "POST",
|
|
624
|
+
path: `/v1/chats/${pathParam(chatID)}/messages`,
|
|
625
|
+
body: params,
|
|
626
|
+
idempotent: true,
|
|
627
|
+
response: "json",
|
|
628
|
+
}, options);
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* Get a message
|
|
632
|
+
*
|
|
633
|
+
* One message of the chat.
|
|
634
|
+
*
|
|
635
|
+
* `GET /v1/chats/{chatID}/messages/{messageID}`
|
|
636
|
+
*/
|
|
637
|
+
get(messageID, params, options) {
|
|
638
|
+
const { chatID } = params;
|
|
639
|
+
return this._client.request({ method: "GET", path: `/v1/chats/${pathParam(chatID)}/messages/${pathParam(messageID)}`, response: "json" }, options);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
export class ChatsApprovals extends APIResource {
|
|
643
|
+
/**
|
|
644
|
+
* Approve or deny a tool call
|
|
645
|
+
*
|
|
646
|
+
* Decides an approval the chat's pending lists; the agent then runs the tool, or not, and goes on. Sending the same decision again changes nothing; another one is a 409. A script's write plan is decided with its planDigest.
|
|
647
|
+
*
|
|
648
|
+
* `POST /v1/chats/{chatID}/approvals/{approvalID}/decide`
|
|
649
|
+
*/
|
|
650
|
+
decide(approvalID, params, options) {
|
|
651
|
+
const { chatID, ...body } = params;
|
|
652
|
+
return this._client.request({
|
|
653
|
+
method: "POST",
|
|
654
|
+
path: `/v1/chats/${pathParam(chatID)}/approvals/${pathParam(approvalID)}/decide`,
|
|
655
|
+
body,
|
|
656
|
+
idempotent: true,
|
|
657
|
+
response: "json",
|
|
658
|
+
}, options);
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
export class ChatsQuestions extends APIResource {
|
|
662
|
+
/**
|
|
663
|
+
* Answer the agent's question
|
|
664
|
+
*
|
|
665
|
+
* One answer per question, each the chosen option labels or, where the question allows, the person's own words; a connection request is answered with [[connectionID]]. The agent goes on with the answer. The same answer again changes nothing; another one is a 409.
|
|
666
|
+
*
|
|
667
|
+
* `POST /v1/chats/{chatID}/questions/{questionID}/answer`
|
|
668
|
+
*/
|
|
669
|
+
answer(questionID, params, options) {
|
|
670
|
+
const { chatID, ...body } = params;
|
|
671
|
+
return this._client.request({
|
|
672
|
+
method: "POST",
|
|
673
|
+
path: `/v1/chats/${pathParam(chatID)}/questions/${pathParam(questionID)}/answer`,
|
|
674
|
+
body,
|
|
675
|
+
idempotent: true,
|
|
676
|
+
response: "json",
|
|
677
|
+
}, options);
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* Dismiss the agent's question
|
|
681
|
+
*
|
|
682
|
+
* Ends the turn that asked it; a message sent while it waited is answered next.
|
|
683
|
+
*
|
|
684
|
+
* `POST /v1/chats/{chatID}/questions/{questionID}/dismiss`
|
|
685
|
+
*/
|
|
686
|
+
dismiss(questionID, params, options) {
|
|
687
|
+
const { chatID } = params;
|
|
688
|
+
return this._client.request({
|
|
689
|
+
method: "POST",
|
|
690
|
+
path: `/v1/chats/${pathParam(chatID)}/questions/${pathParam(questionID)}/dismiss`,
|
|
691
|
+
idempotent: true,
|
|
692
|
+
response: "json",
|
|
693
|
+
}, options);
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
export class ChatsFiles extends APIResource {
|
|
697
|
+
/**
|
|
698
|
+
* Get a file
|
|
699
|
+
*
|
|
700
|
+
* A file the chat holds, with a link that reads it for five minutes.
|
|
701
|
+
*
|
|
702
|
+
* `GET /v1/chats/{chatID}/files/{fileID}`
|
|
703
|
+
*/
|
|
704
|
+
get(fileID, params, options) {
|
|
705
|
+
const { chatID, disposition } = params;
|
|
706
|
+
return this._client.request({
|
|
707
|
+
method: "GET",
|
|
708
|
+
path: `/v1/chats/${pathParam(chatID)}/files/${pathParam(fileID)}`,
|
|
709
|
+
query: { disposition },
|
|
710
|
+
response: "json",
|
|
711
|
+
}, options);
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
export class ChatsBase extends APIResource {
|
|
715
|
+
messages = new ChatsMessages(this._client);
|
|
716
|
+
approvals = new ChatsApprovals(this._client);
|
|
717
|
+
questions = new ChatsQuestions(this._client);
|
|
718
|
+
files = new ChatsFiles(this._client);
|
|
719
|
+
/**
|
|
720
|
+
* List chats
|
|
721
|
+
*
|
|
722
|
+
* The chats the app lists, most recently active first: the member's own, outside any website and subagent. Archived chats are left out.
|
|
723
|
+
*
|
|
724
|
+
* `GET /v1/chats`
|
|
725
|
+
*/
|
|
726
|
+
list(params = {}, options) {
|
|
727
|
+
const { limit, cursor, agentID, search, sort, hasMessages } = params;
|
|
728
|
+
return this._client.list({
|
|
729
|
+
method: "GET",
|
|
730
|
+
path: `/v1/chats`,
|
|
731
|
+
query: { limit, cursor, agentID, search, sort, hasMessages },
|
|
732
|
+
response: "json",
|
|
733
|
+
}, options);
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* Start a chat with an agent
|
|
737
|
+
*
|
|
738
|
+
* A chat with an agent agents.list returns whose mode is primary or all, which answers with its own instructions, model and tools. A subagent works only on tasks another agent gives it: 400 invalid_request.
|
|
739
|
+
*
|
|
740
|
+
* `POST /v1/chats`
|
|
741
|
+
*/
|
|
742
|
+
create(params, options) {
|
|
743
|
+
return this._client.request({ method: "POST", path: `/v1/chats`, body: params, idempotent: true, response: "json" }, options);
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* Get a chat
|
|
747
|
+
*
|
|
748
|
+
* The chat's status: running while the agent works, waiting while it needs an answer to what pending lists, idle otherwise, with the error that ended its latest message. Answers 202 while running.
|
|
749
|
+
*
|
|
750
|
+
* `GET /v1/chats/{chatID}`
|
|
751
|
+
*/
|
|
752
|
+
get(chatID, options) {
|
|
753
|
+
return this._client.request({ method: "GET", path: `/v1/chats/${pathParam(chatID)}`, response: "json" }, options);
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* Stream a chat
|
|
757
|
+
*
|
|
758
|
+
* Server-sent events: chat first and whenever it changes; on a new stream the transcript as messages; then message and part as each is written, delta as the agent's text streams (sent only by the server running the turn), and removed, deleted and error. Stored changes carry ids: reconnect with after, or the Last-Event-ID your client sends, to receive every change after it.
|
|
759
|
+
*
|
|
760
|
+
* `GET /v1/chats/{chatID}/events`
|
|
761
|
+
*/
|
|
762
|
+
events(chatID, params = {}, options) {
|
|
763
|
+
const { after } = params;
|
|
764
|
+
return this._client.request({ method: "GET", path: `/v1/chats/${pathParam(chatID)}/events`, query: { after }, response: "raw" }, options);
|
|
765
|
+
}
|
|
766
|
+
/**
|
|
767
|
+
* Stop the agent
|
|
768
|
+
*
|
|
769
|
+
* Stops the agent's turn, and dismisses what it waits on. Stopping an idle chat changes nothing.
|
|
770
|
+
*
|
|
771
|
+
* `POST /v1/chats/{chatID}/stop`
|
|
772
|
+
*/
|
|
773
|
+
stop(chatID, options) {
|
|
774
|
+
return this._client.request({ method: "POST", path: `/v1/chats/${pathParam(chatID)}/stop`, idempotent: true, response: "json" }, options);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
602
777
|
export class ConversationsMessages extends APIResource {
|
|
603
778
|
/**
|
|
604
779
|
* List a conversation's messages
|
|
@@ -1381,7 +1556,7 @@ export class InboxAccountsAi extends APIResource {
|
|
|
1381
1556
|
/**
|
|
1382
1557
|
* Set AI up on an account
|
|
1383
1558
|
*
|
|
1384
|
-
* Makes the account a workflow of its own from the template, with its settings or the given ones, and puts it live for everyone who writes there. The workflow
|
|
1559
|
+
* Makes the account a workflow of its own from the template, with its settings or the given ones, and puts it live for everyone who writes there. The Inbox manages that workflow: only these routes change it, and Automations doesn't list it. A retry with the same key answers the workflow the first call made.
|
|
1385
1560
|
*
|
|
1386
1561
|
* `POST /v1/inbox/accounts/{connectionID}/ai`
|
|
1387
1562
|
*/
|
|
@@ -1417,7 +1592,7 @@ export class InboxAccountsSettings extends APIResource {
|
|
|
1417
1592
|
/**
|
|
1418
1593
|
* Change an account's AI settings
|
|
1419
1594
|
*
|
|
1420
|
-
* Replaces the settings at expectedRevision and publishes them in one step, keeping the live version's approvals: the next conversation uses them, and ones under way finish as they started. Refused
|
|
1595
|
+
* Replaces the settings at expectedRevision and publishes them in one step, keeping the live version's approvals: the next conversation uses them, and ones under way finish as they started. Refused for an account whose AI was built in Automations, which changes it there. A retry with the same key answers what the first call made.
|
|
1421
1596
|
*
|
|
1422
1597
|
* `PUT /v1/inbox/accounts/{connectionID}/settings`
|
|
1423
1598
|
*/
|
|
@@ -1450,7 +1625,7 @@ export class InboxAccounts extends APIResource {
|
|
|
1450
1625
|
/**
|
|
1451
1626
|
* Take an account out of the Inbox
|
|
1452
1627
|
*
|
|
1453
|
-
* In one step, the account stops receiving messages here and each workflow the Inbox made for it is archived; its conversations stay. Refused with nothing changed for an account set up elsewhere, and while the AI is answering a conversation there. A retry with the same key answers what the first call did.
|
|
1628
|
+
* In one step, the account stops receiving messages here and each workflow the Inbox made for it is archived; its conversations stay. A phone line keeps receiving, since its calls run through it: only its AI goes, and its texts wait for your team. Refused with nothing changed for an account set up elsewhere, and while the AI is answering a conversation there. A retry with the same key answers what the first call did.
|
|
1454
1629
|
*
|
|
1455
1630
|
* Formerly `POST /v1/inbox/accounts/{connectionID}/ai/remove`, which still answers, marked deprecated.
|
|
1456
1631
|
*
|
|
@@ -1499,6 +1674,30 @@ export class Inbox extends APIResource {
|
|
|
1499
1674
|
templates = new InboxTemplates(this._client);
|
|
1500
1675
|
agents = new InboxAgents(this._client);
|
|
1501
1676
|
}
|
|
1677
|
+
export class Agents extends APIResource {
|
|
1678
|
+
/**
|
|
1679
|
+
* List agents
|
|
1680
|
+
*
|
|
1681
|
+
* The workspace's agents: its own agent first, and the ones that work only for other agents last. A chat and the Inbox take one whose mode is primary or all; a Run Agent step takes any, by its exact ID.
|
|
1682
|
+
*
|
|
1683
|
+
* Formerly `GET /v1/workflows/agents`, which still answers, marked deprecated.
|
|
1684
|
+
*
|
|
1685
|
+
* `GET /v1/agents`
|
|
1686
|
+
*/
|
|
1687
|
+
list(options) {
|
|
1688
|
+
return this._client.request({ method: "GET", path: `/v1/agents`, response: "json" }, options);
|
|
1689
|
+
}
|
|
1690
|
+
/**
|
|
1691
|
+
* Get an agent
|
|
1692
|
+
*
|
|
1693
|
+
* One of the agents agents.list returns.
|
|
1694
|
+
*
|
|
1695
|
+
* `GET /v1/agents/{agentID}`
|
|
1696
|
+
*/
|
|
1697
|
+
get(agentID, options) {
|
|
1698
|
+
return this._client.request({ method: "GET", path: `/v1/agents/${pathParam(agentID)}`, response: "json" }, options);
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1502
1701
|
export class WorkflowsCatalog extends APIResource {
|
|
1503
1702
|
/**
|
|
1504
1703
|
* List workflow authoring capabilities
|
|
@@ -1930,20 +2129,6 @@ export class Workflows extends APIResource {
|
|
|
1930
2129
|
return this._client.request({ method: "POST", path: `/v1/workflows/${pathParam(workflowID)}/resume`, response: "json" }, options);
|
|
1931
2130
|
}
|
|
1932
2131
|
}
|
|
1933
|
-
export class Agents extends APIResource {
|
|
1934
|
-
/**
|
|
1935
|
-
* List agents available to Run Agent workflow steps
|
|
1936
|
-
*
|
|
1937
|
-
* Use an exact returned ID. The active revision is resolved once when the workflow is published.
|
|
1938
|
-
*
|
|
1939
|
-
* Formerly `GET /v1/workflows/agents`, which still answers, marked deprecated.
|
|
1940
|
-
*
|
|
1941
|
-
* `GET /v1/agents`
|
|
1942
|
-
*/
|
|
1943
|
-
list(options) {
|
|
1944
|
-
return this._client.request({ method: "GET", path: `/v1/agents`, response: "json" }, options);
|
|
1945
|
-
}
|
|
1946
|
-
}
|
|
1947
2132
|
export class Receptionists extends APIResource {
|
|
1948
2133
|
/**
|
|
1949
2134
|
* List receptionists available to workflows
|