principles-disciple 1.54.0 → 1.55.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/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* SAFETY:
|
|
16
16
|
* - Never load entire file (tail-only, max 512KB)
|
|
17
17
|
* - Skip lines > 100KB (real files have 11MB single lines)
|
|
18
|
-
* - Cap total output at
|
|
18
|
+
* - Cap total output at 2000 chars
|
|
19
19
|
* - All errors caught silently — return empty string on failure
|
|
20
20
|
*/
|
|
21
21
|
|
|
@@ -35,9 +35,9 @@ const TAIL_READ_SIZE = 512_000; // 512KB
|
|
|
35
35
|
/** Max turns to extract */
|
|
36
36
|
const MAX_TURNS = 8;
|
|
37
37
|
/** Max chars per turn entry */
|
|
38
|
-
const MAX_TURN_CHARS =
|
|
38
|
+
const MAX_TURN_CHARS = 400;
|
|
39
39
|
/** Max total output */
|
|
40
|
-
const MAX_OUTPUT_CHARS =
|
|
40
|
+
const MAX_OUTPUT_CHARS = 2000;
|
|
41
41
|
|
|
42
42
|
/** Valid characters for session IDs and agent IDs — prevents path traversal */
|
|
43
43
|
const SAFE_ID_REGEX = /^[a-zA-Z0-9_-]+$/;
|
|
@@ -155,19 +155,24 @@ function extractTurn(msg: ParsedMessage): string | null {
|
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
if (msg.role === 'assistant') {
|
|
158
|
-
|
|
158
|
+
const parts: string[] = [];
|
|
159
|
+
|
|
160
|
+
// Priority 1: final text reply (if present)
|
|
159
161
|
if (msg.textParts.length > 0) {
|
|
160
162
|
const text = msg.textParts.join(' ').trim();
|
|
161
|
-
if (text)
|
|
163
|
+
if (text) parts.push(`[Assistant]: ${text.substring(0, MAX_TURN_CHARS)}`);
|
|
162
164
|
}
|
|
163
|
-
|
|
165
|
+
|
|
166
|
+
// Priority 2: tool call summary (always include if present, for context)
|
|
164
167
|
if (msg.toolCalls.length > 0) {
|
|
165
168
|
const tools = msg.toolCalls.map(tc => tc.name).filter(Boolean);
|
|
166
169
|
const uniqueTools = [...new Set(tools)];
|
|
167
170
|
if (uniqueTools.length > 0) {
|
|
168
|
-
|
|
171
|
+
parts.push(`[Assistant → ${uniqueTools.join(', ')}]`);
|
|
169
172
|
}
|
|
170
173
|
}
|
|
174
|
+
|
|
175
|
+
return parts.length > 0 ? parts.join(' ') : null;
|
|
171
176
|
}
|
|
172
177
|
|
|
173
178
|
if (msg.role === 'toolResult') {
|
|
@@ -179,8 +179,16 @@ export async function auditEventLogs(
|
|
|
179
179
|
recentEntries: recent,
|
|
180
180
|
});
|
|
181
181
|
|
|
182
|
-
// Determine primary path
|
|
183
|
-
|
|
182
|
+
// Determine primary path - prefer configured workspace over workspace-main
|
|
183
|
+
// The configured workspace path is {openclawDir}/workspace (without -main suffix)
|
|
184
|
+
const workspaceDir = path.join(openclawDir, 'workspace') + path.sep;
|
|
185
|
+
const workspaceMainDir = path.join(openclawDir, 'workspace-main') + path.sep;
|
|
186
|
+
|
|
187
|
+
if (filePath.startsWith(workspaceDir)) {
|
|
188
|
+
// Configured workspace (e.g., ~/.openclaw/workspace/) takes priority
|
|
189
|
+
primaryPath = filePath;
|
|
190
|
+
} else if (!primaryPath && filePath.startsWith(workspaceMainDir)) {
|
|
191
|
+
// Fallback to workspace-main only if no configured workspace found yet
|
|
184
192
|
primaryPath = filePath;
|
|
185
193
|
}
|
|
186
194
|
} catch {
|