@2en/clawly-plugins 1.17.0 → 1.17.2
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/cron-hook.ts +1 -1
- package/gateway/index.ts +0 -2
- package/gateway/inject.ts +1 -32
- package/index.ts +0 -3
- package/package.json +1 -2
- package/tools/clawly-send-message.ts +5 -5
- package/channel.ts +0 -56
package/cron-hook.ts
CHANGED
|
@@ -24,7 +24,7 @@ const DELIVERY_SUFFIX = [
|
|
|
24
24
|
'---',
|
|
25
25
|
'DELIVERY INSTRUCTIONS (mandatory):',
|
|
26
26
|
'When done, you MUST deliver your result to the user:',
|
|
27
|
-
'1. Call the clawly_send_message tool with a brief, natural summary of your result.',
|
|
27
|
+
'1. Call the clawly_send_message tool with role="assistant" and a brief, natural summary of your result.',
|
|
28
28
|
'2. Call clawly_is_user_online to check if the user is online.',
|
|
29
29
|
'3. If offline, also call clawly_send_app_push with a short notification.',
|
|
30
30
|
].join('\n')
|
package/gateway/index.ts
CHANGED
|
@@ -2,7 +2,6 @@ import type {PluginApi} from '../index'
|
|
|
2
2
|
import {registerAgentSend} from './agent'
|
|
3
3
|
import {registerChannelsConfigure} from './channels-configure'
|
|
4
4
|
import {registerClawhub2gateway} from './clawhub2gateway'
|
|
5
|
-
import {registerInject} from './inject'
|
|
6
5
|
import {registerMemoryBrowser} from './memory'
|
|
7
6
|
import {registerNotification} from './notification'
|
|
8
7
|
import {registerOfflinePush} from './offline-push'
|
|
@@ -13,7 +12,6 @@ export function registerGateway(api: PluginApi) {
|
|
|
13
12
|
registerPresence(api)
|
|
14
13
|
registerNotification(api)
|
|
15
14
|
registerAgentSend(api)
|
|
16
|
-
registerInject(api)
|
|
17
15
|
registerMemoryBrowser(api)
|
|
18
16
|
registerClawhub2gateway(api)
|
|
19
17
|
registerPlugins(api)
|
package/gateway/inject.ts
CHANGED
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
* Assistant-role message injection — inject messages into the chat transcript
|
|
3
3
|
* as role: "assistant" without triggering an agent run.
|
|
4
4
|
*
|
|
5
|
-
* Method:
|
|
6
|
-
* - clawly.inject({ sessionKey, message, label? }) → { ok, messageId }
|
|
7
|
-
*
|
|
8
5
|
* Wraps the core `chat.inject` OpenClaw gateway method.
|
|
6
|
+
* Used by clawly-send-message tool.
|
|
9
7
|
*/
|
|
10
8
|
|
|
11
9
|
import {$} from 'zx'
|
|
@@ -68,32 +66,3 @@ export async function resolveSessionKey(agentId: string, api: PluginApi): Promis
|
|
|
68
66
|
throw new Error(`sessions.resolve failed: ${msg}`)
|
|
69
67
|
}
|
|
70
68
|
}
|
|
71
|
-
|
|
72
|
-
export function registerInject(api: PluginApi) {
|
|
73
|
-
api.registerGatewayMethod('clawly.inject', async ({params, respond}) => {
|
|
74
|
-
const sessionKey = typeof params.sessionKey === 'string' ? params.sessionKey.trim() : ''
|
|
75
|
-
const message = typeof params.message === 'string' ? params.message.trim() : ''
|
|
76
|
-
const label = typeof params.label === 'string' ? params.label.trim() : undefined
|
|
77
|
-
|
|
78
|
-
if (!sessionKey) {
|
|
79
|
-
respond(false, undefined, {code: 'invalid_params', message: 'sessionKey is required'})
|
|
80
|
-
return
|
|
81
|
-
}
|
|
82
|
-
if (!message) {
|
|
83
|
-
respond(false, undefined, {code: 'invalid_params', message: 'message is required'})
|
|
84
|
-
return
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
try {
|
|
88
|
-
const result = await injectAssistantMessage({sessionKey, message, label}, api)
|
|
89
|
-
respond(true, result)
|
|
90
|
-
} catch (err) {
|
|
91
|
-
respond(false, undefined, {
|
|
92
|
-
code: 'inject_failed',
|
|
93
|
-
message: err instanceof Error ? err.message : String(err),
|
|
94
|
-
})
|
|
95
|
-
}
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
api.logger.info('inject: registered clawly.inject method')
|
|
99
|
-
}
|
package/index.ts
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
* - clawly.notification.send — send a push notification directly
|
|
9
9
|
* - clawly.agent.send — trigger agent turn with a message (+ optional push)
|
|
10
10
|
* - clawly.agent.echo — echo-wrapped agent message (bypasses LLM)
|
|
11
|
-
* - clawly.inject — inject assistant-role message into transcript (wraps chat.inject)
|
|
12
11
|
* - memory-browser.list — list all .md files in the memory directory
|
|
13
12
|
* - memory-browser.get — return content of a single .md file
|
|
14
13
|
* - clawhub2gateway.* — ClawHub CLI RPC bridge (search/install/update/list/explore/inspect/star/unstar)
|
|
@@ -30,7 +29,6 @@
|
|
|
30
29
|
|
|
31
30
|
import {registerAutoPair} from './auto-pair'
|
|
32
31
|
import {registerCalendar} from './calendar'
|
|
33
|
-
import {registerClawlyCronChannel} from './channel'
|
|
34
32
|
import {registerCommands} from './command'
|
|
35
33
|
import {registerCronHook} from './cron-hook'
|
|
36
34
|
import {registerEmail} from './email'
|
|
@@ -115,7 +113,6 @@ export default {
|
|
|
115
113
|
registerOutboundHttpRoute(api)
|
|
116
114
|
registerCommands(api)
|
|
117
115
|
registerTools(api)
|
|
118
|
-
registerClawlyCronChannel(api)
|
|
119
116
|
registerCronHook(api)
|
|
120
117
|
registerGateway(api)
|
|
121
118
|
registerAutoPair(api)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@2en/clawly-plugins",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.2",
|
|
4
4
|
"module": "index.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
"index.ts",
|
|
20
20
|
"auto-pair.ts",
|
|
21
21
|
"calendar.ts",
|
|
22
|
-
"channel.ts",
|
|
23
22
|
"cron-hook.ts",
|
|
24
23
|
"email.ts",
|
|
25
24
|
"gateway-fetch.ts",
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Agent tool: clawly_send_message — send a message to the main session
|
|
3
3
|
* agent from an isolated context (e.g. cron job).
|
|
4
4
|
*
|
|
5
|
-
* - role: "
|
|
6
|
-
* - role: "assistant" — injects into transcript via chat.inject (no agent trigger,
|
|
5
|
+
* - role: "assistant" (default) — injects into transcript via chat.inject (no agent trigger,
|
|
7
6
|
* since the calling agent has already decided to send)
|
|
7
|
+
* - role: "user" — triggers agent turn via gateway RPC
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type {PluginApi} from '../index'
|
|
@@ -23,7 +23,7 @@ const parameters: Record<string, unknown> = {
|
|
|
23
23
|
type: 'string',
|
|
24
24
|
enum: ['user', 'assistant'],
|
|
25
25
|
description:
|
|
26
|
-
'Message role. "
|
|
26
|
+
'Message role. "assistant" (default) injects into transcript as assistant without triggering a run. "user" sends as user and triggers agent run.',
|
|
27
27
|
},
|
|
28
28
|
sessionKey: {
|
|
29
29
|
type: 'string',
|
|
@@ -36,7 +36,7 @@ export function registerSendMessageTool(api: PluginApi) {
|
|
|
36
36
|
api.registerTool({
|
|
37
37
|
name: TOOL_NAME,
|
|
38
38
|
description:
|
|
39
|
-
'Send a message to the user via the main session
|
|
39
|
+
'Send a message to the user via the main session. Use this from cron jobs or isolated sessions to deliver results to the user. By default injects as an assistant message (no agent run). Set role to "user" to trigger an agent run instead.',
|
|
40
40
|
parameters,
|
|
41
41
|
async execute(_toolCallId, params) {
|
|
42
42
|
const message = typeof params.message === 'string' ? params.message.trim() : ''
|
|
@@ -45,7 +45,7 @@ export function registerSendMessageTool(api: PluginApi) {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
const agent = typeof params.agent === 'string' ? params.agent.trim() : 'clawly'
|
|
48
|
-
const role = params.role === '
|
|
48
|
+
const role = params.role === 'user' ? 'user' : 'assistant'
|
|
49
49
|
|
|
50
50
|
try {
|
|
51
51
|
if (role === 'assistant') {
|
package/channel.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Clawly cron delivery channel — minimal no-op channel registration.
|
|
3
|
-
*
|
|
4
|
-
* With delivery.mode = "none", OpenClaw does not call sendText. This
|
|
5
|
-
* registration exists so that any existing cron jobs referencing
|
|
6
|
-
* channel "clawly-cron" still have a valid target and don't error out.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import type {PluginApi} from './index'
|
|
10
|
-
|
|
11
|
-
export function registerClawlyCronChannel(api: PluginApi) {
|
|
12
|
-
const channelRegistration = {
|
|
13
|
-
plugin: {
|
|
14
|
-
id: 'clawly-cron',
|
|
15
|
-
meta: {
|
|
16
|
-
id: 'clawly-cron',
|
|
17
|
-
label: 'Clawly Cron',
|
|
18
|
-
selectionLabel: 'Clawly Cron (webchat)',
|
|
19
|
-
docsPath: '',
|
|
20
|
-
blurb: 'No-op cron delivery channel (delivery.mode = none)',
|
|
21
|
-
},
|
|
22
|
-
capabilities: {chatTypes: ['dm'] as const},
|
|
23
|
-
config: {
|
|
24
|
-
listAccountIds: () => ['default'],
|
|
25
|
-
resolveAccount: () => ({id: 'default'}),
|
|
26
|
-
defaultAccountId: () => 'default',
|
|
27
|
-
isEnabled: () => true,
|
|
28
|
-
isConfigured: () => true,
|
|
29
|
-
},
|
|
30
|
-
status: {
|
|
31
|
-
buildAccountSnapshot: async () => ({
|
|
32
|
-
accountId: 'default',
|
|
33
|
-
enabled: true,
|
|
34
|
-
configured: true,
|
|
35
|
-
running: true,
|
|
36
|
-
}),
|
|
37
|
-
buildChannelSummary: async () => ({
|
|
38
|
-
configured: true,
|
|
39
|
-
running: true,
|
|
40
|
-
}),
|
|
41
|
-
},
|
|
42
|
-
outbound: {
|
|
43
|
-
deliveryMode: 'direct' as const,
|
|
44
|
-
sendText: async () => {
|
|
45
|
-
return {channel: 'clawly-cron', messageId: crypto.randomUUID()}
|
|
46
|
-
},
|
|
47
|
-
sendMedia: async () => {
|
|
48
|
-
return {channel: 'clawly-cron', messageId: crypto.randomUUID()}
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
api.registerChannel(channelRegistration)
|
|
55
|
-
api.logger.info('channel: registered clawly-cron delivery channel (no-op)')
|
|
56
|
-
}
|