@2en/clawly-plugins 1.17.1 → 1.17.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/gateway/index.ts +0 -2
- package/gateway/inject.ts +1 -32
- package/gateway/memory.ts +4 -1
- package/index.ts +0 -3
- package/package.json +1 -2
- package/channel.ts +0 -56
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/gateway/memory.ts
CHANGED
|
@@ -77,10 +77,13 @@ function resolveWorkspaceRoot(api: PluginApi, profile?: string): string {
|
|
|
77
77
|
const configPath = configString(cfg, 'memoryDir')
|
|
78
78
|
if (configPath) return path.dirname(configPath) // strip /memory if configured
|
|
79
79
|
|
|
80
|
+
const stateDir = resolveStateDir(api)
|
|
80
81
|
const baseDir =
|
|
81
82
|
process.env.OPENCLAW_WORKSPACE ??
|
|
82
83
|
readAgentWorkspace(api) ??
|
|
83
|
-
|
|
84
|
+
(stateDir
|
|
85
|
+
? path.join(stateDir, 'workspace')
|
|
86
|
+
: path.join(os.homedir(), '.openclaw', 'workspace'))
|
|
84
87
|
if (profile && profile !== 'main') {
|
|
85
88
|
const parentDir = path.dirname(baseDir)
|
|
86
89
|
const baseName = path.basename(baseDir)
|
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.3",
|
|
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",
|
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
|
-
}
|