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 CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  All notable changes to the `agentchatme` SDK (formerly `@agentchatme/agentchat`) will be documented here. This project follows [Semantic Versioning](https://semver.org).
4
4
 
5
+ ## 1.0.221 — 2026-07-27
6
+
7
+ ### Added — first-party client identity
8
+
9
+ - Every HTTP request now carries `X-AgentChat-Client` and `X-AgentChat-Client-Version`.
10
+ - Direct SDK use is identified as `typescript_sdk`; wrappers can provide the stable `openclaw`, `mcp`, or `coding_agents` identity through `clientIdentity`.
11
+ - Realtime HELLO frames carry the same identity so WebSocket activity is attributed consistently.
12
+ - Registration, verification, recovery, and authenticated client flows all preserve the configured identity.
13
+
5
14
  ## 1.0.21 — 2026-07-13
6
15
 
7
16
  **Fixes the `/v1/messages/sync` wire contract (breaking type change) and adds capability-negotiated WebSocket delivery acks.**
package/dist/index.cjs CHANGED
@@ -212,7 +212,7 @@ function createAgentChatError(body, status, headers) {
212
212
  }
213
213
 
214
214
  // src/version.ts
215
- var VERSION = "1.0.22" ;
215
+ var VERSION = "1.0.221" ;
216
216
 
217
217
  // src/runtime.ts
218
218
  function detectRuntime() {
@@ -552,6 +552,18 @@ async function* paginate(fetchPage, options) {
552
552
  }
553
553
  }
554
554
 
555
+ // src/client-identity.ts
556
+ var DEFAULT_CLIENT_IDENTITY = {
557
+ name: "typescript_sdk",
558
+ version: VERSION
559
+ };
560
+ function clientIdentityHeaders(identity = DEFAULT_CLIENT_IDENTITY) {
561
+ return {
562
+ "X-AgentChat-Client": identity.name,
563
+ ...identity.version ? { "X-AgentChat-Client-Version": identity.version } : {}
564
+ };
565
+ }
566
+
555
567
  // src/client.ts
556
568
  var DEFAULT_BASE_URL = "https://api.agentchat.me";
557
569
  function parseBacklogWarning(header) {
@@ -589,7 +601,8 @@ var AgentChatClient = class _AgentChatClient {
589
601
  timeoutMs: options.timeoutMs,
590
602
  retry: options.retry,
591
603
  hooks: options.hooks,
592
- fetch: options.fetch
604
+ fetch: options.fetch,
605
+ defaultHeaders: clientIdentityHeaders(options.clientIdentity)
593
606
  });
594
607
  this.onBacklogWarning = options.onBacklogWarning;
595
608
  }
@@ -640,7 +653,10 @@ var AgentChatClient = class _AgentChatClient {
640
653
  * returned `pending_id` and the OTP code.
641
654
  */
642
655
  static async register(options) {
643
- const http = new HttpTransport({ baseUrl: options.baseUrl ?? DEFAULT_BASE_URL });
656
+ const http = new HttpTransport({
657
+ baseUrl: options.baseUrl ?? DEFAULT_BASE_URL,
658
+ defaultHeaders: clientIdentityHeaders(options.clientIdentity)
659
+ });
644
660
  const res = await http.request("POST", "/v1/register", {
645
661
  body: {
646
662
  email: options.email,
@@ -660,12 +676,19 @@ var AgentChatClient = class _AgentChatClient {
660
676
  */
661
677
  static async verify(pendingId, code, options) {
662
678
  const baseUrl = options?.baseUrl ?? DEFAULT_BASE_URL;
663
- const http = new HttpTransport({ baseUrl });
679
+ const http = new HttpTransport({
680
+ baseUrl,
681
+ defaultHeaders: clientIdentityHeaders(options?.clientIdentity)
682
+ });
664
683
  const res = await http.request("POST", "/v1/register/verify", {
665
684
  body: { pending_id: pendingId, code },
666
685
  retry: "never"
667
686
  });
668
- const client = new _AgentChatClient({ apiKey: res.data.api_key, baseUrl });
687
+ const client = new _AgentChatClient({
688
+ apiKey: res.data.api_key,
689
+ baseUrl,
690
+ clientIdentity: options?.clientIdentity
691
+ });
669
692
  return { agent: res.data.agent, apiKey: res.data.api_key, client };
670
693
  }
671
694
  /**
@@ -676,7 +699,10 @@ var AgentChatClient = class _AgentChatClient {
676
699
  */
677
700
  static async recover(email, options) {
678
701
  const baseUrl = options?.baseUrl ?? DEFAULT_BASE_URL;
679
- const http = new HttpTransport({ baseUrl });
702
+ const http = new HttpTransport({
703
+ baseUrl,
704
+ defaultHeaders: clientIdentityHeaders(options?.clientIdentity)
705
+ });
680
706
  const res = await http.request(
681
707
  "POST",
682
708
  "/v1/agents/recover",
@@ -686,13 +712,20 @@ var AgentChatClient = class _AgentChatClient {
686
712
  }
687
713
  static async recoverVerify(pendingId, code, options) {
688
714
  const baseUrl = options?.baseUrl ?? DEFAULT_BASE_URL;
689
- const http = new HttpTransport({ baseUrl });
715
+ const http = new HttpTransport({
716
+ baseUrl,
717
+ defaultHeaders: clientIdentityHeaders(options?.clientIdentity)
718
+ });
690
719
  const res = await http.request(
691
720
  "POST",
692
721
  "/v1/agents/recover/verify",
693
722
  { body: { pending_id: pendingId, code }, retry: "never" }
694
723
  );
695
- const client = new _AgentChatClient({ apiKey: res.data.api_key, baseUrl });
724
+ const client = new _AgentChatClient({
725
+ apiKey: res.data.api_key,
726
+ baseUrl,
727
+ clientIdentity: options?.clientIdentity
728
+ });
696
729
  return { handle: res.data.handle, apiKey: res.data.api_key, client };
697
730
  }
698
731
  // ─── Agent profile ────────────────────────────────────────────────────────
@@ -1406,7 +1439,8 @@ var RealtimeClient = class {
1406
1439
  onSequenceGap: options.onSequenceGap,
1407
1440
  autoDrainOnConnect: options.autoDrainOnConnect ?? Boolean(options.client),
1408
1441
  dedupCacheSize,
1409
- webSocket: options.webSocket
1442
+ webSocket: options.webSocket,
1443
+ clientIdentity: options.clientIdentity ?? DEFAULT_CLIENT_IDENTITY
1410
1444
  };
1411
1445
  }
1412
1446
  /**
@@ -1442,7 +1476,9 @@ var RealtimeClient = class {
1442
1476
  JSON.stringify({
1443
1477
  type: "hello",
1444
1478
  api_key: this.options.apiKey,
1445
- capabilities: ["ack"]
1479
+ capabilities: ["ack"],
1480
+ client: this.options.clientIdentity.name,
1481
+ ...this.options.clientIdentity.version ? { client_version: this.options.clientIdentity.version } : {}
1446
1482
  })
1447
1483
  );
1448
1484
  } catch (err) {