@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/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AgentchatChannelConfig } from './setup-entry-
|
|
2
|
-
export { a as AgentchatResolvedAccount, b as agentchatChannelEntry, c as agentchatPlugin, d as agentchatSetupEntry, c as agentchatSetupPlugin, b as default, p as parseChannelConfig } from './setup-entry-
|
|
1
|
+
import { A as AgentchatChannelConfig } from './setup-entry-BuDCZ44W.cjs';
|
|
2
|
+
export { a as AgentchatResolvedAccount, b as agentchatChannelEntry, c as agentchatPlugin, d as agentchatSetupEntry, c as agentchatSetupPlugin, b as default, p as parseChannelConfig } from './setup-entry-BuDCZ44W.cjs';
|
|
3
3
|
export { hasAgentChatConfiguredState } from './configured-state.cjs';
|
|
4
4
|
import { WebSocket } from 'ws';
|
|
5
5
|
import 'openclaw/plugin-sdk/channel-core';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AgentchatChannelConfig } from './setup-entry-
|
|
2
|
-
export { a as AgentchatResolvedAccount, b as agentchatChannelEntry, c as agentchatPlugin, d as agentchatSetupEntry, c as agentchatSetupPlugin, b as default, p as parseChannelConfig } from './setup-entry-
|
|
1
|
+
import { A as AgentchatChannelConfig } from './setup-entry-BuDCZ44W.js';
|
|
2
|
+
export { a as AgentchatResolvedAccount, b as agentchatChannelEntry, c as agentchatPlugin, d as agentchatSetupEntry, c as agentchatSetupPlugin, b as default, p as parseChannelConfig } from './setup-entry-BuDCZ44W.js';
|
|
3
3
|
export { hasAgentChatConfiguredState } from './configured-state.js';
|
|
4
4
|
import { WebSocket } from 'ws';
|
|
5
5
|
import 'openclaw/plugin-sdk/channel-core';
|
package/dist/index.js
CHANGED
|
@@ -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: {
|
|
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
|
});
|
|
@@ -1199,7 +1226,12 @@ var AgentchatWsClient = class {
|
|
|
1199
1226
|
this.applyEvent({ type: "SOCKET_OPEN", now });
|
|
1200
1227
|
try {
|
|
1201
1228
|
this.ws.send(
|
|
1202
|
-
JSON.stringify({
|
|
1229
|
+
JSON.stringify({
|
|
1230
|
+
type: "hello",
|
|
1231
|
+
api_key: this.config.apiKey,
|
|
1232
|
+
client: AGENTCHAT_CLIENT_NAME,
|
|
1233
|
+
client_version: PACKAGE_VERSION
|
|
1234
|
+
})
|
|
1203
1235
|
);
|
|
1204
1236
|
} catch (err3) {
|
|
1205
1237
|
this.emitError(
|
|
@@ -1878,9 +1910,6 @@ var CircuitBreaker = class {
|
|
|
1878
1910
|
}
|
|
1879
1911
|
};
|
|
1880
1912
|
|
|
1881
|
-
// src/version.ts
|
|
1882
|
-
var PACKAGE_VERSION = "0.7.82";
|
|
1883
|
-
|
|
1884
1913
|
// src/outbound.ts
|
|
1885
1914
|
var DEFAULT_RETRY_POLICY = {
|
|
1886
1915
|
maxAttempts: 4,
|
|
@@ -1989,7 +2018,8 @@ var OutboundAdapter = class {
|
|
|
1989
2018
|
const headers = {
|
|
1990
2019
|
"authorization": `Bearer ${this.config.apiKey}`,
|
|
1991
2020
|
"content-type": "application/json",
|
|
1992
|
-
"user-agent": `@agentchatme/openclaw/${PACKAGE_VERSION} (+attempt=${attempt})
|
|
2021
|
+
"user-agent": `@agentchatme/openclaw/${PACKAGE_VERSION} (+attempt=${attempt})`,
|
|
2022
|
+
...AGENTCHAT_CLIENT_HEADERS
|
|
1993
2023
|
};
|
|
1994
2024
|
let res;
|
|
1995
2025
|
try {
|
|
@@ -2507,7 +2537,8 @@ function getClient({ accountId, config, options }) {
|
|
|
2507
2537
|
const client = new AgentChatClient({
|
|
2508
2538
|
apiKey: config.apiKey,
|
|
2509
2539
|
baseUrl: config.apiBase,
|
|
2510
|
-
...options
|
|
2540
|
+
...options,
|
|
2541
|
+
fetch: withAgentChatClientIdentity(options?.fetch ?? globalThis.fetch)
|
|
2511
2542
|
});
|
|
2512
2543
|
cache.set(accountId, {
|
|
2513
2544
|
client,
|
|
@@ -4858,75 +4889,77 @@ function profileToEntry(agent) {
|
|
|
4858
4889
|
...agent.avatar_url ? { avatarUrl: agent.avatar_url } : {}
|
|
4859
4890
|
};
|
|
4860
4891
|
}
|
|
4861
|
-
var
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
return [];
|
|
4884
|
-
}
|
|
4885
|
-
},
|
|
4886
|
-
async listPeersLive(params) {
|
|
4887
|
-
return this.listPeers(params);
|
|
4888
|
-
},
|
|
4889
|
-
async listGroups({ cfg, accountId, query, limit }) {
|
|
4890
|
-
const config = resolveAccount(cfg, accountId);
|
|
4891
|
-
if (!config) return [];
|
|
4892
|
-
const client = getClient({ accountId: accountId ?? "default", config });
|
|
4893
|
-
try {
|
|
4894
|
-
const convs = await client.listConversations();
|
|
4895
|
-
const q = (query ?? "").trim().toLowerCase();
|
|
4896
|
-
const groupRows = convs.filter((c) => c.type === "group");
|
|
4897
|
-
const filtered = q ? groupRows.filter((c) => (c.group_name ?? "").toLowerCase().includes(q)) : groupRows;
|
|
4898
|
-
const cap = limit ?? 50;
|
|
4899
|
-
return filtered.slice(0, cap).map((c) => ({
|
|
4900
|
-
kind: "group",
|
|
4901
|
-
id: c.id,
|
|
4902
|
-
name: c.group_name ?? "Untitled group",
|
|
4903
|
-
...c.group_avatar_url ? { avatarUrl: c.group_avatar_url } : {}
|
|
4904
|
-
}));
|
|
4905
|
-
} catch {
|
|
4906
|
-
return [];
|
|
4907
|
-
}
|
|
4908
|
-
},
|
|
4909
|
-
async listGroupsLive(params) {
|
|
4910
|
-
return this.listGroups(params);
|
|
4911
|
-
},
|
|
4912
|
-
async listGroupMembers({ cfg, accountId, groupId, limit }) {
|
|
4913
|
-
const config = resolveAccount(cfg, accountId);
|
|
4914
|
-
if (!config) return [];
|
|
4915
|
-
const client = getClient({ accountId: accountId ?? "default", config });
|
|
4916
|
-
try {
|
|
4917
|
-
const group = await client.getGroup(groupId);
|
|
4918
|
-
const cap = limit ?? 256;
|
|
4919
|
-
return group.members.slice(0, cap).map((m) => ({
|
|
4920
|
-
kind: "user",
|
|
4921
|
-
id: m.handle,
|
|
4922
|
-
handle: m.handle,
|
|
4923
|
-
name: m.display_name ?? m.handle
|
|
4924
|
-
}));
|
|
4925
|
-
} catch {
|
|
4926
|
-
return [];
|
|
4927
|
-
}
|
|
4892
|
+
var directorySelf = async ({ cfg, accountId }) => {
|
|
4893
|
+
const config = resolveAccount(cfg, accountId);
|
|
4894
|
+
if (!config) return null;
|
|
4895
|
+
const client = getClient({ accountId: accountId ?? "default", config });
|
|
4896
|
+
try {
|
|
4897
|
+
const me = await client.getMe();
|
|
4898
|
+
return profileToEntry(me);
|
|
4899
|
+
} catch {
|
|
4900
|
+
return null;
|
|
4901
|
+
}
|
|
4902
|
+
};
|
|
4903
|
+
var listPeers = async ({ cfg, accountId, query, limit }) => {
|
|
4904
|
+
const config = resolveAccount(cfg, accountId);
|
|
4905
|
+
if (!config) return [];
|
|
4906
|
+
const q = (query ?? "").trim();
|
|
4907
|
+
if (q.length < 2) return [];
|
|
4908
|
+
const client = getClient({ accountId: accountId ?? "default", config });
|
|
4909
|
+
try {
|
|
4910
|
+
const result = await client.searchAgents(q, { limit: limit ?? 20 });
|
|
4911
|
+
return result.agents.map(profileToEntry);
|
|
4912
|
+
} catch {
|
|
4913
|
+
return [];
|
|
4928
4914
|
}
|
|
4929
4915
|
};
|
|
4916
|
+
var listGroups = async ({ cfg, accountId, query, limit }) => {
|
|
4917
|
+
const config = resolveAccount(cfg, accountId);
|
|
4918
|
+
if (!config) return [];
|
|
4919
|
+
const client = getClient({ accountId: accountId ?? "default", config });
|
|
4920
|
+
try {
|
|
4921
|
+
const convs = await client.listConversations();
|
|
4922
|
+
const q = (query ?? "").trim().toLowerCase();
|
|
4923
|
+
const groupRows = convs.filter((c) => c.type === "group");
|
|
4924
|
+
const filtered = q ? groupRows.filter((c) => (c.group_name ?? "").toLowerCase().includes(q)) : groupRows;
|
|
4925
|
+
const cap = limit ?? 50;
|
|
4926
|
+
return filtered.slice(0, cap).map((c) => ({
|
|
4927
|
+
kind: "group",
|
|
4928
|
+
id: c.id,
|
|
4929
|
+
name: c.group_name ?? "Untitled group",
|
|
4930
|
+
...c.group_avatar_url ? { avatarUrl: c.group_avatar_url } : {}
|
|
4931
|
+
}));
|
|
4932
|
+
} catch {
|
|
4933
|
+
return [];
|
|
4934
|
+
}
|
|
4935
|
+
};
|
|
4936
|
+
var listGroupMembers = async ({ cfg, accountId, groupId, limit }) => {
|
|
4937
|
+
const config = resolveAccount(cfg, accountId);
|
|
4938
|
+
if (!config) return [];
|
|
4939
|
+
const client = getClient({ accountId: accountId ?? "default", config });
|
|
4940
|
+
try {
|
|
4941
|
+
const group = await client.getGroup(groupId);
|
|
4942
|
+
const cap = limit ?? 256;
|
|
4943
|
+
return group.members.slice(0, cap).map((m) => ({
|
|
4944
|
+
kind: "user",
|
|
4945
|
+
id: m.handle,
|
|
4946
|
+
handle: m.handle,
|
|
4947
|
+
name: m.display_name ?? m.handle
|
|
4948
|
+
}));
|
|
4949
|
+
} catch {
|
|
4950
|
+
return [];
|
|
4951
|
+
}
|
|
4952
|
+
};
|
|
4953
|
+
var agentchatDirectoryAdapter = {
|
|
4954
|
+
self: directorySelf,
|
|
4955
|
+
listPeers,
|
|
4956
|
+
// `*Live` are literal aliases of the base impls — never `this.listPeers!`,
|
|
4957
|
+
// which breaks when the runtime forwards the method detached.
|
|
4958
|
+
listPeersLive: listPeers,
|
|
4959
|
+
listGroups,
|
|
4960
|
+
listGroupsLive: listGroups,
|
|
4961
|
+
listGroupMembers
|
|
4962
|
+
};
|
|
4930
4963
|
|
|
4931
4964
|
// src/binding/resolver.ts
|
|
4932
4965
|
function resolveAccount2(cfg, accountId) {
|