@2en/clawly-plugins 1.17.5 → 1.17.6
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/memory.ts +8 -2
- package/package.json +1 -1
package/gateway/memory.ts
CHANGED
|
@@ -45,8 +45,13 @@ function resolveStateDir(api: PluginApi): string {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
/** Read agents list from openclaw.json (cached). */
|
|
48
|
-
let _cachedAgentsList:
|
|
49
|
-
|
|
48
|
+
let _cachedAgentsList:
|
|
49
|
+
| Array<{id?: string; default?: boolean; workspace?: string}>
|
|
50
|
+
| null
|
|
51
|
+
| undefined
|
|
52
|
+
function readAgentsList(
|
|
53
|
+
api: PluginApi,
|
|
54
|
+
): Array<{id?: string; default?: boolean; workspace?: string}> | null {
|
|
50
55
|
if (_cachedAgentsList !== undefined) return _cachedAgentsList
|
|
51
56
|
try {
|
|
52
57
|
const stateDir = resolveStateDir(api)
|
|
@@ -76,6 +81,7 @@ function readAgentWorkspace(api: PluginApi, agentId?: string): string | null {
|
|
|
76
81
|
let agent: (typeof agents)[number] | undefined
|
|
77
82
|
if (agentId) {
|
|
78
83
|
agent = agents.find((a) => a.id === agentId)
|
|
84
|
+
if (!agent) return null
|
|
79
85
|
}
|
|
80
86
|
if (!agent) {
|
|
81
87
|
agent = agents.find((a) => a.default) ?? agents[0]
|