@clawling/clawchat-plugin-openclaw 2026.5.12-32 → 2026.5.12-39

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/src/runtime.ts CHANGED
@@ -18,6 +18,7 @@ import { createOpenclawClawlingApiClient } from "./api-client.ts";
18
18
  import { ClawlingApiError } from "./api-types.ts";
19
19
  import {
20
20
  CHANNEL_ID,
21
+ effectiveOutputVisibility,
21
22
  effectiveGroupCommandMode,
22
23
  hasOpenclawClawlingConnectCredentials,
23
24
  type ResolvedOpenclawClawlingAccount,
@@ -111,6 +112,51 @@ const OPENCLAW_CONFIRM_SLASH_COMMANDS = new Set([
111
112
  ]);
112
113
  const GROUP_OWNER_ATTENTION_TITLE = "requires owner attention";
113
114
 
115
+ function isRecord(value: unknown): value is Record<string, unknown> {
116
+ return Boolean(value && typeof value === "object" && !Array.isArray(value));
117
+ }
118
+
119
+ function withFullVerboseDispatchConfig(cfg: OpenClawConfig, agentId: string): OpenClawConfig {
120
+ const cfgRecord = cfg as Record<string, unknown>;
121
+ const agents = isRecord(cfgRecord.agents) ? cfgRecord.agents : {};
122
+ const defaults = isRecord(agents.defaults) ? agents.defaults : {};
123
+ const nextAgents: Record<string, unknown> = {
124
+ ...agents,
125
+ defaults: {
126
+ ...defaults,
127
+ verboseDefault: "full",
128
+ },
129
+ };
130
+ const agentCfg = agents[agentId];
131
+ if (agentId && agentId !== "defaults" && isRecord(agentCfg)) {
132
+ nextAgents[agentId] = {
133
+ ...agentCfg,
134
+ verboseDefault: "full",
135
+ };
136
+ }
137
+ return {
138
+ ...cfgRecord,
139
+ agents: nextAgents,
140
+ } as OpenClawConfig;
141
+ }
142
+
143
+ function resolveDispatchConfigForOutputVisibility(params: {
144
+ cfg: OpenClawConfig;
145
+ account: ResolvedOpenclawClawlingAccount;
146
+ chatId: string;
147
+ chatType: "direct" | "group";
148
+ agentId: string;
149
+ }): OpenClawConfig {
150
+ const visibility = effectiveOutputVisibility(
151
+ params.account,
152
+ params.chatId,
153
+ params.chatType,
154
+ );
155
+ return visibility === "full"
156
+ ? withFullVerboseDispatchConfig(params.cfg, params.agentId)
157
+ : params.cfg;
158
+ }
159
+
114
160
  function resolveChannelContextBuilder(rt: PluginRuntime["channel"]): ChannelContextBuilder {
115
161
  const channel = rt as CompatibleChannelRuntime;
116
162
  const buildContext = channel.inbound?.buildContext ?? channel.turn?.buildContext;
@@ -1373,6 +1419,13 @@ export async function startOpenclawClawlingGateway(params: StartGatewayParams):
1373
1419
 
1374
1420
  const replyCtx = turn.replyCtx;
1375
1421
  const terminalSendScopeId = `${account.accountId}\0${turn.peer.id}\0${turn.messageId}`;
1422
+ const dispatchCfg = resolveDispatchConfigForOutputVisibility({
1423
+ cfg,
1424
+ account,
1425
+ chatId: turn.peer.id,
1426
+ chatType: turn.peer.kind,
1427
+ agentId: route.agentId,
1428
+ });
1376
1429
  const { dispatcher, replyOptions, markDispatchIdle } =
1377
1430
  createOpenclawClawlingReplyDispatcher({
1378
1431
  cfg,
@@ -1411,7 +1464,7 @@ export async function startOpenclawClawlingGateway(params: StartGatewayParams):
1411
1464
  onSettled: () => markDispatchIdle(),
1412
1465
  run: () =>
1413
1466
  runWithTerminalClawChatSendScope(terminalSendScopeId, () =>
1414
- rt.reply.dispatchReplyFromConfig({ ctx: ctxPayload, cfg, dispatcher, replyOptions }),
1467
+ rt.reply.dispatchReplyFromConfig({ ctx: ctxPayload, cfg: dispatchCfg, dispatcher, replyOptions }),
1415
1468
  ),
1416
1469
  });
1417
1470
  const counts = (dispatchResult as { counts?: Record<string, number> } | undefined)?.counts ?? {};
@@ -367,14 +367,6 @@ export type ClawchatUpdateAccountProfileParams = Static<
367
367
  typeof ClawchatUpdateAccountProfileSchema
368
368
  >;
369
369
 
370
- export const ClawchatUploadMediaFileSchema = Type.Object({
371
- filePath: Type.String({
372
- description:
373
- "Absolute local path of the non-avatar media/file to upload to ClawChat for a ClawChat-accessible URL (max 20MB)",
374
- }),
375
- });
376
- export type ClawchatUploadMediaFileParams = Static<typeof ClawchatUploadMediaFileSchema>;
377
-
378
370
  export const ClawchatUploadAvatarImageSchema = Type.Object({
379
371
  filePath: Type.String({
380
372
  description:
package/src/tools.ts CHANGED
@@ -60,7 +60,6 @@ import {
60
60
  ClawchatToggleMomentReactionSchema,
61
61
  ClawchatUpdateAccountProfileSchema,
62
62
  ClawchatUploadAvatarImageSchema,
63
- ClawchatUploadMediaFileSchema,
64
63
  type ClawchatMemoryEditParams,
65
64
  type ClawchatMemoryReadParams,
66
65
  type ClawchatMemorySearchParams,
@@ -85,7 +84,6 @@ import {
85
84
  type ClawchatToggleMomentReactionParams,
86
85
  type ClawchatUpdateAccountProfileParams,
87
86
  type ClawchatUploadAvatarImageParams,
88
- type ClawchatUploadMediaFileParams,
89
87
  } from "./tools-schema.ts";
90
88
 
91
89
  const MAX_UPLOAD_BYTES = 20 * 1024 * 1024;
@@ -1292,50 +1290,7 @@ export function registerOpenclawClawlingTools(
1292
1290
  { name: "clawchat_upload_avatar_image" },
1293
1291
  );
1294
1292
 
1295
- api.registerTool(
1296
- {
1297
- name: "clawchat_upload_media_file",
1298
- label: "Upload ClawChat Media File",
1299
- description: toolDescription(
1300
- "Upload an absolute local file/media path to ClawChat media storage (max 20MB) and return a ClawChat-accessible public/shareable URL. " +
1301
- "TRIGGER — invoke when the user provides an absolute local file path and asks to upload, share, or create a ClawChat-accessible link for that file. " +
1302
- "Do not use this tool to send an attachment in the current chat; use the current runtime's native media-send mechanism instead (for example, MEDIA:/absolute/local/path where supported). " +
1303
- "Do not use this for account avatar changes; use `clawchat_upload_avatar_image` for avatar images. Do not use this just to mirror local assistant identity.",
1304
- ),
1305
- parameters: ClawchatUploadMediaFileSchema,
1306
- async execute(_callId, params) {
1307
- return await recordClawchatToolCall("clawchat_upload_media_file", params, async () => {
1308
- const p = params as ClawchatUploadMediaFileParams;
1309
- if (!p.filePath || !path.isAbsolute(p.filePath)) {
1310
- return validationError("clawchat-plugin-openclaw: filePath must be an absolute local path");
1311
- }
1312
- let stat: fs.Stats;
1313
- try {
1314
- stat = fs.statSync(p.filePath);
1315
- } catch (err) {
1316
- return validationError(
1317
- `clawchat-plugin-openclaw: cannot stat ${p.filePath}: ${err instanceof Error ? err.message : String(err)}`,
1318
- );
1319
- }
1320
- if (!stat.isFile()) {
1321
- return validationError(`clawchat-plugin-openclaw: ${p.filePath} is not a regular file`);
1322
- }
1323
- if (stat.size > MAX_UPLOAD_BYTES) {
1324
- return validationError(
1325
- `clawchat-plugin-openclaw: file too large (${stat.size} bytes; max 20MB)`,
1326
- );
1327
- }
1328
- const buffer = fs.readFileSync(p.filePath);
1329
- const filename = path.basename(p.filePath);
1330
- const mime = inferMimeFromPath(p.filePath);
1331
- return await withClient((c) => c.uploadMedia({ buffer, filename, mime }));
1332
- });
1333
- },
1334
- },
1335
- { name: "clawchat_upload_media_file" },
1336
- );
1337
-
1338
1293
  api.logger.debug?.(
1339
- "clawchat-plugin-openclaw: registered 27 clawchat_* tools (get_account_profile, get_user_profile, list_account_friends, send_friend_request, list_friend_requests, accept_friend_request, reject_friend_request, remove_friend, search_users, get_conversation, mention_message, list_moments, create_moment, delete_moment, toggle_moment_reaction, create_moment_comment, reply_moment_comment, delete_moment_comment, update_account_profile, upload_avatar_image, upload_media_file, memory_search, memory_read, memory_write, memory_edit, metadata_sync, metadata_update)",
1294
+ "clawchat-plugin-openclaw: registered 26 clawchat_* tools (get_account_profile, get_user_profile, list_account_friends, send_friend_request, list_friend_requests, accept_friend_request, reject_friend_request, remove_friend, search_users, get_conversation, mention_message, list_moments, create_moment, delete_moment, toggle_moment_reaction, create_moment_comment, reply_moment_comment, delete_moment_comment, update_account_profile, upload_avatar_image, memory_search, memory_read, memory_write, memory_edit, metadata_sync, metadata_update)",
1340
1295
  );
1341
1296
  }