chore: freeze v1.1.3 filing submission build (60 levels, full-screen safe layout)
This commit is contained in:
commit
96c19dca82
174 files changed
+37935
No files matched your search
@@ -0,0 +1,59 @@
|
||||
'use strict';
|
||||
|
||||
const { createActivityPreview, sanitizeActivityText } = require('./activity-preview');
|
||||
|
||||
class InteractionLog {
|
||||
constructor(limit = 200) {
|
||||
this.limit = limit;
|
||||
this.entries = [];
|
||||
}
|
||||
|
||||
add(toolName, status, summary, result, execution) {
|
||||
const preview = createActivityPreview(result);
|
||||
// Execution logs have their own bounded capture budget; do not run them
|
||||
// through the result array preview limit or silently turn them into a count.
|
||||
const script = execution && {
|
||||
context: execution.context,
|
||||
durationMs: execution.durationMs,
|
||||
logs: execution.logs.map((entry) => ({ level: entry.level, message: entry.message })),
|
||||
logsOmitted: execution.logsOmitted,
|
||||
};
|
||||
this.entries.unshift({
|
||||
toolName,
|
||||
status,
|
||||
summary: sanitizeActivityText(summary || '', 500),
|
||||
timestamp: new Date().toISOString(),
|
||||
...(preview === undefined ? {} : { preview }),
|
||||
...(script ? { execution: script } : {}),
|
||||
});
|
||||
|
||||
if (this.entries.length > this.limit) {
|
||||
this.entries.length = this.limit;
|
||||
}
|
||||
}
|
||||
|
||||
list(limit = 20) {
|
||||
return this.entries.slice(0, Math.max(1, limit));
|
||||
}
|
||||
|
||||
clear() {
|
||||
const count = this.entries.length;
|
||||
this.entries.length = 0;
|
||||
return count;
|
||||
}
|
||||
|
||||
summary(limit = 20) {
|
||||
const items = this.list(limit);
|
||||
if (!items.length) {
|
||||
return 'No MCP interactions recorded yet.';
|
||||
}
|
||||
|
||||
return items
|
||||
.map((entry) => `[${entry.timestamp}] ${entry.status.toUpperCase()} ${entry.toolName}: ${entry.summary}`)
|
||||
.join('\n');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
InteractionLog,
|
||||
};
|
||||
Reference in new issue
Block a user