@2en/clawly-plugins 1.24.7 → 1.24.8-beta.0
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/config-setup.ts +9 -19
- package/gateway/clawhub2gateway.ts +1 -5
- package/gateway/config-repair.ts +1 -2
- package/gateway/memory.ts +2 -6
- package/gateway/plugins.ts +3 -7
- package/model-gateway-setup.ts +1 -5
- package/openclaw.plugin.json +0 -1
- package/package.json +1 -1
- package/types.ts +2 -2
package/config-setup.ts
CHANGED
|
@@ -19,7 +19,6 @@ import {
|
|
|
19
19
|
PROVIDER_NAME,
|
|
20
20
|
patchModelGateway,
|
|
21
21
|
readOpenclawConfig,
|
|
22
|
-
resolveStateDir,
|
|
23
22
|
writeOpenclawConfig,
|
|
24
23
|
} from './model-gateway-setup'
|
|
25
24
|
|
|
@@ -29,7 +28,6 @@ export interface ConfigPluginConfig {
|
|
|
29
28
|
workspaceDir?: string
|
|
30
29
|
defaultModel?: string
|
|
31
30
|
defaultImageModel?: string
|
|
32
|
-
sessionMainKey?: string
|
|
33
31
|
elevenlabsApiKey?: string
|
|
34
32
|
elevenlabsVoiceId?: string
|
|
35
33
|
modelGatewayBaseUrl?: string
|
|
@@ -191,20 +189,6 @@ export function patchBrowser(config: Record<string, unknown>): boolean {
|
|
|
191
189
|
return dirty
|
|
192
190
|
}
|
|
193
191
|
|
|
194
|
-
export function patchSessionMainKey(
|
|
195
|
-
config: Record<string, unknown>,
|
|
196
|
-
pc: ConfigPluginConfig,
|
|
197
|
-
): boolean {
|
|
198
|
-
if (!pc.sessionMainKey) return false
|
|
199
|
-
|
|
200
|
-
const session = (config.session ?? {}) as Record<string, unknown>
|
|
201
|
-
if (session.mainKey === pc.sessionMainKey) return false
|
|
202
|
-
|
|
203
|
-
session.mainKey = pc.sessionMainKey
|
|
204
|
-
config.session = session
|
|
205
|
-
return true
|
|
206
|
-
}
|
|
207
|
-
|
|
208
192
|
export function patchTts(config: Record<string, unknown>, pc: ConfigPluginConfig): boolean {
|
|
209
193
|
const useProxy = !!(pc.modelGatewayBaseUrl && pc.modelGatewayToken)
|
|
210
194
|
const hasDirectKey = !!pc.elevenlabsApiKey
|
|
@@ -360,8 +344,15 @@ export function patchWebSearch(config: Record<string, unknown>, pc: ConfigPlugin
|
|
|
360
344
|
export function patchSession(config: Record<string, unknown>): boolean {
|
|
361
345
|
let dirty = false
|
|
362
346
|
|
|
363
|
-
// session.
|
|
347
|
+
// Remove deprecated session.mainKey (OpenClaw v2026.1.5 hardcoded it to "main")
|
|
364
348
|
const session = (config.session ?? {}) as Record<string, unknown>
|
|
349
|
+
if (session.mainKey != null) {
|
|
350
|
+
delete session.mainKey
|
|
351
|
+
config.session = session
|
|
352
|
+
dirty = true
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// session.dmScope: enforce
|
|
365
356
|
if (session.dmScope !== 'per-channel-peer') {
|
|
366
357
|
session.dmScope = 'per-channel-peer'
|
|
367
358
|
config.session = session
|
|
@@ -386,7 +377,7 @@ export function patchSession(config: Record<string, unknown>): boolean {
|
|
|
386
377
|
// ---------------------------------------------------------------------------
|
|
387
378
|
|
|
388
379
|
export function setupConfig(api: PluginApi): void {
|
|
389
|
-
const stateDir = resolveStateDir(
|
|
380
|
+
const stateDir = api.runtime.state.resolveStateDir()
|
|
390
381
|
if (!stateDir) {
|
|
391
382
|
api.logger.warn('Cannot resolve state dir — config setup skipped.')
|
|
392
383
|
return
|
|
@@ -400,7 +391,6 @@ export function setupConfig(api: PluginApi): void {
|
|
|
400
391
|
dirty = patchAgent(config, pc) || dirty
|
|
401
392
|
dirty = patchGateway(config) || dirty
|
|
402
393
|
dirty = patchBrowser(config) || dirty
|
|
403
|
-
dirty = patchSessionMainKey(config, pc) || dirty
|
|
404
394
|
dirty = patchSession(config) || dirty
|
|
405
395
|
dirty = patchTts(config, pc) || dirty
|
|
406
396
|
dirty = patchWebSearch(config, pc) || dirty
|
|
@@ -145,11 +145,7 @@ export function registerClawhub2gateway(api: PluginApi) {
|
|
|
145
145
|
const defaultTimeoutMs = configNumber(cfg, 'defaultTimeoutMs', 60_000)
|
|
146
146
|
const configPath = configString(cfg, 'configPath')
|
|
147
147
|
|
|
148
|
-
const stateDir =
|
|
149
|
-
api.runtime.state?.resolveStateDir?.(process.env) ??
|
|
150
|
-
process.env.OPENCLAW_STATE_DIR ??
|
|
151
|
-
process.env.CLAWDBOT_STATE_DIR ??
|
|
152
|
-
''
|
|
148
|
+
const stateDir = api.runtime.state.resolveStateDir()
|
|
153
149
|
const defaultConfigPath = stateDir ? path.join(stateDir, 'clawhub', 'config.json') : ''
|
|
154
150
|
|
|
155
151
|
const resolveEnv = async (): Promise<Record<string, string | undefined>> => {
|
package/gateway/config-repair.ts
CHANGED
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
EXTRA_GATEWAY_MODELS,
|
|
14
14
|
PROVIDER_NAME,
|
|
15
15
|
readOpenclawConfig,
|
|
16
|
-
resolveStateDir,
|
|
17
16
|
writeOpenclawConfig,
|
|
18
17
|
} from '../model-gateway-setup'
|
|
19
18
|
|
|
@@ -21,7 +20,7 @@ export function registerConfigRepair(api: PluginApi) {
|
|
|
21
20
|
api.registerGatewayMethod('clawly.config.repair', async ({params, respond}) => {
|
|
22
21
|
const dryRun = params.dryRun === true
|
|
23
22
|
|
|
24
|
-
const stateDir = resolveStateDir(
|
|
23
|
+
const stateDir = api.runtime.state.resolveStateDir()
|
|
25
24
|
if (!stateDir) {
|
|
26
25
|
respond(true, {
|
|
27
26
|
...(dryRun ? {ok: false} : {repaired: false}),
|
package/gateway/memory.ts
CHANGED
|
@@ -40,10 +40,6 @@ function coercePluginConfig(api: PluginApi): Record<string, unknown> {
|
|
|
40
40
|
return isRecord(api.pluginConfig) ? api.pluginConfig : {}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
function resolveStateDir(api: PluginApi): string {
|
|
44
|
-
return api.runtime.state?.resolveStateDir?.(process.env) ?? process.env.OPENCLAW_STATE_DIR ?? ''
|
|
45
|
-
}
|
|
46
|
-
|
|
47
43
|
/** Read agents list from openclaw.json (cached). */
|
|
48
44
|
let _cachedAgentsList:
|
|
49
45
|
| Array<{id?: string; default?: boolean; workspace?: string}>
|
|
@@ -54,7 +50,7 @@ function readAgentsList(
|
|
|
54
50
|
): Array<{id?: string; default?: boolean; workspace?: string}> | null {
|
|
55
51
|
if (_cachedAgentsList !== undefined) return _cachedAgentsList
|
|
56
52
|
try {
|
|
57
|
-
const stateDir = resolveStateDir(
|
|
53
|
+
const stateDir = api.runtime.state.resolveStateDir()
|
|
58
54
|
if (!stateDir) {
|
|
59
55
|
_cachedAgentsList = null
|
|
60
56
|
return null
|
|
@@ -101,7 +97,7 @@ function resolveWorkspaceRoot(api: PluginApi, profile?: string): string {
|
|
|
101
97
|
if (agentWs) return agentWs
|
|
102
98
|
}
|
|
103
99
|
|
|
104
|
-
const stateDir = resolveStateDir(
|
|
100
|
+
const stateDir = api.runtime.state.resolveStateDir()
|
|
105
101
|
const baseDir =
|
|
106
102
|
process.env.OPENCLAW_WORKSPACE ??
|
|
107
103
|
readAgentWorkspace(api) ??
|
package/gateway/plugins.ts
CHANGED
|
@@ -27,10 +27,6 @@ interface NpmViewCache {
|
|
|
27
27
|
|
|
28
28
|
const npmCache = new LruCache<NpmViewCache>({maxSize: 5, ttlMs: 5 * 60 * 1000})
|
|
29
29
|
|
|
30
|
-
function resolveStateDir(api: PluginApi): string {
|
|
31
|
-
return api.runtime.state?.resolveStateDir?.(process.env) ?? process.env.OPENCLAW_STATE_DIR ?? ''
|
|
32
|
-
}
|
|
33
|
-
|
|
34
30
|
function readExtensionVersion(stateDir: string, pluginId: string): string | null {
|
|
35
31
|
try {
|
|
36
32
|
const pkgPath = path.join(stateDir, 'extensions', pluginId, 'package.json')
|
|
@@ -73,7 +69,7 @@ async function withPluginBackup<T>(
|
|
|
73
69
|
pluginId: string,
|
|
74
70
|
operation: () => Promise<T>,
|
|
75
71
|
): Promise<T> {
|
|
76
|
-
const stateDir = resolveStateDir(
|
|
72
|
+
const stateDir = api.runtime.state.resolveStateDir()
|
|
77
73
|
if (!stateDir) return operation()
|
|
78
74
|
|
|
79
75
|
const extensionDir = path.join(stateDir, 'extensions', pluginId)
|
|
@@ -145,7 +141,7 @@ export function registerPlugins(api: PluginApi) {
|
|
|
145
141
|
return
|
|
146
142
|
}
|
|
147
143
|
|
|
148
|
-
const stateDir = resolveStateDir(
|
|
144
|
+
const stateDir = api.runtime.state.resolveStateDir()
|
|
149
145
|
api.logger.info(`plugins.version: checking ${pluginId} (${npmPkgName})`)
|
|
150
146
|
let latestNpmVersion: string | null = null
|
|
151
147
|
let allNpmVersions: string[] = []
|
|
@@ -227,7 +223,7 @@ export function registerPlugins(api: PluginApi) {
|
|
|
227
223
|
let output = ''
|
|
228
224
|
|
|
229
225
|
if (strategy === 'force') {
|
|
230
|
-
const stateDir = resolveStateDir(
|
|
226
|
+
const stateDir = api.runtime.state.resolveStateDir()
|
|
231
227
|
if (!stateDir) throw new Error('cannot resolve openclaw state dir')
|
|
232
228
|
|
|
233
229
|
const configPath = path.join(stateDir, 'openclaw.json')
|
package/model-gateway-setup.ts
CHANGED
|
@@ -67,10 +67,6 @@ export const EXTRA_GATEWAY_MODELS: Array<{
|
|
|
67
67
|
},
|
|
68
68
|
]
|
|
69
69
|
|
|
70
|
-
export function resolveStateDir(api: PluginApi): string {
|
|
71
|
-
return api.runtime.state?.resolveStateDir?.(process.env) ?? process.env.OPENCLAW_STATE_DIR ?? ''
|
|
72
|
-
}
|
|
73
|
-
|
|
74
70
|
export function readOpenclawConfig(configPath: string): Record<string, unknown> {
|
|
75
71
|
try {
|
|
76
72
|
return JSON.parse(fs.readFileSync(configPath, 'utf-8'))
|
|
@@ -214,7 +210,7 @@ export function patchModelGateway(config: Record<string, unknown>, api: PluginAp
|
|
|
214
210
|
|
|
215
211
|
/** Standalone wrapper — reads config, patches, writes. Used by tests. */
|
|
216
212
|
export function setupModelGateway(api: PluginApi): void {
|
|
217
|
-
const stateDir = resolveStateDir(
|
|
213
|
+
const stateDir = api.runtime.state.resolveStateDir()
|
|
218
214
|
if (!stateDir) {
|
|
219
215
|
api.logger.warn('Cannot resolve state dir — model gateway setup skipped.')
|
|
220
216
|
return
|
package/openclaw.plugin.json
CHANGED
|
@@ -55,7 +55,6 @@
|
|
|
55
55
|
"workspaceDir": { "type": "string" },
|
|
56
56
|
"defaultModel": { "type": "string" },
|
|
57
57
|
"defaultImageModel": { "type": "string" },
|
|
58
|
-
"sessionMainKey": { "type": "string" },
|
|
59
58
|
"elevenlabsApiKey": { "type": "string" },
|
|
60
59
|
"elevenlabsVoiceId": { "type": "string" }
|
|
61
60
|
},
|
package/package.json
CHANGED