@agentchatme/openclaw 0.7.821 → 0.7.8211

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.
@@ -1,3 +1,3 @@
1
- export { d as agentchatSetupEntry, c as agentchatSetupPlugin, d as default } from './setup-entry-Dtj6vwDY.cjs';
1
+ export { d as agentchatSetupEntry, c as agentchatSetupPlugin, d as default } from './setup-entry-BuDCZ44W.cjs';
2
2
  import 'openclaw/plugin-sdk/channel-core';
3
3
  import 'zod';
@@ -1,3 +1,3 @@
1
- export { d as agentchatSetupEntry, c as agentchatSetupPlugin, d as default } from './setup-entry-Dtj6vwDY.js';
1
+ export { d as agentchatSetupEntry, c as agentchatSetupPlugin, d as default } from './setup-entry-BuDCZ44W.js';
2
2
  import 'openclaw/plugin-sdk/channel-core';
3
3
  import 'zod';
@@ -118,6 +118,28 @@ function classifyNetworkError(err3) {
118
118
  return "retry-transient";
119
119
  }
120
120
 
121
+ // src/version.ts
122
+ var PACKAGE_VERSION = "0.7.8211";
123
+
124
+ // src/client-identity.ts
125
+ var AGENTCHAT_CLIENT_NAME = "openclaw";
126
+ var AGENTCHAT_CLIENT_HEADERS = {
127
+ "X-AgentChat-Client": AGENTCHAT_CLIENT_NAME,
128
+ "X-AgentChat-Client-Version": PACKAGE_VERSION
129
+ };
130
+ function withAgentChatClientIdentity(fetchImpl) {
131
+ return (async (input, init) => {
132
+ const headers = new Headers(
133
+ typeof Request !== "undefined" && input instanceof Request ? input.headers : void 0
134
+ );
135
+ new Headers(init?.headers).forEach((value, key2) => headers.set(key2, value));
136
+ for (const [key2, value] of Object.entries(AGENTCHAT_CLIENT_HEADERS)) {
137
+ headers.set(key2, value);
138
+ }
139
+ return fetchImpl(input, { ...init, headers });
140
+ });
141
+ }
142
+
121
143
  // src/setup-client.ts
122
144
  var DEFAULT_API_BASE = "https://api.agentchat.me";
123
145
  var DEFAULT_TIMEOUT_MS = 1e4;
@@ -137,7 +159,8 @@ async function validateApiKey(apiKey, opts = {}) {
137
159
  method: "GET",
138
160
  headers: {
139
161
  Authorization: `Bearer ${apiKey}`,
140
- Accept: "application/json"
162
+ Accept: "application/json",
163
+ ...AGENTCHAT_CLIENT_HEADERS
141
164
  },
142
165
  signal: controller.signal
143
166
  });
@@ -279,7 +302,11 @@ async function post(path3, body, opts) {
279
302
  try {
280
303
  const res = await fetchImpl(url, {
281
304
  method: "POST",
282
- headers: { "content-type": "application/json", accept: "application/json" },
305
+ headers: {
306
+ "content-type": "application/json",
307
+ accept: "application/json",
308
+ ...AGENTCHAT_CLIENT_HEADERS
309
+ },
283
310
  body: JSON.stringify(body),
284
311
  signal: controller.signal
285
312
  });
@@ -1191,7 +1218,12 @@ var AgentchatWsClient = class {
1191
1218
  this.applyEvent({ type: "SOCKET_OPEN", now });
1192
1219
  try {
1193
1220
  this.ws.send(
1194
- JSON.stringify({ type: "hello", api_key: this.config.apiKey })
1221
+ JSON.stringify({
1222
+ type: "hello",
1223
+ api_key: this.config.apiKey,
1224
+ client: AGENTCHAT_CLIENT_NAME,
1225
+ client_version: PACKAGE_VERSION
1226
+ })
1195
1227
  );
1196
1228
  } catch (err3) {
1197
1229
  this.emitError(
@@ -1870,9 +1902,6 @@ var CircuitBreaker = class {
1870
1902
  }
1871
1903
  };
1872
1904
 
1873
- // src/version.ts
1874
- var PACKAGE_VERSION = "0.7.821";
1875
-
1876
1905
  // src/outbound.ts
1877
1906
  var DEFAULT_RETRY_POLICY = {
1878
1907
  maxAttempts: 4,
@@ -1981,7 +2010,8 @@ var OutboundAdapter = class {
1981
2010
  const headers = {
1982
2011
  "authorization": `Bearer ${this.config.apiKey}`,
1983
2012
  "content-type": "application/json",
1984
- "user-agent": `@agentchatme/openclaw/${PACKAGE_VERSION} (+attempt=${attempt})`
2013
+ "user-agent": `@agentchatme/openclaw/${PACKAGE_VERSION} (+attempt=${attempt})`,
2014
+ ...AGENTCHAT_CLIENT_HEADERS
1985
2015
  };
1986
2016
  let res;
1987
2017
  try {
@@ -2499,7 +2529,8 @@ function getClient({ accountId, config, options }) {
2499
2529
  const client = new AgentChatClient({
2500
2530
  apiKey: config.apiKey,
2501
2531
  baseUrl: config.apiBase,
2502
- ...options
2532
+ ...options,
2533
+ fetch: withAgentChatClientIdentity(options?.fetch ?? globalThis.fetch)
2503
2534
  });
2504
2535
  cache.set(accountId, {
2505
2536
  client,