taist 0.2.7 → 0.2.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.
@@ -391,18 +391,35 @@ export class ToonFormatter {
391
391
  formatTraceTree(traces, options = {}) {
392
392
  const maxGroups = options.maxGroups ?? 10;
393
393
  const showHeader = options.showHeader !== false;
394
+ const debug = process.env.TAIST_DEBUG === 'true';
394
395
  const lines = [];
395
396
 
396
397
  if (!traces || traces.length === 0) {
397
398
  return 'No traces collected';
398
399
  }
399
400
 
401
+ if (debug) {
402
+ console.log('[formatter] Total traces:', traces.length);
403
+ for (const t of traces) {
404
+ console.log('[formatter] trace:', t.name, 'depth:', t.depth, 'correlationId:', t.correlationId);
405
+ }
406
+ }
407
+
400
408
  // Sort by timestamp
401
409
  const sorted = [...traces].sort((a, b) => a.timestamp - b.timestamp);
402
410
 
403
411
  // Group by traceId
404
412
  const groups = this.groupTracesByRequest(sorted);
405
413
 
414
+ if (debug) {
415
+ console.log('[formatter] Groups:', groups.size);
416
+ for (const [id, groupTraces] of groups) {
417
+ console.log('[formatter] Group', id, ':', groupTraces.length, 'traces');
418
+ const root = groupTraces.find(t => t.depth === 0);
419
+ console.log('[formatter] root:', root?.name || 'none (using "Request")');
420
+ }
421
+ }
422
+
406
423
  if (showHeader) {
407
424
  lines.push('='.repeat(60));
408
425
  lines.push('TRACE OUTPUT');
@@ -120,19 +120,31 @@ export class TraceCollector extends EventEmitter {
120
120
  }
121
121
 
122
122
  _addTrace(trace) {
123
+ const debug = process.env.TAIST_DEBUG === 'true';
124
+
123
125
  // Generate trace ID for deduplication
124
126
  const traceId =
125
127
  trace.id || `${trace.name}-${trace.timestamp}-${trace.type}`;
126
128
 
127
129
  if (this.traceIds.has(traceId)) {
130
+ if (debug) {
131
+ console.log('[collector] DUPLICATE:', trace.name, 'id:', traceId);
132
+ }
128
133
  return; // Duplicate
129
134
  }
130
135
 
131
136
  // Apply filter
132
137
  if (!this.filter(trace)) {
138
+ if (debug) {
139
+ console.log('[collector] FILTERED:', trace.name);
140
+ }
133
141
  return; // Filtered out
134
142
  }
135
143
 
144
+ if (debug) {
145
+ console.log('[collector] RECEIVED:', trace.name, 'depth:', trace.depth, 'correlationId:', trace.correlationId);
146
+ }
147
+
136
148
  // Enforce max traces (circular buffer behavior)
137
149
  if (this.traces.length >= this.maxTraces) {
138
150
  const removed = this.traces.shift();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taist",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "Token-Optimized Testing Framework for AI-Assisted Development",
5
5
  "main": "index.js",
6
6
  "type": "module",