@2en/clawly-plugins 1.24.2 → 1.24.4

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.
@@ -3,7 +3,7 @@
3
3
  * invoking the LLM.
4
4
  */
5
5
 
6
- import type {PluginApi} from '../index'
6
+ import type {PluginApi} from '../types'
7
7
 
8
8
  export function registerEchoCommand(api: PluginApi) {
9
9
  api.registerCommand({
package/command/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type {PluginApi} from '../index'
1
+ import type {PluginApi} from '../types'
2
2
  import {registerEchoCommand} from './clawly_echo'
3
3
 
4
4
  export function registerCommands(api: PluginApi) {
package/config-setup.ts CHANGED
@@ -136,9 +136,11 @@ export function patchGateway(config: Record<string, unknown>): boolean {
136
136
  dirty = true
137
137
  }
138
138
 
139
- const desiredProxies = ['0.0.0.0/0']
140
- if (JSON.stringify(gateway.trustedProxies) !== JSON.stringify(desiredProxies)) {
141
- gateway.trustedProxies = desiredProxies
139
+ // trustedProxies: remove if present.
140
+ // OpenClaw v2026.2.19 hardened resolveClientIp to fail-closed, making
141
+ // trustedProxies: ['0.0.0.0/0'] actively break CLI auto-pair.
142
+ if (gateway.trustedProxies != null) {
143
+ delete gateway.trustedProxies
142
144
  dirty = true
143
145
  }
144
146
 
package/gateway/agent.ts CHANGED
@@ -13,7 +13,7 @@
13
13
  */
14
14
 
15
15
  import {$} from 'zx'
16
- import type {PluginApi} from '../index'
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'
@@ -19,7 +19,7 @@
19
19
  import fs from 'node:fs/promises'
20
20
  import path from 'node:path'
21
21
 
22
- import type {PluginApi} from '../index'
22
+ import type {PluginApi} from '../types'
23
23
 
24
24
  type JsonSchema = Record<string, unknown>
25
25
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  import path from 'node:path'
10
10
 
11
- import type {PluginApi} from '../index'
11
+ import type {PluginApi} from '../types'
12
12
  import {
13
13
  EXTRA_GATEWAY_MODELS,
14
14
  PROVIDER_NAME,
package/gateway/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type {PluginApi} from '../index'
1
+ import type {PluginApi} from '../types'
2
2
  import {registerAgentSend} from './agent'
3
3
  import {registerClawhub2gateway} from './clawhub2gateway'
4
4
  import {registerConfigRepair} from './config-repair'
package/gateway/inject.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import {$} from 'zx'
10
- import type {PluginApi} from '../index'
10
+ import type {PluginApi} from '../types'
11
11
  import {stripCliLogs} from '../lib/stripCliLogs'
12
12
 
13
13
  $.verbose = false
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 '../index'
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))
@@ -14,7 +14,7 @@ import os from 'node:os'
14
14
  import path from 'node:path'
15
15
 
16
16
  import {$} from 'zx'
17
- import type {PluginApi} from '../index'
17
+ import type {PluginApi} from '../types'
18
18
  import {stripCliLogs} from '../lib/stripCliLogs'
19
19
 
20
20
  $.verbose = false
@@ -1,5 +1,5 @@
1
1
  import {beforeEach, describe, expect, mock, test} from 'bun:test'
2
- import type {PluginApi} from '../index'
2
+ import type {PluginApi} from '../types'
3
3
  import {
4
4
  getLastAssistantPreview,
5
5
  getLastAssistantText,
@@ -9,7 +9,7 @@
9
9
  * logic from apps/mobile/lib/messageFilter.ts.
10
10
  */
11
11
 
12
- import type {PluginApi} from '../index'
12
+ import type {PluginApi} from '../types'
13
13
  import {sendPushNotification} from './notification'
14
14
  import {isClientOnline} from './presence'
15
15
 
@@ -1,5 +1,5 @@
1
1
  import {$} from 'zx'
2
- import type {PluginApi} from '../index'
2
+ import type {PluginApi} from '../types'
3
3
  import {stripCliLogs} from '../lib/stripCliLogs'
4
4
 
5
5
  $.verbose = false
@@ -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 '../index'
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'
@@ -7,7 +7,7 @@
7
7
 
8
8
  import {$} from 'zx'
9
9
 
10
- import type {PluginApi} from '../index'
10
+ import type {PluginApi} from '../types'
11
11
  import {stripCliLogs} from '../lib/stripCliLogs'
12
12
 
13
13
  $.verbose = false
@@ -4,10 +4,18 @@
4
4
  * Method: clawly.version({}) → { version: string }
5
5
  */
6
6
 
7
- import type {PluginApi} from '../index'
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
- // Types aligned with OpenClaw plugin API (openclaw/src/plugins/types.ts)
48
- // ---------------------------------------------------------------------------
49
-
50
- export type PluginLogger = {
51
- debug?: (message: string) => void
52
- info: (message: string) => void
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',
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import {$} from 'zx'
6
6
 
7
- import type {PluginApi} from '../../index'
7
+ import type {PluginApi} from '../../types'
8
8
 
9
9
  $.verbose = false
10
10
 
package/outbound.ts CHANGED
@@ -85,6 +85,17 @@ export function registerOutboundMethods(api: PluginApi) {
85
85
  const dest = outboundFilePath(rawPath)
86
86
 
87
87
  if (!(await fileExists(dest))) {
88
+ // Fallback: TTS writes directly to /tmp/openclaw/ and the tool_result_persist hook
89
+ // only fires for agent tool calls, not tts.convert RPC calls. Read the source file
90
+ // directly if it lives in the known-safe TTS temp directory.
91
+ if (rawPath.startsWith('/tmp/openclaw/') && (await fileExists(rawPath))) {
92
+ const buffer = await fsp.readFile(rawPath)
93
+ api.logger.info(
94
+ `clawly.file.getOutbound: served from source ${rawPath} (${buffer.length} bytes)`,
95
+ )
96
+ respond(true, {base64: buffer.toString('base64')})
97
+ return
98
+ }
88
99
  api.logger.warn(`outbound: file not found: ${rawPath} ${dest}`)
89
100
  respond(false, undefined, {code: 'not_found', message: 'outbound file not found'})
90
101
  return
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@2en/clawly-plugins",
3
- "version": "1.24.2",
3
+ "version": "1.24.4",
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",
@@ -4,7 +4,7 @@
4
4
  *
5
5
  */
6
6
 
7
- import type {PluginApi} from '../index'
7
+ import type {PluginApi} from '../types'
8
8
  import {isClientOnline} from '../gateway/presence'
9
9
 
10
10
  const TOOL_NAME = 'clawly_is_user_online'
@@ -6,7 +6,7 @@
6
6
  * https://docs.expo.dev/push-notifications/sending-notifications/
7
7
  */
8
8
 
9
- import type {PluginApi} from '../index'
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 '../index'
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 '../index'
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'