morpheus-cli 0.8.7 → 0.8.8

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.
@@ -7,6 +7,8 @@ import { ConfigManager } from '../../config/manager.js';
7
7
  import { ProviderFactory } from '../providers/factory.js';
8
8
  import { buildDevKit } from '../../devkit/index.js';
9
9
  import { SQLiteChatMessageHistory } from '../memory/sqlite.js';
10
+ import { AuditRepository } from '../audit/repository.js';
11
+ import { TaskRequestContext } from '../tasks/context.js';
10
12
  /**
11
13
  * SmithDelegator — delegates natural-language tasks to a specific Smith.
12
14
  *
@@ -70,6 +72,25 @@ export class SmithDelegator {
70
72
  connection.onMessage(progressHandler);
71
73
  try {
72
74
  const result = await connection.sendTask(taskId, localTool.name, args);
75
+ // Audit the remote tool execution — data already available from Smith's response
76
+ const sessionId = TaskRequestContext.get()?.session_id ?? 'smith';
77
+ const resultStr = result.data !== undefined
78
+ ? (typeof result.data === 'string' ? result.data : JSON.stringify(result.data))
79
+ : result.error;
80
+ const meta = { smith: smithName };
81
+ if (args && Object.keys(args).length > 0)
82
+ meta.args = args;
83
+ if (resultStr)
84
+ meta.result = resultStr.length > 500 ? resultStr.slice(0, 500) + '…' : resultStr;
85
+ AuditRepository.getInstance().insert({
86
+ session_id: sessionId,
87
+ event_type: 'tool_call',
88
+ agent: 'smith',
89
+ tool_name: `${smithName}/${localTool.name}`,
90
+ duration_ms: result.duration_ms,
91
+ status: result.success ? 'success' : 'error',
92
+ metadata: meta,
93
+ });
73
94
  if (result.success) {
74
95
  return typeof result.data === 'string'
75
96
  ? result.data
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "morpheus-cli",
3
- "version": "0.8.7",
3
+ "version": "0.8.8",
4
4
  "description": "Morpheus is a local AI agent for developers, running as a CLI daemon that connects to LLMs, local tools, and MCPs, enabling interaction via Terminal, Telegram, and Discord. Inspired by the character Morpheus from *The Matrix*, the project acts as an intelligent orchestrator, bridging the gap between the developer and complex systems.",
5
5
  "bin": {
6
6
  "morpheus": "./bin/morpheus.js"