@a2hmarket/a2hmarket 0.7.2 → 0.7.3
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/package.json +1 -1
- package/scripts/install.mjs +3 -5
- package/src/agent-service.ts +4 -1
- package/src/tools/send.ts +7 -3
- package/src/tools/works.ts +2 -6
package/package.json
CHANGED
package/scripts/install.mjs
CHANGED
|
@@ -722,11 +722,11 @@ async function main() {
|
|
|
722
722
|
|
|
723
723
|
const prompt2 = createPrompt();
|
|
724
724
|
const choice = await prompt2.ask(
|
|
725
|
-
`选择通知渠道 (1-${channels.length}
|
|
726
|
-
"",
|
|
725
|
+
`选择通知渠道 (1-${channels.length},回车默认 1)`,
|
|
726
|
+
"1",
|
|
727
727
|
);
|
|
728
728
|
|
|
729
|
-
|
|
729
|
+
{
|
|
730
730
|
const idx = parseInt(choice, 10) - 1;
|
|
731
731
|
if (idx >= 0 && idx < channels.length) {
|
|
732
732
|
const chosen = channels[idx];
|
|
@@ -752,8 +752,6 @@ async function main() {
|
|
|
752
752
|
log(` ${WARN} 未输入目标 ID,跳过通知配置`);
|
|
753
753
|
}
|
|
754
754
|
}
|
|
755
|
-
} else {
|
|
756
|
-
log(` ${DIM}跳过通知配置${RESET}`);
|
|
757
755
|
}
|
|
758
756
|
prompt2.close();
|
|
759
757
|
} else {
|
package/src/agent-service.ts
CHANGED
|
@@ -124,7 +124,10 @@ export async function startAgentService(ctx: AgentServiceContext): Promise<void>
|
|
|
124
124
|
payload && typeof payload === "object" && "text" in payload
|
|
125
125
|
? String((payload as { text?: string }).text ?? "")
|
|
126
126
|
: "";
|
|
127
|
-
if (!replyText.trim())
|
|
127
|
+
if (!replyText.trim()) {
|
|
128
|
+
ctx.log.info(`deliver called with empty reply for ${event.senderId}, skipping`);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
128
131
|
|
|
129
132
|
// Convert markdown tables for readability
|
|
130
133
|
const tableMode = runtime.channel.text.resolveMarkdownTableMode({
|
package/src/tools/send.ts
CHANGED
|
@@ -10,9 +10,10 @@ export function registerSendTool(api: OpenClawPluginApi, creds: A2HCredentials)
|
|
|
10
10
|
api.registerTool({
|
|
11
11
|
name: "a2h_send",
|
|
12
12
|
description:
|
|
13
|
-
"Send an A2A message to another agent.
|
|
14
|
-
"
|
|
15
|
-
"
|
|
13
|
+
"Send an A2A message to another agent. ONLY use this for proactive outreach (e.g. human asks you to contact an agent). " +
|
|
14
|
+
"Do NOT use this to reply to inbound messages — reply with plain text instead, the system sends it automatically. " +
|
|
15
|
+
"Supports text, payment QR code (payload.payment_qr), " +
|
|
16
|
+
"external attachment (payload.attachment with url/source/name/mime_type), and arbitrary extra payload fields.",
|
|
16
17
|
parameters: {
|
|
17
18
|
type: "object",
|
|
18
19
|
properties: {
|
|
@@ -44,6 +45,9 @@ export function registerSendTool(api: OpenClawPluginApi, creds: A2HCredentials)
|
|
|
44
45
|
},
|
|
45
46
|
execute: async (params: Record<string, unknown>) => {
|
|
46
47
|
const targetAgentId = params.target_agent_id as string;
|
|
48
|
+
if (!targetAgentId || targetAgentId === "undefined") {
|
|
49
|
+
throw new Error("target_agent_id is required and cannot be empty. If you are replying to an inbound message, reply with plain text instead of calling a2h_send.");
|
|
50
|
+
}
|
|
47
51
|
const messageType = (params.message_type as string) || "chat.request";
|
|
48
52
|
|
|
49
53
|
// Build payload
|
package/src/tools/works.ts
CHANGED
|
@@ -147,19 +147,15 @@ export function registerWorksTools(api: OpenClawPluginApi, client: A2HApiClient)
|
|
|
147
147
|
|
|
148
148
|
api.registerTool({
|
|
149
149
|
name: "a2h_works_delete",
|
|
150
|
-
description: "Delete a works post. This action is irreversible.",
|
|
150
|
+
description: "Delete a works post. This action is irreversible. Only use when the human explicitly asks to delete.",
|
|
151
151
|
parameters: {
|
|
152
152
|
type: "object",
|
|
153
153
|
properties: {
|
|
154
154
|
works_id: { type: "string", description: "Works ID to delete" },
|
|
155
|
-
confirm_human_reviewed: { type: "boolean", description: "Must be true" },
|
|
156
155
|
},
|
|
157
|
-
required: ["works_id"
|
|
156
|
+
required: ["works_id"],
|
|
158
157
|
},
|
|
159
158
|
execute: async (params: Record<string, unknown>) => {
|
|
160
|
-
if (!params.confirm_human_reviewed) {
|
|
161
|
-
throw new Error("confirm_human_reviewed must be true.");
|
|
162
|
-
}
|
|
163
159
|
const data = await client.deleteJSON(`${WORKS_DELETE_API}/${params.works_id}`);
|
|
164
160
|
return { result: JSON.stringify(data ?? { ok: true }, null, 2) };
|
|
165
161
|
},
|