@agentchatme/openclaw 0.7.82 → 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.
- package/CHANGELOG.md +9 -0
- package/dist/index.cjs +108 -75
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +108 -75
- package/dist/index.js.map +1 -1
- package/dist/setup-entry.cjs +108 -75
- package/dist/setup-entry.cjs.map +1 -1
- package/dist/setup-entry.d.cts +1 -1
- package/dist/setup-entry.d.ts +1 -1
- package/dist/setup-entry.js +108 -75
- package/dist/setup-entry.js.map +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/dist/{setup-entry-Dtj6vwDY.d.cts → setup-entry-BuDCZ44W.d.cts} +1 -1
- package/dist/{setup-entry-Dtj6vwDY.d.ts → setup-entry-BuDCZ44W.d.ts} +1 -1
package/dist/setup-entry.cjs
CHANGED
|
@@ -145,6 +145,28 @@ function classifyNetworkError(err3) {
|
|
|
145
145
|
return "retry-transient";
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
+
// src/version.ts
|
|
149
|
+
var PACKAGE_VERSION = "0.7.8211";
|
|
150
|
+
|
|
151
|
+
// src/client-identity.ts
|
|
152
|
+
var AGENTCHAT_CLIENT_NAME = "openclaw";
|
|
153
|
+
var AGENTCHAT_CLIENT_HEADERS = {
|
|
154
|
+
"X-AgentChat-Client": AGENTCHAT_CLIENT_NAME,
|
|
155
|
+
"X-AgentChat-Client-Version": PACKAGE_VERSION
|
|
156
|
+
};
|
|
157
|
+
function withAgentChatClientIdentity(fetchImpl) {
|
|
158
|
+
return (async (input, init) => {
|
|
159
|
+
const headers = new Headers(
|
|
160
|
+
typeof Request !== "undefined" && input instanceof Request ? input.headers : void 0
|
|
161
|
+
);
|
|
162
|
+
new Headers(init?.headers).forEach((value, key2) => headers.set(key2, value));
|
|
163
|
+
for (const [key2, value] of Object.entries(AGENTCHAT_CLIENT_HEADERS)) {
|
|
164
|
+
headers.set(key2, value);
|
|
165
|
+
}
|
|
166
|
+
return fetchImpl(input, { ...init, headers });
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
|
|
148
170
|
// src/setup-client.ts
|
|
149
171
|
var DEFAULT_API_BASE = "https://api.agentchat.me";
|
|
150
172
|
var DEFAULT_TIMEOUT_MS = 1e4;
|
|
@@ -164,7 +186,8 @@ async function validateApiKey(apiKey, opts = {}) {
|
|
|
164
186
|
method: "GET",
|
|
165
187
|
headers: {
|
|
166
188
|
Authorization: `Bearer ${apiKey}`,
|
|
167
|
-
Accept: "application/json"
|
|
189
|
+
Accept: "application/json",
|
|
190
|
+
...AGENTCHAT_CLIENT_HEADERS
|
|
168
191
|
},
|
|
169
192
|
signal: controller.signal
|
|
170
193
|
});
|
|
@@ -306,7 +329,11 @@ async function post(path3, body, opts) {
|
|
|
306
329
|
try {
|
|
307
330
|
const res = await fetchImpl(url, {
|
|
308
331
|
method: "POST",
|
|
309
|
-
headers: {
|
|
332
|
+
headers: {
|
|
333
|
+
"content-type": "application/json",
|
|
334
|
+
accept: "application/json",
|
|
335
|
+
...AGENTCHAT_CLIENT_HEADERS
|
|
336
|
+
},
|
|
310
337
|
body: JSON.stringify(body),
|
|
311
338
|
signal: controller.signal
|
|
312
339
|
});
|
|
@@ -1218,7 +1245,12 @@ var AgentchatWsClient = class {
|
|
|
1218
1245
|
this.applyEvent({ type: "SOCKET_OPEN", now });
|
|
1219
1246
|
try {
|
|
1220
1247
|
this.ws.send(
|
|
1221
|
-
JSON.stringify({
|
|
1248
|
+
JSON.stringify({
|
|
1249
|
+
type: "hello",
|
|
1250
|
+
api_key: this.config.apiKey,
|
|
1251
|
+
client: AGENTCHAT_CLIENT_NAME,
|
|
1252
|
+
client_version: PACKAGE_VERSION
|
|
1253
|
+
})
|
|
1222
1254
|
);
|
|
1223
1255
|
} catch (err3) {
|
|
1224
1256
|
this.emitError(
|
|
@@ -1897,9 +1929,6 @@ var CircuitBreaker = class {
|
|
|
1897
1929
|
}
|
|
1898
1930
|
};
|
|
1899
1931
|
|
|
1900
|
-
// src/version.ts
|
|
1901
|
-
var PACKAGE_VERSION = "0.7.82";
|
|
1902
|
-
|
|
1903
1932
|
// src/outbound.ts
|
|
1904
1933
|
var DEFAULT_RETRY_POLICY = {
|
|
1905
1934
|
maxAttempts: 4,
|
|
@@ -2008,7 +2037,8 @@ var OutboundAdapter = class {
|
|
|
2008
2037
|
const headers = {
|
|
2009
2038
|
"authorization": `Bearer ${this.config.apiKey}`,
|
|
2010
2039
|
"content-type": "application/json",
|
|
2011
|
-
"user-agent": `@agentchatme/openclaw/${PACKAGE_VERSION} (+attempt=${attempt})
|
|
2040
|
+
"user-agent": `@agentchatme/openclaw/${PACKAGE_VERSION} (+attempt=${attempt})`,
|
|
2041
|
+
...AGENTCHAT_CLIENT_HEADERS
|
|
2012
2042
|
};
|
|
2013
2043
|
let res;
|
|
2014
2044
|
try {
|
|
@@ -2526,7 +2556,8 @@ function getClient({ accountId, config, options }) {
|
|
|
2526
2556
|
const client = new agentchatme.AgentChatClient({
|
|
2527
2557
|
apiKey: config.apiKey,
|
|
2528
2558
|
baseUrl: config.apiBase,
|
|
2529
|
-
...options
|
|
2559
|
+
...options,
|
|
2560
|
+
fetch: withAgentChatClientIdentity(options?.fetch ?? globalThis.fetch)
|
|
2530
2561
|
});
|
|
2531
2562
|
cache.set(accountId, {
|
|
2532
2563
|
client,
|
|
@@ -4877,75 +4908,77 @@ function profileToEntry(agent) {
|
|
|
4877
4908
|
...agent.avatar_url ? { avatarUrl: agent.avatar_url } : {}
|
|
4878
4909
|
};
|
|
4879
4910
|
}
|
|
4880
|
-
var
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
return [];
|
|
4903
|
-
}
|
|
4904
|
-
},
|
|
4905
|
-
async listPeersLive(params) {
|
|
4906
|
-
return this.listPeers(params);
|
|
4907
|
-
},
|
|
4908
|
-
async listGroups({ cfg, accountId, query, limit }) {
|
|
4909
|
-
const config = resolveAccount(cfg, accountId);
|
|
4910
|
-
if (!config) return [];
|
|
4911
|
-
const client = getClient({ accountId: accountId ?? "default", config });
|
|
4912
|
-
try {
|
|
4913
|
-
const convs = await client.listConversations();
|
|
4914
|
-
const q = (query ?? "").trim().toLowerCase();
|
|
4915
|
-
const groupRows = convs.filter((c) => c.type === "group");
|
|
4916
|
-
const filtered = q ? groupRows.filter((c) => (c.group_name ?? "").toLowerCase().includes(q)) : groupRows;
|
|
4917
|
-
const cap = limit ?? 50;
|
|
4918
|
-
return filtered.slice(0, cap).map((c) => ({
|
|
4919
|
-
kind: "group",
|
|
4920
|
-
id: c.id,
|
|
4921
|
-
name: c.group_name ?? "Untitled group",
|
|
4922
|
-
...c.group_avatar_url ? { avatarUrl: c.group_avatar_url } : {}
|
|
4923
|
-
}));
|
|
4924
|
-
} catch {
|
|
4925
|
-
return [];
|
|
4926
|
-
}
|
|
4927
|
-
},
|
|
4928
|
-
async listGroupsLive(params) {
|
|
4929
|
-
return this.listGroups(params);
|
|
4930
|
-
},
|
|
4931
|
-
async listGroupMembers({ cfg, accountId, groupId, limit }) {
|
|
4932
|
-
const config = resolveAccount(cfg, accountId);
|
|
4933
|
-
if (!config) return [];
|
|
4934
|
-
const client = getClient({ accountId: accountId ?? "default", config });
|
|
4935
|
-
try {
|
|
4936
|
-
const group = await client.getGroup(groupId);
|
|
4937
|
-
const cap = limit ?? 256;
|
|
4938
|
-
return group.members.slice(0, cap).map((m) => ({
|
|
4939
|
-
kind: "user",
|
|
4940
|
-
id: m.handle,
|
|
4941
|
-
handle: m.handle,
|
|
4942
|
-
name: m.display_name ?? m.handle
|
|
4943
|
-
}));
|
|
4944
|
-
} catch {
|
|
4945
|
-
return [];
|
|
4946
|
-
}
|
|
4911
|
+
var directorySelf = async ({ cfg, accountId }) => {
|
|
4912
|
+
const config = resolveAccount(cfg, accountId);
|
|
4913
|
+
if (!config) return null;
|
|
4914
|
+
const client = getClient({ accountId: accountId ?? "default", config });
|
|
4915
|
+
try {
|
|
4916
|
+
const me = await client.getMe();
|
|
4917
|
+
return profileToEntry(me);
|
|
4918
|
+
} catch {
|
|
4919
|
+
return null;
|
|
4920
|
+
}
|
|
4921
|
+
};
|
|
4922
|
+
var listPeers = async ({ cfg, accountId, query, limit }) => {
|
|
4923
|
+
const config = resolveAccount(cfg, accountId);
|
|
4924
|
+
if (!config) return [];
|
|
4925
|
+
const q = (query ?? "").trim();
|
|
4926
|
+
if (q.length < 2) return [];
|
|
4927
|
+
const client = getClient({ accountId: accountId ?? "default", config });
|
|
4928
|
+
try {
|
|
4929
|
+
const result = await client.searchAgents(q, { limit: limit ?? 20 });
|
|
4930
|
+
return result.agents.map(profileToEntry);
|
|
4931
|
+
} catch {
|
|
4932
|
+
return [];
|
|
4947
4933
|
}
|
|
4948
4934
|
};
|
|
4935
|
+
var listGroups = async ({ cfg, accountId, query, limit }) => {
|
|
4936
|
+
const config = resolveAccount(cfg, accountId);
|
|
4937
|
+
if (!config) return [];
|
|
4938
|
+
const client = getClient({ accountId: accountId ?? "default", config });
|
|
4939
|
+
try {
|
|
4940
|
+
const convs = await client.listConversations();
|
|
4941
|
+
const q = (query ?? "").trim().toLowerCase();
|
|
4942
|
+
const groupRows = convs.filter((c) => c.type === "group");
|
|
4943
|
+
const filtered = q ? groupRows.filter((c) => (c.group_name ?? "").toLowerCase().includes(q)) : groupRows;
|
|
4944
|
+
const cap = limit ?? 50;
|
|
4945
|
+
return filtered.slice(0, cap).map((c) => ({
|
|
4946
|
+
kind: "group",
|
|
4947
|
+
id: c.id,
|
|
4948
|
+
name: c.group_name ?? "Untitled group",
|
|
4949
|
+
...c.group_avatar_url ? { avatarUrl: c.group_avatar_url } : {}
|
|
4950
|
+
}));
|
|
4951
|
+
} catch {
|
|
4952
|
+
return [];
|
|
4953
|
+
}
|
|
4954
|
+
};
|
|
4955
|
+
var listGroupMembers = async ({ cfg, accountId, groupId, limit }) => {
|
|
4956
|
+
const config = resolveAccount(cfg, accountId);
|
|
4957
|
+
if (!config) return [];
|
|
4958
|
+
const client = getClient({ accountId: accountId ?? "default", config });
|
|
4959
|
+
try {
|
|
4960
|
+
const group = await client.getGroup(groupId);
|
|
4961
|
+
const cap = limit ?? 256;
|
|
4962
|
+
return group.members.slice(0, cap).map((m) => ({
|
|
4963
|
+
kind: "user",
|
|
4964
|
+
id: m.handle,
|
|
4965
|
+
handle: m.handle,
|
|
4966
|
+
name: m.display_name ?? m.handle
|
|
4967
|
+
}));
|
|
4968
|
+
} catch {
|
|
4969
|
+
return [];
|
|
4970
|
+
}
|
|
4971
|
+
};
|
|
4972
|
+
var agentchatDirectoryAdapter = {
|
|
4973
|
+
self: directorySelf,
|
|
4974
|
+
listPeers,
|
|
4975
|
+
// `*Live` are literal aliases of the base impls — never `this.listPeers!`,
|
|
4976
|
+
// which breaks when the runtime forwards the method detached.
|
|
4977
|
+
listPeersLive: listPeers,
|
|
4978
|
+
listGroups,
|
|
4979
|
+
listGroupsLive: listGroups,
|
|
4980
|
+
listGroupMembers
|
|
4981
|
+
};
|
|
4949
4982
|
|
|
4950
4983
|
// src/binding/resolver.ts
|
|
4951
4984
|
function resolveAccount2(cfg, accountId) {
|