@2en/clawly-plugins 1.1.0 → 1.1.1

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.
Files changed (2) hide show
  1. package/agent-send.ts +9 -4
  2. package/package.json +4 -1
package/agent-send.ts CHANGED
@@ -18,6 +18,7 @@ $.verbose = false
18
18
 
19
19
  interface AgentSendParams {
20
20
  message: string
21
+ agent?: string
21
22
  notificationMessage?: string
22
23
  }
23
24
 
@@ -29,10 +30,11 @@ interface AgentSendResult {
29
30
 
30
31
  async function runAgentMessage(
31
32
  message: string,
33
+ agent: string,
32
34
  api: PluginApi,
33
35
  ): Promise<{ok: boolean; error?: string}> {
34
36
  try {
35
- await $`openclaw agent --agent main --message ${message}`
37
+ await $`openclaw agent --agent ${agent} --message ${message}`
36
38
  return {ok: true}
37
39
  } catch (err) {
38
40
  const msg = err instanceof Error ? err.message : String(err)
@@ -46,7 +48,8 @@ async function handleAgentSend(
46
48
  params: AgentSendParams,
47
49
  api: PluginApi,
48
50
  ): Promise<AgentSendResult> {
49
- const {ok} = await runAgentMessage(rawMessage, api)
51
+ const agent = params.agent || 'clawly'
52
+ const {ok} = await runAgentMessage(rawMessage, agent, api)
50
53
  const online = await isClientOnline()
51
54
 
52
55
  let pushSent = false
@@ -66,10 +69,11 @@ export function registerAgentSend(api: PluginApi) {
66
69
  return
67
70
  }
68
71
 
72
+ const agent = typeof params.agent === 'string' ? params.agent.trim() : undefined
69
73
  const notificationMessage =
70
74
  typeof params.notificationMessage === 'string' ? params.notificationMessage : undefined
71
75
 
72
- const result = await handleAgentSend(message, {message, notificationMessage}, api)
76
+ const result = await handleAgentSend(message, {message, agent, notificationMessage}, api)
73
77
  respond(result.ok, result)
74
78
  })
75
79
 
@@ -81,11 +85,12 @@ export function registerAgentSend(api: PluginApi) {
81
85
  return
82
86
  }
83
87
 
88
+ const agent = typeof params.agent === 'string' ? params.agent.trim() : undefined
84
89
  const notificationMessage =
85
90
  typeof params.notificationMessage === 'string' ? params.notificationMessage : undefined
86
91
 
87
92
  const echoMessage = `/clawly_echo ${message}`
88
- const result = await handleAgentSend(echoMessage, {message, notificationMessage}, api)
93
+ const result = await handleAgentSend(echoMessage, {message, agent, notificationMessage}, api)
89
94
  respond(result.ok, result)
90
95
  })
91
96
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@2en/clawly-plugins",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "repository": {
@@ -20,6 +20,9 @@
20
20
  "agent-send.ts",
21
21
  "openclaw.plugin.json"
22
22
  ],
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
23
26
  "openclaw": {
24
27
  "extensions": [
25
28
  "./index.ts"