agents-dojo 0.1.7 → 0.1.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.
@@ -4,7 +4,6 @@ import { a2aToContentBlocks } from './part-mapper.js';
4
4
  import { runClaude } from './claude-bridge.js';
5
5
  import { createTranslator } from './event-translator.js';
6
6
  import { recordTaskStart, recordTaskEnd } from './metrics.js';
7
- import { logConversation, AgentConversationLogger } from './agent-logger.js';
8
7
  // ── Global concurrency limiter ─────────────────────────────
9
8
  // Prevents CPU overload by limiting simultaneous Claude SDK processes.
10
9
  const MAX_CONCURRENT = 3;
@@ -125,11 +124,6 @@ export class DojoAgentExecutor {
125
124
  this.controllers.set(taskId, controller);
126
125
  this.contextIds.set(taskId, contextId);
127
126
  // 4. Run Claude (iterate events)
128
- const startTime = Date.now();
129
- let finalResponse = '';
130
- let taskState = 'completed';
131
- // Full SDK conversation logger — captures every message for transparency
132
- const sdkLogger = new AgentConversationLogger(this.agent.agentDir, this.agent.manifest.id, taskId);
133
127
  try {
134
128
  for await (const sdkMsg of runClaude({
135
129
  agent: this.agent,
@@ -138,19 +132,11 @@ export class DojoAgentExecutor {
138
132
  resume: this.sessionId,
139
133
  onEvent: (m) => {
140
134
  translator.onSdkEvent(m);
141
- sdkLogger.onSdkMessage(m);
142
135
  const msg = m;
143
136
  // Capture session_id for cross-call continuity
144
137
  if (msg.session_id && typeof msg.session_id === 'string') {
145
138
  this.sessionId = msg.session_id;
146
139
  }
147
- // Capture final text for summary log
148
- if (msg.type === 'assistant' && msg.message?.content) {
149
- for (const block of msg.message.content) {
150
- if (block.type === 'text')
151
- finalResponse = block.text;
152
- }
153
- }
154
140
  },
155
141
  abortController: controller,
156
142
  })) {
@@ -160,11 +146,9 @@ export class DojoAgentExecutor {
160
146
  }
161
147
  catch (err) {
162
148
  recordTaskEnd(false);
163
- taskState = 'failed';
164
149
  const isAbort = controller.signal.aborted || (err instanceof Error && /abort/i.test(err.message));
165
150
  if (!isAbort) {
166
151
  const reason = err instanceof Error ? err.message : String(err);
167
- finalResponse = `Error: ${reason}`;
168
152
  eventBus.publish({
169
153
  kind: 'status-update',
170
154
  taskId,
@@ -191,18 +175,6 @@ export class DojoAgentExecutor {
191
175
  releaseSlot();
192
176
  this.controllers.delete(taskId);
193
177
  this.contextIds.delete(taskId);
194
- // Flush full SDK conversation log (all LLM interactions)
195
- sdkLogger.flush(taskState, Date.now() - startTime);
196
- // Also save summary log
197
- logConversation(this.agent.agentDir, {
198
- taskId,
199
- agentId: this.agent.manifest.id,
200
- timestamp: new Date().toISOString(),
201
- userMessage: extractPreview(userMessage.parts),
202
- agentResponse: finalResponse.slice(0, 500),
203
- state: taskState,
204
- durationMs: Date.now() - startTime,
205
- });
206
178
  }
207
179
  }
208
180
  /**
@@ -3,6 +3,9 @@ import react from '@vitejs/plugin-react';
3
3
 
4
4
  export default defineConfig({
5
5
  plugins: [react()],
6
+ optimizeDeps: {
7
+ include: ['pixi.js', 'eventemitter3', 'react', 'react-dom', 'react-dom/client', 'react/jsx-runtime', 'react/jsx-dev-runtime', 'zustand'],
8
+ },
6
9
  server: {
7
10
  port: 5173,
8
11
  proxy: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agents-dojo",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "A2A-compatible Agent framework built on Claude Code SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,26 +0,0 @@
1
- /**
2
- * A logger that captures every SDK message for a single task.
3
- * Create one per task, call .onSdkMessage() for each message,
4
- * then .flush() when the task completes.
5
- */
6
- export declare class AgentConversationLogger {
7
- private agentDir;
8
- private agentId;
9
- private taskId;
10
- private messages;
11
- constructor(agentDir: string, agentId: string, taskId: string);
12
- /** Record a raw SDK message (assistant, user, result, etc.) */
13
- onSdkMessage(msg: unknown): void;
14
- /** Write all captured messages to the agent's log file. */
15
- flush(state: 'completed' | 'failed' | 'canceled', durationMs: number): void;
16
- }
17
- export interface ConversationEntry {
18
- taskId: string;
19
- agentId: string;
20
- timestamp: string;
21
- userMessage: string;
22
- agentResponse: string;
23
- state: 'completed' | 'failed';
24
- durationMs: number;
25
- }
26
- export declare function logConversation(agentDir: string, entry: ConversationEntry): void;
@@ -1,63 +0,0 @@
1
- // src/agent-logger.ts
2
- // Saves the complete LLM conversation (all SDK messages) for each agent task.
3
- import { appendFileSync, mkdirSync } from 'fs';
4
- import { join } from 'path';
5
- function todayStr() {
6
- return new Date().toISOString().slice(0, 10);
7
- }
8
- /**
9
- * A logger that captures every SDK message for a single task.
10
- * Create one per task, call .onSdkMessage() for each message,
11
- * then .flush() when the task completes.
12
- */
13
- export class AgentConversationLogger {
14
- agentDir;
15
- agentId;
16
- taskId;
17
- messages = [];
18
- constructor(agentDir, agentId, taskId) {
19
- this.agentDir = agentDir;
20
- this.agentId = agentId;
21
- this.taskId = taskId;
22
- }
23
- /** Record a raw SDK message (assistant, user, result, etc.) */
24
- onSdkMessage(msg) {
25
- this.messages.push({
26
- timestamp: new Date().toISOString(),
27
- type: msg?.type ?? 'unknown',
28
- data: msg,
29
- });
30
- }
31
- /** Write all captured messages to the agent's log file. */
32
- flush(state, durationMs) {
33
- const logDir = join(this.agentDir, 'log');
34
- mkdirSync(logDir, { recursive: true });
35
- const file = join(logDir, `${todayStr()}.jsonl`);
36
- const entry = {
37
- taskId: this.taskId,
38
- agentId: this.agentId,
39
- timestamp: new Date().toISOString(),
40
- state,
41
- durationMs,
42
- messageCount: this.messages.length,
43
- messages: this.messages,
44
- };
45
- try {
46
- appendFileSync(file, JSON.stringify(entry) + '\n');
47
- }
48
- catch (err) {
49
- console.error(`[agent-logger] Failed to write to ${file}:`, err);
50
- }
51
- }
52
- }
53
- export function logConversation(agentDir, entry) {
54
- const logDir = join(agentDir, 'log');
55
- mkdirSync(logDir, { recursive: true });
56
- const file = join(logDir, `${todayStr()}.jsonl`);
57
- try {
58
- appendFileSync(file, JSON.stringify(entry) + '\n');
59
- }
60
- catch (err) {
61
- console.error(`[agent-logger] Failed to write:`, err);
62
- }
63
- }