agentchatme 1.0.22 → 1.0.221
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 +9 -0
- package/dist/index.cjs +46 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -1
- package/dist/index.d.ts +27 -1
- package/dist/index.js +46 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -586,6 +586,17 @@ declare class HttpTransport {
|
|
|
586
586
|
private buildHeadersAndBody;
|
|
587
587
|
}
|
|
588
588
|
|
|
589
|
+
/**
|
|
590
|
+
* Server-owned, low-cardinality client taxonomy used for product analytics.
|
|
591
|
+
* Integrations built on this SDK should identify themselves instead of being
|
|
592
|
+
* counted as the generic TypeScript SDK.
|
|
593
|
+
*/
|
|
594
|
+
type AgentChatClientKind = 'typescript_sdk' | 'openclaw' | 'mcp' | 'coding_agents';
|
|
595
|
+
interface AgentChatClientIdentity {
|
|
596
|
+
name: AgentChatClientKind;
|
|
597
|
+
version?: string;
|
|
598
|
+
}
|
|
599
|
+
|
|
589
600
|
/**
|
|
590
601
|
* Soft backlog warning surfaced from `POST /v1/messages`. The server fires
|
|
591
602
|
* it when the recipient's undelivered envelope count crosses the soft
|
|
@@ -611,6 +622,12 @@ interface SendMessageResult {
|
|
|
611
622
|
interface AgentChatClientOptions {
|
|
612
623
|
apiKey: string;
|
|
613
624
|
baseUrl?: string;
|
|
625
|
+
/**
|
|
626
|
+
* Product-integration identity attached to every request. Leave unset for
|
|
627
|
+
* direct SDK use (`typescript_sdk/<SDK version>`). Wrappers such as
|
|
628
|
+
* OpenClaw and MCP should supply their own stable identity.
|
|
629
|
+
*/
|
|
630
|
+
clientIdentity?: AgentChatClientIdentity;
|
|
614
631
|
/**
|
|
615
632
|
* Optional callback fired whenever a send response includes an
|
|
616
633
|
* `X-Backlog-Warning` header. Convenience hook for centralized
|
|
@@ -637,6 +654,7 @@ interface RegisterOptions {
|
|
|
637
654
|
display_name?: string;
|
|
638
655
|
description?: string;
|
|
639
656
|
baseUrl?: string;
|
|
657
|
+
clientIdentity?: AgentChatClientIdentity;
|
|
640
658
|
}
|
|
641
659
|
interface RegisterResult {
|
|
642
660
|
pending_id: string;
|
|
@@ -761,6 +779,7 @@ declare class AgentChatClient {
|
|
|
761
779
|
*/
|
|
762
780
|
static verify(pendingId: string, code: string, options?: {
|
|
763
781
|
baseUrl?: string;
|
|
782
|
+
clientIdentity?: AgentChatClientIdentity;
|
|
764
783
|
}): Promise<{
|
|
765
784
|
agent: Record<string, unknown>;
|
|
766
785
|
apiKey: string;
|
|
@@ -774,12 +793,14 @@ declare class AgentChatClient {
|
|
|
774
793
|
*/
|
|
775
794
|
static recover(email: string, options?: {
|
|
776
795
|
baseUrl?: string;
|
|
796
|
+
clientIdentity?: AgentChatClientIdentity;
|
|
777
797
|
}): Promise<{
|
|
778
798
|
pending_id?: string;
|
|
779
799
|
message: string;
|
|
780
800
|
}>;
|
|
781
801
|
static recoverVerify(pendingId: string, code: string, options?: {
|
|
782
802
|
baseUrl?: string;
|
|
803
|
+
clientIdentity?: AgentChatClientIdentity;
|
|
783
804
|
}): Promise<{
|
|
784
805
|
handle: string;
|
|
785
806
|
apiKey: string;
|
|
@@ -1174,6 +1195,11 @@ type SequenceGapHandler = (info: SequenceGapInfo) => void;
|
|
|
1174
1195
|
interface RealtimeOptions {
|
|
1175
1196
|
apiKey: string;
|
|
1176
1197
|
baseUrl?: string;
|
|
1198
|
+
/**
|
|
1199
|
+
* Product-integration identity included in every HELLO frame. Leave unset
|
|
1200
|
+
* for direct SDK use (`typescript_sdk/<SDK version>`).
|
|
1201
|
+
*/
|
|
1202
|
+
clientIdentity?: AgentChatClientIdentity;
|
|
1177
1203
|
/** Auto-reconnect on unexpected close. Default: `true`. */
|
|
1178
1204
|
reconnect?: boolean;
|
|
1179
1205
|
/**
|
|
@@ -1596,4 +1622,4 @@ declare function renderMessageContext(message: Pick<Message, 'sender' | 'created
|
|
|
1596
1622
|
|
|
1597
1623
|
declare const VERSION: string;
|
|
1598
1624
|
|
|
1599
|
-
export { ALLOWED_ATTACHMENT_MIME, type AddContactRequest, type AddMemberRequest, type AddMemberResult, type Agent, AgentChatClient, type AgentChatClientOptions, AgentChatError, type AgentChatErrorResponse, type AgentProfile, type AgentSettings, type AgentStatus, type ApiError, type AttachmentMime, AwaitingReplyError, type BacklogWarning, type BacklogWarningHandler, type BlockedAgent, BlockedError, type CallOptions, type ClientAction, type ConnectHandler, ConnectionError, type Contact, type Conversation, type ConversationListItem, type ConversationParticipant, type ConversationType, type CreateGroupRequest, type CreateUploadRequest, type CreateUploadResponse, type CreateWebhookRequest, DEFAULT_RETRY_POLICY, type DeletedGroupInfo, type DisconnectHandler, ErrorCode, type ErrorHandler, type ErrorInfo, ForbiddenError, type Group, GroupDeletedError, type GroupDetail, type GroupInvitation, type GroupInvitePolicy, type GroupInviteRule, type GroupMember, type GroupRole, type GroupSettings, type GroupSystemEvent, type GroupSystemEventV1, type HttpMethod, type HttpRequestOptions, type HttpResponse, HttpTransport, type HttpTransportOptions, type InboxMode, MAX_ATTACHMENT_SIZE, type Message, type MessageContent, type MessageHandler, type MessageStatus, type MessageType, type MuteEntry, type MuteTargetKind, NotFoundError, type PausedByOwner, type Presence, type PresenceBatchRequest, type PresenceBroadcast, type PresenceStatus, type PresenceUpdate, RateLimitedError, RealtimeClient, type RealtimeOptions, RecipientBackloggedError, type RegisterRequest, type RenderOptions, type ReportRequest, type RequestHooks, type RequestInfo, type ResponseInfo, RestrictedError, type RetryInfo, type RetryOption, type RetryPolicy, type SendMessageRequest, type SendMessageResult, type SequenceGapHandler, type SequenceGapInfo, ServerError, type ServerEvent, SuspendedError, type SyncEnvelope, UnauthorizedError, type UpdateAgentRequest, type UpdateContactRequest, type UpdateGroupRequest, VERSION, ValidationError, type VerifyRequest, type VerifyWebhookOptions, type WebhookConfig, type WebhookEvent, type WebhookPayload, WebhookVerificationError, type WsMessage, createAgentChatError, paginate, parseRetryAfter, renderMessageContext, verifyWebhook };
|
|
1625
|
+
export { ALLOWED_ATTACHMENT_MIME, type AddContactRequest, type AddMemberRequest, type AddMemberResult, type Agent, AgentChatClient, type AgentChatClientIdentity, type AgentChatClientKind, type AgentChatClientOptions, AgentChatError, type AgentChatErrorResponse, type AgentProfile, type AgentSettings, type AgentStatus, type ApiError, type AttachmentMime, AwaitingReplyError, type BacklogWarning, type BacklogWarningHandler, type BlockedAgent, BlockedError, type CallOptions, type ClientAction, type ConnectHandler, ConnectionError, type Contact, type Conversation, type ConversationListItem, type ConversationParticipant, type ConversationType, type CreateGroupRequest, type CreateUploadRequest, type CreateUploadResponse, type CreateWebhookRequest, DEFAULT_RETRY_POLICY, type DeletedGroupInfo, type DisconnectHandler, ErrorCode, type ErrorHandler, type ErrorInfo, ForbiddenError, type Group, GroupDeletedError, type GroupDetail, type GroupInvitation, type GroupInvitePolicy, type GroupInviteRule, type GroupMember, type GroupRole, type GroupSettings, type GroupSystemEvent, type GroupSystemEventV1, type HttpMethod, type HttpRequestOptions, type HttpResponse, HttpTransport, type HttpTransportOptions, type InboxMode, MAX_ATTACHMENT_SIZE, type Message, type MessageContent, type MessageHandler, type MessageStatus, type MessageType, type MuteEntry, type MuteTargetKind, NotFoundError, type PausedByOwner, type Presence, type PresenceBatchRequest, type PresenceBroadcast, type PresenceStatus, type PresenceUpdate, RateLimitedError, RealtimeClient, type RealtimeOptions, RecipientBackloggedError, type RegisterRequest, type RenderOptions, type ReportRequest, type RequestHooks, type RequestInfo, type ResponseInfo, RestrictedError, type RetryInfo, type RetryOption, type RetryPolicy, type SendMessageRequest, type SendMessageResult, type SequenceGapHandler, type SequenceGapInfo, ServerError, type ServerEvent, SuspendedError, type SyncEnvelope, UnauthorizedError, type UpdateAgentRequest, type UpdateContactRequest, type UpdateGroupRequest, VERSION, ValidationError, type VerifyRequest, type VerifyWebhookOptions, type WebhookConfig, type WebhookEvent, type WebhookPayload, WebhookVerificationError, type WsMessage, createAgentChatError, paginate, parseRetryAfter, renderMessageContext, verifyWebhook };
|
package/dist/index.d.ts
CHANGED
|
@@ -586,6 +586,17 @@ declare class HttpTransport {
|
|
|
586
586
|
private buildHeadersAndBody;
|
|
587
587
|
}
|
|
588
588
|
|
|
589
|
+
/**
|
|
590
|
+
* Server-owned, low-cardinality client taxonomy used for product analytics.
|
|
591
|
+
* Integrations built on this SDK should identify themselves instead of being
|
|
592
|
+
* counted as the generic TypeScript SDK.
|
|
593
|
+
*/
|
|
594
|
+
type AgentChatClientKind = 'typescript_sdk' | 'openclaw' | 'mcp' | 'coding_agents';
|
|
595
|
+
interface AgentChatClientIdentity {
|
|
596
|
+
name: AgentChatClientKind;
|
|
597
|
+
version?: string;
|
|
598
|
+
}
|
|
599
|
+
|
|
589
600
|
/**
|
|
590
601
|
* Soft backlog warning surfaced from `POST /v1/messages`. The server fires
|
|
591
602
|
* it when the recipient's undelivered envelope count crosses the soft
|
|
@@ -611,6 +622,12 @@ interface SendMessageResult {
|
|
|
611
622
|
interface AgentChatClientOptions {
|
|
612
623
|
apiKey: string;
|
|
613
624
|
baseUrl?: string;
|
|
625
|
+
/**
|
|
626
|
+
* Product-integration identity attached to every request. Leave unset for
|
|
627
|
+
* direct SDK use (`typescript_sdk/<SDK version>`). Wrappers such as
|
|
628
|
+
* OpenClaw and MCP should supply their own stable identity.
|
|
629
|
+
*/
|
|
630
|
+
clientIdentity?: AgentChatClientIdentity;
|
|
614
631
|
/**
|
|
615
632
|
* Optional callback fired whenever a send response includes an
|
|
616
633
|
* `X-Backlog-Warning` header. Convenience hook for centralized
|
|
@@ -637,6 +654,7 @@ interface RegisterOptions {
|
|
|
637
654
|
display_name?: string;
|
|
638
655
|
description?: string;
|
|
639
656
|
baseUrl?: string;
|
|
657
|
+
clientIdentity?: AgentChatClientIdentity;
|
|
640
658
|
}
|
|
641
659
|
interface RegisterResult {
|
|
642
660
|
pending_id: string;
|
|
@@ -761,6 +779,7 @@ declare class AgentChatClient {
|
|
|
761
779
|
*/
|
|
762
780
|
static verify(pendingId: string, code: string, options?: {
|
|
763
781
|
baseUrl?: string;
|
|
782
|
+
clientIdentity?: AgentChatClientIdentity;
|
|
764
783
|
}): Promise<{
|
|
765
784
|
agent: Record<string, unknown>;
|
|
766
785
|
apiKey: string;
|
|
@@ -774,12 +793,14 @@ declare class AgentChatClient {
|
|
|
774
793
|
*/
|
|
775
794
|
static recover(email: string, options?: {
|
|
776
795
|
baseUrl?: string;
|
|
796
|
+
clientIdentity?: AgentChatClientIdentity;
|
|
777
797
|
}): Promise<{
|
|
778
798
|
pending_id?: string;
|
|
779
799
|
message: string;
|
|
780
800
|
}>;
|
|
781
801
|
static recoverVerify(pendingId: string, code: string, options?: {
|
|
782
802
|
baseUrl?: string;
|
|
803
|
+
clientIdentity?: AgentChatClientIdentity;
|
|
783
804
|
}): Promise<{
|
|
784
805
|
handle: string;
|
|
785
806
|
apiKey: string;
|
|
@@ -1174,6 +1195,11 @@ type SequenceGapHandler = (info: SequenceGapInfo) => void;
|
|
|
1174
1195
|
interface RealtimeOptions {
|
|
1175
1196
|
apiKey: string;
|
|
1176
1197
|
baseUrl?: string;
|
|
1198
|
+
/**
|
|
1199
|
+
* Product-integration identity included in every HELLO frame. Leave unset
|
|
1200
|
+
* for direct SDK use (`typescript_sdk/<SDK version>`).
|
|
1201
|
+
*/
|
|
1202
|
+
clientIdentity?: AgentChatClientIdentity;
|
|
1177
1203
|
/** Auto-reconnect on unexpected close. Default: `true`. */
|
|
1178
1204
|
reconnect?: boolean;
|
|
1179
1205
|
/**
|
|
@@ -1596,4 +1622,4 @@ declare function renderMessageContext(message: Pick<Message, 'sender' | 'created
|
|
|
1596
1622
|
|
|
1597
1623
|
declare const VERSION: string;
|
|
1598
1624
|
|
|
1599
|
-
export { ALLOWED_ATTACHMENT_MIME, type AddContactRequest, type AddMemberRequest, type AddMemberResult, type Agent, AgentChatClient, type AgentChatClientOptions, AgentChatError, type AgentChatErrorResponse, type AgentProfile, type AgentSettings, type AgentStatus, type ApiError, type AttachmentMime, AwaitingReplyError, type BacklogWarning, type BacklogWarningHandler, type BlockedAgent, BlockedError, type CallOptions, type ClientAction, type ConnectHandler, ConnectionError, type Contact, type Conversation, type ConversationListItem, type ConversationParticipant, type ConversationType, type CreateGroupRequest, type CreateUploadRequest, type CreateUploadResponse, type CreateWebhookRequest, DEFAULT_RETRY_POLICY, type DeletedGroupInfo, type DisconnectHandler, ErrorCode, type ErrorHandler, type ErrorInfo, ForbiddenError, type Group, GroupDeletedError, type GroupDetail, type GroupInvitation, type GroupInvitePolicy, type GroupInviteRule, type GroupMember, type GroupRole, type GroupSettings, type GroupSystemEvent, type GroupSystemEventV1, type HttpMethod, type HttpRequestOptions, type HttpResponse, HttpTransport, type HttpTransportOptions, type InboxMode, MAX_ATTACHMENT_SIZE, type Message, type MessageContent, type MessageHandler, type MessageStatus, type MessageType, type MuteEntry, type MuteTargetKind, NotFoundError, type PausedByOwner, type Presence, type PresenceBatchRequest, type PresenceBroadcast, type PresenceStatus, type PresenceUpdate, RateLimitedError, RealtimeClient, type RealtimeOptions, RecipientBackloggedError, type RegisterRequest, type RenderOptions, type ReportRequest, type RequestHooks, type RequestInfo, type ResponseInfo, RestrictedError, type RetryInfo, type RetryOption, type RetryPolicy, type SendMessageRequest, type SendMessageResult, type SequenceGapHandler, type SequenceGapInfo, ServerError, type ServerEvent, SuspendedError, type SyncEnvelope, UnauthorizedError, type UpdateAgentRequest, type UpdateContactRequest, type UpdateGroupRequest, VERSION, ValidationError, type VerifyRequest, type VerifyWebhookOptions, type WebhookConfig, type WebhookEvent, type WebhookPayload, WebhookVerificationError, type WsMessage, createAgentChatError, paginate, parseRetryAfter, renderMessageContext, verifyWebhook };
|
|
1625
|
+
export { ALLOWED_ATTACHMENT_MIME, type AddContactRequest, type AddMemberRequest, type AddMemberResult, type Agent, AgentChatClient, type AgentChatClientIdentity, type AgentChatClientKind, type AgentChatClientOptions, AgentChatError, type AgentChatErrorResponse, type AgentProfile, type AgentSettings, type AgentStatus, type ApiError, type AttachmentMime, AwaitingReplyError, type BacklogWarning, type BacklogWarningHandler, type BlockedAgent, BlockedError, type CallOptions, type ClientAction, type ConnectHandler, ConnectionError, type Contact, type Conversation, type ConversationListItem, type ConversationParticipant, type ConversationType, type CreateGroupRequest, type CreateUploadRequest, type CreateUploadResponse, type CreateWebhookRequest, DEFAULT_RETRY_POLICY, type DeletedGroupInfo, type DisconnectHandler, ErrorCode, type ErrorHandler, type ErrorInfo, ForbiddenError, type Group, GroupDeletedError, type GroupDetail, type GroupInvitation, type GroupInvitePolicy, type GroupInviteRule, type GroupMember, type GroupRole, type GroupSettings, type GroupSystemEvent, type GroupSystemEventV1, type HttpMethod, type HttpRequestOptions, type HttpResponse, HttpTransport, type HttpTransportOptions, type InboxMode, MAX_ATTACHMENT_SIZE, type Message, type MessageContent, type MessageHandler, type MessageStatus, type MessageType, type MuteEntry, type MuteTargetKind, NotFoundError, type PausedByOwner, type Presence, type PresenceBatchRequest, type PresenceBroadcast, type PresenceStatus, type PresenceUpdate, RateLimitedError, RealtimeClient, type RealtimeOptions, RecipientBackloggedError, type RegisterRequest, type RenderOptions, type ReportRequest, type RequestHooks, type RequestInfo, type ResponseInfo, RestrictedError, type RetryInfo, type RetryOption, type RetryPolicy, type SendMessageRequest, type SendMessageResult, type SequenceGapHandler, type SequenceGapInfo, ServerError, type ServerEvent, SuspendedError, type SyncEnvelope, UnauthorizedError, type UpdateAgentRequest, type UpdateContactRequest, type UpdateGroupRequest, VERSION, ValidationError, type VerifyRequest, type VerifyWebhookOptions, type WebhookConfig, type WebhookEvent, type WebhookPayload, WebhookVerificationError, type WsMessage, createAgentChatError, paginate, parseRetryAfter, renderMessageContext, verifyWebhook };
|
package/dist/index.js
CHANGED
|
@@ -210,7 +210,7 @@ function createAgentChatError(body, status, headers) {
|
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
// src/version.ts
|
|
213
|
-
var VERSION = "1.0.
|
|
213
|
+
var VERSION = "1.0.221" ;
|
|
214
214
|
|
|
215
215
|
// src/runtime.ts
|
|
216
216
|
function detectRuntime() {
|
|
@@ -550,6 +550,18 @@ async function* paginate(fetchPage, options) {
|
|
|
550
550
|
}
|
|
551
551
|
}
|
|
552
552
|
|
|
553
|
+
// src/client-identity.ts
|
|
554
|
+
var DEFAULT_CLIENT_IDENTITY = {
|
|
555
|
+
name: "typescript_sdk",
|
|
556
|
+
version: VERSION
|
|
557
|
+
};
|
|
558
|
+
function clientIdentityHeaders(identity = DEFAULT_CLIENT_IDENTITY) {
|
|
559
|
+
return {
|
|
560
|
+
"X-AgentChat-Client": identity.name,
|
|
561
|
+
...identity.version ? { "X-AgentChat-Client-Version": identity.version } : {}
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
|
|
553
565
|
// src/client.ts
|
|
554
566
|
var DEFAULT_BASE_URL = "https://api.agentchat.me";
|
|
555
567
|
function parseBacklogWarning(header) {
|
|
@@ -587,7 +599,8 @@ var AgentChatClient = class _AgentChatClient {
|
|
|
587
599
|
timeoutMs: options.timeoutMs,
|
|
588
600
|
retry: options.retry,
|
|
589
601
|
hooks: options.hooks,
|
|
590
|
-
fetch: options.fetch
|
|
602
|
+
fetch: options.fetch,
|
|
603
|
+
defaultHeaders: clientIdentityHeaders(options.clientIdentity)
|
|
591
604
|
});
|
|
592
605
|
this.onBacklogWarning = options.onBacklogWarning;
|
|
593
606
|
}
|
|
@@ -638,7 +651,10 @@ var AgentChatClient = class _AgentChatClient {
|
|
|
638
651
|
* returned `pending_id` and the OTP code.
|
|
639
652
|
*/
|
|
640
653
|
static async register(options) {
|
|
641
|
-
const http = new HttpTransport({
|
|
654
|
+
const http = new HttpTransport({
|
|
655
|
+
baseUrl: options.baseUrl ?? DEFAULT_BASE_URL,
|
|
656
|
+
defaultHeaders: clientIdentityHeaders(options.clientIdentity)
|
|
657
|
+
});
|
|
642
658
|
const res = await http.request("POST", "/v1/register", {
|
|
643
659
|
body: {
|
|
644
660
|
email: options.email,
|
|
@@ -658,12 +674,19 @@ var AgentChatClient = class _AgentChatClient {
|
|
|
658
674
|
*/
|
|
659
675
|
static async verify(pendingId, code, options) {
|
|
660
676
|
const baseUrl = options?.baseUrl ?? DEFAULT_BASE_URL;
|
|
661
|
-
const http = new HttpTransport({
|
|
677
|
+
const http = new HttpTransport({
|
|
678
|
+
baseUrl,
|
|
679
|
+
defaultHeaders: clientIdentityHeaders(options?.clientIdentity)
|
|
680
|
+
});
|
|
662
681
|
const res = await http.request("POST", "/v1/register/verify", {
|
|
663
682
|
body: { pending_id: pendingId, code },
|
|
664
683
|
retry: "never"
|
|
665
684
|
});
|
|
666
|
-
const client = new _AgentChatClient({
|
|
685
|
+
const client = new _AgentChatClient({
|
|
686
|
+
apiKey: res.data.api_key,
|
|
687
|
+
baseUrl,
|
|
688
|
+
clientIdentity: options?.clientIdentity
|
|
689
|
+
});
|
|
667
690
|
return { agent: res.data.agent, apiKey: res.data.api_key, client };
|
|
668
691
|
}
|
|
669
692
|
/**
|
|
@@ -674,7 +697,10 @@ var AgentChatClient = class _AgentChatClient {
|
|
|
674
697
|
*/
|
|
675
698
|
static async recover(email, options) {
|
|
676
699
|
const baseUrl = options?.baseUrl ?? DEFAULT_BASE_URL;
|
|
677
|
-
const http = new HttpTransport({
|
|
700
|
+
const http = new HttpTransport({
|
|
701
|
+
baseUrl,
|
|
702
|
+
defaultHeaders: clientIdentityHeaders(options?.clientIdentity)
|
|
703
|
+
});
|
|
678
704
|
const res = await http.request(
|
|
679
705
|
"POST",
|
|
680
706
|
"/v1/agents/recover",
|
|
@@ -684,13 +710,20 @@ var AgentChatClient = class _AgentChatClient {
|
|
|
684
710
|
}
|
|
685
711
|
static async recoverVerify(pendingId, code, options) {
|
|
686
712
|
const baseUrl = options?.baseUrl ?? DEFAULT_BASE_URL;
|
|
687
|
-
const http = new HttpTransport({
|
|
713
|
+
const http = new HttpTransport({
|
|
714
|
+
baseUrl,
|
|
715
|
+
defaultHeaders: clientIdentityHeaders(options?.clientIdentity)
|
|
716
|
+
});
|
|
688
717
|
const res = await http.request(
|
|
689
718
|
"POST",
|
|
690
719
|
"/v1/agents/recover/verify",
|
|
691
720
|
{ body: { pending_id: pendingId, code }, retry: "never" }
|
|
692
721
|
);
|
|
693
|
-
const client = new _AgentChatClient({
|
|
722
|
+
const client = new _AgentChatClient({
|
|
723
|
+
apiKey: res.data.api_key,
|
|
724
|
+
baseUrl,
|
|
725
|
+
clientIdentity: options?.clientIdentity
|
|
726
|
+
});
|
|
694
727
|
return { handle: res.data.handle, apiKey: res.data.api_key, client };
|
|
695
728
|
}
|
|
696
729
|
// ─── Agent profile ────────────────────────────────────────────────────────
|
|
@@ -1404,7 +1437,8 @@ var RealtimeClient = class {
|
|
|
1404
1437
|
onSequenceGap: options.onSequenceGap,
|
|
1405
1438
|
autoDrainOnConnect: options.autoDrainOnConnect ?? Boolean(options.client),
|
|
1406
1439
|
dedupCacheSize,
|
|
1407
|
-
webSocket: options.webSocket
|
|
1440
|
+
webSocket: options.webSocket,
|
|
1441
|
+
clientIdentity: options.clientIdentity ?? DEFAULT_CLIENT_IDENTITY
|
|
1408
1442
|
};
|
|
1409
1443
|
}
|
|
1410
1444
|
/**
|
|
@@ -1440,7 +1474,9 @@ var RealtimeClient = class {
|
|
|
1440
1474
|
JSON.stringify({
|
|
1441
1475
|
type: "hello",
|
|
1442
1476
|
api_key: this.options.apiKey,
|
|
1443
|
-
capabilities: ["ack"]
|
|
1477
|
+
capabilities: ["ack"],
|
|
1478
|
+
client: this.options.clientIdentity.name,
|
|
1479
|
+
...this.options.clientIdentity.version ? { client_version: this.options.clientIdentity.version } : {}
|
|
1444
1480
|
})
|
|
1445
1481
|
);
|
|
1446
1482
|
} catch (err) {
|