@superclerk/sdk 0.1.1 → 0.3.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 +38 -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 +136 -18
- package/generated/resources.js +205 -20
- package/generated/tools.d.ts +4147 -214
- package/generated/types.d.ts +1110 -52
- 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/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
|
|
@@ -619,7 +794,7 @@ export class ConversationsMessages extends APIResource {
|
|
|
619
794
|
/**
|
|
620
795
|
* Reply as staff
|
|
621
796
|
*
|
|
622
|
-
* 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
|
|
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 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.
|
|
623
798
|
*
|
|
624
799
|
* `POST /v1/conversations/{conversationID}/messages`
|
|
625
800
|
*/
|
|
@@ -674,7 +849,7 @@ export class Conversations extends APIResource {
|
|
|
674
849
|
/**
|
|
675
850
|
* Take a conversation over from the AI
|
|
676
851
|
*
|
|
677
|
-
* A person holds the conversation
|
|
852
|
+
* A person holds the conversation until someone hands it back.
|
|
678
853
|
*
|
|
679
854
|
* Formerly `POST /v1/conversations/{conversationID}/take-over`, which still answers, marked deprecated.
|
|
680
855
|
*
|
|
@@ -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
|