@2en/clawly-plugins 1.24.2 → 1.24.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/command/clawly_echo.ts +1 -1
- package/command/index.ts +1 -1
- package/gateway/agent.ts +1 -1
- package/gateway/clawhub2gateway.ts +1 -1
- package/gateway/config-repair.ts +1 -1
- package/gateway/index.ts +1 -1
- package/gateway/inject.ts +1 -1
- package/gateway/memory.ts +1 -1
- package/gateway/notification.ts +1 -1
- package/gateway/offline-push.test.ts +1 -1
- package/gateway/offline-push.ts +1 -1
- package/gateway/pairing.ts +1 -1
- package/gateway/plugins.ts +1 -1
- package/gateway/presence.ts +1 -1
- package/gateway/version.ts +9 -1
- package/index.ts +8 -129
- package/internal/hooks/auto-update.ts +1 -1
- package/package.json +3 -1
- package/tools/clawly-is-user-online.ts +1 -1
- package/tools/clawly-send-app-push.ts +1 -1
- package/tools/clawly-send-message.ts +1 -1
- package/tools/index.ts +1 -1
- package/types/openclaw.ts +963 -0
- package/types.ts +131 -0
package/command/clawly_echo.ts
CHANGED
package/command/index.ts
CHANGED
package/gateway/agent.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import {$} from 'zx'
|
|
16
|
-
import type {PluginApi} from '../
|
|
16
|
+
import type {PluginApi} from '../types'
|
|
17
17
|
import {stripCliLogs} from '../lib/stripCliLogs'
|
|
18
18
|
import {sendPushNotification} from './notification'
|
|
19
19
|
import {isClientOnline} from './presence'
|
package/gateway/config-repair.ts
CHANGED
package/gateway/index.ts
CHANGED
package/gateway/inject.ts
CHANGED
package/gateway/memory.ts
CHANGED
|
@@ -13,7 +13,7 @@ import fs from 'node:fs/promises'
|
|
|
13
13
|
import os from 'node:os'
|
|
14
14
|
import path from 'node:path'
|
|
15
15
|
|
|
16
|
-
import type {PluginApi} from '../
|
|
16
|
+
import type {PluginApi} from '../types'
|
|
17
17
|
|
|
18
18
|
function isRecord(v: unknown): v is Record<string, unknown> {
|
|
19
19
|
return Boolean(v && typeof v === 'object' && !Array.isArray(v))
|
package/gateway/notification.ts
CHANGED
package/gateway/offline-push.ts
CHANGED
package/gateway/pairing.ts
CHANGED
package/gateway/plugins.ts
CHANGED
|
@@ -10,7 +10,7 @@ import fs from 'node:fs'
|
|
|
10
10
|
import path from 'node:path'
|
|
11
11
|
import {$} from 'zx'
|
|
12
12
|
|
|
13
|
-
import type {PluginApi} from '../
|
|
13
|
+
import type {PluginApi} from '../types'
|
|
14
14
|
import {LruCache} from '../lib/lruCache'
|
|
15
15
|
import {isUpdateAvailable} from '../lib/semver'
|
|
16
16
|
import {stripCliLogs} from '../lib/stripCliLogs'
|
package/gateway/presence.ts
CHANGED
package/gateway/version.ts
CHANGED
|
@@ -4,10 +4,18 @@
|
|
|
4
4
|
* Method: clawly.version({}) → { version: string }
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type {PluginApi} from '../
|
|
7
|
+
import type {PluginApi} from '../types'
|
|
8
8
|
|
|
9
9
|
export function registerVersion(api: PluginApi) {
|
|
10
10
|
api.registerGatewayMethod('clawly.version', async ({respond}) => {
|
|
11
|
+
// Fast path: read from config (no subprocess needed)
|
|
12
|
+
const cached = api.config?.meta?.lastTouchedVersion
|
|
13
|
+
if (cached) {
|
|
14
|
+
respond(true, {version: cached})
|
|
15
|
+
return
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Fallback: exec openclaw --version
|
|
11
19
|
const run = api.runtime.system?.runCommandWithTimeout
|
|
12
20
|
if (!run) {
|
|
13
21
|
respond(false, undefined, {
|
package/index.ts
CHANGED
|
@@ -42,136 +42,15 @@ import {getGatewayConfig} from './gateway-fetch'
|
|
|
42
42
|
import {registerOutboundHook, registerOutboundHttpRoute, registerOutboundMethods} from './outbound'
|
|
43
43
|
import {registerSkillCommandRestore} from './skill-command-restore'
|
|
44
44
|
import {registerTools} from './tools'
|
|
45
|
+
import type {PluginApi} from './types'
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
warn: (message: string) => void
|
|
54
|
-
error: (message: string) => void
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export type PluginRuntime = {
|
|
58
|
-
version?: string
|
|
59
|
-
config?: {
|
|
60
|
-
loadConfig?: (...args: unknown[]) => unknown
|
|
61
|
-
writeConfigFile?: (...args: unknown[]) => unknown
|
|
62
|
-
}
|
|
63
|
-
system?: {
|
|
64
|
-
runCommandWithTimeout?: (
|
|
65
|
-
argv: string[],
|
|
66
|
-
opts: {timeoutMs: number; cwd?: string; env?: Record<string, string | undefined>},
|
|
67
|
-
) => Promise<{
|
|
68
|
-
stdout: string
|
|
69
|
-
stderr: string
|
|
70
|
-
code: number | null
|
|
71
|
-
signal: string | null
|
|
72
|
-
killed: boolean
|
|
73
|
-
}>
|
|
74
|
-
}
|
|
75
|
-
state?: {
|
|
76
|
-
resolveStateDir?: (env?: NodeJS.ProcessEnv) => string
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export type GatewayRequestHandler = (opts: {
|
|
81
|
-
params: Record<string, unknown>
|
|
82
|
-
respond: (ok: boolean, payload?: unknown, error?: {code?: string; message?: string}) => void
|
|
83
|
-
}) => Promise<void> | void
|
|
84
|
-
|
|
85
|
-
export type PluginHookName =
|
|
86
|
-
| 'before_agent_start'
|
|
87
|
-
| 'agent_end'
|
|
88
|
-
| 'before_compaction'
|
|
89
|
-
| 'after_compaction'
|
|
90
|
-
| 'before_reset'
|
|
91
|
-
| 'message_received'
|
|
92
|
-
| 'message_sending'
|
|
93
|
-
| 'message_sent'
|
|
94
|
-
| 'before_tool_call'
|
|
95
|
-
| 'after_tool_call'
|
|
96
|
-
| 'tool_result_persist'
|
|
97
|
-
| 'session_start'
|
|
98
|
-
| 'session_end'
|
|
99
|
-
| 'gateway_start'
|
|
100
|
-
| 'gateway_stop'
|
|
101
|
-
|
|
102
|
-
export type PluginApi = {
|
|
103
|
-
/** id from openclaw.plugin.json */
|
|
104
|
-
id: string
|
|
105
|
-
/** name from openclaw.plugin.json */
|
|
106
|
-
name: string
|
|
107
|
-
/** version from openclaw.plugin.json */
|
|
108
|
-
version?: string
|
|
109
|
-
/** description from openclaw.plugin.json */
|
|
110
|
-
description?: string
|
|
111
|
-
source?: string
|
|
112
|
-
config?: Record<string, unknown>
|
|
113
|
-
pluginConfig?: Record<string, unknown>
|
|
114
|
-
runtime: PluginRuntime
|
|
115
|
-
logger: PluginLogger
|
|
116
|
-
registerGatewayMethod: (method: string, handler: GatewayRequestHandler) => void
|
|
117
|
-
registerTool: (
|
|
118
|
-
tool: {
|
|
119
|
-
name: string
|
|
120
|
-
description: string
|
|
121
|
-
parameters: Record<string, unknown>
|
|
122
|
-
execute: (
|
|
123
|
-
toolCallId: string,
|
|
124
|
-
params: Record<string, unknown>,
|
|
125
|
-
) => Promise<{content: Array<{type: string; text: string}>; details?: unknown}>
|
|
126
|
-
},
|
|
127
|
-
opts?: {optional?: boolean},
|
|
128
|
-
) => void
|
|
129
|
-
registerHook?: (
|
|
130
|
-
events: string | string[],
|
|
131
|
-
handler: (...args: unknown[]) => unknown,
|
|
132
|
-
opts?: {name?: string; description?: string; register?: boolean},
|
|
133
|
-
) => void
|
|
134
|
-
registerCommand: (cmd: {
|
|
135
|
-
name: string
|
|
136
|
-
description?: string
|
|
137
|
-
acceptsArgs?: boolean
|
|
138
|
-
requireAuth?: boolean
|
|
139
|
-
handler: (ctx: {
|
|
140
|
-
args?: string
|
|
141
|
-
[key: string]: unknown
|
|
142
|
-
}) => Promise<{text: string}> | {text: string}
|
|
143
|
-
}) => void
|
|
144
|
-
registerChannel: (registration: {plugin: unknown; dock?: unknown}) => void
|
|
145
|
-
registerHttpHandler?: (
|
|
146
|
-
handler: (
|
|
147
|
-
req: import('node:http').IncomingMessage,
|
|
148
|
-
res: import('node:http').ServerResponse,
|
|
149
|
-
) => Promise<boolean> | boolean,
|
|
150
|
-
) => void
|
|
151
|
-
registerHttpRoute: (params: {
|
|
152
|
-
path: string
|
|
153
|
-
handler: (
|
|
154
|
-
req: import('node:http').IncomingMessage,
|
|
155
|
-
res: import('node:http').ServerResponse,
|
|
156
|
-
) => Promise<void> | void
|
|
157
|
-
}) => void
|
|
158
|
-
registerCli?: (
|
|
159
|
-
registrar: (...args: unknown[]) => void | Promise<void>,
|
|
160
|
-
opts?: {commands?: string[]},
|
|
161
|
-
) => void
|
|
162
|
-
registerService?: (service: {
|
|
163
|
-
id: string
|
|
164
|
-
start: (...args: unknown[]) => void | Promise<void>
|
|
165
|
-
stop?: (...args: unknown[]) => void | Promise<void>
|
|
166
|
-
}) => void
|
|
167
|
-
registerProvider?: (provider: Record<string, unknown>) => void
|
|
168
|
-
resolvePath?: (input: string) => string
|
|
169
|
-
on: (
|
|
170
|
-
hookName: PluginHookName | (string & {}),
|
|
171
|
-
handler: (...args: any[]) => any,
|
|
172
|
-
opts?: {priority?: number},
|
|
173
|
-
) => void
|
|
174
|
-
}
|
|
47
|
+
export type {
|
|
48
|
+
GatewayRequestHandler,
|
|
49
|
+
PluginApi,
|
|
50
|
+
PluginHookName,
|
|
51
|
+
PluginLogger,
|
|
52
|
+
PluginRuntime,
|
|
53
|
+
} from './types'
|
|
175
54
|
|
|
176
55
|
export default {
|
|
177
56
|
id: 'clawly-plugins',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@2en/clawly-plugins",
|
|
3
|
-
"version": "1.24.
|
|
3
|
+
"version": "1.24.3",
|
|
4
4
|
"module": "index.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
"lib",
|
|
18
18
|
"tools",
|
|
19
19
|
"index.ts",
|
|
20
|
+
"types.ts",
|
|
21
|
+
"types",
|
|
20
22
|
"auto-pair.ts",
|
|
21
23
|
"calendar.ts",
|
|
22
24
|
"config-setup.ts",
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* https://docs.expo.dev/push-notifications/sending-notifications/
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type {PluginApi} from '../
|
|
9
|
+
import type {PluginApi} from '../types'
|
|
10
10
|
import {sendPushNotification} from '../gateway/notification'
|
|
11
11
|
|
|
12
12
|
const TOOL_NAME = 'clawly_send_app_push'
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* - role: "user" — triggers agent turn via gateway RPC
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import type {PluginApi} from '../
|
|
10
|
+
import type {PluginApi} from '../types'
|
|
11
11
|
import {callAgentGateway} from '../gateway/agent'
|
|
12
12
|
import {injectAssistantMessage, resolveSessionKey} from '../gateway/inject'
|
|
13
13
|
|
package/tools/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {PluginApi} from '../
|
|
1
|
+
import type {PluginApi} from '../types'
|
|
2
2
|
import {registerIsUserOnlineTool} from './clawly-is-user-online'
|
|
3
3
|
import {registerSendAppPushTool} from './clawly-send-app-push'
|
|
4
4
|
import {registerSendMessageTool} from './clawly-send-message'
|