OpenWriterControle/evals/framework/inspect-real-session.js
darrenhinde 478c8e3e85 feat: implement SDK-based evaluation framework with real agent testing
- Replace planned framework with working SDK implementation using @opencode-ai/sdk
- Add 6 YAML test cases across developer/business/edge-case categories (100% passing)
- Implement 4 evaluators for openagent.md rule compliance (approval-gate, context-loading, delegation, tool-usage)
- Add real-time event streaming and session recording
- Configure opencode/grok-code-fast as default model (zero API costs)
- Add comprehensive documentation (SDK_EVAL_README.md, test-design-guide.md, TEST_SCENARIOS.md)
- Support v2 schema with behavior-based expectations instead of message counts
- Enable model-agnostic test design that works across Claude, GPT-4, and Grok
- Add subagent invocation syntax documentation to openagent.md
2025-11-22 14:30:11 +00:00

54 lines
1.7 KiB
JavaScript

/**
* Inspect a real session to understand the data structure
*/
const {
createConfig,
SessionReader,
TimelineBuilder,
MessageParser
} = require('./dist');
async function main() {
const config = createConfig({
projectPath: '/Users/darrenhinde/Documents/GitHub/opencode-agents'
});
const sessionReader = new SessionReader(config.projectPath, config.sessionStoragePath);
const timelineBuilder = new TimelineBuilder(sessionReader);
const sessions = sessionReader.listSessions();
// Find session with execution tools
for (const session of sessions.slice(0, 20)) {
const timeline = timelineBuilder.buildTimeline(session.id);
const execTools = timeline.filter(e =>
e.type === 'tool_call' &&
['bash', 'write', 'edit', 'task'].includes(e.data?.tool)
);
if (execTools.length > 0) {
console.log('Found session with execution tools:');
console.log(`Session ID: ${session.id}`);
console.log(`Title: ${session.title.substring(0, 60)}...`);
console.log(`\nTimeline (${timeline.length} events):\n`);
timeline.slice(0, 10).forEach((event, idx) => {
console.log(`${idx + 1}. [${event.type}] @ ${event.timestamp}`);
if (event.type === 'text') {
console.log(` Text: ${(event.data?.text || '').substring(0, 80)}...`);
} else if (event.type === 'tool_call') {
console.log(` Tool: ${event.data?.tool}`);
console.log(` Input: ${JSON.stringify(event.data?.input || {}).substring(0, 80)}...`);
}
});
console.log('\n\nFull timeline structure (first event):');
console.log(JSON.stringify(timeline[0], null, 2));
break;
}
}
}
main().catch(console.error);