morpheus-cli 0.8.2 → 0.8.3
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/dist/devkit/registry.js +46 -1
- package/dist/http/api.js +31 -0
- package/dist/runtime/apoc.js +28 -11
- package/dist/runtime/audit/repository.js +132 -0
- package/dist/runtime/audit/types.js +1 -0
- package/dist/runtime/chronos/worker.js +20 -0
- package/dist/runtime/keymaker.js +22 -10
- package/dist/runtime/memory/sati/repository.js +1 -1
- package/dist/runtime/memory/sati/service.js +21 -0
- package/dist/runtime/memory/sqlite.js +73 -7
- package/dist/runtime/neo.js +27 -11
- package/dist/runtime/oracle.js +28 -1
- package/dist/runtime/smiths/delegator.js +30 -14
- package/dist/runtime/tasks/repository.js +15 -3
- package/dist/runtime/tasks/worker.js +79 -8
- package/dist/runtime/tools/apoc-tool.js +16 -1
- package/dist/runtime/tools/factory.js +42 -2
- package/dist/runtime/tools/neo-tool.js +16 -1
- package/dist/runtime/tools/smith-tool.js +17 -1
- package/dist/runtime/tools/trinity-tool.js +16 -1
- package/dist/runtime/trinity.js +25 -10
- package/dist/ui/assets/index-CZS235KG.js +177 -0
- package/dist/ui/assets/index-QQyZIsmH.css +1 -0
- package/dist/ui/index.html +2 -2
- package/dist/ui/sw.js +1 -1
- package/package.json +1 -1
- package/dist/ui/assets/index-C8uUR62u.css +0 -1
- package/dist/ui/assets/index-mIH_kbig.js +0 -117
package/dist/runtime/trinity.js
CHANGED
|
@@ -210,31 +210,46 @@ ${context ? `CONTEXT FROM ORACLE:\n${context}` : ''}
|
|
|
210
210
|
const userMessage = new HumanMessage(task);
|
|
211
211
|
const messages = [systemMessage, userMessage];
|
|
212
212
|
try {
|
|
213
|
+
const startMs = Date.now();
|
|
213
214
|
const response = await this.agent.invoke({ messages });
|
|
215
|
+
const durationMs = Date.now() - startMs;
|
|
214
216
|
const lastMessage = response.messages[response.messages.length - 1];
|
|
215
217
|
const content = typeof lastMessage.content === 'string'
|
|
216
218
|
? lastMessage.content
|
|
217
219
|
: JSON.stringify(lastMessage.content);
|
|
220
|
+
const rawUsage = lastMessage.usage_metadata
|
|
221
|
+
?? lastMessage.response_metadata?.usage
|
|
222
|
+
?? lastMessage.response_metadata?.tokenUsage
|
|
223
|
+
?? lastMessage.usage;
|
|
224
|
+
const inputTokens = rawUsage?.input_tokens ?? 0;
|
|
225
|
+
const outputTokens = rawUsage?.output_tokens ?? 0;
|
|
226
|
+
const stepCount = response.messages.filter((m) => m instanceof AIMessage).length;
|
|
218
227
|
const targetSession = sessionId ?? Trinity.currentSessionId ?? 'trinity';
|
|
219
228
|
const history = new SQLiteChatMessageHistory({ sessionId: targetSession });
|
|
220
229
|
try {
|
|
221
230
|
const persisted = new AIMessage(content);
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
persisted.provider_metadata = {
|
|
228
|
-
provider: trinityConfig.provider,
|
|
229
|
-
model: trinityConfig.model,
|
|
230
|
-
};
|
|
231
|
+
if (rawUsage)
|
|
232
|
+
persisted.usage_metadata = rawUsage;
|
|
233
|
+
persisted.provider_metadata = { provider: trinityConfig.provider, model: trinityConfig.model };
|
|
234
|
+
persisted.agent_metadata = { agent: 'trinity' };
|
|
235
|
+
persisted.duration_ms = durationMs;
|
|
231
236
|
await history.addMessage(persisted);
|
|
232
237
|
}
|
|
233
238
|
finally {
|
|
234
239
|
history.close();
|
|
235
240
|
}
|
|
236
241
|
this.display.log('Trinity task completed.', { source: 'Trinity' });
|
|
237
|
-
return
|
|
242
|
+
return {
|
|
243
|
+
output: content,
|
|
244
|
+
usage: {
|
|
245
|
+
provider: trinityConfig.provider,
|
|
246
|
+
model: trinityConfig.model,
|
|
247
|
+
inputTokens,
|
|
248
|
+
outputTokens,
|
|
249
|
+
durationMs,
|
|
250
|
+
stepCount,
|
|
251
|
+
},
|
|
252
|
+
};
|
|
238
253
|
}
|
|
239
254
|
catch (err) {
|
|
240
255
|
throw new ProviderError(trinityConfig.provider, err, 'Trinity task execution failed');
|